/*! For license information please see mng-digisubs.main.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";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(V(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(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(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)||V(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 Y(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(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<=k)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(V(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 A(this,e,t,n);case"ascii":case"latin1":case"binary":return E(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 k=4096;function O(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){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 U(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 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){H(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){H(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 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 G.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function H(e,t){if("number"!=typeof e)throw new G.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new G.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new G.ERR_BUFFER_OUT_OF_BOUNDS;throw new G.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}W("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W("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=j(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=j(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 Y(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function V(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)}},467(e,t,n){"use strict";function r(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 o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)})}}n.d(t,{A:()=>o})},3029(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>r})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(9922);function o(e,t){for(var n=0;no});var r=n(9922);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},2327(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(2284);function o(e,t){if("object"!=(0,r.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=(0,r.A)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}},9922(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(2284),o=n(2327);function i(e){var t=(0,o.A)(e,"string");return"symbol"==(0,r.A)(t)?t:t+""}},2284(e,t,n){"use strict";function r(e){return r="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},r(e)}n.d(t,{A:()=>r})},1834(e,t,n){"use strict";n.d(t,{A:()=>l});var r=n(467),o=n(3029),i=n(2901),a=n(4467),s=n(4756),c=n(3153);window.disableAuth0AuthFlow=!0;var u=function(){function e(){var t,n;(0,o.A)(this,e),(0,a.A)(this,"readyInstances",new Map),(0,a.A)(this,"connextAlreadyRan",!1),(0,a.A)(this,"eventListeners",{}),(0,a.A)(this,"runConnextIfSilentTimer",void 0),(0,a.A)(this,"runningSophi","1"===(null===(t=window.authentication_config)||void 0===t?void 0:t.sophiSDKEnabled)||"1"===(null===(n=window.authentication_config)||void 0===n?void 0:n.sophiOnDevice))}return(0,i.A)(e,[{key:"init",value:function(){this.setupRunTimer()}},{key:"setupRunTimer",value:function(){var t=this;this.runConnextIfSilentTimer=setTimeout((0,r.A)(s.mark(function n(){return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t.connextReady("onInit",1e3*e.defaultTimeoutLength);case 1:n.sent&&(c.A.log("".concat(e.defaultTimeoutLength," second Connext timer is up.")),t.rerunConnextEntitlements());case 2:case"end":return n.stop()}},n)})),1e3*e.defaultTimeoutLength)}},{key:"connextReady",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onInit",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,o=this.readyInstances.get(n);if(o)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(o.status,".")),"pending"===o.status&&r0&&void 0!==o[0]&&o[0],r=o.length>1&&void 0!==o[1]&&!o[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",r);case 1:if(t.sent){t.next=2;break}return t.abrupt("return");case 2:if(Connext&&!this.connextAlreadyRan){t.next=3;break}return t.abrupt("return");case 3:n&&Connext.GetOptions().Silentmode?this.runConnext():n?c.A.log("Not rerunning Connext"):this.runConnext();case 4:case"end":return t.stop()}},t,this)})),function(){return n.apply(this,arguments)})},{key:"runConnextIfSilent",value:(t=(0,r.A)(s.mark(function t(){var n;return s.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.connextReady("onInit",1e3*e.backupTimeoutLength);case 1:if(n=t.sent,!this.runningSophi&&!this.connextAlreadyRan){t.next=2;break}return t.abrupt("return");case 2:n&&"undefined"!=typeof Connext&&Connext.GetOptions().Silentmode&&(c.A.log("Silent mode, running Connext now."),this.rerunConnextEntitlements());case 3:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})},{key:"removeEventListener",value:function(e){this.eventListeners[e]?(document.removeEventListener(e,this.eventListeners[e]),delete this.eventListeners[e],c.A.log('Connext removed event listener for "'.concat(e,'".'))):c.A.log('No event listener to remove for "'.concat(e,'".'))}}]);var t,n}();(0,a.A)(u,"defaultTimeoutLength",300),(0,a.A)(u,"backupTimeoutLength",1e5),(0,a.A)(u,"subTimeoutInterval",5e3),window.ConnextUtils=window.ConnextUtils||new u;const l=u},3153(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(3612);const o={log:function(){if(r.A.debug){for(var e,t=arguments.length,n=new Array(t),o=0;oc}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>Ks,hasStandardBrowserEnv:()=>Fs,hasStandardBrowserWebWorkerEnv:()=>Xs,navigator:()=>Hs,origin:()=>Js});var t=n(467),r=n(4756),o=n(3612),i=n(3153),a=n(2284);function s(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 f(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);oe.length)&&(t=e.length);for(var n=0,r=Array(t);nDate.now(),x="default";class U extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,U.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new U(t,n)}}class D extends U{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,D.prototype)}}class M extends U{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,M.prototype)}}class B extends U{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,B.prototype)}}class G extends B{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,G.prototype)}}class W extends U{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,W.prototype)}}class j extends U{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,j.prototype)}}class K extends U{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,K.prototype)}}class H extends U{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(J(e,["default"]),"', scope: '").concat(J(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,H.prototype)}}class F extends U{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(J(e,["default"]),"', missing scope: '").concat(J(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,F.prototype)}}class X extends U{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,X.prototype)}}function J(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const Y=()=>window.crypto,Z=()=>{let e="";for(;e.length<43;){const t=Y().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},V=e=>btoa(e),z=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],q=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=z.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},Q=e=>{var t=e.clientId,n=f(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()},$=async e=>{const t=Y().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},ee=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),te=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 ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},re={},oe={};Object.defineProperty(oe,"__esModule",{value:!0});var ie=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}();oe.default=function(){return ie.getInstance()};var ae=ne&&ne.__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())})},se=ne&&ne.__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 ae(this,void 0,void 0,function(){return se(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 ae(this,void 0,void 0,function(){var n,r,o,i;return se(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?de:this.storageHandler,r=le+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,ue.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),ue.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 B;throw e}}}class ye{constructor(){this.activeLocks=new Set,this.lock=new me,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 B;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 we=null;const be=new TextEncoder,ve=new TextDecoder;function Ae(e){return"string"==typeof e?be.encode(e):ve.decode(e)}function Ee(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new Re(`${e.name} modulusLength must be at least 2048 bits`)}let Se;if(Uint8Array.prototype.toBase64)Se=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Se=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),Ue=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},De=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:C;return o?(async(e,t,n,r,o,i,a,s,c)=>xe({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s,skipTokenStorage:c},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0):(async(e,t,n)=>{const r=await Ue(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let n=k(t,2),r=n[0],o=n[1];return e[r]=o,e},{}))};var o})(e,r,a)};async function Me(e,t,n,r,o,i,a,s,c,u,l){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 d,h=null;for(let c=0;c<3;c++)try{d=await De(e,n,r,o,i,a,t,s,l),h=null;break}catch(e){h=e}if(h)throw h;const p=d.json,m=p.error,g=p.error_description,y=f(p,["error","error_description"]),w=d,b=w.headers,v=w.ok;let A;if(c&&(A=b[Pe],A&&await c.setNonce(A)),!v){const d=g||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===m)throw new K(m,d,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===m)throw new H(n,r);if("use_dpop_nonce"===m){if(!c||!A||u)throw new X(A);return Me(e,t,n,r,o,i,a,s,c,!0,l)}throw new U(m||"request_error",d)}return y}async function Be(e,t,n){var r=e.baseUrl,o=e.timeout,i=e.audience,a=e.scope,s=e.auth0Client,c=e.useFormData,u=e.useMrrt,l=e.dpop,d=f(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const h="urn:ietf:params:oauth:grant-type:token-exchange"===d.grant_type,p="refresh_token"===d.grant_type&&u,m=Object.assign(Object.assign(Object.assign(Object.assign({},d),h&&i&&{audience:i}),h&&a&&{scope:a}),p&&{audience:i,scope:a}),g=c?Q(m):JSON.stringify(m),y=(w=d.grant_type,Le.includes(w));var w;return await Me("".concat(r,"/oauth/token"),o,i||x,a,{method:"POST",body:g,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(q(s||P)))}},t,c,u,y?l:void 0,void 0,n)}const Ge=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[x]),Ge(r,t)},je="@@auth0spajs@@",Ke="@@user@@";class He{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:je,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=k(e.split("::"),4),n=t[0],r=t[1],o=t[2],i=t[3];return new He({clientId:r,scope:i,audience:o},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,r=e.client_id;return new He({scope:t,audience:n,clientId:r})}}class Fe{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(je))}}class Xe{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class Je{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||L}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=He.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/1e3);return i.expiresAt-t!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new He({clientId:e},je,Ke).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=He.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===je&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=He.fromKey(r);if(t.prefix===je&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=He.fromKey(i);if(r.prefix===je&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class Ye{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 Ze=e=>"number"==typeof e,Ve=["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 ze=ne&&ne.__assign||function(){return ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;nnt.get(e)||nt.get("".concat(rt).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),et("".concat(rt).concat(e),JSON.stringify(t),r),nt.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),tt(e,n),nt.remove(e,t),nt.remove("".concat(rt).concat(e),t)}},it={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 at;!function(e){e.Code="code",e.ConnectCode="connect_code"}(at||(at={}));var st,ct=function(e){return st=st||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 Xe).enclosedCache,localstorage:()=>new Fe},pt=e=>ht[e],ft=e=>{const t=e.openUrl,n=e.onRedirect,r=f(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},mt=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},gt={NONCE:"nonce",KEYPAIR:"keypair"};class yt{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(gt).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(gt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(gt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(gt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(gt.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());await Promise.all((null==n?void 0: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(gt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(gt.KEYPAIR,this.clientId)}}class wt{constructor(e){this.storage=new yt(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 t=e.keyPair,n=e.url,r=e.method,o=e.nonce,i=e.accessToken;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return Ce(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!Ie(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 Ne(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 _e("unsupported JWK kty")}return Te(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 bt;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(bt||(bt={}));class vt{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]:bt.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?bt.DPoP:bt.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===bt.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,Pe);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new X(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class At{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Et({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Et(t)}}class Et extends Error{constructor(e){let t=e.type,n=e.status,r=e.title,o=e.detail,i=e.validation_errors;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,Et.prototype)}}const St={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var Tt,_t;let Rt;if("undefined"==typeof navigator||null===(Tt=navigator.userAgent)||void 0===Tt||null===(_t=Tt.startsWith)||void 0===_t||!_t.call(Tt,"Mozilla/5.0 ")){const e="v3.8.6";Rt="".concat("oauth4webapi","/").concat(e)}function kt(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Ot="ERR_INVALID_ARG_VALUE",It="ERR_INVALID_ARG_TYPE";function Ct(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const Nt=Symbol(),Pt=Symbol(),Lt=Symbol(),xt=Symbol(),Ut=Symbol(),Dt=Symbol(),Mt=new TextEncoder,Bt=new TextDecoder;function Gt(e){return"string"==typeof e?Mt.encode(e):Bt.decode(e)}let Wt,jt;if(Uint8Array.prototype.toBase64)Wt=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Wt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Ct("The input to be decoded is not correctly encoded.",Ot,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 Ct("".concat(n," must be a non-negative number"),Ot,o);return}throw Ct("".concat(n," must be a positive number"),Ot,o)}catch(e){if(r)throw Xt(e.message,r,o);throw e}}function qt(e,t,n,r){try{if("string"!=typeof e)throw Ct("".concat(t," must be a string"),It,r);if(0===e.length)throw Ct("".concat(t," must not be empty"),Ot,r)}catch(e){if(n)throw Xt(e.message,n,r);throw e}}function Qt(e){!function(e,t){if(_n(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return Xt(t,Jn,e)}(e,t)}(e,"application/json")}function $t(){return Kt(crypto.getRandomValues(new Uint8Array(32)))}function en(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 Ht("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 Ht("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 Ht("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 Ht("unsupported CryptoKey algorithm name",{cause:e})}}function tn(e){const t=null==e?void 0:e[Pt];return"number"==typeof t&&Number.isFinite(t)?t:0}function nn(e){const t=null==e?void 0:e[Lt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function rn(){return Math.floor(Date.now()/1e3)}function on(e){if("object"!=typeof e||null===e)throw Ct('"as" must be an object',It);qt(e.issuer,'"as.issuer"')}function an(e){if("object"!=typeof e||null===e)throw Ct('"client" must be an object',It);qt(e.client_id,'"client.client_id"')}function sn(e){return qt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function cn(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&qt(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Ct("".concat(t," must be a CryptoKey"),It)}(e,t),"private"!==e.type)throw Ct("".concat(t," must be a private CryptoKey"),Ot)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:en(r),kid:o},u=function(e,t){const n=rn()+tn(t);return{jti:$t(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===(s=t[Ut])||void 0===s||s.call(t,c,u),i.set("client_id",n.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 Ct('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Ot);const r="".concat(Kt(Gt(JSON.stringify(e))),".").concat(Kt(Gt(JSON.stringify(t)))),o=Kt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:rr(e)};case"RSA-PSS":switch(nr(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 Ht("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return nr(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Ht("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Gt(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const un=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function ln(e,t){if(t&&"https:"!==e.protocol)throw Xt("only requests to HTTPS are allowed",Zn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Xt("only HTTP and HTTPS requests are allowed",Vn,e)}function dn(e,t,n,r){let o;if("string"!=typeof e||!(o=un(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?$n:er,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return ln(o,r),o}function hn(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?dn(e.mtls_endpoint_aliases[t],t,n,r):dn(e[t],t,n,r)}class pn extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"status",void 0),S(this,"error_description",void 0),S(this,"response",void 0),this.name=this.constructor.name,this.code=jn,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 fn extends Error{constructor(e,t){var n,r;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"error_description",void 0),this.name=this.constructor.name,this.code=Hn,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 mn extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"response",void 0),S(this,"status",void 0),this.name=this.constructor.name,this.code=Wn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const gn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",yn="("+gn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',wn="("+gn+")\\s*=\\s*("+gn+")",bn=new RegExp("^[,\\s]*("+gn+")"),vn=new RegExp("^[,\\s]*"+yn+"[,\\s]*(.*)"),An=new RegExp("^[,\\s]*"+wn+"[,\\s]*(.*)"),En=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Sn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!kt(e,Response))throw Ct('"response" must be an instance of Response',It);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(bn);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let p;if(d)for(;r;){let n,o;if(t=r.match(vn)){var i=k(t,4);if(n=i[1],o=i[2],r=i[3],o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}h[n.toLowerCase()]=o}else{if(!(t=r.match(An))){if(t=r.match(En)){if(Object.keys(h).length)break;var a=k(t,3);p=a[1],r=a[2];break}return}var s=k(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new mn("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){tr(e),Qt(e);try{const t=await e.clone().json();if(Jt(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 pn("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)"),Yn,e)}}function Tn(e){if(!xn.has(e))throw Ct('"options.DPoP" is not a valid DPoPHandle',Ot)}function _n(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function Rn(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[xt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Zt(r,null==a?void 0:a.signal)})}async function kn(e,t,n,r,o,i){var a;const s=hn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Nt]));o.set("grant_type",r);const c=Yt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Tn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Rn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const On=new WeakMap,In=new WeakMap;function Cn(e){if(!e.id_token)return;const t=On.get(e);if(!t)throw Ct('"ref" was already garbage collected or did not resolve from the proper sources',Ot);return t}async function Nn(e,t,n,r,o,i){if(on(e),an(t),!kt(n,Response))throw Ct('"response" must be an instance of Response',It);await Sn(n,200,"Token Endpoint"),tr(n);const a=await cr(n);if(qt(a.access_token,'"response" body "access_token" property',Xn,{body:a}),qt(a.token_type,'"response" body "token_type" property',Xn,{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;zt(e,!0,'"response" body "expires_in" property',Xn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&qt(a.refresh_token,'"response" body "refresh_token" property',Xn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Xt('"response" body "scope" property must be a string',Xn,{body:a});if(void 0!==a.id_token){qt(a.id_token,'"response" body "id_token" property',Xn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(zt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await async function(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new Ht("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw Xt("Invalid JWT",Xn,e);try{i=JSON.parse(Gt(Kt(c)))}catch(e){throw Xt("failed to parse JWT Header body as base64url encoded JSON",Fn,e)}if(!Jt(i))throw Xt("JWT Header must be a top level object",Xn,e);if(t(i),void 0!==i.crit)throw new Ht('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Gt(Kt(u)))}catch(e){throw Xt("failed to parse JWT Payload body as base64url encoded JSON",Fn,e)}if(!Jt(a))throw Xt("JWT Payload must be a top level object",Xn,e);const h=rn()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Xt('unexpected JWT "exp" (expiration time) claim type',Xn,{claims:a});if(a.exp<=h-r)throw Xt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',zn,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Xt('unexpected JWT "iat" (issued at) claim type',Xn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Xt('unexpected JWT "iss" (issuer) claim type',Xn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Xt('unexpected JWT "nbf" (not before) claim type',Xn,{claims:a});if(a.nbf>h+r)throw Xt('unexpected JWT "nbf" (not before) claim value',zn,{claims:a,now:h,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',Xn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,or.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),tn(t),nn(t),o).then(Mn.bind(void 0,i)).then(Ln.bind(void 0,e)).then(Pn.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw Xt('ID Token "aud" (audience) claim includes additional untrusted audiences',qn,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw Xt('unexpected ID Token "azp" (authorized party) claim value',qn,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&zt(c.auth_time,!0,'ID Token "auth_time" (authentication time)',Xn,{claims:c}),In.set(n,u),On.set(a,c)}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 Ht("unsupported `token_type` value",{cause:{body:a}});return a}function Pn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Xt('unexpected JWT "aud" (audience) claim value',qn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Xt('unexpected JWT "aud" (audience) claim value',qn,{expected:e,claims:t.claims,claim:"aud"});return t}function Ln(e,t){var n,r;const o=null!==(n=null===(r=e[lr])||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',qn,{expected:o,claims:t.claims,claim:"iss"});return t}const xn=new WeakSet,Un=Symbol(),Dn={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 Mn(e,t){for(const n of e)if(void 0===t.claims[n])throw Xt('JWT "'.concat(n,'" (').concat(Dn[n],") claim missing"),Xn,{claims:t.claims});return t}const Bn=Symbol(),Gn=Symbol();const Wn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",jn="OAUTH_RESPONSE_BODY_ERROR",Kn="OAUTH_UNSUPPORTED_OPERATION",Hn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Fn="OAUTH_PARSE_ERROR",Xn="OAUTH_INVALID_RESPONSE",Jn="OAUTH_RESPONSE_IS_NOT_JSON",Yn="OAUTH_RESPONSE_IS_NOT_CONFORM",Zn="OAUTH_HTTP_REQUEST_FORBIDDEN",Vn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",zn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",qn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Qn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",$n="OAUTH_MISSING_SERVER_METADATA",er="OAUTH_INVALID_SERVER_METADATA";function tr(e){if(e.bodyUsed)throw Ct('"response" body has been used already',Ot)}function nr(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Ht("unsupported ".concat(t.name," modulusLength"),{cause:e})}function rr(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Ht("unsupported ECDSA namedCurve",{cause:e})}}function or(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Xt('unexpected JWT "alg" header parameter',Xn,{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',Xn,{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',Xn,{header:r,expected:e,reason:"client configuration"})}function ir(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw Xt('"'.concat(t,'" parameter must be provided only once'),Xn);return r}const ar=Symbol(),sr=Symbol();async function cr(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qt;try{t=await e.json()}catch(t){throw n(e),Xt('failed to parse "response" body as JSON',Fn,t)}if(!Jt(t))throw Xt('"response" body must be a top level object',Xn,{body:t});return t}const ur=Symbol(),lr=Symbol(),dr=new TextEncoder,hr=new TextDecoder;function pr(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 fr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},yr=(e,t)=>e.name===t;function wr(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw gr("SHA-".concat(t),"algorithm.hash")}function br(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 vr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(Er,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Sr extends Ar{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}}),S(this,"code","ERR_JWT_EXPIRED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(Sr,"code","ERR_JWT_EXPIRED");class Tr extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}S(Tr,"code","ERR_JOSE_ALG_NOT_ALLOWED");class _r extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JOSE_NOT_SUPPORTED")}}S(_r,"code","ERR_JOSE_NOT_SUPPORTED"),S(class extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),S(class extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Rr extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JWS_INVALID")}}S(Rr,"code","ERR_JWS_INVALID");class kr extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JWT_INVALID")}}S(kr,"code","ERR_JWT_INVALID"),S(class extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Or extends Ar{constructor(){super(...arguments),S(this,"code","ERR_JWKS_INVALID")}}S(Or,"code","ERR_JWKS_INVALID");class Ir extends Ar{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),S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}S(Ir,"code","ERR_JWKS_NO_MATCHING_KEY");class Cr extends Ar{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),S(this,Symbol.asyncIterator,void 0),S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}S(Cr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Nr extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_TIMEOUT")}}S(Nr,"code","ERR_JWKS_TIMEOUT");class Pr extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}S(Pr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Lr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},xr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Ur=e=>Lr(e)||xr(e);function Dr(e,t,n){try{return mr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Mr(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=>Mr(e)&&"string"==typeof e.kty;async function Gr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Hr||(Hr=new WeakMap);let o=Hr.get(e);if(null!=o&&o[n])return o[n];const i=await jr(_(_({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Hr.set(e,{[n]:i}),i};const Xr=(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)},Zr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Vr=(e,t,n)=>{var r;const o=(e=>fr(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){Yr(e,48,"Invalid PKCS#8 structure"),Jr(e),Yr(e,2,"Expected version field");const t=Jr(e);e.pos+=t,Yr(e,48,"Expected algorithm identifier");Jr(e);e.pos}(t),(e=>{const t=(e=>{Yr(e,6,"Expected algorithm OID");const t=Jr(e);return Zr(e,t)})(e);if(Xr(t,[43,101,110]))return"X25519";if(!Xr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Yr(e,6,"Expected curve OID");const n=Jr(e),r=Zr(e,n);for(const e 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]}]){const t=e.name,n=e.oid;if(Xr(r,n))return t}throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new _r("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new _r('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)},zr=e=>null==e?void 0:e[Symbol.toStringTag],qr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Qr,$r;let eo,to;if("undefined"==typeof navigator||null===(Qr=navigator.userAgent)||void 0===Qr||null===($r=Qr.startsWith)||void 0===$r||!$r.call(Qr,"Mozilla/5.0 ")){const e="v6.8.4";to="".concat("openid-client","/").concat(e),eo={"user-agent":to}}const no=e=>ro.get(e);let ro,oo;function io(e){return void 0!==e?sn(e):(oo||(oo=new WeakMap),(e,t,n,r)=>{let o;return(o=oo.get(t))||(function(e,t){if("string"!=typeof e)throw uo("".concat(t," must be a string"),co);if(0===e.length)throw uo("".concat(t," must not be empty"),so)}(t.client_secret,'"metadata.client_secret"'),o=sn(t.client_secret),oo.set(t,o)),o(e,t,n,r)})}const ao=xt,so="ERR_INVALID_ARG_VALUE",co="ERR_INVALID_ARG_TYPE";function uo(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class lo extends Error{constructor(e,t){var n;super(e,t),S(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 ho(e,t,n){return new lo(e,{cause:t,code:n})}function po(e){if(e instanceof TypeError||e instanceof lo||e instanceof pn||e instanceof fn||e instanceof mn)throw e;if(e instanceof Ft)switch(e.code){case Zn:throw ho("only requests to HTTPS are allowed",e,e.code);case Vn:throw ho("only requests to HTTP or HTTPS are allowed",e,e.code);case Yn:throw ho("unexpected HTTP response status code",e.cause,e.code);case Jn:throw ho("unexpected response content-type",e.cause,e.code);case Fn:throw ho("parsing error occured",e,e.code);case Xn:throw ho("invalid response encountered",e,e.code);case qn:throw ho("unexpected JWT claim value encountered",e,e.code);case Qn:throw ho("unexpected JSON attribute value encountered",e,e.code);case zn:throw ho("JWT timestamp claim value failed validation",e,e.code);default:throw ho(e.message,e,e.code)}if(e instanceof Ht)throw ho("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw ho("runtime operation error",e,Kn);case"NotSupportedError":throw ho("runtime unsupported operation",e,Kn);case"TimeoutError":throw ho("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw ho("operation aborted",e,"OAUTH_ABORT")}throw new lo("something went wrong",{cause:e})}async function fo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw uo('"server" must be an instance of URL',co);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 Ct('"'.concat("issuerIdentifier",'" must be an instance of URL'),It);ln(e,!0!==(null==r?void 0:r[Nt]));const o=n(new URL(e.href)),i=Yt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[xt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Zt(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=Vt("".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=Vt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Ct('"options.algorithm" must be "oidc" (default), or "oauth2"',Ot)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[xt]:null==t?void 0:t[ao],[Nt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(Eo),signal:a,headers:new Headers(eo)}):((null==t?void 0:t[ao])||fetch)((ln(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Eo)),e.href),{headers:Object.fromEntries(new Headers(_({accept:"application/json"},eo)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==ur)throw Ct('"expectedIssuerIdentifier" must be an instance of URL',It);if(!kt(t,Response))throw Ct('"response" must be an instance of Response',It);if(200!==t.status)throw Xt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Yn,t);tr(t);const r=await cr(t);if(qt(r.issuer,'"response" body "issuer" property',Xn,{body:r}),n!==ur&&new URL(r.issuer).href!==n.href)throw Xt('"response" body "issuer" property does not match the expected value',Qn,{expected:n.href,body:r,attribute:"issuer"});return r}(ur,e)).catch(po);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[mo]=!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 lo("discovered metadata issuer does not match the expected issuer",{code:Qn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new go(i,t,n,r);let s=no(a);if(null!=o&&o[ao]&&(s.fetch=o[ao]),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 mo=Symbol();class go{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw uo('"clientId" must be a non-empty string',co);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 uo('"clientId" and "metadata.client_id" must be the same',so);const u=_(_({},structuredClone(n)),{},{client_id:t});let l;u[Pt]=null!==(i=null===(a=n)||void 0===a?void 0:a[Pt])&&void 0!==i?i:0,u[Lt]=null!==(s=null===(c=n)||void 0===c?void 0:c[Lt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?io(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);mo in e&&(h[lr]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);ro||(ro=new WeakMap),ro.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(no(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(no(this).c)}get timeout(){return no(this).timeout}set timeout(e){no(this).timeout=e}get[ao](){return no(this).fetch}set[ao](e){no(this).fetch=e}}function yo(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 Cn(this)}catch(e){return}}}}}(e))}async function wo(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 Ft("invalid Retry-After header value",{cause:e});a>t&&await bo(a-t,n)}function bo(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 vo(e,t){Oo(e);const n=no(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){on(e),an(t);const i=hn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Nt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Yt(null==o?void 0:o.headers);return s.set("accept","application/json"),Rn(e,t,n,i,a,s,o)}(r,o,i,t,{[xt]:a,[Nt]:!s,headers:new Headers(eo),signal:Io(c)}).then(e=>async function(e,t,n){if(on(e),an(t),!kt(n,Response))throw Ct('"response" must be an instance of Response',It);await Sn(n,200,"Backchannel Authentication Endpoint"),tr(n);const r=await cr(n);qt(r.auth_req_id,'"response" body "auth_req_id" property',Xn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return zt(o,!0,'"response" body "expires_in" property',Xn,{body:r}),r.expires_in=o,void 0!==r.interval&&zt(r.interval,!1,'"response" body "interval" property',Xn,{body:r}),r}(r,o,e)).catch(po)}async function Ao(e,t,n,r){var o,i;Oo(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 bo(a,s)}catch(e){po(e)}const c=no(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,m=c.timeout,g=c.decrypt,y=(o,i)=>Ao(e,_(_({},t),{},{interval:o}),n,_(_({},r),{},{signal:s,flag:i})),w=function(e,t){const n=Io(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,m),b=await async function(e,t,n,r,o){on(e),an(t),qt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),kn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[xt]:h,[Nt]:!p,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(eo),signal:w.signal}).catch(po).finally(w.cleanup);var v;if(503===b.status&&b.headers.has("retry-after"))return await wo(b,a,s,!0),await(null===(v=b.body)||void 0===v?void 0:v.cancel()),y(a);const A=async function(e,t,n,r){return Nn(e,t,n,void 0,null==r?void 0:r[Dt],null==r?void 0:r.recognizedTokenTypes)}(u,l,b,{[Dt]:g});let E;try{E=await A}catch(e){if(Co(e,r))return y(a,No);if(e instanceof pn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await wo(e.response,a,s),y(a)}po(e)}return E.id_token&&await(null==f?void 0:f(b)),yo(E),E}function Eo(e){no(e).tlsOnly=!1}async function So(e,t,n,r,o){if(Oo(e),!((null==o?void 0:o.flag)===No||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw uo('"currentUrl" must be an instance of URL, or Request',co);let i,a;const s=no(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,m=s.nonRepudiation,g=s.timeout,y=s.decrypt,w=s.implicit;if((null==o?void 0:o.flag)===No)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 Ct("form_post responses are expected to use the POST method",Ot,{cause:e});if("application/x-www-form-urlencoded"!==_n(e))throw Ct("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Ot,{cause:e});return async function(e){if(e.bodyUsed)throw Ct("form_post Request instances must contain a readable body",Ot,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var b=k(e,2);const n=b[0],r=b[1];t.searchParams.append(n,r)}break;default:throw uo("unexpected Request HTTP method",so)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!p:i=await p(t,null==n?void 0:n.expectedState);break;case!!f:i=await f(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(on(e),an(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Ct('"parameters" must be an instance of URLSearchParams, or URL',It);if(ir(n,"response"))throw Xt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Xn,{parameters:n});const o=ir(n,"iss"),i=ir(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Xt('response parameter "iss" (issuer) missing',Xn,{parameters:n});if(o&&o!==e.issuer)throw Xt('unexpected "iss" (issuer) response parameter value',Xn,{expected:e.issuer,parameters:n});switch(r){case void 0:case sr:if(void 0!==i)throw Xt('unexpected "state" response parameter encountered',Xn,{expected:void 0,parameters:n});break;case ar:break;default:if(qt(r,'"expectedState" argument'),i!==r)throw Xt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Xn,{expected:r,parameters:n})}if(ir(n,"error"))throw new fn("authorization response from the server is an error",{cause:n});const a=ir(n,"id_token"),s=ir(n,"token");if(void 0!==a||void 0!==s)throw new Ht("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),xn.add(c),c;var c}(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){po(e)}}}const v=await async function(e,t,n,r,o,i,a){if(on(e),an(t),!xn.has(r))throw Ct('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Ot);qt(o,'"redirectUri"');const s=ir(r,"code");if(!s)throw Xt('no authorization code in "callbackParameters"',Xn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Un&&(qt(i,'"codeVerifier"'),c.set("code_verifier",i)),kn(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||Un,{additionalParameters:r,[xt]:d,[Nt]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(eo),signal:Io(g)}).catch(po);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const A=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=Bn;break;case Bn:break;default:qt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Gn;break;case Gn:break;default:zt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Nn(e,t,n,s,i,a);qt(c.id_token,'"response" body "id_token" property',Xn,{body:c});const u=Cn(c);if(o!==Gn){const e=rn()+tn(t),n=nn(t);if(u.auth_time+o{}});const m=async function(e,t,n,r){return Nn(e,t,n,void 0,null==r?void 0:r[Dt],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[Dt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(o){if(Co(o,r))return Po(e,t,n,_(_({},r),{},{flag:No}));po(o)}return g.id_token&&await(null==h?void 0:h(p)),yo(g),g}async function Lo(e,t,n){if(!Mr(e))throw new Rr("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Rr('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Rr("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Rr("JWS Payload missing");if("string"!=typeof e.signature)throw new Rr("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Mr(e.header))throw new Rr("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=mr(e.protected);r=JSON.parse(hr.decode(t))}catch(e){throw new Rr("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new _r('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(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 s=o.alg;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(Br(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&qr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ur(t))throw new TypeError(vr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(zr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Br(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Ur(t))throw new TypeError(vr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(zr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(zr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(zr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(zr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(zr(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;ne+t.length,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?pr(e.protected):new Uint8Array,pr("."),"string"==typeof e.payload?a?pr(e.payload):dr.encode(e.payload):e.payload),d=Dr(e.signature,"signature",Rr),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(Lr(e))return e;if(xr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Hr||(Hr=new WeakMap);let n=Hr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(Kr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(Kr)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(Kr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(Kr);return n?n[t]=i:Hr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Fr(e,n,t)}if(Br(e))return e.k?mr(e.k):Fr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Gr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const n=t.algorithm.modulusLength;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new _r("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new Pr;let p;p=a?Dr(e.payload,"payload",Rr):"string"==typeof e.payload?dr.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?_(_({},f),{},{key:h}):f}const xo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Uo(e){const t=xo.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 Do=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function Mo(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(hr.decode(t))}catch(e){}if(!Mr(n))throw new kr("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(o&&("string"!=typeof e.typ||Do(e.typ)!==Do(o)))throw new Er('unexpected "typ" JWT header value',n,"typ","check_failed");const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in n))throw new Er('missing required "'.concat(e,'" claim'),n,e,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(n.iss))throw new Er('unexpected "iss" claim value',n,"iss","check_failed");if(c&&n.sub!==c)throw new Er('unexpected "sub" claim value',n,"sub","check_failed");if(u&&(p="string"==typeof u?[u]:u,!("string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(Set.prototype.has.bind(new Set(h))))))throw new Er('unexpected "aud" claim value',n,"aud","check_failed");var h,p;let f;switch(typeof r.clockTolerance){case"string":f=Uo(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const m=(g=r.currentDate||new Date,Math.floor(g.getTime()/1e3));var g;if((void 0!==n.iat||l)&&"number"!=typeof n.iat)throw new Er('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Er('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+f)throw new Er('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Er('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-f)throw new Sr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(l){const e=m-n.iat;if(e-f>("number"==typeof l?l:Uo(l)))throw new Sr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-f)throw new Er('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function Bo(e){return Mr(e)}var Go,Wo,jo=new WeakMap,Ko=new WeakMap;class Ho{constructor(e){if(A(this,jo,void 0),A(this,Ko,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Bo)}(e))throw new Or("JSON Web Key Set malformed");E(jo,this,structuredClone(e))}jwks(){return v(jo,this)}async getKey(e,t){const n=_(_({},e),null==t?void 0:t.header),r=n.alg,o=n.kid,i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new _r('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=v(jo,this).keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof o&&(t=o===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==i||(t=r===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(r){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}),s=a[0],c=a.length;if(0===c)throw new Ir;if(1!==c){const e=new Cr,t=v(Ko,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new O(e.apply(this,arguments))}}(function*(){for(const e of a)try{yield yield w(Fo(t,e,r))}catch(e){}}),e}return Fo(v(Ko,this),s,r)}}async function Fo(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(!Mr(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 mr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new _r('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return jr(_(_({},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 jr(_(_({},e),{},{ext:n}));case"EC":case"OKP":return jr(_(_({},e),{},{alg:t,ext:n}));default:throw new _r('Unsupported "kty" (Key Type) Parameter value')}}(_(_({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Or("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Xo(e){const t=new Ho(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 Jo;if("undefined"==typeof navigator||null===(Go=navigator.userAgent)||void 0===Go||null===(Wo=Go.startsWith)||void 0===Wo||!Wo.call(Go,"Mozilla/5.0 ")){const e="v6.2.3";Jo="".concat("jose","/").concat(e)}const Yo=Symbol(),Zo=Symbol();var Vo=new WeakMap,zo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap;class ii{constructor(e,t){if(A(this,Vo,void 0),A(this,zo,void 0),A(this,qo,void 0),A(this,Qo,void 0),A(this,$o,void 0),A(this,ei,void 0),A(this,ti,void 0),A(this,ni,void 0),A(this,ri,void 0),A(this,oi,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;E(Vo,this,new URL(e.href)),E(zo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),E(qo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),E(Qo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),E(ti,this,new Headers(null==t?void 0:t.headers)),Jo&&!v(ti,this).has("User-Agent")&&v(ti,this).set("User-Agent",Jo),v(ti,this).has("accept")||(v(ti,this).set("accept","application/json"),v(ti,this).append("accept","application/jwk-set+json")),E(ni,this,null==t?void 0:t[Yo]),void 0!==(null==t?void 0:t[Zo])&&(E(oi,this,null==t?void 0:t[Zo]),n=null==t?void 0:t[Zo],r=v(Qo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Mr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Mr)&&(E($o,this,v(oi,this).uat),E(ri,this,Xo(v(oi,this).jwks))))}pendingFetch(){return!!v(ei,this)}coolingDown(){return"number"==typeof v($o,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 Nr;throw e});if(200!==o.status)throw new Ar("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Ar("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(v(Vo,this).href,v(ti,this),AbortSignal.timeout(v(zo,this)),v(ni,this)).then(e=>{E(ri,this,Xo(e)),v(oi,this)&&(v(oi,this).uat=Date.now(),v(oi,this).jwks=e),E($o,this,Date.now()),E(ei,this,void 0)}).catch(e=>{throw E(ei,this,void 0),e})),await v(ei,this)}}const ai=["mfaToken"],si=["mfaToken"];var ci,ui,li,di,hi,pi,fi,mi,gi,yi,wi,bi,vi,Ai,Ei,Si,Ti=class extends Error{constructor(e,t){super(t),S(this,"code",void 0),this.name="NotSupportedError",this.code=e}},_i=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ri=class extends _i{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ki=class extends _i{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Oi=class extends _i{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Ii=class extends _i{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ci=class extends _i{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Ni=class extends _i{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Pi=class extends Error{constructor(e){super(e),S(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Li=class extends _i{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),S(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},xi=class extends _i{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Ui=class extends _i{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Di=class extends _i{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Mi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),S(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Bi(e){return Object.entries(e).filter(e=>void 0!==k(e,2)[1]).reduce((e,t)=>_(_({},e),{},{[t[0]]:t[1]}),{})}var Gi=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Wi=class extends Gi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},ji=class extends Gi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Ki=class extends Gi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Hi=class extends Gi{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 Xi=(ci=new WeakMap,ui=new WeakMap,li=new WeakMap,class{constructor(e){var t;A(this,ci,void 0),A(this,ui,void 0),A(this,li,void 0),E(ci,this,"https://".concat(e.domain)),E(ui,this,e.clientId),E(li,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(v(ci,this),"/mfa/authenticators"),n=e.mfaToken,r=await v(li,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Wi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Fi)}async enrollAuthenticator(e){const t="".concat(v(ci,this),"/mfa/associate"),n=e.mfaToken,r=R(e,ai),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 v(li,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 ji(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const t=e.authenticatorId,n=e.mfaToken,r="".concat(v(ci,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await v(li,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new Ki(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(v(ci,this),"/mfa/challenge"),n=e.mfaToken,r=R(e,si),o={mfa_token:n,client_id:v(ui,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await v(li,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 Hi(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())}}),Ji=class e{constructor(e,t,n,r,o,i,a){S(this,"accessToken",void 0),S(this,"idToken",void 0),S(this,"refreshToken",void 0),S(this,"expiresAt",void 0),S(this,"scope",void 0),S(this,"claims",void 0),S(this,"authorizationDetails",void 0),S(this,"tokenType",void 0),S(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}},Yi=(di=new WeakMap,hi=new WeakMap,pi=new WeakMap,class{constructor(e,t){A(this,di,new Map),A(this,hi,void 0),A(this,pi,void 0),E(pi,this,Math.max(1,Math.floor(e))),E(hi,this,Math.max(0,Math.floor(t)))}get(e){const t=v(di,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return v(di,this).delete(e),v(di,this).set(e,t),t.value;v(di,this).delete(e)}}set(e,t){for(v(di,this).has(e)&&v(di,this).delete(e),v(di,this).set(e,{value:t,expiresAt:Date.now()+v(hi,this)});v(di,this).size>v(pi,this);){const e=v(di,this).keys().next().value;if(void 0===e)break;v(di,this).delete(e)}}}),Zi=new Map;function Vi(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var zi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Zi.get(i));var i;return o||(o=new Yi(e.maxEntries,e.ttlMs),Zi.set(t,o)),o}static createJwksCache(){return{}}},qi="openid profile email offline_access",Qi=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 $i(e){if(null==e)throw new Ni("subject_token is required");if("string"!=typeof e)throw new Ni("subject_token must be a string");if(0===e.trim().length)throw new Ni("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Ni("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Ni("subject_token must not include the 'Bearer ' prefix")}function ea(e,t){if(t)for(const r of Object.entries(t)){var n=k(r,2);const t=n[0],o=n[1];if(!Qi.has(t))if(Array.isArray(o)){if(o.length>20)throw new Ni("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}else e.append(t,o)}}var ta="urn:ietf:params:oauth:token-type:access_token",na=(fi=new WeakMap,mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,wi=new WeakMap,bi=new WeakMap,vi=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,Si=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){b(e,t),t.add(e)}(this,Si),A(this,fi,void 0),A(this,mi,void 0),A(this,gi,void 0),A(this,yi,void 0),A(this,wi,void 0),A(this,bi,void 0),A(this,vi,void 0),A(this,Ai,void 0),A(this,Ei,void 0),S(this,"mfa",void 0),E(yi,this,e),e.useMtls&&!e.customFetch)throw new Ti("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");E(wi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,_(_({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=Vi(e.discoveryCache);E(vi,this,zi.createDiscoveryCache(i)),E(Ai,this,new Map),E(Ei,this,zi.createJwksCache()),this.mfa=new Xi({domain:v(yi,this).domain,clientId:v(yi,this).clientId,customFetch:v(wi,this)})}async getServerMetadata(){return(await y(Si,this,ia).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await y(Si,this,ia).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ti("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await y(Si,this,ua).call(this,e)}catch(e){throw new xi(e)}}async buildLinkUserUrl(e){try{const t=await y(Si,this,ua).call(this,{authorizationParams:_(_({},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 y(Si,this,ua).call(this,{authorizationParams:_(_({},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 Di(e)}}async backchannelAuthentication(e){const t=await y(Si,this,ia).call(this),n=t.configuration,r=t.serverMetadata,o=Bi(_(_({},v(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(_(_({scope:qi},o),{},{client_id:v(yi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await vo(n,i),t=await Ao(n,e);return Ji.fromTokenEndpointResponse(t)}catch(e){throw new Li(e)}}async initiateBackchannelAuthentication(e){const t=await y(Si,this,ia).call(this),n=t.configuration,r=t.serverMetadata,o=Bi(_(_({},v(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(_(_({scope:qi},o),{},{client_id:v(yi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await vo(n,i);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Li(e)}}async backchannelAuthenticationGrant(e){let t=e.authReqId;const n=(await y(Si,this,ia).call(this)).configuration,r=new URLSearchParams({auth_req_id:t});try{const e=await Po(n,"urn:openid:params:grant-type:ciba",r);return Ji.fromTokenEndpointResponse(e)}catch(e){throw new Li(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Ci("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 Ci("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?ta:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof Ni)throw new Ci(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?y(Si,this,aa).call(this,e):y(Si,this,sa).call(this,e)}async getTokenByCode(e,t){const n=(await y(Si,this,ia).call(this)).configuration;try{const r=await So(n,e,{pkceCodeVerifier:t.codeVerifier});return Ji.fromTokenEndpointResponse(r)}catch(e){throw new Ri("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const t=(await y(Si,this,ia).call(this)).configuration,n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await To(t,e.refreshToken,n);return Ji.fromTokenEndpointResponse(r)}catch(e){throw new Oi("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const t=(await y(Si,this,ia).call(this)).configuration,n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await y(Si,this,ca).call(this);r=new go(t.serverMetadata(),v(yi,this).clientId,v(yi,this).clientSecret,n),r[ao]=(t,n)=>v(wi,this).call(this,t,_(_({},n),{},{headers:_(_({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Po(r,"password",n);return Ji.fromTokenEndpointResponse(e)}catch(e){throw new Ii("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const t=(await y(Si,this,ia).call(this)).configuration;try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await _o(t,n);return Ji.fromTokenEndpointResponse(r)}catch(e){throw new ki("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const t=await y(Si,this,ia).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(v(yi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",v(yi,this).clientId),t}return function(e,t){Oo(e);const n=no(e),r=n.as,o=n.c,i=hn(r,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",o.client_id);for(const e of t.entries()){var a=k(e,2);const t=a[0],n=a[1];i.searchParams.append(t,n)}return i}(n,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const t=(await y(Si,this,ia).call(this)).serverMetadata,n=Vi(v(yi,this).discoveryCache),r=t.jwks_uri;v(bi,this)||E(bi,this,function(e,t){const n=new ii(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[Yo]:v(wi,this),[Zo]:v(Ei,this)}));const o=(await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=hr.decode(e)),"string"!=typeof e)throw new Rr("Compact JWS must be a string or Uint8Array");const r=e.split("."),o=r[0],i=r[1],a=r[2];if(3!==r.length)throw new Rr("Invalid Compact JWS");const s=await Lo({payload:i,protected:o,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?_(_({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new kr("JWTs MUST NOT use unencoded payload");const i={payload:Mo(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?_(_({},i),{},{key:o.key}):i}(e.logoutToken,v(bi,this),{issuer:t.issuer,audience:v(yi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in o)&&!("sub"in o))throw new Pi('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new Pi('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new Pi('"sub" claim must be a string');if("nonce"in o)throw new Pi('"nonce" claim is prohibited');if(!("events"in o))throw new Pi('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new Pi('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new Pi('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new Pi('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function ra(){const e=v(yi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(v(yi,this).useMtls?"1":"0")}async function oa(e){const t=await y(Si,this,ca).call(this),n=new go(e,v(yi,this).clientId,v(yi,this).clientSecret,t);return n[ao]=v(wi,this),n}async function ia(){if(v(fi,this)&&v(mi,this))return{configuration:v(fi,this),serverMetadata:v(mi,this)};const e=y(Si,this,ra).call(this),t=v(vi,this).get(e);if(t)return E(mi,this,t.serverMetadata),E(fi,this,await y(Si,this,oa).call(this,t.serverMetadata)),{configuration:v(fi,this),serverMetadata:v(mi,this)};const n=v(Ai,this).get(e);if(n){const e=await n;return E(mi,this,e.serverMetadata),E(fi,this,await y(Si,this,oa).call(this,e.serverMetadata)),{configuration:v(fi,this),serverMetadata:v(mi,this)}}const r=(async()=>{const t=await y(Si,this,ca).call(this),n=await fo(new URL("https://".concat(v(yi,this).domain)),v(yi,this).clientId,{use_mtls_endpoint_aliases:v(yi,this).useMtls},t,{[ao]:v(wi,this)}),r=n.serverMetadata();return v(vi,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>({serverMetadata:e.serverMetadata}));o.catch(()=>{}),v(Ai,this).set(e,o);try{const e=await r,t=e.configuration,n=e.serverMetadata;E(fi,this,t),E(mi,this,n),v(fi,this)[ao]=v(wi,this)}finally{v(Ai,this).delete(e)}return{configuration:v(fi,this),serverMetadata:v(mi,this)}}async function aa(e){var t,n;const r=(await y(Si,this,ia).call(this)).configuration;if("audience"in e||"resource"in e)throw new Ni("audience and resource parameters are not supported for Token Vault exchanges");$i(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:ta,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),ea(o,e.extra);try{const e=await Po(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return Ji.fromTokenEndpointResponse(e)}catch(t){throw new Ni("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function sa(e){const t=(await y(Si,this,ia).call(this)).configuration;$i(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),ea(n,e.extra);try{const e=await Po(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return Ji.fromTokenEndpointResponse(e)}catch(t){throw new Ni("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ca(){return v(gi,this)||E(gi,this,(async()=>{if(!v(yi,this).clientSecret&&!v(yi,this).clientAssertionSigningKey&&!v(yi,this).useMtls)throw new Mi;if(v(yi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=v(yi,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 Vr(e,t,void 0)}(e,v(yi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return cn(e,void 0)}(e):io(v(yi,this).clientSecret)})().catch(e=>{throw E(gi,this,void 0),e})),v(gi,this)}async function ua(e){const t=(await y(Si,this,ia).call(this)).configuration,n=$t(),r=await function(e){return async function(e){return qt(e,"codeVerifier"),Kt(await crypto.subtle.digest("SHA-256",Gt(e)))}(e)}(n),o=Bi(_(_({},v(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(_(_({scope:qi},o),{},{client_id:v(yi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await ko(t,i):await Ro(t,i),codeVerifier:n}}class la extends U{constructor(e,t){super(e,t),Object.setPrototypeOf(this,la.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new la(t,n)}}class da extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}}class ha extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,pa.prototype)}}class fa extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,fa.prototype)}}class ma extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ma.prototype)}}class ga{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 n of this.contexts){var t=k(n,2);const r=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(r)}}get size(){return this.contexts.size}}class ya{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new ga}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 da("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof Wi)throw new da(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=St[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 ji)throw new ha(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 Hi)throw new pa(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 ma("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 fa("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 fa("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 K)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof fa)throw new fa(e.error,e.error_description);throw e}}}class wa{constructor(e){let t,n;if(this.userCache=(new Xe).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!Y())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===Y().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),this.lockManager=(we||(we=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new ge:new ye;var e}()),we),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||N,!pt(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=pt(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:C,this.cookieStorage=!1===e.legacySameSiteCookie?nt:ot,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:it;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 Ye(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||L,this.cacheManager=new Je(n,n.allKeys?void 0:new lt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new wt(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new At(s,a),this.authJsClient=new na({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new ya(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===N&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ct,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||P,n=q(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(Q(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=k(t,3),r=n[0],o=n[1],i=n[2];if(3!==t.length||!r||!o||!i)throw new Error("ID token could not be decoded");const a=JSON.parse(ee(o)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],Ve.includes(e)||(c[e]=a[e])}),{encoded:{header:r,payload:o,signature:i},header:JSON.parse(ee(r)),claims:s,user:c}})(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&&!Ze(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||!Ze(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ze(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&&Ze(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(o))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=V(Z()),i=V(Z()),a=Z(),s=await $(a),c=te(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:We(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||x,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 j;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new W(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new G(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(U.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new U("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),n=t.openUrl,r=t.fragment,o=t.appState,i=f(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),u=c.url,l=f(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:at.Code}),a&&{organization:a}));const d=r?"".concat(u,"#").concat(r):u;n?await n(d):window.location.assign(d)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new U("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===at.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,r=e.state,o=e.error,i=e.error_description;if(o)throw new D(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new U("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:at.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,r=e.state,o=e.error,i=e.error_description;if(o)throw new M(o,i||o,t.connection,r,t.appState);if(!n)throw new U("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new U("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:at.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(dt))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(dt)}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:We(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=ut[t];return n||(n=e().finally(()=>{delete ut[t],n=null}),ut[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 t=e.cacheMode,n=f(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||x,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||x,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),r=e.id_token,o=e.token_type,i=e.access_token,a=e.oauthTokenScope,s=e.expires_in;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 K||e instanceof U&&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||x,clientId:this.options.clientId});if(!t)throw new U("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:We(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({},I),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new He({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||x,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||{},n=t.federated,r=f(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(Q(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||x,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,r=e.useFormData,o=e.refreshTokens,i=e.audience,a=e.client_id,s=e.onRefreshTokenRevoked;const c=e.timeout||C,u="refresh_token",l="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":r?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(q(n||P)))};if(t){const n={client_id:a,token_type_hint:u},o=r?Q(n):JSON.stringify(n);try{return await xe({type:"revoke",timeout:c,fetchUrl:l,fetchOptions:{method:"POST",body:o,headers:d},useFormData:r,auth:{audience:null!=i?i:x}},t)}catch(e){throw new U("revoke_error",e.message)}}for(const t of o){const n={client_id:a,token_type_hint:u,token:t},o=r?Q(n):JSON.stringify(n),i=await Ue(l,{method:"POST",body:o,headers:d},c);if(!i.ok){let t,n;try{var h=JSON.parse(await i.text());t=h.error,n=h.error_description}catch(e){}throw new U(t||"revoke_error",n||"HTTP error ".concat(i.status))}await(null==s?void 0:s(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=ft(e),r=n.openUrl,o=f(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(Ke);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await xe({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const r=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin),o=r.url,i=r.state,a=r.nonce,s=r.code_verifier,c=r.redirect_uri,u=r.scope,l=r.audience;if(window.crossOriginIsolated)throw new U("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const d=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let h;try{h=new URL(this.domainUrl).origin}catch(e){h=this.domainUrl}const p=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 B),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(U.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)})}(o,h,d);if(i!==p.state)throw new U("state_mismatch","Invalid state");const f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:s,code:p.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:t.organization});return Object.assign(Object.assign({},f),{scope:u,oauthTokenScope:f.scope,audience:l})})}catch(e){throw"login_required"===e.error&&(e instanceof U&&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 He({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||x,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 H(e.authorizationParams.audience||x,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&&mt(l,c)||mt(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 F(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||x})}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 K&&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 t=e.id_token,n=e.decodedToken,r=f(e,["id_token","decodedToken"]);this.userCache.set(Ke,{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||x,t=this.scope[e],n=await this.cacheManager.getIdToken(new He({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(Ke);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(Ke,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,r=e.clientId,o=e.cacheMode;const i=await this.cacheManager.get(new He({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,r=i.expires_in,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 o=t||{},i=o.nonceIn,a=o.organization,s=o.scopesToRequest,c=await Be(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:s||e.scope}),this.worker),u=await this._verifyIdToken(c.id_token,i,a);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!==u.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ke))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},c),{decodedToken:u,scope:e.scope,audience:e.audience||x}),c.scope?{oauthTokenScope:c.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(a||u.claims.org_id),Object.assign(Object.assign({},c),{decodedToken:u})}_buildTokenExchangeParams(e){return Object.assign(Object.assign(Object.assign(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}),e.actor_token&&{actor_token:e.actor_token}),e.actor_token_type&&{actor_token_type:e.actor_token_type}),{scope:We(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 loginWithCustomTokenExchange(e){return this._requestToken(this._buildTokenExchangeParams(e))}async customTokenExchange(e){const t=await Be(Object.assign(Object.assign({},this._buildTokenExchangeParams(e)),{baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,dpop:this.dpop}),this.worker,!0);return t.id_token&&await this._verifyIdToken(t.id_token,void 0,e.organization),t}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 vt(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 t=e.openUrl,n=e.appState,r=e.connection,o=e.scopes,i=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!r)throw new Error("connection is required");const c=V(Z()),u=Z(),l=await $(u),d=te(l),h=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:s,state:c,code_challenge:d,code_challenge_method:"S256",authorization_params:i}),p=h.connect_uri,f=h.connect_params,m=h.auth_session;this.transactionManager.create({state:c,code_verifier:u,auth_session:m,redirect_uri:s,appState:n,connection:r,response_type:at.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForMfa(e,t){const n=e.mfaToken,r=f(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function ba(e,t){return function(){return e.apply(t,arguments)}}const{toString:va}=Object.prototype,{getPrototypeOf:Aa}=Object,{iterator:Ea,toStringTag:Sa}=Symbol,Ta=(_a=Object.create(null),e=>{const t=va.call(e);return _a[t]||(_a[t]=t.slice(8,-1).toLowerCase())});var _a;const Ra=e=>(e=e.toLowerCase(),t=>Ta(t)===e),ka=e=>t=>typeof t===e,{isArray:Oa}=Array,Ia=ka("undefined");function Ca(e){return null!==e&&!Ia(e)&&null!==e.constructor&&!Ia(e.constructor)&&La(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Na=Ra("ArrayBuffer");const Pa=ka("string"),La=ka("function"),xa=ka("number"),Ua=e=>null!==e&&"object"==typeof e,Da=e=>{if("object"!==Ta(e))return!1;const t=Aa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Sa in e||Ea in e)},Ma=Ra("Date"),Ba=Ra("File"),Ga=Ra("Blob"),Wa=Ra("FileList");const ja="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Ka=void 0!==ja.FormData?ja.FormData:void 0,Ha=Ra("URLSearchParams"),[Fa,Xa,Ja,Ya]=["ReadableStream","Request","Response","Headers"].map(Ra);function Za(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Oa(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const za="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,qa=e=>!Ia(e)&&e!==za;const Qa=($a="undefined"!=typeof Uint8Array&&Aa(Uint8Array),e=>$a&&e instanceof $a);var $a;const es=Ra("HTMLFormElement"),ts=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ns=Ra("RegExp"),rs=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Za(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const os=Ra("AsyncFunction"),is=(as="function"==typeof setImmediate,ss=La(za.postMessage),as?setImmediate:ss?(cs=`axios@${Math.random()}`,us=[],za.addEventListener("message",({source:e,data:t})=>{e===za&&t===cs&&us.length&&us.shift()()},!1),e=>{us.push(e),za.postMessage(cs,"*")}):e=>setTimeout(e));var as,ss,cs,us;const ls="undefined"!=typeof queueMicrotask?queueMicrotask.bind(za):"undefined"!=typeof process&&process.nextTick||is,ds={isArray:Oa,isArrayBuffer:Na,isBuffer:Ca,isFormData:e=>{if(!e)return!1;if(Ka&&e instanceof Ka)return!0;const t=Aa(e);if(!t||t===Object.prototype)return!1;if(!La(e.append))return!1;const n=Ta(e);return"formdata"===n||"object"===n&&La(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Na(e.buffer),t},isString:Pa,isNumber:xa,isBoolean:e=>!0===e||!1===e,isObject:Ua,isPlainObject:Da,isEmptyObject:e=>{if(!Ua(e)||Ca(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Fa,isRequest:Xa,isResponse:Ja,isHeaders:Ya,isUndefined:Ia,isDate:Ma,isFile:Ba,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ga,isRegExp:ns,isFunction:La,isStream:e=>Ua(e)&&La(e.pipe),isURLSearchParams:Ha,isTypedArray:Qa,isFileList:Wa,forEach:Za,merge:function e(...t){const{caseless:n,skipUndefined:r}=qa(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Va(o,i)||i,s=ts(o,a)?o[a]:void 0;Da(s)&&Da(t)?o[a]=e(s,t):Da(t)?o[a]=e({},t):Oa(t)?o[a]=t.slice():r&&Ia(t)||(o[a]=t)};for(let e=0,n=t.length;e(Za(t,(t,r)=>{n&&La(t)?Object.defineProperty(e,r,{__proto__:null,value:ba(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Aa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ta,kindOfTest:Ra,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Oa(e))return e;let t=e.length;if(!xa(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ea]).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:es,hasOwnProperty:ts,hasOwnProp:ts,reduceDescriptors:rs,freezeMethods:e=>{rs(e,(t,n)=>{if(La(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];La(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 Oa(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:Va,global:za,isContextDefined:qa,isSpecCompliantForm:function(e){return!!(e&&La(e.append)&&"FormData"===e[Sa]&&e[Ea])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Ua(e)){if(t.has(e))return;if(Ca(e))return e;if(!("toJSON"in e)){t.add(e);const r=Oa(e)?[]:{};return Za(e,(e,t)=>{const o=n(e);!Ia(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:os,isThenable:e=>e&&(Ua(e)||La(e))&&La(e.then)&&La(e.catch),setImmediate:is,asap:ls,isIterable:e=>null!=e&&La(e[Ea])},hs=ds.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"]),ps=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]&&hs[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};n.dn(ps);const fs=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ms=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function gs(e,t){return ds.isArray(e)?e.map(e=>gs(e,t)):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function ys(e){const t=Object.create(null);return ds.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>gs(e,ms))(e)}),t}const ws=Symbol("internals");function bs(e){return e&&String(e).trim().toLowerCase()}function vs(e){return!1===e||null==e?e:ds.isArray(e)?e.map(vs):(e=>gs(e,fs))(String(e))}function As(e,t,n,r,o){return ds.isFunction(r)?r.call(this,t,n):(o&&(t=n),ds.isString(t)?ds.isString(r)?-1!==t.indexOf(r):ds.isRegExp(r)?r.test(t):void 0:void 0)}class Es{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=bs(t);if(!o)throw new Error("header name must be a non-empty string");const i=ds.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=vs(e))}const i=(e,t)=>ds.forEach(e,(e,n)=>o(e,n,t));if(ds.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ds.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(ps(e),t);else if(ds.isObject(e)&&ds.isIterable(e)){let n,r,o={};for(const t of e){if(!ds.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ds.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=bs(e)){const n=ds.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(ds.isFunction(t))return t.call(this,e,n);if(ds.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bs(e)){const n=ds.findKey(this,e);return!(!n||void 0===this[n]||t&&!As(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=bs(e)){const o=ds.findKey(n,e);!o||t&&!As(0,n[o],o,t)||(delete n[o],r=!0)}}return ds.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&&!As(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ds.forEach(this,(r,o)=>{const i=ds.findKey(n,o);if(i)return t[i]=vs(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]=vs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ds.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ds.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[ws]=this[ws]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=bs(e);t[r]||(!function(e,t){const n=ds.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return ds.isArray(e)?e.forEach(r):r(e),this}}Es.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ds.reduceDescriptors(Es.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ds.freezeMethods(Es);const Ss=Es;function Ts(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(ds.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof Ss&&(e=e.toJSON()),r.push(e),ds.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);ds.isUndefined(r)||(t[n]=r)});else{if(!ds.isPlainObject(e)&&function(e){if(ds.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ds.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);ds.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class _s extends Error{static from(e,t,n,r,o,i){const a=new _s(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&ds.hasOwnProp(e,"redact")?e.redact:void 0,n=ds.isArray(t)&&t.length>0?Ts(e,t):ds.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}_s.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",_s.ERR_BAD_OPTION="ERR_BAD_OPTION",_s.ECONNABORTED="ECONNABORTED",_s.ETIMEDOUT="ETIMEDOUT",_s.ECONNREFUSED="ECONNREFUSED",_s.ERR_NETWORK="ERR_NETWORK",_s.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",_s.ERR_DEPRECATED="ERR_DEPRECATED",_s.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",_s.ERR_BAD_REQUEST="ERR_BAD_REQUEST",_s.ERR_CANCELED="ERR_CANCELED",_s.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",_s.ERR_INVALID_URL="ERR_INVALID_URL",_s.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Rs=_s;var ks=n(8287).hp;function Os(e){return ds.isPlainObject(e)||ds.isArray(e)}function Is(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function Cs(e,t,n){return e?e.concat(t).map(function(e,t){return e=Is(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ns=ds.toFlatObject(ds,{},null,function(e){return/^is[A-Z]/.test(e)});const Ps=function(e,t,n){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ds.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ds.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&ds.isSpecCompliantForm(t);if(!ds.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ds.isDate(e))return e.toISOString();if(ds.isBoolean(e))return e.toString();if(!u&&ds.isBlob(e))throw new Rs("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(e)||ds.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):ks.from(e):e}function d(e,n,o){let s=e;if(ds.isReactNative(t)&&ds.isReactNativeBlob(e))return t.append(Cs(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(ds.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ds.isArray(e)&&function(e){return ds.isArray(e)&&!e.some(Os)}(e)||(ds.isFileList(e)||ds.endsWith(n,"[]"))&&(s=ds.toArray(e)))return n=Is(n),s.forEach(function(e,r){!ds.isUndefined(e)&&null!==e&&t.append(!0===a?Cs([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Os(e)||(t.append(Cs(o,n,i),l(e)),!1)}const h=[],p=Object.assign(Ns,{defaultVisitor:d,convertValue:l,isVisitable:Os});if(!ds.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!ds.isUndefined(n)){if(i>c)throw new Rs("Object is too deeply nested ("+i+" levels). Max depth: "+c,Rs.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),ds.forEach(n,function(n,a){!0===(!(ds.isUndefined(n)||null===n)&&o.call(t,n,ds.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function Ls(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function xs(e,t){this._pairs=[],e&&Ps(e,this,t)}const Us=xs.prototype;Us.append=function(e,t){this._pairs.push([e,t])},Us.toString=function(e){const t=e?function(t){return e.call(this,t,Ls)}:Ls;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ds=xs;function Ms(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bs(e,t,n){if(!t)return e;const r=n&&n.encode||Ms,o=ds.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):ds.isURLSearchParams(t)?t.toString():new Ds(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Gs=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){ds.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ws={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},js={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ds,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ks="undefined"!=typeof window&&"undefined"!=typeof document,Hs="object"==typeof navigator&&navigator||void 0,Fs=Ks&&(!Hs||["ReactNative","NativeScript","NS"].indexOf(Hs.product)<0),Xs="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Js=Ks&&window.location.href||"http://localhost",Ys={...e,...js};const Zs=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&&ds.isArray(r)?r.length:i,s)return ds.hasOwnProp(r,i)?r[i]=ds.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;ds.hasOwnProp(r,i)&&ds.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ds.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 ds.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Vs=(e,t)=>null!=e&&ds.hasOwnProp(e,t)?e[t]:void 0;const zs={transitional:Ws,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ds.isObject(e);o&&ds.isHTMLForm(e)&&(e=new FormData(e));if(ds.isFormData(e))return r?JSON.stringify(Zs(e)):e;if(ds.isArrayBuffer(e)||ds.isBuffer(e)||ds.isStream(e)||ds.isFile(e)||ds.isBlob(e)||ds.isReadableStream(e))return e;if(ds.isArrayBufferView(e))return e.buffer;if(ds.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Vs(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ps(e,new Ys.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ys.isNode&&ds.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=ds.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Vs(this,"env"),r=n&&n.FormData;return Ps(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Vs(this,"transitional")||zs.transitional,n=t&&t.forcedJSONParsing,r=Vs(this,"responseType"),o="json"===r;if(ds.isResponse(e)||ds.isReadableStream(e))return e;if(e&&ds.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Vs(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Rs.from(e,Rs.ERR_BAD_RESPONSE,this,null,Vs(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ys.classes.FormData,Blob:Ys.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch","query"],e=>{zs.headers[e]={}});const qs=zs;function Qs(e,t){const n=this||qs,r=t||n,o=Ss.from(r.headers);let i=r.data;return ds.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function $s(e){return!(!e||!e.__CANCEL__)}const ec=class extends Rs{constructor(e,t,n){super(e??"canceled",Rs.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function tc(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Rs("Request failed with status code "+n.status,n.status>=400&&n.status<500?Rs.ERR_BAD_REQUEST:Rs.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const nc=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)]},oc=(e,t,n=3)=>{let r=0;const o=nc(50,250);return rc(n=>{if(!n||"number"!=typeof n.loaded)return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},ic=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ac=e=>(...t)=>ds.asap(()=>e(...t)),sc=Ys.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ys.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ys.origin),Ys.navigator&&/(msie|trident)/i.test(Ys.navigator.userAgent)):()=>!0,cc=Ys.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];ds.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),ds.isString(r)&&s.push(`path=${r}`),ds.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),ds.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function uc(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const lc=e=>e instanceof Ss?{...e}:e;function dc(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return ds.isPlainObject(e)&&ds.isPlainObject(t)?ds.merge.call({caseless:r},e,t):ds.isPlainObject(t)?ds.merge({},t):ds.isArray(t)?t.slice():t}function o(e,t,n,o){return ds.isUndefined(t)?ds.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ds.isUndefined(t))return r(void 0,t)}function a(e,t){return ds.isUndefined(t)?ds.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return ds.hasOwnProp(t,i)?r(n,o):ds.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(lc(e),lc(t),0,!0)};return ds.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ds.hasOwnProp(c,r)?c[r]:o,a=i(ds.hasOwnProp(e,r)?e[r]:void 0,ds.hasOwnProp(t,r)?t[r]:void 0,r);ds.isUndefined(a)&&i!==s||(n[r]=a)}),n}const hc=["content-type","content-length"];const pc=e=>{const t=dc({},e),n=e=>ds.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=Ss.from(s),t.url=Bs(uc(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),ds.isFormData(r)&&(Ys.hasStandardBrowserEnv||Ys.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):ds.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{hc.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Ys.hasStandardBrowserEnv){ds.isFunction(o)&&(o=o(t));if(!0===o||null==o&&sc(t.url)){const e=i&&a&&cc.read(a);e&&s.set(i,e)}}return t};n.dn(pc);const fc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=pc(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 g(){if(!m)return;const r=Ss.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());tc(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Rs("Request aborted",Rs.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Rs(r,Rs.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ws;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Rs(t,o.clarifyTimeoutError?Rs.ETIMEDOUT:Rs.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ds.forEach(ys(i),function(e,t){m.setRequestHeader(t,e)}),ds.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=oc(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=oc(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new ec(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||Ys.protocols.includes(y)?m.send(o||null):n(new Rs("Unsupported protocol "+y+":",Rs.ERR_BAD_REQUEST,e))})},mc=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Rs?t:new ec(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Rs(`timeout of ${t}ms exceeded`,Rs.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}=n;return s.unsubscribe=()=>ds.asap(a),s},gc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of yc(e))yield*gc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var bc=n(8287).hp;const vc="1.16.1",{isFunction:Ac}=ds,Ec=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Sc=e=>{const t=void 0!==ds.global&&null!==ds.global?ds.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=ds.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?Ac(o):"function"==typeof fetch,c=Ac(i),u=Ac(a);if(!s)return!1;const l=s&&Ac(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&Ec(()=>{let e=!1;const t=new i(Ys.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&Ec(()=>ds.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Rs(`Response type '${e}' is not supported`,Rs.ERR_NOT_SUPPORT,n)})});const g=async(e,t)=>{const n=ds.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(ds.isBlob(e))return e.size;if(ds.isSpecCompliantForm(e)){const t=new i(Ys.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ds.isArrayBufferView(e)||ds.isArrayBuffer(e)?e.byteLength:(ds.isURLSearchParams(e)&&(e+=""),ds.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:y,responseType:w,headers:b,withCredentials:v="same-origin",fetchOptions:A,maxContentLength:E,maxBodyLength:S}=pc(e);const T=ds.isNumber(E)&&E>-1,_=ds.isNumber(S)&&S>-1;let R=o||fetch;w=w?(w+"").toLowerCase():"text";let k=mc([u,l&&l.toAbortSignal()],d),O=null;const I=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==bc&&"function"==typeof bc.byteLength)return bc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>E)throw new Rs("maxContentLength size of "+E+" exceeded",Rs.ERR_BAD_RESPONSE,e,O)}if(_&&"get"!==n&&"head"!==n){const t=await g(b,s);if("number"==typeof t&&isFinite(t)&&t>S)throw new Rs("Request body larger than maxBodyLength limit",Rs.ERR_BAD_REQUEST,e,O)}if(y&&p&&"get"!==n&&"head"!==n&&0!==(C=await g(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(ds.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=ic(C,oc(ac(y)));s=wc(n.body,65536,e,t)}}ds.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(ds.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+vc,!1);const u={...A,signal:k,method:n.toUpperCase(),headers:ys(b.normalize()),body:s,duplex:"half",credentials:o?v:void 0};O=c&&new i(t,u);let l=await(c?R(O,A):R(t,u));if(T){const t=ds.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>E)throw new Rs("maxContentLength size of "+E+" exceeded",Rs.ERR_BAD_RESPONSE,e,O)}const d=f&&("stream"===w||"response"===w);if(f&&l.body&&(h||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=ds.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&ic(n,oc(ac(h),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>E))throw new Rs("maxContentLength size of "+E+" exceeded",Rs.ERR_BAD_RESPONSE,e,O);r&&r(t)};l=new a(wc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}w=w||"text";let N=await m[ds.findKey(m,w)||"text"](l,e);if(T&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>E)throw new Rs("maxContentLength size of "+E+" exceeded",Rs.ERR_BAD_RESPONSE,e,O)}return!d&&I&&I(),await new Promise((t,n)=>{tc(t,n,{data:N,headers:Ss.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(I&&I(),k&&k.aborted&&k.reason instanceof Rs){const n=k.reason;throw n.config=e,O&&(n.request=O),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Rs("Network Error",Rs.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t});throw Rs.from(t,t&&t.code,e,O,t&&t.response)}}},Tc=new Map,_c=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=Tc;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Sc(t)),u=s;return s},Rc=(_c(),{http:null,xhr:fc,fetch:{get:_c}});ds.forEach(Rc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const kc=e=>`- ${e}`,Oc=e=>ds.isFunction(e)||null===e||!1===e;const Ic={getAdapter:function(e,t){e=ds.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(kc).join("\n"):" "+kc(e[0]):"as no adapter specified";throw new Rs("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Rc};function Cc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ec(null,e)}function Nc(e){Cc(e),e.headers=Ss.from(e.headers),e.data=Qs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ic.getAdapter(e.adapter||qs.adapter,e)(e).then(function(t){Cc(e),e.response=t;try{t.data=Qs.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Ss.from(t.headers),t},function(t){if(!$s(t)&&(Cc(e),t&&t.response)){e.response=t.response;try{t.response.data=Qs.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Ss.from(t.response.headers)}return Promise.reject(t)})}const Pc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Pc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Lc={};Pc.transitional=function(e,t,n){function r(e,t){return"[Axios v"+vc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Rs(r(o," has been removed"+(t?" in "+t:"")),Rs.ERR_DEPRECATED);return t&&!Lc[o]&&(Lc[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)}},Pc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const xc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Rs("options must be an object",Rs.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Rs("option "+i+" must be "+n,Rs.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Rs("Unknown option "+i,Rs.ERR_BAD_OPTION)}},validators:Pc},Uc=xc.validators;class Dc{constructor(e){this.defaults=e||{},this.interceptors={request:new Gs,response:new Gs}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=dc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&xc.assertOptions(n,{silentJSONParsing:Uc.transitional(Uc.boolean),forcedJSONParsing:Uc.transitional(Uc.boolean),clarifyTimeoutError:Uc.transitional(Uc.boolean),legacyInterceptorReqResOrdering:Uc.transitional(Uc.boolean)},!1),null!=r&&(ds.isFunction(r)?t.paramsSerializer={serialize:r}:xc.assertOptions(r,{encode:Uc.function,serialize:Uc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),xc.assertOptions(t,{baseUrl:Uc.spelling("baseURL"),withXsrfToken:Uc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ds.merge(o.common,o[t.method]);o&&ds.forEach(["delete","get","head","post","put","patch","query","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||Ws;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=[Nc.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 ec(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 Bc(function(t){e=t});return{token:t,cancel:e}}}const Gc=Bc;const Wc={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(Wc).forEach(([e,t])=>{Wc[t]=e});const jc=Wc;const Kc=function e(t){const n=new Mc(t),r=ba(Mc.prototype.request,n);return ds.extend(r,Mc.prototype,n,{allOwnKeys:!0}),ds.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(dc(t,n))},r}(qs);Kc.Axios=Mc,Kc.CanceledError=ec,Kc.CancelToken=Gc,Kc.isCancel=$s,Kc.VERSION=vc,Kc.toFormData=Ps,Kc.AxiosError=Rs,Kc.Cancel=Kc.CanceledError,Kc.all=function(e){return Promise.all(e)},Kc.spread=function(e){return function(t){return e.apply(null,t)}},Kc.isAxiosError=function(e){return ds.isObject(e)&&!0===e.isAxiosError},Kc.mergeConfig=dc,Kc.AxiosHeaders=Ss,Kc.formToJSON=e=>Zs(ds.isHTMLForm(e)?new FormData(e):e),Kc.getAdapter=Ic.getAdapter,Kc.HttpStatusCode=jc,Kc.default=Kc;const Hc=Kc,Fc={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 Xc=n(3029),Jc=n(2901),Yc=function(){function e(){(0,Xc.A)(this,e),(0,l.A)(this,"readyPromise",null),(0,l.A)(this,"readyResolved",!1),(0,l.A)(this,"readyValue",!1)}return(0,Jc.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return i.A.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return i.A.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return i.A.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,a=setTimeout(function(){t.readyResolved||(i.A.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return i.A.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var s=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){i.A.log("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(a),i.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(i.A.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();(0,l.A)(Yc,"DEFAULT_TIMEOUT",3e3);const Zc=new Yc;var Vc,zc;function qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=$c().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])},nu=function(){var e=tu();return".".concat(e)},ru=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(i.A.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=d(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},ou=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=tu(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=d(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,";")})},iu=function(){return $c().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},au=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)},su=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=tu().split(".")[0],e.prev=1,e.next=2,Hc({method:"get",url:"".concat(o.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(a=e.sent).data){e.next=3;break}return i.A.log("Apple Sub Check: Request successful: ",a.data),e.abrupt("return","subscribed"===a.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,s=e.catch(1),i.A.log("Apple Sub Check: Request Failure: ",s),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),cu=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Hc({method:"get",url:"".concat(o.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(iu())),headers:{"X-Api-Key":o.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),uu=function(){return"complete"===document.readyState},lu=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var o=!0;if(uu())n();else{i.A.log("UIHandler: ","Waiting for the body to load...");var a=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(o=uu()),document.querySelector("body")&&o&&(clearInterval(a),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},du=function(){return new Promise(function(e){if(("interactive"===document.readyState||uu())&&window.dataLayer)i.A.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{i.A.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),50)}})},hu=function(){return new Promise(function(e){if("interactive"!==document.readyState&&"complete"!==document.readyState||!window.MG2DL){i.A.log("Utils mg2DataLayerLoaded:","Waiting for MG2DL to load...");var t=setInterval(function(){window.MG2DL&&window.MG2DL.length>0&&(clearInterval(t),e(!0))},50)}else i.A.log("Utils mg2DataLayerLoaded:","Document is in interactive state, resolving."),e()})},pu=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,du();case 1:return i.A.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",i.A.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),o=function(e){return i.A.log("Utils dataLayerLoop: look for this element ",e),e[t]?(i.A.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(i.A.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},a=window.dataLayer.some(o),e.abrupt("return",a?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),fu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:[],e.next=1,du();case 1:if(i.A.log("Utils getMultipleDataLayerObjects: looking for these keys ",t),window.dataLayer=window.dataLayer||[],n={},i.A.log("Utils getDataLayerObjects: dataLayer length",window.dataLayer.length),o=function(e){i.A.log("Utils dataLayerLoop: look for this element ",e);var r=!1;return t.forEach(function(t){void 0!==e[t]?(i.A.log("Utils dataLayerLoop: found ".concat(t,":"),e[t]),n[t]=e[t],r=!0):i.A.log("Utils dataLayerLoop: ".concat(t," not found in this element"))}),t.every(function(e){return void 0!==n[e]})?(i.A.log("Utils dataLayerLoop: all requested keys found, stopping search"),!0):r},!(window.dataLayer.some(o)&&Object.keys(n).length>0)){e.next=2;break}return i.A.log("Utils getDataLayerObjects: final result",n),e.abrupt("return",n);case 2:return i.A.log("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)}}(),mu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:"Page Type",e.next=1,pu(t);case 1:return n=e.sent,i.A.log("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),gu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return i.A.log("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){i.A.log("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),i.A.log("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zc.blueConicReady();case 1:if(t=e.sent,i.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,gu();case 2:if(n=e.sent,i.A.log("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return o=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){o.loadValues(["auth0_id"],null,function(){e()})});case 4:return a=o.getValue("auth0_id"),i.A.log("bcGetAuth0Id | auth0_id:",a),e.abrupt("return",a);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),wu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c,u,l,d,h=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]&&h[0],n=!1,a=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Zc.blueConicReady();case 1:if(s=e.sent,i.A.log("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(c=window.blueConicClient.getSegments(),i.A.log("bcLowaCheck | BC segments for users: ",c),u=c.filter(function(e){return a.includes(e.name)}),i.A.log("bcLowaCheck | BC userSubSegments: ",u),!(u.length>0)){e.next=3;break}return e.next=2,yu();case 2:(l=e.sent)&&(n=!0,o=l);case 3:return t&&n&&bu(),d={isSub:n},o&&(d.uuid=o),e.abrupt("return",d);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bu=function(){ru("bc_lowa_status",1,{path:"/",domain:nu(),expires:7,secure:!0})},vu=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(i.A.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(i.A.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};i.A.log("utils | Event: authentication ready: ",r),e(r)}catch(e){i.A.log(e),t(e)}},!1))})},Au=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return o.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(i.A.log("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,i.A.log("Received entitlementsReady event:",r),e(r)}catch(e){i.A.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(i.A.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Eu=function(){ou(Fc.AUTH0_SUB_COOKIE_KEY),ou("mng-jwt-decoded"),localStorage.removeItem(Fc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){i.A.log("Clearing entitlements...");try{ou(Fc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){i.A.log("Failed to delete legacy cookie: ",e)}try{ou(Fc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:tu(),expires:365,secure:!0})}catch(e){i.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Fc.LOCAL_STORAGE_SESSION_KEY)}catch(e){i.A.log("Failed to remove local storage: ",e)}}()},Su=function(e){i.A.log("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),i.A.log("Storage Object removed : ",e))},Tu=function(e){i.A.log("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 i.A.log("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=Tu;var _u;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ru=function(){var e=(0,t.A)(r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===_u){e.next=1;break}return e.abrupt("return",_u);case 1:return t=o.A.auth0Domain,n=o.A.auth0ClientId,_u=new wa({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",_u);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ku=function(e){i.A.log("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,i.A.log("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),i.A.log("utils | Dispatched authenticationReady event"),zc=new CustomEvent("mng-auth-check-complete",{detail:e}),Vc?(i.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(zc)):i.A.log("Islands not ready")},Ou=function(e){if(void 0!==window.authentication_config){var t=window.authentication_config,n=Object.keys(t).filter(function(n){return n.includes(e)&&"1"===t[n]});return i.A.log("checkOneTapOptions: enabled options",n),n.length>0}return!1},Iu=function(e){return Number.isInteger(Number(e))};var Cu=function(e){o.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Nu=function(){var e=(0,t.A)(r.mark(function e(t){var n,s,c,u,l,d;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,i.A.log("deleteUserCache","Setting up cache deletion for ".concat(t)),n=iu(),i.A.log("deleteUSerCache","Domain is: ".concat(n)),s={publication:n,uuid:t},e.next=1,Hc({method:"DELETE",url:"".concat(o.A.entitlementsEndpoint,"session/create"),data:s,headers:{"X-Api-Key":o.A.entitlementsApiKey}});case 1:if(c=e.sent,u=c.data,l=/Succesfully deleted/i,!("object"===(0,a.A)(u)&&Object.prototype.hasOwnProperty.call(u,"message"))||!l.test(u.message)){e.next=2;break}return i.A.log("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return i.A.log("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),i.A.log("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)}}(),Pu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,o){var a={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=(0,t.A)(r.mark(function t(){var s,c,u,l,d,h,p,f,m,g,y;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"1"!==(null===(s=window.sophi_config)||void 0===s?void 0:s.enableSophiSSPW)){t.next=1;break}if(!document.getElementById("server-paywall")){t.next=1;break}return a.sspw=!0,t.abrupt("return",n({paywall:!0,details:Qc({},a)}));case 1:return t.next=2,mu();case 2:return u=t.sent,t.next=3,pu("Paywall_Level");case 3:if(l=t.sent,"article"===u&&"free"!==l){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return t.next=5,Au();case 5:if(!(d=t.sent)||!d.isEntitled){t.next=6;break}return t.abrupt("return",n({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){t.next=7;break}return t.abrupt("return",n({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,i.A.log("checkPaywallStatus - Sophi is running: ",h),!h){t.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(a.sophiClient=!0,a.engageStatus=!0,a.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(a.sophiClient=!0),n({paywall:!0,details:Qc({},a)})},{once:!0}),t.next=12;break;case 8:if(h){t.next=12;break}return p=window.ConnextUtils.connextReady("onPaywallShown"),f=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),t.prev=9,t.next=10,Promise.race([p,f]);case 10:!0===(m=t.sent)?(a.engagePaywall=!0,a.engageStatus="Engage paywall detected"):(a.engagePaywall=!1,a.engageStatus="Engage response: ".concat(m)),t.next=12;break;case 11:t.prev=11,g=t.catch(9),a.engagePaywall=!1,a.engageStatus="Engage response: ".concat(g);case 12:return t.abrupt("return",n({paywall:Object.values(a).some(function(e){return e}),details:Qc({},a)}));case 13:t.prev=13,y=t.catch(0),o(y);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Pu);var Lu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zc.blueConicReady();case 1:return e.next=2,vu();case 2:return e.abrupt("return",new Promise(function(e){i.A.log("ANALYTICS: inside BCregwall events");var t=$c();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)}}(),xu=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,a,s,c;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{void 0!==(n=au(t))&&n&&(i.A.log("ANALYTICS: Partner Access: JWT found"),o=n.entitlement_entitled,a=n.entitlement_source,s=n.entitlement_organizationTrackingId,c=n.entitlement_organizationType,i.A.log("ANALYTICS: Partner Access Event: Entitled: ".concat(o," and source: ").concat(a)),o&&"partner-access"===a&&(i.A.log("ANALYTICS: GA event for partner access"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"partnerAccess",partner:"".concat(s,"|").concat(c)})))}catch(e){i.A.log("ANALYTICS: Failed to send Partner Access event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Uu=function(){var e=(0,t.A)(r.mark(function e(){return r.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"}),i.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer),localStorage.removeItem("regwallEvent"))}catch(e){i.A.log("ANALYTICS: Failed to send Regwall Succuss Event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Du=function(){var e=(0,t.A)(r.mark(function e(t,n){var o,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.entitlements&&(o=au(n.entitlements.token)),i.A.log("ANALYTICS: user state variables are: ",t,n.userState),a="known"===t&&n.userState?o&&o.entitlement_entitled?"comp"===o.entitlement_level||"freeTrial"===o.entitlement_level?"subscriber-".concat(o.entitlement_level):"".concat(n.userState).concat(o.entitlement_serviceCode?"-".concat(o.entitlement_serviceCode):""):n.userState:"known"!==t||n.userState?"unknown"===t||"unknown-default"===t||"unknown-fail"===t&&"noEntitlements"===n.userState?t:t&&n.userState?o&&o.entitlement_entitled?"".concat(n.userState).concat(o.entitlement_serviceCode?"-".concat(o.entitlement_serviceCode):""):n.userState:"noState":"known-entitlements-failed",i.A.log("ANALYTICS: user state is ",a),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Auth0State_event",Auth0State:a});case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),Mu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,vu();case 1:n=e.sent,o=n.isAuthenticated,a=o,e.next=!0===a?2:!1===a?3:a===Fc.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=Fc.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),i.A.log("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)}}(),Bu=function(e){try{window.dataLayer.push({event:e}),i.A.log("ANALYTICS: ".concat(e," event")),i.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){i.A.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}},Gu=function(e){try{var t={};Object.keys(e).forEach(function(n){t[n]=e[n]}),0!==Object.keys(t).length&&window.dataLayer.push(t),i.A.log("ANALYTICS: ".concat(e.event," event")),i.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){i.A.log("ANALYTICS: Failed to send ".concat(e.event," event: "),t)}},Wu=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(Iu(window.authentication_config["got".concat(t,"GroupTime")])?parseInt(window.authentication_config["got".concat(t,"GroupTime")],10):1);break;default:return n.event}return n},ju=function(e){try{var t={googleonetap:"one_tap_login",viafoura_signup:"viafoura_signup_success",viafoura_login:"viafoura_login_success"}[e];"one_tap_login"===t?(n=localStorage.getItem("abcdLocal"),r=localStorage.getItem("abcdeLocal"),o=Ou("GroupEnabled"),a=Ou("GroupDelayEnabled"),s=Ou("GroupTimeDelayEnabled"),c=Ou("got".concat(n,"GroupEnabled")),u=Ou("got".concat(r,"GroupDelayEnabled")),l=Ou("got".concat(n,"GroupTimeDelayEnabled")),d=/Windows|Macintosh|Mac OS X|Linux/.test(navigator.userAgent),n&&o&&c&&!a&&d&&!s?(i.A.log("ANALYTICS: Position event enabled"),Gu(Wu("placement",n))):r&&!o&&a&&u&&!s?(i.A.log("ANALYTICS: Scroll delay enabled"),Gu(Wu("scrolling",r))):n&&!o&&!a&&s&&l?(i.A.log("ANALYTICS: Time delay enabled"),Gu(Wu("delayTime",n))):(i.A.log("ANALYTICS: No custom event detected"),Bu(Wu("default")))):Bu(t)}catch(e){i.A.log("ANALYTICS: Event not setup",e)}var n,r,o,a,s,c,u,l,d},Ku=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=!1,e.next=1,Au();case 1:if(!(n=e.sent)||!n.token){e.next=2;break}return o=n.token,a=n.isEntitled,s=n.adfree,i.A.log("ANALYTICS: entitlements options: ",a,s),!0===s&&i.A.log("ANALYTICS: user state: found ad free",s),!0===a?(i.A.log("ANALYTICS: user state: found subscriber"),t="subscriber"):(i.A.log("ANALYTICS: user state: LINA"),t="lina"),xu(o),e.abrupt("return",{userState:t,entitlements:n});case 2:return e.abrupt("return","noEntitlements");case 3:return e.prev=3,c=e.catch(0),i.A.log("ANALYTICS:",c),e.abrupt("return","entitlementError");case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),Hu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zc.blueConicReady();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Fu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("sspwG2iMeterEvent: initializing sspwG2iMeterEvent function"),e.next=1,mu();case 1:if("article"===e.sent){e.next=2;break}return i.A.log("sspwG2iMeterEvent: not an article page"),e.abrupt("return");case 2:return e.next=3,fu(["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",(o=document.querySelector("#server-paywall, #server-regwall, #nav-api-sspw, #nav-api-ssrw"))&&(i.A.log("sspwG2iMeterEvent: paywall element found: ",o.id),"server-paywall"===o.id||"nav-api-sspw"===o.id?n="SSPW":"server-regwall"!==o.id&&"nav-api-ssrw"!==o.id||(n="SSRW")),a="1"===window.sophi_config.enableSophiSSPW?"sophi":"sspw",s="SSPWV1","sophi"===a&&(s="nav-api-sspw"===o.id||"nav-api-ssrw"===o.id?"Sophi/Naviga_SSPW":"Sophi_SSPW"),c={event:"meterStop",author:t.Byline||"",title:t["Page Title"]||"",section:t.Section||"",actionType:s,actionName:n},i.A.log("sspwG2iMeterEvent: article data found on dataLayer: ",t),e.next=4,hu();case 4:window.MG2DL=window.MG2DL||[],window.MG2DL.push(c),i.A.log("sspwG2iMeterEvent: event pushed to MG2DL: ",window.MG2DL),e.next=6;break;case 5:i.A.log("sspwG2iMeterEvent: event not pushed, criteria not met");case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const Xu={onLoadAnalytics:function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("ANALYTICS: Start Analytics"),Uu(),window.MNGAuthentication.postAuthEvents=[],window.MNGAuthentication.preAuthGTMEvents=[],window.MNGAuthentication.postAuthEvents.push(ju),!((n=$c()).pathname.startsWith("/logout")||n.pathname.startsWith("/login")||n.pathname.startsWith("/callback"))){e.next=1;break}return e.abrupt("return");case 1:return Hu(),e.next=2,Mu();case 2:return o=e.sent,e.next=3,Ku();case 3:a=e.sent,Du(o,a),"1"!==window.authentication_config.serverEntitlements&&"1"!==(null===(t=window.sophi_config)||void 0===t?void 0:t.enableSophiSSPW)||(i.A.log("ANALYTICS: SSPW is active, setting up analytics events."),Fu());case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),blueConicRegwallEvents:Lu,callPreparedGTMEvent:Bu,callCustomGTMEvent:Gu};var Ju=n(1834),Yu=function(){try{var e=localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){i.A.log("Unable to get session from local storage: ",e)}return"{}"},Zu=function(e){try{i.A.log("Setting local storage session",e),localStorage.setItem(Fc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){i.A.log("Unable to save session from local storage: ",e)}},Vu=function(e){try{ru(Fc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:nu(),expires:365,secure:!0})}catch(e){i.A.log("Unable to save session to cookie storage: ",e)}},zu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.A.sessionServer,n="".concat(t,"/api/session"),i.A.log("Checking server session: ",n),e.next=1,Hc.get(n,{withCredentials:!0});case 1:if(!(a=e.sent).data){e.next=2;break}return h=a.data.entitlementTokenDecoded,p=a.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,A=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,Zu(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:A})),""!==g&&"string"==typeof g&&Vu(g),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:A});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)}}(),qu=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=o.A.sessionServer,a="".concat(n,"/api/session"),i.A.log("Updating server session: ",a),e.next=1,Hc.post(a,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),i.A.log("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)}}(),Qu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=o.A.sessionServer,n="".concat(t,"/api/session"),i.A.log("Deleting server session: ",n),e.next=1,Hc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,a=e.catch(0),i.A.log("Failed to delete server session: ",a);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),$u=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,_,R,k,O,I,C;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Inside getSession"),e.prev=1,d=Yu(),i.A.log("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,t=f,o=m,a=g,s=y,c=w,u=b,l=v,i.A.log("Session: check both tokens: ",t,o),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return i.A.log("Session: missing id or entitlements, try session server"),e.next=2,zu();case 2:A=e.sent,E=A.accessToken,S=A.idToken,T=A.entitlementToken,_=A.expiration,R=A.entitlementSource,k=A.isEntitled,O=A.adFree,I=A.entitlementLevel,n=E,t=S,o=T,a=_,s=R,c=k,u=O,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),i.A.log("Failed to get session: ",C);case 5:return i.A.log("Returning session: ",t,n,o),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:o,expiration:a,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)}}(),el=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,_,R,k,O,I,C,N,P;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Yu(),o=JSON.parse(n),a=o.accessToken,s=void 0===a?null:a,c=o.idToken,u=void 0===c?null:c,l=o.entitlementToken,d=void 0===l?null:l,h=o.expiration,p=void 0===h?null:h,f=o.entitlementSource,m=void 0===f?null:f,g=o.isEntitled,y=void 0===g?null:g,w=o.adFree,b=void 0===w?null:w,v=o.entitlementLevel,A=void 0===v?null:v,E=t.accessToken,S=t.idToken,T=t.entitlementToken,_=t.expiration,R=t.entitlementSource,k=t.isEntitled,O=t.adFree,I=t.entitlementLevel,C={accessToken:E??s,idToken:S??u,entitlementToken:T??d,expiration:_??p,entitlementSource:R??m,isEntitled:k??y,adFree:O??b,entitlementLevel:I??A},i.A.log("Current session data: ",o),i.A.log("New session data: ",t),i.A.log("Updated session data:",C),N=JSON.stringify(C),Zu(N),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&Vu(C.entitlementToken),n===N){e.next=1;break}return e.next=1,qu(C);case 1:e.next=3;break;case 2:e.prev=2,P=e.catch(0),i.A.log("Unable to save session: ",P);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),tl=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Ending session..."),Eu(),e.next=1,Qu();case 1:localStorage.removeItem(Fc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),nl="1"===window.authentication_config.isEmbedLoginEnabled,rl=function(){return"logout"===($c().searchParams.get("state")||"").toLowerCase()};nl||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var ol=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Ru();case 1:n=e.sent,i.A.log("Calling Auth0 logout...returning to ".concat(t)),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),il=function(){i.A.log("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){i.A.log("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=/")}},al=function(){return new Promise(function(e){i.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},sl=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c,u,l,d,h;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Attempting to logout..."),il(),i.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(o=n?au(n):"")){e.next=2;break}return a=o.auth0Id,e.next=1,Nu(a);case 1:e.sent.success?i.A.log("User cache cleared."):i.A.log("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,tl();case 3:e.next=5;break;case 4:Eu();case 5:return e.prev=5,i.A.log("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:i.A.log("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),i.A.log("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),i.A.log("Removed Auth0 storage object...")}),Su("hhsl"),Su("userNewsLetterData"),Su(Fc.REGWALL_USER_IS_SUBSCRIBED),Su(Fc.USER_PROFILE_HASH),c=$c(),u=window.location.origin;try{c.searchParams.get("returnURL")&&(l=decodeURIComponent(c.searchParams.get("returnURL")),u=l)}catch(e){i.A.log(e),u=window.location.origin}return u=new URL(u),e.next=9,window.ConnextUtils.connextReady("onInit",Ju.A.defaultTimeoutLength);case 9:if(!e.sent){e.next=11;break}return i.A.log("Auth | Connext silent mode enabled ",Connext.GetOptions().Silentmode),i.A.log("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),e.next=10,al();case 10:e.next=12;break;case 11:i.A.log("Connext Logout was NOT called");case 12:return i.A.log("Calling Auth0 logout now."),e.next=13,ol(u);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),cl=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},ul=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Bu(e)}),i.A.log("Cycled through preauth GTM events.")},ll=function(){var e=(0,t.A)(r.mark(function e(t,n,o,a,s){var c,l,d,h,p,f,m,g,y,w,b,v,A;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Attempting to login..."),cl()>4.5&&window.localStorage.clear(),ul(),a&&(c=[],l=window.localStorage.getItem("callbackEvents"),d=JSON.parse(l),c=d&&d.length>0?u(new Set([].concat(u(a),u(d)))):a,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),h=null,e.next=1,Ru();case 1:if(p=e.sent,f=$c(),m=f.origin,g=new URL("".concat(m,"/callback")),y={},f.searchParams.get("regwall")&&(f.searchParams.get("returnUrl")&&(w=f.searchParams.get("returnUrl")),f.searchParams.get("auth_redirect")&&(w=f.searchParams.get("auth_redirect"))),f.pathname.startsWith("/login")||f.pathname.startsWith("/callback")?f.searchParams.get("returnUrl")?g.searchParams.set("auth_redirect",f.searchParams.get("returnUrl")):s&&g.searchParams.set("auth_redirect",s):g.searchParams.set("auth_redirect",f.toString()),w&&"regwall"!==t&&g.searchParams.set("auth_redirect",w),"true"===f.searchParams.get("close-after-finish")&&g.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,tl();case 2:e.next=4;break;case 3:Eu();case 4:return null!==(h=f.searchParams.get("login-with"))?y.connection=h:n&&(y.connection=n),b="none",t&&"regwall"===t&&(g.searchParams.set("regwall","true"),b="signUp",i.A.log("Logging in with regwall")),t&&(g.searchParams.set("loginsource",t),i.A.log("Logging in with ".concat(t))),o&&(y.login_hint=o),y.redirect_uri=g.toString(),y.initialScreen=b,"googleonetap"!==t&&(y.prompt="select_account"),null!==(v=f.searchParams.get("ampRegiWall"))&&(A=window.location.hostname,y.ampRegiWall=v,y.sourceDomain=A.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)}}(),dl=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();i.A.log("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){i.A.log("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};i.A.log("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){i.A.log(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){i.A.log("Failed to wait for callback events",t),e()}})},hl=function(){var e=(0,t.A)(r.mark(function e(){var n,o,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,_;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(il(),n=$c(),o=!1,a=n.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=n.searchParams.get("redirect_uri")||"",s.includes("applenews")?(i.A.log("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),i.A.log("Post callback Apple redirect URL is ".concat(c)),ll(!1,!1,!1,[],c)):ll()):a.includes("post-apple-login")&&(i.A.log("This is Apple Callback flow."),o=!0,(u=new URL(decodeURIComponent(a))).searchParams.delete("post-apple-login"),a=u),i.A.log("Handling post login callback..."),!(l=n.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==l){e.next=1;break}return e.abrupt("return",ll(!1,!1,!1,!1,a));case 1:o&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Ru();case 3:return d=e.sent,e.next=4,d.handleRedirectCallback();case 4:return e.next=5,d.getIdTokenClaims();case 5:return h=e.sent,e.next=6,d.getUser();case 6:return p=e.sent,i.A.log("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,i.A.log("Cycling through login callbacks..."),e.next=9,dl();case 9:return g=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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:i.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),i.A.log("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="",!o){e.next=17;break}return e.prev=13,e.next=14,cu(y.userId);case 14:return b=e.sent,i.A.log("Encrypted apple uuid is: ".concat(b)),e.next=15,su(b);case 15:w=e.sent,i.A.log("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,T=e.catch(13),i.A.log("Apple sub check error: ".concat(T)),alert("There was an error in logging you in, please try again.");case 17:if(Su(Fc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return i.A.log("Saving idToken to session server"),e.next=18,el({idToken:f,accessToken:m});case 18:if(!n.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!n.search.includes("loginsource")){e.next=20;break}return v=n.searchParams.get("loginsource"),A=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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(A);case 20:return e.prev=20,E=new URL(a),o&&w&&E.searchParams.append("access_token",b),i.A.log("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,_=e.catch(20),i.A.log("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)}}(),pl=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("ANALYTICS: fireBC events"),e.next=1,Lu();case 1:i.A.log("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),fl=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c,u,l,d,h,p,f,m;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,vu();case 1:if(t=e.sent,n=t.idToken,o=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=au(n),c=s.email,u=s.picture,l=s.sub,d=s.name,h=s.nickname,p=s.connection_source,f=null===(a=s.user_metadata)||void 0===a||null===(a=a.customProfile)||void 0===a?void 0:a.nickname,l.split("|").pop(),e.abrupt("return",{authenticated:o,nickname:f||h||d,email:c,picture:u,userId:l,connectionSource:p});case 3:e.prev=3,m=e.catch(2),i.A.log("Unable to parse idToken: ",n," Error: ",m);case 4:return e.abrupt("return",{authenticated:o});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();nl||(window.MNGAuthentication.login=ll,window.MNGAuthentication.logout=sl,window.MNGAuthentication.getUserInfo=fl);var ml=function(){var e=(0,t.A)(r.mark(function e(){var n,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nl){e.next=1;break}return i.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=$c(),s=!1,c="",u=!1,l={},n.searchParams.get("returnAfterLogout")&&(d=decodeURIComponent(n.searchParams.get("returnAfterLogout")),window.location.assign(d)),n.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),h=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Ru();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return l=e.sent,e.next=3,t.isAuthenticated();case 3:if(s=e.sent,c="object"===(0,a.A)(l)?l.__raw:"",n=eu(Fc.ENTITLEMENT_COOKIE_KEY),s||!n){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,o=e.catch(0),i.A.log("Unable to verify user has active auth0 session: ",o);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!n.pathname.startsWith("/logout")){e.next=3;break}return i.A.log("Page is logout. Routing to logout function..."),e.next=2,sl();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,h();case 4:if(""===c){e.next=6;break}if(p=null,f=JSON.parse(window.localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Yu()){e.next=5;break}return f&&(p=f.jwt),e.next=5,el({idToken:c,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,$u();case 7:m=e.sent,c=m.idToken,(s="string"==typeof c)&&(l=au(c)),e.next=9;break;case 8:e.prev=8,A=e.catch(6),i.A.log("Unable to initialize session: ",A);case 9:e.next=11;break;case 10:return e.next=11,h();case 11:if(i.A.log("Authentication Init | isAuthenticated:",s),i.A.log("Authentication Init | accessToken:",u),!s||!o.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(y=null,l&&"object"===(0,a.A)(l)?y=l:c&&(y=au(c)),!((w=null===(g=y)||void 0===g?void 0:g.exp)&&Date.now()/1e3>w)){e.next=13;break}return i.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,sl();case 12:s=!1,c="",l={};case 13:if(s||u||!o.A.blueconicEnabled||!o.A.bcLowaSegements){e.next=15;break}return i.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,wu(!0);case 14:b=e.sent,i.A.log("BlueConic LOWA | bcLowaCheck result:",b),b.isSub?(i.A.log("BlueConic LOWA | authenticated as LOWA"),s=Fc.USER_IS_LOWA,l={sub:b.uuid}):i.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(ku({isAuthenticated:s,idToken:c,accessToken:u,claims:l}),Cu("authenticationReady"),!0===s?(i.A.log("User is authenticated."),n.searchParams.get("auth_redirect")&&(i.A.log("Auth Redirect is present, sending user to auth redirect..."),(v=n.searchParams.get("auth_redirect")).endsWith("#")&&(v=v.slice(0,v.length)),window.location.assign(v)),n.pathname.startsWith("/login")&&!rl()&&(i.A.log("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(n.origin))):i.A.log("User is not authenticated."),n.pathname.startsWith("/login")&&!rl()?(i.A.log("Page is login. Attempting to log user in..."),ll()):n.pathname.startsWith("/login")&&rl()?(i.A.log("Auth | Connext logout state present",Connext.GetOptions().Silentmode),window.ConnextUtils.rerunConnextEntitlements(!0),setTimeout(function(){var e=new URL(window.location.origin);n.searchParams.get("returnURL")&&(e=decodeURIComponent(n.searchParams.get("returnURL"))),i.A.log("Auth | Connext 300ms logout state expired. Manually reloading page.",Connext.GetOptions().Silentmode),window.location.assign(e)},300)):i.A.log("Page is not login or Connext state is present"),!n.pathname.startsWith("/callback")||!n.searchParams.get("regwall")){e.next=17;break}return i.A.log("Page is callback with regwall param. Routing to regwall receiver..."),e.next=16,pl();case 16:i.A.log("Now login from regwall"),ll(),e.next=18;break;case 17:if(!n.pathname.startsWith("/callback")){e.next=18;break}return i.A.log("Page is callback without regwall param. Routing to callback receiver..."),e.next=18,hl();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=ml;const gl={init:ml};var yl=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(i.A.log("Connext was not loaded."),n(!1)),i.A.log("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(){i.A.log("Signed user up to newsletter: ",t),n(!0)},onError:function(e){i.A.log("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){i.A.log("subscribeToNewsletter Error:",e),n(!1)}})};var wl=function(){var e=(0,t.A)(r.mark(function e(t){var n,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Google token ",t),n=au(t.credential),e.prev=1,Bu("one_tap_click"),localStorage.setItem("regwallSuccess","yes"),!o.A.newsletterId){e.next=2;break}return i.A.log("About to call Connext's subscribeToNewsletter function"),e.next=2,yl(n.email,o.A.newsletterId);case 2:e.next=4;break;case 3:e.prev=3,a=e.catch(1),i.A.log("Error: ",a);case 4:return i.A.log("About to login with onetap flow..."),e.next=5,window.MNGAuthentication.login("googleonetap",o.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)}}(),bl=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:google.accounts.id.initialize({client_id:o.A.googleClientId,callback:wl,auto_select:!1,cancel_on_tap_outside:!1}),i.A.log("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"),Bu(t)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const vl={init:function(){var e=(0,t.A)(r.mark(function e(){var t,n,a,s,c;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.oneTapEnabled){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,vu();case 2:if(t=e.sent,n=t.isAuthenticated,a=$c(),n!==Fc.USER_IS_LOWA){e.next=5;break}return e.next=3,yu();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||a.pathname.startsWith("/login")||a.pathname.startsWith("/logout")||a.pathname.startsWith("/callback"))){e.next=6;break}return e.abrupt("return");case 6:return e.next=7,lu();case 7:return i.A.log("onetap loading..."),c=new Date,e.next=8,bl(c);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};var Al=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Settings: ",o.A),gl.init(),Xu.onLoadAnalytics(),e.next=1,vl.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();Al()})()})(); //# 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.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function _(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return E(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 O=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function 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){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}K("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),K("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},467(e,t,n){"use strict";function r(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 o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)})}}n.d(t,{A:()=>o})},3029(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>r})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(9922);function o(e,t){for(var n=0;no});var r=n(9922);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},2327(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(2284);function o(e,t){if("object"!=(0,r.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=(0,r.A)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}},9922(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(2284),o=n(2327);function i(e){var t=(0,o.A)(e,"string");return"symbol"==(0,r.A)(t)?t:t+""}},2284(e,t,n){"use strict";function r(e){return r="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},r(e)}n.d(t,{A:()=>r})},1834(e,t,n){"use strict";n.d(t,{A:()=>l});var r=n(467),o=n(3029),i=n(2901),a=n(4467),s=n(4756),c=n(3153);window.disableAuth0AuthFlow=!0;var u=function(){function e(){var t,n;(0,o.A)(this,e),(0,a.A)(this,"readyInstances",new Map),(0,a.A)(this,"connextAlreadyRan",!1),(0,a.A)(this,"eventListeners",{}),(0,a.A)(this,"runConnextIfSilentTimer",void 0),(0,a.A)(this,"runningSophi","1"===(null===(t=window.authentication_config)||void 0===t?void 0:t.sophiSDKEnabled)||"1"===(null===(n=window.authentication_config)||void 0===n?void 0:n.sophiOnDevice))}return(0,i.A)(e,[{key:"init",value:function(){this.setupRunTimer()}},{key:"setupRunTimer",value:function(){var t=this;this.runConnextIfSilentTimer=setTimeout((0,r.A)(s.mark(function n(){return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t.connextReady("onInit",1e3*e.defaultTimeoutLength);case 1:n.sent&&(c.A.log("".concat(e.defaultTimeoutLength," second Connext timer is up.")),t.rerunConnextEntitlements());case 2:case"end":return n.stop()}},n)})),1e3*e.defaultTimeoutLength)}},{key:"connextReady",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onInit",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,o=this.readyInstances.get(n);if(o)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(o.status,".")),"pending"===o.status&&r0&&void 0!==o[0]&&o[0],r=o.length>1&&void 0!==o[1]&&!o[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",r);case 1:if(t.sent){t.next=2;break}return t.abrupt("return");case 2:if(Connext&&!this.connextAlreadyRan){t.next=3;break}return t.abrupt("return");case 3:n&&Connext.GetOptions().Silentmode?this.runConnext():n?c.A.log("Not rerunning Connext"):this.runConnext();case 4:case"end":return t.stop()}},t,this)})),function(){return n.apply(this,arguments)})},{key:"runConnextIfSilent",value:(t=(0,r.A)(s.mark(function t(){var n;return s.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.connextReady("onInit",1e3*e.backupTimeoutLength);case 1:if(n=t.sent,!this.runningSophi&&!this.connextAlreadyRan){t.next=2;break}return t.abrupt("return");case 2:n&&"undefined"!=typeof Connext&&Connext.GetOptions().Silentmode&&(c.A.log("Silent mode, running Connext now."),this.rerunConnextEntitlements());case 3:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})},{key:"removeEventListener",value:function(e){this.eventListeners[e]?(document.removeEventListener(e,this.eventListeners[e]),delete this.eventListeners[e],c.A.log('Connext removed event listener for "'.concat(e,'".'))):c.A.log('No event listener to remove for "'.concat(e,'".'))}}]);var t,n}();(0,a.A)(u,"defaultTimeoutLength",300),(0,a.A)(u,"backupTimeoutLength",1e5),(0,a.A)(u,"subTimeoutInterval",5e3),window.ConnextUtils=window.ConnextUtils||new u;const l=u},3153(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(3612);const o={log:function(){if(r.A.debug){for(var e,t=arguments.length,n=new Array(t),o=0;oc}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>js,hasStandardBrowserEnv:()=>Ws,hasStandardBrowserWebWorkerEnv:()=>Hs,navigator:()=>Ks,origin:()=>Gs});var t=n(467),r=n(4756),o=n(2284),i=n(4467);function a(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 d(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);oe.length)&&(t=e.length);for(var n=0,r=Array(t);nDate.now(),N="default";class P extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,P.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new P(t,n)}}class L extends P{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,L.prototype)}}class x extends P{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,x.prototype)}}class U extends P{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,U.prototype)}}class D extends U{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,D.prototype)}}class M extends P{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,M.prototype)}}class B extends P{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,B.prototype)}}class j extends P{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,j.prototype)}}class K extends P{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(G(e,["default"]),"', scope: '").concat(G(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,K.prototype)}}class W extends P{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(G(e,["default"]),"', missing scope: '").concat(G(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,W.prototype)}}class H extends P{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,H.prototype)}}function G(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const F=()=>window.crypto,X=()=>{let e="";for(;e.length<43;){const t=F().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},J=e=>btoa(e),Z=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],V=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=Z.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},Y=e=>{var t=e.clientId,n=d(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()},z=async e=>{const t=F().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},q=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),Q=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 $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},ee={},te={};Object.defineProperty(te,"__esModule",{value:!0});var ne=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}();te.default=function(){return ne.getInstance()};var re=$&&$.__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())})},oe=$&&$.__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 re(this,void 0,void 0,function(){return oe(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 re(this,void 0,void 0,function(){var n,r,o,i;return oe(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?ce:this.storageHandler,r=se+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,ae.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),ae.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 U;throw e}}}class fe{constructor(){this.activeLocks=new Set,this.lock=new he,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 U;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 me=null;const ge=new TextEncoder,ye=new TextDecoder;function we(e){return"string"==typeof e?ge.encode(e):ye.decode(e)}function be(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new Se(`${e.name} modulusLength must be at least 2048 bits`)}let ve;if(Uint8Array.prototype.toBase64)ve=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ve=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),Pe=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},Le=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:O;return o?(async(e,t,n,r,o,i,a,s,c)=>Ne({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s,skipTokenStorage:c},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0):(async(e,t,n)=>{const r=await Pe(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let n=T(t,2),r=n[0],o=n[1];return e[r]=o,e},{}))};var o})(e,r,a)};async function xe(e,t,n,r,o,i,a,s,c,u,l){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 h,p=null;for(let c=0;c<3;c++)try{h=await Le(e,n,r,o,i,a,t,s,l),p=null;break}catch(e){p=e}if(p)throw p;const f=h.json,m=f.error,g=f.error_description,y=d(f,["error","error_description"]),w=h,b=w.headers,v=w.ok;let A;if(c&&(A=b[Ie],A&&await c.setNonce(A)),!v){const d=g||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===m)throw new j(m,d,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===m)throw new K(n,r);if("use_dpop_nonce"===m){if(!c||!A||u)throw new H(A);return xe(e,t,n,r,o,i,a,s,c,!0,l)}throw new P(m||"request_error",d)}return y}async function Ue(e,t,n){var r=e.baseUrl,o=e.timeout,i=e.audience,a=e.scope,s=e.auth0Client,c=e.useFormData,u=e.useMrrt,l=e.dpop,h=d(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const p="urn:ietf:params:oauth:grant-type:token-exchange"===h.grant_type,f="refresh_token"===h.grant_type&&u,m=Object.assign(Object.assign(Object.assign(Object.assign({},h),p&&i&&{audience:i}),p&&a&&{scope:a}),f&&{audience:i,scope:a}),g=c?Y(m):JSON.stringify(m),y=(w=h.grant_type,Ce.includes(w));var w;return await xe("".concat(r,"/oauth/token"),o,i||N,a,{method:"POST",body:g,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(V(s||I)))}},t,c,u,y?l:void 0,void 0,n)}const De=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[N]),De(r,t)},Be="@@auth0spajs@@",je="@@user@@";class Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be,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=T(e.split("::"),4),n=t[0],r=t[1],o=t[2],i=t[3];return new Ke({clientId:r,scope:i,audience:o},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,r=e.client_id;return new Ke({scope:t,audience:n,clientId:r})}}class We{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(Be))}}class He{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 Ge{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||C}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=Ke.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/1e3);return i.expiresAt-t!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Ke({clientId:e},Be,je).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Ke.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===Be&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Ke.fromKey(r);if(t.prefix===Be&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=Ke.fromKey(i);if(r.prefix===Be&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class Fe{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 Xe=e=>"number"==typeof e,Je=["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 Ze=$&&$.__assign||function(){return Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n$e.get(e)||$e.get("".concat(et).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),qe("".concat(et).concat(e),JSON.stringify(t),r),$e.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Qe(e,n),$e.remove(e,t),$e.remove("".concat(et).concat(e),t)}},nt={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 rt;!function(e){e.Code="code",e.ConnectCode="connect_code"}(rt||(rt={}));var ot,it=function(e){return ot=ot||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 He).enclosedCache,localstorage:()=>new We},lt=e=>ut[e],dt=e=>{const t=e.openUrl,n=e.onRedirect,r=d(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},ht=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},pt={NONCE:"nonce",KEYPAIR:"keypair"};class ft{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(pt).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(pt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(pt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(pt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(pt.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());await Promise.all((null==n?void 0: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(pt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(pt.KEYPAIR,this.clientId)}}class mt{constructor(e){this.storage=new ft(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 t=e.keyPair,n=e.url,r=e.method,o=e.nonce,i=e.accessToken;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return Oe(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!_e(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 ke(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 Ee("unsupported JWK kty")}return Ae(await crypto.subtle.digest({name:"SHA-256"},we(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var gt;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(gt||(gt={}));class yt{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]:gt.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?gt.DPoP:gt.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===gt.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,Ie);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new H(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 wt{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 bt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new bt(t)}}class bt extends Error{constructor(e){let t=e.type,n=e.status,r=e.title,o=e.detail,i=e.validation_errors;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,bt.prototype)}}const vt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var At,Et;let St;if("undefined"==typeof navigator||null===(At=navigator.userAgent)||void 0===At||null===(Et=At.startsWith)||void 0===Et||!Et.call(At,"Mozilla/5.0 ")){const e="v3.8.6";St="".concat("oauth4webapi","/").concat(e)}function Tt(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Rt="ERR_INVALID_ARG_VALUE",_t="ERR_INVALID_ARG_TYPE";function Ot(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const kt=Symbol(),It=Symbol(),Ct=Symbol(),Nt=Symbol(),Pt=Symbol(),Lt=Symbol(),xt=new TextEncoder,Ut=new TextDecoder;function Dt(e){return"string"==typeof e?xt.encode(e):Ut.decode(e)}let Mt,Bt;if(Uint8Array.prototype.toBase64)Mt=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Mt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Ot("The input to be decoded is not correctly encoded.",Rt,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 Ot("".concat(n," must be a non-negative number"),Rt,o);return}throw Ot("".concat(n," must be a positive number"),Rt,o)}catch(e){if(r)throw Ht(e.message,r,o);throw e}}function Vt(e,t,n,r){try{if("string"!=typeof e)throw Ot("".concat(t," must be a string"),_t,r);if(0===e.length)throw Ot("".concat(t," must not be empty"),Rt,r)}catch(e){if(n)throw Ht(e.message,n,r);throw e}}function Yt(e){!function(e,t){if(En(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 Ht(t,Gn,e)}(e,t)}(e,"application/json")}function zt(){return jt(crypto.getRandomValues(new Uint8Array(32)))}function qt(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Kt("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}}function Qt(e){const t=null==e?void 0:e[It];return"number"==typeof t&&Number.isFinite(t)?t:0}function $t(e){const t=null==e?void 0:e[Ct];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function en(){return Math.floor(Date.now()/1e3)}function tn(e){if("object"!=typeof e||null===e)throw Ot('"as" must be an object',_t);Vt(e.issuer,'"as.issuer"')}function nn(e){if("object"!=typeof e||null===e)throw Ot('"client" must be an object',_t);Vt(e.client_id,'"client.client_id"')}function rn(e){return Vt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function on(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&Vt(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Ot("".concat(t," must be a CryptoKey"),_t)}(e,t),"private"!==e.type)throw Ot("".concat(t," must be a private CryptoKey"),Rt)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:qt(r),kid:o},u=function(e,t){const n=en()+Qt(t);return{jti:zt(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===(s=t[Pt])||void 0===s||s.call(t,c,u),i.set("client_id",n.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 Ot('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Rt);const r="".concat(jt(Dt(JSON.stringify(e))),".").concat(jt(Dt(JSON.stringify(t)))),o=jt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:er(e)};case"RSA-PSS":switch($n(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Kt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return $n(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Dt(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const an=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function sn(e,t){if(t&&"https:"!==e.protocol)throw Ht("only requests to HTTPS are allowed",Xn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Ht("only HTTP and HTTPS requests are allowed",Jn,e)}function cn(e,t,n,r){let o;if("string"!=typeof e||!(o=an(e)))throw Ht("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?zn:qn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return sn(o,r),o}function un(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?cn(e.mtls_endpoint_aliases[t],t,n,r):cn(e[t],t,n,r)}class ln extends Error{constructor(e,t){var n;super(e,t),v(this,"cause",void 0),v(this,"code",void 0),v(this,"error",void 0),v(this,"status",void 0),v(this,"error_description",void 0),v(this,"response",void 0),this.name=this.constructor.name,this.code=Bn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class dn extends Error{constructor(e,t){var n,r;super(e,t),v(this,"cause",void 0),v(this,"code",void 0),v(this,"error",void 0),v(this,"error_description",void 0),this.name=this.constructor.name,this.code=Kn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class hn extends Error{constructor(e,t){var n;super(e,t),v(this,"cause",void 0),v(this,"code",void 0),v(this,"response",void 0),v(this,"status",void 0),this.name=this.constructor.name,this.code=Mn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const pn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",fn="("+pn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',mn="("+pn+")\\s*=\\s*("+pn+")",gn=new RegExp("^[,\\s]*("+pn+")"),yn=new RegExp("^[,\\s]*"+fn+"[,\\s]*(.*)"),wn=new RegExp("^[,\\s]*"+mn+"[,\\s]*(.*)"),bn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function vn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!Tt(e,Response))throw Ot('"response" must be an instance of Response',_t);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(gn);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let p;if(d)for(;r;){let n,o;if(t=r.match(yn)){var i=T(t,4);if(n=i[1],o=i[2],r=i[3],o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}h[n.toLowerCase()]=o}else{if(!(t=r.match(wn))){if(t=r.match(bn)){if(Object.keys(h).length)break;var a=T(t,3);p=a[1],r=a[2];break}return}var s=T(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new hn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){Qn(e),Yt(e);try{const t=await e.clone().json();if(Gt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new ln("server responded with an error in the response body",{cause:t,response:e});throw Ht('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Fn,e)}}function An(e){if(!Nn.has(e))throw Ot('"options.DPoP" is not a valid DPoPHandle',Rt)}function En(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function Sn(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Nt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Xt(r,null==a?void 0:a.signal)})}async function Tn(e,t,n,r,o,i){var a;const s=un(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[kt]));o.set("grant_type",r);const c=Ft(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(An(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Sn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Rn=new WeakMap,_n=new WeakMap;function On(e){if(!e.id_token)return;const t=Rn.get(e);if(!t)throw Ot('"ref" was already garbage collected or did not resolve from the proper sources',Rt);return t}async function kn(e,t,n,r,o,i){if(tn(e),nn(t),!Tt(n,Response))throw Ot('"response" must be an instance of Response',_t);await vn(n,200,"Token Endpoint"),Qn(n);const a=await ir(n);if(Vt(a.access_token,'"response" body "access_token" property',Hn,{body:a}),Vt(a.token_type,'"response" body "token_type" property',Hn,{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;Zt(e,!0,'"response" body "expires_in" property',Hn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Vt(a.refresh_token,'"response" body "refresh_token" property',Hn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Ht('"response" body "scope" property must be a string',Hn,{body:a});if(void 0!==a.id_token){Vt(a.id_token,'"response" body "id_token" property',Hn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Zt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await async function(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new Kt("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw Ht("Invalid JWT",Hn,e);try{i=JSON.parse(Dt(jt(c)))}catch(e){throw Ht("failed to parse JWT Header body as base64url encoded JSON",Wn,e)}if(!Gt(i))throw Ht("JWT Header must be a top level object",Hn,e);if(t(i),void 0!==i.crit)throw new Kt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Dt(jt(u)))}catch(e){throw Ht("failed to parse JWT Payload body as base64url encoded JSON",Wn,e)}if(!Gt(a))throw Ht("JWT Payload must be a top level object",Hn,e);const h=en()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Ht('unexpected JWT "exp" (expiration time) claim type',Hn,{claims:a});if(a.exp<=h-r)throw Ht('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Zn,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Ht('unexpected JWT "iat" (issued at) claim type',Hn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Ht('unexpected JWT "iss" (issuer) claim type',Hn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Ht('unexpected JWT "nbf" (not before) claim type',Hn,{claims:a});if(a.nbf>h+r)throw Ht('unexpected JWT "nbf" (not before) claim value',Zn,{claims:a,now:h,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Ht('unexpected JWT "aud" (audience) claim type',Hn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,tr.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Qt(t),$t(t),o).then(xn.bind(void 0,i)).then(Cn.bind(void 0,e)).then(In.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw Ht('ID Token "aud" (audience) claim includes additional untrusted audiences',Vn,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw Ht('unexpected ID Token "azp" (authorized party) claim value',Vn,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&Zt(c.auth_time,!0,'ID Token "auth_time" (authentication time)',Hn,{claims:c}),_n.set(n,u),Rn.set(a,c)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Kt("unsupported `token_type` value",{cause:{body:a}});return a}function In(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Ht('unexpected JWT "aud" (audience) claim value',Vn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Ht('unexpected JWT "aud" (audience) claim value',Vn,{expected:e,claims:t.claims,claim:"aud"});return t}function Cn(e,t){var n,r;const o=null!==(n=null===(r=e[sr])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Ht('unexpected JWT "iss" (issuer) claim value',Vn,{expected:o,claims:t.claims,claim:"iss"});return t}const Nn=new WeakSet,Pn=Symbol(),Ln={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function xn(e,t){for(const n of e)if(void 0===t.claims[n])throw Ht('JWT "'.concat(n,'" (').concat(Ln[n],") claim missing"),Hn,{claims:t.claims});return t}const Un=Symbol(),Dn=Symbol();const Mn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Bn="OAUTH_RESPONSE_BODY_ERROR",jn="OAUTH_UNSUPPORTED_OPERATION",Kn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Wn="OAUTH_PARSE_ERROR",Hn="OAUTH_INVALID_RESPONSE",Gn="OAUTH_RESPONSE_IS_NOT_JSON",Fn="OAUTH_RESPONSE_IS_NOT_CONFORM",Xn="OAUTH_HTTP_REQUEST_FORBIDDEN",Jn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Zn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Vn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Yn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",zn="OAUTH_MISSING_SERVER_METADATA",qn="OAUTH_INVALID_SERVER_METADATA";function Qn(e){if(e.bodyUsed)throw Ot('"response" body has been used already',Rt)}function $n(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Kt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function er(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Kt("unsupported ECDSA namedCurve",{cause:e})}}function tr(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Ht('unexpected JWT "alg" header parameter',Hn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Ht('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 Ht('unexpected JWT "alg" header parameter',Hn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Ht('unexpected JWT "alg" header parameter',Hn,{header:r,expected:e,reason:"client configuration"})}function nr(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw Ht('"'.concat(t,'" parameter must be provided only once'),Hn);return r}const rr=Symbol(),or=Symbol();async function ir(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yt;try{t=await e.json()}catch(t){throw n(e),Ht('failed to parse "response" body as JSON',Wn,t)}if(!Gt(t))throw Ht('"response" body must be a top level object',Hn,{body:t});return t}const ar=Symbol(),sr=Symbol(),cr=new TextEncoder,ur=new TextDecoder;function lr(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function dr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},fr=(e,t)=>e.name===t;function mr(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw pr("SHA-".concat(t),"algorithm.hash")}function gr(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 yr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),v(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),v(this,"claim",void 0),v(this,"reason",void 0),v(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}v(br,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class vr extends wr{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}}),v(this,"code","ERR_JWT_EXPIRED"),v(this,"claim",void 0),v(this,"reason",void 0),v(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}v(vr,"code","ERR_JWT_EXPIRED");class Ar extends wr{constructor(){super(...arguments),v(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}v(Ar,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Er extends wr{constructor(){super(...arguments),v(this,"code","ERR_JOSE_NOT_SUPPORTED")}}v(Er,"code","ERR_JOSE_NOT_SUPPORTED"),v(class extends wr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),v(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),v(class extends wr{constructor(){super(...arguments),v(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Sr extends wr{constructor(){super(...arguments),v(this,"code","ERR_JWS_INVALID")}}v(Sr,"code","ERR_JWS_INVALID");class Tr extends wr{constructor(){super(...arguments),v(this,"code","ERR_JWT_INVALID")}}v(Tr,"code","ERR_JWT_INVALID"),v(class extends wr{constructor(){super(...arguments),v(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Rr extends wr{constructor(){super(...arguments),v(this,"code","ERR_JWKS_INVALID")}}v(Rr,"code","ERR_JWKS_INVALID");class _r extends wr{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),v(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}v(_r,"code","ERR_JWKS_NO_MATCHING_KEY");class Or extends wr{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),v(this,Symbol.asyncIterator,void 0),v(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}v(Or,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class kr extends wr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),v(this,"code","ERR_JWKS_TIMEOUT")}}v(kr,"code","ERR_JWKS_TIMEOUT");class Ir extends wr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),v(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}v(Ir,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Cr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Nr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Pr=e=>Cr(e)||Nr(e);function Lr(e,t,n){try{return hr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function xr(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const Ur=e=>xr(e)&&"string"==typeof e.kty;async function Dr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Kr||(Kr=new WeakMap);let o=Kr.get(e);if(null!=o&&o[n])return o[n];const i=await Br(E(E({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Kr.set(e,{[n]:i}),i};const Hr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},Xr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Jr=(e,t,n)=>{var r;const o=(e=>dr(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){Fr(e,48,"Invalid PKCS#8 structure"),Gr(e),Fr(e,2,"Expected version field");const t=Gr(e);e.pos+=t,Fr(e,48,"Expected algorithm identifier");Gr(e);e.pos}(t),(e=>{const t=(e=>{Fr(e,6,"Expected algorithm OID");const t=Gr(e);return Xr(e,t)})(e);if(Hr(t,[43,101,110]))return"X25519";if(!Hr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Fr(e,6,"Expected curve OID");const n=Gr(e),r=Xr(e,n);for(const e 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]}]){const t=e.name,n=e.oid;if(Hr(r,n))return t}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 Er("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 Er('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)},Zr=e=>null==e?void 0:e[Symbol.toStringTag],Vr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Yr,zr;let qr,Qr;if("undefined"==typeof navigator||null===(Yr=navigator.userAgent)||void 0===Yr||null===(zr=Yr.startsWith)||void 0===zr||!zr.call(Yr,"Mozilla/5.0 ")){const e="v6.8.4";Qr="".concat("openid-client","/").concat(e),qr={"user-agent":Qr}}const $r=e=>eo.get(e);let eo,to;function no(e){return void 0!==e?rn(e):(to||(to=new WeakMap),(e,t,n,r)=>{let o;return(o=to.get(t))||(function(e,t){if("string"!=typeof e)throw ao("".concat(t," must be a string"),io);if(0===e.length)throw ao("".concat(t," must not be empty"),oo)}(t.client_secret,'"metadata.client_secret"'),o=rn(t.client_secret),to.set(t,o)),o(e,t,n,r)})}const ro=Nt,oo="ERR_INVALID_ARG_VALUE",io="ERR_INVALID_ARG_TYPE";function ao(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class so extends Error{constructor(e,t){var n;super(e,t),v(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function co(e,t,n){return new so(e,{cause:t,code:n})}function uo(e){if(e instanceof TypeError||e instanceof so||e instanceof ln||e instanceof dn||e instanceof hn)throw e;if(e instanceof Wt)switch(e.code){case Xn:throw co("only requests to HTTPS are allowed",e,e.code);case Jn:throw co("only requests to HTTP or HTTPS are allowed",e,e.code);case Fn:throw co("unexpected HTTP response status code",e.cause,e.code);case Gn:throw co("unexpected response content-type",e.cause,e.code);case Wn:throw co("parsing error occured",e,e.code);case Hn:throw co("invalid response encountered",e,e.code);case Vn:throw co("unexpected JWT claim value encountered",e,e.code);case Yn:throw co("unexpected JSON attribute value encountered",e,e.code);case Zn:throw co("JWT timestamp claim value failed validation",e,e.code);default:throw co(e.message,e,e.code)}if(e instanceof Kt)throw co("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw co("runtime operation error",e,jn);case"NotSupportedError":throw co("runtime unsupported operation",e,jn);case"TimeoutError":throw co("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw co("operation aborted",e,"OAUTH_ABORT")}throw new so("something went wrong",{cause:e})}async function lo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw ao('"server" must be an instance of URL',io);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw Ot('"'.concat("issuerIdentifier",'" must be an instance of URL'),_t);sn(e,!0!==(null==r?void 0:r[kt]));const o=n(new URL(e.href)),i=Ft(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Nt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Xt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Jt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Jt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Ot('"options.algorithm" must be "oidc" (default), or "oauth2"',Rt)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Nt]:null==t?void 0:t[ro],[kt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(bo),signal:a,headers:new Headers(qr)}):((null==t?void 0:t[ro])||fetch)((sn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(bo)),e.href),{headers:Object.fromEntries(new Headers(E({accept:"application/json"},qr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==ar)throw Ot('"expectedIssuerIdentifier" must be an instance of URL',_t);if(!Tt(t,Response))throw Ot('"response" must be an instance of Response',_t);if(200!==t.status)throw Ht('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Fn,t);Qn(t);const r=await ir(t);if(Vt(r.issuer,'"response" body "issuer" property',Hn,{body:r}),n!==ar&&new URL(r.issuer).href!==n.href)throw Ht('"response" body "issuer" property does not match the expected value',Yn,{expected:n.href,body:r,attribute:"issuer"});return r}(ar,e)).catch(uo);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[ho]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new so("discovered metadata issuer does not match the expected issuer",{code:Yn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new po(i,t,n,r);let s=$r(a);if(null!=o&&o[ro]&&(s.fetch=o[ro]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const ho=Symbol();class po{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw ao('"clientId" must be a non-empty string',io);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw ao('"clientId" and "metadata.client_id" must be the same',oo);const u=E(E({},structuredClone(n)),{},{client_id:t});let l;u[It]=null!==(i=null===(a=n)||void 0===a?void 0:a[It])&&void 0!==i?i:0,u[Ct]=null!==(s=null===(c=n)||void 0===c?void 0:c[Ct])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?no(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);ho in e&&(h[sr]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);eo||(eo=new WeakMap),eo.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone($r(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone($r(this).c)}get timeout(){return $r(this).timeout}set timeout(e){$r(this).timeout=e}get[ro](){return $r(this).fetch}set[ro](e){$r(this).fetch=e}}function fo(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return On(this)}catch(e){return}}}}}(e))}async function mo(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Wt("invalid Retry-After header value",{cause:e});a>t&&await go(a-t,n)}function go(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 yo(e,t){Ro(e);const n=$r(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){tn(e),nn(t);const i=un(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[kt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Ft(null==o?void 0:o.headers);return s.set("accept","application/json"),Sn(e,t,n,i,a,s,o)}(r,o,i,t,{[Nt]:a,[kt]:!s,headers:new Headers(qr),signal:_o(c)}).then(e=>async function(e,t,n){if(tn(e),nn(t),!Tt(n,Response))throw Ot('"response" must be an instance of Response',_t);await vn(n,200,"Backchannel Authentication Endpoint"),Qn(n);const r=await ir(n);Vt(r.auth_req_id,'"response" body "auth_req_id" property',Hn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Zt(o,!0,'"response" body "expires_in" property',Hn,{body:r}),r.expires_in=o,void 0!==r.interval&&Zt(r.interval,!1,'"response" body "interval" property',Hn,{body:r}),r}(r,o,e)).catch(uo)}async function wo(e,t,n,r){var o,i;Ro(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 go(a,s)}catch(e){uo(e)}const c=$r(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,m=c.timeout,g=c.decrypt,y=(o,i)=>wo(e,E(E({},t),{},{interval:o}),n,E(E({},r),{},{signal:s,flag:i})),w=function(e,t){const n=_o(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,m),b=await async function(e,t,n,r,o){tn(e),nn(t),Vt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Tn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[Nt]:h,[kt]:!p,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(qr),signal:w.signal}).catch(uo).finally(w.cleanup);var v;if(503===b.status&&b.headers.has("retry-after"))return await mo(b,a,s,!0),await(null===(v=b.body)||void 0===v?void 0:v.cancel()),y(a);const A=async function(e,t,n,r){return kn(e,t,n,void 0,null==r?void 0:r[Lt],null==r?void 0:r.recognizedTokenTypes)}(u,l,b,{[Lt]:g});let S;try{S=await A}catch(e){if(Oo(e,r))return y(a,ko);if(e instanceof ln)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await mo(e.response,a,s),y(a)}uo(e)}return S.id_token&&await(null==f?void 0:f(b)),fo(S),S}function bo(e){$r(e).tlsOnly=!1}async function vo(e,t,n,r,o){if(Ro(e),!((null==o?void 0:o.flag)===ko||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw ao('"currentUrl" must be an instance of URL, or Request',io);let i,a;const s=$r(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,m=s.nonRepudiation,g=s.timeout,y=s.decrypt,w=s.implicit;if((null==o?void 0:o.flag)===ko)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Ot("form_post responses are expected to use the POST method",Rt,{cause:e});if("application/x-www-form-urlencoded"!==En(e))throw Ot("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Rt,{cause:e});return async function(e){if(e.bodyUsed)throw Ot("form_post Request instances must contain a readable body",Rt,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var b=T(e,2);const n=b[0],r=b[1];t.searchParams.append(n,r)}break;default:throw ao("unexpected Request HTTP method",oo)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!p:i=await p(t,null==n?void 0:n.expectedState);break;case!!f:i=await f(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!w:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(tn(e),nn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Ot('"parameters" must be an instance of URLSearchParams, or URL',_t);if(nr(n,"response"))throw Ht('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Hn,{parameters:n});const o=nr(n,"iss"),i=nr(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Ht('response parameter "iss" (issuer) missing',Hn,{parameters:n});if(o&&o!==e.issuer)throw Ht('unexpected "iss" (issuer) response parameter value',Hn,{expected:e.issuer,parameters:n});switch(r){case void 0:case or:if(void 0!==i)throw Ht('unexpected "state" response parameter encountered',Hn,{expected:void 0,parameters:n});break;case rr:break;default:if(Vt(r,'"expectedState" argument'),i!==r)throw Ht(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Hn,{expected:r,parameters:n})}if(nr(n,"error"))throw new dn("authorization response from the server is an error",{cause:n});const a=nr(n,"id_token"),s=nr(n,"token");if(void 0!==a||void 0!==s)throw new Kt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Nn.add(c),c;var c}(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){uo(e)}}}const v=await async function(e,t,n,r,o,i,a){if(tn(e),nn(t),!Nn.has(r))throw Ot('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Rt);Vt(o,'"redirectUri"');const s=nr(r,"code");if(!s)throw Ht('no authorization code in "callbackParameters"',Hn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Pn&&(Vt(i,'"codeVerifier"'),c.set("code_verifier",i)),Tn(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||Pn,{additionalParameters:r,[Nt]:d,[kt]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(qr),signal:_o(g)}).catch(uo);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const A=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=Un;break;case Un:break;default:Vt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Dn;break;case Dn:break;default:Zt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await kn(e,t,n,s,i,a);Vt(c.id_token,'"response" body "id_token" property',Hn,{body:c});const u=On(c);if(o!==Dn){const e=en()+Qt(t),n=$t(t);if(u.auth_time+o{}});const m=async function(e,t,n,r){return kn(e,t,n,void 0,null==r?void 0:r[Lt],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[Lt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(o){if(Oo(o,r))return Io(e,t,n,E(E({},r),{},{flag:ko}));uo(o)}return g.id_token&&await(null==h?void 0:h(p)),fo(g),g}async function Co(e,t,n){if(!xr(e))throw new Sr("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Sr('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Sr("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Sr("JWS Payload missing");if("string"!=typeof e.signature)throw new Sr("JWS Signature missing or incorrect type");if(void 0!==e.header&&!xr(e.header))throw new Sr("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=hr(e.protected);r=JSON.parse(ur.decode(t))}catch(e){throw new Sr("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Er('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 s=o.alg;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 Ar('"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(Ur(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Vr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Pr(t))throw new TypeError(yr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Zr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Ur(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Vr(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)&&Vr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Pr(t))throw new TypeError(yr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Zr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Zr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Zr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Zr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Zr(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;ne+t.length,0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?lr(e.protected):new Uint8Array,lr("."),"string"==typeof e.payload?a?lr(e.payload):cr.encode(e.payload):e.payload),d=Lr(e.signature,"signature",Sr),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(Cr(e))return e;if(Nr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Kr||(Kr=new WeakMap);let n=Kr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(jr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(jr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(jr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(jr)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(jr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(jr);return n?n[t]=i:Kr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Wr(e,n,t)}if(Ur(e))return e.k?hr(e.k):Wr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Dr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const n=t.algorithm.modulusLength;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 Er("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new Ir;let p;p=a?Lr(e.payload,"payload",Sr):"string"==typeof e.payload?cr.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?E(E({},f),{},{key:h}):f}const No=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Po(e){const t=No.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const Lo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function xo(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(ur.decode(t))}catch(e){}if(!xr(n))throw new Tr("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(o&&("string"!=typeof e.typ||Lo(e.typ)!==Lo(o)))throw new br('unexpected "typ" JWT header value',n,"typ","check_failed");const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in n))throw new br('missing required "'.concat(e,'" claim'),n,e,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(n.iss))throw new br('unexpected "iss" claim value',n,"iss","check_failed");if(c&&n.sub!==c)throw new br('unexpected "sub" claim value',n,"sub","check_failed");if(u&&(p="string"==typeof u?[u]:u,!("string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(Set.prototype.has.bind(new Set(h))))))throw new br('unexpected "aud" claim value',n,"aud","check_failed");var h,p;let f;switch(typeof r.clockTolerance){case"string":f=Po(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const m=(g=r.currentDate||new Date,Math.floor(g.getTime()/1e3));var g;if((void 0!==n.iat||l)&&"number"!=typeof n.iat)throw new br('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new br('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+f)throw new br('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new br('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-f)throw new vr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(l){const e=m-n.iat;if(e-f>("number"==typeof l?l:Po(l)))throw new vr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-f)throw new br('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function Uo(e){return xr(e)}var Do,Mo,Bo=new WeakMap,jo=new WeakMap;class Ko{constructor(e){if(w(this,Bo,void 0),w(this,jo,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Uo)}(e))throw new Rr("JSON Web Key Set malformed");b(Bo,this,structuredClone(e))}jwks(){return y(Bo,this)}async getKey(e,t){const n=E(E({},e),null==t?void 0:t.header),r=n.alg,o=n.kid,i=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 Er('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=y(Bo,this).keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof o&&(t=o===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==i||(t=r===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(r){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}),s=a[0],c=a.length;if(0===c)throw new _r;if(1!==c){const e=new Or,t=y(jo,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new R(e.apply(this,arguments))}}(function*(){for(const e of a)try{yield yield m(Wo(t,e,r))}catch(e){}}),e}return Wo(y(jo,this),s,r)}}async function Wo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!xr(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return hr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Er('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Br(E(E({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Br(E(E({},e),{},{ext:n}));case"EC":case"OKP":return Br(E(E({},e),{},{alg:t,ext:n}));default:throw new Er('Unsupported "kty" (Key Type) Parameter value')}}(E(E({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Rr("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Ho(e){const t=new Ko(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let Go;if("undefined"==typeof navigator||null===(Do=navigator.userAgent)||void 0===Do||null===(Mo=Do.startsWith)||void 0===Mo||!Mo.call(Do,"Mozilla/5.0 ")){const e="v6.2.3";Go="".concat("jose","/").concat(e)}const Fo=Symbol(),Xo=Symbol();var Jo=new WeakMap,Zo=new WeakMap,Vo=new WeakMap,Yo=new WeakMap,zo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap;class ni{constructor(e,t){if(w(this,Jo,void 0),w(this,Zo,void 0),w(this,Vo,void 0),w(this,Yo,void 0),w(this,zo,void 0),w(this,qo,void 0),w(this,Qo,void 0),w(this,$o,void 0),w(this,ei,void 0),w(this,ti,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;b(Jo,this,new URL(e.href)),b(Zo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),b(Vo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),b(Yo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),b(Qo,this,new Headers(null==t?void 0:t.headers)),Go&&!y(Qo,this).has("User-Agent")&&y(Qo,this).set("User-Agent",Go),y(Qo,this).has("accept")||(y(Qo,this).set("accept","application/json"),y(Qo,this).append("accept","application/jwk-set+json")),b($o,this,null==t?void 0:t[Fo]),void 0!==(null==t?void 0:t[Xo])&&(b(ti,this,null==t?void 0:t[Xo]),n=null==t?void 0:t[Xo],r=y(Yo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&xr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,xr)&&(b(zo,this,y(ti,this).uat),b(ei,this,Ho(y(ti,this).jwks))))}pendingFetch(){return!!y(qo,this)}coolingDown(){return"number"==typeof y(zo,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new kr;throw e});if(200!==o.status)throw new wr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new wr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(y(Jo,this).href,y(Qo,this),AbortSignal.timeout(y(Zo,this)),y($o,this)).then(e=>{b(ei,this,Ho(e)),y(ti,this)&&(y(ti,this).uat=Date.now(),y(ti,this).jwks=e),b(zo,this,Date.now()),b(qo,this,void 0)}).catch(e=>{throw b(qo,this,void 0),e})),await y(qo,this)}}const ri=["mfaToken"],oi=["mfaToken"];var ii,ai,si,ci,ui,li,di,hi,pi,fi,mi,gi,yi,wi,bi,vi,Ai=class extends Error{constructor(e,t){super(t),v(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Ei=class extends Error{constructor(e,t,n){super(t),v(this,"cause",void 0),v(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Si=class extends Ei{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Ti=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"}},_i=class extends Ei{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Oi=class extends Ei{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ki=class extends Ei{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Ii=class extends Error{constructor(e){super(e),v(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Ci=class extends Ei{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),v(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Ni=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"}},Pi=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"}},xi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),v(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Ui(e){return Object.entries(e).filter(e=>void 0!==T(e,2)[1]).reduce((e,t)=>E(E({},e),{},{[t[0]]:t[1]}),{})}var Di=class extends Error{constructor(e,t,n){super(t),v(this,"cause",void 0),v(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Mi=class extends Di{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Bi=class extends Di{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},ji=class extends Di{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ki=class extends Di{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Wi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Hi=(ii=new WeakMap,ai=new WeakMap,si=new WeakMap,class{constructor(e){var t;w(this,ii,void 0),w(this,ai,void 0),w(this,si,void 0),b(ii,this,"https://".concat(e.domain)),b(ai,this,e.clientId),b(si,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(y(ii,this),"/mfa/authenticators"),n=e.mfaToken,r=await y(si,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Mi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Wi)}async enrollAuthenticator(e){const t="".concat(y(ii,this),"/mfa/associate"),n=e.mfaToken,r=S(e,ri),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await y(si,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Bi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const t=e.authenticatorId,n=e.mfaToken,r="".concat(y(ii,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await y(si,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new ji(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(y(ii,this),"/mfa/challenge"),n=e.mfaToken,r=S(e,oi),o={mfa_token:n,client_id:y(ai,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await y(si,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Ki(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),Gi=class e{constructor(e,t,n,r,o,i,a){v(this,"accessToken",void 0),v(this,"idToken",void 0),v(this,"refreshToken",void 0),v(this,"expiresAt",void 0),v(this,"scope",void 0),v(this,"claims",void 0),v(this,"authorizationDetails",void 0),v(this,"tokenType",void 0),v(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},Fi=(ci=new WeakMap,ui=new WeakMap,li=new WeakMap,class{constructor(e,t){w(this,ci,new Map),w(this,ui,void 0),w(this,li,void 0),b(li,this,Math.max(1,Math.floor(e))),b(ui,this,Math.max(0,Math.floor(t)))}get(e){const t=y(ci,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return y(ci,this).delete(e),y(ci,this).set(e,t),t.value;y(ci,this).delete(e)}}set(e,t){for(y(ci,this).has(e)&&y(ci,this).delete(e),y(ci,this).set(e,{value:t,expiresAt:Date.now()+y(ui,this)});y(ci,this).size>y(li,this);){const e=y(ci,this).keys().next().value;if(void 0===e)break;y(ci,this).delete(e)}}}),Xi=new Map;function Ji(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var Zi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Xi.get(i));var i;return o||(o=new Fi(e.maxEntries,e.ttlMs),Xi.set(t,o)),o}static createJwksCache(){return{}}},Vi="openid profile email offline_access",Yi=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function zi(e){if(null==e)throw new ki("subject_token is required");if("string"!=typeof e)throw new ki("subject_token must be a string");if(0===e.trim().length)throw new ki("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ki("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ki("subject_token must not include the 'Bearer ' prefix")}function qi(e,t){if(t)for(const r of Object.entries(t)){var n=T(r,2);const t=n[0],o=n[1];if(!Yi.has(t))if(Array.isArray(o)){if(o.length>20)throw new ki("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}else e.append(t,o)}}var Qi="urn:ietf:params:oauth:token-type:access_token",$i=(di=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,wi=new WeakMap,bi=new WeakMap,vi=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){g(e,t),t.add(e)}(this,vi),w(this,di,void 0),w(this,hi,void 0),w(this,pi,void 0),w(this,fi,void 0),w(this,mi,void 0),w(this,gi,void 0),w(this,yi,void 0),w(this,wi,void 0),w(this,bi,void 0),v(this,"mfa",void 0),b(fi,this,e),e.useMtls&&!e.customFetch)throw new Ai("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");b(mi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,E(E({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=Ji(e.discoveryCache);b(yi,this,Zi.createDiscoveryCache(i)),b(wi,this,new Map),b(bi,this,Zi.createJwksCache()),this.mfa=new Hi({domain:y(fi,this).domain,clientId:y(fi,this).clientId,customFetch:y(mi,this)})}async getServerMetadata(){return(await f(vi,this,na).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await f(vi,this,na).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ai("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 f(vi,this,aa).call(this,e)}catch(e){throw new Ni(e)}}async buildLinkUserUrl(e){try{const t=await f(vi,this,aa).call(this,{authorizationParams:E(E({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Pi(e)}}async buildUnlinkUserUrl(e){try{const t=await f(vi,this,aa).call(this,{authorizationParams:E(E({},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 t=await f(vi,this,na).call(this),n=t.configuration,r=t.serverMetadata,o=Ui(E(E({},y(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(E(E({scope:Vi},o),{},{client_id:y(fi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await yo(n,i),t=await wo(n,e);return Gi.fromTokenEndpointResponse(t)}catch(e){throw new Ci(e)}}async initiateBackchannelAuthentication(e){const t=await f(vi,this,na).call(this),n=t.configuration,r=t.serverMetadata,o=Ui(E(E({},y(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(E(E({scope:Vi},o),{},{client_id:y(fi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await yo(n,i);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Ci(e)}}async backchannelAuthenticationGrant(e){let t=e.authReqId;const n=(await f(vi,this,na).call(this)).configuration,r=new URLSearchParams({auth_req_id:t});try{const e=await Io(n,"urn:openid:params:grant-type:ciba",r);return Gi.fromTokenEndpointResponse(e)}catch(e){throw new Ci(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new 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?Qi:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ki)throw new Oi(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?f(vi,this,ra).call(this,e):f(vi,this,oa).call(this,e)}async getTokenByCode(e,t){const n=(await f(vi,this,na).call(this)).configuration;try{const r=await vo(n,e,{pkceCodeVerifier:t.codeVerifier});return Gi.fromTokenEndpointResponse(r)}catch(e){throw new Si("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const t=(await f(vi,this,na).call(this)).configuration,n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await Ao(t,e.refreshToken,n);return Gi.fromTokenEndpointResponse(r)}catch(e){throw new Ri("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const t=(await f(vi,this,na).call(this)).configuration,n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await f(vi,this,ia).call(this);r=new po(t.serverMetadata(),y(fi,this).clientId,y(fi,this).clientSecret,n),r[ro]=(t,n)=>y(mi,this).call(this,t,E(E({},n),{},{headers:E(E({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Io(r,"password",n);return Gi.fromTokenEndpointResponse(e)}catch(e){throw new _i("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const t=(await f(vi,this,na).call(this)).configuration;try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await Eo(t,n);return Gi.fromTokenEndpointResponse(r)}catch(e){throw new Ti("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const t=await f(vi,this,na).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(y(fi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",y(fi,this).clientId),t}return function(e,t){Ro(e);const n=$r(e),r=n.as,o=n.c,i=un(r,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",o.client_id);for(const e of t.entries()){var a=T(e,2);const t=a[0],n=a[1];i.searchParams.append(t,n)}return i}(n,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const t=(await f(vi,this,na).call(this)).serverMetadata,n=Ji(y(fi,this).discoveryCache),r=t.jwks_uri;y(gi,this)||b(gi,this,function(e,t){const n=new ni(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[Fo]:y(mi,this),[Xo]:y(bi,this)}));const o=(await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=ur.decode(e)),"string"!=typeof e)throw new Sr("Compact JWS must be a string or Uint8Array");const r=e.split("."),o=r[0],i=r[1],a=r[2];if(3!==r.length)throw new Sr("Invalid Compact JWS");const s=await Co({payload:i,protected:o,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?E(E({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Tr("JWTs MUST NOT use unencoded payload");const i={payload:xo(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?E(E({},i),{},{key:o.key}):i}(e.logoutToken,y(gi,this),{issuer:t.issuer,audience:y(fi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in o)&&!("sub"in o))throw new Ii('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new Ii('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new Ii('"sub" claim must be a string');if("nonce"in o)throw new Ii('"nonce" claim is prohibited');if(!("events"in o))throw new Ii('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new Ii('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new Ii('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new Ii('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function ea(){const e=y(fi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(y(fi,this).useMtls?"1":"0")}async function ta(e){const t=await f(vi,this,ia).call(this),n=new po(e,y(fi,this).clientId,y(fi,this).clientSecret,t);return n[ro]=y(mi,this),n}async function na(){if(y(di,this)&&y(hi,this))return{configuration:y(di,this),serverMetadata:y(hi,this)};const e=f(vi,this,ea).call(this),t=y(yi,this).get(e);if(t)return b(hi,this,t.serverMetadata),b(di,this,await f(vi,this,ta).call(this,t.serverMetadata)),{configuration:y(di,this),serverMetadata:y(hi,this)};const n=y(wi,this).get(e);if(n){const e=await n;return b(hi,this,e.serverMetadata),b(di,this,await f(vi,this,ta).call(this,e.serverMetadata)),{configuration:y(di,this),serverMetadata:y(hi,this)}}const r=(async()=>{const t=await f(vi,this,ia).call(this),n=await lo(new URL("https://".concat(y(fi,this).domain)),y(fi,this).clientId,{use_mtls_endpoint_aliases:y(fi,this).useMtls},t,{[ro]:y(mi,this)}),r=n.serverMetadata();return y(yi,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>({serverMetadata:e.serverMetadata}));o.catch(()=>{}),y(wi,this).set(e,o);try{const e=await r,t=e.configuration,n=e.serverMetadata;b(di,this,t),b(hi,this,n),y(di,this)[ro]=y(mi,this)}finally{y(wi,this).delete(e)}return{configuration:y(di,this),serverMetadata:y(hi,this)}}async function ra(e){var t,n;const r=(await f(vi,this,na).call(this)).configuration;if("audience"in e||"resource"in e)throw new ki("audience and resource parameters are not supported for Token Vault exchanges");zi(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:Qi,requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),qi(o,e.extra);try{const e=await Io(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return Gi.fromTokenEndpointResponse(e)}catch(t){throw new ki("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function oa(e){const t=(await f(vi,this,na).call(this)).configuration;zi(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),qi(n,e.extra);try{const e=await Io(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return Gi.fromTokenEndpointResponse(e)}catch(t){throw new ki("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ia(){return y(pi,this)||b(pi,this,(async()=>{if(!y(fi,this).clientSecret&&!y(fi,this).clientAssertionSigningKey&&!y(fi,this).useMtls)throw new xi;if(y(fi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=y(fi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Jr(e,t,void 0)}(e,y(fi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return on(e,void 0)}(e):no(y(fi,this).clientSecret)})().catch(e=>{throw b(pi,this,void 0),e})),y(pi,this)}async function aa(e){const t=(await f(vi,this,na).call(this)).configuration,n=zt(),r=await function(e){return async function(e){return Vt(e,"codeVerifier"),jt(await crypto.subtle.digest("SHA-256",Dt(e)))}(e)}(n),o=Ui(E(E({},y(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(E(E({scope:Vi},o),{},{client_id:y(fi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await To(t,i):await So(t,i),codeVerifier:n}}class sa extends P{constructor(e,t){super(e,t),Object.setPrototypeOf(this,sa.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new sa(t,n)}}class ca extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ca.prototype)}}class ua extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ua.prototype)}}class la extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,la.prototype)}}class da extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}}class ha extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const n of this.contexts){var t=T(n,2);const r=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(r)}}get size(){return this.contexts.size}}class fa{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new pa}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new ca("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof Mi)throw new ca(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=vt[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof Bi)throw new ua(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof Ki)throw new la(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new ha("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new da("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new da("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof j)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof da)throw new da(e.error,e.error_description);throw e}}}class ma{constructor(e){let t,n;if(this.userCache=(new He).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(!F())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===F().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=(me||(me=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new pe:new fe;var e}()),me),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||k,!lt(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=lt(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:O,this.cookieStorage=!1===e.legacySameSiteCookie?$e:tt,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:nt;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]=De(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Fe(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||C,this.cacheManager=new Ge(n,n.allKeys?void 0:new st(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new mt(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 wt(s,a),this.authJsClient=new $i({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new fa(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===k&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new it,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||I,n=V(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(Y(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=T(t,3),r=n[0],o=n[1],i=n[2];if(3!==t.length||!r||!o||!i)throw new Error("ID token could not be decoded");const a=JSON.parse(q(o)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],Je.includes(e)||(c[e]=a[e])}),{encoded:{header:r,payload:o,signature:i},header:JSON.parse(q(r)),claims:s,user:c}})(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&&!Xe(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||!Xe(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Xe(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&&Xe(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(o))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=J(X()),i=J(X()),a=X(),s=await z(a),c=Q(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:Me(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||N,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 B;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new M(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new D(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(P.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new P("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=dt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),n=t.openUrl,r=t.fragment,o=t.appState,i=d(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),u=c.url,l=d(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:rt.Code}),a&&{organization:a}));const h=r?"".concat(u,"#").concat(r):u;n?await n(h):window.location.assign(h)}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 P("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===rt.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,r=e.state,o=e.error,i=e.error_description;if(o)throw new L(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new P("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:rt.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,r=e.state,o=e.error,i=e.error_description;if(o)throw new x(o,i||o,t.connection,r,t.appState);if(!n)throw new P("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new P("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:rt.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(ct))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(ct)}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:Me(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=at[t];return n||(n=e().finally(()=>{delete at[t],n=null}),at[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 t=e.cacheMode,n=d(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||N,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||N,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),r=e.id_token,o=e.token_type,i=e.access_token,a=e.oauthTokenScope,s=e.expires_in;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 j||e instanceof P&&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||N,clientId:this.options.clientId});if(!t)throw new P("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:Me(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({},_),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new Ke({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||N,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||{},n=t.federated,r=d(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(Y(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||N,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,r=e.useFormData,o=e.refreshTokens,i=e.audience,a=e.client_id,s=e.onRefreshTokenRevoked;const c=e.timeout||O,u="refresh_token",l="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":r?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(V(n||I)))};if(t){const n={client_id:a,token_type_hint:u},o=r?Y(n):JSON.stringify(n);try{return await Ne({type:"revoke",timeout:c,fetchUrl:l,fetchOptions:{method:"POST",body:o,headers:d},useFormData:r,auth:{audience:null!=i?i:N}},t)}catch(e){throw new P("revoke_error",e.message)}}for(const t of o){const n={client_id:a,token_type_hint:u,token:t},o=r?Y(n):JSON.stringify(n),i=await Pe(l,{method:"POST",body:o,headers:d},c);if(!i.ok){let t,n;try{var h=JSON.parse(await i.text());t=h.error,n=h.error_description}catch(e){}throw new P(t||"revoke_error",n||"HTTP error ".concat(i.status))}await(null==s?void 0:s(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=dt(e),r=n.openUrl,o=d(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(je);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await Ne({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const r=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin),o=r.url,i=r.state,a=r.nonce,s=r.code_verifier,c=r.redirect_uri,u=r.scope,l=r.audience;if(window.crossOriginIsolated)throw new P("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const d=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let h;try{h=new URL(this.domainUrl).origin}catch(e){h=this.domainUrl}const p=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 U),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(P.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)})}(o,h,d);if(i!==p.state)throw new P("state_mismatch","Invalid state");const f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:s,code:p.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:t.organization});return Object.assign(Object.assign({},f),{scope:u,oauthTokenScope:f.scope,audience:l})})}catch(e){throw"login_required"===e.error&&(e instanceof P&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new Ke({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||N,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||N,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&&ht(l,c)||ht(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 W(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||N})}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 j&&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 t=e.id_token,n=e.decodedToken,r=d(e,["id_token","decodedToken"]);this.userCache.set(je,{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||N,t=this.scope[e],n=await this.cacheManager.getIdToken(new Ke({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(je);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(je,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,r=e.clientId,o=e.cacheMode;const i=await this.cacheManager.get(new Ke({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,r=i.expires_in,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 o=t||{},i=o.nonceIn,a=o.organization,s=o.scopesToRequest,c=await Ue(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:s||e.scope}),this.worker),u=await this._verifyIdToken(c.id_token,i,a);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!==u.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(je))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},c),{decodedToken:u,scope:e.scope,audience:e.audience||N}),c.scope?{oauthTokenScope:c.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(a||u.claims.org_id),Object.assign(Object.assign({},c),{decodedToken:u})}_buildTokenExchangeParams(e){return Object.assign(Object.assign(Object.assign(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}),e.actor_token&&{actor_token:e.actor_token}),e.actor_token_type&&{actor_token_type:e.actor_token_type}),{scope:Me(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 loginWithCustomTokenExchange(e){return this._requestToken(this._buildTokenExchangeParams(e))}async customTokenExchange(e){const t=await Ue(Object.assign(Object.assign({},this._buildTokenExchangeParams(e)),{baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,dpop:this.dpop}),this.worker,!0);return t.id_token&&await this._verifyIdToken(t.id_token,void 0,e.organization),t}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 yt(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 t=e.openUrl,n=e.appState,r=e.connection,o=e.scopes,i=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!r)throw new Error("connection is required");const c=J(X()),u=X(),l=await z(u),d=Q(l),h=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:s,state:c,code_challenge:d,code_challenge_method:"S256",authorization_params:i}),p=h.connect_uri,f=h.connect_params,m=h.auth_session;this.transactionManager.create({state:c,code_verifier:u,auth_session:m,redirect_uri:s,appState:n,connection:r,response_type:rt.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForMfa(e,t){const n=e.mfaToken,r=d(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function ga(e,t){return function(){return e.apply(t,arguments)}}const{toString:ya}=Object.prototype,{getPrototypeOf:wa}=Object,{iterator:ba,toStringTag:va}=Symbol,Aa=(Ea=Object.create(null),e=>{const t=ya.call(e);return Ea[t]||(Ea[t]=t.slice(8,-1).toLowerCase())});var Ea;const Sa=e=>(e=e.toLowerCase(),t=>Aa(t)===e),Ta=e=>t=>typeof t===e,{isArray:Ra}=Array,_a=Ta("undefined");function Oa(e){return null!==e&&!_a(e)&&null!==e.constructor&&!_a(e.constructor)&&Ca(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ka=Sa("ArrayBuffer");const Ia=Ta("string"),Ca=Ta("function"),Na=Ta("number"),Pa=e=>null!==e&&"object"==typeof e,La=e=>{if("object"!==Aa(e))return!1;const t=wa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||va in e||ba in e)},xa=Sa("Date"),Ua=Sa("File"),Da=Sa("Blob"),Ma=Sa("FileList");const Ba="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ja=void 0!==Ba.FormData?Ba.FormData:void 0,Ka=Sa("URLSearchParams"),[Wa,Ha,Ga,Fa]=["ReadableStream","Request","Response","Headers"].map(Sa);function Xa(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Ra(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Za="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Va=e=>!_a(e)&&e!==Za;const Ya=(za="undefined"!=typeof Uint8Array&&wa(Uint8Array),e=>za&&e instanceof za);var za;const qa=Sa("HTMLFormElement"),Qa=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),$a=Sa("RegExp"),es=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Xa(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const ts=Sa("AsyncFunction"),ns=(rs="function"==typeof setImmediate,os=Ca(Za.postMessage),rs?setImmediate:os?(is=`axios@${Math.random()}`,as=[],Za.addEventListener("message",({source:e,data:t})=>{e===Za&&t===is&&as.length&&as.shift()()},!1),e=>{as.push(e),Za.postMessage(is,"*")}):e=>setTimeout(e));var rs,os,is,as;const ss="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Za):"undefined"!=typeof process&&process.nextTick||ns,cs={isArray:Ra,isArrayBuffer:ka,isBuffer:Oa,isFormData:e=>{if(!e)return!1;if(ja&&e instanceof ja)return!0;const t=wa(e);if(!t||t===Object.prototype)return!1;if(!Ca(e.append))return!1;const n=Aa(e);return"formdata"===n||"object"===n&&Ca(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ka(e.buffer),t},isString:Ia,isNumber:Na,isBoolean:e=>!0===e||!1===e,isObject:Pa,isPlainObject:La,isEmptyObject:e=>{if(!Pa(e)||Oa(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Wa,isRequest:Ha,isResponse:Ga,isHeaders:Fa,isUndefined:_a,isDate:xa,isFile:Ua,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Da,isRegExp:$a,isFunction:Ca,isStream:e=>Pa(e)&&Ca(e.pipe),isURLSearchParams:Ka,isTypedArray:Ya,isFileList:Ma,forEach:Xa,merge:function e(...t){const{caseless:n,skipUndefined:r}=Va(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Ja(o,i)||i,s=Qa(o,a)?o[a]:void 0;La(s)&&La(t)?o[a]=e(s,t):La(t)?o[a]=e({},t):Ra(t)?o[a]=t.slice():r&&_a(t)||(o[a]=t)};for(let e=0,n=t.length;e(Xa(t,(t,r)=>{n&&Ca(t)?Object.defineProperty(e,r,{__proto__:null,value:ga(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&wa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Aa,kindOfTest:Sa,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(Ra(e))return e;let t=e.length;if(!Na(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[ba]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:qa,hasOwnProperty:Qa,hasOwnProp:Qa,reduceDescriptors:es,freezeMethods:e=>{es(e,(t,n)=>{if(Ca(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];Ca(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Ra(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ja,global:Za,isContextDefined:Va,isSpecCompliantForm:function(e){return!!(e&&Ca(e.append)&&"FormData"===e[va]&&e[ba])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Pa(e)){if(t.has(e))return;if(Oa(e))return e;if(!("toJSON"in e)){t.add(e);const r=Ra(e)?[]:{};return Xa(e,(e,t)=>{const o=n(e);!_a(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:ts,isThenable:e=>e&&(Pa(e)||Ca(e))&&Ca(e.then)&&Ca(e.catch),setImmediate:ns,asap:ss,isIterable:e=>null!=e&&Ca(e[ba])},us=cs.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ls=e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&us[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};n.dn(ls);const ds=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),hs=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ps(e,t){return cs.isArray(e)?e.map(e=>ps(e,t)):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function fs(e){const t=Object.create(null);return cs.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>ps(e,hs))(e)}),t}const ms=Symbol("internals");function gs(e){return e&&String(e).trim().toLowerCase()}function ys(e){return!1===e||null==e?e:cs.isArray(e)?e.map(ys):(e=>ps(e,ds))(String(e))}function ws(e,t,n,r,o){return cs.isFunction(r)?r.call(this,t,n):(o&&(t=n),cs.isString(t)?cs.isString(r)?-1!==t.indexOf(r):cs.isRegExp(r)?r.test(t):void 0:void 0)}class bs{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=gs(t);if(!o)throw new Error("header name must be a non-empty string");const i=cs.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ys(e))}const i=(e,t)=>cs.forEach(e,(e,n)=>o(e,n,t));if(cs.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(cs.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(ls(e),t);else if(cs.isObject(e)&&cs.isIterable(e)){let n,r,o={};for(const t of e){if(!cs.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?cs.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=gs(e)){const n=cs.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(cs.isFunction(t))return t.call(this,e,n);if(cs.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=gs(e)){const n=cs.findKey(this,e);return!(!n||void 0===this[n]||t&&!ws(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=gs(e)){const o=cs.findKey(n,e);!o||t&&!ws(0,n[o],o,t)||(delete n[o],r=!0)}}return cs.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ws(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return cs.forEach(this,(r,o)=>{const i=cs.findKey(n,o);if(i)return t[i]=ys(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]=ys(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return cs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&cs.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ms]=this[ms]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=gs(e);t[r]||(!function(e,t){const n=cs.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return cs.isArray(e)?e.forEach(r):r(e),this}}bs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),cs.reduceDescriptors(bs.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),cs.freezeMethods(bs);const vs=bs;function As(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(cs.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof vs&&(e=e.toJSON()),r.push(e),cs.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);cs.isUndefined(r)||(t[n]=r)});else{if(!cs.isPlainObject(e)&&function(e){if(cs.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(cs.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);cs.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class Es extends Error{static from(e,t,n,r,o,i){const a=new Es(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&cs.hasOwnProp(e,"redact")?e.redact:void 0,n=cs.isArray(t)&&t.length>0?As(e,t):cs.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}Es.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Es.ERR_BAD_OPTION="ERR_BAD_OPTION",Es.ECONNABORTED="ECONNABORTED",Es.ETIMEDOUT="ETIMEDOUT",Es.ECONNREFUSED="ECONNREFUSED",Es.ERR_NETWORK="ERR_NETWORK",Es.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Es.ERR_DEPRECATED="ERR_DEPRECATED",Es.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Es.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Es.ERR_CANCELED="ERR_CANCELED",Es.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Es.ERR_INVALID_URL="ERR_INVALID_URL",Es.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Ss=Es;var Ts=n(8287).hp;function Rs(e){return cs.isPlainObject(e)||cs.isArray(e)}function _s(e){return cs.endsWith(e,"[]")?e.slice(0,-2):e}function Os(e,t,n){return e?e.concat(t).map(function(e,t){return e=_s(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ks=cs.toFlatObject(cs,{},null,function(e){return/^is[A-Z]/.test(e)});const Is=function(e,t,n){if(!cs.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=cs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!cs.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&cs.isSpecCompliantForm(t);if(!cs.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(cs.isDate(e))return e.toISOString();if(cs.isBoolean(e))return e.toString();if(!u&&cs.isBlob(e))throw new Ss("Blob is not supported. Use a Buffer instead.");return cs.isArrayBuffer(e)||cs.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Ts.from(e):e}function d(e,n,o){let s=e;if(cs.isReactNative(t)&&cs.isReactNativeBlob(e))return t.append(Os(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(cs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(cs.isArray(e)&&function(e){return cs.isArray(e)&&!e.some(Rs)}(e)||(cs.isFileList(e)||cs.endsWith(n,"[]"))&&(s=cs.toArray(e)))return n=_s(n),s.forEach(function(e,r){!cs.isUndefined(e)&&null!==e&&t.append(!0===a?Os([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Rs(e)||(t.append(Os(o,n,i),l(e)),!1)}const h=[],p=Object.assign(ks,{defaultVisitor:d,convertValue:l,isVisitable:Rs});if(!cs.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!cs.isUndefined(n)){if(i>c)throw new Ss("Object is too deeply nested ("+i+" levels). Max depth: "+c,Ss.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),cs.forEach(n,function(n,a){!0===(!(cs.isUndefined(n)||null===n)&&o.call(t,n,cs.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function Cs(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ns(e,t){this._pairs=[],e&&Is(e,this,t)}const Ps=Ns.prototype;Ps.append=function(e,t){this._pairs.push([e,t])},Ps.toString=function(e){const t=e?function(t){return e.call(this,t,Cs)}:Cs;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ls=Ns;function xs(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Us(e,t,n){if(!t)return e;const r=n&&n.encode||xs,o=cs.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):cs.isURLSearchParams(t)?t.toString():new Ls(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Ds=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){cs.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ms={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Bs={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ls,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},js="undefined"!=typeof window&&"undefined"!=typeof document,Ks="object"==typeof navigator&&navigator||void 0,Ws=js&&(!Ks||["ReactNative","NativeScript","NS"].indexOf(Ks.product)<0),Hs="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Gs=js&&window.location.href||"http://localhost",Fs={...e,...Bs};const Xs=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&cs.isArray(r)?r.length:i,s)return cs.hasOwnProp(r,i)?r[i]=cs.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;cs.hasOwnProp(r,i)&&cs.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&cs.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return cs.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Js=(e,t)=>null!=e&&cs.hasOwnProp(e,t)?e[t]:void 0;const Zs={transitional:Ms,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=cs.isObject(e);o&&cs.isHTMLForm(e)&&(e=new FormData(e));if(cs.isFormData(e))return r?JSON.stringify(Xs(e)):e;if(cs.isArrayBuffer(e)||cs.isBuffer(e)||cs.isStream(e)||cs.isFile(e)||cs.isBlob(e)||cs.isReadableStream(e))return e;if(cs.isArrayBufferView(e))return e.buffer;if(cs.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Js(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Is(e,new Fs.classes.URLSearchParams,{visitor:function(e,t,n,r){return Fs.isNode&&cs.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=cs.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Js(this,"env"),r=n&&n.FormData;return Is(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(cs.isString(e))try{return(t||JSON.parse)(e),cs.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Js(this,"transitional")||Zs.transitional,n=t&&t.forcedJSONParsing,r=Js(this,"responseType"),o="json"===r;if(cs.isResponse(e)||cs.isReadableStream(e))return e;if(e&&cs.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Js(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Ss.from(e,Ss.ERR_BAD_RESPONSE,this,null,Js(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Fs.classes.FormData,Blob:Fs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};cs.forEach(["delete","get","head","post","put","patch","query"],e=>{Zs.headers[e]={}});const Vs=Zs;function Ys(e,t){const n=this||Vs,r=t||n,o=vs.from(r.headers);let i=r.data;return cs.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function zs(e){return!(!e||!e.__CANCEL__)}const qs=class extends Ss{constructor(e,t,n){super(e??"canceled",Ss.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Qs(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Ss("Request failed with status code "+n.status,n.status>=400&&n.status<500?Ss.ERR_BAD_REQUEST:Ss.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const $s=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)]},tc=(e,t,n=3)=>{let r=0;const o=$s(50,250);return ec(n=>{if(!n||"number"!=typeof n.loaded)return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},nc=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},rc=e=>(...t)=>cs.asap(()=>e(...t)),oc=Fs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Fs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Fs.origin),Fs.navigator&&/(msie|trident)/i.test(Fs.navigator.userAgent)):()=>!0,ic=Fs.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];cs.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),cs.isString(r)&&s.push(`path=${r}`),cs.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),cs.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function ac(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const sc=e=>e instanceof vs?{...e}:e;function cc(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return cs.isPlainObject(e)&&cs.isPlainObject(t)?cs.merge.call({caseless:r},e,t):cs.isPlainObject(t)?cs.merge({},t):cs.isArray(t)?t.slice():t}function o(e,t,n,o){return cs.isUndefined(t)?cs.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!cs.isUndefined(t))return r(void 0,t)}function a(e,t){return cs.isUndefined(t)?cs.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return cs.hasOwnProp(t,i)?r(n,o):cs.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(sc(e),sc(t),0,!0)};return cs.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=cs.hasOwnProp(c,r)?c[r]:o,a=i(cs.hasOwnProp(e,r)?e[r]:void 0,cs.hasOwnProp(t,r)?t[r]:void 0,r);cs.isUndefined(a)&&i!==s||(n[r]=a)}),n}const uc=["content-type","content-length"];const lc=e=>{const t=cc({},e),n=e=>cs.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=vs.from(s),t.url=Us(ac(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),cs.isFormData(r)&&(Fs.hasStandardBrowserEnv||Fs.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):cs.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{uc.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Fs.hasStandardBrowserEnv){cs.isFunction(o)&&(o=o(t));if(!0===o||null==o&&oc(t.url)){const e=i&&a&&ic.read(a);e&&s.set(i,e)}}return t};n.dn(lc);const dc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=lc(e);let o=r.data;const i=vs.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=vs.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Qs(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Ss("Request aborted",Ss.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Ss(r,Ss.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ms;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Ss(t,o.clarifyTimeoutError?Ss.ETIMEDOUT:Ss.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&cs.forEach(fs(i),function(e,t){m.setRequestHeader(t,e)}),cs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=tc(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=tc(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new qs(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||Fs.protocols.includes(y)?m.send(o||null):n(new Ss("Unsupported protocol "+y+":",Ss.ERR_BAD_REQUEST,e))})},hc=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Ss?t:new qs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Ss(`timeout of ${t}ms exceeded`,Ss.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}=n;return s.unsubscribe=()=>cs.asap(a),s},pc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of fc(e))yield*pc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var gc=n(8287).hp;const yc="1.16.1",{isFunction:wc}=cs,bc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},vc=e=>{const t=void 0!==cs.global&&null!==cs.global?cs.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=cs.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?wc(o):"function"==typeof fetch,c=wc(i),u=wc(a);if(!s)return!1;const l=s&&wc(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&bc(()=>{let e=!1;const t=new i(Fs.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&bc(()=>cs.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Ss(`Response type '${e}' is not supported`,Ss.ERR_NOT_SUPPORT,n)})});const g=async(e,t)=>{const n=cs.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(cs.isBlob(e))return e.size;if(cs.isSpecCompliantForm(e)){const t=new i(Fs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return cs.isArrayBufferView(e)||cs.isArrayBuffer(e)?e.byteLength:(cs.isURLSearchParams(e)&&(e+=""),cs.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:y,responseType:w,headers:b,withCredentials:v="same-origin",fetchOptions:A,maxContentLength:E,maxBodyLength:S}=lc(e);const T=cs.isNumber(E)&&E>-1,R=cs.isNumber(S)&&S>-1;let _=o||fetch;w=w?(w+"").toLowerCase():"text";let O=hc([u,l&&l.toAbortSignal()],d),k=null;const I=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==gc&&"function"==typeof gc.byteLength)return gc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>E)throw new Ss("maxContentLength size of "+E+" exceeded",Ss.ERR_BAD_RESPONSE,e,k)}if(R&&"get"!==n&&"head"!==n){const t=await g(b,s);if("number"==typeof t&&isFinite(t)&&t>S)throw new Ss("Request body larger than maxBodyLength limit",Ss.ERR_BAD_REQUEST,e,k)}if(y&&p&&"get"!==n&&"head"!==n&&0!==(C=await g(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(cs.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=nc(C,tc(rc(y)));s=mc(n.body,65536,e,t)}}cs.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(cs.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+yc,!1);const u={...A,signal:O,method:n.toUpperCase(),headers:fs(b.normalize()),body:s,duplex:"half",credentials:o?v:void 0};k=c&&new i(t,u);let l=await(c?_(k,A):_(t,u));if(T){const t=cs.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>E)throw new Ss("maxContentLength size of "+E+" exceeded",Ss.ERR_BAD_RESPONSE,e,k)}const d=f&&("stream"===w||"response"===w);if(f&&l.body&&(h||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=cs.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&nc(n,tc(rc(h),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>E))throw new Ss("maxContentLength size of "+E+" exceeded",Ss.ERR_BAD_RESPONSE,e,k);r&&r(t)};l=new a(mc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}w=w||"text";let N=await m[cs.findKey(m,w)||"text"](l,e);if(T&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>E)throw new Ss("maxContentLength size of "+E+" exceeded",Ss.ERR_BAD_RESPONSE,e,k)}return!d&&I&&I(),await new Promise((t,n)=>{Qs(t,n,{data:N,headers:vs.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(I&&I(),O&&O.aborted&&O.reason instanceof Ss){const n=O.reason;throw n.config=e,k&&(n.request=k),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ss("Network Error",Ss.ERR_NETWORK,e,k,t&&t.response),{cause:t.cause||t});throw Ss.from(t,t&&t.code,e,k,t&&t.response)}}},Ac=new Map,Ec=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=Ac;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:vc(t)),u=s;return s},Sc=(Ec(),{http:null,xhr:dc,fetch:{get:Ec}});cs.forEach(Sc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Tc=e=>`- ${e}`,Rc=e=>cs.isFunction(e)||null===e||!1===e;const _c={getAdapter:function(e,t){e=cs.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Tc).join("\n"):" "+Tc(e[0]):"as no adapter specified";throw new Ss("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Sc};function Oc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qs(null,e)}function kc(e){Oc(e),e.headers=vs.from(e.headers),e.data=Ys.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _c.getAdapter(e.adapter||Vs.adapter,e)(e).then(function(t){Oc(e),e.response=t;try{t.data=Ys.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=vs.from(t.headers),t},function(t){if(!zs(t)&&(Oc(e),t&&t.response)){e.response=t.response;try{t.response.data=Ys.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=vs.from(t.response.headers)}return Promise.reject(t)})}const Ic={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ic[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Cc={};Ic.transitional=function(e,t,n){function r(e,t){return"[Axios v"+yc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Ss(r(o," has been removed"+(t?" in "+t:"")),Ss.ERR_DEPRECATED);return t&&!Cc[o]&&(Cc[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)}},Ic.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Nc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ss("options must be an object",Ss.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Ss("option "+i+" must be "+n,Ss.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ss("Unknown option "+i,Ss.ERR_BAD_OPTION)}},validators:Ic},Pc=Nc.validators;class Lc{constructor(e){this.defaults=e||{},this.interceptors={request:new Ds,response:new Ds}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=cc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Nc.assertOptions(n,{silentJSONParsing:Pc.transitional(Pc.boolean),forcedJSONParsing:Pc.transitional(Pc.boolean),clarifyTimeoutError:Pc.transitional(Pc.boolean),legacyInterceptorReqResOrdering:Pc.transitional(Pc.boolean)},!1),null!=r&&(cs.isFunction(r)?t.paramsSerializer={serialize:r}:Nc.assertOptions(r,{encode:Pc.function,serialize:Pc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Nc.assertOptions(t,{baseUrl:Pc.spelling("baseURL"),withXsrfToken:Pc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&cs.merge(o.common,o[t.method]);o&&cs.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=vs.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||Ms;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=[kc.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new qs(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Uc(function(t){e=t});return{token:t,cancel:e}}}const Dc=Uc;const Mc={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(Mc).forEach(([e,t])=>{Mc[t]=e});const Bc=Mc;const jc=function e(t){const n=new xc(t),r=ga(xc.prototype.request,n);return cs.extend(r,xc.prototype,n,{allOwnKeys:!0}),cs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(cc(t,n))},r}(Vs);jc.Axios=xc,jc.CanceledError=qs,jc.CancelToken=Dc,jc.isCancel=zs,jc.VERSION=yc,jc.toFormData=Is,jc.AxiosError=Ss,jc.Cancel=jc.CanceledError,jc.all=function(e){return Promise.all(e)},jc.spread=function(e){return function(t){return e.apply(null,t)}},jc.isAxiosError=function(e){return cs.isObject(e)&&!0===e.isAxiosError},jc.mergeConfig=cc,jc.AxiosHeaders=vs,jc.formToJSON=e=>Xs(cs.isHTMLForm(e)?new FormData(e):e),jc.getAdapter=_c.getAdapter,jc.HttpStatusCode=Bc,jc.default=jc;const Kc=jc;var Wc=n(3153),Hc=n(3612);const Gc={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 Fc=n(3029),Xc=n(2901),Jc=function(){function e(){(0,Fc.A)(this,e),(0,i.A)(this,"readyPromise",null),(0,i.A)(this,"readyResolved",!1),(0,i.A)(this,"readyValue",!1)}return(0,Xc.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return Wc.A.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return Wc.A.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return Wc.A.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(Wc.A.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return Wc.A.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){Wc.A.log("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),Wc.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(Wc.A.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();(0,i.A)(Jc,"DEFAULT_TIMEOUT",3e3);const Zc=new Jc;var Vc,Yc;function zc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Qc().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},tu=function(){var e=eu();return".".concat(e)},nu=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(Wc.A.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=c(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},ru=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=eu(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=c(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},ou=function(){return Qc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},iu=function(e){return function(e,t){if("string"!=typeof e)throw new u("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 u(`Invalid token specified: missing part #${n+1}`);let o;try{o=l(r)}catch(e){throw new u(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new u(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},au=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=eu().split(".")[0],e.prev=1,e.next=2,Kc({method:"get",url:"".concat(Hc.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(o=e.sent).data){e.next=3;break}return Wc.A.log("Apple Sub Check: Request successful: ",o.data),e.abrupt("return","subscribed"===o.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,i=e.catch(1),Wc.A.log("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)}}(),su=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Kc({method:"get",url:"".concat(Hc.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(ou())),headers:{"X-Api-Key":Hc.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)}}(),cu=function(){return"complete"===document.readyState},uu=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var o=!0;if(cu())n();else{Wc.A.log("UIHandler: ","Waiting for the body to load...");var i=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(o=cu()),document.querySelector("body")&&o&&(clearInterval(i),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},lu=function(){return new Promise(function(e){if(("interactive"===document.readyState||cu())&&window.dataLayer)Wc.A.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{Wc.A.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),50)}})},du=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,lu();case 1:return Wc.A.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",Wc.A.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),o=function(e){return Wc.A.log("Utils dataLayerLoop: look for this element ",e),e[t]?(Wc.A.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(Wc.A.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(o),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),hu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:"Page Type",e.next=1,du(t);case 1:return n=e.sent,Wc.A.log("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),pu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wc.A.log("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return Wc.A.log("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){Wc.A.log("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),Wc.A.log("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),fu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zc.blueConicReady();case 1:if(t=e.sent,Wc.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,pu();case 2:if(n=e.sent,Wc.A.log("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return o=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){o.loadValues(["auth0_id"],null,function(){e()})});case 4:return i=o.getValue("auth0_id"),Wc.A.log("bcGetAuth0Id | auth0_id:",i),e.abrupt("return",i);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),mu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i,a,s,c,u,l,d=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Zc.blueConicReady();case 1:if(a=e.sent,Wc.A.log("bcLowaCheck | BC load status: ",a),!a){e.next=3;break}if(s=window.blueConicClient.getSegments(),Wc.A.log("bcLowaCheck | BC segments for users: ",s),c=s.filter(function(e){return i.includes(e.name)}),Wc.A.log("bcLowaCheck | BC userSubSegments: ",c),!(c.length>0)){e.next=3;break}return e.next=2,fu();case 2:(u=e.sent)&&(n=!0,o=u);case 3:return t&&n&&gu(),l={isSub:n},o&&(l.uuid=o),e.abrupt("return",l);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),gu=function(){nu("bc_lowa_status",1,{path:"/",domain:tu(),expires:7,secure:!0})},yu=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(Wc.A.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(Wc.A.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};Wc.A.log("utils | Event: authentication ready: ",r),e(r)}catch(e){Wc.A.log(e),t(e)}},!1))})},wu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return Hc.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(Wc.A.log("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,Wc.A.log("Received entitlementsReady event:",r),e(r)}catch(e){Wc.A.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(Wc.A.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bu=function(){ru(Gc.AUTH0_SUB_COOKIE_KEY),ru("mng-jwt-decoded"),localStorage.removeItem(Gc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){Wc.A.log("Clearing entitlements...");try{ru(Gc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){Wc.A.log("Failed to delete legacy cookie: ",e)}try{ru(Gc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:eu(),expires:365,secure:!0})}catch(e){Wc.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Gc.LOCAL_STORAGE_SESSION_KEY)}catch(e){Wc.A.log("Failed to remove local storage: ",e)}}()},vu=function(e){Wc.A.log("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),Wc.A.log("Storage Object removed : ",e))},Au=function(e){Wc.A.log("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 Wc.A.log("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=Au;var Eu;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Su=function(){var e=(0,t.A)(r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Eu){e.next=1;break}return e.abrupt("return",Eu);case 1:return t=Hc.A.auth0Domain,n=Hc.A.auth0ClientId,Eu=new ma({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",Eu);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Tu=function(e){Wc.A.log("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,Wc.A.log("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),Wc.A.log("utils | Dispatched authenticationReady event"),Yc=new CustomEvent("mng-auth-check-complete",{detail:e}),Vc?(Wc.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(Yc)):Wc.A.log("Islands not ready")};var Ru=function(e){Hc.A.datadogEnabled&&window.DD_RUM.addTiming(e)},_u=function(){var e=(0,t.A)(r.mark(function e(t){var n,i,a,s,c,u;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Wc.A.log("deleteUserCache","Setting up cache deletion for ".concat(t)),n=ou(),Wc.A.log("deleteUSerCache","Domain is: ".concat(n)),i={publication:n,uuid:t},e.next=1,Kc({method:"DELETE",url:"".concat(Hc.A.entitlementsEndpoint,"session/create"),data:i,headers:{"X-Api-Key":Hc.A.entitlementsApiKey}});case 1:if(a=e.sent,s=a.data,c=/Succesfully deleted/i,!("object"===(0,o.A)(s)&&Object.prototype.hasOwnProperty.call(s,"message"))||!c.test(s.message)){e.next=2;break}return Wc.A.log("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return Wc.A.log("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(s)),e.abrupt("return",{success:!1});case 3:return e.prev=3,u=e.catch(0),Wc.A.log("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)}}(),Ou=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,o){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=(0,t.A)(r.mark(function t(){var a,s,c,u,l,d,h,p,f,m,g;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){t.next=1;break}if(!document.getElementById("server-paywall")){t.next=1;break}return i.sspw=!0,t.abrupt("return",n({paywall:!0,details:qc({},i)}));case 1:return t.next=2,hu();case 2:return c=t.sent,t.next=3,du("Paywall_Level");case 3:if(u=t.sent,"article"===c&&"free"!==u){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==c?"Page type is not an article":"Free article"}));case 4:return t.next=5,wu();case 5:if(!(l=t.sent)||!l.isEntitled){t.next=6;break}return t.abrupt("return",n({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==u){t.next=7;break}return t.abrupt("return",n({paywall:!0,details:"Premium article"}));case 7:if(d=null===(s=window.ConnextUtils)||void 0===s?void 0:s.runningSophi,Wc.A.log("checkPaywallStatus - Sophi is running: ",d),!d){t.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),n({paywall:!0,details:qc({},i)})},{once:!0}),t.next=12;break;case 8:if(d){t.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown"),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),t.prev=9,t.next=10,Promise.race([h,p]);case 10:!0===(f=t.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(f)),t.next=12;break;case 11:t.prev=11,m=t.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m);case 12:return t.abrupt("return",n({paywall:Object.values(i).some(function(e){return e}),details:qc({},i)}));case 13:t.prev=13,g=t.catch(0),o(g);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Ou);function ku(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(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 Iu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zc.blueConicReady();case 1:return e.next=2,yu();case 2:return e.abrupt("return",new Promise(function(e){Wc.A.log("ANALYTICS: inside BCregwall events");var t=Qc();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Cu=function(e){try{window.dataLayer.push({event:e}),Wc.A.log("ANALYTICS: ".concat(e," event")),Wc.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){Wc.A.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Nu=n(1834),Pu=function(){try{var e=localStorage.getItem(Gc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){Wc.A.log("Unable to get session from local storage: ",e)}return"{}"},Lu=function(e){try{Wc.A.log("Setting local storage session",e),localStorage.setItem(Gc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){Wc.A.log("Unable to save session from local storage: ",e)}},xu=function(e){try{nu(Gc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:tu(),expires:365,secure:!0})}catch(e){Wc.A.log("Unable to save session to cookie storage: ",e)}},Uu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Hc.A.sessionServer,n="".concat(t,"/api/session"),Wc.A.log("Checking server session: ",n),e.next=1,Kc.get(n,{withCredentials:!0});case 1:if(!(o=e.sent).data){e.next=2;break}return l=o.data.entitlementTokenDecoded,d=o.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,g=null!==(a=null==l?void 0:l.entitlement_source)&&void 0!==a?a:null,y=null!==(s=null==l?void 0:l.entitlement_entitled)&&void 0!==s?s:null,w=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,Lu(JSON.stringify({accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:g,isEntitled:y,adFree:w,entitlementLevel:b})),""!==f&&"string"==typeof f&&xu(f),e.abrupt("return",{accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:g,isEntitled:y,adFree:w,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)}}(),Du=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=Hc.A.sessionServer,o="".concat(n,"/api/session"),Wc.A.log("Updating server session: ",o),e.next=1,Kc.post(o,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),Wc.A.log("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)}}(),Mu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=Hc.A.sessionServer,n="".concat(t,"/api/session"),Wc.A.log("Deleting server session: ",n),e.next=1,Kc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,o=e.catch(0),Wc.A.log("Failed to delete server session: ",o);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),Bu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,R,_,O,k,I;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wc.A.log("Inside getSession"),e.prev=1,l=Pu(),Wc.A.log("Session: __MNG_Session = ",l),d=JSON.parse(l),h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=d.expiration,g=d.entitlementSource,y=d.isEntitled,w=d.adFree,b=d.entitlementLevel,n=h,t=p,o=f,i=m,a=g,s=y,c=w,u=b,Wc.A.log("Session: check both tokens: ",t,o),void 0!==p&&void 0!==f&&null!==p&&null!==f){e.next=3;break}return Wc.A.log("Session: missing id or entitlements, try session server"),e.next=2,Uu();case 2:v=e.sent,A=v.accessToken,E=v.idToken,S=v.entitlementToken,T=v.expiration,R=v.entitlementSource,_=v.isEntitled,O=v.adFree,k=v.entitlementLevel,n=A,t=E,o=S,i=T,a=R,s=_,c=O,u=k;case 3:e.next=5;break;case 4:e.prev=4,I=e.catch(1),Wc.A.log("Failed to get session: ",I);case 5:return Wc.A.log("Returning session: ",t,n,o),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:o,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)}}(),ju=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,R,_,O,k,I,C,N;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Pu(),o=JSON.parse(n),i=o.accessToken,a=void 0===i?null:i,s=o.idToken,c=void 0===s?null:s,u=o.entitlementToken,l=void 0===u?null:u,d=o.expiration,h=void 0===d?null:d,p=o.entitlementSource,f=void 0===p?null:p,m=o.isEntitled,g=void 0===m?null:m,y=o.adFree,w=void 0===y?null:y,b=o.entitlementLevel,v=void 0===b?null:b,A=t.accessToken,E=t.idToken,S=t.entitlementToken,T=t.expiration,R=t.entitlementSource,_=t.isEntitled,O=t.adFree,k=t.entitlementLevel,I={accessToken:A??a,idToken:E??c,entitlementToken:S??l,expiration:T??h,entitlementSource:R??f,isEntitled:_??g,adFree:O??w,entitlementLevel:k??v},Wc.A.log("Current session data: ",o),Wc.A.log("New session data: ",t),Wc.A.log("Updated session data:",I),C=JSON.stringify(I),Lu(C),""!==I.entitlementToken&&"string"==typeof I.entitlementToken&&xu(I.entitlementToken),n===C){e.next=1;break}return e.next=1,Du(I);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),Wc.A.log("Unable to save session: ",N);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Ku=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wc.A.log("Ending session..."),bu(),e.next=1,Mu();case 1:localStorage.removeItem(Gc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Wu="1"===window.authentication_config.isEmbedLoginEnabled,Hu=function(){return"logout"===(Qc().searchParams.get("state")||"").toLowerCase()};Wu||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var Gu=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Su();case 1:n=e.sent,Wc.A.log("Calling Auth0 logout...returning to ".concat(t)),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Fu=function(){Wc.A.log("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){Wc.A.log("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(){return new Promise(function(e){Wc.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},Ju=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i,a,s,c,u,l,d;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wc.A.log("Attempting to logout..."),Fu(),Wc.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Gc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(o=n?iu(n):"")){e.next=2;break}return i=o.auth0Id,e.next=1,_u(i);case 1:e.sent.success?Wc.A.log("User cache cleared."):Wc.A.log("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,Ku();case 3:e.next=5;break;case 4:bu();case 5:return e.prev=5,Wc.A.log("Cycling through logout callbacks..."),a=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(a);case 6:Wc.A.log("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,d=e.catch(5),Wc.A.log("Failed to cycle through logout callbacks: ",d);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),Wc.A.log("Removed Auth0 storage object...")}),vu("hhsl"),vu("userNewsLetterData"),vu(Gc.REGWALL_USER_IS_SUBSCRIBED),vu(Gc.USER_PROFILE_HASH),s=Qc(),c=window.location.origin;try{s.searchParams.get("returnURL")&&(u=decodeURIComponent(s.searchParams.get("returnURL")),c=u)}catch(e){Wc.A.log(e),c=window.location.origin}return c=new URL(c),e.next=9,window.ConnextUtils.connextReady("onInit",Nu.A.defaultTimeoutLength);case 9:if(!e.sent){e.next=11;break}return Wc.A.log("Auth | Connext silent mode enabled ",Connext.GetOptions().Silentmode),Wc.A.log("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),l=c,c.origin!==window.location.origin&&(l=new URL(window.location.origin)).searchParams.append("returnAfterLogout",c),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",l),e.next=10,Xu();case 10:e.next=12;break;case 11:Wc.A.log("Connext Logout was NOT called");case 12:return Wc.A.log("Calling Auth0 logout now."),e.next=13,Gu(c);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Zu=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},Vu=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Cu(e)}),Wc.A.log("Cycled through preauth GTM events.")},Yu=function(){var e=(0,t.A)(r.mark(function e(t,n,o,i,a){var s,c,u,l,d,h,p,f,m,g,y,w,b;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wc.A.log("Attempting to login..."),Zu()>4.5&&window.localStorage.clear(),Vu(),i&&(s=[],c=window.localStorage.getItem("callbackEvents"),u=JSON.parse(c),s=u&&u.length>0?ku(new Set([].concat(ku(i),ku(u)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(s))),l=null,e.next=1,Su();case 1:if(d=e.sent,h=Qc(),p=h.origin,f=new URL("".concat(p,"/callback")),m={},h.searchParams.get("regwall")&&(h.searchParams.get("returnUrl")&&(g=h.searchParams.get("returnUrl")),h.searchParams.get("auth_redirect")&&(g=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()),g&&"regwall"!==t&&f.searchParams.set("auth_redirect",g),"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,Ku();case 2:e.next=4;break;case 3:bu();case 4:return null!==(l=h.searchParams.get("login-with"))?m.connection=l:n&&(m.connection=n),y="none",t&&"regwall"===t&&(f.searchParams.set("regwall","true"),y="signUp",Wc.A.log("Logging in with regwall")),t&&(f.searchParams.set("loginsource",t),Wc.A.log("Logging in with ".concat(t))),o&&(m.login_hint=o),m.redirect_uri=f.toString(),m.initialScreen=y,"googleonetap"!==t&&(m.prompt="select_account"),null!==(w=h.searchParams.get("ampRegiWall"))&&(b=window.location.hostname,m.ampRegiWall=w,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)}}(),zu=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();Wc.A.log("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){Wc.A.log("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};Wc.A.log("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){Wc.A.log(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){Wc.A.log("Failed to wait for callback events",t),e()}})},qu=function(){var e=(0,t.A)(r.mark(function e(){var n,o,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Fu(),n=Qc(),o=!1,i=n.searchParams.get("auth_redirect")||"https://".concat(window.location.host),a=n.searchParams.get("redirect_uri")||"",a.includes("applenews")?(Wc.A.log("This is Apple prelogin flow."),(s=new URL(a))?(s.searchParams.append("post-apple-login","true"),Wc.A.log("Post callback Apple redirect URL is ".concat(s)),Yu(!1,!1,!1,[],s)):Yu()):i.includes("post-apple-login")&&(Wc.A.log("This is Apple Callback flow."),o=!0,(c=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=c),Wc.A.log("Handling post login callback..."),!(u=n.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==u){e.next=1;break}return e.abrupt("return",Yu(!1,!1,!1,!1,i));case 1:o&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Su();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,Wc.A.log("Auth0 user profile: ",h),p=d.__raw,e.next=7,l.getTokenSilently();case 7:return f=e.sent,e.prev=8,Wc.A.log("Cycling through login callbacks..."),e.next=9,zu();case 9:return m=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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:Wc.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,E=e.catch(8),Wc.A.log("Failed to cycle through login callbacks: ",E);case 12:if(g={accessToken:f,userId:h.sub,email:h.email,picture:h.picture},y=!1,w="",!o){e.next=17;break}return e.prev=13,e.next=14,su(g.userId);case 14:return w=e.sent,Wc.A.log("Encrypted apple uuid is: ".concat(w)),e.next=15,au(w);case 15:y=e.sent,Wc.A.log("Apple sub status is: ".concat(y)),e.next=17;break;case 16:e.prev=16,S=e.catch(13),Wc.A.log("Apple sub check error: ".concat(S)),alert("There was an error in logging you in, please try again.");case 17:if(vu(Gc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return Wc.A.log("Saving idToken to session server"),e.next=18,ju({idToken:p,accessToken:f});case 18:if(!n.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!n.search.includes("loginsource")){e.next=20;break}return b=n.searchParams.get("loginsource"),v=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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,A=new URL(i),o&&y&&A.searchParams.append("access_token",w),Wc.A.log("Apple redirect URL:",A),e.abrupt("return",window.location.assign(A));case 21:return e.prev=21,T=e.catch(20),Wc.A.log("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)}}(),Qu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Wc.A.log("ANALYTICS: fireBC events"),e.next=1,Iu();case 1:Wc.A.log("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),$u=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,i,a,s,c,u,l,d,h,p,f;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,yu();case 1:if(t=e.sent,n=t.idToken,o=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,a=iu(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:o,nickname:p||d||l,email:s,picture:c,userId:u,connectionSource:h});case 3:e.prev=3,f=e.catch(2),Wc.A.log("Unable to parse idToken: ",n," Error: ",f);case 4:return e.abrupt("return",{authenticated:o});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();Wu||(window.MNGAuthentication.login=Yu,window.MNGAuthentication.logout=Ju,window.MNGAuthentication.getUserInfo=$u);var el=function(){var e=(0,t.A)(r.mark(function e(){var n,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Wu){e.next=1;break}return Wc.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=Qc(),i=!1,a="",s=!1,c={},n.searchParams.get("returnAfterLogout")&&(u=decodeURIComponent(n.searchParams.get("returnAfterLogout")),window.location.assign(u)),n.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),l=function(){var e=(0,t.A)(r.mark(function e(){var t,n,u;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Su();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(i=e.sent,a="object"===(0,o.A)(c)?c.__raw:"",n=$c(Gc.ENTITLEMENT_COOKIE_KEY),i||!n){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),Wc.A.log("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)}}(),!n.pathname.startsWith("/logout")){e.next=3;break}return Wc.A.log("Page is logout. Routing to logout function..."),e.next=2,Ju();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,l();case 4:if(""===a){e.next=6;break}if(d=null,h=JSON.parse(window.localStorage.getItem(Gc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Pu()){e.next=5;break}return h&&(d=h.jwt),e.next=5,ju({idToken:a,entitlementToken:d});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,Bu();case 7:p=e.sent,a=p.idToken,(i="string"==typeof a)&&(c=iu(a)),e.next=9;break;case 8:e.prev=8,b=e.catch(6),Wc.A.log("Unable to initialize session: ",b);case 9:e.next=11;break;case 10:return e.next=11,l();case 11:if(Wc.A.log("Authentication Init | isAuthenticated:",i),Wc.A.log("Authentication Init | accessToken:",s),!i||!Hc.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(m=null,c&&"object"===(0,o.A)(c)?m=c:a&&(m=iu(a)),!((g=null===(f=m)||void 0===f?void 0:f.exp)&&Date.now()/1e3>g)){e.next=13;break}return Wc.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,Ju();case 12:i=!1,a="",c={};case 13:if(i||s||!Hc.A.blueconicEnabled||!Hc.A.bcLowaSegements){e.next=15;break}return Wc.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,mu(!0);case 14:y=e.sent,Wc.A.log("BlueConic LOWA | bcLowaCheck result:",y),y.isSub?(Wc.A.log("BlueConic LOWA | authenticated as LOWA"),i=Gc.USER_IS_LOWA,c={sub:y.uuid}):Wc.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(Tu({isAuthenticated:i,idToken:a,accessToken:s,claims:c}),Ru("authenticationReady"),!0===i?(Wc.A.log("User is authenticated."),n.searchParams.get("auth_redirect")&&(Wc.A.log("Auth Redirect is present, sending user to auth redirect..."),(w=n.searchParams.get("auth_redirect")).endsWith("#")&&(w=w.slice(0,w.length)),window.location.assign(w)),n.pathname.startsWith("/login")&&!Hu()&&(Wc.A.log("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(n.origin))):Wc.A.log("User is not authenticated."),n.pathname.startsWith("/login")&&!Hu()?(Wc.A.log("Page is login. Attempting to log user in..."),Yu()):n.pathname.startsWith("/login")&&Hu()?(Wc.A.log("Auth | Connext logout state present",Connext.GetOptions().Silentmode),window.ConnextUtils.rerunConnextEntitlements(!0),setTimeout(function(){var e=new URL(window.location.origin);n.searchParams.get("returnURL")&&(e=decodeURIComponent(n.searchParams.get("returnURL"))),Wc.A.log("Auth | Connext 300ms logout state expired. Manually reloading page.",Connext.GetOptions().Silentmode),window.location.assign(e)},300)):Wc.A.log("Page is not login or Connext state is present"),!n.pathname.startsWith("/callback")||!n.searchParams.get("regwall")){e.next=17;break}return Wc.A.log("Page is callback with regwall param. Routing to regwall receiver..."),e.next=16,Qu();case 16:Wc.A.log("Now login from regwall"),Yu(),e.next=18;break;case 17:if(!n.pathname.startsWith("/callback")){e.next=18;break}return Wc.A.log("Page is callback without regwall param. Routing to callback receiver..."),e.next=18,qu();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=el;var tl=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(Wc.A.log("Connext was not loaded."),n(!1)),Wc.A.log("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(){Wc.A.log("Signed user up to newsletter: ",t),n(!0)},onError:function(e){Wc.A.log("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){Wc.A.log("subscribeToNewsletter Error:",e),n(!1)}})},nl=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)}})},rl=function(e){try{"string"==typeof e&&nu(Gc.AUTH0_SUB_COOKIE_KEY,e,{domain:tu(),path:"/",expires:365,secure:!0})}catch(e){Wc.A.log("Failed to set auth0_sub cookie: ",e)}},ol=function(e){if(!$c(Gc.AUTH0_SUB_COOKIE_KEY))try{var t=e.claims;if(null==t||"object"!==(0,o.A)(t)&&!Object.keys(t).includes("sub"))return;var n=t.sub;rl(n)}catch(e){Wc.A.log("Failed to set auth0_sub: ",e)}},il=function(e){try{if("string"==typeof e){var t=iu(e).sub;rl(t)}else Wc.A.log("Could not set auth0_sub on login, idToken was not available.")}catch(e){Wc.A.log("Failed to set auth0_sub on login: ",e)}},al=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o;return r.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",1e3*Nu.A.backupTimeoutLength);case 1:return e.next=2,$u();case 2:return n=e.sent,o=n.email,Wc.A.log("CONNEXT: about to sign up ".concat(o," to ").concat(t)),e.next=3,tl(o,t);case 3:window.localStorage.removeItem("newsletter_to_subscribe"),Wc.A.log("CONNEXT: newsletter_to_subscribe value removed from local storage.");case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),sl=function(){var e=(0,t.A)(r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return nl(),al(),MNGAuthentication.oidcLoginCallbacks.push(il),window.ConnextUtils.runConnextIfSilent(),e.next=1,yu();case 1:t=e.sent,ol(t);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const cl={init:sl};(function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return cl.init(),e.next=1,uu(!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.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 N(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return v(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function N(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){F(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){F(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Z(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Z(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function F(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function K(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new H.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=j(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=j(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*y}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,f={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,n){return i=e,a=0,s=t,f.n=n,u}};function h(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=p===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=h&&((o=e<2&&hr||r>p)&&(i[4]=e,i[5]=r,f.n=p,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&h(l,p),a=l,s=p;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(f.n=-1),h(a,s)):f.n=s:f.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=f.n<0)?s:e.call(r,f))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function f(){}n=Object.getPrototypeOf;var h=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),p=f.prototype=l.prototype=Object.create(h);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,r(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return d.prototype=f,r(p,"constructor",f),r(f,"constructor",d),d.displayName="GeneratorFunction",r(f,s,"GeneratorFunction"),r(p),r(p,s,"Generator"),r(p,a,function(){return this}),r(p,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:y}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function f(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var h={throw:1,return:2,break:3,continue:3};function p(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,h[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(p(e),n,r,o&&o.reverse())},isGeneratorFunction:f,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(f(t)?a:i)(p(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!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:()=>Ca,hasStandardBrowserEnv:()=>Pa,hasStandardBrowserWebWorkerEnv:()=>La,navigator:()=>ka,origin:()=>xa});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)}}function y(e,t){this.v=e,this.k=t}function w(e,t){(null==t||t>e.length)&&e.length;for(var n=0,r=Array(t);n0&&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 L(this,void 0,void 0,function(){return x(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 L(this,void 0,void 0,function(){var n,r,o,i;return x(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?B:this.storageHandler,r=M+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,D.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),D.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;F=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;le=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 ee("The input to be decoded is not correctly encoded.",Z,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 ee("".concat(n," must be a non-negative number"),Z,o);return}throw ee("".concat(n," must be a positive number"),Z,o)}catch(e){if(r)throw ye(e.message,r,o);throw e}}function be(e,t,n,r){try{if("string"!=typeof e)throw ee("".concat(t," must be a string"),Q,r);if(0===e.length)throw ee("".concat(t," must not be empty"),Z,r)}catch(e){if(n)throw ye(e.message,n,r);throw e}}function ve(e){!function(e,t){if(Ye(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 ye(t,yt,e)}(e,t)}(e,"application/json")}function Se(){return fe(crypto.getRandomValues(new Uint8Array(32)))}function Te(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 he("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 he("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 he("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 he("unsupported CryptoKey algorithm name",{cause:e})}}function Re(e){const t=null==e?void 0:e[ne];return"number"==typeof t&&Number.isFinite(t)?t:0}function Oe(e){const t=null==e?void 0:e[re];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function _e(){return Math.floor(Date.now()/1e3)}function Ne(e){if("object"!=typeof e||null===e)throw ee('"as" must be an object',Q);be(e.issuer,'"as.issuer"')}function Ie(e){if("object"!=typeof e||null===e)throw ee('"client" must be an object',Q);be(e.client_id,'"client.client_id"')}function Ce(e){return be(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function ke(e,t){const n=e instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&be(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw ee("".concat(t," must be a CryptoKey"),Q)}(e,t),"private"!==e.type)throw ee("".concat(t," must be a private CryptoKey"),Z)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:Te(r),kid:o},u=function(e,t){const n=_e()+Re(t);return{jti:Se(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===t[ie]||void 0===s||s.call(t,c,u),i.set("client_id",n.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 ee('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Z);const r="".concat(fe(ue(JSON.stringify(e))),".").concat(fe(ue(JSON.stringify(t)))),o=fe(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Ot(e)};case"RSA-PSS":switch(Rt(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 he("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Rt(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new he("unsupported CryptoKey algorithm name",{cause:e})}(n),n,ue(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const Pe=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Le(e,t){if(t&&"https:"!==e.protocol)throw ye("only requests to HTTPS are allowed",mt,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw ye("only HTTP and HTTPS requests are allowed",gt,e)}function xe(e,t,n,r){let o;if("string"!=typeof e||!Pe(e))throw ye("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?vt:St,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Le(o,r),o}function Ue(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?xe(e.mtls_endpoint_aliases[t],t,n,r):xe(e[t],t,n,r)}class De extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"status",void 0),S(this,"error_description",void 0),S(this,"response",void 0),this.name=this.constructor.name,this.code=lt,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 Me extends Error{constructor(e,t){var n,r;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"error_description",void 0),this.name=this.constructor.name,this.code=ft,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 Be extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"response",void 0),S(this,"status",void 0),this.name=this.constructor.name,this.code=ut,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 He="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Ge="("+He+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',je="("+He+")\\s*=\\s*("+He+")",Fe=new RegExp("^[,\\s]*("+He+")"),Ke=new RegExp("^[,\\s]*"+Ge+"[,\\s]*(.*)"),We=new RegExp("^[,\\s]*"+je+"[,\\s]*(.*)"),Xe=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Je(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(function(e){if(!z(e,Response))throw ee('"response" must be an instance of Response',Q);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(Fe);const c=null===t||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;l?l[1]:void 0;const f={};let h;if(d)for(;r;){let n,o;if(r.match(Ke)){var i=_(t,4);if(i[1],i[2],i[3],o.includes("\\"))try{JSON.parse('"'.concat(o,'"'))}catch(e){}f[n.toLowerCase()]=o}else{if(!r.match(We)){if(r.match(Xe)){if(Object.keys(f).length)break;var a=_(t,3);a[1],a[2];break}return}var s=_(t,4);s[1],s[2],s[3],f[n.toLowerCase()]=o}}else 0;const p={scheme:c,parameters:f};h&&(p.token68=h),n.push(p)}return n.length?n:void 0}(e))throw new Be("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){Tt(e),ve(e);try{const t=await e.clone().json();if(we(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 De("server responded with an error in the response body",{cause:t,response:e});throw ye('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),wt,e)}}function Ve(e){if(!rt.has(e))throw ee('"options.DPoP" is not a valid DPoPHandle',Z)}function Ye(e){var t;return null===e.headers.get("content-type")||void 0===t?void 0:t.split(";")[0]}async function qe(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[oe])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:ge(r,null==a?void 0:a.signal)})}async function ze(e,t,n,r,o,i){var a;const s=Ue(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[te]));o.set("grant_type",r);const c=me(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Ve(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await qe(e,t,n,s,o,c,i);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(u,s),u}const $e=new WeakMap,Ze=new WeakMap;function Qe(e){if(!e.id_token)return;const t=$e.get(e);if(!t)throw ee('"ref" was already garbage collected or did not resolve from the proper sources',Z);return t}async function et(e,t,n,r,o,i){if(Ne(e),Ie(t),!z(n,Response))throw ee('"response" must be an instance of Response',Q);await Je(n,200,"Token Endpoint"),Tt(n);const a=await kt(n);if(be(a.access_token,'"response" body "access_token" property',pt,{body:a}),be(a.token_type,'"response" body "token_type" property',pt,{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;Ae(e,!0,'"response" body "expires_in" property',pt,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&be(a.refresh_token,'"response" body "refresh_token" property',pt,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw ye('"response" body "scope" property must be a string',pt,{body:a});if(void 0!==a.id_token){be(a.id_token,'"response" body "id_token" property',pt,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Ae(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await async function(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new he("JWE decryption is not configured",{cause:e});var d=(await o(e)).split(".");d[0],d[1],d.length}if(3!==l)throw ye("Invalid JWT",pt,e);try{JSON.parse(ue(fe(c)))}catch(e){throw ye("failed to parse JWT Header body as base64url encoded JSON",ht,e)}if(!we(i))throw ye("JWT Header must be a top level object",pt,e);if(t(i),void 0!==i.crit)throw new he('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{JSON.parse(ue(fe(u)))}catch(e){throw ye("failed to parse JWT Payload body as base64url encoded JSON",ht,e)}if(!we(a))throw ye("JWT Payload must be a top level object",pt,e);const f=_e()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw ye('unexpected JWT "exp" (expiration time) claim type',pt,{claims:a});if(a.exp<=f-r)throw ye('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Et,{claims:a,now:f,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw ye('unexpected JWT "iat" (issued at) claim type',pt,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw ye('unexpected JWT "iss" (issuer) claim type',pt,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw ye('unexpected JWT "nbf" (not before) claim type',pt,{claims:a});if(a.nbf>f+r)throw ye('unexpected JWT "nbf" (not before) claim value',Et,{claims:a,now:f,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw ye('unexpected JWT "aud" (audience) claim type',pt,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,_t.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Re(t),Oe(t),o).then(at.bind(void 0,i)).then(nt.bind(void 0,e)).then(tt.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw ye('ID Token "aud" (audience) claim includes additional untrusted audiences',At,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw ye('unexpected ID Token "azp" (authorized party) claim value',At,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&Ae(c.auth_time,!0,'ID Token "auth_time" (authentication time)',pt,{claims:c}),Ze.set(n,u),$e.set(a,c)}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 he("unsupported `token_type` value",{cause:{body:a}});return a}function tt(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw ye('unexpected JWT "aud" (audience) claim value',At,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw ye('unexpected JWT "aud" (audience) claim value',At,{expected:e,claims:t.claims,claim:"aud"});return t}function nt(e,t){var n,r;const o=null!==(null===e[Lt]||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw ye('unexpected JWT "iss" (issuer) claim value',At,{expected:o,claims:t.claims,claim:"iss"});return t}const rt=new WeakSet,ot=Symbol(),it={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 at(e,t){for(const n of e)if(void 0===t.claims[n])throw ye('JWT "'.concat(n,'" (').concat(it[n],") claim missing"),pt,{claims:t.claims});return t}const st=Symbol(),ct=Symbol();const ut="OAUTH_WWW_AUTHENTICATE_CHALLENGE",lt="OAUTH_RESPONSE_BODY_ERROR",dt="OAUTH_UNSUPPORTED_OPERATION",ft="OAUTH_AUTHORIZATION_RESPONSE_ERROR",ht="OAUTH_PARSE_ERROR",pt="OAUTH_INVALID_RESPONSE",yt="OAUTH_RESPONSE_IS_NOT_JSON",wt="OAUTH_RESPONSE_IS_NOT_CONFORM",mt="OAUTH_HTTP_REQUEST_FORBIDDEN",gt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Et="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",At="OAUTH_JWT_CLAIM_COMPARISON_FAILED",bt="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",vt="OAUTH_MISSING_SERVER_METADATA",St="OAUTH_INVALID_SERVER_METADATA";function Tt(e){if(e.bodyUsed)throw ee('"response" body has been used already',Z)}function Rt(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new he("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Ot(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new he("unsupported ECDSA namedCurve",{cause:e})}}function _t(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw ye('unexpected JWT "alg" header parameter',pt,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw ye('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 ye('unexpected JWT "alg" header parameter',pt,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw ye('unexpected JWT "alg" header parameter',pt,{header:r,expected:e,reason:"client configuration"})}function Nt(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw ye('"'.concat(t,'" parameter must be provided only once'),pt);return r}const It=Symbol(),Ct=Symbol();async function kt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;try{await e.json()}catch(t){throw n(e),ye('failed to parse "response" body as JSON',ht,t)}if(!we(t))throw ye('"response" body must be a top level object',pt,{body:t});return t}const Pt=Symbol(),Lt=Symbol(),xt=new TextEncoder,Ut=new TextDecoder;function Dt(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 Mt(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},Gt=(e,t)=>e.name===t;function jt(e,t){var n;if(e.hash,parseInt(n.name.slice(4),10)!==t)throw Ht("SHA-".concat(t),"algorithm.hash")}function Ft(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 Kt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(Xt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Jt extends Wt{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}}),S(this,"code","ERR_JWT_EXPIRED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(Jt,"code","ERR_JWT_EXPIRED");class Vt extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}S(Vt,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Yt extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_NOT_SUPPORTED")}}S(Yt,"code","ERR_JOSE_NOT_SUPPORTED"),S(class extends Wt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),S(class extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class qt extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JWS_INVALID")}}S(qt,"code","ERR_JWS_INVALID");class zt extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JWT_INVALID")}}S(zt,"code","ERR_JWT_INVALID"),S(class extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class $t extends Wt{constructor(){super(...arguments),S(this,"code","ERR_JWKS_INVALID")}}S($t,"code","ERR_JWKS_INVALID");class Zt extends Wt{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),S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}S(Zt,"code","ERR_JWKS_NO_MATCHING_KEY");class Qt extends Wt{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),S(this,Symbol.asyncIterator,void 0),S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}S(Qt,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class en extends Wt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_TIMEOUT")}}S(en,"code","ERR_JWKS_TIMEOUT");class tn extends Wt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}S(tn,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const nn=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},rn=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),on=e=>nn(e)||rn(e);function an(e,t,n){try{return Bt(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function sn(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 cn=e=>sn(e)&&"string"==typeof e.kty;async function un(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];hn||(hn=new WeakMap);let o=hn.get(e);if(null!=o&&o[n])return o[n];const i=await dn(R(R({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:hn.set(e,{[n]:i}),i};const yn=(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)},gn=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},En=(e,t,n)=>{var r;const o=(e=>Mt(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){mn(e,48,"Invalid PKCS#8 structure"),wn(e),mn(e,2,"Expected version field");const t=wn(e);e.pos+=t,mn(e,48,"Expected algorithm identifier");wn(e);e.pos}(t),(e=>{const t=(e=>{mn(e,6,"Expected algorithm OID");const t=wn(e);return gn(e,t)})(e);if(yn(t,[43,101,110]))return"X25519";if(!yn(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");mn(e,6,"Expected curve OID");const n=wn(e),r=gn(e,n);for(const e 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]}]){const t=e.name,n=e.oid;if(yn(r,n))return t}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 Yt("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 Yt('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)},An=e=>null==e?void 0:e[Symbol.toStringTag],bn=(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 vn,Sn;let Tn,Rn;if("undefined"==typeof navigator||null===(vn=navigator.userAgent)||void 0===vn||null===(Sn=vn.startsWith)||void 0===Sn||!Sn.call(vn,"Mozilla/5.0 ")){const e="v6.8.4";Rn="".concat("openid-client","/").concat(e),Tn={"user-agent":Rn}}const On=e=>_n.get(e);let _n,Nn;function In(e){return void 0!==e?Ce(e):(Nn||(Nn=new WeakMap),(e,t,n,r)=>{let o;return(o=Nn.get(t))||(function(e,t){if("string"!=typeof e)throw Ln("".concat(t," must be a string"),Pn);if(0===e.length)throw Ln("".concat(t," must not be empty"),kn)}(t.client_secret,'"metadata.client_secret"'),o=Ce(t.client_secret),Nn.set(t,o)),o(e,t,n,r)})}const Cn=oe,kn="ERR_INVALID_ARG_VALUE",Pn="ERR_INVALID_ARG_TYPE";function Ln(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class xn extends Error{constructor(e,t){var n;super(e,t),S(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 Un(e,t,n){return new xn(e,{cause:t,code:n})}function Dn(e){if(e instanceof TypeError||e instanceof xn||e instanceof De||e instanceof Me||e instanceof Be)throw e;if(e instanceof pe)switch(e.code){case mt:throw Un("only requests to HTTPS are allowed",e,e.code);case gt:throw Un("only requests to HTTP or HTTPS are allowed",e,e.code);case wt:throw Un("unexpected HTTP response status code",e.cause,e.code);case yt:throw Un("unexpected response content-type",e.cause,e.code);case ht:throw Un("parsing error occured",e,e.code);case pt:throw Un("invalid response encountered",e,e.code);case At:throw Un("unexpected JWT claim value encountered",e,e.code);case bt:throw Un("unexpected JSON attribute value encountered",e,e.code);case Et:throw Un("JWT timestamp claim value failed validation",e,e.code);default:throw Un(e.message,e,e.code)}if(e instanceof he)throw Un("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Un("runtime operation error",e,dt);case"NotSupportedError":throw Un("runtime unsupported operation",e,dt);case"TimeoutError":throw Un("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Un("operation aborted",e,"OAUTH_ABORT")}throw new xn("something went wrong",{cause:e})}async function Mn(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Ln('"server" must be an instance of URL',Pn);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 ee('"'.concat("issuerIdentifier",'" must be an instance of URL'),Q);Le(e,!0!==(null==r?void 0:r[te]));const o=n(new URL(e.href)),i=me(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[oe])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:ge(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=Ee("".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=Ee("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw ee('"options.algorithm" must be "oidc" (default), or "oauth2"',Z)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[oe]:null==t?void 0:t[Cn],[te]:null==t||null===t.execute||void 0===r?void 0:r.includes(Xn),signal:a,headers:new Headers(Tn)}):((null==t?void 0:t[Cn])||fetch)((Le(e,null==t||null===t.execute||void 0===c||!c.includes(Xn)),e.href),{headers:Object.fromEntries(new Headers(R({accept:"application/json"},Tn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Pt)throw ee('"expectedIssuerIdentifier" must be an instance of URL',Q);if(!z(t,Response))throw ee('"response" must be an instance of Response',Q);if(200!==t.status)throw ye('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',wt,t);Tt(t);const r=await kt(t);if(be(r.issuer,'"response" body "issuer" property',pt,{body:r}),n!==Pt&&new URL(r.issuer).href!==n.href)throw ye('"response" body "issuer" property does not match the expected value',bt,{expected:n.href,body:r,attribute:"issuer"});return r}(Pt,e)).catch(Dn);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[Bn]=!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 xn("discovered metadata issuer does not match the expected issuer",{code:bt,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Hn(i,t,n,r);let s=On(a);if(null!=o&&o[Cn]&&(s.fetch=o[Cn]),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 Bn=Symbol();class Hn{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Ln('"clientId" must be a non-empty string',Pn);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 Ln('"clientId" and "metadata.client_id" must be the same',kn);const u=R(R({},structuredClone(n)),{},{client_id:t});let l;u[ne]=null!==(i=null===(a=n)||void 0===a?void 0:a[ne])&&void 0!==i?i:0,u[re]=null!==(s=null===(c=n)||void 0===c?void 0:c[re])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?In(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const f=structuredClone(e);Bn in e&&(f[Lt]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let h=Object.freeze(f);_n||(_n=new WeakMap),_n.set(this,{__proto__:null,as:h,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(On(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(On(this).c)}get timeout(){return On(this).timeout}set timeout(e){On(this).timeout=e}get[Cn](){return On(this).fetch}set[Cn](e){On(this).fetch=e}}function Gn(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 Qe(this)}catch(e){return}}}}}(e))}async function jn(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 pe("invalid Retry-After header value",{cause:e});a>t&&await Fn(a-t,n)}function Fn(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){$n(e);const n=On(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){Ne(e),Ie(t);const i=Ue(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[te])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=me(null==o?void 0:o.headers);return s.set("accept","application/json"),qe(e,t,n,i,a,s,o)}(r,o,i,t,{[oe]:a,[te]:!s,headers:new Headers(Tn),signal:Zn(c)}).then(e=>async function(e,t,n){if(Ne(e),Ie(t),!z(n,Response))throw ee('"response" must be an instance of Response',Q);await Je(n,200,"Backchannel Authentication Endpoint"),Tt(n);const r=await kt(n);be(r.auth_req_id,'"response" body "auth_req_id" property',pt,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Ae(o,!0,'"response" body "expires_in" property',pt,{body:r}),r.expires_in=o,void 0!==r.interval&&Ae(r.interval,!1,'"response" body "interval" property',pt,{body:r}),r}(r,o,e)).catch(Dn)}async function Wn(e,t,n,r){var o,i;$n(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 Fn(a,s)}catch(e){Dn(e)}const c=On(e),u=c.as,l=c.c,d=c.auth,f=c.fetch,h=c.tlsOnly,p=c.nonRepudiation,y=c.timeout,w=c.decrypt,m=(o,i)=>Wn(e,R(R({},t),{},{interval:o}),n,R(R({},r),{},{signal:s,flag:i})),g=function(e,t){const n=Zn(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,y),E=await async function(e,t,n,r,o){Ne(e),Ie(t),be(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),ze(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[oe]:f,[te]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Tn),signal:g.signal}).catch(Dn).finally(g.cleanup);var A;if(503===E.status&&E.headers.has("retry-after"))return await jn(E,a,s,!0),await(null===E.body||void 0===A?void 0:A.cancel()),m(a);const b=async function(e,t,n,r){return et(e,t,n,void 0,null==r?void 0:r[ae],null==r?void 0:r.recognizedTokenTypes)}(u,l,E,{[ae]:w});let v;try{await b}catch(e){if(Qn(e,r))return m(a,er);if(e instanceof De)switch(e.error){case"slow_down":0;case"authorization_pending":return await jn(e.response,a,s),m(a)}Dn(e)}return v.id_token&&await(null==p?void 0:p(E)),Gn(v),v}function Xn(e){On(e).tlsOnly=!1}async function Jn(e,t,n,r,o){if($n(e),!((null==o?void 0:o.flag)===er||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Ln('"currentUrl" must be an instance of URL, or Request',Pn);let i,a;const s=On(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,f=s.tlsOnly,h=s.jarm,p=s.hybrid,y=s.nonRepudiation,w=s.timeout,m=s.decrypt,g=s.implicit;if((null==o?void 0:o.flag)===er)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 ee("form_post responses are expected to use the POST method",Z,{cause:e});if("application/x-www-form-urlencoded"!==Ye(e))throw ee("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Z,{cause:e});return async function(e){if(e.bodyUsed)throw ee("form_post Request instances must contain a readable body",Z,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const e of n.entries()){var E=_(e,2);const n=E[0],r=E[1];t.searchParams.append(n,r)}break;default:throw Ln("unexpected Request HTTP method",kn)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!h:await h(t,null==n?void 0:n.expectedState);break;case!!p:await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!g:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{(function(e,t,n,r){if(Ne(e),Ie(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw ee('"parameters" must be an instance of URLSearchParams, or URL',Q);if(Nt(n,"response"))throw ye('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',pt,{parameters:n});const o=Nt(n,"iss"),i=Nt(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw ye('response parameter "iss" (issuer) missing',pt,{parameters:n});if(o&&o!==e.issuer)throw ye('unexpected "iss" (issuer) response parameter value',pt,{expected:e.issuer,parameters:n});switch(r){case void 0:case Ct:if(void 0!==i)throw ye('unexpected "state" response parameter encountered',pt,{expected:void 0,parameters:n});break;case It:break;default:if(be(r,'"expectedState" argument'),i!==r)throw ye(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',pt,{expected:r,parameters:n})}if(Nt(n,"error"))throw new Me("authorization response from the server is an error",{cause:n});const a=Nt(n,"id_token"),s=Nt(n,"token");if(void 0!==a||void 0!==s)throw new he("implicit and hybrid flows are not supported");return new URLSearchParams(n),rt.add(c),c;var c})(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Dn(e)}}}const A=await async function(e,t,n,r,o,i,a){if(Ne(e),Ie(t),!rt.has(r))throw ee('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Z);be(o,'"redirectUri"');const s=Nt(r,"code");if(!s)throw ye('no authorization code in "callbackParameters"',pt);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==ot&&(be(i,'"codeVerifier"'),c.set("code_verifier",i)),ze(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||ot,{additionalParameters:r,[oe]:d,[te]:!f,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Tn),signal:Zn(w)}).catch(Dn);"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:0;break;case st:break;default:be(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case ct:break;default:Ae(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await et(e,t,n,s,i,a);be(c.id_token,'"response" body "id_token" property',pt,{body:c});const u=Qe(c);if(o!==ct){const e=_e()+Re(t),n=Oe(t);if(u.auth_time+o{}};const y=async function(e,t,n,r){return et(e,t,n,void 0,null==r?void 0:r[ae],null==r?void 0:r.recognizedTokenTypes)}(i,a,h,{[ae]:d,recognizedTokenTypes:p});let w;try{await y}catch(o){if(Qn(o,r))return tr(e,t,n,R(R({},r),{},{flag:er}));Dn(o)}return w.id_token&&await(null==f?void 0:f(h)),Gn(w),w}async function nr(e,t,n){if(!sn(e))throw new qt("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new qt('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new qt("JWS Protected Header incorrect type");if(void 0===e.payload)throw new qt("JWS Payload missing");if("string"!=typeof e.signature)throw new qt("JWS Signature missing or incorrect type");if(void 0!==e.header&&!sn(e.header))throw new qt("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=Bt(e.protected);JSON.parse(Ut.decode(t))}catch(e){throw new qt("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Yt('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)}(qt,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 qt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const s=o.alg;if("string"!=typeof s||!s)throw new qt('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 Vt('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new qt("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new qt("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(cn(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&bn(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(!on(t))throw new TypeError(Kt(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(An(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(cn(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&bn(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)&&bn(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!on(t))throw new TypeError(Kt(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(An(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(An(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(An(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(An(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(An(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;ne+t.length,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?Dt(e.protected):new Uint8Array,Dt("."),"string"==typeof e.payload?a?Dt(e.payload):xt.encode(e.payload):e.payload),d=an(e.signature,"signature",qt),f=await async function(e,t){if(e instanceof Uint8Array)return e;if(nn(e))return e;if(rn(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{hn||(hn=new WeakMap);let n=hn.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(fn)}e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(fn);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(fn);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(fn)}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(fn);const i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[t]&&n===i[t]&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),t.startsWith("ECDH-ES")&&e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"])}if(!i)throw new TypeError(fn);return n?n[t]=i:hn.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return pn(e,n,t)}if(cn(e))return e.k?Bt(e.k):pn(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await un(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const n=t.algorithm.modulusLength;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 Yt("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 tn;let h;a?an(e.payload,"payload",qt):"string"==typeof e.payload?xt.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?R(R({},p),{},{key:f}):p}const rr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function or(e){const t=rr.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 ir=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function ar(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Ut.decode(t))}catch(e){}if(!sn(n))throw new zt("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(o&&("string"!=typeof e.typ||ir(e.typ)!==ir(o)))throw new Xt('unexpected "typ" JWT header value',n,"typ","check_failed");const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in n))throw new Xt('missing required "'.concat(e,'" claim'),n,e,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(n.iss))throw new Xt('unexpected "iss" claim value',n,"iss","check_failed");if(c&&n.sub!==c)throw new Xt('unexpected "sub" claim value',n,"sub","check_failed");if(u&&!("string"==typeof n.aud?h.includes(f):Array.isArray(f)&&h.some(Set.prototype.has.bind(new Set(f)))))throw new Xt('unexpected "aud" claim value',n,"aud","check_failed");var f,h;let p;switch(typeof r.clockTolerance){case"string":or(r.clockTolerance);break;case"number":r.clockTolerance;break;case"undefined":0;break;default:throw new TypeError("Invalid clockTolerance option type")}const y=(r.currentDate||new Date,Math.floor(w.getTime()/1e3));var w;if((void 0!==n.iat||l)&&"number"!=typeof n.iat)throw new Xt('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Xt('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>y+p)throw new Xt('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Xt('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=y-p)throw new Jt('"exp" claim timestamp check failed',n,"exp","check_failed")}if(l){const e=y-n.iat;if(e-p>("number"==typeof l?l:or(l)))throw new Jt('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new Xt('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function sr(e){return sn(e)}var cr,ur,lr=new WeakMap,dr=new WeakMap;class fr{constructor(e){if(b(this,lr,void 0),b(this,dr,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(sr)}(e))throw new $t("JSON Web Key Set malformed");v(lr,this,structuredClone(e))}jwks(){return A(lr,this)}async getKey(e,t){const n=R(R({},e),null==t?void 0:t.header),r=n.alg,o=n.kid,i=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 Yt('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=A(lr,this).keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof o&&o===e.kid,!t||"string"!=typeof e.alg&&"AKP"!==i||r===e.alg,t&&"string"==typeof e.use&&"sig"===e.use,t&&Array.isArray(e.key_ops)&&e.key_ops.includes("verify"),t)switch(r){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}),s=a[0],c=a.length;if(0===c)throw new Zt;if(1!==c){const e=new Qt,t=A(dr,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new N(e.apply(this,arguments))}}(function*(){for(const e of a)try{yield yield g(hr(t,e,r))}catch(e){}}),e}return hr(A(dr,this),s,r)}}async function hr(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(!sn(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 Bt(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Yt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return dn(R(R({},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 dn(R(R({},e),{},{ext:n}));case"EC":case"OKP":return dn(R(R({},e),{},{alg:t,ext:n}));default:throw new Yt('Unsupported "kty" (Key Type) Parameter value')}}(R(R({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new $t("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function pr(e){const t=new fr(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 yr;if("undefined"==typeof navigator||null===(cr=navigator.userAgent)||void 0===cr||null===(ur=cr.startsWith)||void 0===ur||!ur.call(cr,"Mozilla/5.0 ")){const e="v6.2.3";yr="".concat("jose","/").concat(e)}const wr=Symbol(),mr=Symbol();var gr=new WeakMap,Er=new WeakMap,Ar=new WeakMap,br=new WeakMap,vr=new WeakMap,Sr=new WeakMap,Tr=new WeakMap,Rr=new WeakMap,Or=new WeakMap,_r=new WeakMap;class Nr{constructor(e,t){if(b(this,gr,void 0),b(this,Er,void 0),b(this,Ar,void 0),b(this,br,void 0),b(this,vr,void 0),b(this,Sr,void 0),b(this,Tr,void 0),b(this,Rr,void 0),b(this,Or,void 0),b(this,_r,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;v(gr,this,new URL(e.href)),v(Er,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),v(Ar,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),v(br,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),v(Tr,this,new Headers(null==t?void 0:t.headers)),yr&&!A(Tr,this).has("User-Agent")&&A(Tr,this).set("User-Agent",yr),A(Tr,this).has("accept")||(A(Tr,this).set("accept","application/json"),A(Tr,this).append("accept","application/jwk-set+json")),v(Rr,this,null==t?void 0:t[wr]),void 0!==(null==t?void 0:t[mr])&&(v(_r,this,null==t?void 0:t[mr]),null==t?void 0:t[mr],A(br,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&sn(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,sn)&&(v(vr,this,A(_r,this).uat),v(Or,this,pr(A(_r,this).jwks))))}pendingFetch(){return!!A(Sr,this)}coolingDown(){return"number"==typeof A(vr,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 en;throw e});if(200!==o.status)throw new Wt("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Wt("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(A(gr,this).href,A(Tr,this),AbortSignal.timeout(A(Er,this)),A(Rr,this)).then(e=>{v(Or,this,pr(e)),A(_r,this)&&(A(_r,this).uat=Date.now(),A(_r,this).jwks=e),v(vr,this,Date.now()),v(Sr,this,void 0)}).catch(e=>{throw v(Sr,this,void 0),e})),await A(Sr,this)}}const Ir=["mfaToken"],Cr=["mfaToken"];var kr,Pr,Lr,xr,Ur,Dr,Mr,Br,Hr,Gr,jr,Fr,Kr,Wr,Xr,Jr,Vr=class extends Error{constructor(e,t){super(t),S(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Yr=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},qr=class extends Yr{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},zr=class extends Yr{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},$r=class extends Yr{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Zr=class extends Yr{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Qr=class extends Yr{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},eo=class extends Yr{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},to=class extends Error{constructor(e){super(e),S(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},no=class extends Yr{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),S(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ro=class extends Yr{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},oo=class extends Yr{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},io=class extends Yr{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},ao=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),S(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function so(e){return Object.entries(e).filter(e=>void 0!==_(e,2)[1]).reduce((e,t)=>R(R({},e),{},{[t[0]]:t[1]}),{})}var co=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},uo=class extends co{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},lo=class extends co{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},fo=class extends co{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},ho=class extends co{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function po(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var yo=(kr=new WeakMap,Pr=new WeakMap,Lr=new WeakMap,class{constructor(e){var t;b(this,kr,void 0),b(this,Pr,void 0),b(this,Lr,void 0),v(kr,this,"https://".concat(e.domain)),v(Pr,this,e.clientId),v(Lr,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(A(kr,this),"/mfa/authenticators"),n=e.mfaToken,r=await A(Lr,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 uo(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(po)}async enrollAuthenticator(e){const t="".concat(A(kr,this),"/mfa/associate"),n=e.mfaToken,r=O(e,Ir),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 A(Lr,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 lo(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const t=e.authenticatorId,n=e.mfaToken,r="".concat(A(kr,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await A(Lr,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 fo(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(A(kr,this),"/mfa/challenge"),n=e.mfaToken,r=O(e,Cr),o={mfa_token:n,client_id:A(Pr,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await A(Lr,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 ho(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())}}),wo=class e{constructor(e,t,n,r,o,i,a){S(this,"accessToken",void 0),S(this,"idToken",void 0),S(this,"refreshToken",void 0),S(this,"expiresAt",void 0),S(this,"scope",void 0),S(this,"claims",void 0),S(this,"authorizationDetails",void 0),S(this,"tokenType",void 0),S(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}},mo=(xr=new WeakMap,Ur=new WeakMap,Dr=new WeakMap,class{constructor(e,t){b(this,xr,new Map),b(this,Ur,void 0),b(this,Dr,void 0),v(Dr,this,Math.max(1,Math.floor(e))),v(Ur,this,Math.max(0,Math.floor(t)))}get(e){const t=A(xr,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return A(xr,this).delete(e),A(xr,this).set(e,t),t.value;A(xr,this).delete(e)}}set(e,t){for(A(xr,this).has(e)&&A(xr,this).delete(e),A(xr,this).set(e,{value:t,expiresAt:Date.now()+A(Ur,this)});A(xr,this).size>A(Dr,this);){const e=A(xr,this).keys().next().value;if(void 0===e)break;A(xr,this).delete(e)}}}),go=new Map;function Eo(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var Ao=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,go.get(i));var i;return o||(o=new mo(e.maxEntries,e.ttlMs),go.set(t,o)),o}static createJwksCache(){return{}}},bo="openid profile email offline_access",vo=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 So(e){if(null==e)throw new eo("subject_token is required");if("string"!=typeof e)throw new eo("subject_token must be a string");if(0===e.trim().length)throw new eo("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new eo("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new eo("subject_token must not include the 'Bearer ' prefix")}function To(e,t){if(t)for(const r of Object.entries(t)){var n=_(r,2);const t=n[0],o=n[1];if(!vo.has(t))if(Array.isArray(o)){if(o.length>20)throw new eo("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}else e.append(t,o)}}var Ro="urn:ietf:params:oauth:token-type:access_token";Mr=new WeakMap,Br=new WeakMap,Hr=new WeakMap,Gr=new WeakMap,jr=new WeakMap,Fr=new WeakMap,Kr=new WeakMap,Wr=new WeakMap,Xr=new WeakMap,Jr=new WeakSet;function Oo(){const e=A(Gr,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(A(Gr,this).useMtls?"1":"0")}async function _o(e){const t=await m(Jr,this,ko).call(this),n=new Hn(e,A(Gr,this).clientId,A(Gr,this).clientSecret,t);return n[Cn]=A(jr,this),n}async function No(){if(A(Mr,this)&&A(Br,this))return{configuration:A(Mr,this),serverMetadata:A(Br,this)};const e=m(Jr,this,Oo).call(this),t=A(Kr,this).get(e);if(t)return v(Br,this,t.serverMetadata),v(Mr,this,await m(Jr,this,_o).call(this,t.serverMetadata)),{configuration:A(Mr,this),serverMetadata:A(Br,this)};const n=A(Wr,this).get(e);if(n){const e=await n;return v(Br,this,e.serverMetadata),v(Mr,this,await m(Jr,this,_o).call(this,e.serverMetadata)),{configuration:A(Mr,this),serverMetadata:A(Br,this)}}const r=(async()=>{const t=await m(Jr,this,ko).call(this),n=await Mn(new URL("https://".concat(A(Gr,this).domain)),A(Gr,this).clientId,{use_mtls_endpoint_aliases:A(Gr,this).useMtls},t,{[Cn]:A(jr,this)}),r=n.serverMetadata();return A(Kr,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>({serverMetadata:e.serverMetadata}));o.catch(()=>{}),A(Wr,this).set(e,o);try{const e=await r,t=e.configuration,n=e.serverMetadata;v(Mr,this,t),v(Br,this,n),A(Mr,this)[Cn]=A(jr,this)}finally{A(Wr,this).delete(e)}return{configuration:A(Mr,this),serverMetadata:A(Br,this)}}async function Io(e){var t,n;const r=(await m(Jr,this,No).call(this)).configuration;if("audience"in e||"resource"in e)throw new eo("audience and resource parameters are not supported for Token Vault exchanges");So(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==t?t:Ro,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),To(o,e.extra);try{const e=await tr(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return wo.fromTokenEndpointResponse(e)}catch(t){throw new eo("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Co(e){const t=(await m(Jr,this,No).call(this)).configuration;So(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),To(n,e.extra);try{const e=await tr(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return wo.fromTokenEndpointResponse(e)}catch(t){throw new eo("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ko(){return A(Hr,this)||v(Hr,this,(async()=>{if(!A(Gr,this).clientSecret&&!A(Gr,this).clientAssertionSigningKey&&!A(Gr,this).useMtls)throw new ao;if(A(Gr,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=A(Gr,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 En(e,t,void 0)}(e,A(Gr,this).clientAssertionSigningAlg||"RS256"),e?function(e){return ke(e,void 0)}(e):In(A(Gr,this).clientSecret)})().catch(e=>{throw v(Hr,this,void 0),e})),A(Hr,this)}async function Po(e){const t=(await m(Jr,this,No).call(this)).configuration,n=Se(),r=await function(e){return async function(e){return be(e,"codeVerifier"),fe(await crypto.subtle.digest("SHA-256",ue(e)))}(e)}(n),o=so(R(R({},A(Gr,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(R(R({scope:bo},o),{},{client_id:A(Gr,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await zn(t,i):await qn(t,i),codeVerifier:n}}const Lo="auth0_sub",xo="mng-entitlements",Uo="__MNG_Session",Do="regwallUserIsSubscribed";function Mo(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return s("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return s("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return s("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(s("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return s("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){s("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),s("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(s("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();l(Bo,"DEFAULT_TIMEOUT",3e3);new Bo;var Ho,Go;function jo(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 Fo(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Ko().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])},Jo=function(){var e=Xo();return".".concat(e)},Vo=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},Yo=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=Xo(),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,";")})},qo=function(){return Ko().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},zo=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)},$o=function(){return"complete"===document.readyState},Zo=function(){return new Promise(function(e){if(("interactive"===document.readyState||$o())&&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)}})},Qo=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,Zo();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)}}(),ei=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,Qo(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)}}(),ti=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))})},ni=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)}}(),ri=function(){s("Clearing entitlements...");try{Yo(xo,{path:"/"})}catch(e){s("Failed to delete legacy cookie: ",e)}try{Yo(xo,{path:"/",domain:Xo(),expires:365,secure:!0})}catch(e){s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Uo)}catch(e){s("Failed to remove local storage: ",e)}},oi=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=oi;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var ii=function(e){a.A.datadogEnabled&&window.DD_RUM.addTiming(e)},ai=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:Fo({},i)}));case 1:return r.next=2,ei();case 2:return u=r.sent,r.next=3,Qo("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,ni();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:Fo({},i)})},{once:!0}),r.next=12;break;case 8:if(f){r.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown"),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:Fo({},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=ai);function si(e,t){return function(){return e.apply(t,arguments)}}const{toString:ci}=Object.prototype,{getPrototypeOf:ui}=Object,{iterator:li,toStringTag:di}=Symbol,fi=(hi=Object.create(null),e=>{const t=ci.call(e);return hi[t]||(hi[t]=t.slice(8,-1).toLowerCase())});var hi;const pi=e=>(e=e.toLowerCase(),t=>fi(t)===e),yi=e=>t=>typeof t===e,{isArray:wi}=Array,mi=yi("undefined");function gi(e){return null!==e&&!mi(e)&&null!==e.constructor&&!mi(e.constructor)&&bi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ei=pi("ArrayBuffer");const Ai=yi("string"),bi=yi("function"),vi=yi("number"),Si=e=>null!==e&&"object"==typeof e,Ti=e=>{if("object"!==fi(e))return!1;const t=ui(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||di in e||li in e)},Ri=pi("Date"),Oi=pi("File"),_i=pi("Blob"),Ni=pi("FileList");const Ii="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Ci=void 0!==Ii.FormData?Ii.FormData:void 0,ki=pi("URLSearchParams"),[Pi,Li,xi,Ui]=["ReadableStream","Request","Response","Headers"].map(pi);function Di(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),wi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Bi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Hi=e=>!mi(e)&&e!==Bi;const Gi=(ji="undefined"!=typeof Uint8Array&&ui(Uint8Array),e=>ji&&e instanceof ji);var ji;const Fi=pi("HTMLFormElement"),Ki=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Wi=pi("RegExp"),Xi=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Di(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ji=pi("AsyncFunction"),Vi=(Yi="function"==typeof setImmediate,qi=bi(Bi.postMessage),Yi?setImmediate:qi?(zi=`axios@${Math.random()}`,$i=[],Bi.addEventListener("message",({source:e,data:t})=>{e===Bi&&t===zi&&$i.length&&$i.shift()()},!1),e=>{$i.push(e),Bi.postMessage(zi,"*")}):e=>setTimeout(e));var Yi,qi,zi,$i;const Zi="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Bi):"undefined"!=typeof process&&process.nextTick||Vi,Qi={isArray:wi,isArrayBuffer:Ei,isBuffer:gi,isFormData:e=>{if(!e)return!1;if(Ci&&e instanceof Ci)return!0;const t=ui(e);if(!t||t===Object.prototype)return!1;if(!bi(e.append))return!1;const n=fi(e);return"formdata"===n||"object"===n&&bi(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ei(e.buffer),t},isString:Ai,isNumber:vi,isBoolean:e=>!0===e||!1===e,isObject:Si,isPlainObject:Ti,isEmptyObject:e=>{if(!Si(e)||gi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Pi,isRequest:Li,isResponse:xi,isHeaders:Ui,isUndefined:mi,isDate:Ri,isFile:Oi,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:_i,isRegExp:Wi,isFunction:bi,isStream:e=>Si(e)&&bi(e.pipe),isURLSearchParams:ki,isTypedArray:Gi,isFileList:Ni,forEach:Di,merge:function e(...t){const{caseless:n,skipUndefined:r}=Hi(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Mi(o,i)||i,s=Ki(o,a)?o[a]:void 0;Ti(s)&&Ti(t)?o[a]=e(s,t):Ti(t)?o[a]=e({},t):wi(t)?o[a]=t.slice():r&&mi(t)||(o[a]=t)};for(let e=0,n=t.length;e(Di(t,(t,r)=>{n&&bi(t)?Object.defineProperty(e,r,{__proto__:null,value:si(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&ui(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:fi,kindOfTest:pi,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(wi(e))return e;let t=e.length;if(!vi(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[li]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Fi,hasOwnProperty:Ki,hasOwnProp:Ki,reduceDescriptors:Xi,freezeMethods:e=>{Xi(e,(t,n)=>{if(bi(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];bi(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 wi(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:Mi,global:Bi,isContextDefined:Hi,isSpecCompliantForm:function(e){return!!(e&&bi(e.append)&&"FormData"===e[di]&&e[li])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Si(e)){if(t.has(e))return;if(gi(e))return e;if(!("toJSON"in e)){t.add(e);const r=wi(e)?[]:{};return Di(e,(e,t)=>{const o=n(e);!mi(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:Ji,isThenable:e=>e&&(Si(e)||bi(e))&&bi(e.then)&&bi(e.catch),setImmediate:Vi,asap:Zi,isIterable:e=>null!=e&&bi(e[li])},ea=Qi.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"]),ta=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]&&ea[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};n.dn(ta);const na=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ra=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function oa(e,t){return Qi.isArray(e)?e.map(e=>oa(e,t)):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function ia(e){const t=Object.create(null);return Qi.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>oa(e,ra))(e)}),t}const aa=Symbol("internals");function sa(e){return e&&String(e).trim().toLowerCase()}function ca(e){return!1===e||null==e?e:Qi.isArray(e)?e.map(ca):(e=>oa(e,na))(String(e))}function ua(e,t,n,r,o){return Qi.isFunction(r)?r.call(this,t,n):(o&&(t=n),Qi.isString(t)?Qi.isString(r)?-1!==t.indexOf(r):Qi.isRegExp(r)?r.test(t):void 0:void 0)}class la{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=sa(t);if(!o)throw new Error("header name must be a non-empty string");const i=Qi.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ca(e))}const i=(e,t)=>Qi.forEach(e,(e,n)=>o(e,n,t));if(Qi.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Qi.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(ta(e),t);else if(Qi.isObject(e)&&Qi.isIterable(e)){let n,r,o={};for(const t of e){if(!Qi.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Qi.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=sa(e)){const n=Qi.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(Qi.isFunction(t))return t.call(this,e,n);if(Qi.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=sa(e)){const n=Qi.findKey(this,e);return!(!n||void 0===this[n]||t&&!ua(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=sa(e)){const o=Qi.findKey(n,e);!o||t&&!ua(0,n[o],o,t)||(delete n[o],r=!0)}}return Qi.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&&!ua(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Qi.forEach(this,(r,o)=>{const i=Qi.findKey(n,o);if(i)return t[i]=ca(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]=ca(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Qi.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Qi.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[aa]=this[aa]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=sa(e);t[r]||(!function(e,t){const n=Qi.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Qi.isArray(e)?e.forEach(r):r(e),this}}la.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Qi.reduceDescriptors(la.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Qi.freezeMethods(la);const da=la;function fa(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(Qi.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof da&&(e=e.toJSON()),r.push(e),Qi.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);Qi.isUndefined(r)||(t[n]=r)});else{if(!Qi.isPlainObject(e)&&function(e){if(Qi.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Qi.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);Qi.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class ha extends Error{static from(e,t,n,r,o,i){const a=new ha(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&Qi.hasOwnProp(e,"redact")?e.redact:void 0,n=Qi.isArray(t)&&t.length>0?fa(e,t):Qi.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}ha.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ha.ERR_BAD_OPTION="ERR_BAD_OPTION",ha.ECONNABORTED="ECONNABORTED",ha.ETIMEDOUT="ETIMEDOUT",ha.ECONNREFUSED="ECONNREFUSED",ha.ERR_NETWORK="ERR_NETWORK",ha.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ha.ERR_DEPRECATED="ERR_DEPRECATED",ha.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ha.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ha.ERR_CANCELED="ERR_CANCELED",ha.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ha.ERR_INVALID_URL="ERR_INVALID_URL",ha.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const pa=ha;var ya=n(8287).hp;function wa(e){return Qi.isPlainObject(e)||Qi.isArray(e)}function ma(e){return Qi.endsWith(e,"[]")?e.slice(0,-2):e}function ga(e,t,n){return e?e.concat(t).map(function(e,t){return e=ma(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ea=Qi.toFlatObject(Qi,{},null,function(e){return/^is[A-Z]/.test(e)});const Aa=function(e,t,n){if(!Qi.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Qi.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Qi.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&Qi.isSpecCompliantForm(t);if(!Qi.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Qi.isDate(e))return e.toISOString();if(Qi.isBoolean(e))return e.toString();if(!u&&Qi.isBlob(e))throw new pa("Blob is not supported. Use a Buffer instead.");return Qi.isArrayBuffer(e)||Qi.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):ya.from(e):e}function d(e,n,o){let s=e;if(Qi.isReactNative(t)&&Qi.isReactNativeBlob(e))return t.append(ga(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(Qi.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Qi.isArray(e)&&function(e){return Qi.isArray(e)&&!e.some(wa)}(e)||(Qi.isFileList(e)||Qi.endsWith(n,"[]"))&&(s=Qi.toArray(e)))return n=ma(n),s.forEach(function(e,r){!Qi.isUndefined(e)&&null!==e&&t.append(!0===a?ga([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!wa(e)||(t.append(ga(o,n,i),l(e)),!1)}const f=[],h=Object.assign(Ea,{defaultVisitor:d,convertValue:l,isVisitable:wa});if(!Qi.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!Qi.isUndefined(n)){if(i>c)throw new pa("Object is too deeply nested ("+i+" levels). Max depth: "+c,pa.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),Qi.forEach(n,function(n,a){!0===(!(Qi.isUndefined(n)||null===n)&&o.call(t,n,Qi.isString(a)?a.trim():a,r,h))&&e(n,r?r.concat(a):[a],i+1)}),f.pop()}}(e),t};function ba(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function va(e,t){this._pairs=[],e&&Aa(e,this,t)}const Sa=va.prototype;Sa.append=function(e,t){this._pairs.push([e,t])},Sa.toString=function(e){const t=e?function(t){return e.call(this,t,ba)}:ba;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ta=va;function Ra(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Oa(e,t,n){if(!t)return e;const r=n&&n.encode||Ra,o=Qi.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):Qi.isURLSearchParams(t)?t.toString():new Ta(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const _a=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){Qi.forEach(this.handlers,function(t){null!==t&&e(t)})}},Na={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ia={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ta,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ca="undefined"!=typeof window&&"undefined"!=typeof document,ka="object"==typeof navigator&&navigator||void 0,Pa=Ca&&(!ka||["ReactNative","NativeScript","NS"].indexOf(ka.product)<0),La="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,xa=Ca&&window.location.href||"http://localhost",Ua={...e,...Ia};const Da=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&&Qi.isArray(r)?r.length:i,s)return Qi.hasOwnProp(r,i)?r[i]=Qi.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;Qi.hasOwnProp(r,i)&&Qi.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Qi.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 Qi.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Ma=(e,t)=>null!=e&&Qi.hasOwnProp(e,t)?e[t]:void 0;const Ba={transitional:Na,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Qi.isObject(e);o&&Qi.isHTMLForm(e)&&(e=new FormData(e));if(Qi.isFormData(e))return r?JSON.stringify(Da(e)):e;if(Qi.isArrayBuffer(e)||Qi.isBuffer(e)||Qi.isStream(e)||Qi.isFile(e)||Qi.isBlob(e)||Qi.isReadableStream(e))return e;if(Qi.isArrayBufferView(e))return e.buffer;if(Qi.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Ma(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Aa(e,new Ua.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ua.isNode&&Qi.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=Qi.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Ma(this,"env"),r=n&&n.FormData;return Aa(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Qi.isString(e))try{return(t||JSON.parse)(e),Qi.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Ma(this,"transitional")||Ba.transitional,n=t&&t.forcedJSONParsing,r=Ma(this,"responseType"),o="json"===r;if(Qi.isResponse(e)||Qi.isReadableStream(e))return e;if(e&&Qi.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Ma(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw pa.from(e,pa.ERR_BAD_RESPONSE,this,null,Ma(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ua.classes.FormData,Blob:Ua.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Qi.forEach(["delete","get","head","post","put","patch","query"],e=>{Ba.headers[e]={}});const Ha=Ba;function Ga(e,t){const n=this||Ha,r=t||n,o=da.from(r.headers);let i=r.data;return Qi.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ja(e){return!(!e||!e.__CANCEL__)}const Fa=class extends pa{constructor(e,t,n){super(e??"canceled",pa.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ka(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new pa("Request failed with status code "+n.status,n.status>=400&&n.status<500?pa.ERR_BAD_REQUEST:pa.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const Wa=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)]},Ja=(e,t,n=3)=>{let r=0;const o=Wa(50,250);return Xa(n=>{if(!n||"number"!=typeof n.loaded)return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},Va=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ya=e=>(...t)=>Qi.asap(()=>e(...t)),qa=Ua.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ua.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ua.origin),Ua.navigator&&/(msie|trident)/i.test(Ua.navigator.userAgent)):()=>!0,za=Ua.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Qi.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Qi.isString(r)&&s.push(`path=${r}`),Qi.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),Qi.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function $a(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Za=e=>e instanceof da?{...e}:e;function Qa(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return Qi.isPlainObject(e)&&Qi.isPlainObject(t)?Qi.merge.call({caseless:r},e,t):Qi.isPlainObject(t)?Qi.merge({},t):Qi.isArray(t)?t.slice():t}function o(e,t,n,o){return Qi.isUndefined(t)?Qi.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Qi.isUndefined(t))return r(void 0,t)}function a(e,t){return Qi.isUndefined(t)?Qi.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return Qi.hasOwnProp(t,i)?r(n,o):Qi.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(Za(e),Za(t),0,!0)};return Qi.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Qi.hasOwnProp(c,r)?c[r]:o,a=i(Qi.hasOwnProp(e,r)?e[r]:void 0,Qi.hasOwnProp(t,r)?t[r]:void 0,r);Qi.isUndefined(a)&&i!==s||(n[r]=a)}),n}const es=["content-type","content-length"];const ts=e=>{const t=Qa({},e),n=e=>Qi.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var f;if(t.headers=s=da.from(s),t.url=Oa($a(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(f=c.password,encodeURIComponent(f).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),Qi.isFormData(r)&&(Ua.hasStandardBrowserEnv||Ua.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):Qi.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{es.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Ua.hasStandardBrowserEnv){Qi.isFunction(o)&&(o=o(t));if(!0===o||null==o&&qa(t.url)){const e=i&&a&&za.read(a);e&&s.set(i,e)}}return t};n.dn(ts);const ns="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=ts(e);let o=r.data;const i=da.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=da.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());Ka(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:r,config:e,request:y}),y=null}y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout,"onloadend"in y?y.onloadend=w:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&y.responseURL.startsWith("file:"))&&setTimeout(w)},y.onabort=function(){y&&(n(new pa("Request aborted",pa.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new pa(r,pa.ERR_NETWORK,e,y);o.event=t||null,n(o),p(),y=null},y.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Na;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new pa(t,o.clarifyTimeoutError?pa.ETIMEDOUT:pa.ECONNABORTED,e,y)),p(),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&Qi.forEach(ia(i),function(e,t){y.setRequestHeader(t,e)}),Qi.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),d&&"json"!==d&&(y.responseType=r.responseType),h&&([c,l]=Ja(h,!0),y.addEventListener("progress",c)),f&&y.upload&&([s,u]=Ja(f),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{y&&(n(!t||t.type?new Fa(null,e,y):t),y.abort(),p(),y=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const m=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!m||Ua.protocols.includes(m)?y.send(o||null):n(new pa("Unsupported protocol "+m+":",pa.ERR_BAD_REQUEST,e))})},rs=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof pa?t:new Fa(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}=n;return s.unsubscribe=()=>Qi.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 is(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})};var ss=n(8287).hp;const cs="1.16.1",{isFunction:us}=Qi,ls=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ds=e=>{const t=void 0!==Qi.global&&null!==Qi.global?Qi.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Qi.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?us(o):"function"==typeof fetch,c=us(i),u=us(a);if(!s)return!1;const l=s&&us(n),d=s&&("function"==typeof r?(f=new r,e=>f.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var f;const h=c&&l&&ls(()=>{let e=!1;const t=new i(Ua.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),p=u&&l&&ls(()=>Qi.isReadableStream(new a("").body)),y={stream:p&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!y[e]&&(y[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new pa(`Response type '${e}' is not supported`,pa.ERR_NOT_SUPPORT,n)})});const w=async(e,t)=>{const n=Qi.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(Qi.isBlob(e))return e.size;if(Qi.isSpecCompliantForm(e)){const t=new i(Ua.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Qi.isArrayBufferView(e)||Qi.isArrayBuffer(e)?e.byteLength:(Qi.isURLSearchParams(e)&&(e+=""),Qi.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:f,onUploadProgress:m,responseType:g,headers:E,withCredentials:A="same-origin",fetchOptions:b,maxContentLength:v,maxBodyLength:S}=ts(e);const T=Qi.isNumber(v)&&v>-1,R=Qi.isNumber(S)&&S>-1;let O=o||fetch;g=g?(g+"").toLowerCase():"text";let _=rs([u,l&&l.toAbortSignal()],d),N=null;const I=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==ss&&"function"==typeof ss.byteLength)return ss.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>v)throw new pa("maxContentLength size of "+v+" exceeded",pa.ERR_BAD_RESPONSE,e,N)}if(R&&"get"!==n&&"head"!==n){const t=await w(E,s);if("number"==typeof t&&isFinite(t)&&t>S)throw new pa("Request body larger than maxBodyLength limit",pa.ERR_BAD_REQUEST,e,N)}if(m&&h&&"get"!==n&&"head"!==n&&0!==(C=await w(E,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(Qi.isFormData(s)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=Va(C,Ja(Ya(m)));s=as(n.body,65536,e,t)}}Qi.isString(A)||(A=A?"include":"omit");const o=c&&"credentials"in i.prototype;if(Qi.isFormData(s)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/"+cs,!1);const u={...b,signal:_,method:n.toUpperCase(),headers:ia(E.normalize()),body:s,duplex:"half",credentials:o?A:void 0};N=c&&new i(t,u);let l=await(c?O(N,b):O(t,u));if(T){const t=Qi.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>v)throw new pa("maxContentLength size of "+v+" exceeded",pa.ERR_BAD_RESPONSE,e,N)}const d=p&&("stream"===g||"response"===g);if(p&&l.body&&(f||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=Qi.toFiniteNumber(l.headers.get("content-length")),[r,o]=f&&Va(n,Ja(Ya(f),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>v))throw new pa("maxContentLength size of "+v+" exceeded",pa.ERR_BAD_RESPONSE,e,N);r&&r(t)};l=new a(as(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}g=g||"text";let k=await y[Qi.findKey(y,g)||"text"](l,e);if(T&&!p&&!d){let t;if(null!=k&&("number"==typeof k.byteLength?t=k.byteLength:"number"==typeof k.size?t=k.size:"string"==typeof k&&(t="function"==typeof r?(new r).encode(k).byteLength:k.length)),"number"==typeof t&&t>v)throw new pa("maxContentLength size of "+v+" exceeded",pa.ERR_BAD_RESPONSE,e,N)}return!d&&I&&I(),await new Promise((t,n)=>{Ka(t,n,{data:k,headers:da.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:N})})}catch(t){if(I&&I(),_&&_.aborted&&_.reason instanceof pa){const n=_.reason;throw n.config=e,N&&(n.request=N),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new pa("Network Error",pa.ERR_NETWORK,e,N,t&&t.response),{cause:t.cause||t});throw pa.from(t,t&&t.code,e,N,t&&t.response)}}},fs=new Map,hs=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=fs;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:ds(t)),u=s;return s},ps=(hs(),{http:null,xhr:ns,fetch:{get:hs}});Qi.forEach(ps,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const ys=e=>`- ${e}`,ws=e=>Qi.isFunction(e)||null===e||!1===e;const ms={getAdapter:function(e,t){e=Qi.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(ys).join("\n"):" "+ys(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:ps};function gs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Fa(null,e)}function Es(e){gs(e),e.headers=da.from(e.headers),e.data=Ga.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ms.getAdapter(e.adapter||Ha.adapter,e)(e).then(function(t){gs(e),e.response=t;try{t.data=Ga.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=da.from(t.headers),t},function(t){if(!ja(t)&&(gs(e),t&&t.response)){e.response=t.response;try{t.response.data=Ga.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=da.from(t.response.headers)}return Promise.reject(t)})}const As={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{As[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const bs={};As.transitional=function(e,t,n){function r(e,t){return"[Axios v"+cs+"] 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&&!bs[o]&&(bs[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)}},As.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const vs={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=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new 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:As},Ss=vs.validators;class Ts{constructor(e){this.defaults=e||{},this.interceptors={request:new _a,response:new _a}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Qa(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&vs.assertOptions(n,{silentJSONParsing:Ss.transitional(Ss.boolean),forcedJSONParsing:Ss.transitional(Ss.boolean),clarifyTimeoutError:Ss.transitional(Ss.boolean),legacyInterceptorReqResOrdering:Ss.transitional(Ss.boolean)},!1),null!=r&&(Qi.isFunction(r)?t.paramsSerializer={serialize:r}:vs.assertOptions(r,{encode:Ss.function,serialize:Ss.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),vs.assertOptions(t,{baseUrl:Ss.spelling("baseURL"),withXsrfToken:Ss.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Qi.merge(o.common,o[t.method]);o&&Qi.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=da.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||Na;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=[Es.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 Fa(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 Os(function(t){e=t});return{token:t,cancel:e}}}const _s=Os;const Ns={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(Ns).forEach(([e,t])=>{Ns[t]=e});const Is=Ns;const Cs=function e(t){const n=new Rs(t),r=si(Rs.prototype.request,n);return Qi.extend(r,Rs.prototype,n,{allOwnKeys:!0}),Qi.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Qa(t,n))},r}(Ha);Cs.Axios=Rs,Cs.CanceledError=Fa,Cs.CancelToken=_s,Cs.isCancel=ja,Cs.VERSION=cs,Cs.toFormData=Aa,Cs.AxiosError=pa,Cs.Cancel=Cs.CanceledError,Cs.all=function(e){return Promise.all(e)},Cs.spread=function(e){return function(t){return e.apply(null,t)}},Cs.isAxiosError=function(e){return Qi.isObject(e)&&!0===e.isAxiosError},Cs.mergeConfig=Qa,Cs.AxiosHeaders=da,Cs.formToJSON=e=>Da(Qi.isHTMLForm(e)?new FormData(e):e),Cs.getAdapter=ms.getAdapter,Cs.HttpStatusCode=Is,Cs.default=Cs;const ks=Cs;var Ps,Ls,xs=function(){try{var e=localStorage.getItem(Uo);return"string"==typeof e?e:"{}"}catch(e){s("Unable to get session from local storage: ",e)}return"{}"},Us=function(e){try{s("Setting local storage session",e),localStorage.setItem(Uo,e)}catch(e){s("Unable to save session from local storage: ",e)}},Ds=function(e){try{Vo(xo,e,{path:"/",domain:Jo(),expires:365,secure:!0})}catch(e){s("Unable to save session to cookie storage: ",e)}},Ms=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.A.sessionServer,n="".concat(t,"/api/session"),s("Checking server session: ",n),e.next=1,ks.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return f=r.data.entitlementTokenDecoded,h=r.data,p=h.accessToken,y=h.idToken,w=h.entitlementToken,m=null!==(i=null==f?void 0:f.entitlement_expiry)&&void 0!==i?i:null,g=null!==(c=null==f?void 0:f.entitlement_source)&&void 0!==c?c:null,E=null!==(u=null==f?void 0:f.entitlement_entitled)&&void 0!==u?u:null,A=null!==(l=null==f?void 0:f.entitlement_extras_adfree)&&void 0!==l?l:null,b=null!==(d=null==f?void 0:f.entitlement_level)&&void 0!==d?d:null,Us(JSON.stringify({accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:g,isEntitled:E,adFree:A,entitlementLevel:b})),""!==w&&"string"==typeof w&&Ds(w),e.abrupt("return",{accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:g,isEntitled:E,adFree:A,entitlementLevel:b});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Bs=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,ks.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)}}(),Hs=function(){var e=r(o.mark(function e(){var t,n,r,i,a,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S,T,R,O,_,N,I,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Inside getSession"),e.prev=1,d=xs(),s("Session: __MNG_Session = ",d),f=JSON.parse(d),h=f.accessToken,p=f.idToken,y=f.entitlementToken,w=f.expiration,m=f.entitlementSource,g=f.isEntitled,E=f.adFree,A=f.entitlementLevel,n=h,i=w,a=m,c=g,u=E,l=A,s("Session: check both tokens: ",t=p,r=y),void 0!==p&&void 0!==y&&null!==p&&null!==y){e.next=3;break}return s("Session: missing id or entitlements, try session server"),e.next=2,Ms();case 2:b=e.sent,v=b.accessToken,S=b.idToken,T=b.entitlementToken,R=b.expiration,O=b.entitlementSource,_=b.isEntitled,N=b.adFree,I=b.entitlementLevel,n=v,t=S,r=T,i=R,a=O,c=_,u=N,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)}}(),Gs=function(){var e=r(o.mark(function e(t){var n,r,i,a,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S,T,R,O,_,N,I,C,k,P;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=xs(),r=JSON.parse(n),i=r.accessToken,a=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,f=r.expiration,h=void 0===f?null:f,p=r.entitlementSource,y=void 0===p?null:p,w=r.isEntitled,m=void 0===w?null:w,g=r.adFree,E=void 0===g?null:g,A=r.entitlementLevel,b=void 0===A?null:A,v=t.accessToken,S=t.idToken,T=t.entitlementToken,R=t.expiration,O=t.entitlementSource,_=t.isEntitled,N=t.adFree,I=t.entitlementLevel,C={accessToken:v??a,idToken:S??u,entitlementToken:T??d,expiration:R??h,entitlementSource:O??y,isEntitled:_??m,adFree:N??E,entitlementLevel:I??b},s("Current session data: ",r),s("New session data: ",t),s("Updated session data:",C),k=JSON.stringify(C),Us(k),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&Ds(C.entitlementToken),n===k){e.next=1;break}return e.next=1,Bs(C);case 1:e.next=3;break;case 2:e.prev=2,P=e.catch(0),s("Unable to save session: ",P);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),js="1"===window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){Ps||(Ps=e,Ls&&(s("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",Ls),window.dispatchEvent(Ls)))});var Fs=function(){var e=window.localStorage.getItem(Uo);return JSON.parse(e)},Ks=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,Hs();case 1:return t=e.sent,e.abrupt("return",t);case 2:return n=Fs(),e.abrupt("return",n);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ws=function(e){Vo(xo,e,{path:"/",domain:Jo(),expires:365,secure:!0})},Xs=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,Ws(t),s("About to decode token before saving: ",t),n=zo(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,Gs({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(Uo,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)}}(),Js=function(){var e=r(o.mark(function e(t){var n,r,i,u,l,d,f,h,p,y,w,m,g,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,Hs();case 1:"string"==typeof(r=e.sent).idToken&&""!==r.idToken&&(i=zo(r.idToken),n=void 0!==i&&i.email_verified),e.next=4;break;case 2:return e.next=3,ti();case 3:u=e.sent,(l=u.idToken)&&""!==l&&(n=zo(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,Xs(p);case 12:return e.abrupt("return",p);case 13:if(e.prev=13,g=e.catch(6),c("Entitlements: Create Token Failure: ",g),ri(),!window.authentication_config.sessionManagementEnabled){e.next=17;break}return e.prev=14,e.next=15,Gs({entitlementToken:null});case 15:e.next=17;break;case 16:e.prev=16,E=e.catch(14),c("Entitlements: Save Session Failure during error handling: ",E);case 17:throw new Error("Entitlements Refresh failure");case 18:case"end":return e.stop()}},e,null,[[6,13],[14,16]])}));return function(t){return e.apply(this,arguments)}}(),Vs=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=Xo(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,Xs(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,y=e.catch(3),s("Entitlements: Create Token Failure: ",y),ri(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,Gs({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)}}(),Ys=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,Ks();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",Js(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)}}(),qs=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=Wo(xo)){e.next=1;break}return e.abrupt("return",!1);case 1:return s("checkCookiesForToken, Refreshing token, ".concat(t)),e.next=2,Js(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)}}(),zs=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=zo(e);!function(e){var t=Wo("mng-jwt-decoded");t&&t===e||Vo("mng-jwt-decoded",JSON.stringify(e),{path:"/",domain:Jo(),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"),ii("entitlementsReady"),Ls=new CustomEvent("mng-entitlement-check-complete",{detail:t}),Ps?(s("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",r),window.dispatchEvent(Ls)):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)}},$s=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,Vs({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)}}(),Zs=function(){void 0!==window.MNGAuthentication&&Array.isArray(window.MNGAuthentication.oidcLoginCallbacks)&&window.MNGAuthentication.oidcLoginCallbacks.push($s)},Qs=function(e){var t=e.searchParams.get("entitlement_jwt");s("Webview JWT param provided: ",t),Ws(t);var n=zo(t);window.localStorage.setItem(Uo,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}))},ec=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(b.length>0&&void 0!==b[0]?b[0]:{}).forceRecheck,n=void 0!==t&&t,e.prev=1,r=window.localStorage.getItem(Do),i=Wo(Lo),c=Ko(),u=qo(),l=Wo("clearEntCache"),!(n||l||c.searchParams.has("newUser"))){e.next=7;break}return d="".concat(a.A.entitlementsEndpoint,"session/create"),e.next=2,ti();case 2:return f=e.sent,h={uuid:f.claims.auth0Id,publication:u},e.prev=3,e.next=4,$.ajax({type:"DELETE",url:d,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(h)});case 4:e.sent&&(s("loggedOutNewSubscriberActions","Entitlements: Cache cleared"),Yo("clearEntCache")),e.next=6;break;case 5:e.prev=5,E=e.catch(3),s("loggedOutNewSubscriberActions","Entitlements: Cache clear Failure - ".concat(E.message));case 6:e.next=8;break;case 7:s("loggedOutNewSubscriberActions","There is no clearEntCache cookie");case 8:if(s("loggedOutNewSubscriberActions","Checking if this is a new regwall subscriber"),!(n||l||"false"===r&&c.searchParams.has("newUser")&&i)){e.next=11;break}return p=!1,y={sub:i,email_verified:!0},e.next=9,Vs(y);case 9:if((w=e.sent)&&""!==w&&(m=zo(w),g=m.entitlement_entitled,p=g),s("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(p)),!p){e.next=10;break}return window.localStorage.setItem(Do,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 10:case 11:return e.abrupt("return",!1);case 12:return e.prev=12,A=e.catch(1),s("loggedOutNewSubscriberActions error",A),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,null,[[1,12],[3,5]])}));return function(){return e.apply(this,arguments)}}();js||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(Uo));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(Uo));return null!=e&&(s("Subscriber Check: : ",e.isEntitled),e.isEntitled)});var tc=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!js){e.next=1;break}return s("Embed login is enabled, skipping entitlements.js init"),e.abrupt("return",!1);case 1:if(!a.A.entitlementsEnabled){e.next=40;break}return e.next=2,ec();case 2:if(!e.sent){e.next=3;break}return e.abrupt("return",zs(!1));case 3:return t=window.location,n=new URL(t.href),e.next=4,ti();case 4:if(r=e.sent,i=r.idToken,c=r.accessToken,u=r.isAuthenticated,l=r.claims,Zs(),e.prev=5,!n.searchParams.has("newUser")){e.next=9;break}if("string"!=typeof i||""===i){e.next=8;break}return e.next=6,Vs({idToken:i});case 6:if(!(d=e.sent)){e.next=7;break}return s("Entitlements Init: Created new token for new subscriber"),e.abrupt("return",zs(d));case 7:e.next=9;break;case 8:s("New subscription, no idToken.");case 9:e.next=11;break;case 10:e.prev=10,e.catch(5),s("Not a new subscriber.");case 11:try{n.searchParams.has("entitlement_jwt")&&Qs(n)}catch(e){s("Error during webview JWT retrieval: ",e)}return e.prev=12,e.next=13,Ys();case 13:if(!((f=e.sent)instanceof Error)){e.next=14;break}throw f;case 14:f&&(d=f,s("Entitlements Init: Local Storage Token exists")),e.next=16;break;case 15:e.prev=15,E=e.catch(12),s("Error during Local Storage Token check: ",E);case 16:if(e.prev=16,d){e.next=19;break}return e.next=17,qs();case 17:if(!((h=e.sent)instanceof Error)){e.next=18;break}throw h;case 18:h&&(d=h,s("Entitlements Init: Cookie Token exists"));case 19:e.next=21;break;case 20:e.prev=20,A=e.catch(16),s("Error during Cookie Token check: ",A);case 21:if(!u&&d&&(s("Entitled-only flow: User is not authenticated but entitlement token exists."),zo(d).entitlement_entitled?(s("PageSuite flow: User is not authenticated but is subscriber. Access token is ".concat(c)),c?MNGAuthentication.login():s("PageSuite flow: No Access token.")):s("Entitled-only flow: User is not entitled.")),u){e.next=22;break}return s("User is not logged in, skipping entitlement flow."),e.abrupt("return",zs(!1));case 22:if(!a.A.bcLowaSegements||u!==a.A.USER_IS_LOWA||d){e.next=26;break}return e.prev=23,s("About to check entitlements based on BC"),p={sub:l.sub},e.next=24,Vs(p);case 24:d=e.sent,!window.authentication_config.sessionManagementEnabled&&a.A.serverEntitlements&&d&&(s("Entitlements fetched, about to reload to refresh entitlement cookie for server."),window.location.reload()),e.next=26;break;case 25:e.prev=25,b=e.catch(23),s("BC sub segment check failed: ",b);case 26:if(e.prev=26,!d){e.next=32;break}if(!a.A.linaCheckOnArticles){e.next=31;break}if(y=zo(d),w=y.entitlement_entitled,m=y.iat,s("LINA check: isEntitled: ".concat(w,", token created at: ").concat(m)),!(a.A.linaCheckOnArticles&&!w&&Date.now()/1e3-new Date(m)>45)){e.next=31;break}if(s("Checking entitlements again for LINA user."),""===i){e.next=30;break}return e.next=27,Vs({idToken:i});case 27:if(!(g=e.sent)){e.next=29;break}return s("Entitlements Init: Created new token for LINA user"),e.next=28,ei();case 28:return"article"===e.sent&&window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",zs(g));case 29:e.next=31;break;case 30:s("LINA check, no idToken.");case 31:return e.abrupt("return",zs(d));case 32:e.next=34;break;case 33:e.prev=33,v=e.catch(26),s("LINA check error: ",v);case 34:if(e.prev=34,"string"!=typeof i||""===i){e.next=37;break}return e.next=35,Vs({idToken:i});case 35:if(!(d=e.sent)){e.next=36;break}return s("Entitlements Init: Created new token"),e.abrupt("return",zs(d));case 36:e.next=38;break;case 37:s("No OIDC ID Token. Not creating a new entitlements token.");case 38:e.next=40;break;case 39:e.prev=39,S=e.catch(34),s("Unable to create token during initialize: ",S);case 40:return e.abrupt("return",zs(!1));case 41:case"end":return e.stop()}},e,null,[[5,10],[12,15],[16,20],[23,25],[26,33],[34,39]])}));return function(){return e.apply(this,arguments)}}();const nc={init:tc};(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,nc.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.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(z(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(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(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||Y(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)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return I(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),Y(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(z(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 A(this,e,t,n);case"ascii":case"latin1":case"binary":return E(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 O(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function M(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 D(e,t,n,r,i){return t=+t,n>>>=0,i||M(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||M(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){x(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){x(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);x(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);x(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function W(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function K(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new H.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),j("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),j("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=G(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=G(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(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)}},467(e,t,n){"use strict";function r(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 o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)})}}n.d(t,{A:()=>o})},3029(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>r})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(9922);function o(e,t){for(var n=0;no});var r=n(9922);function o(e,t,n){return(t=(0,r.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},2327(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(2284);function o(e,t){if("object"!=(0,r.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=(0,r.A)(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}},9922(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(2284),o=n(2327);function i(e){var t=(0,o.A)(e,"string");return"symbol"==(0,r.A)(t)?t:t+""}},2284(e,t,n){"use strict";function r(e){return r="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},r(e)}n.d(t,{A:()=>r})},1834(e,t,n){"use strict";n.d(t,{A:()=>l});var r=n(467),o=n(3029),i=n(2901),a=n(4467),s=n(4756),c=n(3153);window.disableAuth0AuthFlow=!0;var u=function(){function e(){var t,n;(0,o.A)(this,e),(0,a.A)(this,"readyInstances",new Map),(0,a.A)(this,"connextAlreadyRan",!1),(0,a.A)(this,"eventListeners",{}),(0,a.A)(this,"runConnextIfSilentTimer",void 0),(0,a.A)(this,"runningSophi","1"===(null===(t=window.authentication_config)||void 0===t?void 0:t.sophiSDKEnabled)||"1"===(null===(n=window.authentication_config)||void 0===n?void 0:n.sophiOnDevice))}return(0,i.A)(e,[{key:"init",value:function(){this.setupRunTimer()}},{key:"setupRunTimer",value:function(){var t=this;this.runConnextIfSilentTimer=setTimeout((0,r.A)(s.mark(function n(){return s.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=1,t.connextReady("onInit",1e3*e.defaultTimeoutLength);case 1:n.sent&&(c.A.log("".concat(e.defaultTimeoutLength," second Connext timer is up.")),t.rerunConnextEntitlements());case 2:case"end":return n.stop()}},n)})),1e3*e.defaultTimeoutLength)}},{key:"connextReady",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"onInit",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,o=this.readyInstances.get(n);if(o)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(o.status,".")),"pending"===o.status&&r0&&void 0!==o[0]&&o[0],r=o.length>1&&void 0!==o[1]&&!o[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",r);case 1:if(t.sent){t.next=2;break}return t.abrupt("return");case 2:if(Connext&&!this.connextAlreadyRan){t.next=3;break}return t.abrupt("return");case 3:n&&Connext.GetOptions().Silentmode?this.runConnext():n?c.A.log("Not rerunning Connext"):this.runConnext();case 4:case"end":return t.stop()}},t,this)})),function(){return n.apply(this,arguments)})},{key:"runConnextIfSilent",value:(t=(0,r.A)(s.mark(function t(){var n;return s.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.connextReady("onInit",1e3*e.backupTimeoutLength);case 1:if(n=t.sent,!this.runningSophi&&!this.connextAlreadyRan){t.next=2;break}return t.abrupt("return");case 2:n&&"undefined"!=typeof Connext&&Connext.GetOptions().Silentmode&&(c.A.log("Silent mode, running Connext now."),this.rerunConnextEntitlements());case 3:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})},{key:"removeEventListener",value:function(e){this.eventListeners[e]?(document.removeEventListener(e,this.eventListeners[e]),delete this.eventListeners[e],c.A.log('Connext removed event listener for "'.concat(e,'".'))):c.A.log('No event listener to remove for "'.concat(e,'".'))}}]);var t,n}();(0,a.A)(u,"defaultTimeoutLength",300),(0,a.A)(u,"backupTimeoutLength",1e5),(0,a.A)(u,"subTimeoutInterval",5e3),window.ConnextUtils=window.ConnextUtils||new u;const l=u},3153(e,t,n){"use strict";n.d(t,{A:()=>o});var r=n(3612);const o={log:function(){if(r.A.debug){for(var e,t=arguments.length,n=new Array(t),o=0;oc}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>Ws,hasStandardBrowserEnv:()=>Fs,hasStandardBrowserWebWorkerEnv:()=>Xs,navigator:()=>Ks,origin:()=>Js});var t=n(467),r=n(4756),o=n(3153),i=n(3612),a=n(4467),s=n(2284);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);oe.length)&&(t=e.length);for(var n=0,r=Array(t);nDate.now(),x="default";class P extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,P.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new P(t,n)}}class U extends P{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,U.prototype)}}class M extends P{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,M.prototype)}}class D extends P{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,D.prototype)}}class B extends D{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,B.prototype)}}class H extends P{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,H.prototype)}}class j extends P{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,j.prototype)}}class G extends P{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,G.prototype)}}class W extends P{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(X(e,["default"]),"', scope: '").concat(X(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,W.prototype)}}class K extends P{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(X(e,["default"]),"', missing scope: '").concat(X(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,K.prototype)}}class F extends P{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,F.prototype)}}function X(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const J=()=>window.crypto,Z=()=>{let e="";for(;e.length<43;){const t=J().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},V=e=>btoa(e),z=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],Y=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=z.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},q=e=>{var t=e.clientId,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()},Q=async e=>{const t=J().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},ee=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),te=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 ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},re={},oe={};Object.defineProperty(oe,"__esModule",{value:!0});var ie=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}();oe.default=function(){return ie.getInstance()};var ae=ne&&ne.__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())})},se=ne&&ne.__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 ae(this,void 0,void 0,function(){return se(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 ae(this,void 0,void 0,function(){var n,r,o,i;return se(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?de:this.storageHandler,r=le+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,ue.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),ue.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 D;throw e}}}class ye{constructor(){this.activeLocks=new Set,this.lock=new me,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 D;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 we=null;const be=new TextEncoder,ve=new TextDecoder;function Ae(e){return"string"==typeof e?be.encode(e):ve.decode(e)}function Ee(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new _e(`${e.name} modulusLength must be at least 2048 bits`)}let Se;if(Uint8Array.prototype.toBase64)Se=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Se=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),Ue=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},Me=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:I;return o?(async(e,t,n,r,o,i,a,s,c)=>Pe({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s,skipTokenStorage:c},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0):(async(e,t,n)=>{const r=await Ue(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let n=_(t,2),r=n[0],o=n[1];return e[r]=o,e},{}))};var o})(e,r,a)};async function De(e,t,n,r,o,i,a,s,c,u,l){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 d,h=null;for(let c=0;c<3;c++)try{d=await Me(e,n,r,o,i,a,t,s,l),h=null;break}catch(e){h=e}if(h)throw h;const f=d.json,m=f.error,g=f.error_description,y=p(f,["error","error_description"]),w=d,b=w.headers,v=w.ok;let A;if(c&&(A=b[Le],A&&await c.setNonce(A)),!v){const d=g||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===m)throw new G(m,d,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===m)throw new W(n,r);if("use_dpop_nonce"===m){if(!c||!A||u)throw new F(A);return De(e,t,n,r,o,i,a,s,c,!0,l)}throw new P(m||"request_error",d)}return y}async function Be(e,t,n){var r=e.baseUrl,o=e.timeout,i=e.audience,a=e.scope,s=e.auth0Client,c=e.useFormData,u=e.useMrrt,l=e.dpop,d=p(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const h="urn:ietf:params:oauth:grant-type:token-exchange"===d.grant_type,f="refresh_token"===d.grant_type&&u,m=Object.assign(Object.assign(Object.assign(Object.assign({},d),h&&i&&{audience:i}),h&&a&&{scope:a}),f&&{audience:i,scope:a}),g=c?q(m):JSON.stringify(m),y=(w=d.grant_type,xe.includes(w));var w;return await De("".concat(r,"/oauth/token"),o,i||x,a,{method:"POST",body:g,headers:{"Content-Type":c?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(Y(s||N)))}},t,c,u,y?l:void 0,void 0,n)}const He=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[x]),He(r,t)},Ge="@@auth0spajs@@",We="@@user@@";class Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ge,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=_(e.split("::"),4),n=t[0],r=t[1],o=t[2],i=t[3];return new Ke({clientId:r,scope:i,audience:o},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,r=e.client_id;return new Ke({scope:t,audience:n,clientId:r})}}class Fe{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(Ge))}}class Xe{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class Je{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||L}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=Ke.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/1e3);return i.expiresAt-t!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Ke({clientId:e},Ge,We).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Ke.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===Ge&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Ke.fromKey(r);if(t.prefix===Ge&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=Ke.fromKey(i);if(r.prefix===Ge&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class Ze{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 Ve=e=>"number"==typeof e,ze=["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 Ye=ne&&ne.__assign||function(){return Ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;nnt.get(e)||nt.get("".concat(rt).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),et("".concat(rt).concat(e),JSON.stringify(t),r),nt.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),tt(e,n),nt.remove(e,t),nt.remove("".concat(rt).concat(e),t)}},it={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 at;!function(e){e.Code="code",e.ConnectCode="connect_code"}(at||(at={}));var st,ct=function(e){return st=st||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 Xe).enclosedCache,localstorage:()=>new Fe},pt=e=>ht[e],ft=e=>{const t=e.openUrl,n=e.onRedirect,r=p(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},mt=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},gt={NONCE:"nonce",KEYPAIR:"keypair"};class yt{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(gt).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(gt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(gt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(gt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(gt.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());await Promise.all((null==n?void 0: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(gt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(gt.KEYPAIR,this.clientId)}}class wt{constructor(e){this.storage=new yt(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 t=e.keyPair,n=e.url,r=e.method,o=e.nonce,i=e.accessToken;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return Ce(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!Ie(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 Ne(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 ke("unsupported JWK kty")}return Te(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 bt;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(bt||(bt={}));class vt{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]:bt.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?bt.DPoP:bt.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===bt.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,Le);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new F(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class At{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Et({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Et(t)}}class Et extends Error{constructor(e){let t=e.type,n=e.status,r=e.title,o=e.detail,i=e.validation_errors;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,Et.prototype)}}const St={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var Tt,kt;let _t;if("undefined"==typeof navigator||null===(Tt=navigator.userAgent)||void 0===Tt||null===(kt=Tt.startsWith)||void 0===kt||!kt.call(Tt,"Mozilla/5.0 ")){const e="v3.8.6";_t="".concat("oauth4webapi","/").concat(e)}function Rt(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Ot="ERR_INVALID_ARG_VALUE",It="ERR_INVALID_ARG_TYPE";function Ct(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const Nt=Symbol(),Lt=Symbol(),xt=Symbol(),Pt=Symbol(),Ut=Symbol(),Mt=Symbol(),Dt=new TextEncoder,Bt=new TextDecoder;function Ht(e){return"string"==typeof e?Dt.encode(e):Bt.decode(e)}let jt,Gt;if(Uint8Array.prototype.toBase64)jt=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;jt=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 Ct("The input to be decoded is not correctly encoded.",Ot,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 Ct("".concat(n," must be a non-negative number"),Ot,o);return}throw Ct("".concat(n," must be a positive number"),Ot,o)}catch(e){if(r)throw Xt(e.message,r,o);throw e}}function qt(e,t,n,r){try{if("string"!=typeof e)throw Ct("".concat(t," must be a string"),It,r);if(0===e.length)throw Ct("".concat(t," must not be empty"),Ot,r)}catch(e){if(n)throw Xt(e.message,n,r);throw e}}function Qt(e){!function(e,t){if(kn(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,Jn,e)}(e,t)}(e,"application/json")}function $t(){return Wt(crypto.getRandomValues(new Uint8Array(32)))}function en(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Kt("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}}function tn(e){const t=null==e?void 0:e[Lt];return"number"==typeof t&&Number.isFinite(t)?t:0}function nn(e){const t=null==e?void 0:e[xt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function rn(){return Math.floor(Date.now()/1e3)}function on(e){if("object"!=typeof e||null===e)throw Ct('"as" must be an object',It);qt(e.issuer,'"as.issuer"')}function an(e){if("object"!=typeof e||null===e)throw Ct('"client" must be an object',It);qt(e.client_id,'"client.client_id"')}function sn(e){return qt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function cn(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&qt(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Ct("".concat(t," must be a CryptoKey"),It)}(e,t),"private"!==e.type)throw Ct("".concat(t," must be a private CryptoKey"),Ot)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:en(r),kid:o},u=function(e,t){const n=rn()+tn(t);return{jti:$t(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===(s=t[Ut])||void 0===s||s.call(t,c,u),i.set("client_id",n.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 Ct('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Ot);const r="".concat(Wt(Ht(JSON.stringify(e))),".").concat(Wt(Ht(JSON.stringify(t)))),o=Wt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:rr(e)};case"RSA-PSS":switch(nr(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Kt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return nr(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Ht(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const un=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function ln(e,t){if(t&&"https:"!==e.protocol)throw Xt("only requests to HTTPS are allowed",Vn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Xt("only HTTP and HTTPS requests are allowed",zn,e)}function dn(e,t,n,r){let o;if("string"!=typeof e||!(o=un(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?$n:er,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return ln(o,r),o}function hn(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?dn(e.mtls_endpoint_aliases[t],t,n,r):dn(e[t],t,n,r)}class pn extends Error{constructor(e,t){var n;super(e,t),E(this,"cause",void 0),E(this,"code",void 0),E(this,"error",void 0),E(this,"status",void 0),E(this,"error_description",void 0),E(this,"response",void 0),this.name=this.constructor.name,this.code=Gn,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 fn extends Error{constructor(e,t){var n,r;super(e,t),E(this,"cause",void 0),E(this,"code",void 0),E(this,"error",void 0),E(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 mn extends Error{constructor(e,t){var n;super(e,t),E(this,"cause",void 0),E(this,"code",void 0),E(this,"response",void 0),E(this,"status",void 0),this.name=this.constructor.name,this.code=jn,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 gn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",yn="("+gn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',wn="("+gn+")\\s*=\\s*("+gn+")",bn=new RegExp("^[,\\s]*("+gn+")"),vn=new RegExp("^[,\\s]*"+yn+"[,\\s]*(.*)"),An=new RegExp("^[,\\s]*"+wn+"[,\\s]*(.*)"),En=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Sn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!Rt(e,Response))throw Ct('"response" must be an instance of Response',It);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(bn);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let p;if(d)for(;r;){let n,o;if(t=r.match(vn)){var i=_(t,4);if(n=i[1],o=i[2],r=i[3],o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}h[n.toLowerCase()]=o}else{if(!(t=r.match(An))){if(t=r.match(En)){if(Object.keys(h).length)break;var a=_(t,3);p=a[1],r=a[2];break}return}var s=_(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new mn("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){tr(e),Qt(e);try{const t=await e.clone().json();if(Jt(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 pn("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)"),Zn,e)}}function Tn(e){if(!Pn.has(e))throw Ct('"options.DPoP" is not a valid DPoPHandle',Ot)}function kn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function _n(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[Pt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Vt(r,null==a?void 0:a.signal)})}async function Rn(e,t,n,r,o,i){var a;const s=hn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Nt]));o.set("grant_type",r);const c=Zt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Tn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await _n(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const On=new WeakMap,In=new WeakMap;function Cn(e){if(!e.id_token)return;const t=On.get(e);if(!t)throw Ct('"ref" was already garbage collected or did not resolve from the proper sources',Ot);return t}async function Nn(e,t,n,r,o,i){if(on(e),an(t),!Rt(n,Response))throw Ct('"response" must be an instance of Response',It);await Sn(n,200,"Token Endpoint"),tr(n);const a=await cr(n);if(qt(a.access_token,'"response" body "access_token" property',Xn,{body:a}),qt(a.token_type,'"response" body "token_type" property',Xn,{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;Yt(e,!0,'"response" body "expires_in" property',Xn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&qt(a.refresh_token,'"response" body "refresh_token" property',Xn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Xt('"response" body "scope" property must be a string',Xn,{body:a});if(void 0!==a.id_token){qt(a.id_token,'"response" body "id_token" property',Xn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Yt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await async function(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new Kt("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw Xt("Invalid JWT",Xn,e);try{i=JSON.parse(Ht(Wt(c)))}catch(e){throw Xt("failed to parse JWT Header body as base64url encoded JSON",Fn,e)}if(!Jt(i))throw Xt("JWT Header must be a top level object",Xn,e);if(t(i),void 0!==i.crit)throw new Kt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Ht(Wt(u)))}catch(e){throw Xt("failed to parse JWT Payload body as base64url encoded JSON",Fn,e)}if(!Jt(a))throw Xt("JWT Payload must be a top level object",Xn,e);const h=rn()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Xt('unexpected JWT "exp" (expiration time) claim type',Xn,{claims:a});if(a.exp<=h-r)throw Xt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Yn,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Xt('unexpected JWT "iat" (issued at) claim type',Xn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Xt('unexpected JWT "iss" (issuer) claim type',Xn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Xt('unexpected JWT "nbf" (not before) claim type',Xn,{claims:a});if(a.nbf>h+r)throw Xt('unexpected JWT "nbf" (not before) claim value',Yn,{claims:a,now:h,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',Xn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,or.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),tn(t),nn(t),o).then(Dn.bind(void 0,i)).then(xn.bind(void 0,e)).then(Ln.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw Xt('ID Token "aud" (audience) claim includes additional untrusted audiences',qn,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw Xt('unexpected ID Token "azp" (authorized party) claim value',qn,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&Yt(c.auth_time,!0,'ID Token "auth_time" (authentication time)',Xn,{claims:c}),In.set(n,u),On.set(a,c)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Kt("unsupported `token_type` value",{cause:{body:a}});return a}function Ln(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Xt('unexpected JWT "aud" (audience) claim value',qn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Xt('unexpected JWT "aud" (audience) claim value',qn,{expected:e,claims:t.claims,claim:"aud"});return t}function xn(e,t){var n,r;const o=null!==(n=null===(r=e[lr])||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',qn,{expected:o,claims:t.claims,claim:"iss"});return t}const Pn=new WeakSet,Un=Symbol(),Mn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Dn(e,t){for(const n of e)if(void 0===t.claims[n])throw Xt('JWT "'.concat(n,'" (').concat(Mn[n],") claim missing"),Xn,{claims:t.claims});return t}const Bn=Symbol(),Hn=Symbol();const jn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Gn="OAUTH_RESPONSE_BODY_ERROR",Wn="OAUTH_UNSUPPORTED_OPERATION",Kn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Fn="OAUTH_PARSE_ERROR",Xn="OAUTH_INVALID_RESPONSE",Jn="OAUTH_RESPONSE_IS_NOT_JSON",Zn="OAUTH_RESPONSE_IS_NOT_CONFORM",Vn="OAUTH_HTTP_REQUEST_FORBIDDEN",zn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Yn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",qn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Qn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",$n="OAUTH_MISSING_SERVER_METADATA",er="OAUTH_INVALID_SERVER_METADATA";function tr(e){if(e.bodyUsed)throw Ct('"response" body has been used already',Ot)}function nr(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Kt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function rr(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Kt("unsupported ECDSA namedCurve",{cause:e})}}function or(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Xt('unexpected JWT "alg" header parameter',Xn,{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',Xn,{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',Xn,{header:r,expected:e,reason:"client configuration"})}function ir(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw Xt('"'.concat(t,'" parameter must be provided only once'),Xn);return r}const ar=Symbol(),sr=Symbol();async function cr(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qt;try{t=await e.json()}catch(t){throw n(e),Xt('failed to parse "response" body as JSON',Fn,t)}if(!Jt(t))throw Xt('"response" body must be a top level object',Xn,{body:t});return t}const ur=Symbol(),lr=Symbol(),dr=new TextEncoder,hr=new TextDecoder;function pr(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 fr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},yr=(e,t)=>e.name===t;function wr(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw gr("SHA-".concat(t),"algorithm.hash")}function br(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 vr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),E(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),E(this,"claim",void 0),E(this,"reason",void 0),E(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}E(Er,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Sr extends Ar{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}}),E(this,"code","ERR_JWT_EXPIRED"),E(this,"claim",void 0),E(this,"reason",void 0),E(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}E(Sr,"code","ERR_JWT_EXPIRED");class Tr extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}E(Tr,"code","ERR_JOSE_ALG_NOT_ALLOWED");class kr extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JOSE_NOT_SUPPORTED")}}E(kr,"code","ERR_JOSE_NOT_SUPPORTED"),E(class extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),E(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),E(class extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class _r extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JWS_INVALID")}}E(_r,"code","ERR_JWS_INVALID");class Rr extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JWT_INVALID")}}E(Rr,"code","ERR_JWT_INVALID"),E(class extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Or extends Ar{constructor(){super(...arguments),E(this,"code","ERR_JWKS_INVALID")}}E(Or,"code","ERR_JWKS_INVALID");class Ir extends Ar{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),E(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}E(Ir,"code","ERR_JWKS_NO_MATCHING_KEY");class Cr extends Ar{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),E(this,Symbol.asyncIterator,void 0),E(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}E(Cr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Nr extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),E(this,"code","ERR_JWKS_TIMEOUT")}}E(Nr,"code","ERR_JWKS_TIMEOUT");class Lr extends Ar{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),E(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}E(Lr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const xr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Pr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Ur=e=>xr(e)||Pr(e);function Mr(e,t,n){try{return mr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Dr(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=>Dr(e)&&"string"==typeof e.kty;async function Hr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Kr||(Kr=new WeakMap);let o=Kr.get(e);if(null!=o&&o[n])return o[n];const i=await Gr(T(T({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Kr.set(e,{[n]:i}),i};const Xr=(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)},Vr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},zr=(e,t,n)=>{var r;const o=(e=>fr(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){Zr(e,48,"Invalid PKCS#8 structure"),Jr(e),Zr(e,2,"Expected version field");const t=Jr(e);e.pos+=t,Zr(e,48,"Expected algorithm identifier");Jr(e);e.pos}(t),(e=>{const t=(e=>{Zr(e,6,"Expected algorithm OID");const t=Jr(e);return Vr(e,t)})(e);if(Xr(t,[43,101,110]))return"X25519";if(!Xr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Zr(e,6,"Expected curve OID");const n=Jr(e),r=Vr(e,n);for(const e 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]}]){const t=e.name,n=e.oid;if(Xr(r,n))return t}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 kr("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 kr('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)},Yr=e=>null==e?void 0:e[Symbol.toStringTag],qr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Qr,$r;let eo,to;if("undefined"==typeof navigator||null===(Qr=navigator.userAgent)||void 0===Qr||null===($r=Qr.startsWith)||void 0===$r||!$r.call(Qr,"Mozilla/5.0 ")){const e="v6.8.4";to="".concat("openid-client","/").concat(e),eo={"user-agent":to}}const no=e=>ro.get(e);let ro,oo;function io(e){return void 0!==e?sn(e):(oo||(oo=new WeakMap),(e,t,n,r)=>{let o;return(o=oo.get(t))||(function(e,t){if("string"!=typeof e)throw uo("".concat(t," must be a string"),co);if(0===e.length)throw uo("".concat(t," must not be empty"),so)}(t.client_secret,'"metadata.client_secret"'),o=sn(t.client_secret),oo.set(t,o)),o(e,t,n,r)})}const ao=Pt,so="ERR_INVALID_ARG_VALUE",co="ERR_INVALID_ARG_TYPE";function uo(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class lo extends Error{constructor(e,t){var n;super(e,t),E(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 ho(e,t,n){return new lo(e,{cause:t,code:n})}function po(e){if(e instanceof TypeError||e instanceof lo||e instanceof pn||e instanceof fn||e instanceof mn)throw e;if(e instanceof Ft)switch(e.code){case Vn:throw ho("only requests to HTTPS are allowed",e,e.code);case zn:throw ho("only requests to HTTP or HTTPS are allowed",e,e.code);case Zn:throw ho("unexpected HTTP response status code",e.cause,e.code);case Jn:throw ho("unexpected response content-type",e.cause,e.code);case Fn:throw ho("parsing error occured",e,e.code);case Xn:throw ho("invalid response encountered",e,e.code);case qn:throw ho("unexpected JWT claim value encountered",e,e.code);case Qn:throw ho("unexpected JSON attribute value encountered",e,e.code);case Yn:throw ho("JWT timestamp claim value failed validation",e,e.code);default:throw ho(e.message,e,e.code)}if(e instanceof Kt)throw ho("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw ho("runtime operation error",e,Wn);case"NotSupportedError":throw ho("runtime unsupported operation",e,Wn);case"TimeoutError":throw ho("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw ho("operation aborted",e,"OAUTH_ABORT")}throw new lo("something went wrong",{cause:e})}async function fo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw uo('"server" must be an instance of URL',co);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 Ct('"'.concat("issuerIdentifier",'" must be an instance of URL'),It);ln(e,!0!==(null==r?void 0:r[Nt]));const o=n(new URL(e.href)),i=Zt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Pt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Vt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=zt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=zt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Ct('"options.algorithm" must be "oidc" (default), or "oauth2"',Ot)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Pt]:null==t?void 0:t[ao],[Nt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(Eo),signal:a,headers:new Headers(eo)}):((null==t?void 0:t[ao])||fetch)((ln(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Eo)),e.href),{headers:Object.fromEntries(new Headers(T({accept:"application/json"},eo)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==ur)throw Ct('"expectedIssuerIdentifier" must be an instance of URL',It);if(!Rt(t,Response))throw Ct('"response" must be an instance of Response',It);if(200!==t.status)throw Xt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Zn,t);tr(t);const r=await cr(t);if(qt(r.issuer,'"response" body "issuer" property',Xn,{body:r}),n!==ur&&new URL(r.issuer).href!==n.href)throw Xt('"response" body "issuer" property does not match the expected value',Qn,{expected:n.href,body:r,attribute:"issuer"});return r}(ur,e)).catch(po);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[mo]=!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 lo("discovered metadata issuer does not match the expected issuer",{code:Qn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new go(i,t,n,r);let s=no(a);if(null!=o&&o[ao]&&(s.fetch=o[ao]),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 mo=Symbol();class go{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw uo('"clientId" must be a non-empty string',co);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 uo('"clientId" and "metadata.client_id" must be the same',so);const u=T(T({},structuredClone(n)),{},{client_id:t});let l;u[Lt]=null!==(i=null===(a=n)||void 0===a?void 0:a[Lt])&&void 0!==i?i:0,u[xt]=null!==(s=null===(c=n)||void 0===c?void 0:c[xt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?io(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);mo in e&&(h[lr]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);ro||(ro=new WeakMap),ro.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(no(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(no(this).c)}get timeout(){return no(this).timeout}set timeout(e){no(this).timeout=e}get[ao](){return no(this).fetch}set[ao](e){no(this).fetch=e}}function yo(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 Cn(this)}catch(e){return}}}}}(e))}async function wo(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 Ft("invalid Retry-After header value",{cause:e});a>t&&await bo(a-t,n)}function bo(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 vo(e,t){Oo(e);const n=no(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){on(e),an(t);const i=hn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Nt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Zt(null==o?void 0:o.headers);return s.set("accept","application/json"),_n(e,t,n,i,a,s,o)}(r,o,i,t,{[Pt]:a,[Nt]:!s,headers:new Headers(eo),signal:Io(c)}).then(e=>async function(e,t,n){if(on(e),an(t),!Rt(n,Response))throw Ct('"response" must be an instance of Response',It);await Sn(n,200,"Backchannel Authentication Endpoint"),tr(n);const r=await cr(n);qt(r.auth_req_id,'"response" body "auth_req_id" property',Xn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Yt(o,!0,'"response" body "expires_in" property',Xn,{body:r}),r.expires_in=o,void 0!==r.interval&&Yt(r.interval,!1,'"response" body "interval" property',Xn,{body:r}),r}(r,o,e)).catch(po)}async function Ao(e,t,n,r){var o,i;Oo(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 bo(a,s)}catch(e){po(e)}const c=no(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,m=c.timeout,g=c.decrypt,y=(o,i)=>Ao(e,T(T({},t),{},{interval:o}),n,T(T({},r),{},{signal:s,flag:i})),w=function(e,t){const n=Io(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,m),b=await async function(e,t,n,r,o){on(e),an(t),qt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Rn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[Pt]:h,[Nt]:!p,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(eo),signal:w.signal}).catch(po).finally(w.cleanup);var v;if(503===b.status&&b.headers.has("retry-after"))return await wo(b,a,s,!0),await(null===(v=b.body)||void 0===v?void 0:v.cancel()),y(a);const A=async function(e,t,n,r){return Nn(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(u,l,b,{[Mt]:g});let E;try{E=await A}catch(e){if(Co(e,r))return y(a,No);if(e instanceof pn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await wo(e.response,a,s),y(a)}po(e)}return E.id_token&&await(null==f?void 0:f(b)),yo(E),E}function Eo(e){no(e).tlsOnly=!1}async function So(e,t,n,r,o){if(Oo(e),!((null==o?void 0:o.flag)===No||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw uo('"currentUrl" must be an instance of URL, or Request',co);let i,a;const s=no(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,m=s.nonRepudiation,g=s.timeout,y=s.decrypt,w=s.implicit;if((null==o?void 0:o.flag)===No)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 Ct("form_post responses are expected to use the POST method",Ot,{cause:e});if("application/x-www-form-urlencoded"!==kn(e))throw Ct("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Ot,{cause:e});return async function(e){if(e.bodyUsed)throw Ct("form_post Request instances must contain a readable body",Ot,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var b=_(e,2);const n=b[0],r=b[1];t.searchParams.append(n,r)}break;default:throw uo("unexpected Request HTTP method",so)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!p:i=await p(t,null==n?void 0:n.expectedState);break;case!!f:i=await f(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(on(e),an(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Ct('"parameters" must be an instance of URLSearchParams, or URL',It);if(ir(n,"response"))throw Xt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Xn,{parameters:n});const o=ir(n,"iss"),i=ir(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Xt('response parameter "iss" (issuer) missing',Xn,{parameters:n});if(o&&o!==e.issuer)throw Xt('unexpected "iss" (issuer) response parameter value',Xn,{expected:e.issuer,parameters:n});switch(r){case void 0:case sr:if(void 0!==i)throw Xt('unexpected "state" response parameter encountered',Xn,{expected:void 0,parameters:n});break;case ar:break;default:if(qt(r,'"expectedState" argument'),i!==r)throw Xt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Xn,{expected:r,parameters:n})}if(ir(n,"error"))throw new fn("authorization response from the server is an error",{cause:n});const a=ir(n,"id_token"),s=ir(n,"token");if(void 0!==a||void 0!==s)throw new Kt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Pn.add(c),c;var c}(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){po(e)}}}const v=await async function(e,t,n,r,o,i,a){if(on(e),an(t),!Pn.has(r))throw Ct('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Ot);qt(o,'"redirectUri"');const s=ir(r,"code");if(!s)throw Xt('no authorization code in "callbackParameters"',Xn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Un&&(qt(i,'"codeVerifier"'),c.set("code_verifier",i)),Rn(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||Un,{additionalParameters:r,[Pt]:d,[Nt]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(eo),signal:Io(g)}).catch(po);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const A=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=Bn;break;case Bn:break;default:qt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Hn;break;case Hn:break;default:Yt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Nn(e,t,n,s,i,a);qt(c.id_token,'"response" body "id_token" property',Xn,{body:c});const u=Cn(c);if(o!==Hn){const e=rn()+tn(t),n=nn(t);if(u.auth_time+o{}});const m=async function(e,t,n,r){return Nn(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[Mt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(o){if(Co(o,r))return Lo(e,t,n,T(T({},r),{},{flag:No}));po(o)}return g.id_token&&await(null==h?void 0:h(p)),yo(g),g}async function xo(e,t,n){if(!Dr(e))throw new _r("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new _r('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new _r("JWS Protected Header incorrect type");if(void 0===e.payload)throw new _r("JWS Payload missing");if("string"!=typeof e.signature)throw new _r("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Dr(e.header))throw new _r("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=mr(e.protected);r=JSON.parse(hr.decode(t))}catch(e){throw new _r("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new kr('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)}(_r,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 _r('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const s=o.alg;if("string"!=typeof s||!s)throw new _r('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 _r("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new _r("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(Br(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&qr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ur(t))throw new TypeError(vr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Yr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Br(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Ur(t))throw new TypeError(vr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Yr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Yr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Yr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Yr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Yr(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;ne+t.length,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?pr(e.protected):new Uint8Array,pr("."),"string"==typeof e.payload?a?pr(e.payload):dr.encode(e.payload):e.payload),d=Mr(e.signature,"signature",_r),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(xr(e))return e;if(Pr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Kr||(Kr=new WeakMap);let n=Kr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(Wr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(Wr);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(Wr);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(Wr)}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(Wr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(Wr);return n?n[t]=i:Kr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Fr(e,n,t)}if(Br(e))return e.k?mr(e.k):Fr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Hr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const n=t.algorithm.modulusLength;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 kr("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new Lr;let p;p=a?Mr(e.payload,"payload",_r):"string"==typeof e.payload?dr.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?T(T({},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 Uo(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());function Do(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(hr.decode(t))}catch(e){}if(!Dr(n))throw new Rr("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(o&&("string"!=typeof e.typ||Mo(e.typ)!==Mo(o)))throw new Er('unexpected "typ" JWT header value',n,"typ","check_failed");const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in n))throw new Er('missing required "'.concat(e,'" claim'),n,e,"missing");if(s&&!(Array.isArray(s)?s:[s]).includes(n.iss))throw new Er('unexpected "iss" claim value',n,"iss","check_failed");if(c&&n.sub!==c)throw new Er('unexpected "sub" claim value',n,"sub","check_failed");if(u&&(p="string"==typeof u?[u]:u,!("string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(Set.prototype.has.bind(new Set(h))))))throw new Er('unexpected "aud" claim value',n,"aud","check_failed");var h,p;let f;switch(typeof r.clockTolerance){case"string":f=Uo(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const m=(g=r.currentDate||new Date,Math.floor(g.getTime()/1e3));var g;if((void 0!==n.iat||l)&&"number"!=typeof n.iat)throw new Er('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Er('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+f)throw new Er('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Er('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-f)throw new Sr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(l){const e=m-n.iat;if(e-f>("number"==typeof l?l:Uo(l)))throw new Sr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-f)throw new Er('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function Bo(e){return Dr(e)}var Ho,jo,Go=new WeakMap,Wo=new WeakMap;class Ko{constructor(e){if(v(this,Go,void 0),v(this,Wo,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Bo)}(e))throw new Or("JSON Web Key Set malformed");A(Go,this,structuredClone(e))}jwks(){return b(Go,this)}async getKey(e,t){const n=T(T({},e),null==t?void 0:t.header),r=n.alg,o=n.kid,i=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 kr('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=b(Go,this).keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof o&&(t=o===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==i||(t=r===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(r){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}),s=a[0],c=a.length;if(0===c)throw new Ir;if(1!==c){const e=new Cr,t=b(Wo,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new R(e.apply(this,arguments))}}(function*(){for(const e of a)try{yield yield y(Fo(t,e,r))}catch(e){}}),e}return Fo(b(Wo,this),s,r)}}async function Fo(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(!Dr(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 mr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new kr('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Gr(T(T({},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 Gr(T(T({},e),{},{ext:n}));case"EC":case"OKP":return Gr(T(T({},e),{},{alg:t,ext:n}));default:throw new kr('Unsupported "kty" (Key Type) Parameter value')}}(T(T({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Or("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Xo(e){const t=new Ko(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let Jo;if("undefined"==typeof navigator||null===(Ho=navigator.userAgent)||void 0===Ho||null===(jo=Ho.startsWith)||void 0===jo||!jo.call(Ho,"Mozilla/5.0 ")){const e="v6.2.3";Jo="".concat("jose","/").concat(e)}const Zo=Symbol(),Vo=Symbol();var zo=new WeakMap,Yo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap;class ii{constructor(e,t){if(v(this,zo,void 0),v(this,Yo,void 0),v(this,qo,void 0),v(this,Qo,void 0),v(this,$o,void 0),v(this,ei,void 0),v(this,ti,void 0),v(this,ni,void 0),v(this,ri,void 0),v(this,oi,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;A(zo,this,new URL(e.href)),A(Yo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),A(qo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),A(Qo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),A(ti,this,new Headers(null==t?void 0:t.headers)),Jo&&!b(ti,this).has("User-Agent")&&b(ti,this).set("User-Agent",Jo),b(ti,this).has("accept")||(b(ti,this).set("accept","application/json"),b(ti,this).append("accept","application/jwk-set+json")),A(ni,this,null==t?void 0:t[Zo]),void 0!==(null==t?void 0:t[Vo])&&(A(oi,this,null==t?void 0:t[Vo]),n=null==t?void 0:t[Vo],r=b(Qo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Dr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Dr)&&(A($o,this,b(oi,this).uat),A(ri,this,Xo(b(oi,this).jwks))))}pendingFetch(){return!!b(ei,this)}coolingDown(){return"number"==typeof b($o,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 Nr;throw e});if(200!==o.status)throw new Ar("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Ar("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(b(zo,this).href,b(ti,this),AbortSignal.timeout(b(Yo,this)),b(ni,this)).then(e=>{A(ri,this,Xo(e)),b(oi,this)&&(b(oi,this).uat=Date.now(),b(oi,this).jwks=e),A($o,this,Date.now()),A(ei,this,void 0)}).catch(e=>{throw A(ei,this,void 0),e})),await b(ei,this)}}const ai=["mfaToken"],si=["mfaToken"];var ci,ui,li,di,hi,pi,fi,mi,gi,yi,wi,bi,vi,Ai,Ei,Si,Ti=class extends Error{constructor(e,t){super(t),E(this,"code",void 0),this.name="NotSupportedError",this.code=e}},ki=class extends Error{constructor(e,t,n){super(t),E(this,"cause",void 0),E(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},_i=class extends ki{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Ri=class extends ki{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Oi=class extends ki{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Ii=class extends ki{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ci=class extends ki{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Ni=class extends ki{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Li=class extends Error{constructor(e){super(e),E(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},xi=class extends ki{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),E(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Pi=class extends ki{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 ki{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Mi=class extends ki{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."),E(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Bi(e){return Object.entries(e).filter(e=>void 0!==_(e,2)[1]).reduce((e,t)=>T(T({},e),{},{[t[0]]:t[1]}),{})}var Hi=class extends Error{constructor(e,t,n){super(t),E(this,"cause",void 0),E(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ji=class extends Hi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Gi=class extends Hi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Wi=class extends Hi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ki=class extends Hi{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 Xi=(ci=new WeakMap,ui=new WeakMap,li=new WeakMap,class{constructor(e){var t;v(this,ci,void 0),v(this,ui,void 0),v(this,li,void 0),A(ci,this,"https://".concat(e.domain)),A(ui,this,e.clientId),A(li,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(b(ci,this),"/mfa/authenticators"),n=e.mfaToken,r=await b(li,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 ji(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Fi)}async enrollAuthenticator(e){const t="".concat(b(ci,this),"/mfa/associate"),n=e.mfaToken,r=k(e,ai),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 b(li,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 Gi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const t=e.authenticatorId,n=e.mfaToken,r="".concat(b(ci,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await b(li,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(b(ci,this),"/mfa/challenge"),n=e.mfaToken,r=k(e,si),o={mfa_token:n,client_id:b(ui,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await b(li,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Ki(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),Ji=class e{constructor(e,t,n,r,o,i,a){E(this,"accessToken",void 0),E(this,"idToken",void 0),E(this,"refreshToken",void 0),E(this,"expiresAt",void 0),E(this,"scope",void 0),E(this,"claims",void 0),E(this,"authorizationDetails",void 0),E(this,"tokenType",void 0),E(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},Zi=(di=new WeakMap,hi=new WeakMap,pi=new WeakMap,class{constructor(e,t){v(this,di,new Map),v(this,hi,void 0),v(this,pi,void 0),A(pi,this,Math.max(1,Math.floor(e))),A(hi,this,Math.max(0,Math.floor(t)))}get(e){const t=b(di,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return b(di,this).delete(e),b(di,this).set(e,t),t.value;b(di,this).delete(e)}}set(e,t){for(b(di,this).has(e)&&b(di,this).delete(e),b(di,this).set(e,{value:t,expiresAt:Date.now()+b(hi,this)});b(di,this).size>b(pi,this);){const e=b(di,this).keys().next().value;if(void 0===e)break;b(di,this).delete(e)}}}),Vi=new Map;function zi(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var Yi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Vi.get(i));var i;return o||(o=new Zi(e.maxEntries,e.ttlMs),Vi.set(t,o)),o}static createJwksCache(){return{}}},qi="openid profile email offline_access",Qi=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 $i(e){if(null==e)throw new Ni("subject_token is required");if("string"!=typeof e)throw new Ni("subject_token must be a string");if(0===e.trim().length)throw new Ni("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Ni("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Ni("subject_token must not include the 'Bearer ' prefix")}function ea(e,t){if(t)for(const r of Object.entries(t)){var n=_(r,2);const t=n[0],o=n[1];if(!Qi.has(t))if(Array.isArray(o)){if(o.length>20)throw new Ni("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}else e.append(t,o)}}var ta="urn:ietf:params:oauth:token-type:access_token",na=(fi=new WeakMap,mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,wi=new WeakMap,bi=new WeakMap,vi=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,Si=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){w(e,t),t.add(e)}(this,Si),v(this,fi,void 0),v(this,mi,void 0),v(this,gi,void 0),v(this,yi,void 0),v(this,wi,void 0),v(this,bi,void 0),v(this,vi,void 0),v(this,Ai,void 0),v(this,Ei,void 0),E(this,"mfa",void 0),A(yi,this,e),e.useMtls&&!e.customFetch)throw new Ti("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");A(wi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,T(T({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=zi(e.discoveryCache);A(vi,this,Yi.createDiscoveryCache(i)),A(Ai,this,new Map),A(Ei,this,Yi.createJwksCache()),this.mfa=new Xi({domain:b(yi,this).domain,clientId:b(yi,this).clientId,customFetch:b(wi,this)})}async getServerMetadata(){return(await g(Si,this,ia).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await g(Si,this,ia).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ti("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await g(Si,this,ua).call(this,e)}catch(e){throw new Pi(e)}}async buildLinkUserUrl(e){try{const t=await g(Si,this,ua).call(this,{authorizationParams:T(T({},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 g(Si,this,ua).call(this,{authorizationParams:T(T({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Mi(e)}}async backchannelAuthentication(e){const t=await g(Si,this,ia).call(this),n=t.configuration,r=t.serverMetadata,o=Bi(T(T({},b(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:qi},o),{},{client_id:b(yi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await vo(n,i),t=await Ao(n,e);return Ji.fromTokenEndpointResponse(t)}catch(e){throw new xi(e)}}async initiateBackchannelAuthentication(e){const t=await g(Si,this,ia).call(this),n=t.configuration,r=t.serverMetadata,o=Bi(T(T({},b(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:qi},o),{},{client_id:b(yi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&i.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&i.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await vo(n,i);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new xi(e)}}async backchannelAuthenticationGrant(e){let t=e.authReqId;const n=(await g(Si,this,ia).call(this)).configuration,r=new URLSearchParams({auth_req_id:t});try{const e=await Lo(n,"urn:openid:params:grant-type:ciba",r);return Ji.fromTokenEndpointResponse(e)}catch(e){throw new xi(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Ci("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 Ci("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?ta:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof Ni)throw new Ci(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?g(Si,this,aa).call(this,e):g(Si,this,sa).call(this,e)}async getTokenByCode(e,t){const n=(await g(Si,this,ia).call(this)).configuration;try{const r=await So(n,e,{pkceCodeVerifier:t.codeVerifier});return Ji.fromTokenEndpointResponse(r)}catch(e){throw new _i("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const t=(await g(Si,this,ia).call(this)).configuration,n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await To(t,e.refreshToken,n);return Ji.fromTokenEndpointResponse(r)}catch(e){throw new Oi("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const t=(await g(Si,this,ia).call(this)).configuration,n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await g(Si,this,ca).call(this);r=new go(t.serverMetadata(),b(yi,this).clientId,b(yi,this).clientSecret,n),r[ao]=(t,n)=>b(wi,this).call(this,t,T(T({},n),{},{headers:T(T({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Lo(r,"password",n);return Ji.fromTokenEndpointResponse(e)}catch(e){throw new Ii("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const t=(await g(Si,this,ia).call(this)).configuration;try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await ko(t,n);return Ji.fromTokenEndpointResponse(r)}catch(e){throw new Ri("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const t=await g(Si,this,ia).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(b(yi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",b(yi,this).clientId),t}return function(e,t){Oo(e);const n=no(e),r=n.as,o=n.c,i=hn(r,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",o.client_id);for(const e of t.entries()){var a=_(e,2);const t=a[0],n=a[1];i.searchParams.append(t,n)}return i}(n,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const t=(await g(Si,this,ia).call(this)).serverMetadata,n=zi(b(yi,this).discoveryCache),r=t.jwks_uri;b(bi,this)||A(bi,this,function(e,t){const n=new ii(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[Zo]:b(wi,this),[Vo]:b(Ei,this)}));const o=(await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=hr.decode(e)),"string"!=typeof e)throw new _r("Compact JWS must be a string or Uint8Array");const r=e.split("."),o=r[0],i=r[1],a=r[2];if(3!==r.length)throw new _r("Invalid Compact JWS");const s=await xo({payload:i,protected:o,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?T(T({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Rr("JWTs MUST NOT use unencoded payload");const i={payload:Do(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?T(T({},i),{},{key:o.key}):i}(e.logoutToken,b(bi,this),{issuer:t.issuer,audience:b(yi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in o)&&!("sub"in o))throw new Li('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new Li('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new Li('"sub" claim must be a string');if("nonce"in o)throw new Li('"nonce" claim is prohibited');if(!("events"in o))throw new Li('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new Li('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new Li('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new Li('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function ra(){const e=b(yi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(b(yi,this).useMtls?"1":"0")}async function oa(e){const t=await g(Si,this,ca).call(this),n=new go(e,b(yi,this).clientId,b(yi,this).clientSecret,t);return n[ao]=b(wi,this),n}async function ia(){if(b(fi,this)&&b(mi,this))return{configuration:b(fi,this),serverMetadata:b(mi,this)};const e=g(Si,this,ra).call(this),t=b(vi,this).get(e);if(t)return A(mi,this,t.serverMetadata),A(fi,this,await g(Si,this,oa).call(this,t.serverMetadata)),{configuration:b(fi,this),serverMetadata:b(mi,this)};const n=b(Ai,this).get(e);if(n){const e=await n;return A(mi,this,e.serverMetadata),A(fi,this,await g(Si,this,oa).call(this,e.serverMetadata)),{configuration:b(fi,this),serverMetadata:b(mi,this)}}const r=(async()=>{const t=await g(Si,this,ca).call(this),n=await fo(new URL("https://".concat(b(yi,this).domain)),b(yi,this).clientId,{use_mtls_endpoint_aliases:b(yi,this).useMtls},t,{[ao]:b(wi,this)}),r=n.serverMetadata();return b(vi,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>({serverMetadata:e.serverMetadata}));o.catch(()=>{}),b(Ai,this).set(e,o);try{const e=await r,t=e.configuration,n=e.serverMetadata;A(fi,this,t),A(mi,this,n),b(fi,this)[ao]=b(wi,this)}finally{b(Ai,this).delete(e)}return{configuration:b(fi,this),serverMetadata:b(mi,this)}}async function aa(e){var t,n;const r=(await g(Si,this,ia).call(this)).configuration;if("audience"in e||"resource"in e)throw new Ni("audience and resource parameters are not supported for Token Vault exchanges");$i(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:ta,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),ea(o,e.extra);try{const e=await Lo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return Ji.fromTokenEndpointResponse(e)}catch(t){throw new Ni("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function sa(e){const t=(await g(Si,this,ia).call(this)).configuration;$i(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),ea(n,e.extra);try{const e=await Lo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return Ji.fromTokenEndpointResponse(e)}catch(t){throw new Ni("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ca(){return b(gi,this)||A(gi,this,(async()=>{if(!b(yi,this).clientSecret&&!b(yi,this).clientAssertionSigningKey&&!b(yi,this).useMtls)throw new Di;if(b(yi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=b(yi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return zr(e,t,void 0)}(e,b(yi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return cn(e,void 0)}(e):io(b(yi,this).clientSecret)})().catch(e=>{throw A(gi,this,void 0),e})),b(gi,this)}async function ua(e){const t=(await g(Si,this,ia).call(this)).configuration,n=$t(),r=await function(e){return async function(e){return qt(e,"codeVerifier"),Wt(await crypto.subtle.digest("SHA-256",Ht(e)))}(e)}(n),o=Bi(T(T({},b(yi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:qi},o),{},{client_id:b(yi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Ro(t,i):await _o(t,i),codeVerifier:n}}class la extends P{constructor(e,t){super(e,t),Object.setPrototypeOf(this,la.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new la(t,n)}}class da extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}}class ha extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,pa.prototype)}}class fa extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,fa.prototype)}}class ma extends la{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ma.prototype)}}class ga{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 n of this.contexts){var t=_(n,2);const r=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(r)}}get size(){return this.contexts.size}}class ya{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new ga}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 da("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 ji)throw new da(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=St[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 Gi)throw new ha(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof Ki)throw new pa(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 ma("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 fa("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 fa("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 G)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof fa)throw new fa(e.error,e.error_description);throw e}}}class wa{constructor(e){let t,n;if(this.userCache=(new Xe).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!J())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===J().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=(we||(we=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new ge:new ye;var e}()),we),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||C,!pt(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=pt(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:I,this.cookieStorage=!1===e.legacySameSiteCookie?nt:ot,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:it;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]=He(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Ze(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||L,this.cacheManager=new Je(n,n.allKeys?void 0:new lt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new wt(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new At(s,a),this.authJsClient=new na({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new ya(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===C&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ct,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||N,n=Y(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(q(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=_(t,3),r=n[0],o=n[1],i=n[2];if(3!==t.length||!r||!o||!i)throw new Error("ID token could not be decoded");const a=JSON.parse(ee(o)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],ze.includes(e)||(c[e]=a[e])}),{encoded:{header:r,payload:o,signature:i},header:JSON.parse(ee(r)),claims:s,user:c}})(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&&!Ve(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||!Ve(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ve(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&&Ve(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(o))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=V(Z()),i=V(Z()),a=Z(),s=await Q(a),c=te(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:je(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||x,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 j;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new H(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new B(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(P.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new P("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=ft(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),n=t.openUrl,r=t.fragment,o=t.appState,i=p(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),u=c.url,l=p(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:at.Code}),a&&{organization:a}));const d=r?"".concat(u,"#").concat(r):u;n?await n(d):window.location.assign(d)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new P("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===at.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,r=e.state,o=e.error,i=e.error_description;if(o)throw new U(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new P("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:at.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,r=e.state,o=e.error,i=e.error_description;if(o)throw new M(o,i||o,t.connection,r,t.appState);if(!n)throw new P("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new P("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:at.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(dt))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(dt)}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:je(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=ut[t];return n||(n=e().finally(()=>{delete ut[t],n=null}),ut[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 t=e.cacheMode,n=p(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||x,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||x,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),r=e.id_token,o=e.token_type,i=e.access_token,a=e.oauthTokenScope,s=e.expires_in;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 G||e instanceof P&&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||x,clientId:this.options.clientId});if(!t)throw new P("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:je(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({},O),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new Ke({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||x,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||{},n=t.federated,r=p(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(q(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||x,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,r=e.useFormData,o=e.refreshTokens,i=e.audience,a=e.client_id,s=e.onRefreshTokenRevoked;const c=e.timeout||I,u="refresh_token",l="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":r?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(Y(n||N)))};if(t){const n={client_id:a,token_type_hint:u},o=r?q(n):JSON.stringify(n);try{return await Pe({type:"revoke",timeout:c,fetchUrl:l,fetchOptions:{method:"POST",body:o,headers:d},useFormData:r,auth:{audience:null!=i?i:x}},t)}catch(e){throw new P("revoke_error",e.message)}}for(const t of o){const n={client_id:a,token_type_hint:u,token:t},o=r?q(n):JSON.stringify(n),i=await Ue(l,{method:"POST",body:o,headers:d},c);if(!i.ok){let t,n;try{var h=JSON.parse(await i.text());t=h.error,n=h.error_description}catch(e){}throw new P(t||"revoke_error",n||"HTTP error ".concat(i.status))}await(null==s?void 0:s(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=ft(e),r=n.openUrl,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(We);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await Pe({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const r=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin),o=r.url,i=r.state,a=r.nonce,s=r.code_verifier,c=r.redirect_uri,u=r.scope,l=r.audience;if(window.crossOriginIsolated)throw new P("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const d=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let h;try{h=new URL(this.domainUrl).origin}catch(e){h=this.domainUrl}const p=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 D),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(P.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)})}(o,h,d);if(i!==p.state)throw new P("state_mismatch","Invalid state");const f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:s,code:p.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:t.organization});return Object.assign(Object.assign({},f),{scope:u,oauthTokenScope:f.scope,audience:l})})}catch(e){throw"login_required"===e.error&&(e instanceof P&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new Ke({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||x,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 W(e.authorizationParams.audience||x,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&&mt(l,c)||mt(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 K(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||x})}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 G&&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 t=e.id_token,n=e.decodedToken,r=p(e,["id_token","decodedToken"]);this.userCache.set(We,{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||x,t=this.scope[e],n=await this.cacheManager.getIdToken(new Ke({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(We);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(We,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,r=e.clientId,o=e.cacheMode;const i=await this.cacheManager.get(new Ke({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,r=i.expires_in,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 o=t||{},i=o.nonceIn,a=o.organization,s=o.scopesToRequest,c=await Be(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:s||e.scope}),this.worker),u=await this._verifyIdToken(c.id_token,i,a);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!==u.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(We))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},c),{decodedToken:u,scope:e.scope,audience:e.audience||x}),c.scope?{oauthTokenScope:c.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(a||u.claims.org_id),Object.assign(Object.assign({},c),{decodedToken:u})}_buildTokenExchangeParams(e){return Object.assign(Object.assign(Object.assign(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}),e.actor_token&&{actor_token:e.actor_token}),e.actor_token_type&&{actor_token_type:e.actor_token_type}),{scope:je(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 loginWithCustomTokenExchange(e){return this._requestToken(this._buildTokenExchangeParams(e))}async customTokenExchange(e){const t=await Be(Object.assign(Object.assign({},this._buildTokenExchangeParams(e)),{baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,dpop:this.dpop}),this.worker,!0);return t.id_token&&await this._verifyIdToken(t.id_token,void 0,e.organization),t}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 vt(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 t=e.openUrl,n=e.appState,r=e.connection,o=e.scopes,i=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!r)throw new Error("connection is required");const c=V(Z()),u=Z(),l=await Q(u),d=te(l),h=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:s,state:c,code_challenge:d,code_challenge_method:"S256",authorization_params:i}),p=h.connect_uri,f=h.connect_params,m=h.auth_session;this.transactionManager.create({state:c,code_verifier:u,auth_session:m,redirect_uri:s,appState:n,connection:r,response_type:at.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForMfa(e,t){const n=e.mfaToken,r=p(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function ba(e,t){return function(){return e.apply(t,arguments)}}const{toString:va}=Object.prototype,{getPrototypeOf:Aa}=Object,{iterator:Ea,toStringTag:Sa}=Symbol,Ta=(ka=Object.create(null),e=>{const t=va.call(e);return ka[t]||(ka[t]=t.slice(8,-1).toLowerCase())});var ka;const _a=e=>(e=e.toLowerCase(),t=>Ta(t)===e),Ra=e=>t=>typeof t===e,{isArray:Oa}=Array,Ia=Ra("undefined");function Ca(e){return null!==e&&!Ia(e)&&null!==e.constructor&&!Ia(e.constructor)&&xa(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Na=_a("ArrayBuffer");const La=Ra("string"),xa=Ra("function"),Pa=Ra("number"),Ua=e=>null!==e&&"object"==typeof e,Ma=e=>{if("object"!==Ta(e))return!1;const t=Aa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Sa in e||Ea in e)},Da=_a("Date"),Ba=_a("File"),Ha=_a("Blob"),ja=_a("FileList");const Ga="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Wa=void 0!==Ga.FormData?Ga.FormData:void 0,Ka=_a("URLSearchParams"),[Fa,Xa,Ja,Za]=["ReadableStream","Request","Response","Headers"].map(_a);function Va(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Oa(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,qa=e=>!Ia(e)&&e!==Ya;const Qa=($a="undefined"!=typeof Uint8Array&&Aa(Uint8Array),e=>$a&&e instanceof $a);var $a;const es=_a("HTMLFormElement"),ts=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ns=_a("RegExp"),rs=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Va(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const os=_a("AsyncFunction"),is=(as="function"==typeof setImmediate,ss=xa(Ya.postMessage),as?setImmediate:ss?(cs=`axios@${Math.random()}`,us=[],Ya.addEventListener("message",({source:e,data:t})=>{e===Ya&&t===cs&&us.length&&us.shift()()},!1),e=>{us.push(e),Ya.postMessage(cs,"*")}):e=>setTimeout(e));var as,ss,cs,us;const ls="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ya):"undefined"!=typeof process&&process.nextTick||is,ds={isArray:Oa,isArrayBuffer:Na,isBuffer:Ca,isFormData:e=>{if(!e)return!1;if(Wa&&e instanceof Wa)return!0;const t=Aa(e);if(!t||t===Object.prototype)return!1;if(!xa(e.append))return!1;const n=Ta(e);return"formdata"===n||"object"===n&&xa(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Na(e.buffer),t},isString:La,isNumber:Pa,isBoolean:e=>!0===e||!1===e,isObject:Ua,isPlainObject:Ma,isEmptyObject:e=>{if(!Ua(e)||Ca(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Fa,isRequest:Xa,isResponse:Ja,isHeaders:Za,isUndefined:Ia,isDate:Da,isFile:Ba,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ha,isRegExp:ns,isFunction:xa,isStream:e=>Ua(e)&&xa(e.pipe),isURLSearchParams:Ka,isTypedArray:Qa,isFileList:ja,forEach:Va,merge:function e(...t){const{caseless:n,skipUndefined:r}=qa(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&za(o,i)||i,s=ts(o,a)?o[a]:void 0;Ma(s)&&Ma(t)?o[a]=e(s,t):Ma(t)?o[a]=e({},t):Oa(t)?o[a]=t.slice():r&&Ia(t)||(o[a]=t)};for(let e=0,n=t.length;e(Va(t,(t,r)=>{n&&xa(t)?Object.defineProperty(e,r,{__proto__:null,value:ba(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Aa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ta,kindOfTest:_a,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(Oa(e))return e;let t=e.length;if(!Pa(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ea]).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:es,hasOwnProperty:ts,hasOwnProp:ts,reduceDescriptors:rs,freezeMethods:e=>{rs(e,(t,n)=>{if(xa(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];xa(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Oa(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:za,global:Ya,isContextDefined:qa,isSpecCompliantForm:function(e){return!!(e&&xa(e.append)&&"FormData"===e[Sa]&&e[Ea])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Ua(e)){if(t.has(e))return;if(Ca(e))return e;if(!("toJSON"in e)){t.add(e);const r=Oa(e)?[]:{};return Va(e,(e,t)=>{const o=n(e);!Ia(o)&&(r[t]=o)}),t.delete(e),r}}return e};return n(e)},isAsyncFn:os,isThenable:e=>e&&(Ua(e)||xa(e))&&xa(e.then)&&xa(e.catch),setImmediate:is,asap:ls,isIterable:e=>null!=e&&xa(e[Ea])},hs=ds.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"]),ps=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]&&hs[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};n.dn(ps);const fs=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ms=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function gs(e,t){return ds.isArray(e)?e.map(e=>gs(e,t)):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(t,""))}function ys(e){const t=Object.create(null);return ds.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>gs(e,ms))(e)}),t}const ws=Symbol("internals");function bs(e){return e&&String(e).trim().toLowerCase()}function vs(e){return!1===e||null==e?e:ds.isArray(e)?e.map(vs):(e=>gs(e,fs))(String(e))}function As(e,t,n,r,o){return ds.isFunction(r)?r.call(this,t,n):(o&&(t=n),ds.isString(t)?ds.isString(r)?-1!==t.indexOf(r):ds.isRegExp(r)?r.test(t):void 0:void 0)}class Es{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=bs(t);if(!o)throw new Error("header name must be a non-empty string");const i=ds.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=vs(e))}const i=(e,t)=>ds.forEach(e,(e,n)=>o(e,n,t));if(ds.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ds.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(ps(e),t);else if(ds.isObject(e)&&ds.isIterable(e)){let n,r,o={};for(const t of e){if(!ds.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ds.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=bs(e)){const n=ds.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(ds.isFunction(t))return t.call(this,e,n);if(ds.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bs(e)){const n=ds.findKey(this,e);return!(!n||void 0===this[n]||t&&!As(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=bs(e)){const o=ds.findKey(n,e);!o||t&&!As(0,n[o],o,t)||(delete n[o],r=!0)}}return ds.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&&!As(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ds.forEach(this,(r,o)=>{const i=ds.findKey(n,o);if(i)return t[i]=vs(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]=vs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ds.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ds.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[ws]=this[ws]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=bs(e);t[r]||(!function(e,t){const n=ds.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return ds.isArray(e)?e.forEach(r):r(e),this}}Es.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ds.reduceDescriptors(Es.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ds.freezeMethods(Es);const Ss=Es;function Ts(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(ds.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof Ss&&(e=e.toJSON()),r.push(e),ds.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);ds.isUndefined(r)||(t[n]=r)});else{if(!ds.isPlainObject(e)&&function(e){if(ds.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ds.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);ds.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class ks extends Error{static from(e,t,n,r,o,i){const a=new ks(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&ds.hasOwnProp(e,"redact")?e.redact:void 0,n=ds.isArray(t)&&t.length>0?Ts(e,t):ds.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}ks.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ks.ERR_BAD_OPTION="ERR_BAD_OPTION",ks.ECONNABORTED="ECONNABORTED",ks.ETIMEDOUT="ETIMEDOUT",ks.ECONNREFUSED="ECONNREFUSED",ks.ERR_NETWORK="ERR_NETWORK",ks.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ks.ERR_DEPRECATED="ERR_DEPRECATED",ks.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ks.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ks.ERR_CANCELED="ERR_CANCELED",ks.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ks.ERR_INVALID_URL="ERR_INVALID_URL",ks.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _s=ks;var Rs=n(8287).hp;function Os(e){return ds.isPlainObject(e)||ds.isArray(e)}function Is(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function Cs(e,t,n){return e?e.concat(t).map(function(e,t){return e=Is(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ns=ds.toFlatObject(ds,{},null,function(e){return/^is[A-Z]/.test(e)});const Ls=function(e,t,n){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ds.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ds.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&ds.isSpecCompliantForm(t);if(!ds.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ds.isDate(e))return e.toISOString();if(ds.isBoolean(e))return e.toString();if(!u&&ds.isBlob(e))throw new _s("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(e)||ds.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Rs.from(e):e}function d(e,n,o){let s=e;if(ds.isReactNative(t)&&ds.isReactNativeBlob(e))return t.append(Cs(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(ds.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ds.isArray(e)&&function(e){return ds.isArray(e)&&!e.some(Os)}(e)||(ds.isFileList(e)||ds.endsWith(n,"[]"))&&(s=ds.toArray(e)))return n=Is(n),s.forEach(function(e,r){!ds.isUndefined(e)&&null!==e&&t.append(!0===a?Cs([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Os(e)||(t.append(Cs(o,n,i),l(e)),!1)}const h=[],p=Object.assign(Ns,{defaultVisitor:d,convertValue:l,isVisitable:Os});if(!ds.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!ds.isUndefined(n)){if(i>c)throw new _s("Object is too deeply nested ("+i+" levels). Max depth: "+c,_s.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),ds.forEach(n,function(n,a){!0===(!(ds.isUndefined(n)||null===n)&&o.call(t,n,ds.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function xs(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ps(e,t){this._pairs=[],e&&Ls(e,this,t)}const Us=Ps.prototype;Us.append=function(e,t){this._pairs.push([e,t])},Us.toString=function(e){const t=e?function(t){return e.call(this,t,xs)}:xs;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ms=Ps;function Ds(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bs(e,t,n){if(!t)return e;const r=n&&n.encode||Ds,o=ds.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):ds.isURLSearchParams(t)?t.toString():new Ms(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Hs=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){ds.forEach(this.handlers,function(t){null!==t&&e(t)})}},js={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Gs={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ms,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ws="undefined"!=typeof window&&"undefined"!=typeof document,Ks="object"==typeof navigator&&navigator||void 0,Fs=Ws&&(!Ks||["ReactNative","NativeScript","NS"].indexOf(Ks.product)<0),Xs="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Js=Ws&&window.location.href||"http://localhost",Zs={...e,...Gs};const Vs=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&&ds.isArray(r)?r.length:i,s)return ds.hasOwnProp(r,i)?r[i]=ds.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;ds.hasOwnProp(r,i)&&ds.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ds.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 ds.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},zs=(e,t)=>null!=e&&ds.hasOwnProp(e,t)?e[t]:void 0;const Ys={transitional:js,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ds.isObject(e);o&&ds.isHTMLForm(e)&&(e=new FormData(e));if(ds.isFormData(e))return r?JSON.stringify(Vs(e)):e;if(ds.isArrayBuffer(e)||ds.isBuffer(e)||ds.isStream(e)||ds.isFile(e)||ds.isBlob(e)||ds.isReadableStream(e))return e;if(ds.isArrayBufferView(e))return e.buffer;if(ds.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=zs(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ls(e,new Zs.classes.URLSearchParams,{visitor:function(e,t,n,r){return Zs.isNode&&ds.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=ds.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=zs(this,"env"),r=n&&n.FormData;return Ls(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=zs(this,"transitional")||Ys.transitional,n=t&&t.forcedJSONParsing,r=zs(this,"responseType"),o="json"===r;if(ds.isResponse(e)||ds.isReadableStream(e))return e;if(e&&ds.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,zs(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw _s.from(e,_s.ERR_BAD_RESPONSE,this,null,zs(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Zs.classes.FormData,Blob:Zs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch","query"],e=>{Ys.headers[e]={}});const qs=Ys;function Qs(e,t){const n=this||qs,r=t||n,o=Ss.from(r.headers);let i=r.data;return ds.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function $s(e){return!(!e||!e.__CANCEL__)}const ec=class extends _s{constructor(e,t,n){super(e??"canceled",_s.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function tc(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new _s("Request failed with status code "+n.status,n.status>=400&&n.status<500?_s.ERR_BAD_REQUEST:_s.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const nc=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)]},oc=(e,t,n=3)=>{let r=0;const o=nc(50,250);return rc(n=>{if(!n||"number"!=typeof n.loaded)return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},ic=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ac=e=>(...t)=>ds.asap(()=>e(...t)),sc=Zs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Zs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Zs.origin),Zs.navigator&&/(msie|trident)/i.test(Zs.navigator.userAgent)):()=>!0,cc=Zs.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];ds.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),ds.isString(r)&&s.push(`path=${r}`),ds.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),ds.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function uc(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const lc=e=>e instanceof Ss?{...e}:e;function dc(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return ds.isPlainObject(e)&&ds.isPlainObject(t)?ds.merge.call({caseless:r},e,t):ds.isPlainObject(t)?ds.merge({},t):ds.isArray(t)?t.slice():t}function o(e,t,n,o){return ds.isUndefined(t)?ds.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ds.isUndefined(t))return r(void 0,t)}function a(e,t){return ds.isUndefined(t)?ds.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return ds.hasOwnProp(t,i)?r(n,o):ds.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(lc(e),lc(t),0,!0)};return ds.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ds.hasOwnProp(c,r)?c[r]:o,a=i(ds.hasOwnProp(e,r)?e[r]:void 0,ds.hasOwnProp(t,r)?t[r]:void 0,r);ds.isUndefined(a)&&i!==s||(n[r]=a)}),n}const hc=["content-type","content-length"];const pc=e=>{const t=dc({},e),n=e=>ds.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=Ss.from(s),t.url=Bs(uc(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),ds.isFormData(r)&&(Zs.hasStandardBrowserEnv||Zs.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):ds.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{hc.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Zs.hasStandardBrowserEnv){ds.isFunction(o)&&(o=o(t));if(!0===o||null==o&&sc(t.url)){const e=i&&a&&cc.read(a);e&&s.set(i,e)}}return t};n.dn(pc);const fc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=pc(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 g(){if(!m)return;const r=Ss.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());tc(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new _s("Request aborted",_s.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new _s(r,_s.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||js;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new _s(t,o.clarifyTimeoutError?_s.ETIMEDOUT:_s.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ds.forEach(ys(i),function(e,t){m.setRequestHeader(t,e)}),ds.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=oc(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=oc(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new ec(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||Zs.protocols.includes(y)?m.send(o||null):n(new _s("Unsupported protocol "+y+":",_s.ERR_BAD_REQUEST,e))})},mc=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const o=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof _s?t:new ec(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new _s(`timeout of ${t}ms exceeded`,_s.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}=n;return s.unsubscribe=()=>ds.asap(a),s},gc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of yc(e))yield*gc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var bc=n(8287).hp;const vc="1.16.1",{isFunction:Ac}=ds,Ec=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Sc=e=>{const t=void 0!==ds.global&&null!==ds.global?ds.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=ds.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?Ac(o):"function"==typeof fetch,c=Ac(i),u=Ac(a);if(!s)return!1;const l=s&&Ac(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&Ec(()=>{let e=!1;const t=new i(Zs.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&Ec(()=>ds.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new _s(`Response type '${e}' is not supported`,_s.ERR_NOT_SUPPORT,n)})});const g=async(e,t)=>{const n=ds.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(ds.isBlob(e))return e.size;if(ds.isSpecCompliantForm(e)){const t=new i(Zs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ds.isArrayBufferView(e)||ds.isArrayBuffer(e)?e.byteLength:(ds.isURLSearchParams(e)&&(e+=""),ds.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:y,responseType:w,headers:b,withCredentials:v="same-origin",fetchOptions:A,maxContentLength:E,maxBodyLength:S}=pc(e);const T=ds.isNumber(E)&&E>-1,k=ds.isNumber(S)&&S>-1;let _=o||fetch;w=w?(w+"").toLowerCase():"text";let R=mc([u,l&&l.toAbortSignal()],d),O=null;const I=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==bc&&"function"==typeof bc.byteLength)return bc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>E)throw new _s("maxContentLength size of "+E+" exceeded",_s.ERR_BAD_RESPONSE,e,O)}if(k&&"get"!==n&&"head"!==n){const t=await g(b,s);if("number"==typeof t&&isFinite(t)&&t>S)throw new _s("Request body larger than maxBodyLength limit",_s.ERR_BAD_REQUEST,e,O)}if(y&&p&&"get"!==n&&"head"!==n&&0!==(C=await g(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(ds.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=ic(C,oc(ac(y)));s=wc(n.body,65536,e,t)}}ds.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(ds.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+vc,!1);const u={...A,signal:R,method:n.toUpperCase(),headers:ys(b.normalize()),body:s,duplex:"half",credentials:o?v:void 0};O=c&&new i(t,u);let l=await(c?_(O,A):_(t,u));if(T){const t=ds.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>E)throw new _s("maxContentLength size of "+E+" exceeded",_s.ERR_BAD_RESPONSE,e,O)}const d=f&&("stream"===w||"response"===w);if(f&&l.body&&(h||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=ds.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&ic(n,oc(ac(h),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>E))throw new _s("maxContentLength size of "+E+" exceeded",_s.ERR_BAD_RESPONSE,e,O);r&&r(t)};l=new a(wc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}w=w||"text";let N=await m[ds.findKey(m,w)||"text"](l,e);if(T&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>E)throw new _s("maxContentLength size of "+E+" exceeded",_s.ERR_BAD_RESPONSE,e,O)}return!d&&I&&I(),await new Promise((t,n)=>{tc(t,n,{data:N,headers:Ss.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:O})})}catch(t){if(I&&I(),R&&R.aborted&&R.reason instanceof _s){const n=R.reason;throw n.config=e,O&&(n.request=O),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new _s("Network Error",_s.ERR_NETWORK,e,O,t&&t.response),{cause:t.cause||t});throw _s.from(t,t&&t.code,e,O,t&&t.response)}}},Tc=new Map,kc=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=Tc;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Sc(t)),u=s;return s},_c=(kc(),{http:null,xhr:fc,fetch:{get:kc}});ds.forEach(_c,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Rc=e=>`- ${e}`,Oc=e=>ds.isFunction(e)||null===e||!1===e;const Ic={getAdapter:function(e,t){e=ds.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(Rc).join("\n"):" "+Rc(e[0]):"as no adapter specified";throw new _s("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:_c};function Cc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ec(null,e)}function Nc(e){Cc(e),e.headers=Ss.from(e.headers),e.data=Qs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ic.getAdapter(e.adapter||qs.adapter,e)(e).then(function(t){Cc(e),e.response=t;try{t.data=Qs.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Ss.from(t.headers),t},function(t){if(!$s(t)&&(Cc(e),t&&t.response)){e.response=t.response;try{t.response.data=Qs.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Ss.from(t.response.headers)}return Promise.reject(t)})}const Lc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Lc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const xc={};Lc.transitional=function(e,t,n){function r(e,t){return"[Axios v"+vc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new _s(r(o," has been removed"+(t?" in "+t:"")),_s.ERR_DEPRECATED);return t&&!xc[o]&&(xc[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)}},Lc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Pc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new _s("options must be an object",_s.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new _s("option "+i+" must be "+n,_s.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new _s("Unknown option "+i,_s.ERR_BAD_OPTION)}},validators:Lc},Uc=Pc.validators;class Mc{constructor(e){this.defaults=e||{},this.interceptors={request:new Hs,response:new Hs}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=dc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Pc.assertOptions(n,{silentJSONParsing:Uc.transitional(Uc.boolean),forcedJSONParsing:Uc.transitional(Uc.boolean),clarifyTimeoutError:Uc.transitional(Uc.boolean),legacyInterceptorReqResOrdering:Uc.transitional(Uc.boolean)},!1),null!=r&&(ds.isFunction(r)?t.paramsSerializer={serialize:r}:Pc.assertOptions(r,{encode:Uc.function,serialize:Uc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Pc.assertOptions(t,{baseUrl:Uc.spelling("baseURL"),withXsrfToken:Uc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ds.merge(o.common,o[t.method]);o&&ds.forEach(["delete","get","head","post","put","patch","query","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||js;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=[Nc.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 ec(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 Bc(function(t){e=t});return{token:t,cancel:e}}}const Hc=Bc;const jc={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(jc).forEach(([e,t])=>{jc[t]=e});const Gc=jc;const Wc=function e(t){const n=new Dc(t),r=ba(Dc.prototype.request,n);return ds.extend(r,Dc.prototype,n,{allOwnKeys:!0}),ds.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(dc(t,n))},r}(qs);Wc.Axios=Dc,Wc.CanceledError=ec,Wc.CancelToken=Hc,Wc.isCancel=$s,Wc.VERSION=vc,Wc.toFormData=Ls,Wc.AxiosError=_s,Wc.Cancel=Wc.CanceledError,Wc.all=function(e){return Promise.all(e)},Wc.spread=function(e){return function(t){return e.apply(null,t)}},Wc.isAxiosError=function(e){return ds.isObject(e)&&!0===e.isAxiosError},Wc.mergeConfig=dc,Wc.AxiosHeaders=Ss,Wc.formToJSON=e=>Vs(ds.isHTMLForm(e)?new FormData(e):e),Wc.getAdapter=Ic.getAdapter,Wc.HttpStatusCode=Gc,Wc.default=Wc;const Kc=Wc,Fc={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 Xc=n(3029),Jc=n(2901),Zc=function(){function e(){(0,Xc.A)(this,e),(0,a.A)(this,"readyPromise",null),(0,a.A)(this,"readyResolved",!1),(0,a.A)(this,"readyValue",!1)}return(0,Jc.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return o.A.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return o.A.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var i=null!=n?n:e.DEFAULT_TIMEOUT;return o.A.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,a=setTimeout(function(){t.readyResolved||(o.A.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},i);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return o.A.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var s=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){o.A.log("BlueConicUtils | blueConicReady | BC client detected");var i=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(a),o.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==i||i(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(o.A.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();(0,a.A)(Zc,"DEFAULT_TIMEOUT",3e3);const Vc=new Zc;var zc,Yc;function qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=$c().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])},nu=function(){var e=tu();return".".concat(e)},ru=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(o.A.log("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},ou=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=tu(),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,";")})},iu=function(){return $c().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},au=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)},su=function(){var e=tu();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)},cu=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=tu().split(".")[0],e.prev=1,e.next=2,Kc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(a=e.sent).data){e.next=3;break}return o.A.log("Apple Sub Check: Request successful: ",a.data),e.abrupt("return","subscribed"===a.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,s=e.catch(1),o.A.log("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)}}(),uu=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Kc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(iu())),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)}}(),lu=function(){return"complete"===document.readyState},du=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var i=!0;if(lu())n();else{o.A.log("UIHandler: ","Waiting for the body to load...");var a=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(i=lu()),document.querySelector("body")&&i&&(clearInterval(a),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},hu=function(){return new Promise(function(e){if(lu())e();else{o.A.log("UIHandler: ","Waiting for the log-in-button class to load...");var n=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:document.getElementsByClassName("log-in-button").length>1&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),200)}})},pu=function(){return new Promise(function(e){if(("interactive"===document.readyState||lu())&&window.dataLayer)o.A.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{o.A.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),50)}})},fu=function(){return new Promise(function(e){if(lu())e();else{o.A.log("UIHandler: Employee Debugger: ","Waiting for the digisubs debugger toolbox to load...");var n=setInterval((0,t.A)(r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:document.getElementById("employee-debugger-content")&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),200)}})},mu=function(){var e=(0,t.A)(r.mark(function e(t){var n,i,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,pu();case 1:return o.A.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",o.A.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),i=function(e){return o.A.log("Utils dataLayerLoop: look for this element ",e),e[t]?(o.A.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(o.A.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},a=window.dataLayer.some(i),e.abrupt("return",a?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),gu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"Page Type",e.next=1,mu(t);case 1:return n=e.sent,o.A.log("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)}}(),yu=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.log("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return o.A.log("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){o.A.log("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),o.A.log("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),wu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Vc.blueConicReady();case 1:if(t=e.sent,o.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,yu();case 2:if(n=e.sent,o.A.log("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return i=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){i.loadValues(["auth0_id"],null,function(){e()})});case 4:return a=i.getValue("auth0_id"),o.A.log("bcGetAuth0Id | auth0_id:",a),e.abrupt("return",a);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bu=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a,s,c,u,l,d,h=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]&&h[0],n=!1,a=["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,Vc.blueConicReady();case 1:if(s=e.sent,o.A.log("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(c=window.blueConicClient.getSegments(),o.A.log("bcLowaCheck | BC segments for users: ",c),u=c.filter(function(e){return a.includes(e.name)}),o.A.log("bcLowaCheck | BC userSubSegments: ",u),!(u.length>0)){e.next=3;break}return e.next=2,wu();case 2:(l=e.sent)&&(n=!0,i=l);case 3:return t&&n&&vu(),d={isSub:n},i&&(d.uuid=i),e.abrupt("return",d);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),vu=function(){ru("bc_lowa_status",1,{path:"/",domain:nu(),expires:7,secure:!0})},Au=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(o.A.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(o.A.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};o.A.log("utils | Event: authentication ready: ",r),e(r)}catch(e){o.A.log(e),t(e)}},!1))})},Eu=function(){var e=(0,t.A)(r.mark(function e(){return r.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?(o.A.log("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,o.A.log("Received entitlementsReady event:",r),e(r)}catch(e){o.A.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(o.A.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Su=function(){o.A.log("Clearing entitlements...");try{ou(Fc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){o.A.log("Failed to delete legacy cookie: ",e)}try{ou(Fc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:tu(),expires:365,secure:!0})}catch(e){o.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Fc.LOCAL_STORAGE_SESSION_KEY)}catch(e){o.A.log("Failed to remove local storage: ",e)}},Tu=function(){ou(Fc.AUTH0_SUB_COOKIE_KEY),ou("mng-jwt-decoded"),localStorage.removeItem(Fc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),Su()},ku=function(e){o.A.log("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),o.A.log("Storage Object removed : ",e))},_u=function(e){o.A.log("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 o.A.log("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=_u;var Ru;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ou=function(){var e=(0,t.A)(r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Ru){e.next=1;break}return e.abrupt("return",Ru);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Ru=new wa({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",Ru);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Iu=function(e){o.A.log("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,o.A.log("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),o.A.log("utils | Dispatched authenticationReady event"),Yc=new CustomEvent("mng-auth-check-complete",{detail:e}),zc?(o.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(Yc)):o.A.log("Islands not ready")};var Cu=function(){var e=window.localStorage.getItem("__MNG_Session");if(e){var t=JSON.parse(e);if(t.idToken){var n=au(t.idToken);if(n.home_paper)return o.A.log("Util.js | home paper: Home paper is ",n.home_paper),n.home_paper.replace("www.","").replace("develop.","").replace("preprod.","").replace("staging.","")}}return o.A.log("Util.js | home paper: Home paper is not set ",iu()),iu()},Nu=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Lu=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,c,u,l,d;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o.A.log("deleteUserCache","Setting up cache deletion for ".concat(t)),n=iu(),o.A.log("deleteUSerCache","Domain is: ".concat(n)),a={publication:n,uuid:t},e.next=1,Kc({method:"DELETE",url:"".concat(i.A.entitlementsEndpoint,"session/create"),data:a,headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:if(c=e.sent,u=c.data,l=/Succesfully deleted/i,!("object"===(0,s.A)(u)&&Object.prototype.hasOwnProperty.call(u,"message"))||!l.test(u.message)){e.next=2;break}return o.A.log("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return o.A.log("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),o.A.log("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(d)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),xu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,i){var a={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=(0,t.A)(r.mark(function t(){var s,c,u,l,d,h,p,f,m,g,y;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"1"!==(null===(s=window.sophi_config)||void 0===s?void 0:s.enableSophiSSPW)){t.next=1;break}if(!document.getElementById("server-paywall")){t.next=1;break}return a.sspw=!0,t.abrupt("return",n({paywall:!0,details:Qc({},a)}));case 1:return t.next=2,gu();case 2:return u=t.sent,t.next=3,mu("Paywall_Level");case 3:if(l=t.sent,"article"===u&&"free"!==l){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return t.next=5,Eu();case 5:if(!(d=t.sent)||!d.isEntitled){t.next=6;break}return t.abrupt("return",n({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){t.next=7;break}return t.abrupt("return",n({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,o.A.log("checkPaywallStatus - Sophi is running: ",h),!h){t.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(a.sophiClient=!0,a.engageStatus=!0,a.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(a.sophiClient=!0),n({paywall:!0,details:Qc({},a)})},{once:!0}),t.next=12;break;case 8:if(h){t.next=12;break}return p=window.ConnextUtils.connextReady("onPaywallShown"),f=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),t.prev=9,t.next=10,Promise.race([p,f]);case 10:!0===(m=t.sent)?(a.engagePaywall=!0,a.engageStatus="Engage paywall detected"):(a.engagePaywall=!1,a.engageStatus="Engage response: ".concat(m)),t.next=12;break;case 11:t.prev=11,g=t.catch(9),a.engagePaywall=!1,a.engageStatus="Engage response: ".concat(g);case 12:return t.abrupt("return",n({paywall:Object.values(a).some(function(e){return e}),details:Qc({},a)}));case 13:t.prev=13,y=t.catch(0),i(y);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})},Pu=function(e){return o.A.log("is7DaySub: Checking 7-day subscription status"),e?/7day/i.test(e)?(o.A.log("is7DaySub: Found 7-day subscription ",e),!0):(o.A.log("is7DaySub: Is not 7-day subscription"),!1):(o.A.log("is7DaySub: No service code provided"),!1)};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=xu);var Uu="#primary-menu",Mu="#pushnav",Du=".log-in-button",Bu=".subscribe-visibility",Hu=".log-out-button",ju="dfm-digisubs-menu",Gu="digisubs-push-container",Wu="dfm-digisubs-push-menu",Ku="mega-subscribe-button",Fu=function(){return document.querySelector(Uu)},Xu=function(){return document.querySelector(Mu)},Ju=function(){return document.getElementById(ju)},Zu=function(){return document.getElementById(Gu)},Vu=function(){return document.getElementById(Wu)},zu=function(){return Ju()?Ju().querySelector(Du):null},Yu=function(){return Vu()?Vu().querySelector(Du):null},qu=function(){return Yu()?Yu().querySelector("a"):null},Qu=function(){return document.getElementById(Ku)},$u=function(){return Xu()?Xu().querySelector(Du):null},el=function(){return $u()?$u().querySelector("a"):null},tl=function(){return document.querySelectorAll(Du)},nl=function(){return document.querySelectorAll(Bu)},rl=function(){var e=document.querySelectorAll("".concat(Bu," a"));return e.length>0?e[0]:null};function ol(e){return function(e){if(Array.isArray(e))return 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 il=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Vc.blueConicReady();case 1:return e.next=2,Au();case 2:return e.abrupt("return",new Promise(function(e){o.A.log("ANALYTICS: inside BCregwall events");var t=$c();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),al=function(e){try{window.dataLayer.push({event:e}),o.A.log("ANALYTICS: ".concat(e," event")),o.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){o.A.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var sl=n(1834),cl=function(){try{var e=localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){o.A.log("Unable to get session from local storage: ",e)}return"{}"},ul=function(e){try{o.A.log("Setting local storage session",e),localStorage.setItem(Fc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){o.A.log("Unable to save session from local storage: ",e)}},ll=function(e){try{ru(Fc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:nu(),expires:365,secure:!0})}catch(e){o.A.log("Unable to save session to cookie storage: ",e)}},dl=function(){var e=(0,t.A)(r.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.A.sessionServer,n="".concat(t,"/api/session"),o.A.log("Checking server session: ",n),e.next=1,Kc.get(n,{withCredentials:!0});case 1:if(!(a=e.sent).data){e.next=2;break}return h=a.data.entitlementTokenDecoded,p=a.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,A=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,ul(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:A})),""!==g&&"string"==typeof g&&ll(g),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:A});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)}}(),hl=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=i.A.sessionServer,a="".concat(n,"/api/session"),o.A.log("Updating server session: ",a),e.next=1,Kc.post(a,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),o.A.log("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)}}(),pl=function(){var e=(0,t.A)(r.mark(function e(){var t,n,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=i.A.sessionServer,n="".concat(t,"/api/session"),o.A.log("Deleting server session: ",n),e.next=1,Kc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,a=e.catch(0),o.A.log("Failed to delete server session: ",a);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),fl=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,k,_,R,O,I,C;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.log("Inside getSession"),e.prev=1,d=cl(),o.A.log("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,t=f,i=m,a=g,s=y,c=w,u=b,l=v,o.A.log("Session: check both tokens: ",t,i),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return o.A.log("Session: missing id or entitlements, try session server"),e.next=2,dl();case 2:A=e.sent,E=A.accessToken,S=A.idToken,T=A.entitlementToken,k=A.expiration,_=A.entitlementSource,R=A.isEntitled,O=A.adFree,I=A.entitlementLevel,n=E,t=S,i=T,a=k,s=_,c=R,u=O,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),o.A.log("Failed to get session: ",C);case 5:return o.A.log("Returning session: ",t,n,i),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:i,expiration:a,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)}}(),ml=function(){var e=(0,t.A)(r.mark(function e(t){var n,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,k,_,R,O,I,C,N,L;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=cl(),i=JSON.parse(n),a=i.accessToken,s=void 0===a?null:a,c=i.idToken,u=void 0===c?null:c,l=i.entitlementToken,d=void 0===l?null:l,h=i.expiration,p=void 0===h?null:h,f=i.entitlementSource,m=void 0===f?null:f,g=i.isEntitled,y=void 0===g?null:g,w=i.adFree,b=void 0===w?null:w,v=i.entitlementLevel,A=void 0===v?null:v,E=t.accessToken,S=t.idToken,T=t.entitlementToken,k=t.expiration,_=t.entitlementSource,R=t.isEntitled,O=t.adFree,I=t.entitlementLevel,C={accessToken:E??s,idToken:S??u,entitlementToken:T??d,expiration:k??p,entitlementSource:_??m,isEntitled:R??y,adFree:O??b,entitlementLevel:I??A},o.A.log("Current session data: ",i),o.A.log("New session data: ",t),o.A.log("Updated session data:",C),N=JSON.stringify(C),ul(N),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&ll(C.entitlementToken),n===N){e.next=1;break}return e.next=1,hl(C);case 1:e.next=3;break;case 2:e.prev=2,L=e.catch(0),o.A.log("Unable to save session: ",L);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),gl=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.A.log("Ending session..."),Tu(),e.next=1,pl();case 1:localStorage.removeItem(Fc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yl="1"===window.authentication_config.isEmbedLoginEnabled,wl=function(){return"logout"===($c().searchParams.get("state")||"").toLowerCase()};yl||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var bl=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Ou();case 1:n=e.sent,o.A.log("Calling Auth0 logout...returning to ".concat(t)),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),vl=function(){o.A.log("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){o.A.log("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=/")}},Al=function(){return new Promise(function(e){o.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},El=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a,s,c,u,l,d,h;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.log("Attempting to logout..."),vl(),o.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?au(n):"")){e.next=2;break}return a=i.auth0Id,e.next=1,Lu(a);case 1:e.sent.success?o.A.log("User cache cleared."):o.A.log("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,gl();case 3:e.next=5;break;case 4:Tu();case 5:return e.prev=5,o.A.log("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:o.A.log("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),o.A.log("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),o.A.log("Removed Auth0 storage object...")}),ku("hhsl"),ku("userNewsLetterData"),ku(Fc.REGWALL_USER_IS_SUBSCRIBED),ku(Fc.USER_PROFILE_HASH),c=$c(),u=window.location.origin;try{c.searchParams.get("returnURL")&&(l=decodeURIComponent(c.searchParams.get("returnURL")),u=l)}catch(e){o.A.log(e),u=window.location.origin}return u=new URL(u),e.next=9,window.ConnextUtils.connextReady("onInit",sl.A.defaultTimeoutLength);case 9:if(!e.sent){e.next=11;break}return o.A.log("Auth | Connext silent mode enabled ",Connext.GetOptions().Silentmode),o.A.log("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),e.next=10,Al();case 10:e.next=12;break;case 11:o.A.log("Connext Logout was NOT called");case 12:return o.A.log("Calling Auth0 logout now."),e.next=13,bl(u);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Sl=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},Tl=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return al(e)}),o.A.log("Cycled through preauth GTM events.")},kl=function(){var e=(0,t.A)(r.mark(function e(t,n,i,a,s){var c,u,l,d,h,p,f,m,g,y,w,b,v;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.A.log("Attempting to login..."),Sl()>4.5&&window.localStorage.clear(),Tl(),a&&(c=[],u=window.localStorage.getItem("callbackEvents"),l=JSON.parse(u),c=l&&l.length>0?ol(new Set([].concat(ol(a),ol(l)))):a,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),d=null,e.next=1,Ou();case 1:if(h=e.sent,p=$c(),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,gl();case 2:e.next=4;break;case 3:Tu();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",o.A.log("Logging in with regwall")),t&&(m.searchParams.set("loginsource",t),o.A.log("Logging in with ".concat(t))),i&&(g.login_hint=i),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)}}(),_l=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();o.A.log("Adding listeners to events we need to wait for...");var i=r.map(function(e){return t=e,new Promise(function(e){o.A.log("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};o.A.log("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){o.A.log(t),e()}},!1)});var t});Promise.all(i).then(function(){clearTimeout(t),e()})}catch(t){o.A.log("Failed to wait for callback events",t),e()}})},Rl=function(){var e=(0,t.A)(r.mark(function e(){var n,i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,k;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(vl(),n=$c(),i=!1,a=n.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=n.searchParams.get("redirect_uri")||"",s.includes("applenews")?(o.A.log("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),o.A.log("Post callback Apple redirect URL is ".concat(c)),kl(!1,!1,!1,[],c)):kl()):a.includes("post-apple-login")&&(o.A.log("This is Apple Callback flow."),i=!0,(u=new URL(decodeURIComponent(a))).searchParams.delete("post-apple-login"),a=u),o.A.log("Handling post login callback..."),!(l=n.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==l){e.next=1;break}return e.abrupt("return",kl(!1,!1,!1,!1,a));case 1:i&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Ou();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,o.A.log("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,o.A.log("Cycling through login callbacks..."),e.next=9,_l();case 9:return g=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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:o.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),o.A.log("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="",!i){e.next=17;break}return e.prev=13,e.next=14,uu(y.userId);case 14:return b=e.sent,o.A.log("Encrypted apple uuid is: ".concat(b)),e.next=15,cu(b);case 15:w=e.sent,o.A.log("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,T=e.catch(13),o.A.log("Apple sub check error: ".concat(T)),alert("There was an error in logging you in, please try again.");case 17:if(ku(Fc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return o.A.log("Saving idToken to session server"),e.next=18,ml({idToken:f,accessToken:m});case 18:if(!n.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!n.search.includes("loginsource")){e.next=20;break}return v=n.searchParams.get("loginsource"),A=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(r.mark(function e(t){return r.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(A);case 20:return e.prev=20,E=new URL(a),i&&w&&E.searchParams.append("access_token",b),o.A.log("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,k=e.catch(20),o.A.log("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)}}(),Ol=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.A.log("ANALYTICS: fireBC events"),e.next=1,il();case 1:o.A.log("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Il=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a,s,c,u,l,d,h,p,f,m;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Au();case 1:if(t=e.sent,n=t.idToken,i=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=au(n),c=s.email,u=s.picture,l=s.sub,d=s.name,h=s.nickname,p=s.connection_source,f=null===(a=s.user_metadata)||void 0===a||null===(a=a.customProfile)||void 0===a?void 0:a.nickname,l.split("|").pop(),e.abrupt("return",{authenticated:i,nickname:f||h||d,email:c,picture:u,userId:l,connectionSource:p});case 3:e.prev=3,m=e.catch(2),o.A.log("Unable to parse idToken: ",n," Error: ",m);case 4:return e.abrupt("return",{authenticated:i});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();yl||(window.MNGAuthentication.login=kl,window.MNGAuthentication.logout=El,window.MNGAuthentication.getUserInfo=Il);var Cl=function(){var e=(0,t.A)(r.mark(function e(){var n,a,c,u,l,d,h,p,f,m,g,y,w,b,v,A;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!yl){e.next=1;break}return o.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=$c(),a=!1,c="",u=!1,l={},n.searchParams.get("returnAfterLogout")&&(d=decodeURIComponent(n.searchParams.get("returnAfterLogout")),window.location.assign(d)),n.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),h=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Ou();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(a=e.sent,c="object"===(0,s.A)(l)?l.__raw:"",n=eu(Fc.ENTITLEMENT_COOKIE_KEY),a||!n){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),o.A.log("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)}}(),!n.pathname.startsWith("/logout")){e.next=3;break}return o.A.log("Page is logout. Routing to logout function..."),e.next=2,El();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,h();case 4:if(""===c){e.next=6;break}if(p=null,f=JSON.parse(window.localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==cl()){e.next=5;break}return f&&(p=f.jwt),e.next=5,ml({idToken:c,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,fl();case 7:m=e.sent,c=m.idToken,(a="string"==typeof c)&&(l=au(c)),e.next=9;break;case 8:e.prev=8,A=e.catch(6),o.A.log("Unable to initialize session: ",A);case 9:e.next=11;break;case 10:return e.next=11,h();case 11:if(o.A.log("Authentication Init | isAuthenticated:",a),o.A.log("Authentication Init | accessToken:",u),!a||!i.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(y=null,l&&"object"===(0,s.A)(l)?y=l:c&&(y=au(c)),!((w=null===(g=y)||void 0===g?void 0:g.exp)&&Date.now()/1e3>w)){e.next=13;break}return o.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,El();case 12:a=!1,c="",l={};case 13:if(a||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=15;break}return o.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,bu(!0);case 14:b=e.sent,o.A.log("BlueConic LOWA | bcLowaCheck result:",b),b.isSub?(o.A.log("BlueConic LOWA | authenticated as LOWA"),a=Fc.USER_IS_LOWA,l={sub:b.uuid}):o.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(Iu({isAuthenticated:a,idToken:c,accessToken:u,claims:l}),Nu("authenticationReady"),!0===a?(o.A.log("User is authenticated."),n.searchParams.get("auth_redirect")&&(o.A.log("Auth Redirect is present, sending user to auth redirect..."),(v=n.searchParams.get("auth_redirect")).endsWith("#")&&(v=v.slice(0,v.length)),window.location.assign(v)),n.pathname.startsWith("/login")&&!wl()&&(o.A.log("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(n.origin))):o.A.log("User is not authenticated."),n.pathname.startsWith("/login")&&!wl()?(o.A.log("Page is login. Attempting to log user in..."),kl()):n.pathname.startsWith("/login")&&wl()?(o.A.log("Auth | Connext logout state present",Connext.GetOptions().Silentmode),window.ConnextUtils.rerunConnextEntitlements(!0),setTimeout(function(){var e=new URL(window.location.origin);n.searchParams.get("returnURL")&&(e=decodeURIComponent(n.searchParams.get("returnURL"))),o.A.log("Auth | Connext 300ms logout state expired. Manually reloading page.",Connext.GetOptions().Silentmode),window.location.assign(e)},300)):o.A.log("Page is not login or Connext state is present"),!n.pathname.startsWith("/callback")||!n.searchParams.get("regwall")){e.next=17;break}return o.A.log("Page is callback with regwall param. Routing to regwall receiver..."),e.next=16,Ol();case 16:o.A.log("Now login from regwall"),kl(),e.next=18;break;case 17:if(!n.pathname.startsWith("/callback")){e.next=18;break}return o.A.log("Page is callback without regwall param. Routing to callback receiver..."),e.next=18,Rl();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Cl;var Nl,Ll,xl="1"===window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){Nl||(Nl=e,Ll&&(o.A.log("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",Ll),window.dispatchEvent(Ll)))});var Pl=function(e){ru(Fc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:nu(),expires:365,secure:!0})},Ul=function(){var e=(0,t.A)(r.mark(function e(t){var n,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Pl(t),o.A.log("About to decode token before saving: ",t),n=au(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,ml({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(Fc.LOCAL_STORAGE_SESSION_KEY,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}));case 3:e.next=5;break;case 4:e.prev=4,i=e.catch(0),o.A.log("Entitlements: Failed to save token: ",i);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),Ml=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,c,u,l,d,h,p,f,m;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.log("Entitlements: create token start..."),o.A.log("Entitlements: createToken payload with ",t),"object"===(0,s.A)(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,a=tu(n),t.sub&&(c=t.sub),t.idToken&&(u=t.idToken),u||c){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return l={publication:a.replace("vipdev.lndo.site","com"),requestSource:"website"},u?l.idToken=u:c&&(l.uuid=c),d="".concat(i.A.entitlementsEndpoint,"session/create"),o.A.log("Entitlements: create payload",l),e.prev=3,e.next=4,$.ajax({type:"POST",url:d,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":i.A.entitlementsApiKey},data:JSON.stringify(l)});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,o.A.log("Entitlements: Token Created: ",p),e.next=7;break;case 6:p=h.jwt;case 7:return e.next=8,Ul(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,f=e.catch(3),o.A.log("Entitlements: Create Token Failure: ",f),Su(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,ml({entitlementToken:null});case 11:e.next=13;break;case 12:e.prev=12,m=e.catch(10),o.A.error("Entitlements: Save Session Failure during error handling: ",m);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)}}();xl||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY));return null!=t?(o.A.log("Ad Free Check: : ",t.adFree),(t.idToken||null!==(e=window.MNGAuthentication)&&void 0!==e&&null!==(e=e.authenticationReady)&&void 0!==e&&e.idToken)&&t.adFree||i.A.isAdfreeArticle):i.A.isAdfreeArticle},window.MNGAuthentication.isUserSubscriber=function(){var e=JSON.parse(window.localStorage.getItem(Fc.LOCAL_STORAGE_SESSION_KEY));return null!=e&&(o.A.log("Subscriber Check: : ",e.isEntitled),e.isEntitled)});var Dl=function(e,t){var n=e.toLowerCase(),r="";return["@medianewsgroup.com","@tribpub.com","@activeone.co"].forEach(function(e){t&&t.endsWith(e)&&(r="corporate")}),!!n.includes("employee")&&{employeeAccess:!0,accessGroup:r}},Bl=function(e){return new Promise(function(t,n){o.A.log("Entitlements: get UUID from email start...");var r=su(),a=tu(),s="".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(e,"?all=true&spoofUser=true&domain=").concat(a);$.ajax({type:"GET",url:s,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":i.A.entitlementsApiKey}}).then(function(e){o.A.log("Entitlements: Request successful: ",e);var n=e&&e.identities&&e.identities.find(function(e){return r?"Trib"===e.connection.split("-")[0]:"Trib"!==e.connection.split("-")[0]});if(!n)return o.A.log("Entitlements: No matching user identity found."),t(!1);var i=JSON.stringify(e),a=btoa(encodeURIComponent(i));localStorage.setItem("spoofed-user-profile",a);var s={uuid:n.user_id,provider:n.provider};return t(s)}).catch(function(e){o.A.error("Entitlements: UUID request Failure: ",e),n(e)})})},Hl=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){var n=Connext,r={},i=!1,a=setTimeout(function(){i=!0,clearInterval(s),t(new Error("Timeout: User state did not change within the specified time"))},2e4),s=setInterval(function(){var t=n.Storage.GetUserState();o.A.log("Employee tools: Checking Connext UserState, state is: ".concat(t)),void 0!==t&&"Logged Out"!==t&&(r.conversation=n.Storage.GetCurrentConversation().Name,r.userState=t,r.campaign=n.Storage.GetLocalConfiguration().Campaign.Name,r.meter=n.Storage.GetLocalConfiguration().DynamicMeter.Name,clearInterval(s),clearTimeout(a),e(r))},600);i&&(clearInterval(s),t(new Error("Timeout: User state did not change within the specified time")))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),jl=function(){function e(t,n,r){(0,Xc.A)(this,e),this.source=t,this.email=n,this.employeeId=r,this.spoofContent=document.createElement("p"),this.spoofBanner=document.createElement("div")}return(0,Jc.A)(e,[{key:"clearSpoofedUser",value:(a=(0,t.A)(r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return document.getElementById("spoof-banner").remove(),this.userSpoofCheckbox.checked=!1,e.deleteLocalStorageSpoofUser(),t.next=1,Ml({sub:this.employeeId,email:this.email,email_verified:!0});case 1:if(n=t.sent,!window.authentication_config.sessionManagementEnabled){t.next=3;break}return t.next=2,pl();case 2:return t.next=3,ml({idToken:this.idToken,entitlementToken:n});case 3:window.sessionStorage.removeItem("dashboard-state"),window.location.reload();case 4:case"end":return t.stop()}},t,this)})),function(){return a.apply(this,arguments)})},{key:"handleUserSpoofAction",value:(i=(0,t.A)(r.mark(function t(n){var i,a,s,c,u,l,d;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o.A.log("employee tools: handling spoof"),t.next=1,Au();case 1:if(i=t.sent,a=i.idToken,s=localStorage.getItem(Fc.USER_PROFILE_HASH),!n.target.checked){t.next=12;break}if(c=window.prompt("Enter the email of the user you want to spoof:")){t.next=2;break}return n.target.checked=!1,t.abrupt("return");case 2:return this.userSpoofCheckbox.checked=!0,this.addSpoofBannerToPage("Fetching entitlements for ".concat(c," ..."),"greenyellow"),t.prev=3,t.next=4,Bl(c);case 4:if(u=t.sent,o.A.log("employee tools: spoof user data: ",u),u&&"string"==typeof u.uuid){t.next=5;break}return this.spoofBanner.style.backgroundColor="red",this.spoofContent.textContent="User could not be found with that address, check for typos.",this.userSpoofCheckbox.checked=!1,t.abrupt("return");case 5:return t.next=6,Ml({sub:"".concat(u.provider,"|").concat(u.uuid),email:c,email_verified:!0});case 6:if(l=t.sent,!window.authentication_config.sessionManagementEnabled){t.next=9;break}return t.next=7,pl();case 7:return t.next=8,ml({idToken:a,entitlementToken:l});case 8:e.deleteLocalStorageManualExpiration();case 9:window.localStorage.setItem("spoof-user",c),window.sessionStorage.removeItem("dashboard-state"),e.removeUserProfileHash(s),window.location.reload(),t.next=11;break;case 10:t.prev=10,d=t.catch(3),o.A.log("Error fetching user spoof entitlements",d),this.spoofBanner.style.backgroundColor="red",this.spoofContent.textContent="Error fetching user entitlements",this.userSpoofCheckbox.checked=!1;case 11:t.next=13;break;case 12:return e.deleteLocalStorageManualExpiration(),e.removeUserProfileHash(s),t.next=13,this.clearSpoofedUser();case 13:case"end":return t.stop()}},t,this,[[3,10]])})),function(e){return i.apply(this,arguments)})},{key:"addEventListeners",value:function(){document.getElementById("user-spoof-control").addEventListener("click",this.handleUserSpoofAction.bind(this)),document.getElementById("expiration-control").addEventListener("change",function(t){var n=document.getElementById("datepicker-wrapper");!0===t.currentTarget.checked?n.classList.contains("show-picker")||n.classList.add("show-picker"):(n.classList.contains("show-picker")&&n.classList.remove("show-picker"),window.localStorage.getItem("manual-expiration")&&(window.localStorage.removeItem("manual-expiration"),clearInterval(e.interval),document.getElementById("expiration-pop-up").remove()))})}},{key:"addSpoofBannerToPage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deeppink";o.A.log("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:(n=(0,t.A)(r.mark(function n(){var i,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,k,_,R,O,I;return r.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(window.MNGAuthentication.logoutCallbacks.push(e.deleteLocalStorageSpoofUser),i=window.localStorage.getItem("spoof-user"),a=window.localStorage.getItem("manual-expiration"),s=Dl(this.source,this.email),o.A.log("employee tools: validate employee:",s),this.email&&this.employeeId&&(i||!this.source||s.employeeAccess&&"corporate"===s.accessGroup)&&(this.source||i)){n.next=1;break}return n.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(i," 🤫"),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",(A=document.createElement("button")).id="reset-exp-btn",A.className="expiration-btn",(E=v.appendChild(document.createElement("span"))).className="tooltiptext",E.textContent="Apply date",(S=A.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,A),document.getElementById("employee-debugger").append(u,l),T=JSON.parse(localStorage.getItem("__MNG_Session")),k=au(T.entitlementToken),_=new Date(1e3*T.expiration),R=new Date(1e3*k.session_exp),b.value=_.toISOString().replace(/.\d+Z$/g,""),(O=document.createElement("div")).style.padding="5px 0px 0px 10px",O.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),O.append(t),n.addEventListener("click",function(){var e=n.nextElementSibling;"block"===e.style.display?(e.style.display="none",r.style.display="inline",o.style.display="none"):(e.style.display="block",o.style.display="inline",r.style.display="none")}),i.addEventListener("click",function(){var t=document.getElementById("".concat(e,"_value")).innerHTML;navigator.clipboard&&navigator.clipboard.writeText(t)})}),(I=document.createElement("div")).style.padding="5px 0px 0px 10px",I.innerHTML='\n\t\t\t\t

Connext answer

\n\t\t\t\t',document.addEventListener("onInit",(0,t.A)(r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof Connext){e.next=1;break}(t=document.createElement("p")).className="connext-error-message",t.innerHTML="Something went wrong, reload may solve the issue.",I.append(t),e.next=3;break;case 1:return e.next=2,Hl();case 2:n=e.sent,Object.keys(n).forEach(function(e){var t=document.createElement("div");t.className="list-content";var r=document.createElement("p");r.className="collapsible-list",r.innerHTML="\n\t\t\t\t".concat(e,'\n\t\t\t\t+\n\t\t\t\t\n\t\t\t\t');var o=r.firstChild.nextElementSibling;o.style.display="inline";var i=r.lastChild.previousElementSibling,a=document.createElement("small");a.className="obj-value",a.innerHTML='⤷ ').concat(n[e],""),t.append(r,a),I.append(t),r.addEventListener("click",function(){var e=r.nextElementSibling;"block"===e.style.display?(e.style.display="none",o.style.display="inline",i.style.display="none"):(e.style.display="block",i.style.display="inline",o.style.display="none")}),a.addEventListener("click",function(){var t=document.getElementById("".concat(e,"_value")).innerHTML;navigator.clipboard&&navigator.clipboard.writeText(t)})});case 3:case"end":return e.stop()}},e)}))),document.getElementById("employee-debugger-content").append(d,O,I),document.getElementById("employee-debugger-toggles").append(h),document.getElementById("employee-spoof-wrapper").append(p,this.userSpoofCheckbox),document.getElementById("employee-debugger-button").addEventListener("click",function(){console.log("clicked debugger");var e=document.getElementById("employee-debugger");e.classList.toggle("employee-debugger-close"),e.classList.contains("employee-debugger-close")?e.style.top="50%":e.style.top="20%"}),!i&&this.source&&this.source.toLowerCase().includes("employee")&&ol(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee",t.style.color="blue"}),i&&(this.addSpoofBannerToPage(f),this.userSpoofCheckbox.checked=!0,ol(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee (spoofing)",t.style.color="blue"})),document.getElementById("apply-exp-btn").addEventListener("click",function(){var t,n=null===(t=new Date(b.value))||void 0===t?void 0:t.getTime(),r=Math.floor(n/1e3);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(),a&&(this.datePickerCheckbox.click(),e.timeLeftPopUp(T.expiration));case 2:case"end":return n.stop()}},n,this)})),function(){return n.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"),o.A.log("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(Fc.USER_PROFILE_HASH)}}]);var n,i,a}(),Gl=function(){var e=(0,t.A)(r.mark(function e(t,n){var i,a,s;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.A.log("Employee Tools: employeeAds: "),i=Dl(t,n),o.A.log("employee tools: validate employee:",i),"corporate"===i.accessGroup&&i.employeeAccess){e.next=1;break}return e.abrupt("return",!1);case 1:return e.next=2,fu();case 2:return(a=document.createElement("div")).id="employee-debugger-adfree",a.innerHTML='\n\t\t\n\t\t\n\t\t

(page will reload)

\n\t',document.getElementById("employee-debugger-toggles").append(a),(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){o.A.log("employee tools: employee ad toggle clicked"),e.target.checked?(o.A.log("Employee tools: employee ads: turn off"),localStorage.setItem("hhsl","access"),window.MNGAuthentication.isUserAdFree=!0,setTimeout(function(){window.location.reload()},500)):(o.A.log("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 Wl,Kl,Fl,Xl,Jl,Zl=[],Vl=iu();Vl=Vl.replace("local","com");var zl="".concat(i.A.entitlementsEndpoint,"newsletters"),Yl=function(e){var t=new Date,n=Math.round(t.getTime()/1e3)-86400;return new Date(e)>=new Date(1e3*n).getTime()},ql=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s,c;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=zl,"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,Kc({method:t.method,url:n,headers:{"X-Api-Key":i.A.entitlementsApiKey},data:t.dataToSend});case 2:a=e.sent,"get"===t.method&&((Zl=a.data.responseData).sort(function(e,t){return e.title>t.title?1:-1}),"limited"===Kl?(s=Zl.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:Zl})),nd()),e.next=4;break;case 3:e.prev=3,c=e.catch(1),o.A.log("newsletter: ",c);case 4:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Ql=function(){var e,t,n=navigator.userAgent,r=/^((?!chrome|android).)*safari/i.test(n),o=/Chrome/.test(n);return r?"calc(100vh - 8.5rem)":o?"calc(100vh - ".concat((e=window.innerHeight,(t=(window.screen.height-e)/16)>0?t:0),"rem)"):"calc(100vh - 64px)"},$l=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,Zl.find(function(e){return e.id===o}).isSubscribed=i,t.method=i?"post":"delete",t.dataToSend={email:Wl,domain:Vl,preferenceId:o},td(t)},ed=function(e){e.stopPropagation();var t,n,r=e.target;if(r.matches("span")||r.matches("label")){var o,i=r.closest("div"),a=i.querySelector(".newsletter-icon"),s="block"===(o=i.classList.contains("show-digisubs-push")?document.querySelector("#newsLetterItem-push"):document.querySelector("#newsLetterContent-dropdown")).style.display,c=document.querySelector(".wrapper-nav-subs.pushnav.pushnav-right"),u=/iPad|iPhone|iPod/.test(navigator.userAgent),l=/Android/i.test(navigator.userAgent);s?(a.classList.remove("icon-arrow-down"),a.classList.add("icon-arrow-right"),o.style.display="none",""!==c.style.height&&(c.style.height="")):(a.classList.remove("icon-arrow-right"),a.classList.add("icon-arrow-down"),o.style.display="block",u&&window.innerHeight=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)||""!==c.style.height||(c.style.height=Ql())))}},td=function(e){localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:Fl,newsLetterData:Zl})),ql({method:e.method,dataToSend:e.dataToSend})},nd=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",ed),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",ed);var i=n.cloneNode(!0);i.classList.add("show-digisubs-push","newsletter-dropdown-title"),i.style.display="flex",i.addEventListener("click",ed),n.classList.add("dropdown-item"),e.before(n),t.before(i);var a=document.createElement("li");a.classList.add("dropdown-item-newsletter","explainer-text");var s=document.createElement("p");s.classList.add("info-icon");var c=window.btoa('\n\t\tinfo\n\t\t\n\t\t\n\t\t\n\t'),u="url(data:image/svg+xml;base64,".concat(c,")");s.style.background=u;var l=document.createElement("p"),d=document.createElement("a"),h=Cu();d.setAttribute("href","https://myaccount.".concat(h)),d.setAttribute("id","myAccountLink"),d.textContent="MyAccount",l.appendChild(document.createTextNode("Manage your newsletters here or visit ")),l.appendChild(d),l.appendChild(document.createTextNode(" for more information")),a.append(s),a.append(l);var p=a.cloneNode(!0);e.append(a),t.append(p);var f,m,g,y=(f={},Zl.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(Jl," Newsletters:")):g=["".concat(Jl," Newsletters:")].concat(ol(g)),g);y["".concat(Jl," 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(Jl," 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",$l),Xl&&(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",$l),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 rd=function(e,t,n,r){if(Wl=e,Kl=t,Jl=r,Xl=n){ku("userNewsLetterData");for(var i=document.getElementById("newsLetterContent-dropdown"),a=document.getElementById("newsLetterItem-push");i.firstChild;)i.firstChild.remove();for(;a.firstChild;)a.firstChild.remove()}if(o.A.log("host for newsletter prefs",Vl),localStorage.getItem("userNewsLetterData")){var s=JSON.parse(localStorage.getItem("userNewsLetterData"));Fl=s.expoDate,Yl(Fl)?(Zl=s.newsLetterData,nd()):ql({method:"get",dataToSend:{email:Wl,domain:Vl}})}else ql({method:"get",dataToSend:{email:Wl,domain:Vl}})};var od=function(){var e=Fu()?Fu().querySelector(Hu):null,t=Fu();null!==e&&t.removeChild(e)},id=function(){var e=(0,t.A)(r.mark(function e(t){var n,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E,S,T,k,_,R,O,I,C,N,L,x,P,U,M,D,B,H,j,G,W,K,F,X,J,Z,V,z,Y,q,Q,$,ee,te,ne,re,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ye,we,be,ve,Ae,Ee,Se,Te,ke,_e,Re,Oe;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.authenticatedStatus,a=t.email,s=t.nickname,c=t.picture,u=t.connectionSource,l=t.entitlementSource,d=t.entitlementOrganization,h=t.entitlementLevel,p=t.serviceCode,f=t.isEedition,m=t.accountHref,g=t.userId,y="",w=" | Logged in with ",b=[],v=a,A=Pu(p),E=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!==a&&"undefined"!==a&&a&&!a.endsWith("@example.com")||(v=s||"Logged In"),S=null==u?void 0:u.replace("Trib-","").toLowerCase(),o.A.log("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 w+="Google",e.abrupt("continue",6);case 3:return w+="Facebook",e.abrupt("continue",6);case 4:return w+="Apple",e.abrupt("continue",6);case 5:return w="",e.abrupt("continue",6);case 6:Re=h,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 y="Limited Access",e.abrupt("continue",13);case 8:return y="Standard Digital Access",e.abrupt("continue",13);case 9:return y=A?"Standard Digital Access":"Premium Ad-Free Access",e.abrupt("continue",13);case 10:return y="Standard Digital Trial",e.abrupt("continue",13);case 11:return y="Partner Access",e.abrupt("continue",13);case 12:return y="Anonymous",e.abrupt("continue",13);case 13:if(n===Fc.USER_IS_LOWA&&(w="",y="Anonymous"),f&&p&&p.includes("P")&&(y="Limited Subscription - e-Edition access"),d&&(y="".concat("Standard Digital Access"===y?"Access":"Premium Ad-Free Access"===y?"Ad-Free Access":y," provided by ").concat(d)),od(),Zu().style.display="none",Ju().dataset.status="logged-in",(k=zu()).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"),O=document.getElementById("pushnav-icon"),R.className="rounded-circle",R.alt="Profile image",O.className="rounded-circle",R.src=c,O.src=c,c||(R.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png",O.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png"),(I=document.createElement("span")).className="icon-arrow-down",I.id="icon-caret",I.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),H=null,n!==Fc.USER_IS_LOWA?((H=document.createElement("a")).className="dropdown-item dropdown-profile account-link",H.text=v):document.getElementById("push-email-link").style.display="none",n===Fc.USER_IS_LOWA&&((j=document.createElement("li")).className="dropdown-item log-in-button subscribe-special custom-button",G=document.createElement("a"),W=$c(),G.href="/login?returnUrl=".concat(W),G.target="_blank",G.text="Complete Log In",G.style.cursor="pointer",G.style.margin="0",G.style.width="auto"),K=ad('\n\t\t\t'),F=E(a),(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"),J=rl(),Z=tu(),V="https://checkout.".concat(Z),J){V=J.href,o.A.log("Original sub URL: ",V);try{(z=new URL(V)).searchParams.has("newUser")||z.searchParams.set("newUser","true"),V=z.toString()}catch(e){o.A.log("Error processing subscription URL: ",e)}}for(Y="subscriber"===h||"premium"===h?"\n\t\t\t\t
\n\t\t\t\t\t
".concat(s||"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(s||"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
"),q=ad(Y),X.appendChild(q),(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(y,'
\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=ad($),Q.appendChild(ee),i.A.enableReaderDashboardLink&&((M=document.createElement("a")).className="dropdown-item",M.id="reader-dashboard-link",M.setAttribute("data-mng-click","reader-dashboard"),M.setAttribute("data-mng-category","account-link"),M.setAttribute("data-mng-action","reader-dashboard"),i.A.enableReaderDashboardv2?M.href="".concat(U.origin,"/dashboard"):(M.target="_blank",M.href="".concat(U.origin,"/user-tools/dashboard")),te=ad('\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Reader Dashboard
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
'),M.appendChild(te)),i.A.enableGiftedArticlesLink&&((D=document.createElement("a")).className="dropdown-item",D.setAttribute("data-mng-click","gifted-articles"),D.setAttribute("data-mng-category","account-link"),D.setAttribute("data-mng-action","gifted-articles"),i.A.enableReaderDashboardv2?D.href="".concat(U.origin,"/dashboard/gifted-articles"):(D.href="".concat(U.origin,"/user-tools/dashboard/#shared-articles-container"),D.target="_blank"),ne="subscriber"===h?'\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=ad(ne),D.appendChild(re)),i.A.enableSavedArticlesLink&&((B=document.createElement("a")).className="dropdown-item",i.A.enableReaderDashboardv2?B.href="".concat(U.origin,"/dashboard/saved-articles"):(B.href="".concat(U.origin,"/user-tools/dashboard/#saved-article-container"),B.target="_blank"),oe="subscriber"===h?"\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"===h?'\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=ad(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=ad('\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=ad("\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=ad("\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,I),j&&document.getElementById("account-content").append(j),he=[K,X].concat(ol(M?[M]:[]),[Q],ol(D?[D]:[]),ol(B?[B]:[]),[ae,ce,le]),(T=document.getElementById("account-content")).append.apply(T,ol(he)),document.getElementById("push-auth-source").textContent="".concat(y).concat(w),document.getElementById("push-email-link").textContent=v,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",i.A.enableReaderDashboardv2?pe.href="".concat(U.origin,"/dashboard"):pe.href="".concat(U.origin,"/user-tools/dashboard"),document.querySelector("#push-account-link").after(pe)),o.A.log("Employee tools: start tools here",l,a,g),!1===(fe=l)&&(fe="none"),(me=new jl(fe,a,g)).init(),Gl(fe,a),i.A.newslettersEnabled&&h&&(ge=v,ye=!1,me.userSpoofCheckbox&&(ye=me.userSpoofCheckbox.checked),localStorage.getItem("spoof-user")&&(ge=localStorage.getItem("spoof-user")),!0===n&&rd(ge,h,ye,L)),we=document.getElementById("account-content"),be=document.querySelector(".search-icon-wrapper"),ve=function(){var e=we.classList.contains("show");I.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())}),b=document.getElementsByClassName("account-link"),Ae=0;Ae0&&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(),o.A.log("MutationObserver disconnected: All relevant elements processed or conditions not met."))}},{key:"startObserving",value:(e=(0,t.A)(r.mark(function e(){var t,n=this,i=arguments;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:document.body,e.next=1,pu();case 1:o.A.log("ContentObserver: Starting observation process."),this.observer.observe(t,{childList:!0,subtree:!0}),o.A.log("MutationObserver started for ".concat(t.tagName||"document.body"," elements.")),Object.entries(this.targetsToWatch).forEach(function(e){var r=l(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}();var ud=new cd,ld=function(){var e=(0,t.A)(r.mark(function e(){var t,n,o,a,s,c,u,l,d,h,p,f,m,g,y,w,b;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n="Naviga",o="",a="Anonymous",s=!1,c=!1,u="",!i.A.entitlementsEnabled){e.next=2;break}return e.next=1,Eu();case 1:(l=e.sent)&&l.token&&(d=l.token,h=au(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||"",o=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:o,entitlementLevel:a,serviceCode:s,isEedition:c,tokenEmail:u});case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),dd=function(){var e=(0,t.A)(r.mark(function e(t){var n,o,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=$c(),o=t.querySelector("a"),(i=new URL(o.href)).searchParams.set("returnUrl",encodeURIComponent("".concat(n.href,"?newUser=true"))),o.setAttribute("href",i.href);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),hd=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))?(o.A.log("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))},pd=function(){var e=(0,t.A)(r.mark(function e(t){var n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.accountHref,tl().forEach(function(e){var t=e;t.querySelector("a").textContent="My Account",t.querySelector("a").setAttribute("href",n)});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),fd=function(e){try{void 0!==window.MNGAuthentication&&("keydown"===e.type&&"Enter"===e.key||"click"===e.type)&&(e.preventDefault(),window.MNGAuthentication.logout())}catch(e){o.A.log(e)}},md=function(e){o.A.log("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)},gd=function(){o.A.log("UIHandler: ","show logout buttons"),md("engageLogoutLink"),document.querySelectorAll(Hu).forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.addEventListener("click",fd),t.addEventListener("keydown",fd)})},yd=function(){o.A.log("UIHandler: ","show login buttons"),md("engageLoginLink"),tl().forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.querySelector("a").textContent="Log in";var n=new URL(t.querySelector("a").href),r=new URLSearchParams(n);r.append("returnUrl",$c()),t.querySelector("a").setAttribute("href","".concat(n,"?").concat(r))})},wd=function(){var e=(0,t.A)(r.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,g,y,w,b,v,A,E;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.A.log("UIHandler: ","setup"),e.next=1,Il();case 1:return t=e.sent,n=t.authenticated,a=t.email,s=t.picture,c=t.connectionSource,u=t.userId,l=t.nickname,e.next=2,ld();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=hd({siteUrl:Cu()}),!n){e.next=6;break}if(!i.A.dropdownEnabled){e.next=4;break}return n===Fc.USER_IS_LOWA||a&&!a.includes("@example.com")||(a=w),e.next=3,sd({authenticatedStatus:n,email:a,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,pd({entitlementSource:p,siteUrl:iu(),accountHref:b});case 5:gd(),e.next=7;break;case 6:yd();case 7:v=Qu(),h?(nl().forEach(function(e){e.style.display="none"}),v&&(v.style.display="none")):(nl().forEach(function(e){var t=e;t.style.display="block",dd(t)}),v&&(v.style.display="flex",A=$c(),(E=new URL(v.getAttribute("href"))).searchParams.set("returnUrl",encodeURIComponent(A.href)),v.setAttribute("href",E.href)));case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bd=function(){var e=zu();e&&(e.style.display="block",e.style.visibility="visible");var t=zu()?zu().querySelector("a"):null;t&&(t.textContent="Loading..."),Ju().dataset.status="logged-out"},vd=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return bd(),e.next=1,wd();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 Ad=function(){var e=(0,t.A)(r.mark(function e(){var t,n,i,a;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,du();case 1:return e.next=2,gu();case 2:if("article"===e.sent){e.next=3;break}return o.A.log("addArticleContentObservers: Non-article page detected, leaving."),e.abrupt("return");case 3:return e.next=4,mu("Paywall_Level");case 4:return t=e.sent,e.next=5,ld();case 5:n=e.sent,i=n.userIsEntitled,a=n.entitlementLevel,ud.addTargetsFromObject({"stn-player":{selector:".stn-player",condition:i&&"premium"===a,action:function(e){o.A.log("addArticleContentObservers: Send to news player found. Hiding for adfree user.");var t=e.parentNode;t&&(t.style.display="none")}},bxc:{selector:".bxc",condition:i&&"premium"===a,action:function(e){o.A.log("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()}}}),ud.addTargetsFromObject({".article-bottom-share":{selector:".article-bottom-share",condition:!0,action:function(e){o.A.log("addArticleContentObservers: Bottom article share buttons found, updating styles."),e.style.margin="0 auto"}}}),ud.addTargetsFromObject({"wp-remixd-voice-wrapper":{selector:".wp-remixd-voice-wrapper",condition:"premium"===t&&!i,action:function(e){o.A.log("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)}}(),Ed=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,hu();case 1:return(0,t.A)(r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Ad();case 1:return e.next=2,ud.startObserving();case 2:e.next=4;break;case 3:e.prev=3,t=e.catch(0),o.A.log("Error: Failed to start ContentObserver:",t);case 4:case"end":return e.stop()}},e,null,[[0,3]])}))(),e.next=2,vd();case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Sd=function(){var e=(0,t.A)(r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Ed();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();Sd()})()})(); //# sourceMappingURL=mng-digisubs.uiHandler.bundle.js.map;