PageSourceSearch

https://www.dailyfreeman.com/_static/??-eJylzLEKgDAMBNAf0qaKIA7i6m…5PHKMHFnPzXSjiaG9gfaIh91Xa61o1uu+UCv0ZxFw==

js dailyfreeman.com collected 2026-09-24 17:34:16 UTC 1,374,934 bytes, 12 lines download raw bytes

vendor: 4,755 bytes, lines 1-2
1/*! For license information please see mng-digisubs.main.bundle.js.LICENSE.txt */
2(()=>{var e={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 o=n(5546);function r(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,r,i,a){var s=r&&r.prototype instanceof l?r:l,c=Object.create(s.prototype);return o(c,"_invoke",function(e,o,r){var i,a,s,c=0,l=r||[],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,o){for(a=e,s=o,n=0;!d&&c&&!r&&n<l.length;n++){var r,i=l[n],p=h.p,f=i[2];e>3?(r=f===o)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((r=e<2&&p<i[1])?(a=0,h.v=o,h.n=i[1]):p<f&&(r=e<3||i[0]>o||o>f)&&(i[4]=e,i[5]=o,h.n=f,a=0))}if(r||e>1)return u;throw d=!0,o}return function(r,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||(r="next"),n=i[r]){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 '"+r+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(o,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]())):(o(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,o(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,o(f,"constructor",h),o(h,"constructor",d),d.displayName="GeneratorFunction",o(h,s,"GeneratorFunction"),o(f),o(f,s,"Generator"),o(f,a,function(){return this}),o(f,"toString",function(){return"[object Generator]"}),(e.exports=r=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var o=n(887);e.exports=function(e,t,n,r,i){var a=o(e,t,n,r,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 o=n(6993),r=n(1791);e.exports=function(e,t,n,i,a){return new r(o().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var o=n(5172),r=n(5546);e.exports=function e(t,n){function i(e,r,a,s){try{var c=t[e](r),u=c.value;return u instanceof o?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||(r(e.prototype),r(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(e,t,o){function r(){return new n(function(t,n){i(e,o,t,n)})}return a=a?a.then(r,r):r()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,o,r,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,o,r){function i(n,o){t(e,n,function(e){return this._invoke(n,o,e)})}n?a?a(e,n,{value:o,enumerable:!r,configurable:!r,writable:!r}):e[n]=o:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,o,r,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 o in t)n.unshift(o);return function e(){for(;n.length;)if((o=n.pop())in t)return e.value=o,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var o=n(5172),r=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=r(),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(o){t||(t={stop:function(){return n(o.a,2)},catch:function(){return o.v},abrupt:function(e,t){return n(o.a,p[e],t)},delegateYield:function(e,r,i){return t.resultName=r,n(o.d,u(e),i)},finish:function(e){return n(o.f,e)}},n=function(e,n,r){o.p=t.prev,o.n=t.next;try{return e(n,r)}finally{t.next=o.n}}),t.resultName&&(t[t.resultName]=o.v,t.resultName=void 0),t.sent=o.v,t.next=o.n;try{return e.call(this,t)}finally{o.p=t.prev,o.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,o,r){return t.w(f(e),n,o,r&&r.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new o(e,t)}
2,AsyncIterator:s,async:function(e,t,n,o,r){return(h(t)?a:i)(f(e),t,n,o,r)},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 o=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(o(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 o=n(4633)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},467(e,t,n){"use strict";function o(e,t,n,o,r,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(o,r)}function r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function s(e){o(a,r,i,s,c,"next",e)}function c(e){o(a,r,i,s,c,"throw",e)}s(void 0)})}}n.d(t,{A:()=>r})},3029(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>o})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var o=n(9922);function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(0,o.A)(r.key),r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}},4467(e,t,n){"use strict";n.d(t,{A:()=>r});var o=n(9922);function r(e,t,n){return(t=(0,o.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:()=>r});var o=n(2284);function r(e,t){if("object"!=(0,o.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=(0,o.A)(r))return r;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 o=n(2284),r=n(2327);function i(e){var t=(0,r.A)(e,"string");return"symbol"==(0,o.A)(t)?t:t+""}},2284(e,t,n){"use strict";function o(e){return o="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},o(e)}n.d(t,{A:()=>o})},1834(e,t,n){"use strict";var o=n(467),r=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,r.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,o.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",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,r=this.readyInstances.get(n);if(r)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(r.status,".")),"pending"===r.status&&o<r.timeoutMs&&(c.A.log("Shorter timeout of ".concat(o,"ms requested, replacing existing ").concat(r.timeoutMs,"ms timeout.")),clearTimeout(r.timeout),r.timeoutMs=o,r.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void r.resolveOnce(!0);
2c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),r.resolveOnce(!1)},o)),r.promise;c.A.log('Creating new connext ready promise for "'.concat(n,'" with timeout of ').concat(o,"ms."));var i={promise:null,timeout:null,status:"pending",timeoutMs:o,resolveOnce:null};return i.promise=new Promise(function(e){var r=!1;if(i.resolveOnce=function(t){r||(i.status=t,e(t),r=!0,i.timeout&&(clearTimeout(i.timeout),i.timeout=null))},"undefined"!=typeof Connext&&"onInit"===n)return c.A.log('Connext already ready for event "'.concat(n,'".')),t.removeEventListener(n),void i.resolveOnce(!0);i.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void i.resolveOnce(!0);c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),i.resolveOnce(!1)},o),c.A.log('Listening for Connext event "'.concat(n,'"...'));var a=function(){c.A.log('Connext event "'.concat(n,'" fired!')),t.removeEventListener(n),i.resolveOnce(!0)};document.addEventListener(n,a),t.eventListeners[n]=a,c.A.log('Connext added event listener for "'.concat(n,'"'))}),this.readyInstances.set(n,i),i.promise}},{key:"runConnext",value:function(){"undefined"!=typeof Connext&&(c.A.log("Running Connext now..."),Connext.Run(),this.connextAlreadyRan=!0,this.runConnextIfSilentTimer&&clearTimeout(this.runConnextIfSilentTimer))}},{key:"rerunConnextEntitlements",value:(n=(0,o.A)(s.mark(function t(){var n,o,r=arguments;return s.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>0&&void 0!==r[0]&&r[0],o=r.length>1&&void 0!==r[1]&&!r[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",o);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,o.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;n.d(t,["A",0,l])},3153(e,t,n){"use strict";var o=n(3612);const r={log:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}}};n.d(t,["A",0,r])},3612(e,t,n){"use strict";var o,r,i,a,s;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===(o=window.authentication_config)||void 0===o?void 0:o.articleSharingEnabled)&&"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.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.linaC
2heckOnArticles,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,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var r=t[o++],i=t[o++],a=0===i?{enumerable:!0,value:t[o++]}:{enumerable:!0,get:i};n.o(e,r)||Object.defineProperty(e,r,a)}else 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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>Ql,hasStandardBrowserEnv:()=>ed,hasStandardBrowserWebWorkerEnv:()=>td,navigator:()=>$l,origin:()=>nd});var t=n(467),o=n(4756),r=n(3612),i=n(3153),a=n(2284);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(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 l=n(4467);function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}
2class h extends Error{}function p(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function f(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function m(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function g(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function w(e,t){this.v=e,this.k=t}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function v(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function b(e){return new w(e,0)}function A(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function S(e,t){return e.get(v(e,t))}function _(e,t,n){A(e,t),t.set(e,n)}function E(e,t,n){return e.set(v(e,t),n),n}function T(e,t){A(e,t),t.add(e)}function k(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e){return function(){return new P(e.apply(this,arguments))}}function P(e){var t,n;function o(t,n){try{var i=e[t](n),a=i.value,s=a instanceof w;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return o(c,n);n=e[c](n).value}r(!!i.done,n)},function(e){o("throw",e)})}catch(e){r(2,e)}}function r(e,r){2===e?t.reject(r):t.resolve({value:r,done:e}),(t=t.next)?o(t.key,t.arg):n=null}this._invoke=function(e,r){return new Promise(function(i,a){var s={key:e,arg:r,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,o(e,r))})},"function"!=typeof e.return&&(this.return=void 0)}h.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,P.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},P.prototype.next=function(e){return this._invoke("next",e)},P.prototype.throw=function(e){return this._invoke("throw",e)},P.prototype.return=function(e){return this._invoke("return",e)};const x={timeoutInSeconds:60},L=1e4,U="memory",M="Multifactor authentication required",D="online_access",j={name:"auth0-spa-js",version:"2.27.0"},W=()=>Date.now(),G="default";class K extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,K.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new K(t,n)}}class B extends K{constructor(e,t){super("invalid_configuration","".concat(e," ").concat(t)),this.suggestion=t,Object.setPrototypeOf(this,B.prototype)}}class F extends K{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=o,Object.setPrototypeOf(this,F.prototype)}}class H extends K{constructor(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=o,this.appState=r,Object.setPrototypeOf(this,H.prototype)}}class X extends K{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,X.prototype)}}class J extends X{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,J.prototype)}}class z extends K{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,z.prototype)}}class V extends K{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,V.prototype)}}class Y extends K{constructor(e,t,n,o){super(e,t),this.mfa_token=n,this.mfa_requirements=o,Object.setPrototypeOf(this,Y.prototype)}}class Z extends K{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat($(e,["default"]),"', scope: '").concat($(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,Z.prototype)}}class q extends K{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat($(e,["default"]),"', missing scope: '").concat($(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,q.prototype)}}class Q extends K{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,Q.prototype)}}function $(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const ee=()=>window.crypto,te=()=>{let e="";for(;e.length<43;){const t=ee().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},ne=e=>btoa(e),oe=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],re=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,o)=>{if(t&&"env"===o)return n;const r=oe.find(e=>e.key===o);return r&&r.type.includes(typeof e[o])&&(n[o]=e[o]),n},{})},ie=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()},ae=async e=>{const t=ee().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},se=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),ce=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 ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},le={},de={};
2Object.defineProperty(de,"__esModule",{value:!0});var he=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var o=e.locked.get(t);void 0===o?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(o.unshift(n),e.locked.set(t,o))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,o){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 o=n.pop();e.locked.set(t,n),void 0!==o&&setTimeout(o,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();de.default=function(){return he.getInstance()};var pe=ue&&ue.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})},fe=ue&&ue.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},me=ue;
2Object.defineProperty(le,"__esModule",{value:!0});var ge=de,we="browser-tabs-lock-key",ye={key:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},clear:function(){return pe(me,void 0,void 0,function(){return fe(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function ve(e){return new Promise(function(t){return setTimeout(t,e)})}function be(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var Ae=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+be(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),pe(this,void 0,void 0,function(){var o,r,i,a,s,c,u;return fe(this,function(l){switch(l.label){case 0:o=Date.now()+be(4),r=Date.now()+n,i=we+"-"+t,a=void 0===this.storageHandler?ye:this.storageHandler,l.label=1;case 1:return Date.now()<r?[4,ve(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+o,[4,ve(Math.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:o,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,ve(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===o?(this.acquiredIatSet.add(o),this.refreshLockWhileAcquired(i,o),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?ye:this.storageHandler),[4,this.waitForSomethingToChange(r)];case 6:l.sent(),l.label=7;case 7:return o=Date.now()+be(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return pe(this,void 0,void 0,function(){var n=this;return fe(this,function(o){return setTimeout(function(){return pe(n,void 0,void 0,function(){var n,o,r;return fe(this,function(i){switch(i.label){case 0:return[4,ge.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?ye:this.storageHandler,null===(o=n.getItemSync(e))?(ge.default().unlock(t),[2]):((r=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(r)),ge.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(ge.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return pe(this,void 0,void 0,function(){return fe(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var o=!1,r=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!o){o=!0;var t=50-(Date.now()-r);t>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 pe(this,void 0,void 0,function(){return fe(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 pe(this,void 0,void 0,function(){var n,o,r,i;return fe(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?ye:this.storageHandler,o=we+"-"+t,null===(r=n.getItemSync(o))?[2]:(i=JSON.parse(r)).id!==this.id?[3,2]:[4,ge.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(o),ge.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,o=t,r=[],i=0;;){var a=o.keySync(i);if(null===a)break;r.push(a),i++}for(var s=!1,c=0;c<r.length;c++){var u=r[c];if(u.includes(we)){var l=o.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(o.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),Se=le.default=Ae;class _e{async runWithLock(e,t,n){const o=new AbortController,r=setTimeout(()=>
2o.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:o.signal},async e=>{if(clearTimeout(r),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(r),"AbortError"===(null==e?void 0:e.name))throw new X;throw e}}}class Ee{constructor(){this.activeLocks=new Set,this.lock=new Se,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let o=!1;for(let n=0;n<10&&!o;n++)o=await this.lock.acquireLock(e,t);if(!o)throw new X;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 Te=null;function ke(){return Te||(Te=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new _e:new Ee;var e}()),Te}const Re=new TextEncoder,Oe=new TextDecoder;function Ce(e){return"string"==typeof e?Re.encode(e):Oe.decode(e)}function Ie(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new Le(`${e.name} modulusLength must be at least 2048 bits`)}let Ne;if(Uint8Array.prototype.toBase64)Ne=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Ne=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Pe(e){return Ne(e)}class xe extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class Le extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}function Ue(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new xe("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(e){if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new xe("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(e){if("P-256"===e.algorithm.namedCurve)return"ES256";throw new xe("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new xe("unsupported CryptoKey algorithm name")}}function Me(e){return e instanceof CryptoKey}function De(e){return Me(e)&&"public"===e.type}async function je(e,t,n,o,r,i){const a=null==e?void 0:e.privateKey,s=null==e?void 0:e.publicKey;if(!Me(c=a)||"private"!==c.type)throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!De(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==s.extractable)throw new TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw new TypeError('"htu" must be a string');if("string"!=typeof n)throw new TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw new TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw new TypeError('"accessToken" must be a string or undefined');if(void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)))throw new TypeError('"additional" must be an object');const u=Object.assign(Object.create(null),i,{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:o,htu:t,ath:r?Pe(await crypto.subtle.digest("SHA-256",Ce(r))):void 0});return async function(e,t,n){if(!1===n.usages.includes("sign"))throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const o=`${Pe(Ce(JSON.stringify(e)))}.${Pe(Ce(JSON.stringify(t)))}`;return`${o}.${Pe(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Ie(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Ie(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new xe}(n),n,Ce(o)))}`}({alg:Ue(a),typ:"dpop+jwt",jwk:await We(s)},u,a)}async function We(e){const{kty:t,e:n,n:o,x:r,y:i,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:o,x:r,y:i}}const Ge="dpop-nonce",Ke=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","urn:okta:params:oauth:grant-type:webauthn","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-rec
2overy-code"];const Be=(e,t)=>new Promise(function(n,o){const r=new MessageChannel;r.port1.onmessage=function(e){e.data.error?o(new Error(e.data.error)):n(e.data),r.port1.close()},t.postMessage(e,[r.port2])}),Fe=(e,t,n)=>{const o=new AbortController;let r;return t.signal=o.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{r=setTimeout(()=>{o.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},He=async function(e,t,n,o,r,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:L;return r?(async(e,t,n,o,r,i,a,s,c,u)=>Be({type:"refresh",auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:o,useFormData:a,useMrrt:s,skipTokenStorage:c,preserveRefreshToken:u},i))(e,t,n,o,a,r,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0,arguments.length>9?arguments[9]:void 0):(async(e,t,n)=>{const o=await Fe(e,t,n);return{ok:o.ok,json:await o.json(),headers:(r=o.headers,[...r].reduce((e,t)=>{let n=I(t,2),o=n[0],r=n[1];return e[o]=r,e},{}))};var r})(e,o,a)};async function Xe(e,t,n,o,r,i,a,s,c,u,l,d){if(c){const t=await c.generateProof({url:e,method:r.method||"GET",nonce:await c.getNonce()});r.headers=Object.assign(Object.assign({},r.headers),{dpop:t})}let h,p=null;for(let c=0;c<3;c++)try{h=await He(e,n,o,r,i,a,t,s,l,d),p=null;break}catch(e){p=e}if(p)throw p;const m=h.json,g=m.error,w=m.error_description,y=f(m,["error","error_description"]),v=h,b=v.headers,A=v.ok;let S;if(c&&(S=b[Ge],S&&await c.setNonce(S)),!A){const h=w||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===g)throw new Y(g,h,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===g)throw new Z(n,o);if("use_dpop_nonce"===g){if(!c||!S||u)throw new Q(S);return Xe(e,t,n,o,r,i,a,s,c,!0,l,d)}throw new K(g||"request_error",h)}return y}async function Je(e,t,n){var o=e.baseUrl,r=e.timeout,i=e.audience,a=e.scope,s=e.auth0Client,c=e.useFormData,u=e.useMrrt,l=e.dpop,d=e.preserveRefreshToken,h=f(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop","preserveRefreshToken"]);const p="urn:ietf:params:oauth:grant-type:token-exchange"===h.grant_type,m="urn:okta:params:oauth:grant-type:webauthn"===h.grant_type,g="refresh_token"===h.grant_type&&u,w=p||m||g,y=Object.assign(Object.assign(Object.assign({},h),w&&i&&{audience:i}),w&&a&&{scope:a}),v=m||!c,b=v?JSON.stringify(y):ie(y),A=(S=h.grant_type,Ke.includes(S));var S;return await Xe("".concat(o,"/oauth/token"),r,i||G,a,{method:"POST",body:b,headers:{"Content-Type":v?"application/json":"application/x-www-form-urlencoded","Auth0-Client":btoa(JSON.stringify(re(s||j)))}},t,c,u,A?l:void 0,void 0,n,d)}const ze=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(o=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(o))).join(" ");var o},Ve=(e,t,n)=>{let o;return n&&(o=e[n]),o||(o=e[G]),ze(o,t)},Ye="@@auth0spajs@@",Ze="@@user@@";class qe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ye,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=I(e.split("::"),4),n=t[0],o=t[1],r=t[2],i=t[3];return new qe({clientId:o,scope:i,audience:r},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,o=e.client_id;return new qe({scope:t,audience:n,clientId:o})}}class Qe{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(Ye))}}class $e{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class et{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||W}async setIdToken(e,t,n){var o;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(o=this.keyManifest)||void 0===o?void 0:o.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0;var r;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const r=this.matchExistingCacheKey(e,t);
2if(r&&(i=await this.cache.get(r),a=qe.fromKey(r)),!i&&n&&"cache-only"!==o)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/1e3);return i.expiresAt-t<c?i.body.refresh_token?this.modifiedCachedEntry(i,a):(await this.cache.remove(a.toKey()),void await(null===(r=this.keyManifest)||void 0===r?void 0:r.remove(a.toKey()))):i.body}async modifiedCachedEntry(e,t){const n={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},o={body:n,expiresAt:e.expiresAt};return await this.cache.set(t.toKey(),o),{refresh_token:n.refresh_token,audience:n.audience,scope:n.scope}}async set(e){var t;const n=new qe({clientId:e.client_id,scope:e.scope,audience:e.audience}),o=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),o),await(null===(t=this.keyManifest)||void 0===t?void 0:t.add(n.toKey()))}async remove(e,t,n){const o=new qe({clientId:e,scope:n,audience:t});await this.cache.remove(o.toKey())}async stripRefreshToken(e){var t;const n=await this.getCacheKeys();if(n)for(const o of n){const n=await this.cache.get(o);(null===(t=null==n?void 0:n.body)||void 0===t?void 0:t.refresh_token)===e&&(delete n.body.refresh_token,await this.cache.set(o,n))}}async clear(e){var t;const n=await this.getCacheKeys();n&&(await n.filter(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 qe({clientId:e},Ye,Ze).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const o=qe.fromKey(t),r=new Set(o.scope&&o.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=o.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return o.prefix===Ye&&o.clientId===e.clientId&&o.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const o of t){const t=qe.fromKey(o);if(t.prefix===Ye&&t.clientId===e.clientId){const e=await this.cache.get(o);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 o=await this.getCacheKeys();if(!o)return[];const r=new Set;for(const i of o){const o=qe.fromKey(i);if(o.prefix===Ye&&o.clientId===t&&o.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)&&r.add(e.body.refresh_token)}}return Array.from(r)}async updateEntry(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await this.getCacheKeys();if(r)for(const i of r){if(qe.fromKey(i).clientId!==n)continue;const r=await this.cache.get(i);if(!(null==r?void 0:r.body))continue;const a=r.body.refresh_token;a&&(o||a===e)&&(r.body.refresh_token=t,await this.cache.set(i,r))}}}class tt{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 nt=e=>"number"==typeof e,ot=["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 rt=ue&&ue.__assign||function(){return rt=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},rt.apply(this,arguments)};function it(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}var at=function(e){return function(e){for(var t={},n=e?e.split("; "):[],o=/(%[\dA-F]{2})+/gi,r=0;r<n.length;r++){var i=n[r].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}(document.cookie)[e]};function st(e,t,n){document.cookie=function(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decode
2URIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return it("Expires",e.expires?e.expires.toUTCString():"")+it("Domain",e.domain)+it("Path",e.path)+it("Secure",e.secure)+it("SameSite",e.sameSite)}(n)}(e,t,rt({path:"/"},n))}var ct=st,ut=function(e,t){st(e,"",rt(rt({},t),{expires:-1}))};const lt={get(e){const t=at(e);if(void 0!==t)return JSON.parse(t)},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),ct(e,JSON.stringify(t),o)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),ut(e,n)}},dt="_legacy_",ht={get:e=>lt.get(e)||lt.get("".concat(dt).concat(e)),save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),ct("".concat(dt).concat(e),JSON.stringify(t),o),lt.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),ut(e,n),lt.remove(e,t),lt.remove("".concat(dt).concat(e),t)}},pt={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 ft;!function(e){e.Code="code",e.ConnectCode="connect_code"}(ft||(ft={}));var mt,gt=function(e){return mt=mt||function(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,i=n.length;r<i;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),i=r.indexOf("\n",10)+1,a=r.substring(i)+(o?"//# sourceMappingURL="+o:""),s=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(s)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQpeyhudWxsPT10fHx0PmUubGVuZ3RoKSYmKHQ9ZS5sZW5ndGgpO2Zvcih2YXIgcj0wLG89QXJyYXkodCk7cjx0O3IrKylvW3JdPWVbcl07cmV0dXJuIG99ZnVuY3Rpb24gdCh0LHIpe3JldHVybiBmdW5jdGlvbihlKXtpZihBcnJheS5pc0FycmF5KGUpKXJldHVybiBlfSh0KXx8ZnVuY3Rpb24oZSx0KXt2YXIgcj1udWxsPT1lP251bGw6InVuZGVmaW5lZCIhPXR5cGVvZiBTeW1ib2wmJmVbU3ltYm9sLml0ZXJhdG9yXXx8ZVsiQEBpdGVyYXRvciJdO2lmKG51bGwhPXIpe3ZhciBvLG4scyxhLGk9W10sYz0hMCxsPSExO3RyeXtpZihzPShyPXIuY2FsbChlKSkubmV4dCwwPT09dCl7aWYoT2JqZWN0KHIpIT09cilyZXR1cm47Yz0hMX1lbHNlIGZvcig7IShjPShvPXMuY2FsbChyKSkuZG9uZSkmJihpLnB1c2goby52YWx1ZSksaS5sZW5ndGghPT10KTtjPSEwKTt9Y2F0Y2goZSl7bD0hMCxuPWV9ZmluYWxseXt0cnl7aWYoIWMmJm51bGwhPXIucmV0dXJuJiYoYT1yLnJldHVybigpLE9iamVjdChhKSE9PWEpKXJldHVybn1maW5hbGx5e2lmKGwpdGhyb3cgbn19cmV0dXJuIGl9fSh0LHIpfHxmdW5jdGlvbih0LHIpe2lmKHQpe2lmKCJzdHJpbmciPT10eXBlb2YgdClyZXR1cm4gZSh0LHIpO3ZhciBvPXt9LnRvU3RyaW5nLmNhbGwodCkuc2xpY2UoOCwtMSk7cmV0dXJuIk9iamVjdCI9PT1vJiZ0LmNvbnN0cnVjdG9yJiYobz10LmNvbnN0cnVjdG9yLm5hbWUpLCJNYXAiPT09b3x8IlNldCI9PT1vP0FycmF5LmZyb20odCk6IkFyZ3VtZW50cyI9PT1vfHwvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChvKT9lKHQscik6dm9pZCAwfX0odCxyKXx8ZnVuY3Rpb24oKXt0aHJvdyBuZXcgVHlwZUVycm9yKCJJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLiIpfSgpfWNsYXNzIHIgZXh0ZW5kcyBFcnJvcntjb25zdHJ1Y3RvcihlLHQpe3N1cGVyKHQpLHRoaXMuZXJyb3I9ZSx0aGlzLmVycm9yX2Rlc2NyaXB0aW9uPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsci5wcm90b3R5cGUpfXN0YXRpYyBmcm9tUGF5bG9hZChlKXtsZXQgdD1lLmVycm9yLG89ZS5lcnJvcl9kZXNjcmlwdGlvbjtyZXR1cm4gbmV3IHIodCxvKX19Y2xhc3MgbyBleHRlbmRzIHJ7Y29uc3RydWN0b3IoZSx0KXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIiwiTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyIuY29uY2F0KG4oZSxbImRlZmF1bHQiXSksIicsIHNjb3BlOiAnIikuY29uY2F0KG4odCksIicpIikpLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsby5wcm90b3R5cGUpfX1mdW5jdGlvbiBuKGUpe3JldHVybiBlJiYhKGFyZ3VtZW50cy5sZW5ndGg+MSYmdm9pZCAwIT09YXJndW1lbnRzWzFdP2FyZ3VtZW50c1sxXTpbXSkuaW5jbHVkZXMoZSk/ZToiIn0iZnVuY3Rpb24iPT10eXBlb2YgU3VwcHJlc3NlZEVycm9yJiZTdXBwcmVzc2VkRXJyb3I7Y29uc3Qgcz1lPT57dmFyIHQ9ZS5jbGllbnRJZCxyPWZ1bmN0aW9uKGUsdCl7dmFyIHI9e307Zm9yKHZhciBvIGluIGUpT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbykmJnQuaW5kZXhPZihvKTwwJiYocltvXT1lW29dKTtpZihudWxsIT1lJiYiZnVuY3Rpb24iPT10eXBlb2YgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyl7dmFyIG49MDtmb3Iobz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO248by5sZW5ndGg7bisrKXQuaW5kZXhPZihvW25dKTwwJiZPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLmNhbGwoZSxvW25dKSYmKHJbb1tuXV09ZVtvW25dXSl9cmV0dXJuIHJ9KGUsWyJjbGllbnRJZCJdKTtyZXR1cm4gbmV3IFVSTFNlYXJjaFBhcmFtcygoZT0+T2JqZWN0LmtleXMoZSkuZmlsdGVyKHQ9PnZvaWQgMCE9PWVbdF0pLnJlZHVjZSgodCxyKT0+T2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHQpLHtbcl06ZVtyXX0pLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmc
2oKX07bGV0IGE9e30saT1udWxsO2NvbnN0IGM9KGUsdCk9PiIiLmNvbmNhdChlLCJ8IikuY29uY2F0KHQpLGw9KGUsdCk9PnQuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSx1PShlLHQpPT5hW2MoZSx0KV0sZj1lPT57T2JqZWN0LmVudHJpZXMoYSkuZm9yRWFjaChyPT57bGV0IG89dChyLDIpLG49b1swXTtvWzFdPT09ZSYmZGVsZXRlIGFbbl19KX0saD1lPT57Y29uc3QgdD1uZXcgVVJMU2VhcmNoUGFyYW1zKGUpLHI9e307cmV0dXJuIHQuZm9yRWFjaCgoZSx0KT0+e3JbdF09ZX0pLHJ9LGQ9YXN5bmMgZT0+e2xldCByLG4saT1lLmRhdGEsZj1pLnRpbWVvdXQsZD1pLmF1dGgscD1pLmZldGNoVXJsLHk9aS5mZXRjaE9wdGlvbnMsZz1pLnVzZUZvcm1EYXRhLGI9aS51c2VNcnJ0LE89aS5za2lwVG9rZW5TdG9yYWdlLGs9aS5wcmVzZXJ2ZVJlZnJlc2hUb2tlbixtPXQoZS5wb3J0cywxKVswXSxqPXt9O2NvbnN0IHY9ZHx8e30sXz12LmF1ZGllbmNlLHc9di5zY29wZTt0cnl7Y29uc3QgZT1nP2goeS5ib2R5KTpKU09OLnBhcnNlKHkuYm9keSk7aWYoZS5yZWZyZXNoX3Rva2VufHwicmVmcmVzaF90b2tlbiIhPT1lLmdyYW50X3R5cGUpZS5tZmFfdG9rZW4mJihuPXUoXyx3KSwhbiYmYiYmKG49YS5sYXRlc3RfcmVmcmVzaF90b2tlbikpO2Vsc2V7aWYobj11KF8sdyksIW4mJmIpe2NvbnN0IGU9YS5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+ISFPYmplY3Qua2V5cyhhKS5maW5kKHI9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09cil7Y29uc3Qgbz1sKHQsciksbj1yLnNwbGl0KCJ8IilbMV0uc3BsaXQoIiAiKSxzPWUuc3BsaXQoIiAiKS5ldmVyeShlPT5uLmluY2x1ZGVzKGUpKTtyZXR1cm4gbyYmc319KSkodyxfKTtlJiYhdCYmKG49ZSl9aWYoIW4pdGhyb3cgbmV3IG8oXyx3KTt5LmJvZHk9Zz9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpfWxldCBpLGQ7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGk9bmV3IEFib3J0Q29udHJvbGxlcix5LnNpZ25hbD1pLnNpZ25hbCk7dHJ5e2Q9YXdhaXQgUHJvbWlzZS5yYWNlKFsoUD1mLG5ldyBQcm9taXNlKGU9PnNldFRpbWVvdXQoZSxQKSkpLGZldGNoKHAsT2JqZWN0LmFzc2lnbih7fSx5KSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBtLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZClyZXR1cm4gaSYmaS5hYm9ydCgpLHZvaWQgbS5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtpZihVPWQuaGVhZGVycyxqPVsuLi5VXS5yZWR1Y2UoKGUscik9PntsZXQgbz10KHIsMiksbj1vWzBdLHM9b1sxXTtyZXR1cm4gZVtuXT1zLGV9LHt9KSxyPWF3YWl0IGQuanNvbigpLE8pcmV0dXJuIGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4sdm9pZCBtLnBvc3RNZXNzYWdlKHtvazpkLm9rLGpzb246cixoZWFkZXJzOmp9KTtyLnJlZnJlc2hfdG9rZW4/KGImJihhLmxhdGVzdF9yZWZyZXNoX3Rva2VuPXIucmVmcmVzaF90b2tlbixTPW4sTT1yLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVud
2HJpZXMoYSkuZm9yRWFjaChlPT57bGV0IHI9dChlLDIpLG89clswXTtyWzFdPT09UyYmKGFbb109TSl9KSksKChlLHQscik9PnthW2ModCxyKV09ZX0pKHIucmVmcmVzaF90b2tlbixfLHcpLGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4pOmt8fCgoZSx0KT0+e2RlbGV0ZSBhW2MoZSx0KV19KShfLHcpLG0ucG9zdE1lc3NhZ2Uoe29rOmQub2ssanNvbjpyLGhlYWRlcnM6an0pfWNhdGNoKGUpe20ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmp9KX12YXIgUyxNLFUsUH0scD1hc3luYyBlPT57bGV0IHI9ZS5kYXRhLG89ci50aW1lb3V0LG49ci5hdXRoLGk9ci5mZXRjaFVybCxjPXIuZmV0Y2hPcHRpb25zLHU9ci51c2VGb3JtRGF0YSxkPXQoZS5wb3J0cywxKVswXTtjb25zdCBwPShufHx7fSkuYXVkaWVuY2U7dHJ5e2NvbnN0IGU9KGU9Pntjb25zdCByPW5ldyBTZXQ7cmV0dXJuIE9iamVjdC5lbnRyaWVzKGEpLmZvckVhY2gobz0+e2xldCBuPXQobywyKSxzPW5bMF0sYT1uWzFdO2woZSxzKSYmci5hZGQoYSl9KSxBcnJheS5mcm9tKHIpfSkocCk7aWYoMD09PWUubGVuZ3RoKXJldHVybiB2b2lkIGQucG9zdE1lc3NhZ2Uoe29rOiEwfSk7Y29uc3Qgcj11P2goYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7Zm9yKGNvbnN0IHQgb2YgZSl7Y29uc3QgZT11P3MoT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHIpLHt0b2tlbjp0fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7dG9rZW46dH0pKTtsZXQgbixhLGwsaDsiZnVuY3Rpb24iPT10eXBlb2YgQWJvcnRDb250cm9sbGVyJiYobj1uZXcgQWJvcnRDb250cm9sbGVyLGE9bi5zaWduYWwpO3RyeXtoPWF3YWl0IFByb21pc2UucmFjZShbbmV3IFByb21pc2UoZT0+e2w9c2V0VGltZW91dChlLG8pfSksZmV0Y2goaSxPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sYykse2JvZHk6ZSxzaWduYWw6YX0pKV0pLmZpbmFsbHkoKCk9PmNsZWFyVGltZW91dChsKSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIWgpcmV0dXJuIG4mJm4uYWJvcnQoKSx2b2lkIGQucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7aWYoIWgub2spe2xldCBlO3RyeXtjb25zdCB0PUpTT04ucGFyc2UoYXdhaXQgaC50ZXh0KCkpO2U9dC5lcnJvcl9kZXNjcmlwdGlvbn1jYXRjaChlKXt9cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZXx8IkhUVFAgZXJyb3IgIi5jb25jYXQoaC5zdGF0dXMpfSl9Zih0KX1kLnBvc3RNZXNzYWdlKHtvazohMH0pfWNhdGNoKGUpe2QucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZXx8IlVua25vd24gZXJyb3IgZHVyaW5nIHRva2VuIHJldm9jYXRpb24ifSl9fSx5PShlLHQpPT57aWYoIWkpcmV0dXJuITE7dHJ5e2NvbnN0IHI9bmV3IFVSTChpKS5vcmlnaW4sbz1uZXcgVVJMKGUuZmV0Y2hVcmwpO3JldHVybiBvLm9yaWdpbj09PXImJm8ucGF0aG5hbWU9PT10fWNhdGNoKGUpe3JldHVybiExfX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZT0+e2NvbnN0IHI9ZS5kYXRhLG89dChlLnBvcnRzLDEpWzBdO2lmKCEoInR5cGUiaW4gcil8fCJpbml0IiE9PXIudHlwZSlyZXR1cm4idHlwZSJpbiByJiYiY2xlYXIiPT09ci50eXBlPyhhPXt9LHZvaWQobnVsbD09b3x8by5wb3N0TWVzc2FnZSh7b2s6ITB9KSkpOiJ0eXBlImluIHImJiJyZXZva2UiPT09ci50eXBlP3kociwiL29hdXRoL3Jldm9rZSIpP3ZvaWQgcChlKTp2b2lkKG51bGw9PW98fG8ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSkpOnZvaWQoImZldGNoVXJsImluIHImJnkociwiL29hdXRoL3Rva2VuIik/ZChlKTpudWxsPT1vfHxvLnBvc3RNZXNzYWdlKHtvazohMSxqc29uOntlcnJvcjoiaW52YWxpZF9mZXRjaF91cmwiLGVycm9yX2Rlc2NyaXB0aW9uOiJVbmF1dGhvcml6ZWQgZmV0Y2ggVVJMIn0saGVhZGVyczp7fX0pKTtpZihudWxsPT09aSl0cnl7bmV3IFVSTChyLmFsbG93ZWRCYXNlVXJsKSxpPXIuYWxsb3dlZEJhc2VVcmx9Y2F0Y2goZSl7cmV0dXJufX0pfSgpOwoK",null,false),new Worker(mt,e)};class wt{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return"".concat(Ye,"::").concat(e)}}const yt="auth0.is.authenticated",vt={memory:()=>(new $e).enclosedCache,localstorage:()=>new Qe},bt=e=>vt[e],At=e=>{const t=e.openUrl,n=e.onRedirect,o=f(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},o),{openUrl:!1===t||t?t:n})},St={NONCE:"nonce",KEYPAIR:"keypair"};class _t{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(St).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 o=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>
2{o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(St.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(St.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(St.NONCE,this.buildKey(e))}findKeyPair(){return this.find(St.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(St.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(St.KEYPAIR,this.clientId)}}class Et{constructor(e){this.storage=new _t(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 o;return o={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(o,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,o=e.method,r=e.nonce,i=e.accessToken;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return je(t,a,o,r,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!De(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await We(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new xe("unsupported JWK kty")}return Pe(await crypto.subtle.digest({name:"SHA-256"},Ce(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var Tt;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Tt||(Tt={}));class kt{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)),o=e instanceof Request?new Request(n,e):n;return new Request(o,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Tt.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),o=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",o)}async prepareRequest(e,t){const n=await this.getAccessToken(t);if(void 0===n)throw new K("missing_access_token","No access token available");let o,r;"string"==typeof n?(o=this.config.dpopNonceId?Tt.DPoP:Tt.Bearer,r=n):(o=n.token_type,r=n.access_token),this.setAuthorizationHeader(e,r,o),o===Tt.DPoP&&await this.setDpopProofHeader(e,r)}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,Ge);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new Q(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,o){const r=this.buildBaseRequest
2(e,t);await this.prepareRequest(r,o);const i=await this.config.fetch(r);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const o={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},o),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,o,n)}}class Rt{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)},{scope:["create:me:connected_accounts"]});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)},{scope:["create:me:connected_accounts"]});return this._handleResponse(t)}async getFactors(){const e=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/factors"),{method:"GET"},{scope:["read:me:factors"]});return(await this._handleResponse(e)).factors}async getAuthenticationMethods(e){const t=e?"?".concat(new URLSearchParams({type:e})):"",n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods").concat(t),{method:"GET"},{scope:["read:me:authentication_methods"]});return(await this._handleResponse(n)).authentication_methods}async getAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"GET"},{scope:["read:me:authentication_methods"]});return this._handleResponse(t)}async deleteAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"DELETE"},{scope:["delete:me:authentication_methods"]});t.ok||await this._handleResponse(t)}async updateAuthenticationMethod(e,t){const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},{scope:["update:me:authentication_methods"]});return this._handleResponse(n)}async enrollmentChallenge(e){var t;const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:authentication_methods"]}),o=await this._handleResponse(n),r=null!==(t=n.headers.get("location"))&&void 0!==t?t:"",i=decodeURIComponent(r.split("/").pop()||"");return Object.assign(Object.assign({},o),{id:i,location:r})}async enrollmentVerify(e){const t=e,n=t.location;t.type;const o=f(t,["location","type"]),r=await this.myAccountFetcher.fetchWithAuth("".concat(n,"/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},{scope:["create:me:authentication_methods"]});return this._handleResponse(r)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Ot({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Ot(t)}}class Ot extends Error{constructor(e){let t=e.type,n=e.status,o=e.title,r=e.detail,i=e.validation_errors;super(r),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=o,this.detail=r,this.validation_errors=i,Object.setPrototypeOf(this,Ot.prototype)}}const Ct={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var It,Nt;let Pt;if("undefined"==typeof navigator||null===(It=navigator.userAgent)||void 0===It||null===(Nt=It.startsWith)||void 0===Nt||!Nt.call(It,"Mozilla/5.0 ")){const e="v3.8.6";Pt="".concat("oauth4webapi","/").concat(e)}function xt(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 Lt="ERR_INVALID_ARG_VALUE",Ut="ERR_INVALID_ARG_TYPE";function Mt(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}const Dt=Symbol(),jt=Symbol(),Wt=Symbol(),Gt=Symbol(),Kt=Symbol(),Bt=Symbol(),Ft=new TextEncoder,Ht=new TextDecoder;function Xt(e){return"string"==typeof e?Ft.encode(e):Ht.decode(e)}let Jt,zt;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 o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Vt(e){return"string"==typeof e?zt(e):Jt(e)}zt=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Mt("The input to be decoded is not correctly encoded.",Lt,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw Mt("The input to be decoded is not correctly encoded.",Lt,e)}};
2class Yt extends Error{constructor(e,t){var n;super(e,t),k(this,"code",void 0),this.name=this.constructor.name,this.code=$n,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Zt extends Error{constructor(e,t){var n;super(e,t),k(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function qt(e,t,n){return new Zt(e,{code:t,cause:n})}function Qt(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function $t(e){xt(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Pt&&!t.has("user-agent")&&t.set("user-agent",Pt),t.has("authorization"))throw Mt('"options.headers" must not include the "authorization" header name',Lt);return t}function en(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw Mt('"options.signal" must return or be an instance of AbortSignal',Ut);return t}}function tn(e){return e.includes("//")?e.replace("//","/"):e}function nn(e,t,n,o,r){try{if("number"!=typeof e||!Number.isFinite(e))throw Mt("".concat(n," must be a number"),Ut,r);if(e>0)return;if(t){if(0!==e)throw Mt("".concat(n," must be a non-negative number"),Lt,r);return}throw Mt("".concat(n," must be a positive number"),Lt,r)}catch(e){if(o)throw qt(e.message,o,r);throw e}}function on(e,t,n,o){try{if("string"!=typeof e)throw Mt("".concat(t," must be a string"),Ut,o);if(0===e.length)throw Mt("".concat(t," must not be empty"),Lt,o)}catch(e){if(n)throw qt(e.message,n,o);throw e}}function rn(e){!function(e,t){if(Pn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(o.length>2){const e=o.pop();t+="".concat(o.join(", "),", or ").concat(e)}else 2===o.length?t+="".concat(o[0]," or ").concat(o[1]):t+=o[0];return qt(t,ro,e)}(e,t)}(e,"application/json")}function an(){return Vt(crypto.getRandomValues(new Uint8Array(32)))}function sn(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 Yt("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 Yt("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 Yt("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 Yt("unsupported CryptoKey algorithm name",{cause:e})}}function cn(e){const t=null==e?void 0:e[jt];return"number"==typeof t&&Number.isFinite(t)?t:0}function un(e){const t=null==e?void 0:e[Wt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function ln(){return Math.floor(Date.now()/1e3)}function dn(e){if("object"!=typeof e||null===e)throw Mt('"as" must be an object',Ut);on(e.issuer,'"as.issuer"')}function hn(e){if("object"!=typeof e||null===e)throw Mt('"client" must be an object',Ut);on(e.client_id,'"client.client_id"')}function pn(e){return on(e,'"clientSecret"'),(t,n,o,r)=>{o.set("client_id",n.client_id),o.set("client_secret",e)}}function fn(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&on(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},o=n.key,r=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Mt("".concat(t," must be a CryptoKey"),Ut)}(e,t),"private"!==e.type)throw Mt("".concat(t," must be a private CryptoKey"),Lt)}(o,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:sn(o),kid:r},u=function(e,t){const n=ln()+cn(t);return{jti:an(),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[Kt])||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 Mt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Lt);const o="".concat(Vt(Xt(JSON.stringify(e))),".").concat(Vt(Xt(JSON.stringify(t)))),r=Vt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:wo(e)};case"RSA-PSS":switch(go(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 Yt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return go(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Yt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Xt(o)));return"".concat(o,".").concat(r)}(c,u,o))}}const mn=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function gn(e,t){if(t&&"https:"!==e.protocol)throw qt("only requests to HTTPS are allowed",ao,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw qt("only HTTP and HTTPS requests are allowed",so,e)}function wn(e,t,n,o){let r;if("string"!=typeof e||!(r=mn(e)))throw qt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?ho:po,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return gn(r,o),r}function yn(e,t,n,o){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?wn(e.mtls_endpoint_aliases[t],t,n,o):wn(e[t],t,n,o)}
2class vn extends Error{constructor(e,t){var n;super(e,t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"error",void 0),k(this,"status",void 0),k(this,"error_description",void 0),k(this,"response",void 0),this.name=this.constructor.name,this.code=Qn,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 bn extends Error{constructor(e,t){var n,o;super(e,t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"error",void 0),k(this,"error_description",void 0),this.name=this.constructor.name,this.code=eo,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===(o=Error.captureStackTrace)||void 0===o||o.call(Error,this,this.constructor)}}class An extends Error{constructor(e,t){var n;super(e,t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"response",void 0),k(this,"status",void 0),this.name=this.constructor.name,this.code=qn,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 Sn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",_n="("+Sn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',En="("+Sn+")\\s*=\\s*("+Sn+")",Tn=new RegExp("^[,\\s]*("+Sn+")"),kn=new RegExp("^[,\\s]*"+_n+"[,\\s]*(.*)"),Rn=new RegExp("^[,\\s]*"+En+"[,\\s]*(.*)"),On=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Cn(e,t,n){if(e.status!==t){let t;var o;if(Gn(e),t=await async function(e){if(e.status>399&&e.status<500){mo(e),rn(e);try{const t=await e.clone().json();if(Qt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(o=e.body)||void 0===o?void 0:o.cancel()),new vn("server responded with an error in the response body",{cause:t,response:e});throw qt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),io,e)}}function In(e){if(!Xn.has(e))throw Mt('"options.DPoP" is not a valid DPoPHandle',Lt)}const Nn=Symbol();function Pn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function xn(e,t,n,o,r){if(dn(e),hn(t),!xt(o,Response))throw Mt('"response" must be an instance of Response',Ut);if(Gn(o),200!==o.status)throw qt('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',io,o);let i;if(mo(o),"application/jwt"===Pn(o)){const n=await yo(await o.text(),vo.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),cn(t),un(t),null==r?void 0:r[Bt]).then(Kn.bind(void 0,t.client_id)).then(Fn.bind(void 0,e)),a=n.claims,s=n.jwt;Dn.set(o,s),i=a}else{if(t.userinfo_signed_response_alg)throw qt("JWT UserInfo Response expected",to,o);i=await _o(o)}if(on(i.sub,'"response" body "sub" property',oo,{body:i}),n===Nn);else if(on(n,'"expectedSubject"'),i.sub!==n)throw qt('unexpected "response" body "sub" property value',lo,{expected:n,body:i,attribute:"sub"});return i}async function Ln(e,t,n,o,r,i,a){return await n(e,t,r,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Gt])||fetch)(o.href,{body:r,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:en(o,null==a?void 0:a.signal)})}async function Un(e,t,n,o,r,i){var a;const s=yn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Dt]));r.set("grant_type",o);const c=$t(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(In(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Ln(e,t,n,s,r,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Mn=new WeakMap,Dn=new WeakMap;function jn(e){if(!e.id_token)return;const t=Mn.get(e);if(!t)throw Mt('"ref" was already garbage collected or did not resolve from the proper sources',Lt);return t}async function Wn(e,t,n,o,r,i){if(dn(e),hn(t),!xt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Cn(n,200,"Token Endpoint"),mo(n);const a=await _o(n);if(on(a.access_token,'"response" body "access_token" property',oo,{body:a}),on(a.token_type,'"response" body "token_type" property',oo,{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;nn(e,!0,'"response" body "expires_in" property',oo,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&on(a.refresh_token,'"response" body "refresh_token" property',oo,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw qt('"response" body "scope" property must be a string',oo,{body:a});if(void 0!==a.id_token){on(a.id_token,'"response" body "id_token" property',oo,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(nn(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=o&&o.length&&i.push(...o);const s=await yo(a.id_token,vo.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),cn(t),un(t),r).then(Vn.bind(void 0,i)).then(Hn.bind(void 0,e)).then(Bn.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 qt('ID Token "aud" (audience) claim includes additional untrusted audiences',uo,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw qt('unexpected ID Token "azp" (authorized party) claim value',uo,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&nn(c.auth_time,!0,'ID Token "auth_time" (authentication time)',oo,{claims:c}),Dn.set(n,u),Mn.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 Yt("unsupported `token_type` value",{cause:{body:a}});return a}function Gn(e){let t;if(t=function(e){if(!xt(e,Response))throw Mt('"response" must be an instance of Response',Ut);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let o=t;for(;o;){var r;let t=o.match(Tn);const c=null===(r=t)||void 0===r?void 0:r[1].toLowerCase();if(!c)return;const u=o.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;o=l?l[1]:void 0;const h={};let p;if(d)for(;o;){let n,r;if(t=o.match(kn)){var i=I(t,4);if(n=i[1],r=i[2],o=i[3],r.includes("\\"))try{r=JSON.parse('"'.concat(r,'"'))}catch(e){}h[n.toLowerCase()]=r}else{if(!(t=o.match(Rn))){if(t=o.match(On)){if(Object.keys(h).length)break;var a=I(t,3);p=a[1],o=a[2];break}return}var s=I(t,4);n=s[1],r=s[2],o=s[3],h[n.toLowerCase()]=r}}else o=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 An("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function Kn(e,t){return void 0!==t.claims.aud?Bn(e,t):t}function Bn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw qt('unexpected JWT "aud" (audience) claim value',uo,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw qt('unexpected JWT "aud" (audience) claim value',uo,{expected:e,claims:t.claims,claim:"aud"});return t}function Fn(e,t){return void 0!==t.claims.iss?Hn(e,t):t}function Hn(e,t){var n,o;const r=null!==(n=null===(o=e[To])||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==r)throw qt('unexpected JWT "iss" (issuer) claim value',uo,{expected:r,claims:t.claims,claim:"iss"});return t}const Xn=new WeakSet,Jn=Symbol(),zn={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 Vn(e,t){for(const n of e)if(void 0===t.claims[n])throw qt('JWT "'.concat(n,'" (').concat(zn[n],") claim missing"),oo,{claims:t.claims});return t}const Yn=Symbol(),Zn=Symbol();const qn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Qn="OAUTH_RESPONSE_BODY_ERROR",$n="OAUTH_UNSUPPORTED_OPERATION",eo="OAUTH_AUTHORIZATION_RESPONSE_E
2RROR",to="OAUTH_JWT_USERINFO_EXPECTED",no="OAUTH_PARSE_ERROR",oo="OAUTH_INVALID_RESPONSE",ro="OAUTH_RESPONSE_IS_NOT_JSON",io="OAUTH_RESPONSE_IS_NOT_CONFORM",ao="OAUTH_HTTP_REQUEST_FORBIDDEN",so="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",co="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",uo="OAUTH_JWT_CLAIM_COMPARISON_FAILED",lo="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",ho="OAUTH_MISSING_SERVER_METADATA",po="OAUTH_INVALID_SERVER_METADATA";async function fo(e){if(!xt(e,Response))throw Mt('"response" must be an instance of Response',Ut);await Cn(e,200,"Revocation Endpoint")}function mo(e){if(e.bodyUsed)throw Mt('"response" body has been used already',Lt)}function go(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Yt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function wo(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 Yt("unsupported ECDSA namedCurve",{cause:e})}}async function yo(e,t,n,o,r){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===r)throw new Yt("JWE decryption is not configured",{cause:e});var d=(e=await r(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw qt("Invalid JWT",oo,e);try{i=JSON.parse(Xt(Vt(c)))}catch(e){throw qt("failed to parse JWT Header body as base64url encoded JSON",no,e)}if(!Qt(i))throw qt("JWT Header must be a top level object",oo,e);if(t(i),void 0!==i.crit)throw new Yt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Xt(Vt(u)))}catch(e){throw qt("failed to parse JWT Payload body as base64url encoded JSON",no,e)}if(!Qt(a))throw qt("JWT Payload must be a top level object",oo,e);const h=ln()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw qt('unexpected JWT "exp" (expiration time) claim type',oo,{claims:a});if(a.exp<=h-o)throw qt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',co,{claims:a,now:h,tolerance:o,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw qt('unexpected JWT "iat" (issued at) claim type',oo,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw qt('unexpected JWT "iss" (issuer) claim type',oo,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw qt('unexpected JWT "nbf" (not before) claim type',oo,{claims:a});if(a.nbf>h+o)throw qt('unexpected JWT "nbf" (not before) claim value',co,{claims:a,now:h,tolerance:o,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw qt('unexpected JWT "aud" (audience) claim type',oo,{claims:a});return{header:i,claims:a,jwt:e}}function vo(e,t,n,o){if(void 0===e)if(Array.isArray(t)){if(!t.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw qt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?o.alg!==n:"function"==typeof n?!n(o.alg):!n.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:n,reason:"default value"})}else if("string"==typeof e?o.alg!==e:!e.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:e,reason:"client configuration"})}function bo(e,t){const n=e.getAll(t),o=n[0];if(n.length>1)throw qt('"'.concat(t,'" parameter must be provided only once'),oo);return o}const Ao=Symbol(),So=Symbol();async function _o(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rn;try{t=await e.json()}catch(t){throw n(e),qt('failed to parse "response" body as JSON',no,t)}if(!Qt(t))throw qt('"response" body must be a top level object',oo,{body:t});return t}const Eo=Symbol(),To=Symbol(),ko=new TextEncoder,Ro=new TextDecoder,Oo=new TextDecoder("utf-8",{fatal:!0});function Co(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(o);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}function Io(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const o=e.charCodeAt(n);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=o}return t}const No=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const Po=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if(o.length>2){const t=o.pop();e+="one of type ".concat(o.join(", "),", or ").concat(t,".")}else 2===o.length?e+="one of type ".concat(o[0]," or ").concat(o[1],"."):e+="of type ".concat(o[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}("Key for the ".concat(e," algorithm must be "),t,...o)};
2class xo extends Error{constructor(e,t){var n;super(e,t),k(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}k(xo,"code","ERR_JOSE_GENERIC");class Lo extends xo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),k(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),k(this,"claim",void 0),k(this,"reason",void 0),k(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}k(Lo,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Uo extends xo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),k(this,"code","ERR_JWT_EXPIRED"),k(this,"claim",void 0),k(this,"reason",void 0),k(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}k(Uo,"code","ERR_JWT_EXPIRED");class Mo extends xo{constructor(){super(...arguments),k(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}k(Mo,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Do extends xo{constructor(){super(...arguments),k(this,"code","ERR_JOSE_NOT_SUPPORTED")}}k(Do,"code","ERR_JOSE_NOT_SUPPORTED"),k(class extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),k(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),k(class extends xo{constructor(){super(...arguments),k(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class jo extends xo{constructor(){super(...arguments),k(this,"code","ERR_JWS_INVALID")}}k(jo,"code","ERR_JWS_INVALID");class Wo extends xo{constructor(){super(...arguments),k(this,"code","ERR_JWT_INVALID")}}k(Wo,"code","ERR_JWT_INVALID"),k(class extends xo{constructor(){super(...arguments),k(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Go extends xo{constructor(){super(...arguments),k(this,"code","ERR_JWKS_INVALID")}}k(Go,"code","ERR_JWKS_INVALID");class Ko extends xo{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),k(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}k(Ko,"code","ERR_JWKS_NO_MATCHING_KEY");class Bo extends xo{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),k(this,Symbol.asyncIterator,N(function*(){})),k(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}k(Bo,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Fo extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),k(this,"code","ERR_JWKS_TIMEOUT")}}k(Fo,"code","ERR_JWKS_TIMEOUT");class Ho extends xo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),k(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}k(Ho,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Xo=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function Jo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const zo="The input to be decoded is not correctly encoded.";function Vo(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Ro.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(zo,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Ro.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(zo);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Jo(t)}catch(e){throw new TypeError(zo)}}function Yo(e){let t=e;return"string"==typeof t&&(t=ko.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Zo(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function qo(e){return Zo(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(Zo)}
2function Qo(e,t,n){try{return Vo(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function $o(e,t){var n,o,r,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new Do('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new Do('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const a=null!==(n=null===(o=e.resolve)||void 0===o?void 0:o.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,s=!(!t.d&&!t.priv),c=O({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,a,null!==(r=t.ext)&&void 0!==r?r:!s,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[s?1:0])}function er(e){return O({__proto__:null},e)}const tr=e=>e[Symbol.toStringTag];function nr(e,t,n){const o=e.alg,r=e.secret,i="decrypt"===n||"sign"===n;if(r&&t instanceof Uint8Array)return[or,t];if(Zo(t)){const a=function(e){const t=er(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof a.kty)throw new TypeError(r?Po(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Po(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(r?"oct"===a.kty&&"string"==typeof a.k:"oct"!==a.kty&&(i?"AKP"===a.kty&&"string"==typeof a.priv||"string"==typeof a.d:void 0===a.d&&void 0===a.priv)))throw new TypeError(r?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const o=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"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!==o)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(o,'" when present'));if(Array.isArray(t.key_ops)){var r;const o="encrypt"===n||"decrypt"===n?null===(r=e.ops)||void 0===r?void 0:r["encrypt"===n?0:1]:n;if(o&&!t.key_ops.includes(o))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(o,'" when present'))}})(e,a,n),[ar,t,a]}if(!(e=>Xo(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(r?Po(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Po(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(r){if("secret"!==t.type)throw new TypeError("".concat(tr(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(tr(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const o="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(tr(t)," instances for asymmetric algorithm ").concat(o,' must be of type "').concat(e,'"'))}}return Xo(t)?[rr,t]:[ir,t]}const or=0,rr=1,ir=2,ar=3;let sr;const cr={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function ur(e,t,n){sr||(sr=new WeakMap);const o=sr.get(e);return n&&(o?o[t]=n:sr.set(e,{[t]:n})),null!=n?n:null==o?void 0:o[t]}const lr=async(e,t,n)=>{var o;return null!==(o=ur(e,n.alg))&&void 0!==o?o:ur(e,n.alg,await $o(n,O(O({},t),{},{alg:n.alg})))};async function dr(e,t,n){const o=nr(e,t,n);switch(o[0]){case or:case rr:return o[1];case ar:{const t=o[1],n=o[2];if("oct"===n.kty)return Vo(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return lr(t,n,e)}case ir:{const t=o[1];
2return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,o,r;const i=ur(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,u=cr[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],l=null!==(o=null===(r=t.resolve)||void 0===r?void 0:r.call(t,{crv:u,asymmetricKeyType:c}))&&void 0!==o?o:t.subtle;return ur(e,t.alg,e.toCryptoKey(l,a,s))})(t,e):lr(t,t.export({format:"jwk"}),e)}}}function hr(e){const t={__proto__:null};for(const n in e)t[n]=O(O({},e[n]),{},{alg:n});return t}const pr=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],fr=[[],["deriveBits"]],mr=[[],[]];function gr(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:pr,ops:["wrapKey","unwrapKey"]}}function wr(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,o=e.asymmetricKeyType;if("X25519"===n||"x25519"===o)return{name:"X25519"};if("OKP"===t)throw new Do('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:fr,ops:[void 0,"deriveBits"]}}function yr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:mr,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function vr(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:mr,ops:["deriveBits","deriveBits"]}}const br=hr({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:mr,ops:["encrypt","decrypt"]},"RSA-OAEP":gr(1),"RSA-OAEP-256":gr(256),"RSA-OAEP-384":gr(384),"RSA-OAEP-512":gr(512),"ECDH-ES":wr(),"ECDH-ES+A128KW":wr(),"ECDH-ES+A192KW":wr(),"ECDH-ES+A256KW":wr(),A128KW:yr(128),A192KW:yr(192),A256KW:yr(256),A128GCMKW:yr(128,!0),A192GCMKW:yr(192,!0),A256GCMKW:yr(256,!0),"PBES2-HS256+A128KW":vr(),"PBES2-HS384+A192KW":vr(),"PBES2-HS512+A256KW":vr()}),Ar=["encrypt","decrypt"];function Sr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:mr,ops:Ar,cekBits:e,ivBits:t?128:96,cbc:t}}hr({A128GCM:Sr(128),A192GCM:Sr(192),A256GCM:Sr(256),"A128CBC-HS256":Sr(256,!0),"A192CBC-HS384":Sr(384,!0),"A256CBC-HS512":Sr(512,!0)});const _r={__proto__:null,b64:!0};function Er(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function Tr(e,t,n,o,r){if(void 0!==r.crit&&void 0===(null==o?void 0:o.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return[];if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:O(O({__proto__:null},n),t);for(const t of o.crit){if(!(t in i))throw new Do('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(r,t)||void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(o,t)||void 0===o[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return o.crit}function kr(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new jo('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Rr,Or;let Cr,Ir;if("undefined"==typeof navigator||null===(Rr=navigator.userAgent)||void 0===Rr||null===(Or=Rr.startsWith)||void 0===Or||!Or.call(Rr,"Mozilla/5.0 ")){const e="v6.8.4";Ir="".concat("openid-client","/").concat(e),Cr={"user-agent":Ir}}const Nr=e=>Pr.get(e);let Pr,xr;function Lr(e){return void 0!==e?pn(e):(xr||(xr=new WeakMap),(e,t,n,o)=>{let r;return(r=xr.get(t))||(function(e,t){if("string"!=typeof e)throw Wr("".concat(t," must be a string"),jr);if(0===e.length)throw Wr("".concat(t," must not be empty"),Dr)}(t.client_secret,'"metadata.client_secret"'),r=pn(t.client_secret),xr.set(t,r)),r(e,t,n,o)})}const Ur=Nn,Mr=Gt,Dr="ERR_INVALID_ARG_VALUE",jr="ERR_INVALID_ARG_TYPE";function Wr(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}
2class Gr extends Error{constructor(e,t){var n;super(e,t),k(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 Kr(e,t,n){return new Gr(e,{cause:t,code:n})}function Br(e){if(e instanceof TypeError||e instanceof Gr||e instanceof vn||e instanceof bn||e instanceof An)throw e;if(e instanceof Zt)switch(e.code){case ao:throw Kr("only requests to HTTPS are allowed",e,e.code);case so:throw Kr("only requests to HTTP or HTTPS are allowed",e,e.code);case io:throw Kr("unexpected HTTP response status code",e.cause,e.code);case ro:throw Kr("unexpected response content-type",e.cause,e.code);case no:throw Kr("parsing error occured",e,e.code);case oo:throw Kr("invalid response encountered",e,e.code);case uo:throw Kr("unexpected JWT claim value encountered",e,e.code);case lo:throw Kr("unexpected JSON attribute value encountered",e,e.code);case co:throw Kr("JWT timestamp claim value failed validation",e,e.code);default:throw Kr(e.message,e,e.code)}if(e instanceof Yt)throw Kr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Kr("runtime operation error",e,$n);case"NotSupportedError":throw Kr("runtime unsupported operation",e,$n);case"TimeoutError":throw Kr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Kr("operation aborted",e,"OAUTH_ABORT")}throw new Gr("something went wrong",{cause:e})}async function Fr(e,t,n,o,r){const i=await async function(e,t){var n,o;if(!(e instanceof URL))throw Wr('"server" must be an instance of URL',jr);const r=!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(r?async function(e,t){return async function(e,t,n,o){if(!(e instanceof URL))throw Mt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Ut);gn(e,!0!==(null==o?void 0:o[Dt]));const r=n(new URL(e.href)),i=$t(null==o?void 0:o.headers);return i.set("accept","application/json"),((null==o?void 0:o[Gt])||fetch)(r.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:en(r,null==o?void 0:o.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=tn("".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=tn("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Mt('"options.algorithm" must be "oidc" (default), or "oauth2"',Lt)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Gt]:null==t?void 0:t[Mr],[Dt]:null==t||null===(o=t.execute)||void 0===o?void 0:o.includes(qr),signal:a,headers:new Headers(Cr)}):((null==t?void 0:t[Mr])||fetch)((gn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(qr)),e.href),{headers:Object.fromEntries(new Headers(O({accept:"application/json"},Cr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Eo)throw Mt('"expectedIssuerIdentifier" must be an instance of URL',Ut);if(!xt(t,Response))throw Mt('"response" must be an instance of Response',Ut);if(200!==t.status)throw qt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',io,t);mo(t);const o=await _o(t);if(on(o.issuer,'"response" body "issuer" property',oo,{body:o}),n!==Eo&&new URL(o.issuer).href!==n.href)throw qt('"response" body "issuer" property does not match the expected value',lo,{expected:n.href,body:o,attribute:"issuer"});return o}(Eo,e)).catch(Br);var c;return r&&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[Hr]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new Gr("discovered metadata issuer does not match the expected issuer",{code:lo,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,r),a=new Xr(i,t,n,o);let s=Nr(a);if(null!=r&&r[Mr]&&(s.fetch=r[Mr]),null!=r&&r.timeout&&(s.timeout=r.timeout),null!=r&&r.execute)for(const e of r.execute)e(a);return a}new TextDecoder;const Hr=Symbol();class Xr{constructor(e,t,n,o){var r,i,a,s,c;if("string"!=typeof t||!t.length)throw Wr('"clientId" must be a non-empty string',jr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(r=n)||void 0===r?void 0:r.client_id)&&t!==n.client_id)throw Wr('"clientId" and "metadata.client_id" must be the same',Dr);const u=O(O({},structuredClone(n)),{},{client_id:t});let l;u[jt]=null!==(i=null===(a=n)||void 0===a?void 0:a[jt])&&void 0!==i?i:0,u[Wt]=null!==(s=null===(c=n)||void 0===c?void 0:c[Wt])&&void 0!==s?s:30,l=o||("string"==typeof u.client_secret&&u.client_secret.length?Lr(u.client_secret):(e,t,n,o)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);Hr in e&&(h[To]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Pr||(Pr=new WeakMap),Pr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Nr(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(Nr(this).c)}get timeout(){return Nr(this).timeout}set timeout(e){Nr(this).timeout=e}get[Mr](){return Nr(this).fetch}set[Mr](e){Nr(this).fetch=e}}function Jr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}
2return{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 jn(this)}catch(e){return}}}}}(e))}async function zr(e,t,n){var o;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(o=e.headers.get("retry-after"))||void 0===o?void 0:o.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(r&&!Number.isFinite(a))throw new Zt("invalid Retry-After header value",{cause:e});a>t&&await Vr(a-t,n)}function Vr(e,t){return new Promise((n,o)=>{const r=e=>{try{t.throwIfAborted()}catch(e){return void o(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>r(e-i),1e3*i)};r(e)})}async function Yr(e,t){oi(e);const n=Nr(e),o=n.as,r=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,o,r){dn(e),hn(t);const i=yn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),a=new URLSearchParams(o);a.set("client_id",t.client_id);const s=$t(null==r?void 0:r.headers);return s.set("accept","application/json"),Ln(e,t,n,i,a,s,r)}(o,r,i,t,{[Gt]:a,[Dt]:!s,headers:new Headers(Cr),signal:ri(c)}).then(e=>async function(e,t,n){if(dn(e),hn(t),!xt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Cn(n,200,"Backchannel Authentication Endpoint"),mo(n);const o=await _o(n);on(o.auth_req_id,'"response" body "auth_req_id" property',oo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',oo,{body:o}),o.expires_in=r,void 0!==o.interval&&nn(o.interval,!1,'"response" body "interval" property',oo,{body:o}),o}(o,r,e)).catch(Br)}async function Zr(e,t,n,o){var r,i;oi(e),n=new URLSearchParams(n);let a=null!==(r=t.interval)&&void 0!==r?r:5;const s=null!==(i=null==o?void 0:o.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Vr(a,s)}catch(e){Br(e)}const c=Nr(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,w=(r,i)=>Zr(e,O(O({},t),{},{interval:r}),n,O(O({},o),{},{signal:s,flag:i})),y=function(e,t){const n=ri(t);if(!n)return{signal:e,cleanup(){}};const o=new AbortController,r=e=>{const t=e.target;o.abort(t.reason)};return e.aborted?o.abort(e.reason):n.aborted?o.abort(n.reason):(e.addEventListener("abort",r,{once:!0}),n.addEventListener("abort",r,{once:!0})),{signal:o.signal,cleanup(){e.removeEventListener("abort",r),n.removeEventListener("abort",r)}}}(s,m),v=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"authReqId"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("auth_req_id",o),Un(e,t,n,"urn:openid:params:grant-type:ciba",i,r)}(u,l,d,t.auth_req_id,{[Gt]:h,[Dt]:!p,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Cr),signal:y.signal}).catch(Br).finally(y.cleanup);var b;if(503===v.status&&v.headers.has("retry-after"))return await zr(v,a,s,!0),await(null===(b=v.body)||void 0===b?void 0:b.cancel()),w(a);const A=async function(e,t,n,o){return Wn(e,t,n,void 0,null==o?void 0:o[Bt],null==o?void 0:o.recognizedTokenTypes)}(u,l,v,{[Bt]:g});let S;try{S=await A}catch(e){if(ai(e,o))return w(a,si);if(e instanceof vn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await zr(e.response,a,s),w(a)}Br(e)}return S.id_token&&await(null==f?void 0:f(v)),Jr(S),S}function qr(e){Nr(e).tlsOnly=!1}async function Qr(e,t,n,o,r){if(oi(e),!((null==r?void 0:r.flag)===si||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Wr('"currentUrl" must be an instance of URL, or Request',jr);let i,a;const s=Nr(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,w=s.decrypt,y=s.implicit;if((null==r?void 0:r.flag)===si)i=r.authResponse,a=r.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Mt("form_post responses are expected to use the POST method",Lt,{cause:e});if("application/x-www-form-urlencoded"!==Pn(e))throw Mt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Lt,{cause:e});return async function(e){if(e.bodyUsed)throw Mt("form_post Request instances must contain a readable body",Lt,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var v=I(e,2);const n=v[0],o=v[1];t.searchParams.append(n,o)}break;default:throw Wr("unexpected Request HTTP method",Dr)}}
2switch(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!!y:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,o){if(dn(e),hn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Mt('"parameters" must be an instance of URLSearchParams, or URL',Ut);if(bo(n,"response"))throw qt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',oo,{parameters:n});const r=bo(n,"iss"),i=bo(n,"state");if(!r&&e.authorization_response_iss_parameter_supported)throw qt('response parameter "iss" (issuer) missing',oo,{parameters:n});if(r&&r!==e.issuer)throw qt('unexpected "iss" (issuer) response parameter value',oo,{expected:e.issuer,parameters:n});switch(o){case void 0:case So:if(void 0!==i)throw qt('unexpected "state" response parameter encountered',oo,{expected:void 0,parameters:n});break;case Ao:break;default:if(on(o,'"expectedState" argument'),i!==o)throw qt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',oo,{expected:o,parameters:n})}if(bo(n,"error"))throw new bn("authorization response from the server is an error",{cause:n});const a=bo(n,"id_token"),s=bo(n,"token");if(void 0!==a||void 0!==s)throw new Yt("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){Br(e)}}}const b=await async function(e,t,n,o,r,i,a){if(dn(e),hn(t),!Xn.has(o))throw Mt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Lt);on(r,'"redirectUri"');const s=bo(o,"code");if(!s)throw qt('no authorization code in "callbackParameters"',oo);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",r),c.set("code",s),i!==Jn&&(on(i,'"codeVerifier"'),c.set("code_verifier",i)),Un(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||Jn,{additionalParameters:o,[Gt]:d,[Dt]:!h,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Cr),signal:ri(g)}).catch(Br);"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,o){return"string"==typeof(null==o?void 0:o.expectedNonce)||"number"==typeof(null==o?void 0:o.maxAge)||null!=o&&o.requireIdToken?async function(e,t,n,o,r,i,a){const s=[];
2switch(o){case void 0:o=Yn;break;case Yn:break;default:on(o,'"expectedNonce" argument'),s.push("nonce")}switch(null!=r||(r=t.default_max_age),r){case void 0:r=Zn;break;case Zn:break;default:nn(r,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Wn(e,t,n,s,i,a);on(c.id_token,'"response" body "id_token" property',oo,{body:c});const u=jn(c);if(r!==Zn){const e=ln()+cn(t),n=un(t);if(u.auth_time+r<e-n)throw qt("too much time has elapsed since the last End-User authentication",co,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(o===Yn){if(void 0!==u.nonce)throw qt('unexpected ID Token "nonce" claim value',uo,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==o)throw qt('unexpected ID Token "nonce" claim value',uo,{expected:o,claims:u,claim:"nonce"});return c}(e,t,n,o.expectedNonce,o.maxAge,o[Bt],o.recognizedTokenTypes):async function(e,t,n,o,r){const i=await Wn(e,t,n,void 0,o,r),a=jn(i);if(a){if(void 0!==t.default_max_age){nn(t.default_max_age,!0,'"client.default_max_age"');const e=ln()+cn(t),n=un(t);if(a.auth_time+t.default_max_age<e-n)throw qt("too much time has elapsed since the last End-User authentication",co,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw qt('unexpected ID Token "nonce" claim value',uo,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==o?void 0:o[Bt],null==o?void 0:o.recognizedTokenTypes)}(c,u,b,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[Bt]:w});let S;try{S=await A}catch(t){if(ai(t,r))return Qr(e,void 0,n,o,O(O({},r),{},{flag:si,authResponse:i,redirectUri:a}));Br(t)}return S.id_token&&await(null==m?void 0:m(b)),Jr(S),S}async function $r(e,t,n,o){oi(e),n=new URLSearchParams(n);const r=Nr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,u=r.tlsOnly,l=r.nonRepudiation,d=r.timeout,h=r.decrypt,p=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"refreshToken"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("refresh_token",o),Un(e,t,n,"refresh_token",i,r)}(i,a,s,t,{[Gt]:c,[Dt]:!u,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Cr),signal:ri(d)}).catch(Br),f=async function(e,t,n,o){return Wn(e,t,n,void 0,null==o?void 0:o[Bt],null==o?void 0:o.recognizedTokenTypes)}(i,a,p,{[Bt]:h});let m;try{m=await f}catch(r){if(ai(r,o))return $r(e,t,n,O(O({},o),{},{flag:si}));Br(r)}return m.id_token&&await(null==l?void 0:l(p)),Jr(m),m}async function ei(e,t,n){oi(e),t=new URLSearchParams(t);const o=Nr(e),r=o.as,i=o.c,a=o.auth,s=o.fetch,c=o.tlsOnly,u=o.timeout,l=await async function(e,t,n,o,r){return dn(e),hn(t),Un(e,t,n,"client_credentials",new URLSearchParams(o),r)}(r,i,a,t,{[Gt]:s,[Dt]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Cr),signal:ri(u)}).catch(Br),d=async function(e,t,n){return Wn(e,t,n,void 0,void 0,void 0)}(r,i,l);let h;try{h=await d}catch(o){if(ai(o,n))return ei(e,t,O(O({},n),{},{flag:si}));Br(o)}return Jr(h),h}function ti(e,t){oi(e);const n=Nr(e),o=n.as,r=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,u=yn(o,"authorization_endpoint",!1,i);if((t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw Wr("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",Dr);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=I(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function ni(e,t,n){oi(e);const o=ti(e,t),r=Nr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,u=r.tlsOnly,l=r.timeout,d=await async function(e,t,n,o,r){var i;dn(e),hn(t);const a=yn(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),s=new URLSearchParams(o);s.set("client_id",t.client_id);const c=$t(null==r?void 0:r.headers);c.set("accept","application/json"),void 0!==(null==r?void 0:r.DPoP)&&(In(r.DPoP),await r.DPoP.addProof(a,c,"POST"));const u=await Ln(e,t,n,a,s,c,r);return null==r||null===(i=r.DPoP)||void 0===i||i.cacheNonce(u,a),u}(i,a,s,o.searchParams,{[Gt]:c,[Dt]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Cr),signal:ri(l)}).catch(Br),h=async function(e,t,n){if(dn(e),hn(t),!xt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Cn(n,201,"Pushed Authorization Request Endpoint"),mo(n);const o=await _o(n);on(o.request_uri,'"response" body "request_uri" property',oo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',oo,{body:o}),o.expires_in=r,o}(i,a,d);let p;try{p=await h}catch(o){if(ai(o,n))return ni(e,t,O(O({},n),{},{flag:si}));Br(o)}return ti(e,{request_uri:p.request_uri})}function oi(e){if(!(e instanceof Xr))throw Wr('"config" must be an instance of Configuration',jr);if(Object.getPrototypeOf(e)!==Xr.prototype)throw Wr("subclassing Configuration is not allowed",Dr)}function ri(e){return e?AbortSignal.timeout(1e3*e):void 0}async function ii(e,t,n,o){oi(e);const r=Nr(e),i=r.as,a=r.c,s=r.fetch,c=r.tlsOnly,u=r.nonRepudiation,l=r.timeout,d=r.decrypt,h=await async function(e,t,n,o){dn(e),hn(t);const r=yn(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Dt])),i=$t(null==o?void 0:o.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,o,r,i){var a;if(on(e,'"accessToken"'),!(n instanceof URL))throw Mt('"url" must be an instance of URL',Ut);gn(n,!0!==(null==i?void 0:i[Dt])),o=$t(o),null!=i&&i.DPoP&&(In(i.DPoP),await i.DPoP.addProof(n,o,"GET".toUpperCase(),e)),o.set("authorization","".concat(o.has("dpop")?"DPoP":"Bearer"," ").concat(e));const s=await((null==i?void 0:i[Gt])||fetch)(n.href,{duplex:xt(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(o.entries()),method:"GET",redirect:"manual",signal:en(n,null==i?void 0:i.signal)}
2);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(s,n),s}(n,0,r,i,0,O(O({},o),{},{[jt]:cn(t)}))}(i,a,t,{[Gt]:s,[Dt]:!c,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Cr),signal:ri(l)}).catch(Br);let p,f=xn(i,a,n,h,{[Bt]:d});try{p=await f}catch(r){if(ai(r,o))return ii(e,t,n,O(O({},o),{},{flag:si}));Br(r)}return"application/jwt"===Pn(h)&&await(null==u?void 0:u(h)),p}function ai(e,t){return!(null==t||!t.DPoP||t.flag===si)&&function(e){if(e instanceof An){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof vn&&"use_dpop_nonce"===e.error}(e)}Object.freeze(Xr.prototype);const si=Symbol();async function ci(e,t,n,o){oi(e);const r=Nr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,u=r.tlsOnly,l=r.timeout,d=r.decrypt,h=r.nonRepudiation,p=await async function(e,t,n,o,r,i){return dn(e),hn(t),on(o,'"grantType"'),Un(e,t,n,o,new URLSearchParams(r),i)}(i,a,s,t,new URLSearchParams(n),{[Gt]:c,[Dt]:!u,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Cr),signal:ri(l)}).catch(Br);let f;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(f={n_a:()=>{}});const m=async function(e,t,n,o){return Wn(e,t,n,void 0,null==o?void 0:o[Bt],null==o?void 0:o.recognizedTokenTypes)}(i,a,p,{[Bt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(r){if(ai(r,o))return ci(e,t,n,O(O({},o),{},{flag:si}));Br(r)}return g.id_token&&await(null==h?void 0:h(p)),Jr(g),g}async function ui(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var o;const r=e.algorithm;if(r.name!==t.name)throw No(t.name);if(t.hash&&(null===(o=r.hash)||void 0===o?void 0:o.name)!==t.hash)throw No(t.hash,"algorithm.hash");if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw No(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&r.length!==t.length)throw No(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){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.alg,t),t)}const li=[["verify"],["sign"]];function di(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:li}}function hi(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?O(O({},n),{},{saltLength:t}):n,usages:li,minRsaBits:2048}}function pi(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:li}}function fi(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:li}}function mi(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:li}}const gi=hr({HS256:di(256),HS384:di(384),HS512:di(512),RS256:hi(256),RS384:hi(384),RS512:hi(512),PS256:hi(256,32),PS384:hi(384,48),PS512:hi(512,64),ES256:pi("P-256",256),ES384:pi("P-384",384),ES512:pi("P-521",512),EdDSA:fi(),Ed25519:fi(),"ML-DSA-44":mi(44),"ML-DSA-65":mi(65),"ML-DSA-87":mi(87)});function wi(e){const t="string"==typeof e?gi[e]:void 0;if(!t)throw new Do("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function yi(e,t,n){if(e instanceof Uint8Array&&(e=Ro.decode(e)),"string"!=typeof e)throw new jo("Compact JWS must be a string or Uint8Array");const o=e.split("."),r=o[0],i=o[1],a=o[2];if(3!==o.length)throw new jo("Invalid Compact JWS");const s={payload:i,protected:r,signature:a},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let o;try{o=JSON.parse(Oo.decode(Vo(e)))}catch(e){throw new t(n)}if(!Zo(o))throw new t(n);return o}(e,jo,"JWS Protected Header is invalid");return t}(r),u=function(e,t,n){const o=kr(e,Tr(jo,_r,n[1],e,t)),r=t.alg;if("string"!=typeof r||!r)throw new jo('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(r))throw new Mo('"alg" (Algorithm) Header Parameter value not allowed');return[o,r]}(c,c,t),l=I(u,2),d=l[0],h=l[1],p=d?i:function(e){try{return Io(e)}catch(e){throw new jo("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,o,r,i,a){var s;let c=!1;"function"==typeof n&&(n=await n(r,e),c=!0);const u="string"==typeof a,l=wi(i),d=Co(void 0!==o?Io(o):new Uint8Array,Io("."),u?null!==(s=t[2])&&void 0!==s?s:t[2]=function(e,t,n){try{return Io(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,jo):a),h=Qo(e.signature,"signature",jo),p=await dr(l,n,"verify");if(!await async function(e,t,n,o){const r=await ui(e,t,"verify");try{return await crypto.subtle.verify(e.signing,r,n,o)}catch(e){return!1}}(l,p,h,d))throw new Ho;return[u?Qo(a,"payload",jo):a,r,u,p,c]}(s,t,n,r,c,h,p)}const vi=e=>Math.floor(e.getTime()/1e3),bi={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Ai=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Si="check_failed";function _i(){throw new TypeError("Invalid time period format")}function Ei(e){"string"!=typeof e&&_i();const t=Ai.exec(e);(!t||t[4]&&t[1])&&_i();const n=parseFloat(t[2]),o=Math.round(n*bi[t[3][0].toLowerCase()]);return Number.isFinite(o)||_i(),"-"===t[1]||"ago"===t[4]?-o:o}function Ti(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function ki(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Ri(e,t){return"number"==typeof e?Ti(t,e):e instanceof Date?Ti(t,vi(e)):vi(new Date)+Ei(e)}const Oi=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function Ci(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=e[t];if(void 0!==o||n){if("number"!=typeof o)throw new Lo('"'.concat(t,'" claim must be a number'),e,t,"invali
2d");return o}}function Ii(e,t){throw new Lo('unexpected "'.concat(t,'" claim value'),e,t,Si)}function Ni(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Oo.decode(t))}catch(e){}if(!Zo(n))throw new Wo("JWT Claims Set must be a top-level JSON object");const r=o.typ;if(void 0!==r&&("string"!=typeof e.typ||Oi(e.typ)!==Oi(r)))throw new Lo('unexpected "typ" JWT header value',n,"typ",Si);const i=o.requiredClaims,a=void 0===i?[]:i,s=o.issuer,c=o.subject,u=o.audience,l=o.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(!Object.hasOwn(n,e))throw new Lo('missing required "'.concat(e,'" claim'),n,e,"missing");var h,p;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||Ii(n,"iss"),void 0!==c&&n.sub!==c&&Ii(n,"sub"),void 0===u||(p="string"==typeof u?[u]:u,"string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(e=>h.includes(e)))||Ii(n,"aud");const f=o.clockTolerance;let m=0;if("string"==typeof f)m=Ei(f);else if(void 0!==f){if("number"!=typeof f)throw new TypeError("Invalid clockTolerance option type");m=f}Ti("clockTolerance option",m);const g=o.currentDate,w=Ti("currentDate option",vi(void 0===g?new Date:g)),y=Ci(n,"iat",void 0!==l),v=Ci(n,"nbf");if(void 0!==v&&v>w+m)throw new Lo('"nbf" claim timestamp check failed',n,"nbf",Si);const b=Ci(n,"exp");if(void 0!==b&&b<=w-m)throw new Uo('"exp" claim timestamp check failed',n,"exp",Si);if(void 0!==l){const e=w-y;if(e-m>Ti("maxTokenAge option","number"==typeof l?l:Ei(l)))throw new Uo('"iat" claim timestamp check failed (too far in the past)',n,"iat",Si);if(e<-m)throw new Lo('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Si)}return n}let Pi;function xi(e){return Pi.get(e)}async function Li(e,t,n,o,r){const i=I(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,o;try{n=JSON.stringify(t),o=JSON.parse(n)}catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!Zo(o))throw new e("JOSE Header is not a JSON object");return[o,n]}(jo,e);return[t[0],Yo(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new jo("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}(jo,e),kr(e,Tr(jo,_r,n,e,t))})(a,a,n)||r();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new jo('JWS "alg" (Algorithm) Header Parameter missing or invalid');return wi(t)}(a),u=Yo(e),l=await async function(e,t,n,o){const r=Co(Io(e),Io("."),t),i=await dr(n,o,"sign");return Yo(await async function(e,t,n){const o=await ui(e,t,"sign"),r=await crypto.subtle.sign(e.signing,o,n);return new Uint8Array(r)}(n,i,r))}(s,Io(u),c,o);return"".concat(s,".").concat(u,".").concat(l)}const Ui=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Zo(e))throw new TypeError("JWT Claims Set MUST be an object");(Pi||(Pi=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return ki("iss",e),xi(this).iss=e,this}setSubject(e){return ki("sub",e),xi(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of strings')}(e),xi(this).aud=e,this}setJti(e){return ki("jti",e),xi(this).jti=e,this}setNotBefore(e){return xi(this).nbf=Ri(e,"setNotBefore"),this}setExpirationTime(e){return xi(this).exp=Ri(e,"setExpirationTime"),this}setIssuedAt(e){return xi(this).iat=void 0===e?vi(new Date):"string"==typeof e?Ti("setIssuedAt",vi(new Date)+Ei(e)):Ri(e,"setIssuedAt"),this}};var Mi=new WeakMap;class Di extends Ui{constructor(){super(...arguments),_(this,Mi,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(S(Mi,this)),E(Mi,this,e),this}async sign(e,t){return Li(function(e){const t=xi(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return ko.encode(JSON.stringify(t))}(this),S(Mi,this),null==t?void 0:t.crit,e,()=>{throw new Wo("JWTs MUST NOT use unencoded payload")})}}const ji='"alg" (Algorithm)';function Wi(){throw new Do("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const Gi=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},Ki=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},Bi=e=>{const t=Ki(e);if(128&t){const n=127&t;let o=0;for(let t=0;t<n;t++)o=o<<8|Ki(e);return o}return t},Fi=(e,t,n)=>{if(Ki(e)!==t)throw new Error(n)},Hi=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Xi=e=>{const t=(e=>{Fi(e,6,"Expected algorithm OID");const t=Bi(e);return Hi(e,t)})(e);if(Gi(t,[43,101,110]))return"X25519";if(!Gi(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Fi(e,6,"Expected curve OID");const n=Bi(e),o=Hi(e,n);if(Gi(o,[42,134,72,206,61,3,1,7]))return"P-256";if(Gi(o,[43,129,4,0,34]))return"P-384";if(Gi(o,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},Ji=(e,t,n)=>{const o=(e=>
2Jo(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,o)=>{const r=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==o?void 0:o.extractable),i=function(e,t){var n,o;return null!==(n="string"==typeof e?null!==(o=gi[e])&&void 0!==o?o:br[e]:void 0)&&void 0!==n?n:Wi(t)}(n,ji);i.secret&&Wi(ji);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(Fi(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),Bi(e),"pkcs8"===t){Fi(e,2,"Expected version field");const t=Bi(e);e.pos+=t}Fi(e,48,"Expected algorithm identifier"),Bi(e)}(n,e),s=i.resolve({crv:Xi(n)})}catch(e){throw new Do("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,null!=r?r:a,i.usages[a?0:1])})("pkcs8",o,t,n)};async function zi(e,t,n){const o=e.get(t)||e.set(t,{}).get(t),r=n.alg;if(void 0===o[r]){const e=await $o(n,O(O({},t),{},{alg:r,ext:!0}));if("public"!==e.type)throw new Go("JSON Web Key Set members must be public keys");o[r]=e}return o[r]}function Vi(e){let t;try{t=structuredClone(e)}catch(e){}if(!qo(t))throw new Go("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,o)=>{const r=O(O({},e),null==o?void 0:o.header),i=r.alg,a=r.kid,s="string"==typeof i?gi[i]:void 0;if(!s||s.secret)throw new Do('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,o){const r=er(e),i=r.kty,a=r.key_ops,s=r.ext,c=r.kid,u=r.alg,l=r.use,d=r.crv,h=Array.isArray(a)?[...a]:a;return(void 0===s||"boolean"==typeof s)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===o||"string"==typeof o&&o===c)&&(void 0===u?"AKP"!==i:n===u)&&(void 0===l||"sig"===l)&&(!t.crv||d===t.crv)}(e,s,i,a)),u=c[0],l=c.length;if(!l)throw new Ko;if(1!==l){const e=new Bo;throw e[Symbol.asyncIterator]=N(function*(){for(const e of c)try{yield yield b(zi(n,e,s))}catch(e){}}),e}return zi(n,u,s)},"jwks",{value:()=>structuredClone(t)})}var Yi,Zi;let qi;if("undefined"==typeof navigator||null===(Yi=navigator.userAgent)||void 0===Yi||null===(Zi=Yi.startsWith)||void 0===Zi||!Zi.call(Yi,"Mozilla/5.0 ")){const e="v6.2.10";qi="".concat("jose","/").concat(e)}const Qi=Symbol(),$i=Symbol();function ea(e,t){return Number.isFinite(e)&&Date.now()<e+t}function ta(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function na(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Ji(e,t,n)}const oa=["mfaToken"],ra=["mfaToken"];var ia,aa,sa,ca,ua,la,da,ha,pa,fa,ma,ga,wa,ya,va,ba,Aa,Sa,_a,Ea,Ta,ka,Ra,Oa,Ca,Ia,Na,Pa,xa,La,Ua,Ma,Da,ja,Wa,Ga,Ka,Ba,Fa,Ha,Xa,Ja,za,Va,Ya,Za,qa,Qa,$a,es,ts,ns;function os(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function rs(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const o=e;let r;if(o.response instanceof Response)try{r=new Headers(o.response.headers),r.delete("set-cookie")}catch(e){r=void 0}const i={error:null!==(t=o.error)&&void 0!==t?t:"",error_description:null!==(n=o.error_description)&&void 0!==n?n:"",message:o.message,statusCode:"number"==typeof o.status?o.status:void 0,headers:r};if("mfa_required"===o.error&&o.cause){i.mfa_token="string"==typeof o.cause.mfa_token?o.cause.mfa_token:void 0;const e=o.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var is=class extends Error{constructor(e,t){super(t),k(this,"code",void 0),this.name="NotSupportedError",this.code=e}},as=class extends Error{constructor(e,t,n){super(t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"statusCode",void 0),k(this,"headers",void 0),k(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},ss=class extends as{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},cs=class extends as{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},us=class extends as{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},ls=class extends as{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},ds=class extends as{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},hs=class extends as{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ps=class extends as{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},fs=class extends as{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}}
2,ms=class extends Error{constructor(e){super(e),k(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},gs=class extends as{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),k(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ws=class extends as{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ys=class extends as{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},vs=class extends as{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},bs=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),k(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}},As=class extends Error{constructor(e){super(e),k(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Ss=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),k(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function _s(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function Es(e,t,n){var o;const r="object"==typeof t&&null!==t?t:void 0,i=null!==(o=null==r?void 0:r.response)&&void 0!==o?o:n,a="number"==typeof(null==r?void 0:r.status)?r.status:null==i?void 0:i.status;"number"==typeof a&&(e.statusCode=a),null!=i&&i.headers&&(e.headers=_s(i.headers))}function Ts(e){return Object.entries(e).filter(e=>void 0!==I(e,2)[1]).reduce((e,t)=>O(O({},e),{},{[t[0]]:t[1]}),{})}function ks(e){if(!e.trim())throw new As("organization must not be blank")}function Rs(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new As("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new As('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new As("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new As('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var Os=class extends Error{constructor(e,t,n){super(t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"statusCode",void 0),k(this,"headers",void 0),k(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},Cs=class extends Os{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Is=class extends Os{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Ns=class extends Os{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ps=class extends Os{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},xs=class extends Os{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function Ls(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Us=class e{constructor(e,t,n,o,r,i,a){k(this,"accessToken",void 0),k(this,"idToken",void 0),k(this,"refreshToken",void 0),k(this,"expiresAt",void 0),k(this,"scope",void 0),k(this,"claims",void 0),k(this,"authorizationDetails",void 0),k(this,"tokenType",void 0),k(this,"issuedTokenType",void 0),k(this,"recoveryCode",void 0),k(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=o,this.expiresAt=t,this.scope=r,this.claims=i,this.authorizationDetail
2s=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,o=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 o.tokenType=t.token_type,o.issuedTokenType=t.issued_token_type,o}};function Ms(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},o=btoa(JSON.stringify(n));return async(t,n)=>{const r=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{r.set(t,e)}),r.set("Auth0-Client",o),e(t,O(O({},n),{},{headers:r}))}}function Ds(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function js(e){let t;const n=async(n,o)=>{const r=await e(n,o);return t=r.clone(),r};return n.getCapturedResponse=()=>t,n}function Ws(e,t,n){if(!t)return e;const o=t.signal,r=t.headers,i=t.customFetch,a=i?Ms(i,n):e;return o||r?async(e,t)=>{const n=r?new Headers(e instanceof Request?e.headers:void 0):void 0;if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),r)for(const e of Object.entries(r)){var i=I(e,2);const t=i[0],o=i[1],r=t.toLowerCase();"authorization"!==r&&"auth0-client"!==r&&n.set(t,o)}const s=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,o=[e,t],r=o.find(e=>e.aborted);if(r)return n.abort(r.reason),{signal:n.signal};const i=[],a=()=>{o.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return o.forEach((e,t)=>{const o=()=>{a(),n.abort(e.reason)};i[t]=o,e.addEventListener("abort",o,{once:!0})}),{signal:n.signal,cleanup:a}}(o,null==t?void 0:t.signal);try{return await a(e,O(O(O({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var Gs={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
2overy-code"},Ks=(ia=new WeakMap,aa=new WeakMap,sa=new WeakMap,ca=new WeakMap,ua=new WeakMap,la=new WeakMap,da=new WeakMap,ha=new WeakSet,class{constructor(e){var t,n;T(this,ha),_(this,ia,void 0),_(this,aa,void 0),_(this,sa,void 0),_(this,ca,void 0),_(this,ua,void 0),_(this,la,void 0),_(this,da,void 0),E(ia,this,"https://".concat(e.domain)),E(aa,this,e.clientId),E(sa,this,e.clientSecret),E(ca,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(ua,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(la,this,e.getConfiguration),E(da,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(S(ia,this),"/mfa/authenticators"),o=e.mfaToken,r=await v(ha,this,Bs).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!r.ok){const e=await r.clone().text(),t=r.status,n=_s(r.headers);let i;try{i=JSON.parse(e)}catch(o){throw new Cs("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new Cs(i.error_description||"Failed to list authenticators",O(O({},i),{},{statusCode:t,headers:n,body:e}))}return(await r.json()).map(Ls)}async enrollAuthenticator(e,t){const n="".concat(S(ia,this),"/mfa/associate"),o=e.mfaToken,r=C(e,oa),i={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(i.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(i.phone_number=r.phoneNumber),"email"in r&&r.email&&(i.email=r.email);const a=await v(ha,this,Bs).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=_s(a.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Is("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new Is(r.error_description||"Failed to enroll authenticator",O(O({},r),{},{statusCode:t,headers:n,body: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 a.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,o=e.mfaToken,r="".concat(S(ia,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await v(ha,this,Bs).call(this,t)(r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=_s(i.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Ns("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new Ns(r.error_description||"Failed to delete authenticator",O(O({},r),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(S(ia,this),"/mfa/challenge"),o=e.mfaToken,r=C(e,ra),i={mfa_token:o,client_id:S(aa,this),challenge_type:r.challengeType};S(sa,this)&&(i.client_secret=S(sa,this)),r.authenticatorId&&(i.authenticator_id=r.authenticatorId);const a=await v(ha,this,Bs).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=_s(a.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Ps("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new Ps(r.error_description||"Failed to challenge authenticator",O(O({},r),{},{statusCode:t,headers:n,body: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 a.json())}async verify(e,t){if(!S(la,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var o;if(!S(da,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=js(null!==(o=(await S(la,this).call(this,t))[Mr])&&void 0!==o?o:fetch),c=await S(da,this).call(this,s);try{const t=await ci(c,Gs[e.factorType],n),o=Us.fromTokenEndpointResponse(t);
2t.recovery_code&&(o.recoveryCode=t.recovery_code);const r=s.getCapturedResponse();if(!r)throw new Ss;return{data:o,response:r}}catch(e){var r,i,a;if(e instanceof Ss)throw e;if(e instanceof xs)throw e;const t=e,n=new xs(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(r=t.error)&&void 0!==r?r:"mfa_verify_error",error_description:null!==(i=null!==(a=t.error_description)&&void 0!==a?a:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw Es(n,e,s.getCapturedResponse()),n}}const s=await S(la,this).call(this,t);try{const t=await ci(s,Gs[e.factorType],n),o=Us.fromTokenEndpointResponse(t);return t.recovery_code&&(o.recoveryCode=t.recovery_code),o}catch(e){var c,u,l;if(e instanceof xs)throw e;const t=e,n=new xs(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(u=null!==(l=t.error_description)&&void 0!==l?l:t.message)&&void 0!==u?u:"Failed to verify MFA challenge"});throw Es(n,e),n}}});function Bs(e){return Ws(S(ca,this),e,S(ua,this))}var Fs=class extends Error{constructor(e,t,n){super(t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"statusCode",void 0),k(this,"headers",void 0),k(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},Hs=class extends Fs{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},Xs=class extends Fs{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},Js=class extends Fs{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function zs(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var Vs="urn:okta:params:oauth:grant-type:webauthn",Ys=(pa=new WeakMap,fa=new WeakMap,ma=new WeakMap,ga=new WeakMap,wa=new WeakMap,ya=new WeakMap,va=new WeakSet,class{constructor(e){var t,n;T(this,va),_(this,pa,void 0),_(this,fa,void 0),_(this,ma,void 0),_(this,ga,void 0),_(this,wa,void 0),_(this,ya,void 0),E(pa,this,"https://".concat(e.domain)),E(fa,this,e.clientId),E(ma,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),E(ga,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(wa,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(ya,this,e.grantRequest)}async register(e,t){const n="".concat(S(pa,this),"/passkey/register"),o=O(O(O(O(O(O(O(O({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),r=O(O({client_id:S(fa,this)},zs(S(ma,this))),{},{user_profile:o});e.realm&&(r.realm=e.realm),e.organization&&(r.organization=e.organization),e.userMetadata&&(r.user_metadata=e.userMetadata);const i=await v(va,this,Zs).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){const e=await v(va,this,qs).call(this,i),t=new Hs(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=_s(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:O({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(S(pa,this),"/passkey/challenge"),o=O({client_id:S(fa,this)},zs(S(ma,this)));null!=e&&e.realm&&(o.realm=e.realm),null!=e&&e.organization&&(o.organization=e.organization);const r=await v(va,this,Zs).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const e=await v(va,this,qs).call(this,r),t=new Xs(e.error_description||"Failed to request login challenge",e);throw t.statusCode=r.status,t.headers=_s(r.headers),t}return{authSession:(i=await r.json()).auth_session,authnParamsPublicKey:O({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&ks(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let o;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
2nce),e.organization&&n.append("organization",e.organization);try{o=await S(ya,this).call(this,Vs,n,t,e.fullResponse)}catch(e){if(e instanceof Ss)throw e;const t=rs(e),n=new Js(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw Es(n,e),n}if(e.fullResponse){const t=o;return e.organization&&Rs(t.data.claims,e.organization),t}const r=o;return e.organization&&Rs(r.claims,e.organization),r}});function Zs(e){return Ws(S(ga,this),e,S(wa,this))}async function qs(e){const t=await e.clone().text();try{return O(O({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var Qs=class extends Error{constructor(e,t,n){super(t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"statusCode",void 0),k(this,"headers",void 0),k(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},$s=class extends Qs{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},ec=class extends Qs{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},tc=class extends Qs{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},nc=class extends Qs{constructor(e,t,n,o,r){super("passwordless_challenge_error",e,n),k(this,"statusCode",void 0),k(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=o,this.headers=null!=r?r:this.headers}};function oc(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function rc(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await na(e.clientAssertionSigningKey,r);return{client_assertion:await new Di({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new bs}var ic=(ba=new WeakMap,Aa=new WeakMap,Sa=new WeakMap,_a=new WeakMap,Ea=new WeakMap,Ta=new WeakMap,ka=new WeakMap,Ra=new WeakSet,class{constructor(e){var t,n;T(this,Ra),_(this,ba,void 0),_(this,Aa,void 0),_(this,Sa,void 0),_(this,_a,void 0),_(this,Ea,void 0),_(this,Ta,void 0),_(this,ka,void 0),E(Aa,this,e.domain),E(ba,this,"https://".concat(e.domain)),E(Sa,this,e.clientId),E(_a,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(Ea,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(Ta,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),E(ka,this,e.grantRequest)}async sendEmail(e,t){const n=await v(Ra,this,sc).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",o={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(o.authParams=e.authParams),o}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!oc(e.phoneNumber))throw new $s("Phone number must be in E.164 format (e.g. +14155550100).");const n=await v(Ra,this,sc).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return v(Ra,this,cc).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!oc(e.phoneNumber))throw new nc("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return v(Ra,this,cc).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
2nce),!S(ka,this))throw new tc("Missing grant request delegate.",rs(new Error("missing grantRequest")));try{return await S(ka,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Ss)throw e;const t=new tc("There was an error while trying to request a token.",rs(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function ac(e){return Ws(S(_a,this),e,S(Ea,this))}async function sc(e,t,n,o){var r;const i=await rc(S(Ta,this),S(Sa,this),S(Aa,this)),a=O(O({client_id:S(Sa,this)},e),i);let s;try{s=await v(Ra,this,ac).call(this,o)("".concat(S(ba,this),"/passwordless/start"),{method:"POST",headers:O({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new $s("".concat(t,": a network error occurred."))}if(s.ok)return s;const c=await s.clone().text();let u;if(204!==s.status)try{u=JSON.parse(c)}catch(e){u=void 0}const l=new $s((null===(r=u)||void 0===r?void 0:r.error_description)||t,u);throw l.statusCode=s.status,l.headers=_s(s.headers),l.body=c,l}async function cc(e,t,n){var o,r;const i=await rc(S(Ta,this),S(Sa,this),S(Aa,this)),a=O(O({client_id:S(Sa,this)},e),i);let s;try{s=await v(Ra,this,ac).call(this,n)("".concat(S(ba,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new nc("challenge error: a network error occurred.",0,void 0,void 0)}if(s.ok){let n;try{n=await s.json()}catch(e){throw new nc("".concat(t,": could not parse the response body."),s.status,void 0,void 0,_s(s.headers))}return{authSession:n.auth_session}}const c=await s.clone().text();let u;try{u=JSON.parse(c)}catch(e){u=void 0}const l=u?O(O({},u),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new nc((null===(o=u)||void 0===o?void 0:o.error_description)||t,s.status,l,null===(r=u)||void 0===r?void 0:r.validation_errors,_s(s.headers))}var uc=class extends Error{constructor(e,t,n){super(t),k(this,"cause",void 0),k(this,"code",void 0),k(this,"statusCode",void 0),k(this,"headers",void 0),k(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},lc=class extends uc{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},dc=class extends uc{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function hc(e,t,n){for(const o of t)if(null===e[o]||void 0===e[o]||""===e[o])throw new n('Required parameter "'.concat(String(o),'" was null, undefined, or empty.'))}function pc(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var fc=(Oa=new WeakMap,Ca=new WeakMap,Ia=new WeakMap,Na=new WeakMap,Pa=new WeakSet,class{constructor(e){var t,n;T(this,Pa),_(this,Oa,void 0),_(this,Ca,void 0),_(this,Ia,void 0),_(this,Na,void 0),E(Oa,this,"https://".concat(e.domain)),E(Ca,this,e.clientId),E(Ia,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(Na,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds())}async signUp(e,t){var n;hc(e,["email","password","connection"],lc);const o=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:S(Ca,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),r=await v(Pa,this,mc).call(this,"/dbconnections/signup",o,lc,"Failed to sign up",t);if(e.fullResponse){const e=r.clone();return{data:pc(await r.json()),response:e}}return pc(await r.json())}async changePassword(e,t){var n;if(hc(e,["connection"],dc),!e.email&&!e.username)throw new dc('Either "email" or "username" is required.');const o=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:S(Ca,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),r=await v(Pa,this,mc).call(this,"/dbconnections/change_password",o,dc,"Failed to request a password change",t);if(e.fullResponse){const e=r.clone();return{data:await r.text(),response:e}}return r.text()}});async function mc(e,t,n,o,r){const i=Ws(S(Ia,this),r,S(Na,this));let a;try{a=await i("".concat(S(Oa,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(o,": a network error occurred."))}if(a.ok)return a;const s=await a.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(a.clone()),u=new n((null==c?void 0:c.error_description)||o,null!=c?c:{error:"unknown_error",error_description:o});throw u.statusCode=a.status,u.headers=_s(a.headers),u.body=s,u}
2var gc=class extends Error{constructor(e,t,n){super(t),k(this,"code",void 0),k(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},wc=new Set(["session_expired","invalid_session_token"]);async function yc(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var vc=(xa=new WeakMap,La=new WeakMap,Ua=new WeakMap,Ma=new WeakMap,Da=new WeakMap,ja=new WeakMap,Wa=new WeakMap,Ga=new WeakMap,Ka=new WeakSet,class{constructor(e){var t;T(this,Ka),_(this,xa,void 0),_(this,La,void 0),_(this,Ua,void 0),_(this,Ma,void 0),_(this,Da,void 0),_(this,ja,void 0),_(this,Wa,void 0),_(this,Ga,void 0),E(xa,this,e.domain),E(La,this,"https://".concat(e.domain)),E(Ua,this,e.clientId),E(Ma,this,e.clientSecret),E(Da,this,e.clientAssertionSigningKey),E(ja,this,e.clientAssertionSigningAlg),E(Wa,this,e.useMtls),E(Ga,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:S(Ua,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await v(Ka,this,Ac).call(this,t);if(!n.sessionToken)throw new gc("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await v(Ka,this,bc).call(this,e.sessionToken,e)}catch(t){if(t instanceof gc&&wc.has(t.code))return O(O({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(S(La,this),"/anonymous/logout"),t={client_id:S(Ua,this)},n=await S(Ga,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await yc(n);throw new gc(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function bc(e,t){const n={client_id:S(Ua,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const o=await v(Ka,this,Ac).call(this,n);return{sessionToken:e,accessToken:o.accessToken,expiresAt:o.expiresAt,sessionTokenExpiresAt:o.sessionTokenExpiresAt,scope:o.scope,sessionReplaced:!1}}async function Ac(e){const t="".concat(S(La,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await na(e.clientAssertionSigningKey,r);return{client_assertion:await new Di({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:S(Ma,this),clientAssertionSigningKey:S(Da,this),clientAssertionSigningAlg:S(ja,this),useMtls:S(Wa,this)},S(Ua,this),S(xa,this));Object.assign(e,n);const o=await S(Ga,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!o.ok){const e=await yc(o);throw new gc(e.error,e.error_description||"Anonymous token request failed",e)}let r;try{r=await o.json()}catch(e){throw new gc("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new gc("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new gc("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(r)}var Sc=(Ba=new WeakMap,Fa=new WeakMap,Ha=new WeakMap,class{constructor(e,t){_(this,Ba,new Map),_(this,Fa,void 0),_(this,Ha,void 0),E(Ha,this,Math.max(1,Math.floor(e))),E(Fa,this,Math.max(0,Math.floor(t)))}get(e){const t=S(Ba,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return S(Ba,this).delete(e),S(Ba,this).set(e,t),t.value;S(Ba,this).delete(e)}}set(e,t,n){S(Ba,this).has(e)&&S(Ba,this).delete(e);const o=null!=n&&Number.isFinite(n)&&n>0?n:S(Fa,this);for(S(Ba,this).set(e,{value:t,expiresAt:Date.now()+o});S(Ba,this).size>S(Ha,this);){const e=S(Ba,this).keys().next().value;if(void 0===e)break;S(Ba,this).delete(e)}}}),_c=new Map;function Ec(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 Tc=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,o=e.ttlMs,"".concat(n,":").concat(o));var n,o;let r=(i=t,_c.get(i));var i;return r||(r=new Sc(e.maxEntries,e.ttlMs),_c.set(t,r)),r}static createJwksCache(){return{}}},kc="openid profile email offline_access",Rc=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 Oc(e){if(null==e)throw new hs("subject_token is required");if("string"!=typeof e)throw new hs("subject_token must be a string");if(0===e.trim().length)throw new hs("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new hs("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new hs("subject_token must not include the 'Bearer ' prefix")}function Cc(e,t){if(t)for(const o of Object.entries(t)){var n=I(o,2);const t=n[0],r=n[1];if(!Rc.has(t))if(Array.isArray(r)){if(r.length>20)throw new hs("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));r.forEach(n=>{e.append(t,n)})}
2else e.append(t,r)}}var Ic="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",Nc="urn:ietf:params:oauth:grant-type:token-exchange",Pc="urn:ietf:params:oauth:token-type:access_token";function xc(e,t){return(n,o)=>{const r=null==o?void 0:o.body;if(t!==Vs||!(r instanceof URLSearchParams))return e(n,o);const i={};for(const e of r){var a=I(e,2);const t=a[0],n=a[1];i[t]="authn_response"===t?JSON.parse(n):n}const s=new Headers(null==o?void 0:o.headers);return s.set("Content-Type","application/json"),e(n,O(O({},o),{},{headers:s,body:JSON.stringify(i)}))}}var Lc=(Xa=new WeakMap,Ja=new WeakMap,za=new WeakMap,Va=new WeakMap,Ya=new WeakMap,Za=new WeakMap,qa=new WeakMap,Qa=new WeakMap,$a=new WeakMap,es=new WeakMap,ts=new WeakMap,ns=new WeakSet,class{constructor(e){var t;if(T(this,ns),_(this,Xa,void 0),_(this,Ja,void 0),_(this,za,void 0),_(this,Va,void 0),_(this,Ya,void 0),_(this,Za,void 0),_(this,qa,void 0),_(this,Qa,void 0),_(this,$a,void 0),_(this,es,void 0),_(this,ts,void 0),k(this,"mfa",void 0),k(this,"passkey",void 0),k(this,"passwordless",void 0),k(this,"database",void 0),k(this,"anonymous",void 0),E(Ya,this,e),e.useMtls&&!e.customFetch)throw new is("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");E(qa,this,Ds(e.telemetry)),E(Za,this,Ms(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},S(qa,this)));const n=Ec(e.discoveryCache);E($a,this,Tc.createDiscoveryCache(n)),E(es,this,new Map),E(ts,this,Tc.createJwksCache()),this.mfa=new Ks({domain:S(Ya,this).domain,clientId:S(Ya,this).clientId,clientSecret:S(Ya,this).clientSecret,customFetch:S(Za,this),telemetryConfig:S(qa,this),getConfiguration:async e=>(await v(ns,this,jc).call(this,e)).configuration,createCaptureConfiguration:async e=>{const t=(await v(ns,this,Wc).call(this)).serverMetadata;return v(ns,this,Mc).call(this,t,e)}}),this.passkey=new Ys({domain:S(Ya,this).domain,clientId:S(Ya,this).clientId,clientSecret:S(Ya,this).clientSecret,useMtls:S(Ya,this).useMtls,customFetch:S(Za,this),telemetryConfig:S(qa,this),grantRequest:async(e,t,n,o)=>{const r=(await v(ns,this,Wc).call(this)).serverMetadata,i=v(ns,this,Dc).call(this,n);if(o){const n=js(i),o=await v(ns,this,Mc).call(this,r,n);o[Mr]=xc(n,e);const a=await ci(o,e,t),s=Us.fromTokenEndpointResponse(a),c=n.getCapturedResponse();if(!c)throw new Ss;return{data:s,response:c}}const a=await v(ns,this,Mc).call(this,r);a[Mr]=xc(i,e);const s=await ci(a,e,t);return Us.fromTokenEndpointResponse(s)}}),this.passwordless=new ic({domain:S(Ya,this).domain,clientId:S(Ya,this).clientId,customFetch:S(Za,this),telemetryConfig:S(qa,this),clientSecret:S(Ya,this).clientSecret,clientAssertionSigningKey:S(Ya,this).clientAssertionSigningKey,clientAssertionSigningAlg:S(Ya,this).clientAssertionSigningAlg,useMtls:S(Ya,this).useMtls,grantRequest:async(e,t,n,o)=>{const r=(await v(ns,this,jc).call(this,n)).configuration;if(o){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:S(Za,this)),o=await v(ns,this,Mc).call(this,r.serverMetadata(),n),a=await ci(o,e,t),s=Us.fromTokenEndpointResponse(a),c=n.getCapturedResponse();if(!c)throw new Ss;return{data:s,response:c}}try{const n=await ci(r,e,t);return Us.fromTokenEndpointResponse(n)}catch(e){const t=e,n={};throw Es(n,e),t._statusCode=n.statusCode,t._headers=n.headers,e}}}),this.database=new fc({domain:S(Ya,this).domain,clientId:S(Ya,this).clientId,customFetch:S(Za,this),telemetryConfig:S(qa,this)}),this.anonymous=new vc({domain:S(Ya,this).domain,clientId:S(Ya,this).clientId,clientSecret:S(Ya,this).clientSecret,clientAssertionSigningKey:S(Ya,this).clientAssertionSigningKey,clientAssertionSigningAlg:S(Ya,this).clientAssertionSigningAlg,useMtls:S(Ya,this).useMtls,customFetch:S(Za,this)})}async getServerMetadata(){return(await v(ns,this,Wc).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await v(ns,this,Wc).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new is("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 v(ns,this,Jc).call(this,e)}catch(e){throw new ws(e)}}async buildLinkUserUrl(e){try{const t=await v(ns,this,Jc).call(this,{authorizationParams:O(O({},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 ys(e)}}async buildUnlinkUserUrl(e){try{const t=await v(ns,this,Jc).call(this,{authorizationParams:O(O({},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 vs(e)}}async backchannelAuthentication(e,t){var n;const o=await v(ns,this,jc).call(this,t),r=o.configuration,i=o.serverMetadata,a=Ts(O(O({},S(Ya,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(O(O({scope:kc},a),{},{client_id:S(Ya,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));if(e.requestedExpiry&&s.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetail
2s&&s.append("authorization_details",JSON.stringify(e.authorizationDetails)),e.fullResponse){var c;const e=js(null!==(c=r[Mr])&&void 0!==c?c:S(Za,this)),n=await v(ns,this,Mc).call(this,r.serverMetadata(),e);try{const t=await Yr(r,s),o=await Zr(n,t),i=e.getCapturedResponse();if(!i)throw new Ss;return{data:Us.fromTokenEndpointResponse(o),response:i}}catch(t){if(t instanceof Ss)throw t;const n=new gs(t);throw Es(n,t,e.getCapturedResponse()),n}}const u=js(null!==(n=r[Mr])&&void 0!==n?n:S(Za,this)),l=await v(ns,this,Mc).call(this,r.serverMetadata(),u);try{const e=await Yr(r,s),t=await Zr(l,e);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new gs(e);throw Es(t,e,u.getCapturedResponse()),t}}async initiateBackchannelAuthentication(e,t){var n;const o=await v(ns,this,jc).call(this,t),r=o.configuration,i=o.serverMetadata,a=Ts(O(O({},S(Ya,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(O(O({scope:kc},a),{},{client_id:S(Ya,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&s.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&s.append("authorization_details",JSON.stringify(e.authorizationDetails));const c=js(null!==(n=r[Mr])&&void 0!==n?n:S(Za,this)),u=await v(ns,this,Mc).call(this,r.serverMetadata(),c);try{const e=await Yr(u,s);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){const t=new gs(e),n=c.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async backchannelAuthenticationGrant(e,t){var n;let o=e.authReqId;const r=(await v(ns,this,jc).call(this,t)).configuration,i=new URLSearchParams({auth_req_id:o}),a=js(null!==(n=r[Mr])&&void 0!==n?n:S(Za,this)),s=await v(ns,this,Mc).call(this,r.serverMetadata(),a);try{const e=await ci(s,"urn:openid:params:grant-type:ciba",i);return Us.fromTokenEndpointResponse(e)}catch(e){const t=new gs(e),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async getTokenForConnection(e,t){var n;if(e.refreshToken&&e.accessToken)throw new ds("Either a refresh or access token should be specified, but not both.");const o=null!==(n=e.accessToken)&&void 0!==n?n:e.refreshToken;if(!o)throw new ds("Either a refresh or access token must be specified.");try{return await this.exchangeToken(O({connection:e.connection,subjectToken:o,subjectTokenType:e.accessToken?Pc:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint},e.fullResponse?{fullResponse:!0}:{}),t)}catch(e){if(e instanceof hs){const t=new ds(e.message,e.cause);throw t.statusCode=e.statusCode,t.headers=e.headers,t}throw e}}async exchangeToken(e,t){return e.fullResponse?"connection"in e?v(ns,this,Kc).call(this,e,t,!0):v(ns,this,Fc).call(this,e,t,!0):"connection"in e?v(ns,this,Kc).call(this,e,t):v(ns,this,Fc).call(this,e,t)}async getTokenByCode(e,t,n){var o;const r=(await v(ns,this,jc).call(this,n)).configuration;if(void 0!==t.organization&&ks(t.organization),t.fullResponse){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:S(Za,this)),o=await v(ns,this,Mc).call(this,r.serverMetadata(),n);let a,s;try{const r=await Qr(o,e,{pkceCodeVerifier:t.codeVerifier});if(a=Us.fromTokenEndpointResponse(r),s=n.getCapturedResponse(),!s)throw new Ss}catch(e){if(e instanceof Ss)throw e;const t=new ss("There was an error while trying to request a token.",rs(e)),o=n.getCapturedResponse();throw t.statusCode=null==o?void 0:o.status,t.headers=o?_s(o.headers):void 0,t}return t.organization&&Rs(a.claims,t.organization),{data:a,response:s}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:S(Za,this)),s=await v(ns,this,Mc).call(this,r.serverMetadata(),a);let c;try{const n=await Qr(s,e,{pkceCodeVerifier:t.codeVerifier});c=Us.fromTokenEndpointResponse(n)}catch(e){const t=new ss("There was an error while trying to request a token.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}return t.organization&&Rs(c.claims,t.organization),c}async getTokenByMagicLinkCode(e,t,n){var o;const r=(await v(ns,this,jc).call(this,n)).configuration;if(null!=t&&t.fullResponse){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:S(Za,this)),o=await v(ns,this,Mc).call(this,r.serverMetadata(),n);try{const r=await Qr(o,e,{expectedState:null==t?void 0:t.expectedState}),i=Us.fromTokenEndpointResponse(r),a=n.getCapturedResponse();if(!a)throw new Ss;return{data:i,response:a}}catch(e){if(e instanceof Ss)throw e;const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",o=new ss(t,e),r=n.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?_s(r.headers):void 0,o}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:S(Za,this)),s=await v(ns,this,Mc).call(this,r.serverMetadata(),a);try{const n=await Qr(s,e,{expectedState:null==t?void 0:t.expectedState});return Us.fromTokenEndpointResponse(n)}catch(e){const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",n=new ss(t,e),o=a.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}async getTokenByRefreshToken(e,t){var n;const o=(await v(ns,this,jc).call(this,t)).configuration,r=new URLSearchParams;
2if(e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.fullResponse){var i;const t=js(null!==(i=o[Mr])&&void 0!==i?i:S(Za,this)),n=await v(ns,this,Mc).call(this,o.serverMetadata(),t);try{const o=await $r(n,e.refreshToken,r),i=Us.fromTokenEndpointResponse(o),a=t.getCapturedResponse();if(!a)throw new Ss;return{data:i,response:a}}catch(e){if(e instanceof Ss)throw e;const n=new us("The access token has expired and there was an error while trying to refresh it.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}const a=js(null!==(n=o[Mr])&&void 0!==n?n:S(Za,this)),s=await v(ns,this,Mc).call(this,o.serverMetadata(),a);try{const t=await $r(s,e.refreshToken,r);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new us("The access token has expired and there was an error while trying to refresh it.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async revokeToken(e,t){var n;const o=(await v(ns,this,jc).call(this,t)).configuration,r={};e.tokenTypeHint&&(r.token_type_hint=e.tokenTypeHint);const i=js(null!==(n=o[Mr])&&void 0!==n?n:S(Za,this)),a=await v(ns,this,Mc).call(this,o.serverMetadata(),i);try{await async function(e,t,n){oi(e);const o=Nr(e),r=o.as,i=o.c,a=o.auth,s=o.fetch,c=o.tlsOnly,u=o.timeout;return async function(e,t,n,o,r){dn(e),hn(t),on(o,'"token"');const i=yn(e,"revocation_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),a=new URLSearchParams(null==r?void 0:r.additionalParameters);a.set("token",o);const s=$t(null==r?void 0:r.headers);return s.delete("accept"),Ln(e,t,n,i,a,s,r)}(r,i,a,t,{[Gt]:s,[Dt]:!c,additionalParameters:new URLSearchParams(n),headers:new Headers(Cr),signal:ri(u)}).then(fo).catch(Br)}(a,e.token,r)}catch(e){const t=new ps("An error occurred while trying to revoke the token.",rs(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async getUserInfo(e,t){const n=(await v(ns,this,jc).call(this,t,!0)).configuration;try{var o;return await ii(n,e.accessToken,null!==(o=e.expectedSubject)&&void 0!==o?o:Ur)}catch(e){throw new fs("There was an error while trying to retrieve the user info.",rs(e))}}async getTokenByPassword(e,t){var n;const o=(await v(ns,this,jc).call(this,t)).configuration,r=new URLSearchParams({username:e.username,password:e.password});e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.realm&&r.append("realm",e.realm);let i=o;if(e.auth0ForwardedFor){const t=await v(ns,this,Xc).call(this);i=new Xr(o.serverMetadata(),S(Ya,this).clientId,{client_secret:S(Ya,this).clientSecret,use_mtls_endpoint_aliases:S(Ya,this).useMtls},t);const n=o[Mr];i[Mr]=(t,o)=>n(t,O(O({},o),{},{headers:O(O({},o.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}if(e.fullResponse){var a;const e=js(null!==(a=i[Mr])&&void 0!==a?a:S(Za,this)),n=await v(ns,this,Mc).call(this,i.serverMetadata(),e);try{const t=await ci(n,"password",r),o=Us.fromTokenEndpointResponse(t),i=e.getCapturedResponse();if(!i)throw new Ss;return{data:o,response:i}}catch(t){if(t instanceof Ss)throw t;const n=new ls("There was an error while trying to request a token.",rs(t)),o=e.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}const s=js(null!==(n=i[Mr])&&void 0!==n?n:S(Za,this)),c=await v(ns,this,Mc).call(this,i.serverMetadata(),s);try{const e=await ci(c,"password",r);return Us.fromTokenEndpointResponse(e)}catch(e){const t=new ls("There was an error while trying to request a token.",rs(e)),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async getTokenByPasswordlessEmail(e,t){const n=new URLSearchParams({username:e.email,otp:e.code,realm:"email"});return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),v(ns,this,Hc).call(this,n,t,e.fullResponse)}async getTokenByPasswordlessSms(e,t){if(!oc(e.phoneNumber))throw new ec("Phone number must be in E.164 format (e.g. +14155550100).");const n=new URLSearchParams({username:e.phoneNumber,otp:e.code,realm:"sms"});
2return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),v(ns,this,Hc).call(this,n,t,e.fullResponse)}async getTokenByClientCredentials(e,t){var n;const o=(await v(ns,this,jc).call(this,t)).configuration;if(e.fullResponse){var r;const t=js(null!==(r=o[Mr])&&void 0!==r?r:S(Za,this)),n=await v(ns,this,Mc).call(this,o.serverMetadata(),t),i=new URLSearchParams({audience:e.audience});e.organization&&i.append("organization",e.organization);try{const e=await ei(n,i),o=Us.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new Ss;return{data:o,response:r}}catch(e){if(e instanceof Ss)throw e;const n=new cs("There was an error while trying to request a token.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}const i=js(null!==(n=o[Mr])&&void 0!==n?n:S(Za,this)),a=await v(ns,this,Mc).call(this,o.serverMetadata(),i);try{const t=new URLSearchParams({audience:e.audience});e.organization&&t.append("organization",e.organization);const n=await ei(a,t);return Us.fromTokenEndpointResponse(n)}catch(e){const t=new cs("There was an error while trying to request a token.",rs(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async buildLogoutUrl(e){const t=await v(ns,this,Wc).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(S(Ya,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",S(Ya,this).clientId),e.federated&&t.searchParams.set("federated",""),t}const o={post_logout_redirect_uri:e.returnTo};return e.federated&&(o.federated=""),function(e,t){oi(e);const n=Nr(e),o=n.as,r=n.c,i=yn(o,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const e of t.entries()){var a=I(e,2);const t=a[0],n=a[1];i.searchParams.append(t,n)}return i}(n,o)}async verifyLogoutToken(e){const t=(await v(ns,this,Wc).call(this)).serverMetadata,n=Ec(S(Ya,this).discoveryCache),o=t.jwks_uri;S(Qa,this)||E(Qa,this,function(e,t){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");const n=new URL(e.href).href,o=null!=t?t:{},r=o.timeoutDuration;if("number"==typeof r&&(!Number.isInteger(r)||r<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');const i="number"==typeof r?r:5e3,a=ta(o.cooldownDuration,3e4,"cooldownDuration"),s=ta(o.cacheMaxAge,6e5,"cacheMaxAge"),c=new Headers(o.headers);qi&&!c.has("User-Agent")&&c.set("User-Agent",qi),c.has("accept")||c.set("accept","application/json, application/jwk-set+json");const u=o[Qi],l=o[$i];let d,h,p,f=0,m=0;if(l&&"object"==typeof l){const e=l.uat,t=l.jwks;ea(e,s)&&qo(t)&&(d=e,p=Vi(t))}const g=async()=>{if(h&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(h=void 0),!h){const e=++f,t=h=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch;const r=await o(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Fo;throw e});if(200!==r.status)throw new xo("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch(e){throw new xo("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(n,c,AbortSignal.timeout(i),u).then(t=>{const n=Vi(t);if(e<=m)return;p=n;const o=Date.now();l&&(l.uat=o,l.jwks=t),d=o,m=e}).finally(()=>{h===t&&(h=void 0)})}await h};return Object.defineProperties(async(e,t)=>{p&&ea(d,s)||await g();try{return await p(e,t)}catch(n){if(n instanceof Ko&&!ea(d,a))return await g(),p(e,t);throw n}},{coolingDown:{get:()=>ea(d,a),enumerable:!0},fresh:{get:()=>ea(d,s),enumerable:!0},reload:{value:g,enumerable:!0},reloading:{get:()=>!!h,enumerable:!0},jwks:{value:()=>{var e;return null===(e=p)||void 0===e?void 0:e.jwks()},enumerable:!0}})}(new URL(o),{cacheMaxAge:n.ttlMs,[Qi]:S(Za,this),[$i]:S(ts,this)}));const r=(await async function(e,t,n){const o=await yi(e,function(e){return[e&&Er("algorithms",e.algorithms),null==e?void 0:e.crit]}(n),t);
2if(!o[2])throw new Wo("JWTs MUST NOT use unencoded payload");const r={payload:Ni(o[1],o[0],n),protectedHeader:o[1]};return"function"==typeof t?O(O({},r),{},{key:o[3]}):r}(e.logoutToken,S(Qa,this),{issuer:t.issuer,audience:S(Ya,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in r)&&!("sub"in r))throw new ms('either "sid" or "sub" (or both) claims must be present');if("sid"in r&&"string"!=typeof r.sid)throw new ms('"sid" claim must be a string');if("sub"in r&&"string"!=typeof r.sub)throw new ms('"sub" claim must be a string');if("nonce"in r)throw new ms('"nonce" claim is prohibited');if(!("events"in r))throw new ms('"events" claim is missing');if("object"!=typeof r.events||null===r.events)throw new ms('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in r.events))throw new ms('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof r.events["http://schemas.openid.net/event/backchannel-logout"])throw new ms('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:r.sid,sub:r.sub}}});function Uc(){const e=S(Ya,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(S(Ya,this).useMtls?"1":"0")}async function Mc(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=await v(ns,this,Xc).call(this,n),r=new Xr(e,S(Ya,this).clientId,{client_secret:S(Ya,this).clientSecret,use_mtls_endpoint_aliases:S(Ya,this).useMtls},o);return r[Mr]=null!=t?t:S(Za,this),r}function Dc(e){return Ws(S(Za,this),e,S(qa,this))}async function jc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await v(ns,this,Wc).call(this,t),o=n.configuration,r=n.serverMetadata;if(!e)return{configuration:o,serverMetadata:r};const i=v(ns,this,Dc).call(this,e);return{configuration:await v(ns,this,Mc).call(this,r,i,t),serverMetadata:r}}async function Wc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=S(e?Ja:Xa,this);if(t&&S(za,this))return{configuration:t,serverMetadata:S(za,this)};const n=v(ns,this,Uc).call(this);e||await v(ns,this,Xc).call(this,!1);const o=S($a,this).get(n);if(o)return v(ns,this,Gc).call(this,o.serverMetadata,e);const r=S(es,this).get(n);if(r){const t=await r;return v(ns,this,Gc).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await Fr(new URL("https://".concat(S(Ya,this).domain)),S(Ya,this).clientId,{use_mtls_endpoint_aliases:S(Ya,this).useMtls},(e,t,n,o)=>{n.set("client_id",t.client_id)},{[Mr]:S(Za,this)})).serverMetadata();return S($a,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),S(es,this).set(n,i);try{const t=(await i).serverMetadata;return v(ns,this,Gc).call(this,t,e)}finally{S(es,this).delete(n)}}async function Gc(e,t){const n=await v(ns,this,Mc).call(this,e,void 0,t);return E(za,this,e),E(t?Ja:Xa,this,n),{configuration:n,serverMetadata:e}}async function Kc(e,t,n){var o,r,i;const a=(await v(ns,this,jc).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new hs("audience and resource parameters are not supported for Token Vault exchanges");Oc(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(o=e.subjectTokenType)&&void 0!==o?o:Pc,requested_token_type:null!==(r=e.requestedTokenType)&&void 0!==r?r:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&s.append("login_hint",e.loginHint),e.scope&&s.append("scope",e.scope),Cc(s,e.extra),n){var c;const t=js(null!==(c=a[Mr])&&void 0!==c?c:S(Za,this)),o=await v(ns,this,Mc).call(this,a.serverMetadata(),t);try{const e=await ci(o,Ic,s),n=Us.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new Ss;return{data:n,response:r}}catch(n){if(n instanceof Ss)throw n;const o=new hs("Failed to exchange token for connection '".concat(e.connection,"'."),rs(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?_s(r.headers):void 0,o}}const u=js(null!==(i=a[Mr])&&void 0!==i?i:S(Za,this)),l=await v(ns,this,Mc).call(this,a.serverMetadata(),u);try{const e=await ci(l,Ic,s);return Us.fromTokenEndpointResponse(e)}catch(t){const n=new hs("Failed to exchange token for connection '".concat(e.connection,"'."),rs(t)),o=u.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}function Bc(e,t,n){var o;if(n.organization&&Rs(e.claims,n.organization),n.actorToken)if(null!==(o=e.claims)&&void 0!==o&&o.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new Wo("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],o=t.length;if(5===o)throw new Wo("Only JWTs using Compact JWS serialization can be decoded");
2if(3!==o)throw new Wo("Invalid JWT");if(!n)throw new Wo("JWTs must contain a payload");let r,i;try{r=Vo(n)}catch(e){throw new Wo("Failed to base64url decode the payload")}try{i=JSON.parse(Oo.decode(r))}catch(e){throw new Wo("Failed to parse the decoded payload as JSON")}if(!Zo(i))throw new Wo("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function Fc(e,t,n){var o;const r=(await v(ns,this,jc).call(this,t)).configuration;if(Oc(e.subjectToken),void 0!==e.organization&&ks(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new hs("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),Cc(i,e.extra),n){var a;const t=js(null!==(a=r[Mr])&&void 0!==a?a:S(Za,this)),o=await v(ns,this,Mc).call(this,r.serverMetadata(),t);let s,c,u;try{if(c=await ci(o,Nc,i),s=Us.fromTokenEndpointResponse(c),u=t.getCapturedResponse(),!u)throw new Ss}catch(n){if(n instanceof Ss)throw n;const o=new hs("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),rs(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?_s(r.headers):void 0,o}return v(ns,this,Bc).call(this,s,c,e),{data:s,response:u}}const s=js(null!==(o=r[Mr])&&void 0!==o?o:S(Za,this)),c=await v(ns,this,Mc).call(this,r.serverMetadata(),s);let u,l;try{l=await ci(c,Nc,i),u=Us.fromTokenEndpointResponse(l)}catch(t){const n=new hs("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),rs(t)),o=s.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}return v(ns,this,Bc).call(this,u,l,e),u}async function Hc(e,t,n){var o;const r=(await v(ns,this,jc).call(this,t)).configuration;if(n){var i;const t=js(null!==(i=r[Mr])&&void 0!==i?i:S(Za,this)),n=await v(ns,this,Mc).call(this,r.serverMetadata(),t);try{const o=await ci(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),r=Us.fromTokenEndpointResponse(o),i=t.getCapturedResponse();if(!i)throw new Ss;return{data:r,response:i}}catch(e){if(e instanceof Ss)throw e;const n=new ec("There was an error while trying to request a token.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?_s(o.headers):void 0,n}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:S(Za,this)),s=await v(ns,this,Mc).call(this,r.serverMetadata(),a);try{const t=await ci(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new ec("There was an error while trying to request a token.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?_s(n.headers):void 0,t}}async function Xc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!S(Ya,this).clientSecret||!!S(Ya,this).clientAssertionSigningKey||!!S(Ya,this).useMtls;return e&&!t?(e,t,n,o)=>{n.set("client_id",t.client_id)}:(S(Va,this)||E(Va,this,(async()=>{if(!S(Ya,this).clientSecret&&!S(Ya,this).clientAssertionSigningKey&&!S(Ya,this).useMtls)throw new bs;if(S(Ya,this).useMtls)return(e,t,n,o)=>{n.set("client_id",t.client_id)};let e=S(Ya,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await na(e,S(Ya,this).clientAssertionSigningAlg||"RS256")),e?function(e){return fn(e,void 0)}(e):Lr(S(Ya,this).clientSecret)})().catch(e=>{throw E(Va,this,void 0),e})),S(Va,this))}async function Jc(e){const t=(await v(ns,this,Wc).call(this)).configuration,n=an(),o=await function(e){return async function(e){return on(e,"codeVerifier"),Vt(await crypto.subtle.digest("SHA-256",Xt(e)))}(e)}(n),r=Ts(O(O({},S(Ya,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(O(O({scope:kc},r),{}
2,{client_id:S(Ya,this).clientId,code_challenge:o,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await ni(t,i):await ti(t,i),codeVerifier:n}}var zc,Vc;new Sc(1e3,6e4);class Yc extends K{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Yc.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new Yc(t,n)}}class Zc extends Yc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Zc.prototype)}}class qc extends Yc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,qc.prototype)}}class Qc extends Yc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Qc.prototype)}}class $c extends Yc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,$c.prototype)}}class eu extends Yc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,eu.prototype)}}class tu{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=I(n,2);const o=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(o)}}get size(){return this.contexts.size}}class nu{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new tu}setMFAAuthDetails(e,t,n,o){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:o})}async getAuthenticators(e){var t,n,o;const r=this.contextManager.get(e);if(!r)throw new Zc("invalid_request","MFA context not found for this MFA token");const i=null===(n=null===(t=r.mfaRequirements)||void 0===t?void 0:t.challenge)||void 0===n?void 0:n.map(e=>e.type);try{const t=await this.authJsMfaClient.listAuthenticators({mfaToken:e});return i&&0!==i.length?t.filter(e=>!!e.type&&i.includes(e.type)):t}catch(e){if(e instanceof Cs)throw new Zc(null===(o=e.cause)||void 0===o?void 0:o.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=Ct[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof Is)throw new qc(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 Ps)throw new Qc(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 eu("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 $c("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-rec
2overy-code":void 0}(e);if(!n)throw new $c("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const o=t.scope,r=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:o,audience:r,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof $c)throw new $c(e.error,e.error_description);throw e}}}class ou extends Error{constructor(e,t,n){super(t),this.name="PasskeyError",this.code=e,this.cause=n,Object.setPrototypeOf(this,ou.prototype)}}class ru{constructor(e,t){zc.set(this,void 0),Vc.set(this,void 0),g(this,zc,e,"f"),g(this,Vc,t,"f")}async signup(e){if(!window.PublicKeyCredential)throw new ou("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.scope,n=e.audience,o=f(e,["scope","audience"]),r=await m(this,zc,"f").register(o),i=su(r.authnParamsPublicKey),a=await navigator.credentials.create({publicKey:i});if(!a)throw new ou("passkey_cancelled","Passkey creation was cancelled or no credential was returned.");const s=uu(a);return m(this,Vc,"f")._requestTokenForPasskey({authSession:r.authSession,credential:s,realm:o.realm,organization:o.organization,scope:t,audience:n})}async login(e){if(!window.PublicKeyCredential)throw new ou("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e||{},n=t.scope,o=t.audience,r=f(t,["scope","audience"]),i=await m(this,zc,"f").challenge(Object.keys(r).length>0?r:void 0),a=cu(i.authnParamsPublicKey),s=await navigator.credentials.get({publicKey:a});if(!s)throw new ou("passkey_cancelled","Passkey authentication was cancelled or no credential was returned.");const c=lu(s);return m(this,Vc,"f")._requestTokenForPasskey({authSession:i.authSession,credential:c,realm:r.realm,organization:r.organization,scope:n,audience:o})}async getSignupChallenge(e){if(!window.PublicKeyCredential)throw new ou("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await m(this,zc,"f").register(e);return{authSession:t.authSession,publicKey:su(t.authnParamsPublicKey)}}async getLoginChallenge(e){if(!window.PublicKeyCredential)throw new ou("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await m(this,zc,"f").challenge(e);return{authSession:t.authSession,publicKey:cu(t.authnParamsPublicKey)}}async getTokenWithPasskey(e){if(!window.PublicKeyCredential)throw new ou("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.authSession,n=e.credential,o=e.realm,r=e.organization,i=e.scope,a=e.audience,s=n.response;let c;if(s instanceof AuthenticatorAttestationResponse)c=uu(n);else{if(!(s instanceof AuthenticatorAssertionResponse))throw new ou("passkey_invalid_credential","The provided credential is not a valid attestation or assertion response.");c=lu(n)}return m(this,Vc,"f")._requestTokenForPasskey({authSession:t,credential:c,realm:o,organization:r,scope:i,audience:a})}}function iu(e){const t=new Uint8Array(e),n=Array.from(t,e=>String.fromCharCode(e)).join("");return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function au(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),o=atob(n),r=new Uint8Array(o.length);for(let e=0;e<o.length;e++)r[e]=o.charCodeAt(e);return r.buffer}function su(e){return Object.assign(Object.assign({},e),{challenge:au(e.challenge),user:Object.assign(Object.assign({},e.user),{id:au(e.user.id)}),pubKeyCredParams:e.pubKeyCredParams,authenticatorSelection:e.authenticatorSelection})}function cu(e){return Object.assign(Object.assign({},e),{challenge:au(e.challenge)})}function uu(e){var t;const n=e.response;return{id:e.id,rawId:iu(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:iu(n.clientDataJSON),attestationObject:iu(n.attestationObject)},clientExtensionResults:e.getClientExtensionResults()}}function lu(e){var t;const n=e.response;return{id:e.id,rawId:iu(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:iu(n.clientDataJSON),authenticatorData:iu(n.authenticatorData),signature:iu(n.signature),userHandle:n.userHandle?iu(n.userHandle):void 0},clientExtensionResults:e.getClientExtensionResults()}}function du(e){return{get(){try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}},set(t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}},remove(){try{window.localStorage.removeItem(e)}catch(e){}}}}function hu(){let e=null;return{get:()=>e,set:t=>{e=t},remove:()=>{e=null}}}zc=new WeakMap,Vc=new WeakMap;class pu{constructor(e,t){this.slots=new Map,this.baseKey="".concat("@@auth0spajs@@","::").concat(e,"::anonymous"),this.useLocalStorage="localStorage"===t&&"undefined"!=typeof window&&!!window.localStorage,this.sessionKey="".concat(this.baseKey,"::").concat("session"),this.sessionStore=this.useLocalStorage?du(this.sessionKey):hu()}getStore(e,t){const n="".concat(this.baseKey,"::").concat(JSON.stringify([null!=e?e:"",null!=t?t:""]));return this.slots.has(n)||this.slots.set(n,this.useLocalStorage?du(n):hu()),this.slots.get(n)}getSessionToken(){return this.sessionStore.get()}setSessionToken(e){this.sessionStore.set(e)}
2removeAll(){if(this.sessionStore.remove(),this.slots.forEach(e=>e.remove()),this.slots.clear(),this.useLocalStorage)try{const e=this.baseKey+"::",t=[];for(let n=0;n<window.localStorage.length;n++){const o=window.localStorage.key(n);(null==o?void 0:o.startsWith(e))&&t.push(o)}t.forEach(e=>window.localStorage.removeItem(e))}catch(e){}}}class fu{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"localStorage",o=arguments.length>3?arguments[3]:void 0;this.authJsClient=e,this.clientId=t,this.cache=new pu(t,n),this.lockManager=null!=o?o:ke()}async createSession(e){const t=await this.authJsClient.createSession(e);return this.cache.setSessionToken(Object.assign({sessionToken:t.sessionToken},void 0!==t.sessionTokenExpiresAt&&{sessionTokenExpiresAt:t.sessionTokenExpiresAt})),this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:t.accessToken,expiresAt:t.expiresAt},void 0!==t.scope&&{scope:t.scope})),t}async getTokenSilently(e){const t=this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope),n=t.get();return n&&n.expiresAt-60>Date.now()/1e3?n:this.lockManager.runWithLock("anonymous::".concat(this.clientId),5e3,async()=>{var n;const o=t.get();if(o&&o.expiresAt-60>Date.now()/1e3)return o;const r=null===(n=this.cache.getSessionToken())||void 0===n?void 0:n.sessionToken,i=await this.authJsClient.getAccessToken(Object.assign(Object.assign({},e),{sessionToken:r}));return this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})),!i.sessionReplaced&&this.cache.getSessionToken()||this.cache.setSessionToken(Object.assign({sessionToken:i.sessionToken},void 0!==i.sessionTokenExpiresAt&&{sessionTokenExpiresAt:i.sessionTokenExpiresAt})),Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})})}async logout(){await this.authJsClient.logout(),this.cache.removeAll()}hasSession(){var e;return!!(null===(e=this.cache.getSessionToken())||void 0===e?void 0:e.sessionToken)}getClaims(){return null}}class mu{resolveOnlineAccess(e){if("online"!==e.refreshTokenMode)return!1;if(!0!==e.useRefreshTokens)throw new B('`refreshTokenMode: "online"` requires the refresh-token grant.',"Set `useRefreshTokens: true`.");if(!0!==e.useDpop)throw new B('`refreshTokenMode: "online"` requires DPoP, which is missing or disabled.',"Set `useDpop: true` (DPoP is mandatory for online access).");return!0}warnEnterpriseConnectConfig(e){var t,n;if(!0!==e.enterpriseConnect)return;const o=null===(t=e.authorizationParams)||void 0===t?void 0:t.scope;(!0===e.useRefreshTokens||"string"==typeof o&&o.includes("offline_access"))&&console.warn("Enterprise Connect issues no refresh token; `useRefreshTokens` and `offline_access` in `scope` have no effect."),(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)&&console.warn("Enterprise Connect resolves the organization from the email domain (Home Realm Discovery); a static `organization` breaks multi-customer setups.")}constructor(e){let t,n;if(this.userCache=(new $e).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0,refreshTokenMode:"offline",anonymousSessionsCacheMode:"localStorage"},this.onlineAccess=this.resolveOnlineAccess(e),this.warnEnterpriseConnectConfig(e),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(!ee())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===ee().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=ke(),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||U,!bt(t))throw new Error('Invalid cac
2he location "'.concat(t,'"'));n=bt(t)()}var o;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:L,this.cookieStorage=!1===e.legacySameSiteCookie?lt:ht,this.orgHintCookieName=(o=this.options.clientId,"auth0.".concat(o,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:pt;let i="";var a;this.onlineAccess?i=D:this.options.useRefreshTokens&&(i="offline_access"),this.scope=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if("object"!=typeof e)return{[G]:ze(t,e,...o)};let i={[G]:ze(t,...o)};return Object.keys(e).forEach(n=>{const r=e[n];i[n]=ze(t,r,...o)}),i}(this.options.authorizationParams.scope,"openid",i),this.transactionManager=new tt(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||W,this.cacheManager=new et(n,n.allKeys?void 0:new wt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Et(this.options.clientId):void 0,this.domainUrl=(a=this.options.domain,/^https?:\/\//.test(a)?a:"https://".concat(a)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const s="".concat(this.domainUrl,"/me/"),c=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{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:s},detailedResponse:!0})}}));this.myAccount=new Rt(c,s),this.authJsClient=new Lc({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new nu(this.authJsClient.mfa,this),this.anonymous=new fu(this.authJsClient.anonymous,this.options.clientId,this.options.anonymousSessionsCacheMode,this.lockManager),this.passkey=new ru(this.authJsClient.passkey,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===U&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new gt,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||j,n=re(t,!0),o=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(o)}_authorizeUrl(e){return this._url("/authorize?".concat(ie(e)))}async _verifyIdToken(e,t,n){const o=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),n=I(t,3),o=n[0],r=n[1],i=n[2];if(3!==t.length||!o||!r||!i)throw new Error("ID token could not be decoded");const a=JSON.parse(se(r)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],ot.includes(e)||(c[e]=a[e])}),{encoded:{header:o,payload:r,signature:i},header:JSON.parse(se(o)),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");
2if(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&&!nt(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||!nt(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!nt(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,o=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),o>r)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(o,") is after expiration time (").concat(r,")"));if(null!=t.claims.nbf&&nt(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),o<e)throw new Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(o,") is before ").concat(e))}if(null!=t.claims.auth_time&&nt(t.claims.auth_time)){const r=new Date(0);if(r.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),o>r)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(o,") is after last auth at ").concat(r))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.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:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:o});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_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 o;const r=ne(te()),i=ne(te()),a=te(),s=await ae(a),c=ce(s),u=await(null===(o=this.dpop)||void 0===o?void 0:o.calculateThumbprint()),l=((e,t,n,o,r,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:Ve(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:o,nonce:r,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,r,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||G,redirect_uri:l.redirect_uri,state:r,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 V;const o=this._applySessionTransferToken(e.authorizationParams||{}),r=await this._prepareAuthorizeUrl(o,{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const i=await((e,t)=>new Promise((n,o)=>{let r;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",r,!1),o(new z(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),o(new J(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return o(K.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(r.url).origin);if(r.state!==i.state)throw new K("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:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;if(await this._isSessionCeilingReached())return;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;if(await this._isSessionCeilingReached())return;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=At(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
2),n=t.openUrl,o=t.fragment,r=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:r,response_type:ft.Code}),a&&{organization:a}));const d=o?"".concat(u,"#").concat(o):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 K("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===ft.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,o=e.state,r=e.error,i=e.error_description;if(r)throw new F(r,i||r,o,t.appState);if(!t.code_verifier||t.state&&t.state!==o)throw new K("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:ft.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,o=e.state,r=e.error,i=e.error_description;if(r)throw new H(r,i||r,t.connection,o,t.appState);if(!n)throw new K("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===o))throw new K("state_mismatch","Invalid state");const a=await this.myAccount.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:ft.ConnectCode})}async _maybeCreateAnonymousSession(){if(this.options.createAnonymousSessionOnFailedSilentAuth){if(this.anonymous.hasSession())return;try{await this.anonymous.getTokenSilently()}catch(e){console.debug("[auth0-spa-js] Anonymous session creation failed",e)}}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(yt))return void await this._maybeCreateAnonymousSession();this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(yt)}try{await this.getTokenSilently(e)}catch(e){e instanceof K&&"login_required"===e.error&&e.error_description!==M&&await this._maybeCreateAnonymousSession()}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const o=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ve(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)})}),r=await this._getTokenSilently(o);return e.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const t=e.cacheMode,n=f(e,["cacheMode"]);if(await this._isSessionCeilingReached())return;if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||G,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const o=(r=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(r,".").concat(i));var r,i;try{return await this.lockManager.runWithLock(o,5e3,async()=>
2{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||G,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),o=e.id_token,r=e.token_type,i=e.access_token,a=e.oauthTokenScope,s=e.expires_in;return Object.assign(Object.assign({id_token:o,token_type:r,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 Y||e instanceof K&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&e.error_description===M}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||G,clientId:this.options.clientId});if(!t)throw new K("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,o;const r=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ve(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(o=e.authorizationParams)||void 0===o?void 0:o.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},x),t),await this.loginWithPopup(r,t),(await this.cacheManager.get(new qe({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||G,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,o=f(t,["federated"]),r=n?"&federated":"";return this._url("/v2/logout?".concat(ie(Object.assign({clientId:e.clientId},o))))+r}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||G,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,o=e.useFormData,r=e.refreshTokens,i=e.audience,a=e.client_id,s=e.onRefreshTokenRevoked;const c=e.timeout||L,u="refresh_token",l="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(re(n||j)))};if(t){const n={client_id:a,token_type_hint:u},r=o?ie(n):JSON.stringify(n);try{return await Be({type:"revoke",timeout:c,fetchUrl:l,fetchOptions:{method:"POST",body:r,headers:d},useFormData:o,auth:{audience:null!=i?i:G}},t)}catch(e){throw new K("revoke_error",e.message)}}for(const t of r){const n={client_id:a,token_type_hint:u,token:t},r=o?ie(n):JSON.stringify(n),i=await Fe(l,{method:"POST",body:r,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 K(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),this.onlineAccess&&await this._clearLocalSession()}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;this.options.enterpriseConnect&&!0!==(null===(t=e.logoutParams)||void 0===t?void 0:t.federated)&&console.warn("Enterprise Connect logout without `federated: true` leaves the enterprise IdP session alive; the next login may silently reuse the previous user.");const n=At(e),o=n.openUrl,r=f(n,["openUrl"]);await this._clearLocalSession(e.clientId);const i=this._buildLogoutUrl(r);o?await o(i):!1!==o&&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 o=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"}
2,window.location.origin),r=o.url,i=o.state,a=o.nonce,s=o.code_verifier,c=o.redirect_uri,u=o.scope,l=o.audience;if(window.crossOriginIsolated)throw new K("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((o,r)=>{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(()=>{r(new X),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(K.fromPayload(e.data.response)):o(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,h,d);if(i!==p.state)throw new K("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 K&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new qe({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||G,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new Z(e.authorizationParams.audience||G,e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,r=((e,t,n,o)=>{var r;if(e&&n&&o){if(t.audience!==n)return t.scope;const e=o.split(" "),i=(null===(r=t.scope)||void 0===r?void 0:r.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?o:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==t?void 0:t.audience,null==t?void 0:t.scope);try{const u=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),o&&{timeout:o}),{scopesToRequest:r});if(await this._propagateRotatedRefreshToken(null==t?void 0:t.refresh_token,u.refresh_token),this.options.useMrrt&&(i=null==t?void 0:t.audience,a=null==t?void 0:t.scope,s=e.authorizationParams.audience,c=e.authorizationParams.scope,i!==s||!((e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))})(c,a))){const t=((e,t,n)=>{const o=(null==e?void 0:e.split(" "))||[],r=n?o.filter(e=>e!==D):o,i=(null==t?void 0:t.split(" "))||[];return r.filter(e=>-1==i.indexOf(e)).join(",")})(r,u.scope,this.onlineAccess);if(t){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope),new q(e.authorizationParams.audience||"default",t)}}return Object.assign(Object.assign({},u),{scope:e.authorizationParams.scope,oauthTokenScope:u.scope,audience:e.authorizationParams.audience||G})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw t}var i,a,s,c}async _propagateRotatedRefreshToken(e,t){!this.onlineAccess&&t&&e&&await this.cacheManager.updateEntry(e,t,this.options.clientId,this.options.useMrrt)}async _saveEntryInCache(e){const t=e.decodedToken.claims,n=t.session_expiry,o=t.iat;
2if(void 0!==n){if("number"!=typeof n)throw new K("invalid_token","Invalid session_expiry: value must be a number.");if(n>=1e10)throw new K("invalid_token","Invalid session_expiry: value appears to be in milliseconds; expected a Unix timestamp in seconds.");if(void 0===o||n<=o)throw new K("invalid_token","Invalid session_expiry: session ceiling is before or at the token issue time.")}const r=e.id_token,i=e.decodedToken,a=f(e,["id_token","decodedToken"]);this.userCache.set(Ze,{id_token:r,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(a)}async _clearLocalSession(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.clientId;var t;null===e?await this.cacheManager.clear():await this.cacheManager.clear(e),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(Ze);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await Be({type:"clear"},this.worker)}catch(e){}}async _isSessionCeilingReached(){var e,t;const n=this.userCache.get(Ze),o=null!=n?n:await this.cacheManager.getIdToken(new qe({clientId:this.options.clientId})),r=null===(t=null===(e=null==o?void 0:o.decodedToken)||void 0===e?void 0:e.claims)||void 0===t?void 0:t.session_expiry;if(void 0===r)return!1;const i=await this.nowProvider();return Math.floor(i/1e3)>=r-30&&(await this._clearLocalSession(),!0)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||G,t=this.scope[e],n=await this.cacheManager.getIdToken(new qe({clientId:this.options.clientId,audience:e,scope:t})),o=this.userCache.get(Ze);return n&&n.id_token===(null==o?void 0:o.id_token)?o:(this.userCache.set(Ze,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,o=e.clientId,r=e.cacheMode;const i=await this.cacheManager.get(new qe({scope:t,audience:n,clientId:o}),60,this.options.useMrrt,r);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,o=i.expires_in,r=await this._getIdTokenFromCache();return r&&Object.assign(Object.assign({id_token:r.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:o})}}_storeMfaContext(e,t,n){e instanceof Y&&this.mfa.setMFAAuthDetails(e.mfa_token,t,n,e.mfa_requirements)}async _requestToken(e,t){var n,o,r,i,a,s;const c=t||{},u=c.nonceIn,l=c.organization,d=c.scopesToRequest;try{const t=await Je(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,preserveRefreshToken:this.onlineAccess},e),{scope:d||e.scope}),this.worker);let c=await this._verifyIdToken(t.id_token,u,l);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(o=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===o?void 0:o.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ze))}if("authorization_code"!==e.grant_type){const e=await this._getIdTokenFromCache(),t=null===(i=null===(r=null==e?void 0:e.decodedToken)||void 0===r?void 0:r.claims)||void 0===i?void 0:i.session_expiry;void 0!==t&&(c=Object.assign(Object.assign({},c),{claims:Object.assign(Object.assign({},c.claims),{session_expiry:t})}))}return!t.refresh_token&&this.onlineAccess&&(t.refresh_token=null!==(a=e.refresh_token)&&void 0!==a?a:null===(s=await this.cacheManager.get(new qe({scope:d||e.scope,audience:e.audience||G,clientId:this.options.clientId}),void 0,this.options.useMrrt))||void 0===s?void 0:s.refresh_token),await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},t),{decodedToken:c,scope:e.scope,audience:e.audience||G}),t.scope?{oauthTokenScope:t.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(l||c.claims.org_id),Object.assign(Object.assign({},t),{decodedToken:c})}catch(t){throw"authorization_code"!==e.grant_type&&this._storeMfaContext(t,d||e.scope,e.audie
2nce),t}}_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:Ve(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=this._buildTokenExchangeParams(e);try{const n=await Je(Object.assign(Object.assign({},t),{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 n.id_token&&await this._verifyIdToken(n.id_token,void 0,e.organization),n}catch(e){throw this._storeMfaContext(e,t.scope,t.audience),e}}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 kt(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,o=e.connection,r=e.scopes,i=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!o)throw new Error("connection is required");const c=ne(te()),u=te(),l=await ae(u),d=ce(l),h=await this.myAccount.connectAccount({connection:o,scopes:r,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:o,response_type:ft.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForPasskey(e){const t=e.audience||this.options.authorizationParams.audience,n=e.organization||this.options.authorizationParams.organization;return this._requestToken(Object.assign(Object.assign(Object.assign({grant_type:"urn:okta:params:oauth:grant-type:webauthn",auth_session:e.authSession,authn_response:e.credential},e.realm&&{realm:e.realm}),n&&{organization:n}),{scope:Ve(this.scope,e.scope,t),audience:t}))}async _requestTokenForMfa(e,t){const n=e.mfaToken,o=f(e,["mfaToken"]),r=await this.cacheManager.get(new qe({scope:o.scope,audience:o.audience||G,clientId:this.options.clientId}),void 0,this.options.useMrrt),i=await this._requestToken(Object.assign(Object.assign({},o),{mfa_token:n}),t);return await this._propagateRotatedRefreshToken(null==r?void 0:r.refresh_token,i.refresh_token),i}}function gu(e,t){return function(){return e.apply(t,arguments)}}const{toString:wu}=Object.prototype,{getPrototypeOf:yu}=Object,{iterator:vu,toStringTag:bu}=Symbol,Au=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Su=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),_u=(e,t,n)=>e===Object.prototype||!n&&null===t,Eu=(e,t)=>{let n=e;const o=[];for(;null!=n;){if(-1!==o.indexOf(n))return!1;o.push(n);const r=yu(n);if(_u(n,r,n===e))return!1;if(Au(n,t))return!0;n=r}return!1},Tu=(ku=Object.create(null),e=>{const t=wu.call(e);return ku[t]||(ku[t]=t.slice(8,-1).toLowerCase())});var ku;const Ru=e=>(e=e.toLowerCase(),t=>Tu(t)===e),Ou=e=>t=>typeof t===e,{isArray:Cu}
vendor: 4,172 bytes, line 2
2=Array,Iu=Ou("undefined");function Nu(e){return null!==e&&!Iu(e)&&null!==e.constructor&&!Iu(e.constructor)&&Lu(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Pu=Ru("ArrayBuffer");const xu=Ou("string"),Lu=Ou("function"),Uu=Ou("number"),Mu=e=>null!==e&&"object"==typeof e,Du=e=>{if(!Mu(e))return!1;const t=yu(e);return!(null!==t&&t!==Object.prototype&&null!==yu(t)||Eu(e,bu)||Eu(e,vu))},ju=Ru("Date"),Wu=Ru("File"),Gu=Ru("Blob"),Ku=Ru("FileList"),Bu=Ru("Set");const Fu="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Hu=void 0!==Fu.FormData?Fu.FormData:void 0,Xu=Ru("URLSearchParams"),[Ju,zu,Vu,Yu]=["ReadableStream","Request","Response","Headers"].map(Ru);function Zu(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let o,r;if("object"!=typeof e&&(e=[e]),Cu(e))for(o=0,r=e.length;o<r;o++)t.call(null,e[o],o,e);else{if(Nu(e))return;const r=n?Object.getOwnPropertyNames(e):Object.keys(e),i=r.length;let a;for(o=0;o<i;o++)a=r[o],t.call(null,e[a],a,e)}}function qu(e,t){if(Nu(e))return null;t=t.toLowerCase();const n=Object.keys(e);let o,r=n.length;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Qu="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,$u=e=>!Iu(e)&&e!==Qu;const el=(tl="undefined"!=typeof Uint8Array&&yu(Uint8Array),e=>tl&&e instanceof tl);var tl;const nl=Ru("HTMLFormElement"),{propertyIsEnumerable:ol}=Object.prototype,rl=Ru("RegExp"),il=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};Zu(n,(n,r)=>{let i;!1!==(i=t(n,r,e))&&(o[r]=i||n)}),Object.defineProperties(e,o)};const al=Ru("AsyncFunction"),sl=(cl="function"==typeof setImmediate,ul=Lu(Qu.postMessage),cl?setImmediate:ul?(ll=`axios@${Math.random()}`,dl=[],Qu.addEventListener("message",({source:e,data:t})=>{e===Qu&&t===ll&&dl.length&&dl.shift()()},!1),e=>{dl.push(e),Qu.postMessage(ll,"*")}):e=>setTimeout(e));var cl,ul,ll,dl;const hl="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Qu):"undefined"!=typeof process&&process.nextTick||sl,pl=e=>null!=e&&Lu(e[vu]),fl={isArray:Cu,isArrayBuffer:Pu,isBuffer:Nu,isFormData:e=>{if(!e)return!1;if(Hu&&e instanceof Hu)return!0;const t=yu(e);if(!t||t===Object.prototype)return!1;if(!Lu(e.append))return!1;const n=Tu(e);return"formdata"===n||"object"===n&&Lu(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Pu(e.buffer),t},isString:xu,isNumber:Uu,isBoolean:e=>!0===e||!1===e,isObject:Mu,isPlainObject:Du,isEmptyObject:e=>{if(!Mu(e)||Nu(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ju,isRequest:zu,isResponse:Vu,isHeaders:Yu,isUndefined:Iu,isDate:ju,isFile:Wu,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Gu,isRegExp:rl,isFunction:Lu,isStream:e=>Mu(e)&&Lu(e.pipe),isURLSearchParams:Xu,isTypedArray:el,isFileList:Ku,forEach:Zu,merge:function e(...t){const{caseless:n,skipUndefined:o}=$u(this)&&this||{},r={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&"string"==typeof i&&qu(r,i)||i,s=Au(r,a)?r[a]:void 0;Du(s)&&Du(t)?r[a]=e(s,t):Du(t)?r[a]=e({},t):Cu(t)?r[a]=t.slice():o&&Iu(t)||(r[a]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||Nu(n))continue;if(Zu(n,i),"object"!=typeof n||Cu(n))continue;const o=Object.getOwnPropertySymbols(n);for(let e=0;e<o.length;e++){const t=o[e];ol.call(n,t)&&i(n[t],t)}}return r},extend:(e,t,n,{allOwnKeys:o}={})=>(Zu(t,(t,o)=>{n&&Lu(t)?Object.defineProperty(e,o,{__proto__:null,value:gu(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:o}),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,o)=>{e.prototype=Object.create(t.prototype,o),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,
vendor: 5,334 bytes, line 2
2configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,o)=>{let r,i,a;const s={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)a=r[i],o&&!o(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&yu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Tu,kindOfTest:Ru,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const o=e.indexOf(t,n);return-1!==o&&o===n},toArray:e=>{if(!e)return null;if(Cu(e))return e;let t=e.length;if(!Uu(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[vu]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const o=[];for(;null!==(n=e.exec(t));)o.push(n);return o},isHTMLForm:nl,hasOwnProperty:Au,hasOwnProp:Au,hasOwnInPrototypeChain:Eu,getSafeProp:(e,t)=>null!=e&&Eu(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=yu(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(Su(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),o=Object.create(null),r=[];let i=e;for(;null!=i&&-1===r.indexOf(i);){r.push(i);const a=i===e?t:yu(i);if(_u(i,a,i===e))break;const s=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&s.push(...Object.getOwnPropertySymbols(i));for(const t of s)Su(t)||Au(o,t)||(n[t]=e[t],o[t]=!0);i=a}return n},reduceDescriptors:il,freezeMethods:e=>{il(e,(t,n)=>{if(Lu(e)&&["arguments","caller","callee"].includes(n))return!1;const o=e[n];Lu(o)&&(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={},o=e=>{e.forEach(e=>{n[e]=!0})};return Cu(e)?o(e):o(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:qu,global:Qu,isContextDefined:$u,isSpecCompliantForm:function(e){return!!(e&&Lu(e.append)&&"FormData"===e[bu]&&e[vu])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Mu(e)){if(t.has(e))return;if(Nu(e))return e;if(!("toJSON"in e)){let o;if(t.add(e),Bu(e)){o=[];for(const t of e){const e=n(t);!Iu(e)&&o.push(e)}}else o=Cu(e)?[]:{},Zu(e,(e,t)=>{const r=n(e);!Iu(r)&&(o[t]=r)});return t.delete(e),o}}return e};return n(e)},isAsyncFn:al,isThenable:e=>e&&(Mu(e)||Lu(e))&&Lu(e.then)&&Lu(e.catch),setImmediate:sl,asap:hl,isIterable:pl,isSafeIterable:e=>null!=e&&Eu(e,vu)&&pl(e)},ml=fl.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"]),gl=e=>{const t={};let n,o,r;return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),o=e.substring(r+1).trim();const i=fl.hasOwnProp(t,n);!n||i&&fl.hasOwnProp(ml,n)||("set-cookie"===n?i?t[n].push(o):t[n]=[o]:t[n]=i?t[n]+", "+o:o)}),t};n.dn(gl);const wl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),yl=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function vl(e,t){return fl.isArray(e)?e.map(e=>vl(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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 bl(e){const t=Object.create(null);return fl.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>vl(e,yl))(e)}),t}const Al=Symbol("internals");function Sl(e){return e&&String(e).trim().toLowerCase()}function _l(e){return!1===e||null==e?e:fl.isArray(e)?e.map(_l):(e=>vl(e,wl))(String(e))}const El=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Tl(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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)}function kl(e,t,n,o,r){return fl.isFunction(o)?o.call(this,t,n):(r&&(t=n),fl.isString(t)?fl.isString(o)?-1!==t.indexOf(o):fl.isRegExp(o)?o.test(t):void 0:void 0)}class Rl{constructor(e){e&&this.set(e)}set(e,t,n){const o=this;function r(e,t,n){const r=Sl(t);if(!r)return;const i=fl.findKey(o,r);(!i||void 0===o[i]||!0===n||void 0===n&&!1!==o[i])&&(o[i||t]=_l(e))}const i=(e,t)=>fl.forEach(e,(e,n)=>r(e,n,t));if(fl.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(fl.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(gl(e),t);else if(fl.isObject(e)&&fl.isSafeIterable(e)){let n,o,r=Object.create(null);for(const t of e){if(!fl.isArray(t))throw new TypeError("Object iterator must return a key-value pair");o=t[0],fl.hasOwnProp(r,o)?(n=r[o],r[o]=fl.isArray(n)?[...n,t[1]]:[n,t[1]]):r[o]=t[1]}i(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=Sl(e)){const n=fl.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,;
vendor: 7,136 bytes, line 2
2=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}(e);if(fl.isFunction(t))return t.call(this,e,n);if(fl.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Sl(e)){const n=fl.findKey(this,e);return!(!n||void 0===this[n]||t&&!kl(0,this[n],n,t))}return!1}delete(e,t){const n=this;let o=!1;function r(e){if(e=Sl(e)){const r=fl.findKey(n,e);!r||t&&!kl(0,n[r],r,t)||(delete n[r],o=!0)}}return fl.isArray(e)?e.forEach(r):r(e),o}clear(e){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const r=t[n];e&&!kl(0,this[r],r,e,!0)||(delete this[r],o=!0)}return o}normalize(e){const t=this,n={};return fl.forEach(this,(o,r)=>{const i=fl.findKey(n,r);if(i)return t[i]=_l(o),void delete t[r];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(r):String(r).trim();a!==r&&delete t[r],t[a]=_l(o),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fl.forEach(this,(n,o)=>{null!=n&&!1!==n&&(t[o]=e&&fl.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(){const e=this.get("set-cookie");return fl.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let o=0,r=!1,i=!1;function a(e){const r=Tl(n.slice(o,e)),i=r.indexOf("=");if(i<1)return;const a=Tl(r.slice(0,i));if(!El.test(a))return;const s=a.toLowerCase();if("__proto__"===s||"constructor"===s||"prototype"===s)return;const c=Tl(r.slice(i+1));t[s]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let o=1;o<t;o++){const r=e.charCodeAt(o);if(34===r)return e;if(92===r&&(o+=1,o>=t))return e;n+=e[o]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);r?i?i=!1:92===t?i=!0:34===t&&(r=!1):34===t?r=!0:44!==t&&59!==t||(a(e),o=e+1)}return a(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Al]=this[Al]={accessors:{}}).accessors,n=this.prototype;function o(e){const o=Sl(e);t[o]||(!function(e,t){const n=fl.toCamelCase(" "+t);["get","set","has"].forEach(o=>{Object.defineProperty(e,o+n,{__proto__:null,value:function(e,n,r){return this[o].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[o]=!0)}return fl.isArray(e)?e.forEach(o):o(e),this}}Rl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fl.reduceDescriptors(Rl.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),fl.freezeMethods(Rl);const Ol=Rl,Cl="[REDACTED ****]";function Il(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),o=[],r=e=>{if(null===e||"object"!=typeof e)return e;if(fl.isBuffer(e))return e;if(-1!==o.indexOf(e))return;let t;if(e instanceof Ol&&(e=e.toJSON()),o.push(e),fl.isArray(e))t=[],e.forEach((e,n)=>{const o=r(e);fl.isUndefined(o)||(t[n]=o)});else{if(!fl.isPlainObject(e)&&function(e){if(fl.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(fl.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return o.pop(),e;t=Object.create(null);for(const[o,i]of Object.entries(e)){const e=n.has(o.toLowerCase())?Cl:r(i);fl.isUndefined(e)||(t[o]=e)}}return o.pop(),t};return r(e)}function Nl(e){try{return String(e)}catch(e){return""}}class Pl extends Error{static from(e,t,n,o,r,i){let a=e.message;!a&&fl.isArray(e.errors)&&e.errors.length&&(a=function(e){return e.errors.map(e=>{try{return e&&e.message?Nl(e.message):Nl(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const s=new Pl(a,t||e.code,n,o,r);return Object.defineProperty(s,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),i&&Object.assign(s,i),s}constructor(e,t,n,o,r){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),o&&(this.request=o),r&&(this.response=r,this.status=r.status)}toJSON(){const e=this.config,t=e&&fl.hasOwnProp(e,"redact")?e.redact:void 0,n=fl.isArray(t)&&t.length>0?Il(e,t):fl.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}}}Pl.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Pl.ERR_BAD_OPTION="ERR_BAD_OPTION",Pl.ECONNABORTED="ECONNABORTED",Pl.ETIMEDOUT="ETIMEDOUT",Pl.ECONNREFUSED="ECONNREFUSED",Pl.ERR_NETWORK="ERR_NETWORK",Pl.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Pl.ERR_DEPRECATED="ERR_DEPRECATED",Pl.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Pl.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Pl.ERR_CANCELED="ERR_CANCELED",Pl.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Pl.ERR_INVALID_URL="ERR_INVALID_URL",Pl.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const xl=Pl;function Ll(e){return fl.isPlainObject(e)||fl.isArray(e)}function Ul(e){return fl.endsWith(e,"[]")?e.slice(0,-2):e}function Ml(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ul(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Dl=fl.toFlatObject(fl,{},null,function(e){return/^is[A-Z]/.test(e)});const jl=function(e,t,n){if(!fl.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const o=(e,t)=>{const o=fl.getSafeProp(n,e);return fl.isUndefined(o)?t:o},r=o("metaTokens",!0),i=o("visitor")||f,a=o("dots",!1),s=o("indexes",!1),c=o("Blob")||"undefined"!=typeof Blob&&Blob,u=o("maxDepth",100),l=c&&fl.isSpecCompliantForm(t),d=[];if(!fl.isFunction(i))throw new TypeError("visitor must be a function");function h(e){if(null===e)return"";if(fl.isDate(e))return e.toISOString();if(fl.isBoolean(e))return e.toString();if(!l&&fl.isBlob(e))throw new xl("Blob is not supported. Use a Buffer instead.");if(fl.isArrayBuffer(e)||fl.isTypedArray(e)){if(l&&"function"==typeof c)return new c([e]);throw new xl("Blob is not supported. Use a Buffer instead.",xl.ERR_NOT_SUPPORT)}return e}function p(e){if(e>u)throw new xl("Object is too deeply nested ("+e+" levels). Max depth: "+u,xl.ERR_FORM_DATA_DEPTH_EXCEEDED)}function f(e,n,o){let i=e;if(fl.isReactNative(t)&&fl.isReactNativeBlob(e))return t.append(Ml(o,n,a),h(e)),!1;if(e&&!o&&"object"==typeof e)if(fl.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,o){if(!fl.isObject(o))return o;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(o),p(t+n.length-1),o})}(e,1);else if(fl.isArray(e)&&function(e){return fl.isArray(e)&&!e.some(Ll)}(e)||(fl.isFileList(e)||fl.endsWith(n,"[]"))&&(i=fl.toArray(e)))return n=Ul(n),i.forEac
vendor: 4,843 bytes, line 2
2h(function(e,o){!fl.isUndefined(e)&&null!==e&&t.append(!0===s?Ml([n],o,a):null===s?n:n+"[]",h(e))}),!1;return!!Ll(e)||(t.append(Ml(o,n,a),h(e)),!1)}const m=Object.assign(Dl,{defaultVisitor:f,convertValue:h,isVisitable:Ll});if(!fl.isObject(e))throw new TypeError("data must be an object");return function e(n,o,r=0){if(!fl.isUndefined(n)){if(p(r),-1!==d.indexOf(n))throw new Error("Circular reference detected in "+o.join("."));d.push(n),fl.forEach(n,function(n,a){!0===(!(fl.isUndefined(n)||null===n)&&i.call(t,n,fl.isString(a)?a.trim():a,o,m))&&e(n,o?o.concat(a):[a],r+1)}),d.pop()}}(e),t};function Wl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Gl(e,t){this._pairs=[],e&&jl(e,this,t)}const Kl=Gl.prototype;Kl.append=function(e,t){this._pairs.push([e,t])},Kl.toString=function(e){const t=e?t=>e.call(this,t,Wl):Wl;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Bl=Gl;function Fl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hl(e,t,n){if(!t)return e;e=e||"";const o=fl.isFunction(n)?{serialize:n}:n,r=fl.getSafeProp(o,"encode")||Fl,i=fl.getSafeProp(o,"serialize");let a;if(a=i?i(t,o):fl.isURLSearchParams(t)?t.toString():new Bl(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Xl=Symbol("internals");function Jl(e){return e?e.length:0}function zl(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Vl(e,t){const n=e.handlers,o=Jl(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):o!==t.handlersLength&&(o?t.handlerEntries.forEach(function(e,o){n[e.index]!==e.handler&&t.handlerEntries.delete(o)}):t.handlerEntries.clear()),t.handlersLength=o}const Yl=class{constructor(){this.handlers=[],this[Xl]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const o={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},r=this[Xl];null==this.handlers&&(this.handlers=[]),Vl(this,r);const i=r.nextId++;return this.handlers.push(o),r.handlerEntries.set(i,{handler:o,index:this.handlers.length-1}),r.handlersLength=this.handlers.length,i}eject(e){const t=this[Xl];Vl(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(zl(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Vl(this,this[Xl]))}forEach(e){const t=this[Xl];Vl(this,t),t.iterationDepth++;try{fl.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Vl(this,t),zl(this.handlers),t.handlersLength=Jl(this.handlers))}}},Zl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},ql={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Bl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ql="undefined"!=typeof window&&"undefined"!=typeof document,$l="object"==typeof navigator&&navigator||void 0,ed=Ql&&(!$l||["ReactNative","NativeScript","NS"].indexOf($l.product)<0),td="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,nd=Ql&&window.location.href||"http://localhost",od={...e,...ql};function rd(e){if(e>100)throw new xl("FormData field is too deeply nested ("+e+" levels). Max depth: 100",xl.ERR_FORM_DATA_DEPTH_EXCEEDED)}const id=function(e){function t(e,n,o,r){rd(r);let i=e[r++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=r>=e.length;if(i=!i&&fl.isArray(o)?o.length:i,s)return fl.hasOwnProp(o,i)?o[i]=fl.isArray(o[i])?o[i].concat(n):[o[i],n]:o[i]=n,!a;fl.hasOwnProp(o,i)&&fl.isObject(o[i])||(o[i]=[]);return t(e,n,o[i],r)&&fl.isArray(o[i])&&(o[i]=function(e){const t={},n=Object.keys(e);let o;const r=n.length;let i;for(o=0;o<r;o++)i=n[o],t[i]=e[i];return t}(o[i])),!a}if(fl.isFormData(e)&&fl.isFunction(e.entries)){const n={};return fl.forEachEntry(e,(e,o)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let o;for(;null!==(o=n.exec(e));)rd(t.length),t.push("[]"===o[0]?"":o[1]||o[0]);return t}(e),o,n,0)}),n}return null},ad=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),sd=(e,t)=>null!=e&&fl.hasOwnProp(e,t)?e[t]:void 0;const cd={transitional:Zl,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,r=fl.isObject(e);
vendor: 18,265 bytes, line 2
2r&&fl.isHTMLForm(e)&&(e=new FormData(e));if(fl.isFormData(e))return o?JSON.stringify(id(e)):e;if(fl.isArrayBuffer(e)||fl.isBuffer(e)||fl.isStream(e)||fl.isFile(e)||fl.isBlob(e)||fl.isReadableStream(e))return e;if(fl.isArrayBufferView(e))return e.buffer;if(fl.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(r){const t=sd(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return jl(e,new od.classes.URLSearchParams,{visitor:function(e,t,n,o){return od.isNode&&fl.isBuffer(e)?(this.append(t,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=fl.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=sd(this,"env"),o=n&&n.FormData;return jl(i?{"files[]":e}:e,o&&new o,t)}}return r||o?(t.setContentType("application/json",!1),function(e,t,n){if(fl.isString(e))try{return(t||JSON.parse)(e),fl.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=sd(this,"transitional")||cd.transitional,n=t&&t.forcedJSONParsing,o=sd(this,"responseType"),r="json"===o;if(fl.isResponse(e)||fl.isReadableStream(e))return e;if(e&&fl.isString(e)&&(n&&!o||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,sd(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw xl.from(e,xl.ERR_BAD_RESPONSE,this,null,sd(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:od.classes.FormData,Blob:od.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fl.forEach(ad,e=>{cd.headers[e]={}});const ud=cd;function ld(e,t){const n=this||ud,o=t||n,r=Ol.from(o.headers);let i=o.data;return fl.forEach(e,function(e){i=e.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function dd(e){return!(!e||!e.__CANCEL__)}const hd=class extends xl{constructor(e,t,n){super(e??"canceled",xl.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function pd(e,t,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new xl("Request failed with status code "+n.status,n.status>=400&&n.status<500?xl.ERR_BAD_REQUEST:xl.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const fd=/[\t\n\r]/g;function md(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(fd,"")}function gd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const wd=function(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=o[a];r||(r=c),n[i]=s,o[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-r<t)return;const h=u&&c-u;return h?Math.round(1e3*d/h):void 0}};const yd=function(e,t){let n,o,r=0,i=1e3/t;const a=(t,i=Date.now())=>{r=i,n=null,o&&(clearTimeout(o),o=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-r;s>=i?a(e,t):(n=e,o||(o=setTimeout(()=>{o=null,a(n)},i-s)))},()=>n&&a(n),(...e)=>a(e)]},vd=(e,t,n=3)=>{let o=0;const r=wd(50,250);return yd(n=>{if(!n||!fl.isNumber(n.loaded))return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=Math.max(0,null!=a?Math.min(i,a):i),c=Math.max(0,s-o),u=r(c);o=Math.max(o,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)},bd=(e,t)=>{const n=null!=e;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},Ad=(e,t=fl.asap)=>(...n)=>t(()=>e(...n)),Sd=od.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,od.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(od.origin),od.navigator&&/(msie|trident)/i.test(od.navigator.userAgent)):()=>!0,_d=od.hasStandardBrowserEnv?{write(e,t,n,o,r,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];fl.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),fl.isString(o)&&s.push(`path=${o}`),fl.isString(r)&&s.push(`domain=${r}`),!0===i&&s.push("secure"),fl.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;n<t.length;n++){const o=t[n].replace(/^\s+/,""),r=o.indexOf("=");if(-1!==r&&o.slice(0,r)===e)try{return decodeURIComponent(o.slice(r+1))}catch(e){return o.slice(r+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const Ed=/^https?:(?!\/\/)/i;function Td(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Cl}@`),n=t.indexOf("#"),o=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Cl}`);return-1===n?o:`${o}#${r=t.slice(n+1),r?r.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${Cl}`):r}`;var r}function kd(e,t){if("string"==typeof e){const n=md(e);if(Ed.test(n))throw new xl(`Invalid URL ${JSON.stringify(Td(n))}: missing "//" after protocol`,xl.ERR_INVALID_URL,t)}}function Rd(e,t,n,o){kd(t,o);let r=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(r||!1===n)?(kd(e,o),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const Od=e=>e instanceof Ol?{...e}:e;function Cd(e,t){e=e||{},t=t||{};const n=Object.create(null);function o(e,t,n,o){return fl.isPlainObject(e)&&fl.isPlainObject(t)?fl.merge.call({caseless:o},e,t):fl.isPlainObject(t)?fl.merge({},t):fl.isArray(t)?t.slice():t}function r(e,t,n,r){return fl.isUndefined(t)?fl.isUndefined(e)?void 0:o(void 0,e,0,r):o(e,t,0,r)}function i(e,t){if(!fl.isUndefined(t))return o(void 0,t)}function a(e,t){return fl.isUndefined(t)?fl.isUndefined(e)?void 0:o(void 0,e):o(void 0,t)}function s(n,r,i){return fl.hasOwnProp(t,i)?o(n,r):fl.hasOwnProp(e,i)?o(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,timeoutErrorMessage: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)=>r(Od(e),Od(t),0,!0)};var u;return fl.forEach((u={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(u).concat(Object.getOwnPropertySymbols(u).filter(e=>Object.getOwnPropertyDescriptor(u,e).enumerable)):Object.keys(u)),function(o){if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=fl.hasOwnProp(c,o)?c[o]:r,a=i(fl.hasOwnProp(e,o)?e[o]:void 0,fl.hasOwnProp(t,o)?t[o]:void 0,o);fl.isUndefined(a)&&i!==s||(n[o]=a)}),fl.hasOwnProp(t,"validateStatus")&&fl.isUndefined(t.validateStatus)&&!1===function(n){const o=fl.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!fl.isUndefined(o)){if(!fl.isPlainObject(o))return;if(fl.hasOwnProp(o,n))return o[n]}const r=fl.hasOwnProp(e,"transitional")?e.transitional:void 0;if(fl.isPlainObject(r)&&fl.hasOwnProp(r,n))return r[n]}("validateStatusUndefinedResolves")&&(fl.hasOwnProp(e,"validateStatus")?n.validateStatus=o(void 0,e.validateStatus):delete n.validateStatus),n}const Id=["content-type","content-length"];const Nd=function(e){const t=Cd({},e),n=e=>fl.hasOwnProp(t,e)?t[e]:void 0,o=n("data");let r=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");if(t.headers=s=Ol.from(s),t.url=Hl(Rd(u,d,l,t),n("params"),n("paramsSerializer")),c){const t=fl.getSafeProp(c,"username")||"",n=fl.getSafeProp(c,"password")||"";try{s.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw xl.from(t,xl.ERR_BAD_OPTION_VALUE,e)}}if(fl.isFormData(o)){const e=fl.getSafeProp(o,"getHeaders");od.hasStandardBrowserEnv||od.hasStandardBrowserWebWorkerEnv||fl.isReactNative(o)?s.setContentType(void 0):fl.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{Id.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,e.call(o),n("formDataHeaderPolicy"))}if(od.hasStandardBrowserEnv){fl.isFunction(r)&&(r=r(t));if(!0===r||null==r&&Sd(t.url)){const e=i&&a&&_d.read(a);e&&s.set(i,e)}}return t},Pd="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const o=Nd(e);let r=o.data;const i=Ol.from(o.headers).normalize();let a,s,c,u,l,d,{responseType:h,onUploadProgress:p,onDownloadProgress:f}=o;function m(){u&&u(),l&&l(),o.cancelToken&&o.cancelToken.unsubscribe(a),o.signal&&o.signal.removeEventListener("abort",a)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(gd(md(o.url))||gd(od.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new xl("Request aborted",xl.ECONNABORTED,e,g)),m(),void(g=null);try{r?d&&d(r):l&&l()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const i=Ol.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());pd(function(e){t(e),m()},function(e){n(e),m()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:i,config:e,request:g}),g=null}g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new xl("Request aborted",xl.ECONNABORTED,e,g)),m(),g=null)},g.onerror=function(t){const o=t&&t.message?t.message:"Network Error",r=new xl(o,xl.ERR_NETWORK,e,g);r.event=t||null,n(r),m(),g=null},g.ontimeout=function(){let t=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const r=o.transitional||Zl;o.timeoutErrorMessage&&(t=o.timeoutErrorMessage),n(new xl(t,r.clarifyTimeoutError?xl.ETIMEDOUT:xl.ECONNABORTED,e,g)),m(),g=null},void 0===r&&i.setContentType(null),"setRequestHeader"in g&&fl.forEach(bl(i),function(e,t){g.setRequestHeader(t,e)}),fl.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),h&&"json"!==h&&(g.responseType=o.responseType),f&&([c,l,d]=vd(f,!0),g.addEventListener("progress",c)),p&&g.upload&&([s,u]=vd(p),g.upload.addEventListener("progress",s),g.upload.addEventListener("loadend",u)),(o.cancelToken||o.signal)&&(a=t=>{g&&(n(!t||t.type?new hd(null,e,g):t),g.abort(),m(),g=null)},o.cancelToken&&o.cancelToken.subscribe(a),o.signal&&(o.signal.aborted?a():o.signal.addEventListener("abort",a)));const y=gd(o.url);if(y&&!od.protocols.includes(y))return n(new xl("Unsupported protocol "+y+":",xl.ERR_BAD_REQUEST,e)),void m();g.send(r||null)})},xd=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let o=!1;const r=function(e){if(!o){o=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof xl?t:new hd(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,r(new xl(`timeout of ${t}ms exceeded`,xl.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)}),e=null)};e.forEach(e=>{o||(e.aborted?r.call(e):e.addEventListener("abort",r,{once:!0}))});const{signal:s}=n;return s.unsubscribe=()=>fl.asap(a),s},Ld=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let o,r=0;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Ud=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Md=(e,t,n,o)=>{const r=async function*(e,t){for await(const n of Ud(e))yield*Ld(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,o&&o(e))};return new ReadableStream({async pull(e){try{const{done:t,value:o}=await r.next();if(t)return s(),void e.close();let i=o.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(o))}catch(e){throw s(e),e}},cancel:e=>(s(e),r.return())},{highWaterMark:2})},Dd=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,jd=(e,t,n)=>t+2<n&&Dd(e.charCodeAt(t+1))&&Dd(e.charCodeAt(t+2)),Wd=e=>e<=57?e-48:(223&e)-55,Gd=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Kd=e=>9===e||10===e||12===e||13===e||32===e,Bd=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Fd=e=>{const t=e.length;let n=0,o=0,r=!1;for(let i=0;i<t;i++){let a=e.charCodeAt(i);37===a&&jd(e,i,t)&&(a=16*Wd(e.charCodeAt(i+1))+Wd(e.charCodeAt(i+2)),i+=2),Kd(a)||(61!==a?!Gd(a)||o>0?r=!0:n++:o++)}return r||o>2||o>0&&(n+o)%4!=0||n%4==1?Bd(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Hd=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const o=e.slice(5,n),r=e.slice(n+1);if(/;base64/i.test(o))return t(r);let i=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);if(37===n&&jd(r,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const Xd={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Jd}=fl,zd=e=>{if(!fl.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Vd=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Yd=e=>{const t=void 0!==fl.global&&null!==fl.global?fl.global:globalThis,{ReadableStream:n,TextEncoder:o}=t;e=fl.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:r,Request:i,Response:a}=e,s=r?Jd(r):"function"==typeof fetch,c=Jd(i),u=Jd(a);if(!s)return!1;const l=s&&Jd(n),d=s&&("function"==typeof o?(h=new o,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&Vd(()=>{let e=!1;const t=new i(od.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),o=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!o}),f=u&&l&&Vd(()=>fl.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 o=t&&t[e];if(o)return o.call(t);throw new xl(`Response type '${e}' is not supported`,xl.ERR_NOT_SUPPORT,n)})});const g=async e=>{if(null==e)return 0;if(fl.isBlob(e))return e.size;if(fl.isSpecCompliantForm(e)){const t=new i(od.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return fl.isArrayBufferView(e)||fl.isArrayBuffer(e)?e.byteLength:(fl.isURLSearchParams(e)&&(e+=""),fl.isString(e)?(await d(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:d,timeout:h,onDownloadProgress:w,onUploadProgress:y,responseType:v,headers:b,withCredentials:A="same-origin",fetchOptions:S,maxContentLength:_,maxBodyLength:E,maxRedirects:T}=Nd(e);const k=fl.isNumber(_)&&_>-1,R=fl.isNumber(E)&&E>-1;let O=r||fetch;v=v?(v+"").toLowerCase():"text";let C=xd([u,d&&d.toAbortSignal()],h),I=null;const N=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let P,x=null;const L=()=>new xl("Request body larger than maxBodyLength limit",xl.ERR_BAD_REQUEST,e,I);try{let r;const u=(M="auth",fl.hasOwnProp(e,M)?e[M]:void 0);if(u){const e=fl.getSafeProp(u,"username")||"";r={username:e,password:fl.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,od.origin);if(!r&&(e.username||e.password)){const t=zd(e.username);r={username:t,password:zd(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(r&&(b.delete("authorization"),b.set("Authorization","Basic "+btoa((U=(r.username||"")+":"+(r.password||""),encodeURIComponent(U).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),k&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Hd(-1===t?e:e.slice(0,t),Fd)}(t);if(n>_)throw new xl("maxContentLength size of "+_+" exceeded",xl.ERR_BAD_RESPONSE,e,I)}if(R&&"get"!==n&&"head"!==n){const e=await g(s);if("number"==typeof e&&isFinite(e)&&(P=e,e>E))throw L()}const d=R&&(fl.isReadableStream(s)||fl.isStream(s)),h=(e,t,n)=>Md(e,65536,e=>{if(R&&e>E)throw x=L();t&&t(e)},n);if(p&&"get"!==n&&"head"!==n&&(y||d)){if(P=P??await(async(e,t)=>{const n=fl.toFiniteNumber(e.getContentLength());return n??g(t)})(b,s),0!==P||d){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(fl.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=y&&bd(P,vd(Ad(y)))||[];s=h(n.body,e,t)}}}else if(d&&!c&&l&&"get"!==n&&"head"!==n)s=h(s);else if(d&&c&&!p&&"get"!==n&&"head"!==n)throw new xl("Stream request bodies are not supported by the current fetch implementation",xl.ERR_NOT_SUPPORT,e,I);fl.isString(A)||(A=A?"include":"omit");const D=c&&"credentials"in i.prototype;if(fl.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/1.20.0",!1);const j=null==S?S:Object.assign(Object.create(null),S);j&&(delete j.body,delete j.headers,delete j.method,delete j.signal,delete j.duplex,delete j.credentials);const W=Object.assign(Object.create(null),j,{signal:C,method:n.toUpperCase(),headers:bl(b.normalize()),body:s,duplex:"half",credentials:D?A:void 0});c&&(fl.forEach(Xd,(e,t)=>{void 0===W[t]&&(W[t]=e)}),void 0===W.signal&&(W.signal=null),void 0===W.body&&(W.body=null)),0===T&&(W.redirect="manual",j&&(j.redirect="manual")),I=c&&new i(t,W);let G=await(c?O(I,j):O(t,W));const K=Ol.from(G.headers);if(k){const t=fl.toFiniteNumber(K.getContentLength());if(null!=t&&t>_)throw new xl("maxContentLength size of "+_+" exceeded",xl.ERR_BAD_RESPONSE,e,I)}const B=f&&("stream"===v||"response"===v);if(f&&G.body&&(w||k||B&&N)){const t={};
vendor: 8,607 bytes, line 2
2["status","statusText","headers"].forEach(e=>{t[e]=G[e]});const n=fl.toFiniteNumber(K.getContentLength()),[o,r]=w&&bd(n,vd(Ad(w),!0))||[];let i=0;const s=t=>{if(k&&(i=t,i>_))throw new xl("maxContentLength size of "+_+" exceeded",xl.ERR_BAD_RESPONSE,e,I);o&&o(t)};G=new a(Md(G.body,65536,s,()=>{r&&r(),N&&N()}),t)}v=v||"text";let F=await m[fl.findKey(m,v)||"text"](G,e);if(k&&!f&&!B){let t;if(null!=F&&("number"==typeof F.byteLength?t=F.byteLength:"number"==typeof F.size?t=F.size:"string"==typeof F&&(t="function"==typeof o?(new o).encode(F).byteLength:F.length)),"number"==typeof t&&t>_)throw new xl("maxContentLength size of "+_+" exceeded",xl.ERR_BAD_RESPONSE,e,I)}return!B&&N&&N(),await new Promise((t,n)=>{pd(t,n,{data:F,headers:Ol.from(G.headers),status:G.status,statusText:G.statusText,config:e,request:I})})}catch(t){if(N&&N(),C&&C.aborted&&C.reason instanceof xl){const n=C.reason;throw n.config=e,I&&(n.request=I),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(x)throw I&&!x.request&&(x.request=I),x;if(t instanceof xl)throw I&&!t.request&&(t.request=I),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new xl("Network Error",xl.ERR_NETWORK,e,I,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw xl.from(t,t&&t.code,e,I,t&&t.response)}var U,M}},Zd=new Map,qd=e=>{let t=e&&e.env||{};const{fetch:n,Request:o,Response:r}=t,i=[o,r,n];let a,s,c=i.length,u=Zd;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Yd(t)),u=s;return s},Qd=(qd(),{http:null,xhr:Pd,fetch:{get:qd}});fl.forEach(Qd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const $d=e=>`- ${e}`,eh=e=>fl.isFunction(e)||null===e||!1===e;const th={getAdapter:function(e,t){e=fl.isArray(e)?e:[e];const{length:n}=e;let o,r;const i={};for(let a=0;a<n;a++){let n;if(o=e[a],r=o,!eh(o)&&(r=Qd[(n=String(o)).toLowerCase()],void 0===r))throw new xl(`Unknown adapter '${n}'`);if(r&&(fl.isFunction(r)||(r=r.get(t))))break;i[n||"#"+a]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`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($d).join("\n"):" "+$d(e[0]):"as no adapter specified";throw new xl("There is no suitable adapter to dispatch the request "+t,xl.ERR_NOT_SUPPORT)}return r},adapters:Qd};function nh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new hd(null,e)}function oh(e){const t=fl.toSafeFlatObject(e);nh(t),t.headers=Ol.from(fl.getSafeProp(t,"headers")),t.data=ld.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return th.getAdapter(t.adapter||ud.adapter,t)(t).then(function(e){nh(t),t.response=e;try{e.data=ld.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=Ol.from(e.headers),e},function(e){if(!dd(e)&&(nh(t),e&&e.response)){t.response=e.response;try{e.response.data=ld.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=Ol.from(e.response.headers)}return Promise.reject(e)})}const rh={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{rh[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ih={};rh.transitional=function(e,t,n){function o(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,i)=>{if(!1===e)throw new xl(o(r," has been removed"+(t?" in "+t:"")),xl.ERR_DEPRECATED);return t&&!ih[r]&&(ih[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,i)}},rh.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const ah={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new xl("options must be an object",xl.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const i=o[r],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 xl("option "+i+" must be "+n,xl.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new xl("Unknown option "+i,xl.ERR_BAD_OPTION)}},validators:rh},sh=ah.validators;class ch{constructor(e){this.defaults=e||{},this.interceptors={request:new Yl,response:new Yl}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let o="";if("string"==typeof n){const e=n.indexOf("\n");o=-1===e?"":n.slice(e+1)}if(e.stack){if(o){const t=o.indexOf("\n"),n=-1===t?-1:o.indexOf("\n",t+1),r=-1===n?"":o.slice(n+1);String(e.stack).endsWith(r)||(e.stack+="\n"+o)}}else e.stack=o}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Cd(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:r}=t;void 0!==n&&ah.assertOptions(n,{silentJSONParsing:sh.transitional(sh.boolean),forcedJSONParsing:sh.transitional(sh.boolean),clarifyTimeoutError:sh.transitional(sh.boolean),legacyInterceptorReqResOrdering:sh.transitional(sh.boolean),advertiseZstdAcceptEncoding:sh.transitional(sh.boolean),validateStatusUndefinedResolves:sh.transitional(sh.boolean)},!1),null!=o&&(fl.isFunction(o)?t.paramsSerializer={serialize:o}:ah.assertOptions(o,{encode:sh.function,serialize:sh.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ah.assertOptions(t,{baseUrl:sh.spelling("baseURL"),withXsrfToken:sh.spelling("withXSRFToken")},!0),t.method=(fl.getSafeProp(t,"method")||fl.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=r&&fl.merge(r.common,r[t.method]);r&&fl.forEach(ad.concat("common"),e=>{delete r[e]}),t.headers=Ol.concat(i,r);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||Zl;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=[oh.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=a.length;let h=t;for(;d<l;){const e=a[d++],t=a[d++];try{h=e?e(h):h}catch(e){if(!t){u=Promise.reject(e);break}try{const n=t.call(this,e);fl.isThenable(n)&&(u=Promise.resolve(n).then(()=>oh.call(this,h)))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=oh.call(this,h)}catch(e){u=Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return Hl(Rd((e=Cd(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}fl.forEach(["delete","get","head","options"],function(e){ch.prototype[e]=function(t,n){return this.request(Cd(n||{},{method:e,url:t,data:n&&fl.hasOwnProp(n,"data")?n.data:void 0}))}}),fl.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,o,r){return this.request(Cd(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}ch.prototype[e]=t(),"query"!==e&&(ch.prototype[e+"Form"]=t(!0))});const uh=ch;class lh{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{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 o=new Promise(e=>{n.subscribe(e),t=e}).then(e);return o.cancel=function(){n.unsubscribe(t)},o},e(function(e,o,r){n.reason||(n.reason=new hd(e,o,r),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 lh(function(t){e=t});return{token:t,cancel:e}}}const dh=lh;const hh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,Re
2setContent: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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(hh).forEach(([e,t])=>{void 0===hh[t]&&(hh[t]=e)});const ph=hh;const fh=function e(t){const n=new uh(t),o=gu(uh.prototype.request,n);return fl.extend(o,uh.prototype,n,{allOwnKeys:!0}),fl.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Cd(t,n))},o}(ud);fh.Axios=uh,fh.CanceledError=hd,fh.CancelToken=dh,fh.isCancel=dd,fh.VERSION="1.20.0",fh.toFormData=jl,fh.AxiosError=xl,fh.Cancel=fh.CanceledError,fh.all=function(e){return Promise.all(e)},fh.spread=function(e){return function(t){return e.apply(null,t)}},fh.isAxiosError=function(e){return fl.isObject(e)&&!0===e.isAxiosError},fh.mergeConfig=Cd,fh.AxiosHeaders=Ol,fh.formToJSON=e=>id(fl.isHTMLForm(e)?new FormData(e):e),fh.getAdapter=th.getAdapter,fh.HttpStatusCode=ph,fh.default=fh;const mh=fh,gh={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 wh=n(3029),yh=n(2901),vh=function(){function e(){(0,wh.A)(this,e),(0,l.A)(this,"readyPromise",null),(0,l.A)(this,"readyResolved",!1),(0,l.A)(this,"readyValue",!1)}return(0,yh.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,o=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 r=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()-o)/1e3,"s"),t.resolveReady(!1,e))},r);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 r=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(a),i.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-o)/1e3,"s"),null==r||r(),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)(vh,"DEFAULT_TIMEOUT",3e3);const bh=new vh;var Ah,Sh;function _h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function Eh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?_h(Object(n),!0).forEach(function(t){(0,l.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){Ah||(Ah=e,Sh&&(i.A.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",Sh),window.dispatchEvent(Sh)))}),i.A.log("Waiting for islands ready");var Th=function(){var e=window.location.href;return new URL(e)},kh=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),o=0;o<n.length;o+=1){var r=n[o].trimLeft();if(0===r.indexOf(t))return r.substring(t.length,r.length)}return!1},Rh=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=Th().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])},Oh=function(){var e=Rh();return".".concat(e)},Ch=function(e,t,n){var o="".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],r=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),o+="expires=".concat(i.toUTCString(),";")}else o+="".concat(n,"=").concat(r,";")})):o+="path=/;",document.cookie=o},Ih=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),r=Rh(),i=[r,"www".concat(r),".www".concat(r)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=d(e,2),n=t[0],r=t[1];o+="".concat(n,"=").concat(r,";")}),0===Object.keys(t).length&&(o+="path=/;"),document.cookie=o,i.forEach(function(e){document.cookie=o.concat("domain=",e,";")})},Nh=function(){return Th().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Ph=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,o=e.split(".")[n];if("string"!=typeof o)throw new h(`Invalid token specified: missing part #${n+1}`);let r;try{r=p(o)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},xh=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Rh().split(".")[0],e.prev=1,e.next=2,mh({method:"get",url:"".concat(r.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)}}(),Lh=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,mh({method:"get",url:"".concat(r.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(Nh())),headers:{"X-Api-Key":r.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)}}(),Uh=function(){return"complete"===document.readyState},Mh=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var r=!0;if(Uh())n();else{i.A.log("UIHandler: ","Waiting for the body to load...");var a=setInterval((0,t.A)(o.mark(function t(){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(r=Uh()),document.querySelector("body")&&r&&(clearInterval(a),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},Dh=function(){return new Promise(function(e){if(("interactive"===document.readyState||Uh())&&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)(o.mark(function t(){return o.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)}})},jh=function(){var e,t=new Promise(function(t){e=setTimeout(function(){i.A.log("Utils engageLibraryReady: engageLibrary failed to load within 10 seconds."),t(!1)},1e4)}),n=new Promise(function(t){var n=function(){clearTimeout(e),t(!0)};window.engageLibrary?n():window.addEventListener("engageLibraryReady",n,{once:!0})});return Promise.race([n,t])},Wh=function(){return new Promise(function(e){if("interactive"!==document.readyState&&"complete"!==document.readyState||!window.MG2DL){
2i.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()})},Gh=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Dh();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),r=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(r),e.abrupt("return",a?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Kh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a=arguments;return o.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,Dh();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),r=function(e){i.A.log("Utils dataLayerLoop: look for this element ",e);var o=!1;return t.forEach(function(t){void 0!==e[t]?(i.A.log("Utils dataLayerLoop: found ".concat(t,":"),e[t]),n[t]=e[t],o=!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):o},!(window.dataLayer.some(r)&&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)}}(),Bh=function(){var e=(0,t.A)(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,Gh(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)}}(),Fh=function(){var e=(0,t.A)(o.mark(function e(){return o.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)}}(),Hh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:if(t=e.sent,i.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,Fh();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 r=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){r.loadValues(["auth0_id"],null,function(){e()})});case 4:return a=r.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)}}(),Xh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c,u,l,d,h=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>
20&&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,bh.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,Hh();case 2:(l=e.sent)&&(n=!0,r=l);case 3:return t&&n&&Jh(),d={isSub:n},r&&(d.uuid=r),e.abrupt("return",d);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Jh=function(){Ch("bc_lowa_status",1,{path:"/",domain:Oh(),expires:7,secure:!0})},zh=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 o=n.detail||{};i.A.log("utils | Event: authentication ready: ",o),e(o)}catch(e){i.A.log(e),t(e)}},!1))})},Vh=function(){var e=(0,t.A)(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 r.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 o=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=o,i.A.log("Received entitlementsReady event:",o),e(o)}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)}}(),Yh=function(){Ih(gh.AUTH0_SUB_COOKIE_KEY),Ih("mng-jwt-decoded"),localStorage.removeItem(gh.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){i.A.log("Clearing entitlements...");try{Ih(gh.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){i.A.log("Failed to delete legacy cookie: ",e)}try{Ih(gh.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:Rh(),expires:365,secure:!0})}catch(e){i.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(gh.LOCAL_STORAGE_SESSION_KEY)}catch(e){i.A.log("Failed to remove local storage: ",e)}}()},Zh=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))},qh=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","COMM
2BANK","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","SO
2CIAL","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=qh;var Qh;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var $h=function(){var e=(0,t.A)(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;
2)switch(e.prev=e.next){case 0:if(void 0===Qh){e.next=1;break}return e.abrupt("return",Qh);case 1:return t=r.A.auth0Domain,n=r.A.auth0ClientId,Qh=new mu({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",Qh);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ep=function(e){Sh=new CustomEvent("mng-auth-check-complete",{detail:e}),Ah?(i.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(Sh)):i.A.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return ep(e.detail)});var tp=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"),ep(e)},np=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},op=function(e){return Number.isInteger(Number(e))};var rp=function(e){r.A.datadogEnabled&&window.DD_RUM.addTiming(e)},ip=function(){var e=(0,t.A)(o.mark(function e(t){var n,s,c,u,l,d;return o.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=Nh(),i.A.log("deleteUSerCache","Domain is: ".concat(n)),s={publication:n,uuid:t},e.next=1,mh({method:"DELETE",url:"".concat(r.A.entitlementsEndpoint,"session/create"),data:s,headers:{"X-Api-Key":r.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)}}(),ap=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,r){var a={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=(0,t.A)(o.mark(function t(){var s,c,u,l,d,h,p,f,m,g,w;return o.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:Eh({},a)}));case 1:return t.next=2,Bh();case 2:return u=t.sent,t.next=3,Gh("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,Vh();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:Eh({},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:Eh({},a)}));case 13:t.prev=13,w=t.catch(0),r(w);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=ap);var sp=function(){function e(){(0,wh.A)(this,e),(0,l.A)(this,"pendingSets",new Map),(0,l.A)(this,"flushTimer",null),(0,l.A)(this,"hasFlushed",!1),(0,l.A)(this,"isPaused",!1)}return(0,yh.A)(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,i.A.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){i.A.error("AdmiralUtils | pauseTargeting | failed",e)}else i.A.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)i.A.log('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return i.A.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
2try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),i.A.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),i.A.log("AdmiralUtils | flush | targeting ready.")}catch(e){i.A.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)i.A.log("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),i.A.log("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();(0,l.A)(sp,"DEFAULT_READY_DELAY_MS",2e3);const cp=sp;var up=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:return e.next=2,zh();case 2:return e.abrupt("return",new Promise(function(e){i.A.log("ANALYTICS: inside BCregwall events");var t=Th();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)}}(),lp=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,a,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{void 0!==(n=Ph(t))&&n&&(i.A.log("ANALYTICS: Partner Access: JWT found"),r=n.entitlement_entitled,a=n.entitlement_source,s=n.entitlement_organizationTrackingId,c=n.entitlement_organizationType,i.A.log("ANALYTICS: Partner Access Event: Entitled: ".concat(r," and source: ").concat(a)),r&&"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)}}(),dp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{"yes"===localStorage.getItem("regwallEvent")&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"regwall_success"}),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)}}(),hp=function(){var e=(0,t.A)(o.mark(function e(t,n){var r,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.entitlements&&(r=Ph(n.entitlements.token)),i.A.log("ANALYTICS: user state variables are:  ",t,n.userState),a="known"===t&&n.userState?r&&r.entitlement_entitled?"comp"===r.entitlement_level||"freeTrial"===r.entitlement_level?"subscriber-".concat(r.entitlement_level):"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"known"!==t||n.userState?"unknown"===t||"unknown-default"===t||"unknown-fail"===t&&"noEntitlements"===n.userState?t:t&&n.userState?r&&r.entitlement_entitled?"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"noState":"known-entitlements-failed",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)}}(),pp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,zh();case 1:n=e.sent,r=n.isAuthenticated,a=r,e.next=!0===a?2:!1===a?3:a===gh.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=gh.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
2),e.abrupt("return","unknown-fail");case 8:case"end":return e.stop()}},e,null,[[0,7]])}));return function(){return e.apply(this,arguments)}}(),fp=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)}},mp=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)}},gp=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(op(window.authentication_config["got".concat(t,"GroupTime")])?parseInt(window.authentication_config["got".concat(t,"GroupTime")],10):1);break;default:return n.event}return n},wp=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"),o=localStorage.getItem("abcdeLocal"),r=np("GroupEnabled"),a=np("GroupDelayEnabled"),s=np("GroupTimeDelayEnabled"),c=np("got".concat(n,"GroupEnabled")),u=np("got".concat(o,"GroupDelayEnabled")),l=np("got".concat(n,"GroupTimeDelayEnabled")),d=/Windows|Macintosh|Mac OS X|Linux/.test(navigator.userAgent),n&&r&&c&&!a&&d&&!s?(i.A.log("ANALYTICS: Position event enabled"),mp(gp("placement",n))):o&&!r&&a&&u&&!s?(i.A.log("ANALYTICS: Scroll delay enabled"),mp(gp("scrolling",o))):n&&!r&&!a&&s&&l?(i.A.log("ANALYTICS: Time delay enabled"),mp(gp("delayTime",n))):(i.A.log("ANALYTICS: No custom event detected"),fp(gp("default")))):fp(t)}catch(e){i.A.log("ANALYTICS: Event not setup",e)}var n,o,r,a,s,c,u,l,d},yp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=!1,e.next=1,Vh();case 1:if(!(n=e.sent)||!n.token){e.next=2;break}return r=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"),lp(r),e.abrupt("return",{userState:t,entitlements:n});case 2:return e.abrupt("return","noEntitlements");case 3:return e.prev=3,c=e.catch(0),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)}}(),vp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bp=function(e,t,n){var o=[],r=[],i=function(e){return e.join(n)};return e.forEach(function(e){(0===r.length?e:i([].concat(u(r),[e]))).length<=t?r.push(e):(r.length>0&&o.push(i(r)),r=[e])}),r.length>0&&o.push(i(r)),o},Ap=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:if(0!==(n=(null===(t=window.blueConicClient)||void 0===t?void 0:t.getSegments())||[]).length){e.next=2;break}return i.A.log("ANALYTICS: No BlueConic segments found, skipping Admiral segments KVP"),e.abrupt("return");case 2:if(r=n.map(function(e){return e.name}),a=bp(r,1200,";"),cp.isAvailable()){e.next=3;break}return i.A.log("ANALYTICS: window.admiral is not available, skipping Admiral segments KVP"),e.abrupt("return");case 3:s=cp.getInstance(),a.forEach(function(e,t){var n="bcSegments-".concat(t+1);s.queueSet(n,e),i.A.log("ANALYTICS: Admiral segments KVP queued (".concat(n,"):"),e)}),s.scheduleReady();case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Sp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("sspwG2iMeterEvent: initializing sspwG2iMeterEvent function"),e.next=1,Bh();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,Kh(["Byline","Page Title","Section","Paywall_Level"]);case 3:if(!("free"!==(t=e.sent).Paywall_Level&&"1"===window.sophi_config.enableSophiSSPW||"premium"===t.Paywall_Level&&"1"===window.authentication_config.serverEntitlements)){e.next=5;break}return n="NOWALL",(r=document.querySelector("#server-paywall, #server-regwall, #nav-api-sspw, #nav-api-ssrw"))&&(i.A.log("sspwG2iMeterEvent: paywall element found: ",r.id),"server-paywall"===r.id||"nav-api-sspw"===r.id?n="SSPW":"server-regwall"!==r.id&&"nav-api-ssrw"!==r.i
2d||(n="SSRW")),a="1"===window.sophi_config.enableSophiSSPW?"sophi":"sspw",s="SSPWV1","sophi"===a&&(s="nav-api-sspw"===r.id||"nav-api-ssrw"===r.id?"Sophi/Naviga_SSPW":"Sophi_SSPW"),c={event:"meterStop",author:t.Byline||"",title:t["Page Title"]||"",section:t.Section||"",actionType:s,actionName:n},i.A.log("sspwG2iMeterEvent: article data found on dataLayer: ",t),e.next=4,Wh();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 _p={onLoadAnalytics:function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("ANALYTICS: Start Analytics"),dp(),window.MNGAuthentication.postAuthEvents=[],window.MNGAuthentication.preAuthGTMEvents=[],window.MNGAuthentication.postAuthEvents.push(wp),!((n=Th()).pathname.startsWith("/logout")||n.pathname.startsWith("/login")||n.pathname.startsWith("/callback"))){e.next=1;break}return e.abrupt("return");case 1:return vp(),e.next=2,pp();case 2:return r=e.sent,e.next=3,yp();case 3:return a=e.sent,hp(r,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."),Sp()),e.next=4,Ap();case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),blueConicRegwallEvents:up,callPreparedGTMEvent:fp,callCustomGTMEvent:mp};var Ep=n(1834),Tp=function(){try{var e=localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){i.A.log("Unable to get session from local storage: ",e)}return"{}"},kp=function(e){try{i.A.log("Setting local storage session",e),localStorage.setItem(gh.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){i.A.log("Unable to save session from local storage: ",e)}},Rp=function(e){try{Ch(gh.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:Oh(),expires:365,secure:!0})}catch(e){i.A.log("Unable to save session to cookie storage: ",e)}},Op=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,g,w,y,v,b,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.A.sessionServer,n="".concat(t,"/api/session"),i.A.log("Checking server session: ",n),e.next=1,mh.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,w=null!==(s=null==h?void 0:h.entitlement_expiry)&&void 0!==s?s:null,y=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,v=null!==(u=null==h?void 0:h.entitlement_entitled)&&void 0!==u?u:null,b=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,kp(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:w,entitlementSource:y,isEntitled:v,adFree:b,entitlementLevel:A})),""!==g&&"string"==typeof g&&Rp(g),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:g,expiration:w,entitlementSource:y,isEntitled:v,adFree:b,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)}}(),Cp=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=r.A.sessionServer,a="".concat(n,"/api/session"),i.A.log("Updating server session: ",a),e.next=1,mh.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)}}(),Ip=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=r.A.sessionServer,n="".concat(t,"/api/session"),i.A.log("Deleting server session: ",n),e.next=1,mh.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)}}(),Np=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E,T,k,R,O,C,I;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Inside getSession"),e.prev=1,d=Tp(),i.A.log("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,g=h.expiration,w=h.entitlementSource,y=h.isEntitled,v=h.adFree,b
2=h.entitlementLevel,n=p,t=f,r=m,a=g,s=w,c=y,u=v,l=b,i.A.log("Session: check both tokens: ",t,r),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,Op();case 2:A=e.sent,S=A.accessToken,_=A.idToken,E=A.entitlementToken,T=A.expiration,k=A.entitlementSource,R=A.isEntitled,O=A.adFree,C=A.entitlementLevel,n=S,t=_,r=E,a=T,s=k,c=R,u=O,l=C;case 3:e.next=5;break;case 4:e.prev=4,I=e.catch(1),i.A.log("Failed to get session: ",I);case 5:return i.A.log("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,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)}}(),Pp=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,a,s,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E,T,k,R,O,C,I,N,P;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Tp(),r=JSON.parse(n),a=r.accessToken,s=void 0===a?null:a,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,h=r.expiration,p=void 0===h?null:h,f=r.entitlementSource,m=void 0===f?null:f,g=r.isEntitled,w=void 0===g?null:g,y=r.adFree,v=void 0===y?null:y,b=r.entitlementLevel,A=void 0===b?null:b,S=t.accessToken,_=t.idToken,E=t.entitlementToken,T=t.expiration,k=t.entitlementSource,R=t.isEntitled,O=t.adFree,C=t.entitlementLevel,I={accessToken:S??s,idToken:_??u,entitlementToken:E??d,expiration:T??p,entitlementSource:k??m,isEntitled:R??w,adFree:O??v,entitlementLevel:C??A},i.A.log("Current session data: ",r),i.A.log("New session data: ",t),i.A.log("Updated session data:",I),N=JSON.stringify(I),kp(N),""!==I.entitlementToken&&"string"==typeof I.entitlementToken&&Rp(I.entitlementToken),n===N){e.next=1;break}return e.next=1,Cp(I);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)}}(),xp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Ending session..."),Yh(),e.next=1,Ip();case 1:localStorage.removeItem(gh.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Lp="1"===window.authentication_config.isEmbedLoginEnabled,Up=function(){return"logout"===(Th().searchParams.get("state")||"").toLowerCase()};Lp||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var Mp=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,$h();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)}}(),Dp=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=/")}},jp=function(){return new Promise(function(e){i.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},Wp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c,u,l,d,h;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Attempting to logout..."),Dp(),i.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(r=n?Ph(n):"")){e.next=2;break}return a=r.auth0Id,e.next=1,ip(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,xp();case 3:e.next=5;break;case 4:Yh();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")}
2).forEach(function(e){window.localStorage.removeItem(e),i.A.log("Removed Auth0 storage object...")}),Zh("hhsl"),Zh("userNewsLetterData"),Zh(gh.REGWALL_USER_IS_SUBSCRIBED),Zh(gh.USER_PROFILE_HASH),c=Th(),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",Ep.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,jp();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,Mp(u);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Gp=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},Kp=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return fp(e)}),i.A.log("Cycled through preauth GTM events.")},Bp=function(){var e=(0,t.A)(o.mark(function e(t,n,r,a,s){var c,l,d,h,p,f,m,g,w,y,v,b,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Attempting to login..."),Gp()>4.5&&window.localStorage.clear(),Kp(),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,$h();case 1:if(p=e.sent,f=Th(),m=f.origin,g=new URL("".concat(m,"/callback")),w={},f.searchParams.get("regwall")&&(f.searchParams.get("returnUrl")&&(y=f.searchParams.get("returnUrl")),f.searchParams.get("auth_redirect")&&(y=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()),y&&"regwall"!==t&&g.searchParams.set("auth_redirect",y),"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,xp();case 2:e.next=4;break;case 3:Yh();case 4:return null!==(h=f.searchParams.get("login-with"))?w.connection=h:n&&(w.connection=n),v="none",t&&"regwall"===t&&(g.searchParams.set("regwall","true"),v="signUp",i.A.log("Logging in with regwall")),t&&(g.searchParams.set("loginsource",t),i.A.log("Logging in with ".concat(t))),r&&(w.login_hint=r),w.redirect_uri=g.toString(),w.initialScreen=v,"googleonetap"!==t&&(w.prompt="select_account"),null!==(b=f.searchParams.get("ampRegiWall"))&&(A=window.location.hostname,w.ampRegiWall=b,w.sourceDomain=A.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),w.initialScreen="signUp",w.preferenceId=f.searchParams.get("prefId")),e.next=5,p.loginWithRedirect({authorizationParams:w});case 5:case"end":return e.stop()}},e)}));return function(t,n,o,r,i){return e.apply(this,arguments)}}(),Fp=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),o=JSON.parse(n);if(!o||0===o.length)return void e();i.A.log("Adding listeners to events we need to wait for...");var r=o.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 o=n.detail||{};i.A.log("Event: ".concat(t,"} ready: "),o),e(o)}catch(t){i.A.log(t),e()}},!1)});var t});Promise.all(r).then(function(){clearTimeout(t),e()})}catch(t){i.A.log("Failed to wait for callback events",t),e()}})},Hp=function(){var e=(0,t.A)(o.mark(function e(){var n,r,a,s,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E,T;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Dp(),n=Th(),r=!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)),Bp(!1,!1,!1,[],c)):Bp()):a.includes("post-apple-login")&&(i.A.log("This is Apple Callback flow."),r=!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",Bp(!1,!1,!1,!1,a));case 1:r&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,$h();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,Fp();case 9:return g=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(f));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(g);case 10:i.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,_=e.catch(8),i.A.log("Failed to cycle through login callbacks: ",_);case 12:if(w={accessToken:m,userId:p.sub,email:p.email,picture:p.picture},y=!1,v="",!r){e.next=17;break}return e.prev=13,e.next=14,Lh(w.userId);case 14:return v=e.sent,i.A.log("Encrypted apple uuid is: ".concat(v)),e.next=15,xh(v);case 15:y=e.sent,i.A.log("Apple sub status is: ".concat(y)),e.next=17;break;case 16:e.prev=16,E=e.catch(13),i.A.log("Apple sub check error: ".concat(E)),alert("There was an error in logging you in, please try again.");case 17:if(Zh(gh.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}
2return i.A.log("Saving idToken to session server"),e.next=18,Pp({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 b=n.searchParams.get("loginsource"),A=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(b));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(A);case 20:return e.prev=20,S=new URL(a),r&&y&&S.searchParams.append("access_token",v),i.A.log("Apple redirect URL:",S),e.abrupt("return",window.location.assign(S));case 21:return e.prev=21,T=e.catch(20),i.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)}}(),Xp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("ANALYTICS: fireBC events"),e.next=1,up();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)}}(),Jp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c,u,l,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,zh();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=Ph(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:r,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:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();Lp||(window.MNGAuthentication.login=Bp,window.MNGAuthentication.logout=Wp,window.MNGAuthentication.getUserInfo=Jp);var zp=function(){var e=(0,t.A)(o.mark(function e(){var n,s,c,u,l,d,h,p,f,m,g,w,y,v,b,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Lp){e.next=1;break}return i.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=Th(),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)(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,$h();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=kh(gh.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,r=e.catch(0),i.A.log("Unable to verify user has active auth0 session: ",r);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,Wp();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(gh.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Tp()){e.next=5;break}return f&&(p=f.jwt),e.next=5,Pp({idToken:c,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,Np();case 7:m=e.sent,c=m.idToken,(s="string"==typeof c)&&(l=Ph(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||!r.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(w=null,l&&"object"===(0,a.A)(l)?w=l:c&&(w=Ph(c)),!((y=null===(g=w)||void 0===g?void 0:g.exp)&&Date.now()/1e3>y)){e.next=13;break}return i.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,Wp();case 12:s=!1,c="",l={};case 13:if(s||u||!r.A.blueconicEnabled||!r.A.bcLowaSegements){e.next=15;break}return i.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,Xh(!0);case 14:v=e.sent,i.A.log("BlueConic LOWA | bcLowaCheck result:",v),v.isSub?(i.A.log("BlueConic LOWA | authenticated as LOWA"),s=gh.USER_IS_LOWA,l={sub:v.uuid}):i.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(tp({isAuthenticated:s,idToken:c,accessToken:u,claims:l}),rp("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..."),(b=n.searchParams.get("auth_redirect")).endsWith("#")&&(b=b.slice(0,b.length)),window.location.assign(b)),n.pathname.startsWith("/login")&&!Up()&&(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")&&!Up()?(i.A.log("Page is login. Attempting to log user in..."),Bp()):n.pathname.startsWith("/login")&&Up()?(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,Xp();case 16:i.A.log("Now login from regwall"),Bp(),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,Hp();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=zp;const Vp={init:zp};var Yp=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 
vendor: 9,595 bytes, lines 2-5
2newsletter: ",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 Zp=function(){var e=(0,t.A)(o.mark(function e(t){var n,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.log("Google token ",t),n=Ph(t.credential),e.prev=1,fp("one_tap_click"),localStorage.setItem("regwallSuccess","yes"),!r.A.newsletterId){e.next=2;break}return i.A.log("About to call Connext's subscribeToNewsletter function"),e.next=2,Yp(n.email,r.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",r.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)}}(),qp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:google.accounts.id.initialize({client_id:r.A.googleClientId,callback:Zp,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"),fp(t)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const Qp={init:function(){var e=(0,t.A)(o.mark(function e(){var t,n,a,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.oneTapEnabled){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,zh();case 2:if(t=e.sent,n=t.isAuthenticated,a=Th(),n!==gh.USER_IS_LOWA){e.next=5;break}return e.next=3,Hh();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,Mh();case 7:return i.A.log("onetap loading..."),c=new Date,e.next=8,qp(c);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};const $p=function(){return(0,yh.A)(function e(){(0,wh.A)(this,e)},null,[{key:"init",value:(n=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Mh(!0);case 1:document.querySelectorAll("#nav-api-ssrw, #ss-regwall-body").length>0&&(i.A.log("ServerWalls | initRegwall()"),this.preventNativeSubmit(),this.initRegwall());case 2:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"preventNativeSubmit",value:function(){document.addEventListener("click",function(e){e.target.closest("#regiliteSubButtonId")&&e.preventDefault()},!0)}},{key:"initRegwall",value:(e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,jh();case 1:if(!1!==e.sent){e.next=2;break}return i.A.log("ServerWalls | engageLibrary failed to load within 10 seconds, skipping regilite()."),e.abrupt("return");case 2:window.engageLibrary.regilite(99999);case 3:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})}]);var e,n}();var ef=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.A.log("Settings: ",r.A),Vp.init(),_p.onLoadAnalytics(),$p.init(),e.next=1,Qp.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();ef()})()})();
3//# sourceMappingURL=mng-digisubs.main.bundle.js.map;
4/*! For license information please see mng-digisubs.connext.bundle.js.LICENSE.txt */
5(()=>{var e={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 o=n(5546);function r(){var t,n,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function c(e,r,i,s){var a=r&&r.prototype instanceof l?r:l,c=Object.create(a.prototype);return o(c,"_invoke",function(e,o,r){var i,s,a,c=0,l=r||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,s=0,a=t,h.n=n,u}};function p(e,o){for(s=e,a=o,n=0;!d&&c&&!r&&n<l.length;n++){var r,i=l[n],p=h.p,f=i[2];e>3?(r=f===o)&&(a=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=p&&((r=e<2&&p<i[1])?(s=0,h.v=o,h.n=i[1]):p<f&&(r=e<3||i[0]>o||o>f)&&(i[4]=e,i[5]=o,h.n=f,s=0))}if(r||e>1)return u;throw d=!0,o}return function(r,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),s=l,a=f;(n=s<2?t:a)||!d;){i||(s?s<3?(s>1&&(h.n=-1),p(s,a)):h.n=a:h.v=a);try{if(c=2,i){if(s||(r="next"),n=i[r]){if(!(n=n.call(i,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,s<2&&(s=0)}else 1===s&&(n=i.return)&&n.call(i),s<2&&(a=TypeError("The iterator does not provide a '"+r+"' method"),s=1);i=t}else if((n=(d=h.n<0)?a:e.call(o,h))!==u)break}catch(e){i=t,s=1,a=e}finally{c=1}}return{value:n,done:d}}}(e,i,s),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][s]?n(n([][s]())):(o(n={},s,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,o(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,o(f,"constructor",h),o(h,"constructor",d),d.displayName="GeneratorFunction",o(h,a,"GeneratorFunction"),o(f),o(f,a,"Generator"),o(f,s,function(){return this}),o(f,"toString",function(){return"[object Generator]"}),(e.exports=r=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var o=n(887);e.exports=function(e,t,n,r,i){var s=o(e,t,n,r,i);return s.next().then(function(e){return e.done?e.value:s.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var o=n(6993),r=n(1791);e.exports=function(e,t,n,i,s){return new r(o().w(e,t,n,i),s||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var o=n(5172),r=n(5546);e.exports=function e(t,n){function i(e,r,s,a){try{var c=t[e](r),u=c.value;return u instanceof o?n.resolve(u.v).then(function(e){i("next",e,s,a)},function(e){i("throw",e,s,a)}):n.resolve(u).then(function(e){c.value=e,s(c)},function(e){return i("throw",e,s,a)})}catch(e){a(e)}}var s;this.next||(r(e.prototype),r(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(e,t,o){function r(){return new n(function(t,n){i(e,o,t,n)})}return s=s?s.then(r,r):r()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,o,r,i){var s=Object.defineProperty;try{s({},"",{})}catch(n){s=0}e.exports=t=function(e,n,o,r){function i(n,o){t(e,n,function(e){return this._invoke(n,o,e)})}n?s?s(e,n,{value:o,enumerable:!r,configurable:!r,writable:!r}):e[n]=o:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,o,r,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 o in t)n.unshift(o);return function e(){for(;n.length;)if((o=n.pop())in t)return e.value=o,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var o=n(5172),r=n(6993),i=n(5869),s=n(887),a=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=r(),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(o){t||(t={stop:function(){return n(o.a,2)},catch:function(){return o.v},abrupt:function(e,t){return n(o.a,p[e],t)},delegateYield:function(e,r,i){return t.resultName=r,n(o.d,u(e),i)},finish:function(e){return n(o.f,e)}},n=function(e,n,r){o.p=t.prev,o.n=t.next;try{return e(n,r)}finally{t.next=o.n}}),t.resultName&&(t[t.resultName]=o.v,t.resultName=void 0),t.sent=o.v,t.next=o.n;try{return e.call(this,t)}finally{o.p=t.prev,o.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,o,r){return t.w(f(e),n,o,r&&r.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new o(e,t)},AsyncIterator:a,async:function(e,t,n,o,r){return(h(t)?s:i)(f(e),t,n,o,r)},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 o=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(o(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 o=n(4633)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}
5,467(e,t,n){"use strict";function o(e,t,n,o,r,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(o,r)}function r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(e){o(s,r,i,a,c,"next",e)}function c(e){o(s,r,i,a,c,"throw",e)}a(void 0)})}}n.d(t,{A:()=>r})},3029(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>o})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var o=n(9922);function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(0,o.A)(r.key),r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}},4467(e,t,n){"use strict";n.d(t,{A:()=>r});var o=n(9922);function r(e,t,n){return(t=(0,o.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:()=>r});var o=n(2284);function r(e,t){if("object"!=(0,o.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=(0,o.A)(r))return r;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 o=n(2284),r=n(2327);function i(e){var t=(0,r.A)(e,"string");return"symbol"==(0,o.A)(t)?t:t+""}},2284(e,t,n){"use strict";function o(e){return o="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},o(e)}n.d(t,{A:()=>o})},1834(e,t,n){"use strict";var o=n(467),r=n(3029),i=n(2901),s=n(4467),a=n(4756),c=n(3153);window.disableAuth0AuthFlow=!0;var u=function(){function e(){var t,n;(0,r.A)(this,e),(0,s.A)(this,"readyInstances",new Map),(0,s.A)(this,"connextAlreadyRan",!1),(0,s.A)(this,"eventListeners",{}),(0,s.A)(this,"runConnextIfSilentTimer",void 0),(0,s.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,o.A)(a.mark(function n(){return a.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",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,r=this.readyInstances.get(n);if(r)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(r.status,".")),"pending"===r.status&&o<r.timeoutMs&&(c.A.log("Shorter timeout of ".concat(o,"ms requested, replacing existing ").concat(r.timeoutMs,"ms timeout.")),clearTimeout(r.timeout),r.timeoutMs=o,r.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void r.resolveOnce(!0);
5c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),r.resolveOnce(!1)},o)),r.promise;c.A.log('Creating new connext ready promise for "'.concat(n,'" with timeout of ').concat(o,"ms."));var i={promise:null,timeout:null,status:"pending",timeoutMs:o,resolveOnce:null};return i.promise=new Promise(function(e){var r=!1;if(i.resolveOnce=function(t){r||(i.status=t,e(t),r=!0,i.timeout&&(clearTimeout(i.timeout),i.timeout=null))},"undefined"!=typeof Connext&&"onInit"===n)return c.A.log('Connext already ready for event "'.concat(n,'".')),t.removeEventListener(n),void i.resolveOnce(!0);i.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void i.resolveOnce(!0);c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),i.resolveOnce(!1)},o),c.A.log('Listening for Connext event "'.concat(n,'"...'));var s=function(){c.A.log('Connext event "'.concat(n,'" fired!')),t.removeEventListener(n),i.resolveOnce(!0)};document.addEventListener(n,s),t.eventListeners[n]=s,c.A.log('Connext added event listener for "'.concat(n,'"'))}),this.readyInstances.set(n,i),i.promise}},{key:"runConnext",value:function(){"undefined"!=typeof Connext&&(c.A.log("Running Connext now..."),Connext.Run(),this.connextAlreadyRan=!0,this.runConnextIfSilentTimer&&clearTimeout(this.runConnextIfSilentTimer))}},{key:"rerunConnextEntitlements",value:(n=(0,o.A)(a.mark(function t(){var n,o,r=arguments;return a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>0&&void 0!==r[0]&&r[0],o=r.length>1&&void 0!==r[1]&&!r[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",o);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,o.A)(a.mark(function t(){var n;return a.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,s.A)(u,"defaultTimeoutLength",300),(0,s.A)(u,"backupTimeoutLength",1e5),(0,s.A)(u,"subTimeoutInterval",5e3),window.ConnextUtils=window.ConnextUtils||new u;const l=u;n.d(t,["A",0,l])},3153(e,t,n){"use strict";var o=n(3612);const r={log:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}}};n.d(t,["A",0,r])},3612(e,t,n){"use strict";var o,r,i,s,a;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===(o=window.authentication_config)||void 0===o?void 0:o.articleSharingEnabled)&&"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(s=window.authentication_config)||void 0===s?void 0:s.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(a=window.authentication_config)||void 0===a?void 0:a.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.linaC
5heckOnArticles,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,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var r=t[o++],i=t[o++],s=0===i?{enumerable:!0,value:t[o++]}:{enumerable:!0,get:i};n.o(e,r)||Object.defineProperty(e,r,s)}else 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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>Zl,hasStandardBrowserEnv:()=>ql,hasStandardBrowserWebWorkerEnv:()=>Ql,navigator:()=>Yl,origin:()=>$l});var t=n(467),o=n(4756),r=n(2284),i=n(4467);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,s,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(a.push(o.value),a.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw r}}return a}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}class u extends Error{}function l(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function d(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function h(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function p(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function f(e,t){this.v=e,this.k=t}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function g(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function w(e){return new f(e,0)}function y(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function v(e,t){return e.get(g(e,t))}function b(e,t,n){y(e,t),t.set(e,n)}function A(e,t,n){return e.set(g(e,t),n),n}function S(e,t){y(e,t),t.add(e)}function _(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
5t%2?E(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,s,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(a.push(o.value),a.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){return function(){return new C(e.apply(this,arguments))}}function C(e){var t,n;function o(t,n){try{var i=e[t](n),s=i.value,a=s instanceof f;Promise.resolve(a?s.v:s).then(function(n){if(a){var c="return"===t&&s.k?t:"next";if(!s.k||n.done)return o(c,n);n=e[c](n).value}r(!!i.done,n)},function(e){o("throw",e)})}catch(e){r(2,e)}}function r(e,r){2===e?t.reject(r):t.resolve({value:r,done:e}),(t=t.next)?o(t.key,t.arg):n=null}this._invoke=function(e,r){return new Promise(function(i,s){var a={key:e,arg:r,resolve:i,reject:s,next:null};n?n=n.next=a:(t=n=a,o(e,r))})},"function"!=typeof e.return&&(this.return=void 0)}u.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,C.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},C.prototype.next=function(e){return this._invoke("next",e)},C.prototype.throw=function(e){return this._invoke("throw",e)},C.prototype.return=function(e){return this._invoke("return",e)};const I={timeoutInSeconds:60},N=1e4,P="memory",x="Multifactor authentication required",L="online_access",U={name:"auth0-spa-js",version:"2.27.0"},M=()=>Date.now(),D="default";class j extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,j.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new j(t,n)}}class W extends j{constructor(e,t){super("invalid_configuration","".concat(e," ").concat(t)),this.suggestion=t,Object.setPrototypeOf(this,W.prototype)}}class K extends j{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=o,Object.setPrototypeOf(this,K.prototype)}}class G extends j{constructor(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=o,this.appState=r,Object.setPrototypeOf(this,G.prototype)}}class B extends j{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,B.prototype)}}class F extends B{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,F.prototype)}}class H extends j{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,H.prototype)}}class X extends j{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,X.prototype)}}class J extends j{constructor(e,t,n,o){super(e,t),this.mfa_token=n,this.mfa_requirements=o,Object.setPrototypeOf(this,J.prototype)}}class z extends j{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(Y(e,["default"]),"', scope: '").concat(Y(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,z.prototype)}}class V extends j{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(Y(e,["default"]),"', missing scope: '").concat(Y(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,V.prototype)}}class Z extends j{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,Z.prototype)}}function Y(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const q=()=>window.crypto,Q=()=>{let e="";for(;e.length<43;){const t=q().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},$=e=>btoa(e),ee=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],te=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,o)=>
5{if(t&&"env"===o)return n;const r=ee.find(e=>e.key===o);return r&&r.type.includes(typeof e[o])&&(n[o]=e[o]),n},{})},ne=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()},oe=async e=>{const t=q().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},re=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),ie=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 se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},ae={},ce={};Object.defineProperty(ce,"__esModule",{value:!0});var ue=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var o=e.locked.get(t);void 0===o?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(o.unshift(n),e.locked.set(t,o))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,o){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 o=n.pop();e.locked.set(t,n),void 0!==o&&setTimeout(o,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();ce.default=function(){return ue.getInstance()};var le=se&&se.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(s,a)}c((o=o.apply(e,t||[])).next())})},de=se&&se.__generator||function(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},he=se;Object.defineProperty(ae,"__esModule",{value:!0});var pe=ce,fe="browser-tabs-lock-key",me={key:function(e){return le(he,void 0,void 0,function(){return de(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return le(he,void 0,void 0,function(){return de(this,function(e){throw new Error("Unsupported")})})},clear:function(){return le(he,void 0,void 0,function(){return de(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return le(he,void 0,void 0,function(){return de(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return le(he,void 0,void 0,function(){return de(this,function(e){throw new Error("Unsupported")})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function ge(e){return new Promise(function(t){return setTimeout(t,e)})}function we(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var ye=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+we(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),le(this,void 0,void 0,function(){var o,r,i,s,a,c,u;return de(this,function(l){switch(l.label){case 0:o=Date.now()+we(4),r=Date.now()+n,i=fe+"-"+t,s=void 0===this.storageHandler?me:this.storageHandler,l.label=1;case 1:return Date.now()<r?[4,ge(30)]:[3,8];case 2:return l.sent(),null!==s.getItemSync(i)?[3,5]:(a=this.id+"-"+t+"-"+
5o,[4,ge(Math.floor(25*Math.random()))]);case 3:return l.sent(),s.setItemSync(i,JSON.stringify({id:this.id,iat:o,timeoutKey:a,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,ge(30)];case 4:return l.sent(),null!==(c=s.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===o?(this.acquiredIatSet.add(o),this.refreshLockWhileAcquired(i,o),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?me:this.storageHandler),[4,this.waitForSomethingToChange(r)];case 6:l.sent(),l.label=7;case 7:return o=Date.now()+we(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return le(this,void 0,void 0,function(){var n=this;return de(this,function(o){return setTimeout(function(){return le(n,void 0,void 0,function(){var n,o,r;return de(this,function(i){switch(i.label){case 0:return[4,pe.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?me:this.storageHandler,null===(o=n.getItemSync(e))?(pe.default().unlock(t),[2]):((r=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(r)),pe.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(pe.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return le(this,void 0,void 0,function(){return de(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var o=!1,r=Date.now(),i=!1;function s(){if(i||(window.removeEventListener("storage",s),e.removeFromWaiting(s),clearTimeout(a),i=!0),!o){o=!0;var t=50-(Date.now()-r);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",s),e.addToWaiting(s);var a=setTimeout(s,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 le(this,void 0,void 0,function(){return de(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 le(this,void 0,void 0,function(){var n,o,r,i;return de(this,function(s){switch(s.label){case 0:return n=void 0===this.storageHandler?me:this.storageHandler,o=fe+"-"+t,null===(r=n.getItemSync(o))?[2]:(i=JSON.parse(r)).id!==this.id?[3,2]:[4,pe.default().lock(i.iat)];case 1:s.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(o),pe.default().unlock(i.iat),e.notifyWaiters(),s.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,o=t,r=[],i=0;;){var s=o.keySync(i);if(null===s)break;r.push(s),i++}for(var a=!1,c=0;c<r.length;c++){var u=r[c];if(u.includes(fe)){var l=o.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(o.removeItemSync(u),a=!0)}}}a&&e.notifyWaiters()},e.waiters=void 0,e}(),ve=ae.default=ye;class be{async runWithLock(e,t,n){const o=new AbortController,r=setTimeout(()=>o.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:o.signal},async e=>{if(clearTimeout(r),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(r),"AbortError"===(null==e?void 0:e.name))throw new B;throw e}}}class Ae{constructor(){this.activeLocks=new Set,this.lock=new ve,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let o=!1;for(let n=0;n<10&&!o;n++)o=await this.lock.acquireLock(e,t);if(!o)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 Se=null;function _e(){return Se||(Se=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new be:new Ae;var e}()),Se}const Ee=new TextEncoder,Te=new TextDecoder;function ke(e){return"string"==typeof e?Ee.encode(e):Te.decode(e)}function Oe(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new Ne(`${e.name} modulusLength must be at least 2048 bits`)}let Re;if(Uint8Array.prototype.toBase64)Re=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Re=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Ce(e){return Re(e)}
5class Ie extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class Ne extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}function Pe(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new Ie("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(e){if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new Ie("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(e){if("P-256"===e.algorithm.namedCurve)return"ES256";throw new Ie("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new Ie("unsupported CryptoKey algorithm name")}}function xe(e){return e instanceof CryptoKey}function Le(e){return xe(e)&&"public"===e.type}async function Ue(e,t,n,o,r,i){const s=null==e?void 0:e.privateKey,a=null==e?void 0:e.publicKey;if(!xe(c=s)||"private"!==c.type)throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!Le(a))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==a.extractable)throw new TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw new TypeError('"htu" must be a string');if("string"!=typeof n)throw new TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw new TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw new TypeError('"accessToken" must be a string or undefined');if(void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)))throw new TypeError('"additional" must be an object');const u=Object.assign(Object.create(null),i,{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:o,htu:t,ath:r?Ce(await crypto.subtle.digest("SHA-256",ke(r))):void 0});return async function(e,t,n){if(!1===n.usages.includes("sign"))throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const o=`${Ce(ke(JSON.stringify(e)))}.${Ce(ke(JSON.stringify(t)))}`;return`${o}.${Ce(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Oe(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Oe(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new Ie}(n),n,ke(o)))}`}({alg:Pe(s),typ:"dpop+jwt",jwk:await Me(a)},u,s)}async function Me(e){const{kty:t,e:n,n:o,x:r,y:i,crv:s}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:s,e:n,n:o,x:r,y:i}}const De="dpop-nonce",je=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","urn:okta:params:oauth:grant-type:webauthn","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-rec
5overy-code"];const We=(e,t)=>new Promise(function(n,o){const r=new MessageChannel;r.port1.onmessage=function(e){e.data.error?o(new Error(e.data.error)):n(e.data),r.port1.close()},t.postMessage(e,[r.port2])}),Ke=(e,t,n)=>{const o=new AbortController;let r;return t.signal=o.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{r=setTimeout(()=>{o.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},Ge=async function(e,t,n,o,r,i){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:N;return r?(async(e,t,n,o,r,i,s,a,c,u)=>We({type:"refresh",auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:o,useFormData:s,useMrrt:a,skipTokenStorage:c,preserveRefreshToken:u},i))(e,t,n,o,s,r,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0,arguments.length>9?arguments[9]:void 0):(async(e,t,n)=>{const o=await Ke(e,t,n);return{ok:o.ok,json:await o.json(),headers:(r=o.headers,[...r].reduce((e,t)=>{let n=O(t,2),o=n[0],r=n[1];return e[o]=r,e},{}))};var r})(e,o,s)};async function Be(e,t,n,o,r,i,s,a,c,u,l,h){if(c){const t=await c.generateProof({url:e,method:r.method||"GET",nonce:await c.getNonce()});r.headers=Object.assign(Object.assign({},r.headers),{dpop:t})}let p,f=null;for(let c=0;c<3;c++)try{p=await Ge(e,n,o,r,i,s,t,a,l,h),f=null;break}catch(e){f=e}if(f)throw f;const m=p.json,g=m.error,w=m.error_description,y=d(m,["error","error_description"]),v=p,b=v.headers,A=v.ok;let S;if(c&&(S=b[De],S&&await c.setNonce(S)),!A){const d=w||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===g)throw new J(g,d,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===g)throw new z(n,o);if("use_dpop_nonce"===g){if(!c||!S||u)throw new Z(S);return Be(e,t,n,o,r,i,s,a,c,!0,l,h)}throw new j(g||"request_error",d)}return y}async function Fe(e,t,n){var o=e.baseUrl,r=e.timeout,i=e.audience,s=e.scope,a=e.auth0Client,c=e.useFormData,u=e.useMrrt,l=e.dpop,h=e.preserveRefreshToken,p=d(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop","preserveRefreshToken"]);const f="urn:ietf:params:oauth:grant-type:token-exchange"===p.grant_type,m="urn:okta:params:oauth:grant-type:webauthn"===p.grant_type,g="refresh_token"===p.grant_type&&u,w=f||m||g,y=Object.assign(Object.assign(Object.assign({},p),w&&i&&{audience:i}),w&&s&&{scope:s}),v=m||!c,b=v?JSON.stringify(y):ne(y),A=(S=p.grant_type,je.includes(S));var S;return await Be("".concat(o,"/oauth/token"),r,i||D,s,{method:"POST",body:b,headers:{"Content-Type":v?"application/json":"application/x-www-form-urlencoded","Auth0-Client":btoa(JSON.stringify(te(a||U)))}},t,c,u,A?l:void 0,void 0,n,h)}const He=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(o=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(o))).join(" ");var o},Xe=(e,t,n)=>{let o;return n&&(o=e[n]),o||(o=e[D]),He(o,t)},Je="@@auth0spajs@@",ze="@@user@@";class Ve{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=O(e.split("::"),4),n=t[0],o=t[1],r=t[2],i=t[3];return new Ve({clientId:o,scope:i,audience:r},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,o=e.client_id;return new Ve({scope:t,audience:n,clientId:o})}}class Ze{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 Ye{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 qe{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||M}async setIdToken(e,t,n){var o;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(o=this.keyManifest)||void 0===o?void 0:o.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0;var r;let i=await this.cache.get(e.toKey()),s=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const r=this.matchExistingCacheKey(e,t);
5if(r&&(i=await this.cache.get(r),s=Ve.fromKey(r)),!i&&n&&"cache-only"!==o)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),c=Math.floor(a/1e3);return i.expiresAt-t<c?i.body.refresh_token?this.modifiedCachedEntry(i,s):(await this.cache.remove(s.toKey()),void await(null===(r=this.keyManifest)||void 0===r?void 0:r.remove(s.toKey()))):i.body}async modifiedCachedEntry(e,t){const n={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},o={body:n,expiresAt:e.expiresAt};return await this.cache.set(t.toKey(),o),{refresh_token:n.refresh_token,audience:n.audience,scope:n.scope}}async set(e){var t;const n=new Ve({clientId:e.client_id,scope:e.scope,audience:e.audience}),o=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),o),await(null===(t=this.keyManifest)||void 0===t?void 0:t.add(n.toKey()))}async remove(e,t,n){const o=new Ve({clientId:e,scope:n,audience:t});await this.cache.remove(o.toKey())}async stripRefreshToken(e){var t;const n=await this.getCacheKeys();if(n)for(const o of n){const n=await this.cache.get(o);(null===(t=null==n?void 0:n.body)||void 0===t?void 0:t.refresh_token)===e&&(delete n.body.refresh_token,await this.cache.set(o,n))}}async clear(e){var t;const n=await this.getCacheKeys();n&&(await n.filter(t=>!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Ve({clientId:e},Je,ze).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const o=Ve.fromKey(t),r=new Set(o.scope&&o.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],s=o.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return o.prefix===Je&&o.clientId===e.clientId&&o.audience===e.audience&&s})[0]}async getEntryWithRefreshToken(e,t){var n;for(const o of t){const t=Ve.fromKey(o);if(t.prefix===Je&&t.clientId===e.clientId){const e=await this.cache.get(o);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 o=await this.getCacheKeys();if(!o)return[];const r=new Set;for(const i of o){const o=Ve.fromKey(i);if(o.prefix===Je&&o.clientId===t&&o.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)&&r.add(e.body.refresh_token)}}return Array.from(r)}async updateEntry(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await this.getCacheKeys();if(r)for(const i of r){if(Ve.fromKey(i).clientId!==n)continue;const r=await this.cache.get(i);if(!(null==r?void 0:r.body))continue;const s=r.body.refresh_token;s&&(o||s===e)&&(r.body.refresh_token=t,await this.cache.set(i,r))}}}class Qe{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 $e=e=>"number"==typeof e,et=["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 tt=se&&se.__assign||function(){return tt=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},tt.apply(this,arguments)};function nt(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}var ot=function(e){return function(e){for(var t={},n=e?e.split("; "):[],o=/(%[\dA-F]{2})+/gi,r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");'"'===s.charAt(0)&&(s=s.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=s.replace(o,decodeURIComponent)}catch(e){}}return t}(document.cookie)[e]};function rt(e,t,n){document.cookie=function(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decode
5URIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return nt("Expires",e.expires?e.expires.toUTCString():"")+nt("Domain",e.domain)+nt("Path",e.path)+nt("Secure",e.secure)+nt("SameSite",e.sameSite)}(n)}(e,t,tt({path:"/"},n))}var it=rt,st=function(e,t){rt(e,"",tt(tt({},t),{expires:-1}))};const at={get(e){const t=ot(e);if(void 0!==t)return JSON.parse(t)},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),it(e,JSON.stringify(t),o)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),st(e,n)}},ct="_legacy_",ut={get:e=>at.get(e)||at.get("".concat(ct).concat(e)),save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),it("".concat(ct).concat(e),JSON.stringify(t),o),at.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),st(e,n),at.remove(e,t),at.remove("".concat(ct).concat(e),t)}},lt={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 dt;!function(e){e.Code="code",e.ConnectCode="connect_code"}(dt||(dt={}));var ht,pt=function(e){return ht=ht||function(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,i=n.length;r<i;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),i=r.indexOf("\n",10)+1,s=r.substring(i)+(o?"//# sourceMappingURL="+o:""),a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQpeyhudWxsPT10fHx0PmUubGVuZ3RoKSYmKHQ9ZS5sZW5ndGgpO2Zvcih2YXIgcj0wLG89QXJyYXkodCk7cjx0O3IrKylvW3JdPWVbcl07cmV0dXJuIG99ZnVuY3Rpb24gdCh0LHIpe3JldHVybiBmdW5jdGlvbihlKXtpZihBcnJheS5pc0FycmF5KGUpKXJldHVybiBlfSh0KXx8ZnVuY3Rpb24oZSx0KXt2YXIgcj1udWxsPT1lP251bGw6InVuZGVmaW5lZCIhPXR5cGVvZiBTeW1ib2wmJmVbU3ltYm9sLml0ZXJhdG9yXXx8ZVsiQEBpdGVyYXRvciJdO2lmKG51bGwhPXIpe3ZhciBvLG4scyxhLGk9W10sYz0hMCxsPSExO3RyeXtpZihzPShyPXIuY2FsbChlKSkubmV4dCwwPT09dCl7aWYoT2JqZWN0KHIpIT09cilyZXR1cm47Yz0hMX1lbHNlIGZvcig7IShjPShvPXMuY2FsbChyKSkuZG9uZSkmJihpLnB1c2goby52YWx1ZSksaS5sZW5ndGghPT10KTtjPSEwKTt9Y2F0Y2goZSl7bD0hMCxuPWV9ZmluYWxseXt0cnl7aWYoIWMmJm51bGwhPXIucmV0dXJuJiYoYT1yLnJldHVybigpLE9iamVjdChhKSE9PWEpKXJldHVybn1maW5hbGx5e2lmKGwpdGhyb3cgbn19cmV0dXJuIGl9fSh0LHIpfHxmdW5jdGlvbih0LHIpe2lmKHQpe2lmKCJzdHJpbmciPT10eXBlb2YgdClyZXR1cm4gZSh0LHIpO3ZhciBvPXt9LnRvU3RyaW5nLmNhbGwodCkuc2xpY2UoOCwtMSk7cmV0dXJuIk9iamVjdCI9PT1vJiZ0LmNvbnN0cnVjdG9yJiYobz10LmNvbnN0cnVjdG9yLm5hbWUpLCJNYXAiPT09b3x8IlNldCI9PT1vP0FycmF5LmZyb20odCk6IkFyZ3VtZW50cyI9PT1vfHwvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChvKT9lKHQscik6dm9pZCAwfX0odCxyKXx8ZnVuY3Rpb24oKXt0aHJvdyBuZXcgVHlwZUVycm9yKCJJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLiIpfSgpfWNsYXNzIHIgZXh0ZW5kcyBFcnJvcntjb25zdHJ1Y3RvcihlLHQpe3N1cGVyKHQpLHRoaXMuZXJyb3I9ZSx0aGlzLmVycm9yX2Rlc2NyaXB0aW9uPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsci5wcm90b3R5cGUpfXN0YXRpYyBmcm9tUGF5bG9hZChlKXtsZXQgdD1lLmVycm9yLG89ZS5lcnJvcl9kZXNjcmlwdGlvbjtyZXR1cm4gbmV3IHIodCxvKX19Y2xhc3MgbyBleHRlbmRzIHJ7Y29uc3RydWN0b3IoZSx0KXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIiwiTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyIuY29uY2F0KG4oZSxbImRlZmF1bHQiXSksIicsIHNjb3BlOiAnIikuY29uY2F0KG4odCksIicpIikpLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsby5wcm90b3R5cGUpfX1mdW5jdGlvbiBuKGUpe3JldHVybiBlJiYhKGFyZ3VtZW50cy5sZW5ndGg+MSYmdm9pZCAwIT09YXJndW1lbnRzWzFdP2FyZ3VtZW50c1sxXTpbXSkuaW5jbHVkZXMoZSk/ZToiIn0iZnVuY3Rpb24iPT10eXBlb2YgU3VwcHJlc3NlZEVycm9yJiZTdXBwcmVzc2VkRXJyb3I7Y29uc3Qgcz1lPT57dmFyIHQ9ZS5jbGllbnRJZCxyPWZ1bmN0aW9uKGUsdCl7dmFyIHI9e307Zm9yKHZhciBvIGluIGUpT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbykmJnQuaW5kZXhPZihvKTwwJiYocltvXT1lW29dKTtpZihudWxsIT1lJiYiZnVuY3Rpb24iPT10eXBlb2YgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyl7dmFyIG49MDtmb3Iobz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO248by5sZW5ndGg7bisrKXQuaW5kZXhPZihvW25dKTwwJiZPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLmNhbGwoZSxvW25dKSYmKHJbb1tuXV09ZVtvW25dXSl9cmV0dXJuIHJ9KGUsWyJjbGllbnRJZCJdKTtyZXR1cm4gbmV3IFVSTFNlYXJjaFBhcmFtcygoZT0+T2JqZWN0LmtleXMoZSkuZmlsdGVyKHQ9PnZvaWQgMCE9PWVbdF0pLnJlZHVjZSgodCxyKT0+T2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHQpLHtbcl06ZVtyXX0pLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmc
5oKX07bGV0IGE9e30saT1udWxsO2NvbnN0IGM9KGUsdCk9PiIiLmNvbmNhdChlLCJ8IikuY29uY2F0KHQpLGw9KGUsdCk9PnQuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSx1PShlLHQpPT5hW2MoZSx0KV0sZj1lPT57T2JqZWN0LmVudHJpZXMoYSkuZm9yRWFjaChyPT57bGV0IG89dChyLDIpLG49b1swXTtvWzFdPT09ZSYmZGVsZXRlIGFbbl19KX0saD1lPT57Y29uc3QgdD1uZXcgVVJMU2VhcmNoUGFyYW1zKGUpLHI9e307cmV0dXJuIHQuZm9yRWFjaCgoZSx0KT0+e3JbdF09ZX0pLHJ9LGQ9YXN5bmMgZT0+e2xldCByLG4saT1lLmRhdGEsZj1pLnRpbWVvdXQsZD1pLmF1dGgscD1pLmZldGNoVXJsLHk9aS5mZXRjaE9wdGlvbnMsZz1pLnVzZUZvcm1EYXRhLGI9aS51c2VNcnJ0LE89aS5za2lwVG9rZW5TdG9yYWdlLGs9aS5wcmVzZXJ2ZVJlZnJlc2hUb2tlbixtPXQoZS5wb3J0cywxKVswXSxqPXt9O2NvbnN0IHY9ZHx8e30sXz12LmF1ZGllbmNlLHc9di5zY29wZTt0cnl7Y29uc3QgZT1nP2goeS5ib2R5KTpKU09OLnBhcnNlKHkuYm9keSk7aWYoZS5yZWZyZXNoX3Rva2VufHwicmVmcmVzaF90b2tlbiIhPT1lLmdyYW50X3R5cGUpZS5tZmFfdG9rZW4mJihuPXUoXyx3KSwhbiYmYiYmKG49YS5sYXRlc3RfcmVmcmVzaF90b2tlbikpO2Vsc2V7aWYobj11KF8sdyksIW4mJmIpe2NvbnN0IGU9YS5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+ISFPYmplY3Qua2V5cyhhKS5maW5kKHI9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09cil7Y29uc3Qgbz1sKHQsciksbj1yLnNwbGl0KCJ8IilbMV0uc3BsaXQoIiAiKSxzPWUuc3BsaXQoIiAiKS5ldmVyeShlPT5uLmluY2x1ZGVzKGUpKTtyZXR1cm4gbyYmc319KSkodyxfKTtlJiYhdCYmKG49ZSl9aWYoIW4pdGhyb3cgbmV3IG8oXyx3KTt5LmJvZHk9Zz9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpfWxldCBpLGQ7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGk9bmV3IEFib3J0Q29udHJvbGxlcix5LnNpZ25hbD1pLnNpZ25hbCk7dHJ5e2Q9YXdhaXQgUHJvbWlzZS5yYWNlKFsoUD1mLG5ldyBQcm9taXNlKGU9PnNldFRpbWVvdXQoZSxQKSkpLGZldGNoKHAsT2JqZWN0LmFzc2lnbih7fSx5KSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBtLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZClyZXR1cm4gaSYmaS5hYm9ydCgpLHZvaWQgbS5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtpZihVPWQuaGVhZGVycyxqPVsuLi5VXS5yZWR1Y2UoKGUscik9PntsZXQgbz10KHIsMiksbj1vWzBdLHM9b1sxXTtyZXR1cm4gZVtuXT1zLGV9LHt9KSxyPWF3YWl0IGQuanNvbigpLE8pcmV0dXJuIGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4sdm9pZCBtLnBvc3RNZXNzYWdlKHtvazpkLm9rLGpzb246cixoZWFkZXJzOmp9KTtyLnJlZnJlc2hfdG9rZW4/KGImJihhLmxhdGVzdF9yZWZyZXNoX3Rva2VuPXIucmVmcmVzaF90b2tlbixTPW4sTT1yLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVud
5HJpZXMoYSkuZm9yRWFjaChlPT57bGV0IHI9dChlLDIpLG89clswXTtyWzFdPT09UyYmKGFbb109TSl9KSksKChlLHQscik9PnthW2ModCxyKV09ZX0pKHIucmVmcmVzaF90b2tlbixfLHcpLGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4pOmt8fCgoZSx0KT0+e2RlbGV0ZSBhW2MoZSx0KV19KShfLHcpLG0ucG9zdE1lc3NhZ2Uoe29rOmQub2ssanNvbjpyLGhlYWRlcnM6an0pfWNhdGNoKGUpe20ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmp9KX12YXIgUyxNLFUsUH0scD1hc3luYyBlPT57bGV0IHI9ZS5kYXRhLG89ci50aW1lb3V0LG49ci5hdXRoLGk9ci5mZXRjaFVybCxjPXIuZmV0Y2hPcHRpb25zLHU9ci51c2VGb3JtRGF0YSxkPXQoZS5wb3J0cywxKVswXTtjb25zdCBwPShufHx7fSkuYXVkaWVuY2U7dHJ5e2NvbnN0IGU9KGU9Pntjb25zdCByPW5ldyBTZXQ7cmV0dXJuIE9iamVjdC5lbnRyaWVzKGEpLmZvckVhY2gobz0+e2xldCBuPXQobywyKSxzPW5bMF0sYT1uWzFdO2woZSxzKSYmci5hZGQoYSl9KSxBcnJheS5mcm9tKHIpfSkocCk7aWYoMD09PWUubGVuZ3RoKXJldHVybiB2b2lkIGQucG9zdE1lc3NhZ2Uoe29rOiEwfSk7Y29uc3Qgcj11P2goYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7Zm9yKGNvbnN0IHQgb2YgZSl7Y29uc3QgZT11P3MoT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHIpLHt0b2tlbjp0fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7dG9rZW46dH0pKTtsZXQgbixhLGwsaDsiZnVuY3Rpb24iPT10eXBlb2YgQWJvcnRDb250cm9sbGVyJiYobj1uZXcgQWJvcnRDb250cm9sbGVyLGE9bi5zaWduYWwpO3RyeXtoPWF3YWl0IFByb21pc2UucmFjZShbbmV3IFByb21pc2UoZT0+e2w9c2V0VGltZW91dChlLG8pfSksZmV0Y2goaSxPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sYykse2JvZHk6ZSxzaWduYWw6YX0pKV0pLmZpbmFsbHkoKCk9PmNsZWFyVGltZW91dChsKSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIWgpcmV0dXJuIG4mJm4uYWJvcnQoKSx2b2lkIGQucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7aWYoIWgub2spe2xldCBlO3RyeXtjb25zdCB0PUpTT04ucGFyc2UoYXdhaXQgaC50ZXh0KCkpO2U9dC5lcnJvcl9kZXNjcmlwdGlvbn1jYXRjaChlKXt9cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZXx8IkhUVFAgZXJyb3IgIi5jb25jYXQoaC5zdGF0dXMpfSl9Zih0KX1kLnBvc3RNZXNzYWdlKHtvazohMH0pfWNhdGNoKGUpe2QucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZXx8IlVua25vd24gZXJyb3IgZHVyaW5nIHRva2VuIHJldm9jYXRpb24ifSl9fSx5PShlLHQpPT57aWYoIWkpcmV0dXJuITE7dHJ5e2NvbnN0IHI9bmV3IFVSTChpKS5vcmlnaW4sbz1uZXcgVVJMKGUuZmV0Y2hVcmwpO3JldHVybiBvLm9yaWdpbj09PXImJm8ucGF0aG5hbWU9PT10fWNhdGNoKGUpe3JldHVybiExfX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZT0+e2NvbnN0IHI9ZS5kYXRhLG89dChlLnBvcnRzLDEpWzBdO2lmKCEoInR5cGUiaW4gcil8fCJpbml0IiE9PXIudHlwZSlyZXR1cm4idHlwZSJpbiByJiYiY2xlYXIiPT09ci50eXBlPyhhPXt9LHZvaWQobnVsbD09b3x8by5wb3N0TWVzc2FnZSh7b2s6ITB9KSkpOiJ0eXBlImluIHImJiJyZXZva2UiPT09ci50eXBlP3kociwiL29hdXRoL3Jldm9rZSIpP3ZvaWQgcChlKTp2b2lkKG51bGw9PW98fG8ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSkpOnZvaWQoImZldGNoVXJsImluIHImJnkociwiL29hdXRoL3Rva2VuIik/ZChlKTpudWxsPT1vfHxvLnBvc3RNZXNzYWdlKHtvazohMSxqc29uOntlcnJvcjoiaW52YWxpZF9mZXRjaF91cmwiLGVycm9yX2Rlc2NyaXB0aW9uOiJVbmF1dGhvcml6ZWQgZmV0Y2ggVVJMIn0saGVhZGVyczp7fX0pKTtpZihudWxsPT09aSl0cnl7bmV3IFVSTChyLmFsbG93ZWRCYXNlVXJsKSxpPXIuYWxsb3dlZEJhc2VVcmx9Y2F0Y2goZSl7cmV0dXJufX0pfSgpOwoK",null,false),new Worker(ht,e)};class ft{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return"".concat(Je,"::").concat(e)}}const mt="auth0.is.authenticated",gt={memory:()=>(new Ye).enclosedCache,localstorage:()=>new Ze},wt=e=>gt[e],yt=e=>{const t=e.openUrl,n=e.onRedirect,o=d(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},o),{openUrl:!1===t||t?t:n})},vt={NONCE:"nonce",KEYPAIR:"keypair"};class bt{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(vt).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 o=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>
5{o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(vt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(vt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(vt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(vt.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(vt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(vt.KEYPAIR,this.clientId)}}class At{constructor(e){this.storage=new bt(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 o;return o={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(o,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,o=e.method,r=e.nonce,i=e.accessToken;const s=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return Ue(t,s,o,r,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!Le(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await Me(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 Ie("unsupported JWK kty")}return Ce(await crypto.subtle.digest({name:"SHA-256"},ke(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var St;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(St||(St={}));class _t{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)),o=e instanceof Request?new Request(n,e):n;return new Request(o,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),o=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",o)}async prepareRequest(e,t){const n=await this.getAccessToken(t);if(void 0===n)throw new j("missing_access_token","No access token available");let o,r;"string"==typeof n?(o=this.config.dpopNonceId?St.DPoP:St.Bearer,r=n):(o=n.token_type,r=n.access_token),this.setAuthorizationHeader(e,r,o),o===St.DPoP&&await this.setDpopProofHeader(e,r)}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,De);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new Z(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,o){const r=this.buildBaseRequest
5(e,t);await this.prepareRequest(r,o);const i=await this.config.fetch(r);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const o={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},o),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,o,n)}}class Et{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:connected_accounts"]});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)},{scope:["create:me:connected_accounts"]});return this._handleResponse(t)}async getFactors(){const e=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/factors"),{method:"GET"},{scope:["read:me:factors"]});return(await this._handleResponse(e)).factors}async getAuthenticationMethods(e){const t=e?"?".concat(new URLSearchParams({type:e})):"",n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods").concat(t),{method:"GET"},{scope:["read:me:authentication_methods"]});return(await this._handleResponse(n)).authentication_methods}async getAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"GET"},{scope:["read:me:authentication_methods"]});return this._handleResponse(t)}async deleteAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"DELETE"},{scope:["delete:me:authentication_methods"]});t.ok||await this._handleResponse(t)}async updateAuthenticationMethod(e,t){const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},{scope:["update:me:authentication_methods"]});return this._handleResponse(n)}async enrollmentChallenge(e){var t;const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:authentication_methods"]}),o=await this._handleResponse(n),r=null!==(t=n.headers.get("location"))&&void 0!==t?t:"",i=decodeURIComponent(r.split("/").pop()||"");return Object.assign(Object.assign({},o),{id:i,location:r})}async enrollmentVerify(e){const t=e,n=t.location;t.type;const o=d(t,["location","type"]),r=await this.myAccountFetcher.fetchWithAuth("".concat(n,"/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},{scope:["create:me:authentication_methods"]});return this._handleResponse(r)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Tt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Tt(t)}}class Tt extends Error{constructor(e){let t=e.type,n=e.status,o=e.title,r=e.detail,i=e.validation_errors;super(r),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=o,this.detail=r,this.validation_errors=i,Object.setPrototypeOf(this,Tt.prototype)}}const kt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var Ot,Rt;let Ct;if("undefined"==typeof navigator||null===(Ot=navigator.userAgent)||void 0===Ot||null===(Rt=Ot.startsWith)||void 0===Rt||!Rt.call(Ot,"Mozilla/5.0 ")){const e="v3.8.6";Ct="".concat("oauth4webapi","/").concat(e)}function It(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 Nt="ERR_INVALID_ARG_VALUE",Pt="ERR_INVALID_ARG_TYPE";function xt(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}const Lt=Symbol(),Ut=Symbol(),Mt=Symbol(),Dt=Symbol(),jt=Symbol(),Wt=Symbol(),Kt=new TextEncoder,Gt=new TextDecoder;function Bt(e){return"string"==typeof e?Kt.encode(e):Gt.decode(e)}let Ft,Ht;if(Uint8Array.prototype.toBase64)Ft=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Ft=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Xt(e){return"string"==typeof e?Ht(e):Ft(e)}Ht=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw xt("The input to be decoded is not correctly encoded.",Nt,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw xt("The input to be decoded is not correctly encoded.",Nt,e)}};
5class Jt extends Error{constructor(e,t){var n;super(e,t),_(this,"code",void 0),this.name=this.constructor.name,this.code=Yn,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class zt extends Error{constructor(e,t){var n;super(e,t),_(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function Vt(e,t,n){return new zt(e,{code:t,cause:n})}function Zt(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Yt(e){It(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Ct&&!t.has("user-agent")&&t.set("user-agent",Ct),t.has("authorization"))throw xt('"options.headers" must not include the "authorization" header name',Nt);return t}function qt(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw xt('"options.signal" must return or be an instance of AbortSignal',Pt);return t}}function Qt(e){return e.includes("//")?e.replace("//","/"):e}function $t(e,t,n,o,r){try{if("number"!=typeof e||!Number.isFinite(e))throw xt("".concat(n," must be a number"),Pt,r);if(e>0)return;if(t){if(0!==e)throw xt("".concat(n," must be a non-negative number"),Nt,r);return}throw xt("".concat(n," must be a positive number"),Nt,r)}catch(e){if(o)throw Vt(e.message,o,r);throw e}}function en(e,t,n,o){try{if("string"!=typeof e)throw xt("".concat(t," must be a string"),Pt,o);if(0===e.length)throw xt("".concat(t," must not be empty"),Nt,o)}catch(e){if(n)throw Vt(e.message,n,o);throw e}}function tn(e){!function(e,t){if(Cn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(o.length>2){const e=o.pop();t+="".concat(o.join(", "),", or ").concat(e)}else 2===o.length?t+="".concat(o[0]," or ").concat(o[1]):t+=o[0];return Vt(t,to,e)}(e,t)}(e,"application/json")}function nn(){return Xt(crypto.getRandomValues(new Uint8Array(32)))}function on(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 Jt("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 Jt("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 Jt("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 Jt("unsupported CryptoKey algorithm name",{cause:e})}}function rn(e){const t=null==e?void 0:e[Ut];return"number"==typeof t&&Number.isFinite(t)?t:0}function sn(e){const t=null==e?void 0:e[Mt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function an(){return Math.floor(Date.now()/1e3)}function cn(e){if("object"!=typeof e||null===e)throw xt('"as" must be an object',Pt);en(e.issuer,'"as.issuer"')}function un(e){if("object"!=typeof e||null===e)throw xt('"client" must be an object',Pt);en(e.client_id,'"client.client_id"')}function ln(e){return en(e,'"clientSecret"'),(t,n,o,r)=>{o.set("client_id",n.client_id),o.set("client_secret",e)}}function dn(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&en(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},o=n.key,r=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw xt("".concat(t," must be a CryptoKey"),Pt)}(e,t),"private"!==e.type)throw xt("".concat(t," must be a private CryptoKey"),Nt)}(o,'"clientPrivateKey.key"'),async(e,n,i,s)=>{var a;const c={alg:on(o),kid:r},u=function(e,t){const n=an()+rn(t);return{jti:nn(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===(a=t[jt])||void 0===a||a.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 xt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Nt);const o="".concat(Xt(Bt(JSON.stringify(e))),".").concat(Xt(Bt(JSON.stringify(t)))),r=Xt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:fo(e)};case"RSA-PSS":switch(po(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 Jt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return po(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Jt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Bt(o)));return"".concat(o,".").concat(r)}(c,u,o))}}const hn=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function pn(e,t){if(t&&"https:"!==e.protocol)throw Vt("only requests to HTTPS are allowed",oo,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Vt("only HTTP and HTTPS requests are allowed",ro,e)}function fn(e,t,n,o){let r;if("string"!=typeof e||!(r=hn(e)))throw Vt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?co:uo,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return pn(r,o),r}function mn(e,t,n,o){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?fn(e.mtls_endpoint_aliases[t],t,n,o):fn(e[t],t,n,o)}
5class gn extends Error{constructor(e,t){var n;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"error",void 0),_(this,"status",void 0),_(this,"error_description",void 0),_(this,"response",void 0),this.name=this.constructor.name,this.code=Zn,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 wn extends Error{constructor(e,t){var n,o;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"error",void 0),_(this,"error_description",void 0),this.name=this.constructor.name,this.code=qn,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===(o=Error.captureStackTrace)||void 0===o||o.call(Error,this,this.constructor)}}class yn extends Error{constructor(e,t){var n;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"response",void 0),_(this,"status",void 0),this.name=this.constructor.name,this.code=Vn,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 vn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",bn="("+vn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',An="("+vn+")\\s*=\\s*("+vn+")",Sn=new RegExp("^[,\\s]*("+vn+")"),_n=new RegExp("^[,\\s]*"+bn+"[,\\s]*(.*)"),En=new RegExp("^[,\\s]*"+An+"[,\\s]*(.*)"),Tn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function kn(e,t,n){if(e.status!==t){let t;var o;if(Dn(e),t=await async function(e){if(e.status>399&&e.status<500){ho(e),tn(e);try{const t=await e.clone().json();if(Zt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(o=e.body)||void 0===o?void 0:o.cancel()),new gn("server responded with an error in the response body",{cause:t,response:e});throw Vt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),no,e)}}function On(e){if(!Bn.has(e))throw xt('"options.DPoP" is not a valid DPoPHandle',Nt)}const Rn=Symbol();function Cn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function In(e,t,n,o,r){if(cn(e),un(t),!It(o,Response))throw xt('"response" must be an instance of Response',Pt);if(Dn(o),200!==o.status)throw Vt('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',no,o);let i;if(ho(o),"application/jwt"===Cn(o)){const n=await mo(await o.text(),go.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),rn(t),sn(t),null==r?void 0:r[Wt]).then(jn.bind(void 0,t.client_id)).then(Kn.bind(void 0,e)),s=n.claims,a=n.jwt;Ln.set(o,a),i=s}else{if(t.userinfo_signed_response_alg)throw Vt("JWT UserInfo Response expected",Qn,o);i=await bo(o)}if(en(i.sub,'"response" body "sub" property',eo,{body:i}),n===Rn);else if(en(n,'"expectedSubject"'),i.sub!==n)throw Vt('unexpected "response" body "sub" property value',ao,{expected:n,body:i,attribute:"sub"});return i}async function Nn(e,t,n,o,r,i,s){return await n(e,t,r,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==s?void 0:s[Dt])||fetch)(o.href,{body:r,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:qt(o,null==s?void 0:s.signal)})}async function Pn(e,t,n,o,r,i){var s;const a=mn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Lt]));r.set("grant_type",o);const c=Yt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(On(i.DPoP),await i.DPoP.addProof(a,c,"POST"));const u=await Nn(e,t,n,a,r,c,i);return null==i||null===(s=i.DPoP)||void 0===s||s.cacheNonce(u,a),u}const xn=new WeakMap,Ln=new WeakMap;function Un(e){if(!e.id_token)return;const t=xn.get(e);if(!t)throw xt('"ref" was already garbage collected or did not resolve from the proper sources',Nt);return t}async function Mn(e,t,n,o,r,i){if(cn(e),un(t),!It(n,Response))throw xt('"response" must be an instance of Response',Pt);await kn(n,200,"Token Endpoint"),ho(n);const s=await bo(n);if(en(s.access_token,'"response" body "access_token" property',eo,{body:s}),en(s.token_type,'"response" body "token_type" property',eo,{body:s}),s.token_type=s.token_type.toLowerCase(),void 0!==s.expires_in){let e="number"!=typeof s.expires_in?parseFloat(s.expires_in):s.expires_in;$t(e,!0,'"response" body "expires_in" property',eo,{body:s}),s.expires_in=e}if(void 0!==s.refresh_token&&en(s.refresh_token,'"response" body "refresh_token" property',eo,{body:s}),void 0!==s.scope&&"string"!=typeof s.scope)throw Vt('"response" body "scope" property must be a string',eo,{body:s});if(void 0!==s.id_token){en(s.id_token,'"response" body "id_token" property',eo,{body:s});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&($t(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=o&&o.length&&i.push(...o);const a=await mo(s.id_token,go.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),rn(t),sn(t),r).then(Xn.bind(void 0,i)).then(Gn.bind(void 0,e)).then(Wn.bind(void 0,t.client_id)),c=a.claims,u=a.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw Vt('ID Token "aud" (audience) claim includes additional untrusted audiences',so,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw Vt('unexpected ID Token "azp" (authorized party) claim value',so,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&$t(c.auth_time,!0,'ID Token "auth_time" (authentication time)',eo,{claims:c}),Ln.set(n,u),xn.set(s,c)}if(void 0!==(null==i?void 0:i[s.token_type]))i[s.token_type](n,s);else if("dpop"!==s.token_type&&"bearer"!==s.token_type)throw new Jt("unsupported `token_type` value",{cause:{body:s}});return s}function Dn(e){let t;if(t=function(e){if(!It(e,Response))throw xt('"response" must be an instance of Response',Pt);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let o=t;for(;o;){var r;let t=o.match(Sn);const c=null===(r=t)||void 0===r?void 0:r[1].toLowerCase();if(!c)return;const u=o.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;o=l?l[1]:void 0;const h={};let p;if(d)for(;o;){let n,r;if(t=o.match(_n)){var i=O(t,4);if(n=i[1],r=i[2],o=i[3],r.includes("\\"))try{r=JSON.parse('"'.concat(r,'"'))}catch(e){}h[n.toLowerCase()]=r}else{if(!(t=o.match(En))){if(t=o.match(Tn)){if(Object.keys(h).length)break;var s=O(t,3);p=s[1],o=s[2];break}return}var a=O(t,4);n=a[1],r=a[2],o=a[3],h[n.toLowerCase()]=r}}else o=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 yn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function jn(e,t){return void 0!==t.claims.aud?Wn(e,t):t}function Wn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Vt('unexpected JWT "aud" (audience) claim value',so,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Vt('unexpected JWT "aud" (audience) claim value',so,{expected:e,claims:t.claims,claim:"aud"});return t}function Kn(e,t){return void 0!==t.claims.iss?Gn(e,t):t}function Gn(e,t){var n,o;const r=null!==(n=null===(o=e[So])||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==r)throw Vt('unexpected JWT "iss" (issuer) claim value',so,{expected:r,claims:t.claims,claim:"iss"});return t}const Bn=new WeakSet,Fn=Symbol(),Hn={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 Vt('JWT "'.concat(n,'" (').concat(Hn[n],") claim missing"),eo,{claims:t.claims});return t}const Jn=Symbol(),zn=Symbol();const Vn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Zn="OAUTH_RESPONSE_BODY_ERROR",Yn="OAUTH_UNSUPPORTED_OPERATION",qn="OAUTH_AUTHORIZATION_RESPONSE_E
5RROR",Qn="OAUTH_JWT_USERINFO_EXPECTED",$n="OAUTH_PARSE_ERROR",eo="OAUTH_INVALID_RESPONSE",to="OAUTH_RESPONSE_IS_NOT_JSON",no="OAUTH_RESPONSE_IS_NOT_CONFORM",oo="OAUTH_HTTP_REQUEST_FORBIDDEN",ro="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",io="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",so="OAUTH_JWT_CLAIM_COMPARISON_FAILED",ao="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",co="OAUTH_MISSING_SERVER_METADATA",uo="OAUTH_INVALID_SERVER_METADATA";async function lo(e){if(!It(e,Response))throw xt('"response" must be an instance of Response',Pt);await kn(e,200,"Revocation Endpoint")}function ho(e){if(e.bodyUsed)throw xt('"response" body has been used already',Nt)}function po(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Jt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function fo(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 Jt("unsupported ECDSA namedCurve",{cause:e})}}async function mo(e,t,n,o,r){let i,s,a=e.split("."),c=a[0],u=a[1],l=a.length;if(5===l){if(void 0===r)throw new Jt("JWE decryption is not configured",{cause:e});var d=(e=await r(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw Vt("Invalid JWT",eo,e);try{i=JSON.parse(Bt(Xt(c)))}catch(e){throw Vt("failed to parse JWT Header body as base64url encoded JSON",$n,e)}if(!Zt(i))throw Vt("JWT Header must be a top level object",eo,e);if(t(i),void 0!==i.crit)throw new Jt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{s=JSON.parse(Bt(Xt(u)))}catch(e){throw Vt("failed to parse JWT Payload body as base64url encoded JSON",$n,e)}if(!Zt(s))throw Vt("JWT Payload must be a top level object",eo,e);const h=an()+n;if(void 0!==s.exp){if("number"!=typeof s.exp)throw Vt('unexpected JWT "exp" (expiration time) claim type',eo,{claims:s});if(s.exp<=h-o)throw Vt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',io,{claims:s,now:h,tolerance:o,claim:"exp"})}if(void 0!==s.iat&&"number"!=typeof s.iat)throw Vt('unexpected JWT "iat" (issued at) claim type',eo,{claims:s});if(void 0!==s.iss&&"string"!=typeof s.iss)throw Vt('unexpected JWT "iss" (issuer) claim type',eo,{claims:s});if(void 0!==s.nbf){if("number"!=typeof s.nbf)throw Vt('unexpected JWT "nbf" (not before) claim type',eo,{claims:s});if(s.nbf>h+o)throw Vt('unexpected JWT "nbf" (not before) claim value',io,{claims:s,now:h,tolerance:o,claim:"nbf"})}if(void 0!==s.aud&&"string"!=typeof s.aud&&!Array.isArray(s.aud))throw Vt('unexpected JWT "aud" (audience) claim type',eo,{claims:s});return{header:i,claims:s,jwt:e}}function go(e,t,n,o){if(void 0===e)if(Array.isArray(t)){if(!t.includes(o.alg))throw Vt('unexpected JWT "alg" header parameter',eo,{header:o,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Vt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?o.alg!==n:"function"==typeof n?!n(o.alg):!n.includes(o.alg))throw Vt('unexpected JWT "alg" header parameter',eo,{header:o,expected:n,reason:"default value"})}else if("string"==typeof e?o.alg!==e:!e.includes(o.alg))throw Vt('unexpected JWT "alg" header parameter',eo,{header:o,expected:e,reason:"client configuration"})}function wo(e,t){const n=e.getAll(t),o=n[0];if(n.length>1)throw Vt('"'.concat(t,'" parameter must be provided only once'),eo);return o}const yo=Symbol(),vo=Symbol();async function bo(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tn;try{t=await e.json()}catch(t){throw n(e),Vt('failed to parse "response" body as JSON',$n,t)}if(!Zt(t))throw Vt('"response" body must be a top level object',eo,{body:t});return t}const Ao=Symbol(),So=Symbol(),_o=new TextEncoder,Eo=new TextDecoder,To=new TextDecoder("utf-8",{fatal:!0});function ko(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(o);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}function Oo(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const o=e.charCodeAt(n);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=o}return t}const Ro=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const Co=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if(o.length>2){const t=o.pop();e+="one of type ".concat(o.join(", "),", or ").concat(t,".")}else 2===o.length?e+="one of type ".concat(o[0]," or ").concat(o[1],"."):e+="of type ".concat(o[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}("Key for the ".concat(e," algorithm must be "),t,...o)};
5class Io extends Error{constructor(e,t){var n;super(e,t),_(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}_(Io,"code","ERR_JOSE_GENERIC");class No extends Io{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),_(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),_(this,"claim",void 0),_(this,"reason",void 0),_(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}_(No,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Po extends Io{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),_(this,"code","ERR_JWT_EXPIRED"),_(this,"claim",void 0),_(this,"reason",void 0),_(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}_(Po,"code","ERR_JWT_EXPIRED");class xo extends Io{constructor(){super(...arguments),_(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}_(xo,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Lo extends Io{constructor(){super(...arguments),_(this,"code","ERR_JOSE_NOT_SUPPORTED")}}_(Lo,"code","ERR_JOSE_NOT_SUPPORTED"),_(class extends Io{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),_(class extends Io{constructor(){super(...arguments),_(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Uo extends Io{constructor(){super(...arguments),_(this,"code","ERR_JWS_INVALID")}}_(Uo,"code","ERR_JWS_INVALID");class Mo extends Io{constructor(){super(...arguments),_(this,"code","ERR_JWT_INVALID")}}_(Mo,"code","ERR_JWT_INVALID"),_(class extends Io{constructor(){super(...arguments),_(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Do extends Io{constructor(){super(...arguments),_(this,"code","ERR_JWKS_INVALID")}}_(Do,"code","ERR_JWKS_INVALID");class jo extends Io{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),_(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}_(jo,"code","ERR_JWKS_NO_MATCHING_KEY");class Wo extends Io{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),_(this,Symbol.asyncIterator,R(function*(){})),_(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}_(Wo,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Ko extends Io{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWKS_TIMEOUT")}}_(Ko,"code","ERR_JWKS_TIMEOUT");class Go extends Io{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}_(Go,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Bo=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function Fo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const Ho="The input to be decoded is not correctly encoded.";function Xo(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Eo.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(Ho,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Eo.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(Ho);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Fo(t)}catch(e){throw new TypeError(Ho)}}function Jo(e){let t=e;return"string"==typeof t&&(t=_o.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function zo(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function Vo(e){return zo(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(zo)}
5function Zo(e,t,n){try{return Xo(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function Yo(e,t){var n,o,r,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new Lo('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new Lo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const s=null!==(n=null===(o=e.resolve)||void 0===o?void 0:o.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,a=!(!t.d&&!t.priv),c=T({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,s,null!==(r=t.ext)&&void 0!==r?r:!a,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[a?1:0])}function qo(e){return T({__proto__:null},e)}const Qo=e=>e[Symbol.toStringTag];function $o(e,t,n){const o=e.alg,r=e.secret,i="decrypt"===n||"sign"===n;if(r&&t instanceof Uint8Array)return[er,t];if(zo(t)){const s=function(e){const t=qo(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof s.kty)throw new TypeError(r?Co(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Co(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(r?"oct"===s.kty&&"string"==typeof s.k:"oct"!==s.kty&&(i?"AKP"===s.kty&&"string"==typeof s.priv||"string"==typeof s.d:void 0===s.d&&void 0===s.priv)))throw new TypeError(r?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const o=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"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!==o)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(o,'" when present'));if(Array.isArray(t.key_ops)){var r;const o="encrypt"===n||"decrypt"===n?null===(r=e.ops)||void 0===r?void 0:r["encrypt"===n?0:1]:n;if(o&&!t.key_ops.includes(o))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(o,'" when present'))}})(e,s,n),[or,t,s]}if(!(e=>Bo(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(r?Co(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Co(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(r){if("secret"!==t.type)throw new TypeError("".concat(Qo(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(Qo(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const o="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(Qo(t)," instances for asymmetric algorithm ").concat(o,' must be of type "').concat(e,'"'))}}return Bo(t)?[tr,t]:[nr,t]}const er=0,tr=1,nr=2,or=3;let rr;const ir={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function sr(e,t,n){rr||(rr=new WeakMap);const o=rr.get(e);return n&&(o?o[t]=n:rr.set(e,{[t]:n})),null!=n?n:null==o?void 0:o[t]}const ar=async(e,t,n)=>{var o;return null!==(o=sr(e,n.alg))&&void 0!==o?o:sr(e,n.alg,await Yo(n,T(T({},t),{},{alg:n.alg})))};async function cr(e,t,n){const o=$o(e,t,n);switch(o[0]){case er:case tr:return o[1];case or:{const t=o[1],n=o[2];if("oct"===n.kty)return Xo(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return ar(t,n,e)}case nr:{const t=o[1];
5return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,o,r;const i=sr(e,t.alg);if(i)return i;const s="public"===e.type,a=t.usages[s?0:1],c=e.asymmetricKeyType,u=ir[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],l=null!==(o=null===(r=t.resolve)||void 0===r?void 0:r.call(t,{crv:u,asymmetricKeyType:c}))&&void 0!==o?o:t.subtle;return sr(e,t.alg,e.toCryptoKey(l,s,a))})(t,e):ar(t,t.export({format:"jwk"}),e)}}}function ur(e){const t={__proto__:null};for(const n in e)t[n]=T(T({},e[n]),{},{alg:n});return t}const lr=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],dr=[[],["deriveBits"]],hr=[[],[]];function pr(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:lr,ops:["wrapKey","unwrapKey"]}}function fr(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,o=e.asymmetricKeyType;if("X25519"===n||"x25519"===o)return{name:"X25519"};if("OKP"===t)throw new Lo('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:dr,ops:[void 0,"deriveBits"]}}function mr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:hr,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function gr(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:hr,ops:["deriveBits","deriveBits"]}}const wr=ur({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:hr,ops:["encrypt","decrypt"]},"RSA-OAEP":pr(1),"RSA-OAEP-256":pr(256),"RSA-OAEP-384":pr(384),"RSA-OAEP-512":pr(512),"ECDH-ES":fr(),"ECDH-ES+A128KW":fr(),"ECDH-ES+A192KW":fr(),"ECDH-ES+A256KW":fr(),A128KW:mr(128),A192KW:mr(192),A256KW:mr(256),A128GCMKW:mr(128,!0),A192GCMKW:mr(192,!0),A256GCMKW:mr(256,!0),"PBES2-HS256+A128KW":gr(),"PBES2-HS384+A192KW":gr(),"PBES2-HS512+A256KW":gr()}),yr=["encrypt","decrypt"];function vr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:hr,ops:yr,cekBits:e,ivBits:t?128:96,cbc:t}}ur({A128GCM:vr(128),A192GCM:vr(192),A256GCM:vr(256),"A128CBC-HS256":vr(256,!0),"A192CBC-HS384":vr(384,!0),"A256CBC-HS512":vr(512,!0)});const br={__proto__:null,b64:!0};function Ar(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function Sr(e,t,n,o,r){if(void 0!==r.crit&&void 0===(null==o?void 0:o.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return[];if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:T(T({__proto__:null},n),t);for(const t of o.crit){if(!(t in i))throw new Lo('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(r,t)||void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(o,t)||void 0===o[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return o.crit}function _r(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new Uo('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Er,Tr;let kr,Or;if("undefined"==typeof navigator||null===(Er=navigator.userAgent)||void 0===Er||null===(Tr=Er.startsWith)||void 0===Tr||!Tr.call(Er,"Mozilla/5.0 ")){const e="v6.8.4";Or="".concat("openid-client","/").concat(e),kr={"user-agent":Or}}const Rr=e=>Cr.get(e);let Cr,Ir;function Nr(e){return void 0!==e?ln(e):(Ir||(Ir=new WeakMap),(e,t,n,o)=>{let r;return(r=Ir.get(t))||(function(e,t){if("string"!=typeof e)throw Mr("".concat(t," must be a string"),Ur);if(0===e.length)throw Mr("".concat(t," must not be empty"),Lr)}(t.client_secret,'"metadata.client_secret"'),r=ln(t.client_secret),Ir.set(t,r)),r(e,t,n,o)})}const Pr=Rn,xr=Dt,Lr="ERR_INVALID_ARG_VALUE",Ur="ERR_INVALID_ARG_TYPE";function Mr(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}
5class Dr extends Error{constructor(e,t){var n;super(e,t),_(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 jr(e,t,n){return new Dr(e,{cause:t,code:n})}function Wr(e){if(e instanceof TypeError||e instanceof Dr||e instanceof gn||e instanceof wn||e instanceof yn)throw e;if(e instanceof zt)switch(e.code){case oo:throw jr("only requests to HTTPS are allowed",e,e.code);case ro:throw jr("only requests to HTTP or HTTPS are allowed",e,e.code);case no:throw jr("unexpected HTTP response status code",e.cause,e.code);case to:throw jr("unexpected response content-type",e.cause,e.code);case $n:throw jr("parsing error occured",e,e.code);case eo:throw jr("invalid response encountered",e,e.code);case so:throw jr("unexpected JWT claim value encountered",e,e.code);case ao:throw jr("unexpected JSON attribute value encountered",e,e.code);case io:throw jr("JWT timestamp claim value failed validation",e,e.code);default:throw jr(e.message,e,e.code)}if(e instanceof Jt)throw jr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw jr("runtime operation error",e,Yn);case"NotSupportedError":throw jr("runtime unsupported operation",e,Yn);case"TimeoutError":throw jr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw jr("operation aborted",e,"OAUTH_ABORT")}throw new Dr("something went wrong",{cause:e})}async function Kr(e,t,n,o,r){const i=await async function(e,t){var n,o;if(!(e instanceof URL))throw Mr('"server" must be an instance of URL',Ur);const r=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,s=AbortSignal.timeout(1e3*i),a=await(r?async function(e,t){return async function(e,t,n,o){if(!(e instanceof URL))throw xt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Pt);pn(e,!0!==(null==o?void 0:o[Lt]));const r=n(new URL(e.href)),i=Yt(null==o?void 0:o.headers);return i.set("accept","application/json"),((null==o?void 0:o[Dt])||fetch)(r.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:qt(r,null==o?void 0:o.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Qt("".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=Qt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw xt('"options.algorithm" must be "oidc" (default), or "oauth2"',Nt)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Dt]:null==t?void 0:t[xr],[Lt]:null==t||null===(o=t.execute)||void 0===o?void 0:o.includes(Vr),signal:s,headers:new Headers(kr)}):((null==t?void 0:t[xr])||fetch)((pn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Vr)),e.href),{headers:Object.fromEntries(new Headers(T({accept:"application/json"},kr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:s})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Ao)throw xt('"expectedIssuerIdentifier" must be an instance of URL',Pt);if(!It(t,Response))throw xt('"response" must be an instance of Response',Pt);if(200!==t.status)throw Vt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',no,t);ho(t);const o=await bo(t);if(en(o.issuer,'"response" body "issuer" property',eo,{body:o}),n!==Ao&&new URL(o.issuer).href!==n.href)throw Vt('"response" body "issuer" property does not match the expected value',ao,{expected:n.href,body:o,attribute:"issuer"});return o}(Ao,e)).catch(Wr);var c;return r&&new URL(a.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Gr]=!0,0))}(e,a,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new Dr("discovered metadata issuer does not match the expected issuer",{code:ao,cause:{expected:e.href,body:a,attribute:"issuer"}})})()),a}(e,r),s=new Br(i,t,n,o);let a=Rr(s);if(null!=r&&r[xr]&&(a.fetch=r[xr]),null!=r&&r.timeout&&(a.timeout=r.timeout),null!=r&&r.execute)for(const e of r.execute)e(s);return s}new TextDecoder;const Gr=Symbol();class Br{constructor(e,t,n,o){var r,i,s,a,c;if("string"!=typeof t||!t.length)throw Mr('"clientId" must be a non-empty string',Ur);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(r=n)||void 0===r?void 0:r.client_id)&&t!==n.client_id)throw Mr('"clientId" and "metadata.client_id" must be the same',Lr);const u=T(T({},structuredClone(n)),{},{client_id:t});let l;u[Ut]=null!==(i=null===(s=n)||void 0===s?void 0:s[Ut])&&void 0!==i?i:0,u[Mt]=null!==(a=null===(c=n)||void 0===c?void 0:c[Mt])&&void 0!==a?a:30,l=o||("string"==typeof u.client_secret&&u.client_secret.length?Nr(u.client_secret):(e,t,n,o)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);Gr in e&&(h[So]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Cr||(Cr=new WeakMap),Cr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Rr(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(Rr(this).c)}get timeout(){return Rr(this).timeout}set timeout(e){Rr(this).timeout=e}get[xr](){return Rr(this).fetch}set[xr](e){Rr(this).fetch=e}}function Fr(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()}
5return{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 Un(this)}catch(e){return}}}}}(e))}async function Hr(e,t,n){var o;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(o=e.headers.get("retry-after"))||void 0===o?void 0:o.trim();if(void 0===i)return;let s;if(/^\d+$/.test(i))s=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&&(s=Math.ceil(n/1e3))}}if(r&&!Number.isFinite(s))throw new zt("invalid Retry-After header value",{cause:e});s>t&&await Xr(s-t,n)}function Xr(e,t){return new Promise((n,o)=>{const r=e=>{try{t.throwIfAborted()}catch(e){return void o(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>r(e-i),1e3*i)};r(e)})}async function Jr(e,t){ei(e);const n=Rr(e),o=n.as,r=n.c,i=n.auth,s=n.fetch,a=n.tlsOnly,c=n.timeout;return async function(e,t,n,o,r){cn(e),un(t);const i=mn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Lt])),s=new URLSearchParams(o);s.set("client_id",t.client_id);const a=Yt(null==r?void 0:r.headers);return a.set("accept","application/json"),Nn(e,t,n,i,s,a,r)}(o,r,i,t,{[Dt]:s,[Lt]:!a,headers:new Headers(kr),signal:ti(c)}).then(e=>async function(e,t,n){if(cn(e),un(t),!It(n,Response))throw xt('"response" must be an instance of Response',Pt);await kn(n,200,"Backchannel Authentication Endpoint"),ho(n);const o=await bo(n);en(o.auth_req_id,'"response" body "auth_req_id" property',eo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return $t(r,!0,'"response" body "expires_in" property',eo,{body:o}),o.expires_in=r,void 0!==o.interval&&$t(o.interval,!1,'"response" body "interval" property',eo,{body:o}),o}(o,r,e)).catch(Wr)}async function zr(e,t,n,o){var r,i;ei(e),n=new URLSearchParams(n);let s=null!==(r=t.interval)&&void 0!==r?r:5;const a=null!==(i=null==o?void 0:o.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Xr(s,a)}catch(e){Wr(e)}const c=Rr(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,w=(r,i)=>zr(e,T(T({},t),{},{interval:r}),n,T(T({},o),{},{signal:a,flag:i})),y=function(e,t){const n=ti(t);if(!n)return{signal:e,cleanup(){}};const o=new AbortController,r=e=>{const t=e.target;o.abort(t.reason)};return e.aborted?o.abort(e.reason):n.aborted?o.abort(n.reason):(e.addEventListener("abort",r,{once:!0}),n.addEventListener("abort",r,{once:!0})),{signal:o.signal,cleanup(){e.removeEventListener("abort",r),n.removeEventListener("abort",r)}}}(a,m),v=await async function(e,t,n,o,r){cn(e),un(t),en(o,'"authReqId"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("auth_req_id",o),Pn(e,t,n,"urn:openid:params:grant-type:ciba",i,r)}(u,l,d,t.auth_req_id,{[Dt]:h,[Lt]:!p,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(kr),signal:y.signal}).catch(Wr).finally(y.cleanup);var b;if(503===v.status&&v.headers.has("retry-after"))return await Hr(v,s,a,!0),await(null===(b=v.body)||void 0===b?void 0:b.cancel()),w(s);const A=async function(e,t,n,o){return Mn(e,t,n,void 0,null==o?void 0:o[Wt],null==o?void 0:o.recognizedTokenTypes)}(u,l,v,{[Wt]:g});let S;try{S=await A}catch(e){if(oi(e,o))return w(s,ri);if(e instanceof gn)switch(e.error){case"slow_down":s+=5;case"authorization_pending":return await Hr(e.response,s,a),w(s)}Wr(e)}return S.id_token&&await(null==f?void 0:f(v)),Fr(S),S}function Vr(e){Rr(e).tlsOnly=!1}async function Zr(e,t,n,o,r){if(ei(e),!((null==r?void 0:r.flag)===ri||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Mr('"currentUrl" must be an instance of URL, or Request',Ur);let i,s;const a=Rr(e),c=a.as,u=a.c,l=a.auth,d=a.fetch,h=a.tlsOnly,p=a.jarm,f=a.hybrid,m=a.nonRepudiation,g=a.timeout,w=a.decrypt,y=a.implicit;if((null==r?void 0:r.flag)===ri)i=r.authResponse,s=r.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 xt("form_post responses are expected to use the POST method",Nt,{cause:e});if("application/x-www-form-urlencoded"!==Cn(e))throw xt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Nt,{cause:e});return async function(e){if(e.bodyUsed)throw xt("form_post Request instances must contain a readable body",Nt,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var v=O(e,2);const n=v[0],o=v[1];t.searchParams.append(n,o)}break;default:throw Mr("unexpected Request HTTP method",Lr)}}
5switch(s=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!!y:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,o){if(cn(e),un(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw xt('"parameters" must be an instance of URLSearchParams, or URL',Pt);if(wo(n,"response"))throw Vt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',eo,{parameters:n});const r=wo(n,"iss"),i=wo(n,"state");if(!r&&e.authorization_response_iss_parameter_supported)throw Vt('response parameter "iss" (issuer) missing',eo,{parameters:n});if(r&&r!==e.issuer)throw Vt('unexpected "iss" (issuer) response parameter value',eo,{expected:e.issuer,parameters:n});switch(o){case void 0:case vo:if(void 0!==i)throw Vt('unexpected "state" response parameter encountered',eo,{expected:void 0,parameters:n});break;case yo:break;default:if(en(o,'"expectedState" argument'),i!==o)throw Vt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',eo,{expected:o,parameters:n})}if(wo(n,"error"))throw new wn("authorization response from the server is an error",{cause:n});const s=wo(n,"id_token"),a=wo(n,"token");if(void 0!==s||void 0!==a)throw new Jt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Bn.add(c),c;var c}(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Wr(e)}}}const b=await async function(e,t,n,o,r,i,s){if(cn(e),un(t),!Bn.has(o))throw xt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Nt);en(r,'"redirectUri"');const a=wo(o,"code");if(!a)throw Vt('no authorization code in "callbackParameters"',eo);const c=new URLSearchParams(null==s?void 0:s.additionalParameters);return c.set("redirect_uri",r),c.set("code",a),i!==Fn&&(en(i,'"codeVerifier"'),c.set("code_verifier",i)),Pn(e,t,n,"authorization_code",c,s)}(c,u,l,i,s,(null==n?void 0:n.pkceCodeVerifier)||Fn,{additionalParameters:o,[Dt]:d,[Lt]:!h,DPoP:null==r?void 0:r.DPoP,headers:new Headers(kr),signal:ti(g)}).catch(Wr);"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,o){return"string"==typeof(null==o?void 0:o.expectedNonce)||"number"==typeof(null==o?void 0:o.maxAge)||null!=o&&o.requireIdToken?async function(e,t,n,o,r,i,s){const a=[];switch(o){case void 0:o=Jn;break;case Jn:break;default:en(o,'"expectedNonce" argument'),a.push("nonce")}switch(null!=r||(r=t.default_max_age),r){case void 0:r=zn;break;case zn:break;default:$t(r,!0,'"maxAge" argument'),a.push("auth_time")}const c=await Mn(e,t,n,a,i,s);en(c.id_token,'"response" body "id_token" property',eo,{body:c});const u=Un(c);if(r!==zn){const e=an()+rn(t),n=sn(t);if(u.auth_time+r<e-n)throw Vt("too much time has elapsed since the last End-User authentication",io,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(o===Jn){if(void 0!==u.nonce)throw Vt('unexpected ID Token "nonce" claim value',so,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==o)throw Vt('unexpected ID Token "nonce" claim value',so,{expected:o,claims:u,claim:"nonce"});return c}(e,t,n,o.expectedNonce,o.maxAge,o[Wt],o.recognizedTokenTypes):async function(e,t,n,o,r){const i=await Mn(e,t,n,void 0,o,r),s=Un(i);if(s){if(void 0!==t.default_max_age){$t(t.default_max_age,!0,'"client.default_max_age"');const e=an()+rn(t),n=sn(t);if(s.auth_time+t.default_max_age<e-n)throw Vt("too much time has elapsed since the last End-User authentication",io,{claims:s,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==s.nonce)throw Vt('unexpected ID Token "nonce" claim value',so,{expected:void 0,claims:s,claim:"nonce"})}return i}(e,t,n,null==o?void 0:o[Wt],null==o?void 0:o.recognizedTokenTypes)}(c,u,b,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[Wt]:w});let S;try{S=await A}catch(t){if(oi(t,r))return Zr(e,void 0,n,o,T(T({},r),{},{flag:ri,authResponse:i,redirectUri:s}));Wr(t)}return S.id_token&&await(null==m?void 0:m(b)),Fr(S),S}async function Yr(e,t,n,o){ei(e),n=new URLSearchParams(n);const r=Rr(e),i=r.as,s=r.c,a=r.auth,c=r.fetch,u=r.tlsOnly,l=r.nonRepudiation,d=r.timeout,h=r.decrypt,p=await async function(e,t,n,o,r){cn(e),un(t),en(o,'"refreshToken"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("refresh_token",o),Pn(e,t,n,"refresh_token",i,r)}(i,s,a,t,{[Dt]:c,[Lt]:!u,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(kr),signal:ti(d)}).catch(Wr),f=async function(e,t,n,o){return Mn(e,t,n,void 0,null==o?void 0:o[Wt],null==o?void 0:o.recognizedTokenTypes)}(i,s,p,{[Wt]:h});let m;try{m=await f}catch(r){if(oi(r,o))return Yr(e,t,n,T(T({},o),{},{flag:ri}));Wr(r)}return m.id_token&&await(null==l?void 0:l(p)),Fr(m),m}async function qr(e,t,n){ei(e),t=new URLSearchParams(t);const o=Rr(e),r=o.as,i=o.c,s=o.auth,a=o.fetch,c=o.tlsOnly,u=o.timeout,l=await async function(e,t,n,o,r){return cn(e),un(t),Pn(e,t,n,"client_credentials",new URLSearchParams(o),r)}(r,i,s,t,{[Dt]:a,[Lt]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(kr),signal:ti(u)}).catch(Wr),d=async function(e,t,n){return Mn(e,t,n,void 0,void 0,void 0)}(r,i,l);let h;try{h=await d}catch(o){if(oi(o,n))return qr(e,t,T(T({},n),{},{flag:ri}));Wr(o)}return Fr(h),h}function Qr(e,t){ei(e);const n=Rr(e),o=n.as,r=n.c,i=n.tlsOnly,s=n.hybrid,a=n.jarm,c=n.implicit,u=mn(o,"authorization_endpoint",!1,i);if((t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",s?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw Mr("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",Lr);a&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=O(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function $r(e,t,n){ei(e);const o=Qr(e,t),r=Rr(e),i=r.as,s=r.c,a=r.auth,c=r.fetch,u=r.tlsOnly,l=r.timeout,d=await async function(e,t,n,o,r){var i;cn(e),un(t);const s=mn(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Lt])),a=new URLSearchParams(o);a.set("client_id",t.client_id);const c=Yt(null==r?void 0:r.headers);c.set("accept","application/json"),void 0!==(null==r?void 0:r.DPoP)&&(On(r.DPoP),await r.DPoP.addProof(s,c,"POST"));const u=await Nn(e,t,n,s,a,c,r);return null==r||null===(i=r.DPoP)||void 0===i||i.cacheNonce(u,s),u}(i,s,a,o.searchParams,{[Dt]:c,[Lt]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers(kr),signal:ti(l)}).catch(Wr),h=async function(e,t,n){if(cn(e),un(t),!It(n,Response))throw xt('"response" must be an instance of Response',Pt);await kn(n,201,"Pushed Authorization Request Endpoint"),ho(n);const o=await bo(n);en(o.request_uri,'"response" body "request_uri" property',eo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return $t(r,!0,'"response" body "expires_in" property',eo,{body:o}),o.expires_in=r,o}(i,s,d);let p;try{p=await h}catch(o){if(oi(o,n))return $r(e,t,T(T({},n),{},{flag:ri}));Wr(o)}return Qr(e,{request_uri:p.request_uri})}function ei(e){if(!(e instanceof Br))throw Mr('"config" must be an instance of Configuration',Ur);if(Object.getPrototypeOf(e)!==Br.prototype)throw Mr("subclassing Configuration is not allowed",Lr)}function ti(e){return e?AbortSignal.timeout(1e3*e):void 0}async function ni(e,t,n,o){ei(e);const r=Rr(e),i=r.as,s=r.c,a=r.fetch,c=r.tlsOnly,u=r.nonRepudiation,l=r.timeout,d=r.decrypt,h=await async function(e,t,n,o){cn(e),un(t);const r=mn(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Lt])),i=Yt(null==o?void 0:o.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,o,r,i){var s;if(en(e,'"accessToken"'),!(n instanceof URL))throw xt('"url" must be an instance of URL',Pt);pn(n,!0!==(null==i?void 0:i[Lt])),o=Yt(o),null!=i&&i.DPoP&&(On(i.DPoP),await i.DPoP.addProof(n,o,"GET".toUpperCase(),e)),o.set("authorization","".concat(o.has("dpop")?"DPoP":"Bearer"," ").concat(e));const a=await((null==i?void 0:i[Dt])||fetch)(n.href,{duplex:It(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(o.entries()),method:"GET",redirect:"manual",signal:qt(n,null==i?void 0:i.signal)}
5);return null==i||null===(s=i.DPoP)||void 0===s||s.cacheNonce(a,n),a}(n,0,r,i,0,T(T({},o),{},{[Ut]:rn(t)}))}(i,s,t,{[Dt]:a,[Lt]:!c,DPoP:null==o?void 0:o.DPoP,headers:new Headers(kr),signal:ti(l)}).catch(Wr);let p,f=In(i,s,n,h,{[Wt]:d});try{p=await f}catch(r){if(oi(r,o))return ni(e,t,n,T(T({},o),{},{flag:ri}));Wr(r)}return"application/jwt"===Cn(h)&&await(null==u?void 0:u(h)),p}function oi(e,t){return!(null==t||!t.DPoP||t.flag===ri)&&function(e){if(e instanceof yn){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof gn&&"use_dpop_nonce"===e.error}(e)}Object.freeze(Br.prototype);const ri=Symbol();async function ii(e,t,n,o){ei(e);const r=Rr(e),i=r.as,s=r.c,a=r.auth,c=r.fetch,u=r.tlsOnly,l=r.timeout,d=r.decrypt,h=r.nonRepudiation,p=await async function(e,t,n,o,r,i){return cn(e),un(t),en(o,'"grantType"'),Pn(e,t,n,o,new URLSearchParams(r),i)}(i,s,a,t,new URLSearchParams(n),{[Dt]:c,[Lt]:!u,DPoP:null==o?void 0:o.DPoP,headers:new Headers(kr),signal:ti(l)}).catch(Wr);let f;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(f={n_a:()=>{}});const m=async function(e,t,n,o){return Mn(e,t,n,void 0,null==o?void 0:o[Wt],null==o?void 0:o.recognizedTokenTypes)}(i,s,p,{[Wt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(r){if(oi(r,o))return ii(e,t,n,T(T({},o),{},{flag:ri}));Wr(r)}return g.id_token&&await(null==h?void 0:h(p)),Fr(g),g}async function si(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var o;const r=e.algorithm;if(r.name!==t.name)throw Ro(t.name);if(t.hash&&(null===(o=r.hash)||void 0===o?void 0:o.name)!==t.hash)throw Ro(t.hash,"algorithm.hash");if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw Ro(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&r.length!==t.length)throw Ro(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){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.alg,t),t)}const ai=[["verify"],["sign"]];function ci(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:ai}}function ui(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?T(T({},n),{},{saltLength:t}):n,usages:ai,minRsaBits:2048}}function li(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:ai}}function di(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:ai}}function hi(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:ai}}const pi=ur({HS256:ci(256),HS384:ci(384),HS512:ci(512),RS256:ui(256),RS384:ui(384),RS512:ui(512),PS256:ui(256,32),PS384:ui(384,48),PS512:ui(512,64),ES256:li("P-256",256),ES384:li("P-384",384),ES512:li("P-521",512),EdDSA:di(),Ed25519:di(),"ML-DSA-44":hi(44),"ML-DSA-65":hi(65),"ML-DSA-87":hi(87)});function fi(e){const t="string"==typeof e?pi[e]:void 0;if(!t)throw new Lo("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function mi(e,t,n){if(e instanceof Uint8Array&&(e=Eo.decode(e)),"string"!=typeof e)throw new Uo("Compact JWS must be a string or Uint8Array");const o=e.split("."),r=o[0],i=o[1],s=o[2];if(3!==o.length)throw new Uo("Invalid Compact JWS");const a={payload:i,protected:r,signature:s},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let o;try{o=JSON.parse(To.decode(Xo(e)))}catch(e){throw new t(n)}if(!zo(o))throw new t(n);return o}(e,Uo,"JWS Protected Header is invalid");return t}(r),u=function(e,t,n){const o=_r(e,Sr(Uo,br,n[1],e,t)),r=t.alg;if("string"!=typeof r||!r)throw new Uo('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(r))throw new xo('"alg" (Algorithm) Header Parameter value not allowed');return[o,r]}(c,c,t),l=O(u,2),d=l[0],h=l[1],p=d?i:function(e){try{return Oo(e)}catch(e){throw new Uo("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,o,r,i,s){var a;let c=!1;"function"==typeof n&&(n=await n(r,e),c=!0);const u="string"==typeof s,l=fi(i),d=ko(void 0!==o?Oo(o):new Uint8Array,Oo("."),u?null!==(a=t[2])&&void 0!==a?a:t[2]=function(e,t,n){try{return Oo(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(s,0,Uo):s),h=Zo(e.signature,"signature",Uo),p=await cr(l,n,"verify");if(!await async function(e,t,n,o){const r=await si(e,t,"verify");try{return await crypto.subtle.verify(e.signing,r,n,o)}catch(e){return!1}}(l,p,h,d))throw new Go;return[u?Zo(s,"payload",Uo):s,r,u,p,c]}(a,t,n,r,c,h,p)}const gi=e=>Math.floor(e.getTime()/1e3),wi={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},yi=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,vi="check_failed";function bi(){throw new TypeError("Invalid time period format")}function Ai(e){"string"!=typeof e&&bi();const t=yi.exec(e);(!t||t[4]&&t[1])&&bi();const n=parseFloat(t[2]),o=Math.round(n*wi[t[3][0].toLowerCase()]);return Number.isFinite(o)||bi(),"-"===t[1]||"ago"===t[4]?-o:o}function Si(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function _i(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Ei(e,t){return"number"==typeof e?Si(t,e):e instanceof Date?Si(t,gi(e)):gi(new Date)+Ai(e)}const Ti=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function ki(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=e[t];if(void 0!==o||n){if("number"!=typeof o)throw new No('"'.concat(t,'" claim must be a number'),e,t,"invali
5d");return o}}function Oi(e,t){throw new No('unexpected "'.concat(t,'" claim value'),e,t,vi)}function Ri(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(To.decode(t))}catch(e){}if(!zo(n))throw new Mo("JWT Claims Set must be a top-level JSON object");const r=o.typ;if(void 0!==r&&("string"!=typeof e.typ||Ti(e.typ)!==Ti(r)))throw new No('unexpected "typ" JWT header value',n,"typ",vi);const i=o.requiredClaims,s=void 0===i?[]:i,a=o.issuer,c=o.subject,u=o.audience,l=o.maxTokenAge,d=[...s];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==a&&d.push("iss");for(const e of new Set(d.reverse()))if(!Object.hasOwn(n,e))throw new No('missing required "'.concat(e,'" claim'),n,e,"missing");var h,p;void 0===a||(Array.isArray(a)?a:[a]).includes(n.iss)||Oi(n,"iss"),void 0!==c&&n.sub!==c&&Oi(n,"sub"),void 0===u||(p="string"==typeof u?[u]:u,"string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(e=>h.includes(e)))||Oi(n,"aud");const f=o.clockTolerance;let m=0;if("string"==typeof f)m=Ai(f);else if(void 0!==f){if("number"!=typeof f)throw new TypeError("Invalid clockTolerance option type");m=f}Si("clockTolerance option",m);const g=o.currentDate,w=Si("currentDate option",gi(void 0===g?new Date:g)),y=ki(n,"iat",void 0!==l),v=ki(n,"nbf");if(void 0!==v&&v>w+m)throw new No('"nbf" claim timestamp check failed',n,"nbf",vi);const b=ki(n,"exp");if(void 0!==b&&b<=w-m)throw new Po('"exp" claim timestamp check failed',n,"exp",vi);if(void 0!==l){const e=w-y;if(e-m>Si("maxTokenAge option","number"==typeof l?l:Ai(l)))throw new Po('"iat" claim timestamp check failed (too far in the past)',n,"iat",vi);if(e<-m)throw new No('"iat" claim timestamp check failed (it should be in the past)',n,"iat",vi)}return n}let Ci;function Ii(e){return Ci.get(e)}async function Ni(e,t,n,o,r){const i=O(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,o;try{n=JSON.stringify(t),o=JSON.parse(n)}catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!zo(o))throw new e("JOSE Header is not a JSON object");return[o,n]}(Uo,e);return[t[0],Jo(t[1])]}(t),2),s=i[0],a=i[1];if(!s)throw new Uo("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}(Uo,e),_r(e,Sr(Uo,br,n,e,t))})(s,s,n)||r();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new Uo('JWS "alg" (Algorithm) Header Parameter missing or invalid');return fi(t)}(s),u=Jo(e),l=await async function(e,t,n,o){const r=ko(Oo(e),Oo("."),t),i=await cr(n,o,"sign");return Jo(await async function(e,t,n){const o=await si(e,t,"sign"),r=await crypto.subtle.sign(e.signing,o,n);return new Uint8Array(r)}(n,i,r))}(a,Oo(u),c,o);return"".concat(a,".").concat(u,".").concat(l)}const Pi=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!zo(e))throw new TypeError("JWT Claims Set MUST be an object");(Ci||(Ci=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return _i("iss",e),Ii(this).iss=e,this}setSubject(e){return _i("sub",e),Ii(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of strings')}(e),Ii(this).aud=e,this}setJti(e){return _i("jti",e),Ii(this).jti=e,this}setNotBefore(e){return Ii(this).nbf=Ei(e,"setNotBefore"),this}setExpirationTime(e){return Ii(this).exp=Ei(e,"setExpirationTime"),this}setIssuedAt(e){return Ii(this).iat=void 0===e?gi(new Date):"string"==typeof e?Si("setIssuedAt",gi(new Date)+Ai(e)):Ei(e,"setIssuedAt"),this}};var xi=new WeakMap;class Li extends Pi{constructor(){super(...arguments),b(this,xi,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(v(xi,this)),A(xi,this,e),this}async sign(e,t){return Ni(function(e){const t=Ii(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return _o.encode(JSON.stringify(t))}(this),v(xi,this),null==t?void 0:t.crit,e,()=>{throw new Mo("JWTs MUST NOT use unencoded payload")})}}const Ui='"alg" (Algorithm)';function Mi(){throw new Lo("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const Di=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},ji=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},Wi=e=>{const t=ji(e);if(128&t){const n=127&t;let o=0;for(let t=0;t<n;t++)o=o<<8|ji(e);return o}return t},Ki=(e,t,n)=>{if(ji(e)!==t)throw new Error(n)},Gi=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Bi=e=>{const t=(e=>{Ki(e,6,"Expected algorithm OID");const t=Wi(e);return Gi(e,t)})(e);if(Di(t,[43,101,110]))return"X25519";if(!Di(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Ki(e,6,"Expected curve OID");const n=Wi(e),o=Gi(e,n);if(Di(o,[42,134,72,206,61,3,1,7]))return"P-256";if(Di(o,[43,129,4,0,34]))return"P-384";if(Di(o,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},Fi=(e,t,n)=>{const o=(e=>
5Fo(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,o)=>{const r=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==o?void 0:o.extractable),i=function(e,t){var n,o;return null!==(n="string"==typeof e?null!==(o=pi[e])&&void 0!==o?o:wr[e]:void 0)&&void 0!==n?n:Mi(t)}(n,Ui);i.secret&&Mi(Ui);const s="spki"===e;let a;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(Ki(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),Wi(e),"pkcs8"===t){Ki(e,2,"Expected version field");const t=Wi(e);e.pos+=t}Ki(e,48,"Expected algorithm identifier"),Wi(e)}(n,e),a=i.resolve({crv:Bi(n)})}catch(e){throw new Lo("Invalid or unsupported key format")}else a=i.subtle;return crypto.subtle.importKey(e,t,a,null!=r?r:s,i.usages[s?0:1])})("pkcs8",o,t,n)};async function Hi(e,t,n){const o=e.get(t)||e.set(t,{}).get(t),r=n.alg;if(void 0===o[r]){const e=await Yo(n,T(T({},t),{},{alg:r,ext:!0}));if("public"!==e.type)throw new Do("JSON Web Key Set members must be public keys");o[r]=e}return o[r]}function Xi(e){let t;try{t=structuredClone(e)}catch(e){}if(!Vo(t))throw new Do("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,o)=>{const r=T(T({},e),null==o?void 0:o.header),i=r.alg,s=r.kid,a="string"==typeof i?pi[i]:void 0;if(!a||a.secret)throw new Lo('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,o){const r=qo(e),i=r.kty,s=r.key_ops,a=r.ext,c=r.kid,u=r.alg,l=r.use,d=r.crv,h=Array.isArray(s)?[...s]:s;return(void 0===a||"boolean"==typeof a)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===o||"string"==typeof o&&o===c)&&(void 0===u?"AKP"!==i:n===u)&&(void 0===l||"sig"===l)&&(!t.crv||d===t.crv)}(e,a,i,s)),u=c[0],l=c.length;if(!l)throw new jo;if(1!==l){const e=new Wo;throw e[Symbol.asyncIterator]=R(function*(){for(const e of c)try{yield yield w(Hi(n,e,a))}catch(e){}}),e}return Hi(n,u,a)},"jwks",{value:()=>structuredClone(t)})}var Ji,zi;let Vi;if("undefined"==typeof navigator||null===(Ji=navigator.userAgent)||void 0===Ji||null===(zi=Ji.startsWith)||void 0===zi||!zi.call(Ji,"Mozilla/5.0 ")){const e="v6.2.10";Vi="".concat("jose","/").concat(e)}const Zi=Symbol(),Yi=Symbol();function qi(e,t){return Number.isFinite(e)&&Date.now()<e+t}function Qi(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function $i(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Fi(e,t,n)}const es=["mfaToken"],ts=["mfaToken"];var ns,os,rs,is,ss,as,cs,us,ls,ds,hs,ps,fs,ms,gs,ws,ys,vs,bs,As,Ss,_s,Es,Ts,ks,Os,Rs,Cs,Is,Ns,Ps,xs,Ls,Us,Ms,Ds,js,Ws,Ks,Gs,Bs,Fs,Hs,Xs,Js,zs,Vs,Zs,Ys,qs,Qs,$s;function ea(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function ta(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const o=e;let r;if(o.response instanceof Response)try{r=new Headers(o.response.headers),r.delete("set-cookie")}catch(e){r=void 0}const i={error:null!==(t=o.error)&&void 0!==t?t:"",error_description:null!==(n=o.error_description)&&void 0!==n?n:"",message:o.message,statusCode:"number"==typeof o.status?o.status:void 0,headers:r};if("mfa_required"===o.error&&o.cause){i.mfa_token="string"==typeof o.cause.mfa_token?o.cause.mfa_token:void 0;const e=o.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var na=class extends Error{constructor(e,t){super(t),_(this,"code",void 0),this.name="NotSupportedError",this.code=e}},oa=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const o=ea(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},ra=class extends oa{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ia=class extends oa{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},sa=class extends oa{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},aa=class extends oa{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},ca=class extends oa{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ua=class extends oa{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},la=class extends oa{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},da=class extends oa{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}}
5,ha=class extends Error{constructor(e){super(e),_(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},pa=class extends oa{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),_(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},fa=class extends oa{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ma=class extends oa{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ga=class extends oa{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},wa=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),_(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}},ya=class extends Error{constructor(e){super(e),_(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},va=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),_(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function ba(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function Aa(e,t,n){var o;const r="object"==typeof t&&null!==t?t:void 0,i=null!==(o=null==r?void 0:r.response)&&void 0!==o?o:n,s="number"==typeof(null==r?void 0:r.status)?r.status:null==i?void 0:i.status;"number"==typeof s&&(e.statusCode=s),null!=i&&i.headers&&(e.headers=ba(i.headers))}function Sa(e){return Object.entries(e).filter(e=>void 0!==O(e,2)[1]).reduce((e,t)=>T(T({},e),{},{[t[0]]:t[1]}),{})}function _a(e){if(!e.trim())throw new ya("organization must not be blank")}function Ea(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new ya("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new ya('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new ya("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new ya('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var Ta=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=ea(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},ka=class extends Ta{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Oa=class extends Ta{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Ra=class extends Ta{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ca=class extends Ta{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},Ia=class extends Ta{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function Na(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Pa=class e{constructor(e,t,n,o,r,i,s){_(this,"accessToken",void 0),_(this,"idToken",void 0),_(this,"refreshToken",void 0),_(this,"expiresAt",void 0),_(this,"scope",void 0),_(this,"claims",void 0),_(this,"authorizationDetails",void 0),_(this,"tokenType",void 0),_(this,"issuedTokenType",void 0),_(this,"recoveryCode",void 0),_(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=o,this.expiresAt=t,this.scope=r,this.claims=i,this.authorizationDetail
5s=s}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,o=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 o.tokenType=t.token_type,o.issuedTokenType=t.issued_token_type,o}};function xa(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},o=btoa(JSON.stringify(n));return async(t,n)=>{const r=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{r.set(t,e)}),r.set("Auth0-Client",o),e(t,T(T({},n),{},{headers:r}))}}function La(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function Ua(e){let t;const n=async(n,o)=>{const r=await e(n,o);return t=r.clone(),r};return n.getCapturedResponse=()=>t,n}function Ma(e,t,n){if(!t)return e;const o=t.signal,r=t.headers,i=t.customFetch,s=i?xa(i,n):e;return o||r?async(e,t)=>{const n=r?new Headers(e instanceof Request?e.headers:void 0):void 0;if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),r)for(const e of Object.entries(r)){var i=O(e,2);const t=i[0],o=i[1],r=t.toLowerCase();"authorization"!==r&&"auth0-client"!==r&&n.set(t,o)}const a=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,o=[e,t],r=o.find(e=>e.aborted);if(r)return n.abort(r.reason),{signal:n.signal};const i=[],s=()=>{o.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return o.forEach((e,t)=>{const o=()=>{s(),n.abort(e.reason)};i[t]=o,e.addEventListener("abort",o,{once:!0})}),{signal:n.signal,cleanup:s}}(o,null==t?void 0:t.signal);try{return await s(e,T(T(T({},t),n&&{headers:n}),{},{signal:a.signal}))}finally{var c;null===(c=a.cleanup)||void 0===c||c.call(a)}}:s}var Da={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
5overy-code"},ja=(ns=new WeakMap,os=new WeakMap,rs=new WeakMap,is=new WeakMap,ss=new WeakMap,as=new WeakMap,cs=new WeakMap,us=new WeakSet,class{constructor(e){var t,n;S(this,us),b(this,ns,void 0),b(this,os,void 0),b(this,rs,void 0),b(this,is,void 0),b(this,ss,void 0),b(this,as,void 0),b(this,cs,void 0),A(ns,this,"https://".concat(e.domain)),A(os,this,e.clientId),A(rs,this,e.clientSecret),A(is,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(ss,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:La()),A(as,this,e.getConfiguration),A(cs,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(v(ns,this),"/mfa/authenticators"),o=e.mfaToken,r=await g(us,this,Wa).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!r.ok){const e=await r.clone().text(),t=r.status,n=ba(r.headers);let i;try{i=JSON.parse(e)}catch(o){throw new ka("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new ka(i.error_description||"Failed to list authenticators",T(T({},i),{},{statusCode:t,headers:n,body:e}))}return(await r.json()).map(Na)}async enrollAuthenticator(e,t){const n="".concat(v(ns,this),"/mfa/associate"),o=e.mfaToken,r=k(e,es),i={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(i.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(i.phone_number=r.phoneNumber),"email"in r&&r.email&&(i.email=r.email);const s=await g(us,this,Wa).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const e=await s.clone().text(),t=s.status,n=ba(s.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Oa("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new Oa(r.error_description||"Failed to enroll authenticator",T(T({},r),{},{statusCode:t,headers:n,body: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 s.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,o=e.mfaToken,r="".concat(v(ns,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await g(us,this,Wa).call(this,t)(r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=ba(i.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Ra("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new Ra(r.error_description||"Failed to delete authenticator",T(T({},r),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(v(ns,this),"/mfa/challenge"),o=e.mfaToken,r=k(e,ts),i={mfa_token:o,client_id:v(os,this),challenge_type:r.challengeType};v(rs,this)&&(i.client_secret=v(rs,this)),r.authenticatorId&&(i.authenticator_id=r.authenticatorId);const s=await g(us,this,Wa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok){const e=await s.clone().text(),t=s.status,n=ba(s.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Ca("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new Ca(r.error_description||"Failed to challenge authenticator",T(T({},r),{},{statusCode:t,headers:n,body: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 s.json())}async verify(e,t){if(!v(as,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var o;if(!v(cs,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const a=Ua(null!==(o=(await v(as,this).call(this,t))[xr])&&void 0!==o?o:fetch),c=await v(cs,this).call(this,a);try{const t=await ii(c,Da[e.factorType],n),o=Pa.fromTokenEndpointResponse(t);
5t.recovery_code&&(o.recoveryCode=t.recovery_code);const r=a.getCapturedResponse();if(!r)throw new va;return{data:o,response:r}}catch(e){var r,i,s;if(e instanceof va)throw e;if(e instanceof Ia)throw e;const t=e,n=new Ia(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(r=t.error)&&void 0!==r?r:"mfa_verify_error",error_description:null!==(i=null!==(s=t.error_description)&&void 0!==s?s:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw Aa(n,e,a.getCapturedResponse()),n}}const a=await v(as,this).call(this,t);try{const t=await ii(a,Da[e.factorType],n),o=Pa.fromTokenEndpointResponse(t);return t.recovery_code&&(o.recoveryCode=t.recovery_code),o}catch(e){var c,u,l;if(e instanceof Ia)throw e;const t=e,n=new Ia(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(u=null!==(l=t.error_description)&&void 0!==l?l:t.message)&&void 0!==u?u:"Failed to verify MFA challenge"});throw Aa(n,e),n}}});function Wa(e){return Ma(v(is,this),e,v(ss,this))}var Ka=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=ea(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}}
5,Ga=class extends Ka{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},Ba=class extends Ka{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},Fa=class extends Ka{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function Ha(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var Xa="urn:okta:params:oauth:grant-type:webauthn",Ja=(ls=new WeakMap,ds=new WeakMap,hs=new WeakMap,ps=new WeakMap,fs=new WeakMap,ms=new WeakMap,gs=new WeakSet,class{constructor(e){var t,n;S(this,gs),b(this,ls,void 0),b(this,ds,void 0),b(this,hs,void 0),b(this,ps,void 0),b(this,fs,void 0),b(this,ms,void 0),A(ls,this,"https://".concat(e.domain)),A(ds,this,e.clientId),A(hs,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),A(ps,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(fs,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:La()),A(ms,this,e.grantRequest)}async register(e,t){const n="".concat(v(ls,this),"/passkey/register"),o=T(T(T(T(T(T(T(T({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),r=T(T({client_id:v(ds,this)},Ha(v(hs,this))),{},{user_profile:o});e.realm&&(r.realm=e.realm),e.organization&&(r.organization=e.organization),e.userMetadata&&(r.user_metadata=e.userMetadata);const i=await g(gs,this,za).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){const e=await g(gs,this,Va).call(this,i),t=new Ga(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=ba(i.headers),t}return{authSession:(s=await i.json()).auth_session,authnParamsPublicKey:T({},s.authn_params_public_key)};var s}async challenge(e,t){const n="".concat(v(ls,this),"/passkey/challenge"),o=T({client_id:v(ds,this)},Ha(v(hs,this)));null!=e&&e.realm&&(o.realm=e.realm),null!=e&&e.organization&&(o.organization=e.organization);const r=await g(gs,this,za).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const e=await g(gs,this,Va).call(this,r),t=new Ba(e.error_description||"Failed to request login challenge",e);throw t.statusCode=r.status,t.headers=ba(r.headers),t}return{authSession:(i=await r.json()).auth_session,authnParamsPublicKey:T({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&_a(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let o;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audience),e.organization&&n.append("organization",e.organization);try{o=await v(ms,this).call(this,Xa,n,t,e.fullResponse)}catch(e){if(e instanceof va)throw e;const t=ta(e),n=new Fa(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw Aa(n,e),n}if(e.fullResponse){const t=o;return e.organization&&Ea(t.data.claims,e.organization),t}const r=o;return e.organization&&Ea(r.claims,e.organization),r}});function za(e){return Ma(v(ps,this),e,v(fs,this))}async function Va(e){const t=await e.clone().text();try{return T(T({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var Za=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const o=ea(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},Ya=class extends Za{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},qa=class extends Za{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},Qa=class extends Za{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},$a=class extends Za{constructor(e,t,n,o,r){super("passwordless_challenge_error",e,n),_(this,"statusCode",void 0),_(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=o,this.headers=null!=r?r:this.headers}};function ec(e){return/^\+[1-9]\d{1,14}$/.test(e)}
5async function tc(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await $i(e.clientAssertionSigningKey,r);return{client_assertion:await new Li({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new wa}var nc=(ws=new WeakMap,ys=new WeakMap,vs=new WeakMap,bs=new WeakMap,As=new WeakMap,Ss=new WeakMap,_s=new WeakMap,Es=new WeakSet,class{constructor(e){var t,n;S(this,Es),b(this,ws,void 0),b(this,ys,void 0),b(this,vs,void 0),b(this,bs,void 0),b(this,As,void 0),b(this,Ss,void 0),b(this,_s,void 0),A(ys,this,e.domain),A(ws,this,"https://".concat(e.domain)),A(vs,this,e.clientId),A(bs,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(As,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:La()),A(Ss,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),A(_s,this,e.grantRequest)}async sendEmail(e,t){const n=await g(Es,this,rc).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",o={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(o.authParams=e.authParams),o}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!ec(e.phoneNumber))throw new Ya("Phone number must be in E.164 format (e.g. +14155550100).");const n=await g(Es,this,rc).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return g(Es,this,ic).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!ec(e.phoneNumber))throw new $a("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return g(Es,this,ic).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audience),!v(_s,this))throw new Qa("Missing grant request delegate.",ta(new Error("missing grantRequest")));try{return await v(_s,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof va)throw e;const t=new Qa("There was an error while trying to request a token.",ta(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function oc(e){return Ma(v(bs,this),e,v(As,this))}async function rc(e,t,n,o){var r;const i=await tc(v(Ss,this),v(vs,this),v(ys,this)),s=T(T({client_id:v(vs,this)},e),i);let a;try{a=await g(Es,this,oc).call(this,o)("".concat(v(ws,this),"/passwordless/start"),{method:"POST",headers:T({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(s)})}catch(e){throw new Ya("".concat(t,": a network error occurred."))}if(a.ok)return a;const c=await a.clone().text();let u;if(204!==a.status)try{u=JSON.parse(c)}catch(e){u=void 0}const l=new Ya((null===(r=u)||void 0===r?void 0:r.error_description)||t,u);throw l.statusCode=a.status,l.headers=ba(a.headers),l.body=c,l}async function ic(e,t,n){var o,r;const i=await tc(v(Ss,this),v(vs,this),v(ys,this)),s=T(T({client_id:v(vs,this)},e),i);let a;try{a=await g(Es,this,oc).call(this,n)("".concat(v(ws,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(e){throw new $a("challenge error: a network error occurred.",0,void 0,void 0)}if(a.ok){let n;try{n=await a.json()}catch(e){throw new $a("".concat(t,": could not parse the response body."),a.status,void 0,void 0,ba(a.headers))}return{authSession:n.auth_session}}const c=await a.clone().text();let u;
5try{u=JSON.parse(c)}catch(e){u=void 0}const l=u?T(T({},u),{},{statusCode:a.status,headers:a.headers,body:c}):{error:"",error_description:"",statusCode:a.status,headers:a.headers,body:c};throw new $a((null===(o=u)||void 0===o?void 0:o.error_description)||t,a.status,l,null===(r=u)||void 0===r?void 0:r.validation_errors,ba(a.headers))}var sc=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=ea(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},ac=class extends sc{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},cc=class extends sc{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function uc(e,t,n){for(const o of t)if(null===e[o]||void 0===e[o]||""===e[o])throw new n('Required parameter "'.concat(String(o),'" was null, undefined, or empty.'))}function lc(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var dc=(Ts=new WeakMap,ks=new WeakMap,Os=new WeakMap,Rs=new WeakMap,Cs=new WeakSet,class{constructor(e){var t,n;S(this,Cs),b(this,Ts,void 0),b(this,ks,void 0),b(this,Os,void 0),b(this,Rs,void 0),A(Ts,this,"https://".concat(e.domain)),A(ks,this,e.clientId),A(Os,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Rs,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:La())}async signUp(e,t){var n;uc(e,["email","password","connection"],ac);const o=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:v(ks,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),r=await g(Cs,this,hc).call(this,"/dbconnections/signup",o,ac,"Failed to sign up",t);if(e.fullResponse){const e=r.clone();return{data:lc(await r.json()),response:e}}return lc(await r.json())}async changePassword(e,t){var n;if(uc(e,["connection"],cc),!e.email&&!e.username)throw new cc('Either "email" or "username" is required.');const o=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:v(ks,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),r=await g(Cs,this,hc).call(this,"/dbconnections/change_password",o,cc,"Failed to request a password change",t);if(e.fullResponse){const e=r.clone();return{data:await r.text(),response:e}}return r.text()}});async function hc(e,t,n,o,r){const i=Ma(v(Os,this),r,v(Rs,this));let s;try{s=await i("".concat(v(Ts,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(o,": a network error occurred."))}if(s.ok)return s;const a=await s.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(s.clone()),u=new n((null==c?void 0:c.error_description)||o,null!=c?c:{error:"unknown_error",error_description:o});throw u.statusCode=s.status,u.headers=ba(s.headers),u.body=a,u}var pc=class extends Error{constructor(e,t,n){super(t),_(this,"code",void 0),_(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}}
5,fc=new Set(["session_expired","invalid_session_token"]);async function mc(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var gc=(Is=new WeakMap,Ns=new WeakMap,Ps=new WeakMap,xs=new WeakMap,Ls=new WeakMap,Us=new WeakMap,Ms=new WeakMap,Ds=new WeakMap,js=new WeakSet,class{constructor(e){var t;S(this,js),b(this,Is,void 0),b(this,Ns,void 0),b(this,Ps,void 0),b(this,xs,void 0),b(this,Ls,void 0),b(this,Us,void 0),b(this,Ms,void 0),b(this,Ds,void 0),A(Is,this,e.domain),A(Ns,this,"https://".concat(e.domain)),A(Ps,this,e.clientId),A(xs,this,e.clientSecret),A(Ls,this,e.clientAssertionSigningKey),A(Us,this,e.clientAssertionSigningAlg),A(Ms,this,e.useMtls),A(Ds,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:v(Ps,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await g(js,this,yc).call(this,t);if(!n.sessionToken)throw new pc("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await g(js,this,wc).call(this,e.sessionToken,e)}catch(t){if(t instanceof pc&&fc.has(t.code))return T(T({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(v(Ns,this),"/anonymous/logout"),t={client_id:v(Ps,this)},n=await v(Ds,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await mc(n);throw new pc(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function wc(e,t){const n={client_id:v(Ps,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const o=await g(js,this,yc).call(this,n);return{sessionToken:e,accessToken:o.accessToken,expiresAt:o.expiresAt,sessionTokenExpiresAt:o.sessionTokenExpiresAt,scope:o.scope,sessionReplaced:!1}}async function yc(e){const t="".concat(v(Ns,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await $i(e.clientAssertionSigningKey,r);return{client_assertion:await new Li({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:v(xs,this),clientAssertionSigningKey:v(Ls,this),clientAssertionSigningAlg:v(Us,this),useMtls:v(Ms,this)},v(Ps,this),v(Is,this));Object.assign(e,n);const o=await v(Ds,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!o.ok){const e=await mc(o);throw new pc(e.error,e.error_description||"Anonymous token request failed",e)}let r;try{r=await o.json()}catch(e){throw new pc("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new pc("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new pc("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(r)}var vc=(Ws=new WeakMap,Ks=new WeakMap,Gs=new WeakMap,class{constructor(e,t){b(this,Ws,new Map),b(this,Ks,void 0),b(this,Gs,void 0),A(Gs,this,Math.max(1,Math.floor(e))),A(Ks,this,Math.max(0,Math.floor(t)))}get(e){const t=v(Ws,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return v(Ws,this).delete(e),v(Ws,this).set(e,t),t.value;v(Ws,this).delete(e)}}set(e,t,n){v(Ws,this).has(e)&&v(Ws,this).delete(e);const o=null!=n&&Number.isFinite(n)&&n>0?n:v(Ks,this);for(v(Ws,this).set(e,{value:t,expiresAt:Date.now()+o});v(Ws,this).size>v(Gs,this);){const e=v(Ws,this).keys().next().value;if(void 0===e)break;v(Ws,this).delete(e)}}}),bc=new Map;function Ac(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 Sc=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,o=e.ttlMs,"".concat(n,":").concat(o));var n,o;let r=(i=t,bc.get(i));var i;return r||(r=new vc(e.maxEntries,e.ttlMs),bc.set(t,r)),r}static createJwksCache(){return{}}},_c="openid profile email offline_access",Ec=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 Tc(e){if(null==e)throw new ua("subject_token is required");if("string"!=typeof e)throw new ua("subject_token must be a string");if(0===e.trim().length)throw new ua("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ua("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ua("subject_token must not include the 'Bearer ' prefix")}function kc(e,t){if(t)for(const o of Object.entries(t)){var n=O(o,2);const t=n[0],r=n[1];if(!Ec.has(t))if(Array.isArray(r)){if(r.length>20)throw new ua("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));r.forEach(n=>{e.append(t,n)})}
5else e.append(t,r)}}var Oc="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",Rc="urn:ietf:params:oauth:grant-type:token-exchange",Cc="urn:ietf:params:oauth:token-type:access_token";function Ic(e,t){return(n,o)=>{const r=null==o?void 0:o.body;if(t!==Xa||!(r instanceof URLSearchParams))return e(n,o);const i={};for(const e of r){var s=O(e,2);const t=s[0],n=s[1];i[t]="authn_response"===t?JSON.parse(n):n}const a=new Headers(null==o?void 0:o.headers);return a.set("Content-Type","application/json"),e(n,T(T({},o),{},{headers:a,body:JSON.stringify(i)}))}}var Nc=(Bs=new WeakMap,Fs=new WeakMap,Hs=new WeakMap,Xs=new WeakMap,Js=new WeakMap,zs=new WeakMap,Vs=new WeakMap,Zs=new WeakMap,Ys=new WeakMap,qs=new WeakMap,Qs=new WeakMap,$s=new WeakSet,class{constructor(e){var t;if(S(this,$s),b(this,Bs,void 0),b(this,Fs,void 0),b(this,Hs,void 0),b(this,Xs,void 0),b(this,Js,void 0),b(this,zs,void 0),b(this,Vs,void 0),b(this,Zs,void 0),b(this,Ys,void 0),b(this,qs,void 0),b(this,Qs,void 0),_(this,"mfa",void 0),_(this,"passkey",void 0),_(this,"passwordless",void 0),_(this,"database",void 0),_(this,"anonymous",void 0),A(Js,this,e),e.useMtls&&!e.customFetch)throw new na("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");A(Vs,this,La(e.telemetry)),A(zs,this,xa(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},v(Vs,this)));const n=Ac(e.discoveryCache);A(Ys,this,Sc.createDiscoveryCache(n)),A(qs,this,new Map),A(Qs,this,Sc.createJwksCache()),this.mfa=new ja({domain:v(Js,this).domain,clientId:v(Js,this).clientId,clientSecret:v(Js,this).clientSecret,customFetch:v(zs,this),telemetryConfig:v(Vs,this),getConfiguration:async e=>(await g($s,this,Uc).call(this,e)).configuration,createCaptureConfiguration:async e=>{const t=(await g($s,this,Mc).call(this)).serverMetadata;return g($s,this,xc).call(this,t,e)}}),this.passkey=new Ja({domain:v(Js,this).domain,clientId:v(Js,this).clientId,clientSecret:v(Js,this).clientSecret,useMtls:v(Js,this).useMtls,customFetch:v(zs,this),telemetryConfig:v(Vs,this),grantRequest:async(e,t,n,o)=>{const r=(await g($s,this,Mc).call(this)).serverMetadata,i=g($s,this,Lc).call(this,n);if(o){const n=Ua(i),o=await g($s,this,xc).call(this,r,n);o[xr]=Ic(n,e);const s=await ii(o,e,t),a=Pa.fromTokenEndpointResponse(s),c=n.getCapturedResponse();if(!c)throw new va;return{data:a,response:c}}const s=await g($s,this,xc).call(this,r);s[xr]=Ic(i,e);const a=await ii(s,e,t);return Pa.fromTokenEndpointResponse(a)}}),this.passwordless=new nc({domain:v(Js,this).domain,clientId:v(Js,this).clientId,customFetch:v(zs,this),telemetryConfig:v(Vs,this),clientSecret:v(Js,this).clientSecret,clientAssertionSigningKey:v(Js,this).clientAssertionSigningKey,clientAssertionSigningAlg:v(Js,this).clientAssertionSigningAlg,useMtls:v(Js,this).useMtls,grantRequest:async(e,t,n,o)=>{const r=(await g($s,this,Uc).call(this,n)).configuration;if(o){var i;const n=Ua(null!==(i=r[xr])&&void 0!==i?i:v(zs,this)),o=await g($s,this,xc).call(this,r.serverMetadata(),n),s=await ii(o,e,t),a=Pa.fromTokenEndpointResponse(s),c=n.getCapturedResponse();if(!c)throw new va;return{data:a,response:c}}try{const n=await ii(r,e,t);return Pa.fromTokenEndpointResponse(n)}catch(e){const t=e,n={};throw Aa(n,e),t._statusCode=n.statusCode,t._headers=n.headers,e}}}),this.database=new dc({domain:v(Js,this).domain,clientId:v(Js,this).clientId,customFetch:v(zs,this),telemetryConfig:v(Vs,this)}),this.anonymous=new gc({domain:v(Js,this).domain,clientId:v(Js,this).clientId,clientSecret:v(Js,this).clientSecret,clientAssertionSigningKey:v(Js,this).clientAssertionSigningKey,clientAssertionSigningAlg:v(Js,this).clientAssertionSigningAlg,useMtls:v(Js,this).useMtls,customFetch:v(zs,this)})}async getServerMetadata(){return(await g($s,this,Mc).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await g($s,this,Mc).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new na("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($s,this,Fc).call(this,e)}catch(e){throw new fa(e)}}async buildLinkUserUrl(e){try{const t=await g($s,this,Fc).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 ma(e)}}async buildUnlinkUserUrl(e){try{const t=await g($s,this,Fc).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 ga(e)}}async backchannelAuthentication(e,t){var n;const o=await g($s,this,Uc).call(this,t),r=o.configuration,i=o.serverMetadata,s=Sa(T(T({},v(Js,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(T(T({scope:_c},s),{},{client_id:v(Js,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));if(e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetail
5s&&a.append("authorization_details",JSON.stringify(e.authorizationDetails)),e.fullResponse){var c;const e=Ua(null!==(c=r[xr])&&void 0!==c?c:v(zs,this)),n=await g($s,this,xc).call(this,r.serverMetadata(),e);try{const t=await Jr(r,a),o=await zr(n,t),i=e.getCapturedResponse();if(!i)throw new va;return{data:Pa.fromTokenEndpointResponse(o),response:i}}catch(t){if(t instanceof va)throw t;const n=new pa(t);throw Aa(n,t,e.getCapturedResponse()),n}}const u=Ua(null!==(n=r[xr])&&void 0!==n?n:v(zs,this)),l=await g($s,this,xc).call(this,r.serverMetadata(),u);try{const e=await Jr(r,a),t=await zr(l,e);return Pa.fromTokenEndpointResponse(t)}catch(e){const t=new pa(e);throw Aa(t,e,u.getCapturedResponse()),t}}async initiateBackchannelAuthentication(e,t){var n;const o=await g($s,this,Uc).call(this,t),r=o.configuration,i=o.serverMetadata,s=Sa(T(T({},v(Js,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(T(T({scope:_c},s),{},{client_id:v(Js,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&a.append("authorization_details",JSON.stringify(e.authorizationDetails));const c=Ua(null!==(n=r[xr])&&void 0!==n?n:v(zs,this)),u=await g($s,this,xc).call(this,r.serverMetadata(),c);try{const e=await Jr(u,a);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){const t=new pa(e),n=c.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async backchannelAuthenticationGrant(e,t){var n;let o=e.authReqId;const r=(await g($s,this,Uc).call(this,t)).configuration,i=new URLSearchParams({auth_req_id:o}),s=Ua(null!==(n=r[xr])&&void 0!==n?n:v(zs,this)),a=await g($s,this,xc).call(this,r.serverMetadata(),s);try{const e=await ii(a,"urn:openid:params:grant-type:ciba",i);return Pa.fromTokenEndpointResponse(e)}catch(e){const t=new pa(e),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async getTokenForConnection(e,t){var n;if(e.refreshToken&&e.accessToken)throw new ca("Either a refresh or access token should be specified, but not both.");const o=null!==(n=e.accessToken)&&void 0!==n?n:e.refreshToken;if(!o)throw new ca("Either a refresh or access token must be specified.");try{return await this.exchangeToken(T({connection:e.connection,subjectToken:o,subjectTokenType:e.accessToken?Cc:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint},e.fullResponse?{fullResponse:!0}:{}),t)}catch(e){if(e instanceof ua){const t=new ca(e.message,e.cause);throw t.statusCode=e.statusCode,t.headers=e.headers,t}throw e}}async exchangeToken(e,t){return e.fullResponse?"connection"in e?g($s,this,jc).call(this,e,t,!0):g($s,this,Kc).call(this,e,t,!0):"connection"in e?g($s,this,jc).call(this,e,t):g($s,this,Kc).call(this,e,t)}async getTokenByCode(e,t,n){var o;const r=(await g($s,this,Uc).call(this,n)).configuration;if(void 0!==t.organization&&_a(t.organization),t.fullResponse){var i;const n=Ua(null!==(i=r[xr])&&void 0!==i?i:v(zs,this)),o=await g($s,this,xc).call(this,r.serverMetadata(),n);let s,a;try{const r=await Zr(o,e,{pkceCodeVerifier:t.codeVerifier});if(s=Pa.fromTokenEndpointResponse(r),a=n.getCapturedResponse(),!a)throw new va}catch(e){if(e instanceof va)throw e;const t=new ra("There was an error while trying to request a token.",ta(e)),o=n.getCapturedResponse();throw t.statusCode=null==o?void 0:o.status,t.headers=o?ba(o.headers):void 0,t}return t.organization&&Ea(s.claims,t.organization),{data:s,response:a}}const s=Ua(null!==(o=r[xr])&&void 0!==o?o:v(zs,this)),a=await g($s,this,xc).call(this,r.serverMetadata(),s);let c;try{const n=await Zr(a,e,{pkceCodeVerifier:t.codeVerifier});c=Pa.fromTokenEndpointResponse(n)}catch(e){const t=new ra("There was an error while trying to request a token.",ta(e)),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}return t.organization&&Ea(c.claims,t.organization),c}async getTokenByMagicLinkCode(e,t,n){var o;const r=(await g($s,this,Uc).call(this,n)).configuration;if(null!=t&&t.fullResponse){var i;const n=Ua(null!==(i=r[xr])&&void 0!==i?i:v(zs,this)),o=await g($s,this,xc).call(this,r.serverMetadata(),n);try{const r=await Zr(o,e,{expectedState:null==t?void 0:t.expectedState}),i=Pa.fromTokenEndpointResponse(r),s=n.getCapturedResponse();if(!s)throw new va;return{data:i,response:s}}catch(e){if(e instanceof va)throw e;const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",o=new ra(t,e),r=n.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?ba(r.headers):void 0,o}}const s=Ua(null!==(o=r[xr])&&void 0!==o?o:v(zs,this)),a=await g($s,this,xc).call(this,r.serverMetadata(),s);try{const n=await Zr(a,e,{expectedState:null==t?void 0:t.expectedState});return Pa.fromTokenEndpointResponse(n)}catch(e){const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",n=new ra(t,e),o=s.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}async getTokenByRefreshToken(e,t){var n;const o=(await g($s,this,Uc).call(this,t)).configuration,r=new URLSearchParams;
5if(e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.fullResponse){var i;const t=Ua(null!==(i=o[xr])&&void 0!==i?i:v(zs,this)),n=await g($s,this,xc).call(this,o.serverMetadata(),t);try{const o=await Yr(n,e.refreshToken,r),i=Pa.fromTokenEndpointResponse(o),s=t.getCapturedResponse();if(!s)throw new va;return{data:i,response:s}}catch(e){if(e instanceof va)throw e;const n=new sa("The access token has expired and there was an error while trying to refresh it.",ta(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}const s=Ua(null!==(n=o[xr])&&void 0!==n?n:v(zs,this)),a=await g($s,this,xc).call(this,o.serverMetadata(),s);try{const t=await Yr(a,e.refreshToken,r);return Pa.fromTokenEndpointResponse(t)}catch(e){const t=new sa("The access token has expired and there was an error while trying to refresh it.",ta(e)),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async revokeToken(e,t){var n;const o=(await g($s,this,Uc).call(this,t)).configuration,r={};e.tokenTypeHint&&(r.token_type_hint=e.tokenTypeHint);const i=Ua(null!==(n=o[xr])&&void 0!==n?n:v(zs,this)),s=await g($s,this,xc).call(this,o.serverMetadata(),i);try{await async function(e,t,n){ei(e);const o=Rr(e),r=o.as,i=o.c,s=o.auth,a=o.fetch,c=o.tlsOnly,u=o.timeout;return async function(e,t,n,o,r){cn(e),un(t),en(o,'"token"');const i=mn(e,"revocation_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Lt])),s=new URLSearchParams(null==r?void 0:r.additionalParameters);s.set("token",o);const a=Yt(null==r?void 0:r.headers);return a.delete("accept"),Nn(e,t,n,i,s,a,r)}(r,i,s,t,{[Dt]:a,[Lt]:!c,additionalParameters:new URLSearchParams(n),headers:new Headers(kr),signal:ti(u)}).then(lo).catch(Wr)}(s,e.token,r)}catch(e){const t=new la("An error occurred while trying to revoke the token.",ta(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async getUserInfo(e,t){const n=(await g($s,this,Uc).call(this,t,!0)).configuration;try{var o;return await ni(n,e.accessToken,null!==(o=e.expectedSubject)&&void 0!==o?o:Pr)}catch(e){throw new da("There was an error while trying to retrieve the user info.",ta(e))}}async getTokenByPassword(e,t){var n;const o=(await g($s,this,Uc).call(this,t)).configuration,r=new URLSearchParams({username:e.username,password:e.password});e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.realm&&r.append("realm",e.realm);let i=o;if(e.auth0ForwardedFor){const t=await g($s,this,Bc).call(this);i=new Br(o.serverMetadata(),v(Js,this).clientId,{client_secret:v(Js,this).clientSecret,use_mtls_endpoint_aliases:v(Js,this).useMtls},t);const n=o[xr];i[xr]=(t,o)=>n(t,T(T({},o),{},{headers:T(T({},o.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}if(e.fullResponse){var s;const e=Ua(null!==(s=i[xr])&&void 0!==s?s:v(zs,this)),n=await g($s,this,xc).call(this,i.serverMetadata(),e);try{const t=await ii(n,"password",r),o=Pa.fromTokenEndpointResponse(t),i=e.getCapturedResponse();if(!i)throw new va;return{data:o,response:i}}catch(t){if(t instanceof va)throw t;const n=new aa("There was an error while trying to request a token.",ta(t)),o=e.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}const a=Ua(null!==(n=i[xr])&&void 0!==n?n:v(zs,this)),c=await g($s,this,xc).call(this,i.serverMetadata(),a);try{const e=await ii(c,"password",r);return Pa.fromTokenEndpointResponse(e)}catch(e){const t=new aa("There was an error while trying to request a token.",ta(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async getTokenByPasswordlessEmail(e,t){const n=new URLSearchParams({username:e.email,otp:e.code,realm:"email"});return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),g($s,this,Gc).call(this,n,t,e.fullResponse)}async getTokenByPasswordlessSms(e,t){if(!ec(e.phoneNumber))throw new qa("Phone number must be in E.164 format (e.g. +14155550100).");const n=new URLSearchParams({username:e.phoneNumber,otp:e.code,realm:"sms"});
5return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),g($s,this,Gc).call(this,n,t,e.fullResponse)}async getTokenByClientCredentials(e,t){var n;const o=(await g($s,this,Uc).call(this,t)).configuration;if(e.fullResponse){var r;const t=Ua(null!==(r=o[xr])&&void 0!==r?r:v(zs,this)),n=await g($s,this,xc).call(this,o.serverMetadata(),t),i=new URLSearchParams({audience:e.audience});e.organization&&i.append("organization",e.organization);try{const e=await qr(n,i),o=Pa.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new va;return{data:o,response:r}}catch(e){if(e instanceof va)throw e;const n=new ia("There was an error while trying to request a token.",ta(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}const i=Ua(null!==(n=o[xr])&&void 0!==n?n:v(zs,this)),s=await g($s,this,xc).call(this,o.serverMetadata(),i);try{const t=new URLSearchParams({audience:e.audience});e.organization&&t.append("organization",e.organization);const n=await qr(s,t);return Pa.fromTokenEndpointResponse(n)}catch(e){const t=new ia("There was an error while trying to request a token.",ta(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async buildLogoutUrl(e){const t=await g($s,this,Mc).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(v(Js,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",v(Js,this).clientId),e.federated&&t.searchParams.set("federated",""),t}const o={post_logout_redirect_uri:e.returnTo};return e.federated&&(o.federated=""),function(e,t){ei(e);const n=Rr(e),o=n.as,r=n.c,i=mn(o,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const e of t.entries()){var s=O(e,2);const t=s[0],n=s[1];i.searchParams.append(t,n)}return i}(n,o)}async verifyLogoutToken(e){const t=(await g($s,this,Mc).call(this)).serverMetadata,n=Ac(v(Js,this).discoveryCache),o=t.jwks_uri;v(Zs,this)||A(Zs,this,function(e,t){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");const n=new URL(e.href).href,o=null!=t?t:{},r=o.timeoutDuration;if("number"==typeof r&&(!Number.isInteger(r)||r<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');const i="number"==typeof r?r:5e3,s=Qi(o.cooldownDuration,3e4,"cooldownDuration"),a=Qi(o.cacheMaxAge,6e5,"cacheMaxAge"),c=new Headers(o.headers);Vi&&!c.has("User-Agent")&&c.set("User-Agent",Vi),c.has("accept")||c.set("accept","application/json, application/jwk-set+json");const u=o[Zi],l=o[Yi];let d,h,p,f=0,m=0;if(l&&"object"==typeof l){const e=l.uat,t=l.jwks;qi(e,a)&&Vo(t)&&(d=e,p=Xi(t))}const g=async()=>{if(h&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(h=void 0),!h){const e=++f,t=h=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch;const r=await o(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Ko;throw e});if(200!==r.status)throw new Io("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch(e){throw new Io("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(n,c,AbortSignal.timeout(i),u).then(t=>{const n=Xi(t);if(e<=m)return;p=n;const o=Date.now();l&&(l.uat=o,l.jwks=t),d=o,m=e}).finally(()=>{h===t&&(h=void 0)})}await h};return Object.defineProperties(async(e,t)=>{p&&qi(d,a)||await g();try{return await p(e,t)}catch(n){if(n instanceof jo&&!qi(d,s))return await g(),p(e,t);throw n}},{coolingDown:{get:()=>qi(d,s),enumerable:!0},fresh:{get:()=>qi(d,a),enumerable:!0},reload:{value:g,enumerable:!0},reloading:{get:()=>!!h,enumerable:!0},jwks:{value:()=>{var e;return null===(e=p)||void 0===e?void 0:e.jwks()},enumerable:!0}})}(new URL(o),{cacheMaxAge:n.ttlMs,[Zi]:v(zs,this),[Yi]:v(Qs,this)}));const r=(await async function(e,t,n){const o=await mi(e,function(e){return[e&&Ar("algorithms",e.algorithms),null==e?void 0:e.crit]}(n),t);
5if(!o[2])throw new Mo("JWTs MUST NOT use unencoded payload");const r={payload:Ri(o[1],o[0],n),protectedHeader:o[1]};return"function"==typeof t?T(T({},r),{},{key:o[3]}):r}(e.logoutToken,v(Zs,this),{issuer:t.issuer,audience:v(Js,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in r)&&!("sub"in r))throw new ha('either "sid" or "sub" (or both) claims must be present');if("sid"in r&&"string"!=typeof r.sid)throw new ha('"sid" claim must be a string');if("sub"in r&&"string"!=typeof r.sub)throw new ha('"sub" claim must be a string');if("nonce"in r)throw new ha('"nonce" claim is prohibited');if(!("events"in r))throw new ha('"events" claim is missing');if("object"!=typeof r.events||null===r.events)throw new ha('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in r.events))throw new ha('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof r.events["http://schemas.openid.net/event/backchannel-logout"])throw new ha('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:r.sid,sub:r.sub}}});function Pc(){const e=v(Js,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(v(Js,this).useMtls?"1":"0")}async function xc(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=await g($s,this,Bc).call(this,n),r=new Br(e,v(Js,this).clientId,{client_secret:v(Js,this).clientSecret,use_mtls_endpoint_aliases:v(Js,this).useMtls},o);return r[xr]=null!=t?t:v(zs,this),r}function Lc(e){return Ma(v(zs,this),e,v(Vs,this))}async function Uc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await g($s,this,Mc).call(this,t),o=n.configuration,r=n.serverMetadata;if(!e)return{configuration:o,serverMetadata:r};const i=g($s,this,Lc).call(this,e);return{configuration:await g($s,this,xc).call(this,r,i,t),serverMetadata:r}}async function Mc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=v(e?Fs:Bs,this);if(t&&v(Hs,this))return{configuration:t,serverMetadata:v(Hs,this)};const n=g($s,this,Pc).call(this);e||await g($s,this,Bc).call(this,!1);const o=v(Ys,this).get(n);if(o)return g($s,this,Dc).call(this,o.serverMetadata,e);const r=v(qs,this).get(n);if(r){const t=await r;return g($s,this,Dc).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await Kr(new URL("https://".concat(v(Js,this).domain)),v(Js,this).clientId,{use_mtls_endpoint_aliases:v(Js,this).useMtls},(e,t,n,o)=>{n.set("client_id",t.client_id)},{[xr]:v(zs,this)})).serverMetadata();return v(Ys,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),v(qs,this).set(n,i);try{const t=(await i).serverMetadata;return g($s,this,Dc).call(this,t,e)}finally{v(qs,this).delete(n)}}async function Dc(e,t){const n=await g($s,this,xc).call(this,e,void 0,t);return A(Hs,this,e),A(t?Fs:Bs,this,n),{configuration:n,serverMetadata:e}}async function jc(e,t,n){var o,r,i;const s=(await g($s,this,Uc).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new ua("audience and resource parameters are not supported for Token Vault exchanges");Tc(e.subjectToken);const a=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(o=e.subjectTokenType)&&void 0!==o?o:Cc,requested_token_type:null!==(r=e.requestedTokenType)&&void 0!==r?r:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&a.append("login_hint",e.loginHint),e.scope&&a.append("scope",e.scope),kc(a,e.extra),n){var c;const t=Ua(null!==(c=s[xr])&&void 0!==c?c:v(zs,this)),o=await g($s,this,xc).call(this,s.serverMetadata(),t);try{const e=await ii(o,Oc,a),n=Pa.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new va;return{data:n,response:r}}catch(n){if(n instanceof va)throw n;const o=new ua("Failed to exchange token for connection '".concat(e.connection,"'."),ta(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?ba(r.headers):void 0,o}}const u=Ua(null!==(i=s[xr])&&void 0!==i?i:v(zs,this)),l=await g($s,this,xc).call(this,s.serverMetadata(),u);try{const e=await ii(l,Oc,a);return Pa.fromTokenEndpointResponse(e)}catch(t){const n=new ua("Failed to exchange token for connection '".concat(e.connection,"'."),ta(t)),o=u.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}
5function Wc(e,t,n){var o;if(n.organization&&Ea(e.claims,n.organization),n.actorToken)if(null!==(o=e.claims)&&void 0!==o&&o.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new Mo("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],o=t.length;if(5===o)throw new Mo("Only JWTs using Compact JWS serialization can be decoded");if(3!==o)throw new Mo("Invalid JWT");if(!n)throw new Mo("JWTs must contain a payload");let r,i;try{r=Xo(n)}catch(e){throw new Mo("Failed to base64url decode the payload")}try{i=JSON.parse(To.decode(r))}catch(e){throw new Mo("Failed to parse the decoded payload as JSON")}if(!zo(i))throw new Mo("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function Kc(e,t,n){var o;const r=(await g($s,this,Uc).call(this,t)).configuration;if(Tc(e.subjectToken),void 0!==e.organization&&_a(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new ua("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),kc(i,e.extra),n){var s;const t=Ua(null!==(s=r[xr])&&void 0!==s?s:v(zs,this)),o=await g($s,this,xc).call(this,r.serverMetadata(),t);let a,c,u;try{if(c=await ii(o,Rc,i),a=Pa.fromTokenEndpointResponse(c),u=t.getCapturedResponse(),!u)throw new va}catch(n){if(n instanceof va)throw n;const o=new ua("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),ta(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?ba(r.headers):void 0,o}return g($s,this,Wc).call(this,a,c,e),{data:a,response:u}}const a=Ua(null!==(o=r[xr])&&void 0!==o?o:v(zs,this)),c=await g($s,this,xc).call(this,r.serverMetadata(),a);let u,l;try{l=await ii(c,Rc,i),u=Pa.fromTokenEndpointResponse(l)}catch(t){const n=new ua("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),ta(t)),o=a.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}return g($s,this,Wc).call(this,u,l,e),u}async function Gc(e,t,n){var o;const r=(await g($s,this,Uc).call(this,t)).configuration;if(n){var i;const t=Ua(null!==(i=r[xr])&&void 0!==i?i:v(zs,this)),n=await g($s,this,xc).call(this,r.serverMetadata(),t);try{const o=await ii(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),r=Pa.fromTokenEndpointResponse(o),i=t.getCapturedResponse();if(!i)throw new va;return{data:r,response:i}}catch(e){if(e instanceof va)throw e;const n=new qa("There was an error while trying to request a token.",ta(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?ba(o.headers):void 0,n}}const s=Ua(null!==(o=r[xr])&&void 0!==o?o:v(zs,this)),a=await g($s,this,xc).call(this,r.serverMetadata(),s);try{const t=await ii(a,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return Pa.fromTokenEndpointResponse(t)}catch(e){const t=new qa("There was an error while trying to request a token.",ta(e)),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?ba(n.headers):void 0,t}}async function Bc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!v(Js,this).clientSecret||!!v(Js,this).clientAssertionSigningKey||!!v(Js,this).useMtls;return e&&!t?(e,t,n,o)=>{n.set("client_id",t.client_id)}:(v(Xs,this)||A(Xs,this,(async()=>{if(!v(Js,this).clientSecret&&!v(Js,this).clientAssertionSigningKey&&!v(Js,this).useMtls)throw new wa;if(v(Js,this).useMtls)return(e,t,n,o)=>{n.set("client_id",t.client_id)};let e=v(Js,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await $i(e,v(Js,this).clientAssertionSigningAlg||"RS256")),e?function(e){return dn(e,void 0)}(e):Nr(v(Js,this).clientSecret)})().catch(e=>{throw A(Xs,this,void 0),e})),v(Xs,this))}async function Fc(e){const t=(await g($s,this,Mc).call(this)).configuration,n=nn(),o=await function(e){return async function(e){return en(e,"codeVerifier"),Xt(await crypto.subtle.digest("SHA-256",Bt(e)))}(e)}(n),r=Sa(T(T({},v(Js,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:_c},r),{}
5,{client_id:v(Js,this).clientId,code_challenge:o,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await $r(t,i):await Qr(t,i),codeVerifier:n}}var Hc,Xc;new vc(1e3,6e4);class Jc extends j{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Jc.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new Jc(t,n)}}class zc extends Jc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,zc.prototype)}}class Vc extends Jc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Vc.prototype)}}class Zc extends Jc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Zc.prototype)}}class Yc extends Jc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Yc.prototype)}}class qc extends Jc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,qc.prototype)}}class Qc{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=O(n,2);const o=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(o)}}get size(){return this.contexts.size}}class $c{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Qc}setMFAAuthDetails(e,t,n,o){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:o})}async getAuthenticators(e){var t,n,o;const r=this.contextManager.get(e);if(!r)throw new zc("invalid_request","MFA context not found for this MFA token");const i=null===(n=null===(t=r.mfaRequirements)||void 0===t?void 0:t.challenge)||void 0===n?void 0:n.map(e=>e.type);try{const t=await this.authJsMfaClient.listAuthenticators({mfaToken:e});return i&&0!==i.length?t.filter(e=>!!e.type&&i.includes(e.type)):t}catch(e){if(e instanceof ka)throw new zc(null===(o=e.cause)||void 0===o?void 0:o.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=kt[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 Oa)throw new Vc(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 Ca)throw new Zc(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 qc("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 Yc("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-rec
5overy-code":void 0}(e);if(!n)throw new Yc("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const o=t.scope,r=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:o,audience:r,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 Yc)throw new Yc(e.error,e.error_description);throw e}}}class eu extends Error{constructor(e,t,n){super(t),this.name="PasskeyError",this.code=e,this.cause=n,Object.setPrototypeOf(this,eu.prototype)}}class tu{constructor(e,t){Hc.set(this,void 0),Xc.set(this,void 0),p(this,Hc,e,"f"),p(this,Xc,t,"f")}async signup(e){if(!window.PublicKeyCredential)throw new eu("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.scope,n=e.audience,o=d(e,["scope","audience"]),r=await h(this,Hc,"f").register(o),i=ru(r.authnParamsPublicKey),s=await navigator.credentials.create({publicKey:i});if(!s)throw new eu("passkey_cancelled","Passkey creation was cancelled or no credential was returned.");const a=su(s);return h(this,Xc,"f")._requestTokenForPasskey({authSession:r.authSession,credential:a,realm:o.realm,organization:o.organization,scope:t,audience:n})}async login(e){if(!window.PublicKeyCredential)throw new eu("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e||{},n=t.scope,o=t.audience,r=d(t,["scope","audience"]),i=await h(this,Hc,"f").challenge(Object.keys(r).length>0?r:void 0),s=iu(i.authnParamsPublicKey),a=await navigator.credentials.get({publicKey:s});if(!a)throw new eu("passkey_cancelled","Passkey authentication was cancelled or no credential was returned.");const c=au(a);return h(this,Xc,"f")._requestTokenForPasskey({authSession:i.authSession,credential:c,realm:r.realm,organization:r.organization,scope:n,audience:o})}async getSignupChallenge(e){if(!window.PublicKeyCredential)throw new eu("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await h(this,Hc,"f").register(e);return{authSession:t.authSession,publicKey:ru(t.authnParamsPublicKey)}}async getLoginChallenge(e){if(!window.PublicKeyCredential)throw new eu("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await h(this,Hc,"f").challenge(e);return{authSession:t.authSession,publicKey:iu(t.authnParamsPublicKey)}}async getTokenWithPasskey(e){if(!window.PublicKeyCredential)throw new eu("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.authSession,n=e.credential,o=e.realm,r=e.organization,i=e.scope,s=e.audience,a=n.response;let c;if(a instanceof AuthenticatorAttestationResponse)c=su(n);else{if(!(a instanceof AuthenticatorAssertionResponse))throw new eu("passkey_invalid_credential","The provided credential is not a valid attestation or assertion response.");c=au(n)}return h(this,Xc,"f")._requestTokenForPasskey({authSession:t,credential:c,realm:o,organization:r,scope:i,audience:s})}}function nu(e){const t=new Uint8Array(e),n=Array.from(t,e=>String.fromCharCode(e)).join("");return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ou(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),o=atob(n),r=new Uint8Array(o.length);for(let e=0;e<o.length;e++)r[e]=o.charCodeAt(e);return r.buffer}function ru(e){return Object.assign(Object.assign({},e),{challenge:ou(e.challenge),user:Object.assign(Object.assign({},e.user),{id:ou(e.user.id)}),pubKeyCredParams:e.pubKeyCredParams,authenticatorSelection:e.authenticatorSelection})}function iu(e){return Object.assign(Object.assign({},e),{challenge:ou(e.challenge)})}function su(e){var t;const n=e.response;return{id:e.id,rawId:nu(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:nu(n.clientDataJSON),attestationObject:nu(n.attestationObject)},clientExtensionResults:e.getClientExtensionResults()}}function au(e){var t;const n=e.response;return{id:e.id,rawId:nu(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:nu(n.clientDataJSON),authenticatorData:nu(n.authenticatorData),signature:nu(n.signature),userHandle:n.userHandle?nu(n.userHandle):void 0},clientExtensionResults:e.getClientExtensionResults()}}function cu(e){return{get(){try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}},set(t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}},remove(){try{window.localStorage.removeItem(e)}catch(e){}}}}function uu(){let e=null;return{get:()=>e,set:t=>{e=t},remove:()=>{e=null}}}Hc=new WeakMap,Xc=new WeakMap;class lu{constructor(e,t){this.slots=new Map,this.baseKey="".concat("@@auth0spajs@@","::").concat(e,"::anonymous"),this.useLocalStorage="localStorage"===t&&"undefined"!=typeof window&&!!window.localStorage,this.sessionKey="".concat(this.baseKey,"::").concat("session"),this.sessionStore=this.useLocalStorage?cu(this.sessionKey):uu()}getStore(e,t){const n="".concat(this.baseKey,"::").concat(JSON.stringify([null!=e?e:"",null!=t?t:""]));return this.slots.has(n)||this.slots.set(n,this.useLocalStorage?cu(n):uu()),this.slots.get(n)}getSessionToken(){return this.sessionStore.get()}setSessionToken(e){this.sessionStore.set(e)}
5removeAll(){if(this.sessionStore.remove(),this.slots.forEach(e=>e.remove()),this.slots.clear(),this.useLocalStorage)try{const e=this.baseKey+"::",t=[];for(let n=0;n<window.localStorage.length;n++){const o=window.localStorage.key(n);(null==o?void 0:o.startsWith(e))&&t.push(o)}t.forEach(e=>window.localStorage.removeItem(e))}catch(e){}}}class du{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"localStorage",o=arguments.length>3?arguments[3]:void 0;this.authJsClient=e,this.clientId=t,this.cache=new lu(t,n),this.lockManager=null!=o?o:_e()}async createSession(e){const t=await this.authJsClient.createSession(e);return this.cache.setSessionToken(Object.assign({sessionToken:t.sessionToken},void 0!==t.sessionTokenExpiresAt&&{sessionTokenExpiresAt:t.sessionTokenExpiresAt})),this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:t.accessToken,expiresAt:t.expiresAt},void 0!==t.scope&&{scope:t.scope})),t}async getTokenSilently(e){const t=this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope),n=t.get();return n&&n.expiresAt-60>Date.now()/1e3?n:this.lockManager.runWithLock("anonymous::".concat(this.clientId),5e3,async()=>{var n;const o=t.get();if(o&&o.expiresAt-60>Date.now()/1e3)return o;const r=null===(n=this.cache.getSessionToken())||void 0===n?void 0:n.sessionToken,i=await this.authJsClient.getAccessToken(Object.assign(Object.assign({},e),{sessionToken:r}));return this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})),!i.sessionReplaced&&this.cache.getSessionToken()||this.cache.setSessionToken(Object.assign({sessionToken:i.sessionToken},void 0!==i.sessionTokenExpiresAt&&{sessionTokenExpiresAt:i.sessionTokenExpiresAt})),Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})})}async logout(){await this.authJsClient.logout(),this.cache.removeAll()}hasSession(){var e;return!!(null===(e=this.cache.getSessionToken())||void 0===e?void 0:e.sessionToken)}getClaims(){return null}}class hu{resolveOnlineAccess(e){if("online"!==e.refreshTokenMode)return!1;if(!0!==e.useRefreshTokens)throw new W('`refreshTokenMode: "online"` requires the refresh-token grant.',"Set `useRefreshTokens: true`.");if(!0!==e.useDpop)throw new W('`refreshTokenMode: "online"` requires DPoP, which is missing or disabled.',"Set `useDpop: true` (DPoP is mandatory for online access).");return!0}warnEnterpriseConnectConfig(e){var t,n;if(!0!==e.enterpriseConnect)return;const o=null===(t=e.authorizationParams)||void 0===t?void 0:t.scope;(!0===e.useRefreshTokens||"string"==typeof o&&o.includes("offline_access"))&&console.warn("Enterprise Connect issues no refresh token; `useRefreshTokens` and `offline_access` in `scope` have no effect."),(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)&&console.warn("Enterprise Connect resolves the organization from the email domain (Home Realm Discovery); a static `organization` breaks multi-customer setups.")}constructor(e){let t,n;if(this.userCache=(new Ye).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0,refreshTokenMode:"offline",anonymousSessionsCacheMode:"localStorage"},this.onlineAccess=this.resolveOnlineAccess(e),this.warnEnterpriseConnectConfig(e),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(!q())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===q().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=_e(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||P,!wt(t))throw new Error('Invalid cac
5he location "'.concat(t,'"'));n=wt(t)()}var o;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:N,this.cookieStorage=!1===e.legacySameSiteCookie?at:ut,this.orgHintCookieName=(o=this.options.clientId,"auth0.".concat(o,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:lt;let i="";var s;this.onlineAccess?i=L:this.options.useRefreshTokens&&(i="offline_access"),this.scope=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if("object"!=typeof e)return{[D]:He(t,e,...o)};let i={[D]:He(t,...o)};return Object.keys(e).forEach(n=>{const r=e[n];i[n]=He(t,r,...o)}),i}(this.options.authorizationParams.scope,"openid",i),this.transactionManager=new Qe(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||M,this.cacheManager=new qe(n,n.allKeys?void 0:new ft(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new At(this.options.clientId):void 0,this.domainUrl=(s=this.options.domain,/^https?:\/\//.test(s)?s:"https://".concat(s)),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/"),c=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{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:a},detailedResponse:!0})}}));this.myAccount=new Et(c,a),this.authJsClient=new Nc({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new $c(this.authJsClient.mfa,this),this.anonymous=new du(this.authJsClient.anonymous,this.options.clientId,this.options.anonymousSessionsCacheMode,this.lockManager),this.passkey=new tu(this.authJsClient.passkey,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===P&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new pt,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||U,n=te(t,!0),o=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(o)}_authorizeUrl(e){return this._url("/authorize?".concat(ne(e)))}async _verifyIdToken(e,t,n){const o=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=O(t,3),o=n[0],r=n[1],i=n[2];if(3!==t.length||!o||!r||!i)throw new Error("ID token could not be decoded");const s=JSON.parse(re(r)),a={__raw:e},c={};return Object.keys(s).forEach(e=>{a[e]=s[e],et.includes(e)||(c[e]=s[e])}),{encoded:{header:o,payload:r,signature:i},header:JSON.parse(re(o)),claims:a,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");
5if(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&&!$e(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!$e(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!$e(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,o=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),o>r)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(o,") is after expiration time (").concat(r,")"));if(null!=t.claims.nbf&&$e(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),o<e)throw new Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(o,") is before ").concat(e))}if(null!=t.claims.auth_time&&$e(t.claims.auth_time)){const r=new Date(0);if(r.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),o>r)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(o,") is after last auth at ").concat(r))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.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:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:o});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_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 o;const r=$(Q()),i=$(Q()),s=Q(),a=await oe(s),c=ie(a),u=await(null===(o=this.dpop)||void 0===o?void 0:o.calculateThumbprint()),l=((e,t,n,o,r,i,s,a,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:Xe(t,n.scope,n.audience),response_type:"code",response_mode:a||"query",state:o,nonce:r,redirect_uri:s||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,r,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:s,scope:l.scope,audience:l.audience||D,redirect_uri:l.redirect_uri,state:r,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 X;const o=this._applySessionTransferToken(e.authorizationParams||{}),r=await this._prepareAuthorizeUrl(o,{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const i=await((e,t)=>new Promise((n,o)=>{let r;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(s),window.removeEventListener("message",r,!1),o(new H(e.popup)))},1e3),s=setTimeout(()=>{clearInterval(i),o(new F(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));
5r=function(a){if(a.origin===t&&a.data&&"authorization_response"===a.data.type){if(clearTimeout(s),clearInterval(i),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return o(j.fromPayload(a.data.response));n(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(r.url).origin);if(r.state!==i.state)throw new j("state_mismatch","Invalid state");const s=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:s})}async getUser(){var e;if(await this._isSessionCeilingReached())return;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;if(await this._isSessionCeilingReached())return;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=yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
5),n=t.openUrl,o=t.fragment,r=t.appState,i=d(t,["openUrl","fragment","appState"]),s=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,a=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(a),u=c.url,l=d(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:r,response_type:dt.Code}),s&&{organization:s}));const h=o?"".concat(u,"#").concat(o):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 j("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===dt.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,o=e.state,r=e.error,i=e.error_description;if(r)throw new K(r,i||r,o,t.appState);if(!t.code_verifier||t.state&&t.state!==o)throw new j("state_mismatch","Invalid state");const s=t.organization,a=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:a,organization:s}),{appState:t.appState,response_type:dt.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,o=e.state,r=e.error,i=e.error_description;if(r)throw new G(r,i||r,t.connection,o,t.appState);if(!n)throw new j("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===o))throw new j("state_mismatch","Invalid state");const s=await this.myAccount.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},s),{appState:t.appState,response_type:dt.ConnectCode})}async _maybeCreateAnonymousSession(){if(this.options.createAnonymousSessionOnFailedSilentAuth){if(this.anonymous.hasSession())return;try{await this.anonymous.getTokenSilently()}catch(e){console.debug("[auth0-spa-js] Anonymous session creation failed",e)}}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(mt))return void await this._maybeCreateAnonymousSession();this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(mt)}try{await this.getTokenSilently(e)}catch(e){e instanceof j&&"login_required"===e.error&&e.error_description!==x&&await this._maybeCreateAnonymousSession()}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const o=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Xe(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)})}),r=await this._getTokenSilently(o);return e.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const t=e.cacheMode,n=d(e,["cacheMode"]);if(await this._isSessionCeilingReached())return;if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||D,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const o=(r=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(r,".").concat(i));var r,i;try{return await this.lockManager.runWithLock(o,5e3,async()=>
5{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||D,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),o=e.id_token,r=e.token_type,i=e.access_token,s=e.oauthTokenScope,a=e.expires_in;return Object.assign(Object.assign({id_token:o,token_type:r,access_token:i},s?{scope:s}:null),{expires_in:a})})}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 j&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&e.error_description===x}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||D,clientId:this.options.clientId});if(!t)throw new j("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,o;const r=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Xe(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(o=e.authorizationParams)||void 0===o?void 0:o.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},I),t),await this.loginWithPopup(r,t),(await this.cacheManager.get(new Ve({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||D,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,o=d(t,["federated"]),r=n?"&federated":"";return this._url("/v2/logout?".concat(ne(Object.assign({clientId:e.clientId},o))))+r}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||D,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,o=e.useFormData,r=e.refreshTokens,i=e.audience,s=e.client_id,a=e.onRefreshTokenRevoked;const c=e.timeout||N,u="refresh_token",l="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(te(n||U)))};if(t){const n={client_id:s,token_type_hint:u},r=o?ne(n):JSON.stringify(n);try{return await We({type:"revoke",timeout:c,fetchUrl:l,fetchOptions:{method:"POST",body:r,headers:d},useFormData:o,auth:{audience:null!=i?i:D}},t)}catch(e){throw new j("revoke_error",e.message)}}for(const t of r){const n={client_id:s,token_type_hint:u,token:t},r=o?ne(n):JSON.stringify(n),i=await Ke(l,{method:"POST",body:r,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 j(t||"revoke_error",n||"HTTP error ".concat(i.status))}await(null==a?void 0:a(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),this.onlineAccess&&await this._clearLocalSession()}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;this.options.enterpriseConnect&&!0!==(null===(t=e.logoutParams)||void 0===t?void 0:t.federated)&&console.warn("Enterprise Connect logout without `federated: true` leaves the enterprise IdP session alive; the next login may silently reuse the previous user.");const n=yt(e),o=n.openUrl,r=d(n,["openUrl"]);await this._clearLocalSession(e.clientId);const i=this._buildLogoutUrl(r);o?await o(i):!1!==o&&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 o=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"}
5,window.location.origin),r=o.url,i=o.state,s=o.nonce,a=o.code_verifier,c=o.redirect_uri,u=o.scope,l=o.audience;if(window.crossOriginIsolated)throw new j("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((o,r)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const s=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",a,!1))};let a;const c=setTimeout(()=>{r(new B),s()},1e3*n);a=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(j.fromPayload(e.data.response)):o(e.data.response),clearTimeout(c),window.removeEventListener("message",a,!1),setTimeout(s,2e3)},window.addEventListener("message",a,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,h,d);if(i!==p.state)throw new j("state_mismatch","Invalid state");const f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:p.code,grant_type:"authorization_code",redirect_uri:c,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:s,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 j&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new Ve({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||D,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new z(e.authorizationParams.audience||D,e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,r=((e,t,n,o)=>{var r;if(e&&n&&o){if(t.audience!==n)return t.scope;const e=o.split(" "),i=(null===(r=t.scope)||void 0===r?void 0:r.split(" "))||[],s=i.every(t=>e.includes(t));return e.length>=i.length&&s?o:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==t?void 0:t.audience,null==t?void 0:t.scope);try{const u=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),o&&{timeout:o}),{scopesToRequest:r});if(await this._propagateRotatedRefreshToken(null==t?void 0:t.refresh_token,u.refresh_token),this.options.useMrrt&&(i=null==t?void 0:t.audience,s=null==t?void 0:t.scope,a=e.authorizationParams.audience,c=e.authorizationParams.scope,i!==a||!((e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))})(c,s))){const t=((e,t,n)=>{const o=(null==e?void 0:e.split(" "))||[],r=n?o.filter(e=>e!==L):o,i=(null==t?void 0:t.split(" "))||[];return r.filter(e=>-1==i.indexOf(e)).join(",")})(r,u.scope,this.onlineAccess);if(t){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope),new V(e.authorizationParams.audience||"default",t)}}return Object.assign(Object.assign({},u),{scope:e.authorizationParams.scope,oauthTokenScope:u.scope,audience:e.authorizationParams.audience||D})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw t}var i,s,a,c}async _propagateRotatedRefreshToken(e,t){!this.onlineAccess&&t&&e&&await this.cacheManager.updateEntry(e,t,this.options.clientId,this.options.useMrrt)}async _saveEntryInCache(e){const t=e.decodedToken.claims,n=t.session_expiry,o=t.iat;
5if(void 0!==n){if("number"!=typeof n)throw new j("invalid_token","Invalid session_expiry: value must be a number.");if(n>=1e10)throw new j("invalid_token","Invalid session_expiry: value appears to be in milliseconds; expected a Unix timestamp in seconds.");if(void 0===o||n<=o)throw new j("invalid_token","Invalid session_expiry: session ceiling is before or at the token issue time.")}const r=e.id_token,i=e.decodedToken,s=d(e,["id_token","decodedToken"]);this.userCache.set(ze,{id_token:r,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(s)}async _clearLocalSession(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.clientId;var t;null===e?await this.cacheManager.clear():await this.cacheManager.clear(e),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(ze);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await We({type:"clear"},this.worker)}catch(e){}}async _isSessionCeilingReached(){var e,t;const n=this.userCache.get(ze),o=null!=n?n:await this.cacheManager.getIdToken(new Ve({clientId:this.options.clientId})),r=null===(t=null===(e=null==o?void 0:o.decodedToken)||void 0===e?void 0:e.claims)||void 0===t?void 0:t.session_expiry;if(void 0===r)return!1;const i=await this.nowProvider();return Math.floor(i/1e3)>=r-30&&(await this._clearLocalSession(),!0)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||D,t=this.scope[e],n=await this.cacheManager.getIdToken(new Ve({clientId:this.options.clientId,audience:e,scope:t})),o=this.userCache.get(ze);return n&&n.id_token===(null==o?void 0:o.id_token)?o:(this.userCache.set(ze,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,o=e.clientId,r=e.cacheMode;const i=await this.cacheManager.get(new Ve({scope:t,audience:n,clientId:o}),60,this.options.useMrrt,r);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,o=i.expires_in,r=await this._getIdTokenFromCache();return r&&Object.assign(Object.assign({id_token:r.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:o})}}_storeMfaContext(e,t,n){e instanceof J&&this.mfa.setMFAAuthDetails(e.mfa_token,t,n,e.mfa_requirements)}async _requestToken(e,t){var n,o,r,i,s,a;const c=t||{},u=c.nonceIn,l=c.organization,d=c.scopesToRequest;try{const t=await Fe(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,preserveRefreshToken:this.onlineAccess},e),{scope:d||e.scope}),this.worker);let c=await this._verifyIdToken(t.id_token,u,l);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(o=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===o?void 0:o.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(ze))}if("authorization_code"!==e.grant_type){const e=await this._getIdTokenFromCache(),t=null===(i=null===(r=null==e?void 0:e.decodedToken)||void 0===r?void 0:r.claims)||void 0===i?void 0:i.session_expiry;void 0!==t&&(c=Object.assign(Object.assign({},c),{claims:Object.assign(Object.assign({},c.claims),{session_expiry:t})}))}return!t.refresh_token&&this.onlineAccess&&(t.refresh_token=null!==(s=e.refresh_token)&&void 0!==s?s:null===(a=await this.cacheManager.get(new Ve({scope:d||e.scope,audience:e.audience||D,clientId:this.options.clientId}),void 0,this.options.useMrrt))||void 0===a?void 0:a.refresh_token),await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},t),{decodedToken:c,scope:e.scope,audience:e.audience||D}),t.scope?{oauthTokenScope:t.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(l||c.claims.org_id),Object.assign(Object.assign({},t),{decodedToken:c})}catch(t){throw"authorization_code"!==e.grant_type&&this._storeMfaContext(t,d||e.scope,e.audie
5nce),t}}_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:Xe(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=this._buildTokenExchangeParams(e);try{const n=await Fe(Object.assign(Object.assign({},t),{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 n.id_token&&await this._verifyIdToken(n.id_token,void 0,e.organization),n}catch(e){throw this._storeMfaContext(e,t.scope,t.audience),e}}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 _t(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,o=e.connection,r=e.scopes,i=e.authorization_params,s=e.redirectUri,a=void 0===s?this.options.authorizationParams.redirect_uri||window.location.origin:s;if(!o)throw new Error("connection is required");const c=$(Q()),u=Q(),l=await oe(u),d=ie(l),h=await this.myAccount.connectAccount({connection:o,scopes:r,redirect_uri:a,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:a,appState:n,connection:o,response_type:dt.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForPasskey(e){const t=e.audience||this.options.authorizationParams.audience,n=e.organization||this.options.authorizationParams.organization;return this._requestToken(Object.assign(Object.assign(Object.assign({grant_type:"urn:okta:params:oauth:grant-type:webauthn",auth_session:e.authSession,authn_response:e.credential},e.realm&&{realm:e.realm}),n&&{organization:n}),{scope:Xe(this.scope,e.scope,t),audience:t}))}async _requestTokenForMfa(e,t){const n=e.mfaToken,o=d(e,["mfaToken"]),r=await this.cacheManager.get(new Ve({scope:o.scope,audience:o.audience||D,clientId:this.options.clientId}),void 0,this.options.useMrrt),i=await this._requestToken(Object.assign(Object.assign({},o),{mfa_token:n}),t);return await this._propagateRotatedRefreshToken(null==r?void 0:r.refresh_token,i.refresh_token),i}}function pu(e,t){return function(){return e.apply(t,arguments)}}const{toString:fu}=Object.prototype,{getPrototypeOf:mu}=Object,{iterator:gu,toStringTag:wu}=Symbol,yu=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vu=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),bu=(e,t,n)=>e===Object.prototype||!n&&null===t,Au=(e,t)=>{let n=e;const o=[];for(;null!=n;){if(-1!==o.indexOf(n))return!1;o.push(n);const r=mu(n);if(bu(n,r,n===e))return!1;if(yu(n,t))return!0;n=r}return!1},Su=(_u=Object.create(null),e=>{const t=fu.call(e);return _u[t]||(_u[t]=t.slice(8,-1).toLowerCase())});var _u;const Eu=e=>(e=e.toLowerCase(),t=>Su(t)===e),Tu=e=>t=>typeof t===e,{isArray:ku}=Array,Ou=Tu("undefined");function Ru(e){return null!==e&&!Ou(e)&&null!==e.constructor&&!Ou(e.constructor)&&Nu(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Cu=Eu("ArrayBuffer");const Iu=Tu("string"),Nu=Tu("function"),Pu=Tu("number"),xu=e=>null!==e&&"object"==typeof e,Lu=e=>{if(!xu(e))return!1;const t=mu(e);return!(null!==t&&t!==Object.prototype&&null!==mu(t)||Au(e,wu)||Au(e,gu))}
vendor: 4,435 bytes, line 5
5,Uu=Eu("Date"),Mu=Eu("File"),Du=Eu("Blob"),ju=Eu("FileList"),Wu=Eu("Set");const Ku="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Gu=void 0!==Ku.FormData?Ku.FormData:void 0,Bu=Eu("URLSearchParams"),[Fu,Hu,Xu,Ju]=["ReadableStream","Request","Response","Headers"].map(Eu);function zu(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let o,r;if("object"!=typeof e&&(e=[e]),ku(e))for(o=0,r=e.length;o<r;o++)t.call(null,e[o],o,e);else{if(Ru(e))return;const r=n?Object.getOwnPropertyNames(e):Object.keys(e),i=r.length;let s;for(o=0;o<i;o++)s=r[o],t.call(null,e[s],s,e)}}function Vu(e,t){if(Ru(e))return null;t=t.toLowerCase();const n=Object.keys(e);let o,r=n.length;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Zu="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Yu=e=>!Ou(e)&&e!==Zu;const qu=(Qu="undefined"!=typeof Uint8Array&&mu(Uint8Array),e=>Qu&&e instanceof Qu);var Qu;const $u=Eu("HTMLFormElement"),{propertyIsEnumerable:el}=Object.prototype,tl=Eu("RegExp"),nl=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};zu(n,(n,r)=>{let i;!1!==(i=t(n,r,e))&&(o[r]=i||n)}),Object.defineProperties(e,o)};const ol=Eu("AsyncFunction"),rl=(il="function"==typeof setImmediate,sl=Nu(Zu.postMessage),il?setImmediate:sl?(al=`axios@${Math.random()}`,cl=[],Zu.addEventListener("message",({source:e,data:t})=>{e===Zu&&t===al&&cl.length&&cl.shift()()},!1),e=>{cl.push(e),Zu.postMessage(al,"*")}):e=>setTimeout(e));var il,sl,al,cl;const ul="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Zu):"undefined"!=typeof process&&process.nextTick||rl,ll=e=>null!=e&&Nu(e[gu]),dl={isArray:ku,isArrayBuffer:Cu,isBuffer:Ru,isFormData:e=>{if(!e)return!1;if(Gu&&e instanceof Gu)return!0;const t=mu(e);if(!t||t===Object.prototype)return!1;if(!Nu(e.append))return!1;const n=Su(e);return"formdata"===n||"object"===n&&Nu(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Cu(e.buffer),t},isString:Iu,isNumber:Pu,isBoolean:e=>!0===e||!1===e,isObject:xu,isPlainObject:Lu,isEmptyObject:e=>{if(!xu(e)||Ru(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Fu,isRequest:Hu,isResponse:Xu,isHeaders:Ju,isUndefined:Ou,isDate:Uu,isFile:Mu,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Du,isRegExp:tl,isFunction:Nu,isStream:e=>xu(e)&&Nu(e.pipe),isURLSearchParams:Bu,isTypedArray:qu,isFileList:ju,forEach:zu,merge:function e(...t){const{caseless:n,skipUndefined:o}=Yu(this)&&this||{},r={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=n&&"string"==typeof i&&Vu(r,i)||i,a=yu(r,s)?r[s]:void 0;Lu(a)&&Lu(t)?r[s]=e(a,t):Lu(t)?r[s]=e({},t):ku(t)?r[s]=t.slice():o&&Ou(t)||(r[s]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||Ru(n))continue;if(zu(n,i),"object"!=typeof n||ku(n))continue;const o=Object.getOwnPropertySymbols(n);for(let e=0;e<o.length;e++){const t=o[e];el.call(n,t)&&i(n[t],t)}}return r},extend:(e,t,n,{allOwnKeys:o}={})=>(zu(t,(t,o)=>{n&&Nu(t)?Object.defineProperty(e,o,{__proto__:null,value:pu(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:o}),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,o)=>{e.prototype=Object.create(t.prototype,o),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,o)=>{let r,i,s;const a={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)s=r[i],o&&!o(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&mu(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Su,kindOfTest:Eu,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const o=e.indexOf(t,n);return-1!==o&&o===n},toArray:e=>{if(!e)return null;if(ku(e))return e;let t=e.length;if(!Pu(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n}
vendor: 14,858 bytes, line 5
5,forEachEntry:(e,t)=>{const n=(e&&e[gu]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const o=[];for(;null!==(n=e.exec(t));)o.push(n);return o},isHTMLForm:$u,hasOwnProperty:yu,hasOwnProp:yu,hasOwnInPrototypeChain:Au,getSafeProp:(e,t)=>null!=e&&Au(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=mu(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(vu(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),o=Object.create(null),r=[];let i=e;for(;null!=i&&-1===r.indexOf(i);){r.push(i);const s=i===e?t:mu(i);if(bu(i,s,i===e))break;const a=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(i));for(const t of a)vu(t)||yu(o,t)||(n[t]=e[t],o[t]=!0);i=s}return n},reduceDescriptors:nl,freezeMethods:e=>{nl(e,(t,n)=>{if(Nu(e)&&["arguments","caller","callee"].includes(n))return!1;const o=e[n];Nu(o)&&(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={},o=e=>{e.forEach(e=>{n[e]=!0})};return ku(e)?o(e):o(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:Vu,global:Zu,isContextDefined:Yu,isSpecCompliantForm:function(e){return!!(e&&Nu(e.append)&&"FormData"===e[wu]&&e[gu])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(xu(e)){if(t.has(e))return;if(Ru(e))return e;if(!("toJSON"in e)){let o;if(t.add(e),Wu(e)){o=[];for(const t of e){const e=n(t);!Ou(e)&&o.push(e)}}else o=ku(e)?[]:{},zu(e,(e,t)=>{const r=n(e);!Ou(r)&&(o[t]=r)});return t.delete(e),o}}return e};return n(e)},isAsyncFn:ol,isThenable:e=>e&&(xu(e)||Nu(e))&&Nu(e.then)&&Nu(e.catch),setImmediate:rl,asap:ul,isIterable:ll,isSafeIterable:e=>null!=e&&Au(e,gu)&&ll(e)},hl=dl.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"]),pl=e=>{const t={};let n,o,r;return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),o=e.substring(r+1).trim();const i=dl.hasOwnProp(t,n);!n||i&&dl.hasOwnProp(hl,n)||("set-cookie"===n?i?t[n].push(o):t[n]=[o]:t[n]=i?t[n]+", "+o:o)}),t};n.dn(pl);const fl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ml=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function gl(e,t){return dl.isArray(e)?e.map(e=>gl(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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 wl(e){const t=Object.create(null);return dl.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>gl(e,ml))(e)}),t}const yl=Symbol("internals");function vl(e){return e&&String(e).trim().toLowerCase()}function bl(e){return!1===e||null==e?e:dl.isArray(e)?e.map(bl):(e=>gl(e,fl))(String(e))}const Al=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Sl(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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)}function _l(e,t,n,o,r){return dl.isFunction(o)?o.call(this,t,n):(r&&(t=n),dl.isString(t)?dl.isString(o)?-1!==t.indexOf(o):dl.isRegExp(o)?o.test(t):void 0:void 0)}class El{constructor(e){e&&this.set(e)}set(e,t,n){const o=this;function r(e,t,n){const r=vl(t);if(!r)return;const i=dl.findKey(o,r);(!i||void 0===o[i]||!0===n||void 0===n&&!1!==o[i])&&(o[i||t]=bl(e))}const i=(e,t)=>dl.forEach(e,(e,n)=>r(e,n,t));if(dl.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(dl.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(pl(e),t);else if(dl.isObject(e)&&dl.isSafeIterable(e)){let n,o,r=Object.create(null);for(const t of e){if(!dl.isArray(t))throw new TypeError("Object iterator must return a key-value pair");o=t[0],dl.hasOwnProp(r,o)?(n=r[o],r[o]=dl.isArray(n)?[...n,t[1]]:[n,t[1]]):r[o]=t[1]}i(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=vl(e)){const n=dl.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 o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}(e);if(dl.isFunction(t))return t.call(this,e,n);if(dl.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vl(e)){const n=dl.findKey(this,e);return!(!n||void 0===this[n]||t&&!_l(0,this[n],n,t))}return!1}delete(e,t){const n=this;let o=!1;function r(e){if(e=vl(e)){const r=dl.findKey(n,e);!r||t&&!_l(0,n[r],r,t)||(delete n[r],o=!0)}}return dl.isArray(e)?e.forEach(r):r(e),o}clear(e){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const r=t[n];e&&!_l(0,this[r],r,e,!0)||(delete this[r],o=!0)}return o}normalize(e){const t=this,n={};return dl.forEach(this,(o,r)=>{const i=dl.findKey(n,r);if(i)return t[i]=bl(o),void delete t[r];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(r):String(r).trim();s!==r&&delete t[r],t[s]=bl(o),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return dl.forEach(this,(n,o)=>{null!=n&&!1!==n&&(t[o]=e&&dl.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(){const e=this.get("set-cookie");return dl.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let o=0,r=!1,i=!1;function s(e){const r=Sl(n.slice(o,e)),i=r.indexOf("=");if(i<1)return;const s=Sl(r.slice(0,i));if(!Al.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const c=Sl(r.slice(i+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let o=1;o<t;o++){const r=e.charCodeAt(o);if(34===r)return e;if(92===r&&(o+=1,o>=t))return e;n+=e[o]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);r?i?i=!1:92===t?i=!0:34===t&&(r=!1):34===t?r=!0:44!==t&&59!==t||(s(e),o=e+1)}return s(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[yl]=this[yl]={accessors:{}}).accessors,n=this.prototype;function o(e){const o=vl(e);t[o]||(!function(e,t){const n=dl.toCamelCase(" "+t);["get","set","has"].forEach(o=>{Object.defineProperty(e,o+n,{__proto__:null,value:function(e,n,r){return this[o].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[o]=!0)}return dl.isArray(e)?e.forEach(o):o(e),this}}El.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),dl.reduceDescriptors(El.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),dl.freezeMethods(El);const Tl=El,kl="[REDACTED ****]";function Ol(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),o=[],r=e=>{if(null===e||"object"!=typeof e)return e;if(dl.isBuffer(e))return e;if(-1!==o.indexOf(e))return;let t;if(e instanceof Tl&&(e=e.toJSON()),o.push(e),dl.isArray(e))t=[],e.forEach((e,n)=>{const o=r(e);dl.isUndefined(o)||(t[n]=o)});else{if(!dl.isPlainObject(e)&&function(e){if(dl.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(dl.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return o.pop(),e;t=Object.create(null);for(const[o,i]of Object.entries(e)){const e=n.has(o.toLowerCase())?kl:r(i);dl.isUndefined(e)||(t[o]=e)}}return o.pop(),t};return r(e)}function Rl(e){try{return String(e)}catch(e){return""}}class Cl extends Error{static from(e,t,n,o,r,i){let s=e.message;!s&&dl.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map(e=>{try{return e&&e.message?Rl(e.message):Rl(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new Cl(s,t||e.code,n,o,r);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,o,r){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),o&&(this.request=o),r&&(this.response=r,this.status=r.status)}toJSON(){const e=this.config,t=e&&dl.hasOwnProp(e,"redact")?e.redact:void 0,n=dl.isArray(t)&&t.length>0?Ol(e,t):dl.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}}}Cl.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Cl.ERR_BAD_OPTION="ERR_BAD_OPTION",Cl.ECONNABORTED="ECONNABORTED",Cl.ETIMEDOUT="ETIMEDOUT",Cl.ECONNREFUSED="ECONNREFUSED",Cl.ERR_NETWORK="ERR_NETWORK",Cl.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Cl.ERR_DEPRECATED="ERR_DEPRECATED",Cl.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Cl.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Cl.ERR_CANCELED="ERR_CANCELED",Cl.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Cl.ERR_INVALID_URL="ERR_INVALID_URL",Cl.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Il=Cl;function Nl(e){return dl.isPlainObject(e)||dl.isArray(e)}function Pl(e){return dl.endsWith(e,"[]")?e.slice(0,-2):e}function xl(e,t,n){return e?e.concat(t).map(function(e,t){return e=Pl(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ll=dl.toFlatObject(dl,{},null,function(e){return/^is[A-Z]/.test(e)});const Ul=function(e,t,n){if(!dl.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const o=(e,t)=>{const o=dl.getSafeProp(n,e);return dl.isUndefined(o)?t:o},r=o("metaTokens",!0),i=o("visitor")||f,s=o("dots",!1),a=o("indexes",!1),c=o("Blob")||"undefined"!=typeof Blob&&Blob,u=o("maxDepth",100),l=c&&dl.isSpecCompliantForm(t),d=[];if(!dl.isFunction(i))throw new TypeError("visitor must be a function");function h(e){if(null===e)return"";if(dl.isDate(e))return e.toISOString();if(dl.isBoolean(e))return e.toString();if(!l&&dl.isBlob(e))throw new Il("Blob is not supported. Use a Buffer instead.");if(dl.isArrayBuffer(e)||dl.isTypedArray(e)){if(l&&"function"==typeof c)return new c([e]);throw new Il("Blob is not supported. Use a Buffer instead.",Il.ERR_NOT_SUPPORT)}return e}function p(e){if(e>u)throw new Il("Object is too deeply nested ("+e+" levels). Max depth: "+u,Il.ERR_FORM_DATA_DEPTH_EXCEEDED)}function f(e,n,o){let i=e;if(dl.isReactNative(t)&&dl.isReactNativeBlob(e))return t.append(xl(o,n,s),h(e)),!1;if(e&&!o&&"object"==typeof e)if(dl.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,o){if(!dl.isObject(o))return o;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(o),p(t+n.length-1),o})}(e,1);else if(dl.isArray(e)&&function(e){return dl.isArray(e)&&!e.some(Nl)}(e)||(dl.isFileList(e)||dl.endsWith(n,"[]"))&&(i=dl.toArray(e)))return n=Pl(n),i.forEach(function(e,o){!dl.isUndefined(e)&&null!==e&&t.append(!0===a?xl([n],o,s):null===a?n:n+"[]",h(e))}),!1;return!!Nl(e)||(t.append(xl(o,n,s),h(e)),!1)}const m=Object.assign(Ll,{defaultVisitor:f,convertValue:h,isVisitable:Nl});if(!dl.isObject(e))throw new TypeError("data must be an object");return function e(n,o,r=0){if(!dl.isUndefined(n)){if(p(r),-1!==d.indexOf(n))throw new Error("Circular reference detected in "+o.join("."));d.push(n),dl.forEach(n,function(n,s){!0===(!(dl.isUndefined(n)||null===n)&&i.call(t,n,dl.isString(s)?s.trim():s,o,m))&&e(n,o?o.concat(s):[s],r+1)}),d.pop()}}(e),t};function Ml(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Dl(e,t){this._pairs=[],e&&Ul(e,this,t)}const jl=Dl.prototype;jl.append=function(e,t){this._pairs.push([e,t])},jl.toString=function(e){const t=e?t=>e.call(this,t,Ml):Ml;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Wl=Dl;function Kl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Gl(e,t,n){if(!t)return e;e=e||"";const o=dl.isFunction(n)?{serialize:n}:n,r=dl.getSafeProp(o,"encode")||Kl,i=dl.getSafeProp(o,"serialize");let s;if(s=i?i(t,o):dl.isURLSearchParams(t)?t.toString():new Wl(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}const Bl=Symbol("internals");function Fl(e){return e?e.length:0}function Hl(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Xl(e,t){const n=e.handlers,o=Fl(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):o!==t.handlersLength&&(o?t.handlerEntries.forEach(function(e,o){n[e.index]!==e.handler&&t.handlerEntries.delete(o)}):t.handlerEntries.clear()),t.handlersLength=o}const Jl=class{constructor(){this.handlers=[],this[Bl]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const o={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},r=this[Bl];null==this.handlers&&(this.handlers=[]),Xl(this,r);const i=r.nextId++;return this.handlers.push(o),r.handlerEntries.set(i,{handler:o,index:this.handlers.length-1}),r.handlersLength=this.handlers.length,i}eject(e){const t=this[Bl];Xl(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(Hl(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Xl(this,this[Bl]))}forEach(e){const t=this[Bl];Xl(this,t),t.iterationDepth++;try{dl.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Xl(this,t),Hl(this.handlers),t.handlersLength=Fl(this.handlers))}}},zl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0}
vendor: 17,998 bytes, line 5
5,Vl={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Wl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Zl="undefined"!=typeof window&&"undefined"!=typeof document,Yl="object"==typeof navigator&&navigator||void 0,ql=Zl&&(!Yl||["ReactNative","NativeScript","NS"].indexOf(Yl.product)<0),Ql="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,$l=Zl&&window.location.href||"http://localhost",ed={...e,...Vl};function td(e){if(e>100)throw new Il("FormData field is too deeply nested ("+e+" levels). Max depth: 100",Il.ERR_FORM_DATA_DEPTH_EXCEEDED)}const nd=function(e){function t(e,n,o,r){td(r);let i=e[r++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=r>=e.length;if(i=!i&&dl.isArray(o)?o.length:i,a)return dl.hasOwnProp(o,i)?o[i]=dl.isArray(o[i])?o[i].concat(n):[o[i],n]:o[i]=n,!s;dl.hasOwnProp(o,i)&&dl.isObject(o[i])||(o[i]=[]);return t(e,n,o[i],r)&&dl.isArray(o[i])&&(o[i]=function(e){const t={},n=Object.keys(e);let o;const r=n.length;let i;for(o=0;o<r;o++)i=n[o],t[i]=e[i];return t}(o[i])),!s}if(dl.isFormData(e)&&dl.isFunction(e.entries)){const n={};return dl.forEachEntry(e,(e,o)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let o;for(;null!==(o=n.exec(e));)td(t.length),t.push("[]"===o[0]?"":o[1]||o[0]);return t}(e),o,n,0)}),n}return null},od=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),rd=(e,t)=>null!=e&&dl.hasOwnProp(e,t)?e[t]:void 0;const id={transitional:zl,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,r=dl.isObject(e);r&&dl.isHTMLForm(e)&&(e=new FormData(e));if(dl.isFormData(e))return o?JSON.stringify(nd(e)):e;if(dl.isArrayBuffer(e)||dl.isBuffer(e)||dl.isStream(e)||dl.isFile(e)||dl.isBlob(e)||dl.isReadableStream(e))return e;if(dl.isArrayBufferView(e))return e.buffer;if(dl.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(r){const t=rd(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ul(e,new ed.classes.URLSearchParams,{visitor:function(e,t,n,o){return ed.isNode&&dl.isBuffer(e)?(this.append(t,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=dl.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=rd(this,"env"),o=n&&n.FormData;return Ul(i?{"files[]":e}:e,o&&new o,t)}}return r||o?(t.setContentType("application/json",!1),function(e,t,n){if(dl.isString(e))try{return(t||JSON.parse)(e),dl.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=rd(this,"transitional")||id.transitional,n=t&&t.forcedJSONParsing,o=rd(this,"responseType"),r="json"===o;if(dl.isResponse(e)||dl.isReadableStream(e))return e;if(e&&dl.isString(e)&&(n&&!o||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,rd(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Il.from(e,Il.ERR_BAD_RESPONSE,this,null,rd(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ed.classes.FormData,Blob:ed.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};dl.forEach(od,e=>{id.headers[e]={}});const sd=id;function ad(e,t){const n=this||sd,o=t||n,r=Tl.from(o.headers);let i=o.data;return dl.forEach(e,function(e){i=e.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function cd(e){return!(!e||!e.__CANCEL__)}const ud=class extends Il{constructor(e,t,n){super(e??"canceled",Il.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ld(e,t,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new Il("Request failed with status code "+n.status,n.status>=400&&n.status<500?Il.ERR_BAD_REQUEST:Il.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const dd=/[\t\n\r]/g;function hd(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(dd,"")}function pd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const fd=function(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=o[s];r||(r=c),n[i]=a,o[i]=c;let l=s,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-r<t)return;const h=u&&c-u;return h?Math.round(1e3*d/h):void 0}};const md=function(e,t){let n,o,r=0,i=1e3/t;const s=(t,i=Date.now())=>{r=i,n=null,o&&(clearTimeout(o),o=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-r;a>=i?s(e,t):(n=e,o||(o=setTimeout(()=>{o=null,s(n)},i-a)))},()=>n&&s(n),(...e)=>s(e)]},gd=(e,t,n=3)=>{let o=0;const r=fd(50,250);return md(n=>{if(!n||!dl.isNumber(n.loaded))return;const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=Math.max(0,null!=s?Math.min(i,s):i),c=Math.max(0,a-o),u=r(c);o=Math.max(o,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},wd=(e,t)=>{const n=null!=e;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},yd=(e,t=dl.asap)=>(...n)=>t(()=>e(...n)),vd=ed.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ed.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ed.origin),ed.navigator&&/(msie|trident)/i.test(ed.navigator.userAgent)):()=>!0,bd=ed.hasStandardBrowserEnv?{write(e,t,n,o,r,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];dl.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),dl.isString(o)&&a.push(`path=${o}`),dl.isString(r)&&a.push(`domain=${r}`),!0===i&&a.push("secure"),dl.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const o=t[n].replace(/^\s+/,""),r=o.indexOf("=");if(-1!==r&&o.slice(0,r)===e)try{return decodeURIComponent(o.slice(r+1))}catch(e){return o.slice(r+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const Ad=/^https?:(?!\/\/)/i;function Sd(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${kl}@`),n=t.indexOf("#"),o=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${kl}`);return-1===n?o:`${o}#${r=t.slice(n+1),r?r.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${kl}`):r}`;var r}function _d(e,t){if("string"==typeof e){const n=hd(e);if(Ad.test(n))throw new Il(`Invalid URL ${JSON.stringify(Sd(n))}: missing "//" after protocol`,Il.ERR_INVALID_URL,t)}}function Ed(e,t,n,o){_d(t,o);let r=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(r||!1===n)?(_d(e,o),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const Td=e=>e instanceof Tl?{...e}:e;function kd(e,t){e=e||{},t=t||{};const n=Object.create(null);function o(e,t,n,o){return dl.isPlainObject(e)&&dl.isPlainObject(t)?dl.merge.call({caseless:o},e,t):dl.isPlainObject(t)?dl.merge({},t):dl.isArray(t)?t.slice():t}function r(e,t,n,r){return dl.isUndefined(t)?dl.isUndefined(e)?void 0:o(void 0,e,0,r):o(e,t,0,r)}function i(e,t){if(!dl.isUndefined(t))return o(void 0,t)}function s(e,t){return dl.isUndefined(t)?dl.isUndefined(e)?void 0:o(void 0,e):o(void 0,t)}function a(n,r,i){return dl.hasOwnProp(t,i)?o(n,r):dl.hasOwnProp(e,i)?o(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:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>r(Td(e),Td(t),0,!0)};var u;return dl.forEach((u={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(u).concat(Object.getOwnPropertySymbols(u).filter(e=>Object.getOwnPropertyDescriptor(u,e).enumerable)):Object.keys(u)),function(o){if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=dl.hasOwnProp(c,o)?c[o]:r,s=i(dl.hasOwnProp(e,o)?e[o]:void 0,dl.hasOwnProp(t,o)?t[o]:void 0,o);dl.isUndefined(s)&&i!==a||(n[o]=s)}),dl.hasOwnProp(t,"validateStatus")&&dl.isUndefined(t.validateStatus)&&!1===function(n){const o=dl.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!dl.isUndefined(o)){if(!dl.isPlainObject(o))return;if(dl.hasOwnProp(o,n))return o[n]}const r=dl.hasOwnProp(e,"transitional")?e.transitional:void 0;if(dl.isPlainObject(r)&&dl.hasOwnProp(r,n))return r[n]}("validateStatusUndefinedResolves")&&(dl.hasOwnProp(e,"validateStatus")?n.validateStatus=o(void 0,e.validateStatus):delete n.validateStatus),n}const Od=["content-type","content-length"];const Rd=function(e){const t=kd({},e),n=e=>dl.hasOwnProp(t,e)?t[e]:void 0,o=n("data");let r=n("withXSRFToken");const i=n("xsrfHeaderName"),s=n("xsrfCookieName");let a=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");if(t.headers=a=Tl.from(a),t.url=Gl(Ed(u,d,l,t),n("params"),n("paramsSerializer")),c){const t=dl.getSafeProp(c,"username")||"",n=dl.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw Il.from(t,Il.ERR_BAD_OPTION_VALUE,e)}}if(dl.isFormData(o)){const e=dl.getSafeProp(o,"getHeaders");ed.hasStandardBrowserEnv||ed.hasStandardBrowserWebWorkerEnv||dl.isReactNative(o)?a.setContentType(void 0):dl.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{Od.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(a,e.call(o),n("formDataHeaderPolicy"))}if(ed.hasStandardBrowserEnv){dl.isFunction(r)&&(r=r(t));if(!0===r||null==r&&vd(t.url)){const e=i&&s&&bd.read(s);e&&a.set(i,e)}}return t},Cd="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const o=Rd(e);let r=o.data;const i=Tl.from(o.headers).normalize();let s,a,c,u,l,d,{responseType:h,onUploadProgress:p,onDownloadProgress:f}=o;function m(){u&&u(),l&&l(),o.cancelToken&&o.cancelToken.unsubscribe(s),o.signal&&o.signal.removeEventListener("abort",s)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(pd(hd(o.url))||pd(ed.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new Il("Request aborted",Il.ECONNABORTED,e,g)),m(),void(g=null);try{r?d&&d(r):l&&l()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const i=Tl.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());ld(function(e){t(e),m()},function(e){n(e),m()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:i,config:e,request:g}),g=null}g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new Il("Request aborted",Il.ECONNABORTED,e,g)),m(),g=null)},g.onerror=function(t){const o=t&&t.message?t.message:"Network Error",r=new Il(o,Il.ERR_NETWORK,e,g);r.event=t||null,n(r),m(),g=null},g.ontimeout=function(){let t=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const r=o.transitional||zl;o.timeoutErrorMessage&&(t=o.timeoutErrorMessage),n(new Il(t,r.clarifyTimeoutError?Il.ETIMEDOUT:Il.ECONNABORTED,e,g)),m(),g=null},void 0===r&&i.setContentType(null),"setRequestHeader"in g&&dl.forEach(wl(i),function(e,t){g.setRequestHeader(t,e)}),dl.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),h&&"json"!==h&&(g.responseType=o.responseType),f&&([c,l,d]=gd(f,!0),g.addEventListener("progress",c)),p&&g.upload&&([a,u]=gd(p),g.upload.addEventListener("progress",a),g.upload.addEventListener("loadend",u)),(o.cancelToken||o.signal)&&(s=t=>{g&&(n(!t||t.type?new ud(null,e,g):t),g.abort(),m(),g=null)},o.cancelToken&&o.cancelToken.subscribe(s),o.signal&&(o.signal.aborted?s():o.signal.addEventListener("abort",s)));const y=pd(o.url);if(y&&!ed.protocols.includes(y))return n(new Il("Unsupported protocol "+y+":",Il.ERR_BAD_REQUEST,e)),void m();g.send(r||null)})},Id=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let o=!1;const r=function(e){if(!o){o=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Il?t:new ud(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,r(new Il(`timeout of ${t}ms exceeded`,Il.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)}),e=null)};e.forEach(e=>{o||(e.aborted?r.call(e):e.addEventListener("abort",r,{once:!0}))});const{signal:a}=n;return a.unsubscribe=()=>dl.asap(s),a},Nd=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let o,r=0;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Pd=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},xd=(e,t,n,o)=>{const r=async function*(e,t){for await(const n of Pd(e))yield*Nd(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,o&&o(e))};return new ReadableStream({async pull(e){try{const{done:t,value:o}=await r.next();if(t)return a(),void e.close();let i=o.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(o))}catch(e){throw a(e),e}},cancel:e=>(a(e),r.return())},{highWaterMark:2})},Ld=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Ud=(e,t,n)=>t+2<n&&Ld(e.charCodeAt(t+1))&&Ld(e.charCodeAt(t+2)),Md=e=>e<=57?e-48:(223&e)-55,Dd=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,jd=e=>9===e||10===e||12===e||13===e||32===e,Wd=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Kd=e=>{const t=e.length;let n=0,o=0,r=!1;for(let i=0;i<t;i++){let s=e.charCodeAt(i);37===s&&Ud(e,i,t)&&(s=16*Md(e.charCodeAt(i+1))+Md(e.charCodeAt(i+2)),i+=2),jd(s)||(61!==s?!Dd(s)||o>0?r=!0:n++:o++)}return r||o>2||o>0&&(n+o)%4!=0||n%4==1?Wd(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Gd=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const o=e.slice(5,n),r=e.slice(n+1);if(/;base64/i.test(o))return t(r);let i=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);if(37===n&&Ud(r,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const Bd={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Fd}=dl,Hd=e=>{if(!dl.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Xd=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Jd=e=>{const t=void 0!==dl.global&&null!==dl.global?dl.global:globalThis,{ReadableStream:n,TextEncoder:o}=t;e=dl.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:r,Request:i,Response:s}=e,a=r?Fd(r):"function"==typeof fetch,c=Fd(i),u=Fd(s);if(!a)return!1;const l=a&&Fd(n),d=a&&("function"==typeof o?(h=new o,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&Xd(()=>{let e=!1;const t=new i(ed.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),o=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!o}),f=u&&l&&Xd(()=>dl.isReadableStream(new s("").body)),m={stream:f&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let o=t&&t[e];if(o)return o.call(t);throw new Il(`Response type '${e}' is not supported`,Il.ERR_NOT_SUPPORT,n)})});const g=async e=>{if(null==e)return 0;if(dl.isBlob(e))return e.size;if(dl.isSpecCompliantForm(e)){const t=new i(ed.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return dl.isArrayBufferView(e)||dl.isArrayBuffer(e)?e.byteLength:(dl.isURLSearchParams(e)&&(e+=""),dl.isString(e)?(await d(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:a,signal:u,cancelToken:d,timeout:h,onDownloadProgress:w,onUploadProgress:y,responseType:v,headers:b,withCredentials:A="same-origin",fetchOptions:S,maxContentLength:_,maxBodyLength:E,maxRedirects:T}=Rd(e);const k=dl.isNumber(_)&&_>-1,O=dl.isNumber(E)&&E>-1;let R=r||fetch;v=v?(v+"").toLowerCase():"text";let C=Id([u,d&&d.toAbortSignal()],h),I=null;const N=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let P,x=null;const L=()=>new Il("Request body larger than maxBodyLength limit",Il.ERR_BAD_REQUEST,e,I);try{let r;const u=(M="auth",dl.hasOwnProp(e,M)?e[M]:void 0);if(u){const e=dl.getSafeProp(u,"username")||"";r={username:e,password:dl.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,ed.origin);if(!r&&(e.username||e.password)){const t=Hd(e.username);r={username:t,password:Hd(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(r&&(b.delete("authorization"),b.set("Authorization","Basic "+btoa((U=(r.username||"")+":"+(r.password||""),encodeURIComponent(U).replace(/%([0-9A-F]{2})/gi,(e,t)=>
vendor: 10,692 bytes, line 5
5String.fromCharCode(parseInt(t,16))))))),k&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Gd(-1===t?e:e.slice(0,t),Kd)}(t);if(n>_)throw new Il("maxContentLength size of "+_+" exceeded",Il.ERR_BAD_RESPONSE,e,I)}if(O&&"get"!==n&&"head"!==n){const e=await g(a);if("number"==typeof e&&isFinite(e)&&(P=e,e>E))throw L()}const d=O&&(dl.isReadableStream(a)||dl.isStream(a)),h=(e,t,n)=>xd(e,65536,e=>{if(O&&e>E)throw x=L();t&&t(e)},n);if(p&&"get"!==n&&"head"!==n&&(y||d)){if(P=P??await(async(e,t)=>{const n=dl.toFiniteNumber(e.getContentLength());return n??g(t)})(b,a),0!==P||d){let e,n=new i(t,{method:"POST",body:a,duplex:"half"});if(dl.isFormData(a)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=y&&wd(P,gd(yd(y)))||[];a=h(n.body,e,t)}}}else if(d&&!c&&l&&"get"!==n&&"head"!==n)a=h(a);else if(d&&c&&!p&&"get"!==n&&"head"!==n)throw new Il("Stream request bodies are not supported by the current fetch implementation",Il.ERR_NOT_SUPPORT,e,I);dl.isString(A)||(A=A?"include":"omit");const D=c&&"credentials"in i.prototype;if(dl.isFormData(a)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/1.20.0",!1);const j=null==S?S:Object.assign(Object.create(null),S);j&&(delete j.body,delete j.headers,delete j.method,delete j.signal,delete j.duplex,delete j.credentials);const W=Object.assign(Object.create(null),j,{signal:C,method:n.toUpperCase(),headers:wl(b.normalize()),body:a,duplex:"half",credentials:D?A:void 0});c&&(dl.forEach(Bd,(e,t)=>{void 0===W[t]&&(W[t]=e)}),void 0===W.signal&&(W.signal=null),void 0===W.body&&(W.body=null)),0===T&&(W.redirect="manual",j&&(j.redirect="manual")),I=c&&new i(t,W);let K=await(c?R(I,j):R(t,W));const G=Tl.from(K.headers);if(k){const t=dl.toFiniteNumber(G.getContentLength());if(null!=t&&t>_)throw new Il("maxContentLength size of "+_+" exceeded",Il.ERR_BAD_RESPONSE,e,I)}const B=f&&("stream"===v||"response"===v);if(f&&K.body&&(w||k||B&&N)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=K[e]});const n=dl.toFiniteNumber(G.getContentLength()),[o,r]=w&&wd(n,gd(yd(w),!0))||[];let i=0;const a=t=>{if(k&&(i=t,i>_))throw new Il("maxContentLength size of "+_+" exceeded",Il.ERR_BAD_RESPONSE,e,I);o&&o(t)};K=new s(xd(K.body,65536,a,()=>{r&&r(),N&&N()}),t)}v=v||"text";let F=await m[dl.findKey(m,v)||"text"](K,e);if(k&&!f&&!B){let t;if(null!=F&&("number"==typeof F.byteLength?t=F.byteLength:"number"==typeof F.size?t=F.size:"string"==typeof F&&(t="function"==typeof o?(new o).encode(F).byteLength:F.length)),"number"==typeof t&&t>_)throw new Il("maxContentLength size of "+_+" exceeded",Il.ERR_BAD_RESPONSE,e,I)}return!B&&N&&N(),await new Promise((t,n)=>{ld(t,n,{data:F,headers:Tl.from(K.headers),status:K.status,statusText:K.statusText,config:e,request:I})})}catch(t){if(N&&N(),C&&C.aborted&&C.reason instanceof Il){const n=C.reason;throw n.config=e,I&&(n.request=I),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(x)throw I&&!x.request&&(x.request=I),x;if(t instanceof Il)throw I&&!t.request&&(t.request=I),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new Il("Network Error",Il.ERR_NETWORK,e,I,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw Il.from(t,t&&t.code,e,I,t&&t.response)}var U,M}},zd=new Map,Vd=e=>{let t=e&&e.env||{};const{fetch:n,Request:o,Response:r}=t,i=[o,r,n];let s,a,c=i.length,u=zd;for(;c--;)s=i[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Jd(t)),u=a;return a},Zd=(Vd(),{http:null,xhr:Cd,fetch:{get:Vd}});dl.forEach(Zd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Yd=e=>`- ${e}`,qd=e=>dl.isFunction(e)||null===e||!1===e;const Qd={getAdapter:function(e,t){e=dl.isArray(e)?e:[e];const{length:n}=e;let o,r;const i={};for(let s=0;s<n;s++){let n;if(o=e[s],r=o,!qd(o)&&(r=Zd[(n=String(o)).toLowerCase()],void 0===r))throw new Il(`Unknown adapter '${n}'`);if(r&&(dl.isFunction(r)||(r=r.get(t))))break;i[n||"#"+s]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`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(Yd).join("\n"):" "+Yd(e[0]):"as no adapter specified";throw new Il("There is no suitable adapter to dispatch the request "+t,Il.ERR_NOT_SUPPORT)}return r},adapters:Zd};function $d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ud(null,e)}function eh(e){const t=dl.toSafeFlatObject(e);$d(t),t.headers=Tl.from(dl.getSafeProp(t,"headers")),t.data=ad.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Qd.getAdapter(t.adapter||sd.adapter,t)(t).then(function(e){$d(t),t.response=e;try{e.data=ad.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=Tl.from(e.headers),e},function(e){if(!cd(e)&&($d(t),e&&e.response)){t.response=e.response;try{e.response.data=ad.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=Tl.from(e.response.headers)}return Promise.reject(e)})}const th={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{th[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nh={};th.transitional=function(e,t,n){function o(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,i)=>{if(!1===e)throw new Il(o(r," has been removed"+(t?" in "+t:"")),Il.ERR_DEPRECATED);return t&&!nh[r]&&(nh[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,i)}},th.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const oh={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new Il("options must be an object",Il.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const i=o[r],s=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new Il("option "+i+" must be "+n,Il.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Il("Unknown option "+i,Il.ERR_BAD_OPTION)}},validators:th},rh=oh.validators;class ih{constructor(e){this.defaults=e||{},this.interceptors={request:new Jl,response:new Jl}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let o="";if("string"==typeof n){const e=n.indexOf("\n");o=-1===e?"":n.slice(e+1)}if(e.stack){if(o){const t=o.indexOf("\n"),n=-1===t?-1:o.indexOf("\n",t+1),r=-1===n?"":o.slice(n+1);String(e.stack).endsWith(r)||(e.stack+="\n"+o)}}else e.stack=o}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=kd(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:r}=t;void 0!==n&&oh.assertOptions(n,{silentJSONParsing:rh.transitional(rh.boolean),forcedJSONParsing:rh.transitional(rh.boolean),clarifyTimeoutError:rh.transitional(rh.boolean),legacyInterceptorReqResOrdering:rh.transitional(rh.boolean),advertiseZstdAcceptEncoding:rh.transitional(rh.boolean),validateStatusUndefinedResolves:rh.transitional(rh.boolean)},!1),null!=o&&(dl.isFunction(o)?t.paramsSerializer={serialize:o}:oh.assertOptions(o,{encode:rh.function,serialize:rh.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),oh.assertOptions(t,{baseUrl:rh.spelling("baseURL"),withXsrfToken:rh.spelling("withXSRFToken")},!0),t.method=(dl.getSafeProp(t,"method")||dl.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=r&&dl.merge(r.common,r[t.method]);r&&dl.forEach(od.concat("common"),e=>{delete r[e]}),t.headers=Tl.concat(i,r);const s=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||zl;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.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(!a){const e=[eh.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=s.length;let h=t;for(;d<l;){const e=s[d++],t=s[d++];try{h=e?e(h):h}catch(e){if(!t){u=Promise.reject(e);break}try{const n=t.call(this,e);dl.isThenable(n)&&(u=Promise.resolve(n).then(()=>eh.call(this,h)))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=eh.call(this,h)}catch(e){u=Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return Gl(Ed((e=kd(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}dl.forEach(["delete","get","head","options"],function(e){ih.prototype[e]=function(t,n){return this.request(kd(n||{},{method:e,url:t,data:n&&dl.hasOwnProp(n,"data")?n.data:void 0}))}}),dl.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,o,r){return this.request(kd(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}ih.prototype[e]=t(),"query"!==e&&(ih.prototype[e+"Form"]=t(!0))});const sh=ih;class ah{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{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 o=new Promise(e=>{n.subscribe(e),t=e}).then(e);return o.cancel=function(){n.unsubscribe(t)},o},e(function(e,o,r){n.reason||(n.reason=new ud(e,o,r),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 ah(function(t){e=t});return{token:t,cancel:e}}}const ch=ah;const uh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
5alContent: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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(uh).forEach(([e,t])=>{void 0===uh[t]&&(uh[t]=e)});const lh=uh;const dh=function e(t){const n=new sh(t),o=pu(sh.prototype.request,n);return dl.extend(o,sh.prototype,n,{allOwnKeys:!0}),dl.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(kd(t,n))},o}(sd);dh.Axios=sh,dh.CanceledError=ud,dh.CancelToken=ch,dh.isCancel=cd,dh.VERSION="1.20.0",dh.toFormData=Ul,dh.AxiosError=Il,dh.Cancel=dh.CanceledError,dh.all=function(e){return Promise.all(e)},dh.spread=function(e){return function(t){return e.apply(null,t)}},dh.isAxiosError=function(e){return dl.isObject(e)&&!0===e.isAxiosError},dh.mergeConfig=kd,dh.AxiosHeaders=Tl,dh.formToJSON=e=>nd(dl.isHTMLForm(e)?new FormData(e):e),dh.getAdapter=Qd.getAdapter,dh.HttpStatusCode=lh,dh.default=dh;const hh=dh;var ph=n(3153),fh=n(3612);const mh={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 gh=n(3029),wh=n(2901),yh=function(){function e(){(0,gh.A)(this,e),(0,i.A)(this,"readyPromise",null),(0,i.A)(this,"readyResolved",!1),(0,i.A)(this,"readyValue",!1)}return(0,wh.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,o=Date.now();if(this.readyResolved&&!0===this.readyValue)return ph.A.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return ph.A.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var r=null!=n?n:e.DEFAULT_TIMEOUT;return ph.A.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(ph.A.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-o)/1e3,"s"),t.resolveReady(!1,e))},r);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return ph.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){ph.A.log("BlueConicUtils | blueConicReady | BC client detected");var r=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),ph.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-o)/1e3,"s"),null==r||r(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(ph.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)(yh,"DEFAULT_TIMEOUT",3e3);const vh=new yh;var bh,Ah;function Sh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function _h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
5t%2?Sh(Object(n),!0).forEach(function(t){(0,i.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){bh||(bh=e,Ah&&(ph.A.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",Ah),window.dispatchEvent(Ah)))}),ph.A.log("Waiting for islands ready");var Eh=function(){var e=window.location.href;return new URL(e)},Th=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),o=0;o<n.length;o+=1){var r=n[o].trimLeft();if(0===r.indexOf(t))return r.substring(t.length,r.length)}return!1},kh=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=Eh().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])},Oh=function(){var e=kh();return".".concat(e)},Rh=function(e,t,n){var o="".concat(e,"=").concat(t,";");void 0!==n?(ph.A.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=c(e,2),n=t[0],r=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),o+="expires=".concat(i.toUTCString(),";")}else o+="".concat(n,"=").concat(r,";")})):o+="path=/;",document.cookie=o},Ch=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),r=kh(),i=[r,"www".concat(r),".www".concat(r)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=c(e,2),n=t[0],r=t[1];o+="".concat(n,"=").concat(r,";")}),0===Object.keys(t).length&&(o+="path=/;"),document.cookie=o,i.forEach(function(e){document.cookie=o.concat("domain=",e,";")})},Ih=function(){return Eh().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Nh=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,o=e.split(".")[n];if("string"!=typeof o)throw new u(`Invalid token specified: missing part #${n+1}`);let r;try{r=l(o)}catch(e){throw new u(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new u(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},Ph=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=kh().split(".")[0],e.prev=1,e.next=2,hh({method:"get",url:"".concat(fh.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return ph.A.log("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,i=e.catch(1),ph.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)}}(),xh=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,hh({method:"get",url:"".concat(fh.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(Ih())),headers:{"X-Api-Key":fh.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)}}(),Lh=function(){return"complete"===document.readyState},Uh=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var r=!0;if(Lh())n();else{ph.A.log("UIHandler: ","Waiting for the body to load...");var i=setInterval((0,t.A)(o.mark(function t(){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(r=Lh()),document.querySelector("body")&&r&&(clearInterval(i),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},Mh=function(){return new Promise(function(e){if(("interactive"===document.readyState||Lh())&&window.dataLayer)ph.A.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{ph.A.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval((0,t.A)(o.mark(function t(){return o.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)}})},Dh=function(){var e=(0,t.A)(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,Mh();case 1:return ph.A.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",ph.A.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return ph.A.log("Utils dataLayerLoop:  look for this element ",e),e[t]?(ph.A.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(ph.A.log("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)}}(),jh=function(){var e=(0,t.A)(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,Dh(t);case 1:return n=e.sent,ph.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)}}(),Wh=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ph.A.log("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return ph.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(){ph.A.log("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),ph.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)}}(),Kh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,vh.blueConicReady();case 1:if(t=e.sent,ph.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,Wh();case 2:if(n=e.sent,ph.A.log("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return r=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){r.loadValues(["auth0_id"],null,function(){e()})});case 4:return i=r.getValue("auth0_id"),ph.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)}}(),Gh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i,s,a,c,u,l,d=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>
50&&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,vh.blueConicReady();case 1:if(s=e.sent,ph.A.log("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(a=window.blueConicClient.getSegments(),ph.A.log("bcLowaCheck | BC segments for users: ",a),c=a.filter(function(e){return i.includes(e.name)}),ph.A.log("bcLowaCheck | BC userSubSegments: ",c),!(c.length>0)){e.next=3;break}return e.next=2,Kh();case 2:(u=e.sent)&&(n=!0,r=u);case 3:return t&&n&&Bh(),l={isSub:n},r&&(l.uuid=r),e.abrupt("return",l);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Bh=function(){Rh("bc_lowa_status",1,{path:"/",domain:Oh(),expires:7,secure:!0})},Fh=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(ph.A.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(ph.A.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var o=n.detail||{};ph.A.log("utils | Event: authentication ready: ",o),e(o)}catch(e){ph.A.log(e),t(e)}},!1))})},Hh=function(){var e=(0,t.A)(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 fh.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(ph.A.log("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var o=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=o,ph.A.log("Received entitlementsReady event:",o),e(o)}catch(e){ph.A.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(ph.A.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Xh=function(){Ch(mh.AUTH0_SUB_COOKIE_KEY),Ch("mng-jwt-decoded"),localStorage.removeItem(mh.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){ph.A.log("Clearing entitlements...");try{Ch(mh.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){ph.A.log("Failed to delete legacy cookie: ",e)}try{Ch(mh.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:kh(),expires:365,secure:!0})}catch(e){ph.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(mh.LOCAL_STORAGE_SESSION_KEY)}catch(e){ph.A.log("Failed to remove local storage: ",e)}}()},Jh=function(e){ph.A.log("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),ph.A.log("Storage Object removed : ",e))},zh=function(e){ph.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","COMM
5BANK","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","SO
5CIAL","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 ph.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=zh;var Vh;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Zh=function(){var e=(0,t.A)(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Vh){e.next=1;break}return e.abrupt("return",Vh);case 1:return t=fh.A.auth0Domain,n=fh.A.auth0ClientId,Vh=new hu({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",Vh);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Yh=function(e){Ah=new CustomEvent("mng-auth-check-complete",{detail:e}),bh?(ph.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(Ah)):ph.A.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return Yh(e.detail)});var qh=function(e){ph.A.log("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,ph.A.log("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),ph.A.log("utils | Dispatched authenticationReady event"),Yh(e)};var Qh=function(e){fh.A.datadogEnabled&&window.DD_RUM.addTiming(e)},$h=function(){var e=(0,t.A)(o.mark(function e(t){var n,i,s,a,c,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,ph.A.log("deleteUserCache","Setting up cache deletion for ".concat(t)),n=Ih(),p
5h.A.log("deleteUSerCache","Domain is: ".concat(n)),i={publication:n,uuid:t},e.next=1,hh({method:"DELETE",url:"".concat(fh.A.entitlementsEndpoint,"session/create"),data:i,headers:{"X-Api-Key":fh.A.entitlementsApiKey}});case 1:if(s=e.sent,a=s.data,c=/Succesfully deleted/i,!("object"===(0,r.A)(a)&&Object.prototype.hasOwnProperty.call(a,"message"))||!c.test(a.message)){e.next=2;break}return ph.A.log("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return ph.A.log("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(a)),e.abrupt("return",{success:!1});case 3:return e.prev=3,u=e.catch(0),ph.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)}}(),ep=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,r){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=(0,t.A)(o.mark(function t(){var s,a,c,u,l,d,h,p,f,m,g;return o.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 i.sspw=!0,t.abrupt("return",n({paywall:!0,details:_h({},i)}));case 1:return t.next=2,jh();case 2:return c=t.sent,t.next=3,Dh("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,Hh();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===(a=window.ConnextUtils)||void 0===a?void 0:a.runningSophi,ph.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:_h({},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:_h({},i)}));case 13:t.prev=13,g=t.catch(0),r(g);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=ep);function tp(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(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 np=function(){function e(){(0,gh.A)(this,e),(0,i.A)(this,"pendingSets",new Map),(0,i.A)(this,"flushTimer",null),(0,i.A)(this,"hasFlushed",!1),(0,i.A)(this,"isPaused",!1)}return(0,wh.A)(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,ph.A.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){ph.A.error("AdmiralUtils | pauseTargeting | failed",e)}else ph.A.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)ph.A.log('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return ph.A.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
5try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),ph.A.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),ph.A.log("AdmiralUtils | flush | targeting ready.")}catch(e){ph.A.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)ph.A.log("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),ph.A.log("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();(0,i.A)(np,"DEFAULT_READY_DELAY_MS",2e3);var op=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,vh.blueConicReady();case 1:return e.next=2,Fh();case 2:return e.abrupt("return",new Promise(function(e){ph.A.log("ANALYTICS: inside BCregwall events");var t=Eh();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)}}(),rp=function(e){try{window.dataLayer.push({event:e}),ph.A.log("ANALYTICS: ".concat(e," event")),ph.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){ph.A.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var ip=n(1834),sp=function(){try{var e=localStorage.getItem(mh.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){ph.A.log("Unable to get session from local storage: ",e)}return"{}"},ap=function(e){try{ph.A.log("Setting local storage session",e),localStorage.setItem(mh.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){ph.A.log("Unable to save session from local storage: ",e)}},cp=function(e){try{Rh(mh.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:Oh(),expires:365,secure:!0})}catch(e){ph.A.log("Unable to save session to cookie storage: ",e)}},up=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i,s,a,c,u,l,d,h,p,f,m,g,w,y,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=fh.A.sessionServer,n="".concat(t,"/api/session"),ph.A.log("Checking server session: ",n),e.next=1,hh.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return l=r.data.entitlementTokenDecoded,d=r.data,h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=null!==(i=null==l?void 0:l.entitlement_expiry)&&void 0!==i?i:null,g=null!==(s=null==l?void 0:l.entitlement_source)&&void 0!==s?s:null,w=null!==(a=null==l?void 0:l.entitlement_entitled)&&void 0!==a?a:null,y=null!==(c=null==l?void 0:l.entitlement_extras_adfree)&&void 0!==c?c:null,v=null!==(u=null==l?void 0:l.entitlement_level)&&void 0!==u?u:null,ap(JSON.stringify({accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:g,isEntitled:w,adFree:y,entitlementLevel:v})),""!==f&&"string"==typeof f&&cp(f),e.abrupt("return",{accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:g,isEntitled:w,adFree:y,entitlementLevel:v});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)}}(),lp=function(){var e=(0,t.A)(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=fh.A.sessionServer,r="".concat(n,"/api/session"),ph.A.log("Updating server session: ",r),e.next=1,hh.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),ph.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)}}(),dp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=fh.A.sessionServer,n="".concat(t,"/api/session"),ph.A.log("Deleting server session: ",n),e.next=1,hh.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),ph.A.log("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),hp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i,s,a,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E,T,k,O,R,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ph.A.log("Inside getSession"),e.prev=1,l=sp(),ph.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,w=d.isEntitled,y=d.adFree,v=d.entitlementLevel,n=h,t=p,r=f,i=m,s=g,a=w,c=y,u=v,ph.A.log("Session: check both tokens: ",t,r),void 0!==p&&void 0!==f&&null!==p&&null!==f){e.next=3;break}
5return ph.A.log("Session: missing id or entitlements, try session server"),e.next=2,up();case 2:b=e.sent,A=b.accessToken,S=b.idToken,_=b.entitlementToken,E=b.expiration,T=b.entitlementSource,k=b.isEntitled,O=b.adFree,R=b.entitlementLevel,n=A,t=S,r=_,i=E,s=T,a=k,c=O,u=R;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),ph.A.log("Failed to get session: ",C);case 5:return ph.A.log("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:s,isEntitled:a,adFree:c,entitlementLevel:u});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),pp=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,i,s,a,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E,T,k,O,R,C,I,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=sp(),r=JSON.parse(n),i=r.accessToken,s=void 0===i?null:i,a=r.idToken,c=void 0===a?null:a,u=r.entitlementToken,l=void 0===u?null:u,d=r.expiration,h=void 0===d?null:d,p=r.entitlementSource,f=void 0===p?null:p,m=r.isEntitled,g=void 0===m?null:m,w=r.adFree,y=void 0===w?null:w,v=r.entitlementLevel,b=void 0===v?null:v,A=t.accessToken,S=t.idToken,_=t.entitlementToken,E=t.expiration,T=t.entitlementSource,k=t.isEntitled,O=t.adFree,R=t.entitlementLevel,C={accessToken:A??s,idToken:S??c,entitlementToken:_??l,expiration:E??h,entitlementSource:T??f,isEntitled:k??g,adFree:O??y,entitlementLevel:R??b},ph.A.log("Current session data: ",r),ph.A.log("New session data: ",t),ph.A.log("Updated session data:",C),I=JSON.stringify(C),ap(I),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&cp(C.entitlementToken),n===I){e.next=1;break}return e.next=1,lp(C);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),ph.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)}}(),fp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return ph.A.log("Ending session..."),Xh(),e.next=1,dp();case 1:localStorage.removeItem(mh.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),mp="1"===window.authentication_config.isEmbedLoginEnabled,gp=function(){return"logout"===(Eh().searchParams.get("state")||"").toLowerCase()};mp||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var wp=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Zh();case 1:n=e.sent,ph.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)}}(),yp=function(){ph.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){ph.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=/")}},vp=function(){return new Promise(function(e){ph.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},bp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i,s,a,c,u,l,d;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ph.A.log("Attempting to logout..."),yp(),ph.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(mh.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(r=n?Nh(n):"")){e.next=2;break}return i=r.auth0Id,e.next=1,$h(i);case 1:e.sent.success?ph.A.log("User cache cleared."):ph.A.log("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,fp();case 3:e.next=5;break;case 4:Xh();case 5:return e.prev=5,ph.A.log("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:ph.A.log("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,d=e.catch(5),ph.A.log("Failed to cycle through logout callbacks: ",d);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}
5).forEach(function(e){window.localStorage.removeItem(e),ph.A.log("Removed Auth0 storage object...")}),Jh("hhsl"),Jh("userNewsLetterData"),Jh(mh.REGWALL_USER_IS_SUBSCRIBED),Jh(mh.USER_PROFILE_HASH),a=Eh(),c=window.location.origin;try{a.searchParams.get("returnURL")&&(u=decodeURIComponent(a.searchParams.get("returnURL")),c=u)}catch(e){ph.A.log(e),c=window.location.origin}return c=new URL(c),e.next=9,window.ConnextUtils.connextReady("onInit",ip.A.defaultTimeoutLength);case 9:if(!e.sent){e.next=11;break}return ph.A.log("Auth | Connext silent mode enabled ",Connext.GetOptions().Silentmode),ph.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,vp();case 10:e.next=12;break;case 11:ph.A.log("Connext Logout was NOT called");case 12:return ph.A.log("Calling Auth0 logout now."),e.next=13,wp(c);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Ap=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},Sp=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return rp(e)}),ph.A.log("Cycled through preauth GTM events.")},_p=function(){var e=(0,t.A)(o.mark(function e(t,n,r,i,s){var a,c,u,l,d,h,p,f,m,g,w,y,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return ph.A.log("Attempting to login..."),Ap()>4.5&&window.localStorage.clear(),Sp(),i&&(a=[],c=window.localStorage.getItem("callbackEvents"),u=JSON.parse(c),a=u&&u.length>0?tp(new Set([].concat(tp(i),tp(u)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(a))),l=null,e.next=1,Zh();case 1:if(d=e.sent,h=Eh(),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")):s&&f.searchParams.set("auth_redirect",s):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,fp();case 2:e.next=4;break;case 3:Xh();case 4:return null!==(l=h.searchParams.get("login-with"))?m.connection=l:n&&(m.connection=n),w="none",t&&"regwall"===t&&(f.searchParams.set("regwall","true"),w="signUp",ph.A.log("Logging in with regwall")),t&&(f.searchParams.set("loginsource",t),ph.A.log("Logging in with ".concat(t))),r&&(m.login_hint=r),m.redirect_uri=f.toString(),m.initialScreen=w,"googleonetap"!==t&&(m.prompt="select_account"),null!==(y=h.searchParams.get("ampRegiWall"))&&(v=window.location.hostname,m.ampRegiWall=y,m.sourceDomain=v.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,o,r,i){return e.apply(this,arguments)}}(),Ep=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),o=JSON.parse(n);if(!o||0===o.length)return void e();ph.A.log("Adding listeners to events we need to wait for...");var r=o.map(function(e){return t=e,new Promise(function(e){ph.A.log("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var o=n.detail||{};ph.A.log("Event: ".concat(t,"} ready: "),o),e(o)}catch(t){ph.A.log(t),e()}},!1)});var t});Promise.all(r).then(function(){clearTimeout(t),e()})}catch(t){ph.A.log("Failed to wait for callback events",t),e()}})},Tp=function(){var e=(0,t.A)(o.mark(function e(){var n,r,i,s,a,c,u,l,d,h,p,f,m,g,w,y,v,b,A,S,_,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(yp(),n=Eh(),r=!1,i=n.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=n.searchParams.get("redirect_uri")||"",s.includes("applenews")?(ph.A.log("This is Apple prelogin flow."),(a=new URL(s))?(a.searchParams.append("post-apple-login","true"),ph.A.log("Post callback Apple redirect URL is ".concat(a)),_p(!1,!1,!1,[],a)):_p()):i.includes("post-apple-login")&&(ph.A.log("This is Apple Callback flow."),r=!0,(c=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=c),ph.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",_p(!1,!1,!1,!1,i));case 1:r&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Zh();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,ph.A.log("Auth0 user profile: ",h),p=d.__raw,e.next=7,l.getTokenSilently();case 7:return f=e.sent,e.prev=8,ph.A.log("Cycling through login callbacks..."),e.next=9,Ep();case 9:return m=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(p));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(m);case 10:ph.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),ph.A.log("Failed to cycle through login callbacks: ",S);case 12:if(g={accessToken:f,userId:h.sub,email:h.email,picture:h.picture},w=!1,y="",!r){e.next=17;break}return e.prev=13,e.next=14,xh(g.userId);case 14:return y=e.sent,ph.A.log("Encrypted apple uuid is: ".concat(y)),e.next=15,Ph(y);case 15:w=e.sent,ph.A.log("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,_=e.catch(13),ph.A.log("Apple sub check error: ".concat(_)),alert("There was an error in logging you in, please try again.");case 17:if(Jh(mh.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}
5return ph.A.log("Saving idToken to session server"),e.next=18,pp({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 v=n.searchParams.get("loginsource"),b=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(v));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(b);case 20:return e.prev=20,A=new URL(i),r&&w&&A.searchParams.append("access_token",y),ph.A.log("Apple redirect URL:",A),e.abrupt("return",window.location.assign(A));case 21:return e.prev=21,E=e.catch(20),ph.A.log("Failed to redirect after authentication: ",E),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)}}(),kp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return ph.A.log("ANALYTICS: fireBC events"),e.next=1,op();case 1:ph.A.log("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Op=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,i,s,a,c,u,l,d,h,p,f;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Fh();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=Nh(n),a=s.email,c=s.picture,u=s.sub,l=s.name,d=s.nickname,h=s.connection_source,p=null===(i=s.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,u.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:p||d||l,email:a,picture:c,userId:u,connectionSource:h});case 3:e.prev=3,f=e.catch(2),ph.A.log("Unable to parse idToken: ",n," Error: ",f);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();mp||(window.MNGAuthentication.login=_p,window.MNGAuthentication.logout=bp,window.MNGAuthentication.getUserInfo=Op);var Rp=function(){var e=(0,t.A)(o.mark(function e(){var n,i,s,a,c,u,l,d,h,p,f,m,g,w,y,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!mp){e.next=1;break}return ph.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=Eh(),i=!1,s="",a=!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)(o.mark(function e(){var t,n,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Zh();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,s="object"===(0,r.A)(c)?c.__raw:"",n=Th(mh.ENTITLEMENT_COOKIE_KEY),i||!n){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:a=e.sent;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(0),ph.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 ph.A.log("Page is logout. Routing to logout function..."),e.next=2,bp();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(""===s){e.next=6;break}if(d=null,h=JSON.parse(window.localStorage.getItem(mh.LOCAL_STORAGE_SESSION_KEY)),"{}"!==sp()){e.next=5;break}return h&&(d=h.jwt),e.next=5,pp({idToken:s,entitlementToken:d});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,hp();case 7:p=e.sent,s=p.idToken,(i="string"==typeof s)&&(c=Nh(s)),e.next=9;break;case 8:e.prev=8,v=e.catch(6),ph.A.log("Unable to initialize session: ",v);case 9:e.next=11;break;case 10:return e.next=11,l();case 11:if(ph.A.log("Authentication Init | isAuthenticated:",i),ph.A.log("Authentication Init | accessToken:",a),!i||!fh.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(m=null,c&&"object"===(0,r.A)(c)?m=c:s&&(m=Nh(s)),!((g=null===(f=m)||void 0===f?void 0:f.exp)&&Date.now()/1e3>g)){e.next=13;break}return ph.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,bp();case 12:i=!1,s="",c={};case 13:if(i||a||!fh.A.blueconicEnabled||!fh.A.bcLowaSegements){e.next=15;break}return ph.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,Gh(!0);case 14:w=e.sent,ph.A.log("BlueConic LOWA | bcLowaCheck result:",w),w.isSub?(ph.A.log("BlueConic LOWA | authenticated as LOWA"),i=mh.USER_IS_LOWA,c={sub:w.uuid}):ph.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(qh({isAuthenticated:i,idToken:s,accessToken:a,claims:c}),Qh("authenticationReady"),!0===i?(ph.A.log("User is authenticated."),n.searchParams.get("auth_redirect")&&(ph.A.log("Auth Redirect is present, sending user to auth redirect..."),(y=n.searchParams.get("auth_redirect")).endsWith("#")&&(y=y.slice(0,y.length)),window.location.assign(y)),n.pathname.startsWith("/login")&&!gp()&&(ph.A.log("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(n.origin))):ph.A.log("User is not authenticated."),n.pathname.startsWith("/login")&&!gp()?(ph.A.log("Page is login. Attempting to log user in..."),_p()):n.pathname.startsWith("/login")&&gp()?(ph.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"))),ph.A.log("Auth | Connext 300ms logout state expired. Manually reloading page.",Connext.GetOptions().Silentmode),window.location.assign(e)},300)):ph.A.log("Page is not login or Connext state is present"),!n.pathname.startsWith("/callback")||!n.searchParams.get("regwall")){e.next=17;break}return ph.A.log("Page is callback with regwall param. Routing to regwall receiver..."),e.next=16,kp();case 16:ph.A.log("Now login from regwall"),_p(),e.next=18;break;case 17:if(!n.pathname.startsWith("/callback")){e.next=18;break}return ph.A.log("Page is callback without regwall param. Routing to callback receiver..."),e.next=18,Tp();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Rp;var Cp=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(ph.A.log("Connext was not loaded."),n(!1)),ph.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(){ph.A.log("Signed user up to 
vendor: 4,893 bytes, lines 5-8
5newsletter: ",t),n(!0)},onError:function(e){ph.A.log("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){ph.A.log("subscribeToNewsletter Error:",e),n(!1)}})},Ip=function(){document.addEventListener("click",function(e){if(e.target.classList.contains("connext-login")){var t=window.location.href,n=new URL(t),o=n.origin,r=new URL("".concat(o,"/login"));r.searchParams.set("returnUrl",n.toString()),window.location.assign(r)}})},Np=function(e){try{"string"==typeof e&&Rh(mh.AUTH0_SUB_COOKIE_KEY,e,{domain:Oh(),path:"/",expires:365,secure:!0})}catch(e){ph.A.log("Failed to set auth0_sub cookie: ",e)}},Pp=function(e){if(!Th(mh.AUTH0_SUB_COOKIE_KEY))try{var t=e.claims;if(null==t||"object"!==(0,r.A)(t)&&!Object.keys(t).includes("sub"))return;var n=t.sub;Np(n)}catch(e){ph.A.log("Failed to set auth0_sub: ",e)}},xp=function(e){try{if("string"==typeof e){var t=Nh(e).sub;Np(t)}else ph.A.log("Could not set auth0_sub on login, idToken was not available.")}catch(e){ph.A.log("Failed to set auth0_sub on login: ",e)}},Lp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=window.localStorage.getItem("newsletter_to_subscribe"))){e.next=4;break}return e.next=1,window.ConnextUtils.connextReady("onFinish",1e3*ip.A.backupTimeoutLength);case 1:return e.next=2,Op();case 2:return n=e.sent,r=n.email,ph.A.log("CONNEXT: about to sign up ".concat(r," to ").concat(t)),e.next=3,Cp(r,t);case 3:window.localStorage.removeItem("newsletter_to_subscribe"),ph.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)}}(),Up=function(){var e=(0,t.A)(o.mark(function e(){var t;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Ip(),Lp(),"1"!==window.authentication_config.isEmbedLoginEnabled&&MNGAuthentication.oidcLoginCallbacks.push(xp),window.ConnextUtils.runConnextIfSilent(),e.next=1,Fh();case 1:t=e.sent,Pp(t);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const Mp={init:Up};(function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Mp.init(),e.next=1,Uh(!0);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})();
6//# sourceMappingURL=mng-digisubs.connext.bundle.js.map;
7/*! For license information please see mng-digisubs.entitlements.bundle.js.LICENSE.txt */
8(()=>{var e={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:f,f:f.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function f(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n<l.length;n++){var o,i=l[n],f=h.p,p=i[2];e>3?(o=p===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=f&&((o=e<2&&f<i[1])?(a=0,h.v=r,h.n=i[1]):f<p&&(o=e<3||i[0]>r||r>p)&&(i[4]=e,i[5]=r,h.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&&f(l,p),a=l,s=p;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),f(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 f=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),p=h.prototype=l.prototype=Object.create(f);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return d.prototype=h,r(p,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,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}},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}
8,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 f={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,f[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: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)(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;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.linaC
8heckOnArticles,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,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],i=t[r++],a=0===i?{enumerable:!0,value:t[r++]}:{enumerable:!0,get:i};n.o(e,o)||Object.defineProperty(e,o,a)}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&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:()=>Ru,hasStandardBrowserEnv:()=>Cu,hasStandardBrowserWebWorkerEnv:()=>ku,navigator:()=>Nu,origin:()=>Iu});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;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},c=function(){if(a.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}};function u(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}function l(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}
8finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}class f extends Error{}function p(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function m(e,t){this.v=e,this.k=t}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function g(e){return new m(e,0)}function v(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function E(e,t){return e.get(y(e,t))}function b(e,t,n){v(e,t),t.set(e,n)}function A(e,t,n){return e.set(y(e,t),n),n}function S(e,t){v(e,t),t.add(e)}function T(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(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 O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach(function(t){T(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function R(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(){return new k(e.apply(this,arguments))}}function k(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof m;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(c,n);n=e[c](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})}
8,"function"!=typeof e.return&&(this.return=void 0)}f.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,k.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},k.prototype.next=function(e){return this._invoke("next",e)},k.prototype.throw=function(e){return this._invoke("throw",e)},k.prototype.return=function(e){return this._invoke("return",e)};Error;var I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},P={},x={};Object.defineProperty(x,"__esModule",{value:!0});var L=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}();x.default=function(){return L.getInstance()};var M=I&&I.__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())})},U=I&&I.__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]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},D=I;Object.defineProperty(P,"__esModule",{value:!0});var B=x,j="browser-tabs-lock-key",F={key:function(e){return M(D,void 0,void 0,function(){return U(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return M(D,void 0,void 0,function(){return U(this,function(e){throw new Error("Unsupported")})})},clear:function(){return M(D,void 0,void 0,function(){return U(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return M(D,void 0,void 0,function(){return U(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return M(D,void 0,void 0,function(){return U(this,function(e){throw new Error("Unsupported")})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function H(e){return new Promise(function(t){return setTimeout(t,e)})}function G(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var W=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+G(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),M(this,void 0,void 0,function(){var r,o,i,a,s,c,u;return U(this,function(l){switch(l.label){case 0:r=Date.now()+G(4),o=Date.now()+n,i=j+"-"+t,a=void 0===this.storageHandler?F:this.storageHandler,l.label=1;case 1:return Date.now()<o?[4,H(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+r,[4,H(Math.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,H(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(i,r),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?F:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:l.sent(),l.label=7;case 7:return r=Date.now()+G(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return M(this,void 0,void 0,function(){var n=this;return U(this,function(r){return setTimeout(function(){return M(n,void 0,void 0,function(){var n,r,o;return U(this,function(i){switch(i.label){case 0:return[4,B.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?F:this.storageHandler,null===(r=n.getItemSync(e))?(B.default().unlock(t),[2]):((o=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(o)),B.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(B.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return M(this,void 0,void 0,function(){return U(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,o=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!r){r=!0;var t=50-(Date.now()-o);t>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().forEac
8h(function(e){return e()})},e.prototype.releaseLock=function(e){return M(this,void 0,void 0,function(){return U(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 M(this,void 0,void 0,function(){var n,r,o,i;return U(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?F:this.storageHandler,r=j+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,B.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),B.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<o.length;c++){var u=o[c];if(u.includes(j)){var l=r.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}();P.default=W;new TextEncoder,new TextDecoder;let K;if(Uint8Array.prototype.toBase64)K=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;K=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}Error;Error;var J=I&&I.__assign||function(){return J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},J.apply(this,arguments)};var X;!function(e){e.Code="code",e.ConnectCode="connect_code"}(X||(X={}));var V;var Y;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Y||(Y={}));Error;var q,z;let Z;if("undefined"==typeof navigator||null===(q=navigator.userAgent)||void 0===q||null===(z=q.startsWith)||void 0===z||!z.call(q,"Mozilla/5.0 ")){const e="v3.8.6";Z="".concat("oauth4webapi","/").concat(e)}function Q(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 ee="ERR_INVALID_ARG_VALUE",te="ERR_INVALID_ARG_TYPE";function ne(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const re=Symbol(),oe=Symbol(),ie=Symbol(),ae=Symbol(),se=Symbol(),ce=Symbol(),ue=new TextEncoder,le=new TextDecoder;function de(e){return"string"==typeof e?ue.encode(e):le.decode(e)}let he,fe;if(Uint8Array.prototype.toBase64)he=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;he=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function pe(e){return"string"==typeof e?fe(e):he(e)}fe=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw ne("The input to be decoded is not correctly encoded.",ee,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw ne("The input to be decoded is not correctly encoded.",ee,e)}};class me extends Error{constructor(e,t){var n;super(e,t),T(this,"code",void 0),this.name=this.constructor.name,this.code=gt,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class we extends Error{constructor(e,t){var n;super(e,t),T(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function ye(e,t,n){return new we(e,{code:t,cause:n})}function ge(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ve(e){Q(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Z&&!t.has("user-agent")&&t.set("user-agent",Z),t.has("authorization"))throw ne('"options.headers" must not include the "authorization" header name',ee);return t}function Ee(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw ne('"options.signal" must return or be an instance of AbortSignal',te);return t}}function be(e){return e.includes("//")?e.replace("//","/"):e}function Ae(e,t,n,r,o){try{if("number"!=typeof e||!Number.isFinite(e))throw ne("".concat(n," must be a number"),te,o);if(e>0)return;if(t){if(0!==e)throw ne("".concat(n," must be a non-negative number"),ee,o);return}throw ne("".concat(n," must be a positive number"),ee,o)}catch(e){if(r)throw ye(e.message,r,o);throw e}}function Se(e,t,n,r){try{if("string"!=typeof e)throw ne("".concat(t," must be a string"),te,r);
8if(0===e.length)throw ne("".concat(t," must not be empty"),ee,r)}catch(e){if(n)throw ye(e.message,n,r);throw e}}function Te(e){!function(e,t){if(Ze(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;o<n;o++)r[o-1]=arguments[o];if(r.length>2){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 ye(t,St,e)}(e,t)}(e,"application/json")}function _e(){return pe(crypto.getRandomValues(new Uint8Array(32)))}function Oe(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 me("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 me("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 me("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 me("unsupported CryptoKey algorithm name",{cause:e})}}function Re(e){const t=null==e?void 0:e[oe];return"number"==typeof t&&Number.isFinite(t)?t:0}function Ne(e){const t=null==e?void 0:e[ie];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Ce(){return Math.floor(Date.now()/1e3)}function ke(e){if("object"!=typeof e||null===e)throw ne('"as" must be an object',te);Se(e.issuer,'"as.issuer"')}function Ie(e){if("object"!=typeof e||null===e)throw ne('"client" must be an object',te);Se(e.client_id,'"client.client_id"')}function Pe(e){return Se(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function xe(e,t){const n=e instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&Se(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 ne("".concat(t," must be a CryptoKey"),te)}(e,t),"private"!==e.type)throw ne("".concat(t," must be a private CryptoKey"),ee)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:Oe(r),kid:o},u=function(e,t){const n=Ce()+Re(t);return{jti:_e(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===t[se]||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 ne('CryptoKey instances used for signing assertions must include "sign" in their "usages"',ee);const r="".concat(pe(de(JSON.stringify(e))),".").concat(pe(de(JSON.stringify(t)))),o=pe(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Mt(e)};case"RSA-PSS":switch(Lt(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 me("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Lt(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new me("unsupported CryptoKey algorithm name",{cause:e})}(n),n,de(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const Le=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Me(e,t){if(t&&"https:"!==e.protocol)throw ye("only requests to HTTPS are allowed",_t,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw ye("only HTTP and HTTPS requests are allowed",Ot,e)}function Ue(e,t,n,r){let o;if("string"!=typeof e||!(o=Le(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?kt:It,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Me(o,r),o}function De(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Ue(e.mtls_endpoint_aliases[t],t,n,r):Ue(e[t],t,n,r)}
8class Be extends Error{constructor(e,t){var n;super(e,t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"error",void 0),T(this,"status",void 0),T(this,"error_description",void 0),T(this,"response",void 0),this.name=this.constructor.name,this.code=yt,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 je extends Error{constructor(e,t){var n,r;super(e,t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"error",void 0),T(this,"error_description",void 0),this.name=this.constructor.name,this.code=vt,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 Fe extends Error{constructor(e,t){var n;super(e,t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"response",void 0),T(this,"status",void 0),this.name=this.constructor.name,this.code=wt,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 He="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Ge="("+He+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',We="("+He+")\\s*=\\s*("+He+")",Ke=new RegExp("^[,\\s]*("+He+")"),Je=new RegExp("^[,\\s]*"+Ge+"[,\\s]*(.*)"),Xe=new RegExp("^[,\\s]*"+We+"[,\\s]*(.*)"),Ve=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Ye(e,t,n){if(e.status!==t){let t;var r;if(it(e),t=await async function(e){if(e.status>399&&e.status<500){xt(e),Te(e);try{const t=await e.clone().json();if(ge(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 Be("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)"),Tt,e)}}function qe(e){if(!lt.has(e))throw ne('"options.DPoP" is not a valid DPoPHandle',ee)}const ze=Symbol();function Ze(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function Qe(e,t,n,r,o){if(ke(e),Ie(t),!Q(r,Response))throw ne('"response" must be an instance of Response',te);if(it(r),200!==r.status)throw ye('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',Tt,r);let i;if(xt(r),"application/jwt"===Ze(r)){const n=await Ut(await r.text(),Dt.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),Re(t),Ne(t),null==o?void 0:o[ce]).then(at.bind(void 0,t.client_id)).then(ct.bind(void 0,e)),i=n.claims,a=n.jwt;nt.set(r,a)}else{if(t.userinfo_signed_response_alg)throw ye("JWT UserInfo Response expected",Et,r);await Ht(r)}if(Se(i.sub,'"response" body "sub" property',At,{body:i}),n===ze);else if(Se(n,'"expectedSubject"'),i.sub!==n)throw ye('unexpected "response" body "sub" property value',Ct,{expected:n,body:i,attribute:"sub"});return i}async function $e(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[ae])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Ee(r,null==a?void 0:a.signal)})}async function et(e,t,n,r,o,i){var a;const s=De(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[re]));o.set("grant_type",r);const c=ve(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(qe(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await $e(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const tt=new WeakMap,nt=new WeakMap;function rt(e){if(!e.id_token)return;const t=tt.get(e);if(!t)throw ne('"ref" was already garbage collected or did not resolve from the proper sources',ee);return t}
8async function ot(e,t,n,r,o,i){if(ke(e),Ie(t),!Q(n,Response))throw ne('"response" must be an instance of Response',te);await Ye(n,200,"Token Endpoint"),xt(n);const a=await Ht(n);if(Se(a.access_token,'"response" body "access_token" property',At,{body:a}),Se(a.token_type,'"response" body "token_type" property',At,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;Ae(e,!0,'"response" body "expires_in" property',At,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Se(a.refresh_token,'"response" body "refresh_token" property',At,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw ye('"response" body "scope" property must be a string',At,{body:a});if(void 0!==a.id_token){Se(a.id_token,'"response" body "id_token" property',At,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Ae(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await Ut(a.id_token,Dt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Re(t),Ne(t),o).then(ft.bind(void 0,i)).then(ut.bind(void 0,e)).then(st.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',Nt,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw ye('unexpected ID Token "azp" (authorized party) claim value',Nt,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&Ae(c.auth_time,!0,'ID Token "auth_time" (authentication time)',At,{claims:c}),nt.set(n,u),tt.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 me("unsupported `token_type` value",{cause:{body:a}});return a}function it(e){let t;if(t=function(e){if(!Q(e,Response))throw ne('"response" must be an instance of Response',te);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(Ke);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 f;if(d)for(;r;){let n,o;if(t=r.match(Je)){var i=N(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(Xe))){if(t=r.match(Ve)){if(Object.keys(h).length)break;var a=N(t,3);f=a[1],r=a[2];break}return}var s=N(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const p={scheme:c,parameters:h};f&&(p.token68=f),n.push(p)}return n.length?n:void 0}(e))throw new Fe("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function at(e,t){return void 0!==t.claims.aud?st(e,t):t}function st(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw ye('unexpected JWT "aud" (audience) claim value',Nt,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw ye('unexpected JWT "aud" (audience) claim value',Nt,{expected:e,claims:t.claims,claim:"aud"});return t}function ct(e,t){return void 0!==t.claims.iss?ut(e,t):t}function ut(e,t){var n,r;const o=null!==(n=null===(r=e[Wt])||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',Nt,{expected:o,claims:t.claims,claim:"iss"});return t}const lt=new WeakSet,dt=Symbol(),ht={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 ft(e,t){for(const n of e)if(void 0===t.claims[n])throw ye('JWT "'.concat(n,'" (').concat(ht[n],") claim missing"),At,{claims:t.claims});return t}const pt=Symbol(),mt=Symbol();const wt="OAUTH_WWW_AUTHENTICATE_CHALLENGE",yt="OAUTH_RESPONSE_BODY_ERROR",gt="OAUTH_UNSUPPORTED_OPERATION",vt="OAUTH_AUTHORIZATION_RESPONSE_E
8RROR",Et="OAUTH_JWT_USERINFO_EXPECTED",bt="OAUTH_PARSE_ERROR",At="OAUTH_INVALID_RESPONSE",St="OAUTH_RESPONSE_IS_NOT_JSON",Tt="OAUTH_RESPONSE_IS_NOT_CONFORM",_t="OAUTH_HTTP_REQUEST_FORBIDDEN",Ot="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Rt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Nt="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Ct="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",kt="OAUTH_MISSING_SERVER_METADATA",It="OAUTH_INVALID_SERVER_METADATA";async function Pt(e){if(!Q(e,Response))throw ne('"response" must be an instance of Response',te);await Ye(e,200,"Revocation Endpoint")}function xt(e){if(e.bodyUsed)throw ne('"response" body has been used already',ee)}function Lt(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new me("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Mt(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 me("unsupported ECDSA namedCurve",{cause:e})}}async function Ut(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 me("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 ye("Invalid JWT",At,e);try{i=JSON.parse(de(pe(c)))}catch(e){throw ye("failed to parse JWT Header body as base64url encoded JSON",bt,e)}if(!ge(i))throw ye("JWT Header must be a top level object",At,e);if(t(i),void 0!==i.crit)throw new me('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(de(pe(u)))}catch(e){throw ye("failed to parse JWT Payload body as base64url encoded JSON",bt,e)}if(!ge(a))throw ye("JWT Payload must be a top level object",At,e);const h=Ce()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw ye('unexpected JWT "exp" (expiration time) claim type',At,{claims:a});if(a.exp<=h-r)throw ye('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Rt,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw ye('unexpected JWT "iat" (issued at) claim type',At,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw ye('unexpected JWT "iss" (issuer) claim type',At,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw ye('unexpected JWT "nbf" (not before) claim type',At,{claims:a});if(a.nbf>h+r)throw ye('unexpected JWT "nbf" (not before) claim value',Rt,{claims:a,now:h,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',At,{claims:a});return{header:i,claims:a,jwt:e}}function Dt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw ye('unexpected JWT "alg" header parameter',At,{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',At,{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',At,{header:r,expected:e,reason:"client configuration"})}function Bt(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw ye('"'.concat(t,'" parameter must be provided only once'),At);return r}const jt=Symbol(),Ft=Symbol();async function Ht(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Te;try{t=await e.json()}catch(t){throw n(e),ye('failed to parse "response" body as JSON',bt,t)}if(!ge(t))throw ye('"response" body must be a top level object',At,{body:t});return t}const Gt=Symbol(),Wt=Symbol(),Kt=new TextEncoder,Jt=new TextDecoder,Xt=new TextDecoder("utf-8",{fatal:!0});function Vt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.reduce((e,t)=>e+t.length,0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}function Yt(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(r>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}const qt=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};
8const zt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(r.length>2){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}("Key for the ".concat(e," algorithm must be "),t,...r)};class Zt extends Error{constructor(e,t){var n;super(e,t),T(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}T(Zt,"code","ERR_JOSE_GENERIC");class Qt extends Zt{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}}),T(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),T(this,"claim",void 0),T(this,"reason",void 0),T(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}T(Qt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class $t extends Zt{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}}),T(this,"code","ERR_JWT_EXPIRED"),T(this,"claim",void 0),T(this,"reason",void 0),T(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}
8T($t,"code","ERR_JWT_EXPIRED");class en extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}T(en,"code","ERR_JOSE_ALG_NOT_ALLOWED");class tn extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JOSE_NOT_SUPPORTED")}}T(tn,"code","ERR_JOSE_NOT_SUPPORTED"),T(class extends Zt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),T(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),T(class extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class nn extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JWS_INVALID")}}T(nn,"code","ERR_JWS_INVALID");class rn extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JWT_INVALID")}}T(rn,"code","ERR_JWT_INVALID"),T(class extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class on extends Zt{constructor(){super(...arguments),T(this,"code","ERR_JWKS_INVALID")}}T(on,"code","ERR_JWKS_INVALID");class an extends Zt{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),T(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}T(an,"code","ERR_JWKS_NO_MATCHING_KEY");class sn extends Zt{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),T(this,Symbol.asyncIterator,C(function*(){})),T(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}T(sn,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class cn extends Zt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),T(this,"code","ERR_JWKS_TIMEOUT")}}T(cn,"code","ERR_JWKS_TIMEOUT");class un extends Zt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),T(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}T(un,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const ln=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function dn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const hn="The input to be decoded is not correctly encoded.";function fn(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Jt.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(hn,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Jt.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(hn);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return dn(t)}catch(e){throw new TypeError(hn)}}function pn(e){let t=e;return"string"==typeof t&&(t=Kt.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function mn(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function wn(e){return mn(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(mn)}function yn(e,t,n){try{return fn(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function gn(e,t){var n,r,o,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new tn('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new tn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const a=null!==(n=null===(r=e.resolve)||void 0===r?void 0:r.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,s=!(!t.d&&!t.priv),c=O({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,a,null!==(o=t.ext)&&void 0!==o?o:!s,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[s?1:0])}function vn(e){return O({__proto__:null},e)}const En=e=>e[Symbol.toStringTag];function bn(e,t,n){const r=e.alg,o=e.secret,i="decrypt"===n||"sign"===n;if(o&&t instanceof Uint8Array)return[An,t];if(mn(t)){const a=function(e){const t=vn(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof a.kty)throw new TypeError(o?zt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):zt(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(o?"oct"===a.kty&&"string"==typeof a.k:"oct"!==a.kty&&(i?"AKP"===a.kty&&"string"==typeof a.priv||"string"==typeof a.d:void 0===a.d&&void 0===a.priv)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const r=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"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!==r)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(r,'" when present'));if(Array.isArray(t.key_ops)){var o;const r="encrypt"===n||"decrypt"===n?null===(o=e.ops)||void 0===o?void 0:o["encrypt"===n?0:1]:n;if(r&&!t.key_ops.includes(r))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(r,'" when present'))}})(e,a,n),[_n,t,a]}if(!(e=>ln(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(o?zt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):zt(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if("secret"!==t.type)throw new TypeError("".concat(En(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(En(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const r="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(En(t)," instances for asymmetric algorithm ").concat(r,' must be of type "').concat(e,'"'))}}return ln(t)?[Sn,t]:[Tn,t]}const An=0,Sn=1,Tn=2,_n=3;let On;const Rn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function Nn(e,t,n){On||(On=new WeakMap);const r=On.get(e);return n&&(r?r[t]=n:On.set(e,{[t]:n})),null!=n?n:null==r?void 0:r[t]}const Cn=async(e,t,n)=>{var r;return null!==(r=Nn(e,n.alg))&&void 0!==r?r:Nn(e,n.alg,await gn(n,O(O({},t),{},{alg:n.alg})))};
8async function kn(e,t,n){const r=bn(e,t,n);switch(r[0]){case An:case Sn:return r[1];case _n:{const t=r[1],n=r[2];if("oct"===n.kty)return fn(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return Cn(t,n,e)}case Tn:{const t=r[1];return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,r,o;const i=Nn(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,u=Rn[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],l=null!==(r=null===(o=t.resolve)||void 0===o?void 0:o.call(t,{crv:u,asymmetricKeyType:c}))&&void 0!==r?r:t.subtle;return Nn(e,t.alg,e.toCryptoKey(l,a,s))})(t,e):Cn(t,t.export({format:"jwk"}),e)}}}function In(e){const t={__proto__:null};for(const n in e)t[n]=O(O({},e[n]),{},{alg:n});return t}const Pn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],xn=[[],["deriveBits"]],Ln=[[],[]];function Mn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:Pn,ops:["wrapKey","unwrapKey"]}}function Un(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,r=e.asymmetricKeyType;if("X25519"===n||"x25519"===r)return{name:"X25519"};if("OKP"===t)throw new tn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:xn,ops:[void 0,"deriveBits"]}}function Dn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:Ln,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function Bn(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:Ln,ops:["deriveBits","deriveBits"]}}const jn=In({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:Ln,ops:["encrypt","decrypt"]},"RSA-OAEP":Mn(1),"RSA-OAEP-256":Mn(256),"RSA-OAEP-384":Mn(384),"RSA-OAEP-512":Mn(512),"ECDH-ES":Un(),"ECDH-ES+A128KW":Un(),"ECDH-ES+A192KW":Un(),"ECDH-ES+A256KW":Un(),A128KW:Dn(128),A192KW:Dn(192),A256KW:Dn(256),A128GCMKW:Dn(128,!0),A192GCMKW:Dn(192,!0),A256GCMKW:Dn(256,!0),"PBES2-HS256+A128KW":Bn(),"PBES2-HS384+A192KW":Bn(),"PBES2-HS512+A256KW":Bn()}),Fn=["encrypt","decrypt"];function Hn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:Ln,ops:Fn,cekBits:e,ivBits:t?128:96,cbc:t}}In({A128GCM:Hn(128),A192GCM:Hn(192),A256GCM:Hn(256),"A128CBC-HS256":Hn(256,!0),"A192CBC-HS384":Hn(384,!0),"A256CBC-HS512":Hn(512,!0)});const Gn={__proto__:null,b64:!0};function Wn(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function Kn(e,t,n,r,o){if(void 0!==o.crit&&void 0===(null==r?void 0:r.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return[];if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:O(O({__proto__:null},n),t);for(const t of r.crit){if(!(t in i))throw new tn('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(o,t)||void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(r,t)||void 0===r[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return r.crit}function Jn(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new nn('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Xn,Vn;let Yn,qn;if("undefined"==typeof navigator||null===(Xn=navigator.userAgent)||void 0===Xn||null===(Vn=Xn.startsWith)||void 0===Vn||!Vn.call(Xn,"Mozilla/5.0 ")){const e="v6.8.4";qn="".concat("openid-client","/").concat(e),Yn={"user-agent":qn}}const zn=e=>Zn.get(e);let Zn,Qn;function $n(e){return void 0!==e?Pe(e):(Qn||(Qn=new WeakMap),(e,t,n,r)=>{let o;return(o=Qn.get(t))||(function(e,t){if("string"!=typeof e)throw or("".concat(t," must be a string"),rr);
8if(0===e.length)throw or("".concat(t," must not be empty"),nr)}(t.client_secret,'"metadata.client_secret"'),o=Pe(t.client_secret),Qn.set(t,o)),o(e,t,n,r)})}const er=ze,tr=ae,nr="ERR_INVALID_ARG_VALUE",rr="ERR_INVALID_ARG_TYPE";function or(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class ir extends Error{constructor(e,t){var n;super(e,t),T(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 ar(e,t,n){return new ir(e,{cause:t,code:n})}function sr(e){if(e instanceof TypeError||e instanceof ir||e instanceof Be||e instanceof je||e instanceof Fe)throw e;if(e instanceof we)switch(e.code){case _t:throw ar("only requests to HTTPS are allowed",e,e.code);case Ot:throw ar("only requests to HTTP or HTTPS are allowed",e,e.code);case Tt:throw ar("unexpected HTTP response status code",e.cause,e.code);case St:throw ar("unexpected response content-type",e.cause,e.code);case bt:throw ar("parsing error occured",e,e.code);case At:throw ar("invalid response encountered",e,e.code);case Nt:throw ar("unexpected JWT claim value encountered",e,e.code);case Ct:throw ar("unexpected JSON attribute value encountered",e,e.code);case Rt:throw ar("JWT timestamp claim value failed validation",e,e.code);default:throw ar(e.message,e,e.code)}if(e instanceof me)throw ar("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw ar("runtime operation error",e,gt);case"NotSupportedError":throw ar("runtime unsupported operation",e,gt);case"TimeoutError":throw ar("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw ar("operation aborted",e,"OAUTH_ABORT")}throw new ir("something went wrong",{cause:e})}async function cr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw or('"server" must be an instance of URL',rr);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 ne('"'.concat("issuerIdentifier",'" must be an instance of URL'),te);Me(e,!0!==(null==r?void 0:r[re]));const o=n(new URL(e.href)),i=ve(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[ae])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Ee(o,null==r?void 0:r.signal)}
8)}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=be("".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=be("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw ne('"options.algorithm" must be "oidc" (default), or "oauth2"',ee)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[ae]:null==t?void 0:t[tr],[re]:null==t||null===t.execute||void 0===r?void 0:r.includes(wr),signal:a,headers:new Headers(Yn)}):((null==t?void 0:t[tr])||fetch)((Me(e,null==t||null===t.execute||void 0===c||!c.includes(wr)),e.href),{headers:Object.fromEntries(new Headers(O({accept:"application/json"},Yn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Gt)throw ne('"expectedIssuerIdentifier" must be an instance of URL',te);if(!Q(t,Response))throw ne('"response" must be an instance of Response',te);if(200!==t.status)throw ye('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Tt,t);xt(t);const r=await Ht(t);if(Se(r.issuer,'"response" body "issuer" property',At,{body:r}),n!==Gt&&new URL(r.issuer).href!==n.href)throw ye('"response" body "issuer" property does not match the expected value',Ct,{expected:n.href,body:r,attribute:"issuer"});return r}(Gt,e)).catch(sr);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[ur]=!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 ir("discovered metadata issuer does not match the expected issuer",{code:Ct,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new lr(i,t,n,r);let s=zn(a);if(null!=o&&o[tr]&&(s.fetch=o[tr]),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 ur=Symbol();class lr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw or('"clientId" must be a non-empty string',rr);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 or('"clientId" and "metadata.client_id" must be the same',nr);const u=O(O({},structuredClone(n)),{},{client_id:t});let l;u[oe]=null!==(i=null===(a=n)||void 0===a?void 0:a[oe])&&void 0!==i?i:0,u[ie]=null!==(s=null===(c=n)||void 0===c?void 0:c[ie])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?$n(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);ur in e&&(h[Wt]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let f=Object.freeze(h);Zn||(Zn=new WeakMap),Zn.set(this,{__proto__:null,as:f,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(zn(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(zn(this).c)}get timeout(){return zn(this).timeout}set timeout(e){zn(this).timeout=e}get[tr](){return zn(this).fetch}set[tr](e){zn(this).fetch=e}}function dr(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()}
8return{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 rt(this)}catch(e){return}}}}}(e))}async function hr(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 we("invalid Retry-After header value",{cause:e});a>t&&await fr(a-t,n)}function fr(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 pr(e,t){Ar(e);const n=zn(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){ke(e),Ie(t);const i=De(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[re])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=ve(null==o?void 0:o.headers);return s.set("accept","application/json"),$e(e,t,n,i,a,s,o)}(r,o,i,t,{[ae]:a,[re]:!s,headers:new Headers(Yn),signal:Sr(c)}).then(e=>async function(e,t,n){if(ke(e),Ie(t),!Q(n,Response))throw ne('"response" must be an instance of Response',te);await Ye(n,200,"Backchannel Authentication Endpoint"),xt(n);const r=await Ht(n);Se(r.auth_req_id,'"response" body "auth_req_id" property',At,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Ae(o,!0,'"response" body "expires_in" property',At,{body:r}),r.expires_in=o,void 0!==r.interval&&Ae(r.interval,!1,'"response" body "interval" property',At,{body:r}),r}(r,o,e)).catch(sr)}async function mr(e,t,n,r){var o,i;Ar(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 fr(a,s)}catch(e){sr(e)}const c=zn(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,f=c.tlsOnly,p=c.nonRepudiation,m=c.timeout,w=c.decrypt,y=(o,i)=>mr(e,O(O({},t),{},{interval:o}),n,O(O({},r),{},{signal:s,flag:i})),g=function(e,t){const n=Sr(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),v=await async function(e,t,n,r,o){ke(e),Ie(t),Se(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),et(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[ae]:h,[re]:!f,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Yn),signal:g.signal}).catch(sr).finally(g.cleanup);var E;if(503===v.status&&v.headers.has("retry-after"))return await hr(v,a,s,!0),await(null===v.body||void 0===E?void 0:E.cancel()),y(a);const b=async function(e,t,n,r){return ot(e,t,n,void 0,null==r?void 0:r[ce],null==r?void 0:r.recognizedTokenTypes)}(u,l,v,{[ce]:w});let A;try{await b}catch(e){if(_r(e,r))return y(a,Or);if(e instanceof Be)switch(e.error){case"slow_down":0;case"authorization_pending":return await hr(e.response,a,s),y(a)}sr(e)}return A.id_token&&await(null==p?void 0:p(v)),dr(A),A}function wr(e){zn(e).tlsOnly=!1}async function yr(e,t,n,r,o){if(Ar(e),!((null==o?void 0:o.flag)===Or||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw or('"currentUrl" must be an instance of URL, or Request',rr);let i,a;const s=zn(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,f=s.jarm,p=s.hybrid,m=s.nonRepudiation,w=s.timeout,y=s.decrypt,g=s.implicit;if((null==o?void 0:o.flag)===Or)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 ne("form_post responses are expected to use the POST method",ee,{cause:e});if("application/x-www-form-urlencoded"!==Ze(e))throw ne("form_post responses are expected to use the application/x-www-form-urlencoded content-type",ee,{cause:e});return async function(e){if(e.bodyUsed)throw ne("form_post Request instances must contain a readable body",ee,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const e of n.entries()){var v=N(e,2);const n=v[0],r=v[1];t.searchParams.append(n,r)}break;default:throw or("unexpected Request HTTP method",nr)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!f:await f(t,null==n?void 0:n.expectedState);break;case!!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(ke(e),Ie(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw ne('"parameters" must be an instance of URLSearchParams, or URL',te);if(Bt(n,"response"))throw ye('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',At,{parameters:n});const o=Bt(n,"iss"),i=Bt(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw ye('response parameter "iss" (issuer) missing',At,{parameters:n});if(o&&o!==e.issuer)throw ye('unexpected "iss" (issuer) response parameter value',At,{expected:e.issuer,parameters:n});switch(r){case void 0:case Ft:if(void 0!==i)throw ye('unexpected "state" response parameter encountered',At,{expected:void 0,parameters:n});break;case jt:break;default:if(Se(r,'"expectedState" argument'),i!==r)throw ye(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',At,{expected:r,parameters:n})}if(Bt(n,"error"))throw new je("authorization response from the server is an error",{cause:n});const a=Bt(n,"id_token"),s=Bt(n,"token");if(void 0!==a||void 0!==s)throw new me("implicit and hybrid flows are not supported");return new URLSearchParams(n),lt.add(c),c;var c})(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){sr(e)}}}const E=await async function(e,t,n,r,o,i,a){if(ke(e),Ie(t),!lt.has(r))throw ne('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',ee);Se(o,'"redirectUri"');
8const s=Bt(r,"code");if(!s)throw ye('no authorization code in "callbackParameters"',At);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==dt&&(Se(i,'"codeVerifier"'),c.set("code_verifier",i)),et(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||dt,{additionalParameters:r,[ae]:d,[re]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Yn),signal:Sr(w)}).catch(sr);"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 pt:break;default:Se(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case mt:break;default:Ae(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await ot(e,t,n,s,i,a);Se(c.id_token,'"response" body "id_token" property',At,{body:c});const u=rt(c);if(o!==mt){const e=Ce()+Re(t),n=Ne(t);if(u.auth_time+o<e-n)throw ye("too much time has elapsed since the last End-User authentication",Rt,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(r===pt){if(void 0!==u.nonce)throw ye('unexpected ID Token "nonce" claim value',Nt,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==r)throw ye('unexpected ID Token "nonce" claim value',Nt,{expected:r,claims:u,claim:"nonce"});return c}(e,t,n,r.expectedNonce,r.maxAge,r[ce],r.recognizedTokenTypes):async function(e,t,n,r,o){const i=await ot(e,t,n,void 0,r,o),a=rt(i);if(a){if(void 0!==t.default_max_age){Ae(t.default_max_age,!0,'"client.default_max_age"');const e=Ce()+Re(t),n=Ne(t);if(a.auth_time+t.default_max_age<e-n)throw ye("too much time has elapsed since the last End-User authentication",Rt,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw ye('unexpected ID Token "nonce" claim value',Nt,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==r?void 0:r[ce],null==r?void 0:r.recognizedTokenTypes)}(c,u,E,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[ce]:y});let A;try{await b}catch(t){if(_r(t,o))return yr(e,void 0,n,r,O(O({},o),{},{flag:Or,authResponse:i,redirectUri:a}));sr(t)}return A.id_token&&await(null==m?void 0:m(E)),dr(A),A}async function gr(e,t,n,r){Ar(e),new URLSearchParams(n);const o=zn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.nonRepudiation,d=o.timeout,h=o.decrypt,f=await async function(e,t,n,r,o){ke(e),Ie(t),Se(r,'"refreshToken"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("refresh_token",r),et(e,t,n,"refresh_token",i,o)}(i,a,s,t,{[ae]:c,[re]:!u,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Yn),signal:Sr(d)}).catch(sr),p=async function(e,t,n,r){return ot(e,t,n,void 0,null==r?void 0:r[ce],null==r?void 0:r.recognizedTokenTypes)}(i,a,f,{[ce]:h});let m;try{await p}catch(o){if(_r(o,r))return gr(e,t,n,O(O({},r),{},{flag:Or}));sr(o)}return m.id_token&&await(null==l?void 0:l(f)),dr(m),m}async function vr(e,t,n){Ar(e),new URLSearchParams(t);const r=zn(e),o=r.as,i=r.c,a=r.auth,s=r.fetch,c=r.tlsOnly,u=r.timeout,l=await async function(e,t,n,r,o){return ke(e),Ie(t),et(e,t,n,"client_credentials",new URLSearchParams(r),o)}(o,i,a,t,{[ae]:s,[re]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Yn),signal:Sr(u)}).catch(sr),d=async function(e,t,n){return ot(e,t,n,void 0,void 0,void 0)}(o,i,l);let h;try{await d}catch(r){if(_r(r,n))return vr(e,t,O(O({},n),{},{flag:Or}));sr(r)}return dr(h),h}function Er(e,t){Ar(e);const n=zn(e),r=n.as,o=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,u=De(r,"authorization_endpoint",!1,i);if(new URLSearchParams(t).has("client_id")||t.set("client_id",o.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw or("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",nr);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=N(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function br(e,t,n){Ar(e);const r=Er(e,t),o=zn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=await async function(e,t,n,r,o){var i;ke(e),Ie(t);const a=De(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[re])),s=new URLSearchParams(r);s.set("client_id",t.client_id);const c=ve(null==o?void 0:o.headers);c.set("accept","application/json"),void 0!==(null==o?void 0:o.DPoP)&&(qe
8(o.DPoP),await o.DPoP.addProof(a,c,"POST"));const u=await $e(e,t,n,a,s,c,o);return null==o||null===o.DPoP||void 0===i||i.cacheNonce(u,a),u}(i,a,s,r.searchParams,{[ae]:c,[re]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Yn),signal:Sr(l)}).catch(sr),h=async function(e,t,n){if(ke(e),Ie(t),!Q(n,Response))throw ne('"response" must be an instance of Response',te);await Ye(n,201,"Pushed Authorization Request Endpoint"),xt(n);const r=await Ht(n);Se(r.request_uri,'"response" body "request_uri" property',At,{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',At,{body:r}),r.expires_in=o,r}(i,a,d);let f;try{await h}catch(r){if(_r(r,n))return br(e,t,O(O({},n),{},{flag:Or}));sr(r)}return Er(e,{request_uri:f.request_uri})}function Ar(e){if(!(e instanceof lr))throw or('"config" must be an instance of Configuration',rr);if(Object.getPrototypeOf(e)!==lr.prototype)throw or("subclassing Configuration is not allowed",nr)}function Sr(e){return e?AbortSignal.timeout(1e3*e):void 0}async function Tr(e,t,n,r){Ar(e);const o=zn(e),i=o.as,a=o.c,s=o.fetch,c=o.tlsOnly,u=o.nonRepudiation,l=o.timeout,d=o.decrypt,h=await async function(e,t,n,r){ke(e),Ie(t);const o=De(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[re])),i=ve(null==r?void 0:r.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,r,o,i){var a;if(Se(e,'"accessToken"'),!(n instanceof URL))throw ne('"url" must be an instance of URL',te);Me(n,!0!==(null==i?void 0:i[re])),ve(r),null!=i&&i.DPoP&&(qe(i.DPoP),await i.DPoP.addProof(n,r,"GET".toUpperCase(),e)),r.set("authorization","".concat(r.has("dpop")?"DPoP":"Bearer"," ").concat(e));const s=await((null==i?void 0:i[ae])||fetch)(n.href,{duplex:Q(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:Ee(n,null==i?void 0:i.signal)});return null==i||null===i.DPoP||void 0===a||a.cacheNonce(s,n),s}(n,0,o,i,0,O(O({},r),{},{[oe]:Re(t)}))}(i,a,t,{[ae]:s,[re]:!c,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Yn),signal:Sr(l)}).catch(sr);let f,p=Qe(i,a,n,h,{[ce]:d});try{await p}catch(o){if(_r(o,r))return Tr(e,t,n,O(O({},r),{},{flag:Or}));sr(o)}return"application/jwt"===Ze(h)&&await(null==u?void 0:u(h)),f}function _r(e,t){return!(null==t||!t.DPoP||t.flag===Or)&&function(e){if(e instanceof Fe){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof Be&&"use_dpop_nonce"===e.error}(e)}Object.freeze(lr.prototype);const Or=Symbol();async function Rr(e,t,n,r){Ar(e);const o=zn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=o.decrypt,h=o.nonRepudiation,f=await async function(e,t,n,r,o,i){return ke(e),Ie(t),Se(r,'"grantType"'),et(e,t,n,r,new URLSearchParams(o),i)}(i,a,s,t,new URLSearchParams(n),{[ae]:c,[re]:!u,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Yn),signal:Sr(l)}).catch(sr);let p;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(p={n_a:()=>{}});const m=async function(e,t,n,r){return ot(e,t,n,void 0,null==r?void 0:r[ce],null==r?void 0:r.recognizedTokenTypes)}(i,a,f,{[ce]:d,recognizedTokenTypes:p});let w;try{w=await m}catch(o){if(_r(o,r))return Rr(e,t,n,O(O({},r),{},{flag:Or}));sr(o)}return w.id_token&&await(null==h?void 0:h(f)),dr(w),w}async function Nr(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var r;const o=e.algorithm;if(o.name!==t.name)throw qt(t.name);if(t.hash&&(null===(r=o.hash)||void 0===r?void 0:r.name)!==t.hash)throw qt(t.hash,"algorithm.hash");if(t.namedCurve&&o.namedCurve!==t.namedCurve)throw qt(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&o.length!==t.length)throw qt(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){const n=t.algorithm.modulusLength;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires ke
8y modulusLength to be 2048 bits or larger"))}(e.alg,t),t)}const Cr=[["verify"],["sign"]];function kr(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:Cr}}function Ir(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?O(O({},n),{},{saltLength:t}):n,usages:Cr,minRsaBits:2048}}function Pr(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:Cr}}function xr(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:Cr}}function Lr(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:Cr}}const Mr=In({HS256:kr(256),HS384:kr(384),HS512:kr(512),RS256:Ir(256),RS384:Ir(384),RS512:Ir(512),PS256:Ir(256,32),PS384:Ir(384,48),PS512:Ir(512,64),ES256:Pr("P-256",256),ES384:Pr("P-384",384),ES512:Pr("P-521",512),EdDSA:xr(),Ed25519:xr(),"ML-DSA-44":Lr(44),"ML-DSA-65":Lr(65),"ML-DSA-87":Lr(87)});function Ur(e){const t="string"==typeof e?Mr[e]:void 0;if(!t)throw new tn("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function Dr(e,t,n){if(e instanceof Uint8Array&&Jt.decode(e),"string"!=typeof e)throw new nn("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 nn("Invalid Compact JWS");const s={payload:i,protected:o,signature:a},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let r;try{JSON.parse(Xt.decode(fn(e)))}catch(e){throw new t(n)}if(!mn(r))throw new t(n);return r}(e,nn,"JWS Protected Header is invalid");return t}(o),u=function(e,t,n){const r=Jn(e,Kn(nn,Gn,n[1],e,t)),o=t.alg;if("string"!=typeof o||!o)throw new nn('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(o))throw new en('"alg" (Algorithm) Header Parameter value not allowed');return[r,o]}(c,c,t),l=N(u,2),d=l[0],h=l[1],f=d?i:function(e){try{return Yt(e)}catch(e){throw new nn("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,r,o,i,a){var s;let c=!1;"function"==typeof n&&(await n(o,e),!0);const u="string"==typeof a,l=Ur(i),d=Vt(void 0!==r?Yt(r):new Uint8Array,Yt("."),u?null!==t[2]&&void 0!==s?s:t[2]=function(e,t,n){try{return Yt(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,nn):a),h=yn(e.signature,"signature",nn),f=await kn(l,n,"verify");if(!await async function(e,t,n,r){const o=await Nr(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,n,r)}catch(e){return!1}}(l,f,h,d))throw new un;return[u?yn(a,"payload",nn):a,o,u,f,c]}(s,t,n,o,c,h,f)}const Br=e=>Math.floor(e.getTime()/1e3),jr={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Fr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Hr="check_failed";function Gr(){throw new TypeError("Invalid time period format")}function Wr(e){"string"!=typeof e&&Gr();const t=Fr.exec(e);(!t||t[4]&&t[1])&&Gr();const n=parseFloat(t[2]),r=Math.round(n*jr[t[3][0].toLowerCase()]);return Number.isFinite(r)||Gr(),"-"===t[1]||"ago"===t[4]?-r:r}function Kr(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function Jr(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Xr(e,t){return"number"==typeof e?Kr(t,e):e instanceof Date?Kr(t,Br(e)):Br(new Date)+Wr(e)}const Vr=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function Yr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e[t];if(void 0!==r||n){if("number"!=typeof r)throw new Qt('"'.concat(t,'" claim must be a number'),e,t,"invalid");return r}}function qr(e,t){throw new Qt('unexpected "'.concat(t,'" claim value'),e,t,Hr)}function zr(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Xt.decode(t))}catch(e){}if(!mn(n))throw new rn("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(void 0!==o&&("string"!=typeof e.typ||Vr(e.typ)!==Vr(o)))throw new Qt('unexpected "typ" JWT header value',n,"typ",Hr);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(!Object.hasOwn(n,e))throw new Qt('missing required "'.concat(e,'" claim'),n,e,"missing");var h,f;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||qr(n,"iss"),void 0!==c&&n.sub!==c&&qr(n,"sub"),void 0===u||("string"==typeof n.aud?f.includes(h):Array.isArray(h)&&f.some(e=>h.includes(e)))||qr(n,"aud");const p=r.clockTolerance;let m=0;if("string"==typeof p)Wr(p);else if(void 0!==p){if("number"!=typeof p)throw new TypeError("Invalid clockTolerance option type");0}Kr("clockTolerance option",m);const w=r.currentDate,y=Kr("currentDate option",Br(void 0===w?new Date:w)),g=Yr(n,"iat",void 0!==l),v=Yr(n,"nbf");if(void 0!==v&&v>y+m)throw new Qt('"nbf" claim timestamp check failed',n,"nbf",Hr);const E=Yr(n,"exp");if(void 0!==E&&E<=y-m)throw new $t('"exp" claim timestamp check failed',n,"exp",Hr);if(void 0!==l){const e=y-g;if(e-m>Kr("maxTokenAge option","number"==typeof l?l:Wr(l)))throw new $t('"iat" claim timestamp check failed (too far in the past)',n,"iat",Hr);if(e<-m)throw new Qt('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Hr)}return n}let Zr;function Qr(e){return Zr.get(e)}async function $r(e,t,n,r,o){const i=N(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,r;try{n=JSON.stringify(t),r=JSON.parse(n)}
8catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!mn(r))throw new e("JOSE Header is not a JSON object");return[r,n]}(nn,e);return[t[0],pn(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new nn("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}(nn,e),Jn(e,Kn(nn,Gn,n,e,t))})(a,a,n)||o();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new nn('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Ur(t)}(a),u=pn(e),l=await async function(e,t,n,r){const o=Vt(Yt(e),Yt("."),t),i=await kn(n,r,"sign");return pn(await async function(e,t,n){const r=await Nr(e,t,"sign"),o=await crypto.subtle.sign(e.signing,r,n);return new Uint8Array(o)}(n,i,o))}(s,Yt(u),c,r);return"".concat(s,".").concat(u,".").concat(l)}const eo=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!mn(e))throw new TypeError("JWT Claims Set MUST be an object");(Zr||(Zr=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return Jr("iss",e),Qr(this).iss=e,this}setSubject(e){return Jr("sub",e),Qr(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of strings')}(e),Qr(this).aud=e,this}setJti(e){return Jr("jti",e),Qr(this).jti=e,this}setNotBefore(e){return Qr(this).nbf=Xr(e,"setNotBefore"),this}setExpirationTime(e){return Qr(this).exp=Xr(e,"setExpirationTime"),this}setIssuedAt(e){return Qr(this).iat=void 0===e?Br(new Date):"string"==typeof e?Kr("setIssuedAt",Br(new Date)+Wr(e)):Xr(e,"setIssuedAt"),this}};var to=new WeakMap;class no extends eo{constructor(){super(...arguments),b(this,to,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(E(to,this)),A(to,this,e),this}async sign(e,t){return $r(function(e){const t=Qr(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return Kt.encode(JSON.stringify(t))}(this),E(to,this),null==t?void 0:t.crit,e,()=>{throw new rn("JWTs MUST NOT use unencoded payload")})}}const ro='"alg" (Algorithm)';function oo(){throw new tn("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const io=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},ao=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},so=e=>{const t=ao(e);if(128&t){const n=127&t;let r=0;for(let t=0;t<n;t++)r=r<<8|ao(e);return r}return t},co=(e,t,n)=>{if(ao(e)!==t)throw new Error(n)},uo=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},lo=e=>{const t=(e=>{co(e,6,"Expected algorithm OID");const t=so(e);return uo(e,t)})(e);if(io(t,[43,101,110]))return"X25519";if(!io(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");co(e,6,"Expected curve OID");const n=so(e),r=uo(e,n);if(io(r,[42,134,72,206,61,3,1,7]))return"P-256";if(io(r,[43,129,4,0,34]))return"P-384";if(io(r,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},ho=(e,t,n)=>{const r=(e=>dn(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,r)=>{const o=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==r?void 0:r.extractable),i=function(e,t){var n,r;return null!==(n="string"==typeof e?null!==(r=Mr[e])&&void 0!==r?r:jn[e]:void 0)&&void 0!==n?n:oo(t)}(n,ro);i.secret&&oo(ro);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(co(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),so(e),"pkcs8"===t){co(e,2,"Expected version field");const t=so(e);e.pos+=t}co(e,48,"Expected algorithm identifier"),so(e)}(n,e),s=i.resolve({crv:lo(n)})}catch(e){throw new tn("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,null!=o?o:a,i.usages[a?0:1])})("pkcs8",r,t,n)};async function fo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t),o=n.alg;if(void 0===r[o]){const e=await gn(n,O(O({},t),{},{alg:o,ext:!0}));if("public"!==e.type)throw new on("JSON Web Key Set members must be public keys");r[o]=e}return r[o]}function po(e){let t;try{structuredClone(e)}catch(e){}if(!wn(t))throw new on("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,r)=>{const o=O(O({},e),null==r?void 0:r.header),i=o.alg,a=o.kid,s="string"==typeof i?Mr[i]:void 0;if(!s||s.secret)throw new tn('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,r){const o=vn(e),i=o.kty,a=o.key_ops,s=o.ext,c=o.kid,u=o.alg,l=o.use,d=o.crv,h=Array.isArray(a)?[...a]:a;return(void 0===s||"boolean"==typeof s)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===r||"string"==typeof r&&r===c)&&(void 0===u?"AKP"!==i:n===u)&&(void 0===l||"sig"===l)&&(!t.crv||d===t.crv)}(e,s,i,a)),u=c[0],l=c.length;if(!l)throw new an;if(1!==l){const e=new sn;throw e[Symbol.asyncIterator]=C(function*(){for(const e of c)try{yield yield g(fo(n,e,s))}catch(e){}}),e}return fo(n,u,s)},"jwks",{value:()=>structuredClone(t)})}var mo,wo;let yo;if("undefined"==typeof navigator||null===(mo=navigator.userAgent)||void 0===mo||null===(wo=mo.startsWith)||void 0===wo||!wo.call(mo,"Mozilla/5.0 ")){const e="v6.2.10";yo="".concat("jose","/").concat(e)}const go=Symbol(),vo=Symbol();function Eo(e,t){return Number.isFinite(e)&&Date.now()<e+t}function bo(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function Ao(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
8return ho(e,t,n)}const So=["mfaToken"],To=["mfaToken"];var _o,Oo,Ro,No,Co,ko,Io,Po,xo,Lo,Mo,Uo,Do,Bo,jo,Fo,Ho,Go,Wo,Ko,Jo,Xo,Vo,Yo,qo,zo,Zo,Qo,$o,ei,ti,ni,ri,oi,ii,ai,si,ci,ui,li,di,hi,fi,pi,mi,wi,yi,gi,vi,Ei,bi,Ai;function Si(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function Ti(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const r=e;let o;if(r.response instanceof Response)try{o=new Headers(r.response.headers),o.delete("set-cookie")}catch(e){o=void 0}const i={error:null!==(t=r.error)&&void 0!==t?t:"",error_description:null!==(n=r.error_description)&&void 0!==n?n:"",message:r.message,statusCode:"number"==typeof r.status?r.status:void 0,headers:o};if("mfa_required"===r.error&&r.cause){i.mfa_token="string"==typeof r.cause.mfa_token?r.cause.mfa_token:void 0;const e=r.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var _i=class extends Error{constructor(e,t){super(t),T(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Oi=class extends Error{constructor(e,t,n){super(t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"statusCode",void 0),T(this,"headers",void 0),T(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const r=Si(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ri=class extends Oi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Ni=class extends Oi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Ci=class extends Oi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},ki=class extends Oi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ii=class extends Oi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Pi=class extends Oi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},xi=class extends Oi{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},Li=class extends Oi{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}},Mi=class extends Error{constructor(e){super(e),T(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Ui=class extends Oi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),T(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Di=class extends Oi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Bi=class extends Oi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ji=class extends Oi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Fi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),T(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}},Hi=class extends Error{constructor(e){super(e),T(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Gi=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),T(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function Wi(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function Ki(e,t,n){var r;const o="object"==typeof t&&null!==t?t:void 0,i=null!==(r=null==o?void 0:o.response)&&void 0!==r?r:n,a="number"==typeof(null==o?void 0:o.status)?o.status:null==i?void 0:i.status;"number"==typeof a&&(e.statusCode=a),null!=i&&i.headers&&(e.headers=Wi(i.headers))}function Ji(e){return Object.entries(e).filter(e=>void 0!==N(e,2)[1]).reduce((e,t)=>
8O(O({},e),{},{[t[0]]:t[1]}),{})}function Xi(e){if(!e.trim())throw new Hi("organization must not be blank")}function Vi(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new Hi("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new Hi('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new Hi("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new Hi('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var Yi=class extends Error{constructor(e,t,n){super(t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"statusCode",void 0),T(this,"headers",void 0),T(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Si(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},qi=class extends Yi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},zi=class extends Yi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Zi=class extends Yi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Qi=class extends Yi{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},$i=class extends Yi{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function ea(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var ta=class e{constructor(e,t,n,r,o,i,a){T(this,"accessToken",void 0),T(this,"idToken",void 0),T(this,"refreshToken",void 0),T(this,"expiresAt",void 0),T(this,"scope",void 0),T(this,"claims",void 0),T(this,"authorizationDetails",void 0),T(this,"tokenType",void 0),T(this,"issuedTokenType",void 0),T(this,"recoveryCode",void 0),T(this,"act",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}};function na(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,O(O({},n),{},{headers:o}))}}function ra(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function oa(e){let t;const n=async(n,r)=>{const o=await e(n,r);return t=o.clone(),o};return n.getCapturedResponse=()=>t,n}function ia(e,t,n){if(!t)return e;const r=t.signal,o=t.headers,i=t.customFetch,a=i?na(i,n):e;return r||o?async(e,t)=>{const n=o?new Headers(e instanceof Request?e.headers:void 0):void 0;if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),o)for(const e of Object.entries(o)){var i=N(e,2);const t=i[0],r=i[1],o=t.toLowerCase();"authorization"!==o&&"auth0-client"!==o&&n.set(t,r)}const s=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,r=[e,t],o=r.find(e=>e.aborted);if(o)return n.abort(o.reason),{signal:n.signal};const i=[],a=()=>{r.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return r.forEach((e,t)=>{const r=()=>{a(),n.abort(e.reason)};i[t]=r,e.addEventListener("abort",r,{once:!0})}),{signal:n.signal,cleanup:a}}(r,null==t?void 0:t.signal);try{return await a(e,O(O(O({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var aa={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
8overy-code"},sa=(_o=new WeakMap,Oo=new WeakMap,Ro=new WeakMap,No=new WeakMap,Co=new WeakMap,ko=new WeakMap,Io=new WeakMap,Po=new WeakSet,class{constructor(e){var t,n;S(this,Po),b(this,_o,void 0),b(this,Oo,void 0),b(this,Ro,void 0),b(this,No,void 0),b(this,Co,void 0),b(this,ko,void 0),b(this,Io,void 0),A(_o,this,"https://".concat(e.domain)),A(Oo,this,e.clientId),A(Ro,this,e.clientSecret),A(No,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Co,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ra()),A(ko,this,e.getConfiguration),A(Io,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(E(_o,this),"/mfa/authenticators"),r=e.mfaToken,o=await y(Po,this,ca).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!o.ok){const e=await o.clone().text(),t=o.status,n=Wi(o.headers);let i;try{i=JSON.parse(e)}catch(r){throw new qi("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new qi(i.error_description||"Failed to list authenticators",O(O({},i),{},{statusCode:t,headers:n,body:e}))}return(await o.json()).map(ea)}async enrollAuthenticator(e,t){const n="".concat(E(_o,this),"/mfa/associate"),r=e.mfaToken,o=R(e,So),i={authenticator_types:o.authenticatorTypes};"oobChannels"in o&&(i.oob_channels=o.oobChannels),"phoneNumber"in o&&o.phoneNumber&&(i.phone_number=o.phoneNumber),"email"in o&&o.email&&(i.email=o.email);const a=await y(Po,this,ca).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Wi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new zi("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new zi(o.error_description||"Failed to enroll authenticator",O(O({},o),{},{statusCode:t,headers:n,body: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 a.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,r=e.mfaToken,o="".concat(E(_o,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await y(Po,this,ca).call(this,t)(o,{method:"DELETE",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=Wi(i.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Zi("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new Zi(o.error_description||"Failed to delete authenticator",O(O({},o),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(E(_o,this),"/mfa/challenge"),r=e.mfaToken,o=R(e,To),i={mfa_token:r,client_id:E(Oo,this),challenge_type:o.challengeType};E(Ro,this)&&(i.client_secret=E(Ro,this)),o.authenticatorId&&(i.authenticator_id=o.authenticatorId);const a=await y(Po,this,ca).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Wi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Qi("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new Qi(o.error_description||"Failed to challenge authenticator",O(O({},o),{},{statusCode:t,headers:n,body: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 a.json())}async verify(e,t){if(!E(ko,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var r;if(!E(Io,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=oa(null!==(r=(await E(ko,this).call(this,t))[tr])&&void 0!==r?r:fetch),c=await E(Io,this).call(this,s);
8try{const t=await Rr(c,aa[e.factorType],n),r=ta.fromTokenEndpointResponse(t);t.recovery_code&&(r.recoveryCode=t.recovery_code);const o=s.getCapturedResponse();if(!o)throw new Gi;return{data:r,response:o}}catch(e){var o,i,a;if(e instanceof Gi)throw e;if(e instanceof $i)throw e;const t=e,n=new $i(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(o=t.error)&&void 0!==o?o:"mfa_verify_error",error_description:null!==(i=null!==(a=t.error_description)&&void 0!==a?a:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw Ki(n,e,s.getCapturedResponse()),n}}const s=await E(ko,this).call(this,t);try{const t=await Rr(s,aa[e.factorType],n),r=ta.fromTokenEndpointResponse(t);return t.recovery_code&&(r.recoveryCode=t.recovery_code),r}catch(e){var c,u,l;if(e instanceof $i)throw e;const t=e,n=new $i(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(u=null!==(l=t.error_description)&&void 0!==l?l:t.message)&&void 0!==u?u:"Failed to verify MFA challenge"});throw Ki(n,e),n}}});function ca(e){return ia(E(No,this),e,E(Co,this))}var ua=class extends Error{constructor(e,t,n){super(t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"statusCode",void 0),T(this,"headers",void 0),T(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Si(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},la=class extends ua{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},da=class extends ua{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},ha=class extends ua{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function fa(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var pa="urn:okta:params:oauth:grant-type:webauthn",ma=(xo=new WeakMap,Lo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Do=new WeakMap,Bo=new WeakMap,jo=new WeakSet,class{constructor(e){var t,n;S(this,jo),b(this,xo,void 0),b(this,Lo,void 0),b(this,Mo,void 0),b(this,Uo,void 0),b(this,Do,void 0),b(this,Bo,void 0),A(xo,this,"https://".concat(e.domain)),A(Lo,this,e.clientId),A(Mo,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),A(Uo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Do,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ra()),A(Bo,this,e.grantRequest)}async register(e,t){const n="".concat(E(xo,this),"/passkey/register"),r=O(O(O(O(O(O(O(O({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),o=O(O({client_id:E(Lo,this)},fa(E(Mo,this))),{},{user_profile:r});e.realm&&(o.realm=e.realm),e.organization&&(o.organization=e.organization),e.userMetadata&&(o.user_metadata=e.userMetadata);const i=await y(jo,this,wa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await y(jo,this,ya).call(this,i),t=new la(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=Wi(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:O({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(E(xo,this),"/passkey/challenge"),r=O({client_id:E(Lo,this)},fa(E(Mo,this)));null!=e&&e.realm&&(r.realm=e.realm),null!=e&&e.organization&&(r.organization=e.organization);const o=await y(jo,this,wa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){const e=await y(jo,this,ya).call(this,o),t=new da(e.error_description||"Failed to request login challenge",e);throw t.statusCode=o.status,t.headers=Wi(o.headers),t}return{authSession:(i=await o.json()).auth_session,authnParamsPublicKey:O({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&Xi(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let r;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
8nce),e.organization&&n.append("organization",e.organization);try{r=await E(Bo,this).call(this,pa,n,t,e.fullResponse)}catch(e){if(e instanceof Gi)throw e;const t=Ti(e),n=new ha(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw Ki(n,e),n}if(e.fullResponse){const t=r;return e.organization&&Vi(t.data.claims,e.organization),t}const o=r;return e.organization&&Vi(o.claims,e.organization),o}});function wa(e){return ia(E(Uo,this),e,E(Do,this))}async function ya(e){const t=await e.clone().text();try{return O(O({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var ga=class extends Error{constructor(e,t,n){super(t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"statusCode",void 0),T(this,"headers",void 0),T(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const r=Si(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},va=class extends ga{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},Ea=class extends ga{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},ba=class extends ga{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},Aa=class extends ga{constructor(e,t,n,r,o){super("passwordless_challenge_error",e,n),T(this,"statusCode",void 0),T(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=r,this.headers=null!=o?o:this.headers}};function Sa(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function Ta(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await Ao(e.clientAssertionSigningKey,o);return{client_assertion:await new no({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new Fi}var _a=(Fo=new WeakMap,Ho=new WeakMap,Go=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,Vo=new WeakSet,class{constructor(e){var t,n;S(this,Vo),b(this,Fo,void 0),b(this,Ho,void 0),b(this,Go,void 0),b(this,Wo,void 0),b(this,Ko,void 0),b(this,Jo,void 0),b(this,Xo,void 0),A(Ho,this,e.domain),A(Fo,this,"https://".concat(e.domain)),A(Go,this,e.clientId),A(Wo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Ko,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ra()),A(Jo,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),A(Xo,this,e.grantRequest)}async sendEmail(e,t){const n=await y(Vo,this,Ra).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",r={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(r.authParams=e.authParams),r}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!Sa(e.phoneNumber))throw new va("Phone number must be in E.164 format (e.g. +14155550100).");const n=await y(Vo,this,Ra).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return y(Vo,this,Na).call(this,n,"Failed to request email OTP challenge",t)}
8async challengeWithPhoneNumber(e,t){if(!Sa(e.phoneNumber))throw new Aa("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return y(Vo,this,Na).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audience),!E(Xo,this))throw new ba("Missing grant request delegate.",Ti(new Error("missing grantRequest")));try{return await E(Xo,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Gi)throw e;const t=new ba("There was an error while trying to request a token.",Ti(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function Oa(e){return ia(E(Wo,this),e,E(Ko,this))}async function Ra(e,t,n,r){var o;const i=await Ta(E(Jo,this),E(Go,this),E(Ho,this)),a=O(O({client_id:E(Go,this)},e),i);let s;try{s=await y(Vo,this,Oa).call(this,r)("".concat(E(Fo,this),"/passwordless/start"),{method:"POST",headers:O({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new va("".concat(t,": a network error occurred."))}if(s.ok)return s;const c=await s.clone().text();let u;if(204!==s.status)try{u=JSON.parse(c)}catch(e){u=void 0}const l=new va((null===(o=u)||void 0===o?void 0:o.error_description)||t,u);throw l.statusCode=s.status,l.headers=Wi(s.headers),l.body=c,l}async function Na(e,t,n){var r,o;const i=await Ta(E(Jo,this),E(Go,this),E(Ho,this)),a=O(O({client_id:E(Go,this)},e),i);let s;try{s=await y(Vo,this,Oa).call(this,n)("".concat(E(Fo,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new Aa("challenge error: a network error occurred.",0,void 0,void 0)}if(s.ok){let n;try{n=await s.json()}catch(e){throw new Aa("".concat(t,": could not parse the response body."),s.status,void 0,void 0,Wi(s.headers))}return{authSession:n.auth_session}}const c=await s.clone().text();let u;try{u=JSON.parse(c)}catch(e){u=void 0}const l=u?O(O({},u),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new Aa((null===(r=u)||void 0===r?void 0:r.error_description)||t,s.status,l,null===(o=u)||void 0===o?void 0:o.validation_errors,Wi(s.headers))}var Ca=class extends Error{constructor(e,t,n){super(t),T(this,"cause",void 0),T(this,"code",void 0),T(this,"statusCode",void 0),T(this,"headers",void 0),T(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Si(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},ka=class extends Ca{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},Ia=class extends Ca{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function Pa(e,t,n){for(const r of t)if(null===e[r]||void 0===e[r]||""===e[r])throw new n('Required parameter "'.concat(String(r),'" was null, undefined, or empty.'))}function xa(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var La=(Yo=new WeakMap,qo=new WeakMap,zo=new WeakMap,Zo=new WeakMap,Qo=new WeakSet,class{constructor(e){var t,n;S(this,Qo),b(this,Yo,void 0),b(this,qo,void 0),b(this,zo,void 0),b(this,Zo,void 0),A(Yo,this,"https://".concat(e.domain)),A(qo,this,e.clientId),A(zo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Zo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ra())}async signUp(e,t){var n;Pa(e,["email","password","connection"],ka);const r=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:E(qo,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),o=await y(Qo,this,Ma).call(this,"/dbconnections/signup",r,ka,"Failed to sign up",t);if(e.fullResponse){const e=o.clone();return{data:xa(await o.json()),response:e}}return xa(await o.json())}async changePassword(e,t){var n;if(Pa(e,["connection"],Ia),!e.email&&!e.username)throw new Ia('Either "email" or "username" is required.');const r=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:E(qo,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),o=await y(Qo,this,Ma).call(this,"/dbconnections/change_password",r,Ia,"Failed to request a password change",t);if(e.fullResponse){const e=o.clone();return{data:await o.text(),response:e}}return o.text()}});async function Ma(e,t,n,r,o){const i=ia(E(zo,this),o,E(Zo,this));let a;try{a=await i("".concat(E(Yo,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(r,": a network error occurred."))}if(a.ok)return a;const s=await a.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(a.clone()),u=new n((null==c?void 0:c.error_description)||r,null!=c?c:{error:"unknown_error",error_description:r});throw u.statusCode=a.status,u.headers=Wi(a.headers),u.body=s,u}
8var Ua=class extends Error{constructor(e,t,n){super(t),T(this,"code",void 0),T(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Da=new Set(["session_expired","invalid_session_token"]);async function Ba(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var ja=($o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap,ii=new WeakMap,ai=new WeakMap,si=new WeakSet,class{constructor(e){var t;S(this,si),b(this,$o,void 0),b(this,ei,void 0),b(this,ti,void 0),b(this,ni,void 0),b(this,ri,void 0),b(this,oi,void 0),b(this,ii,void 0),b(this,ai,void 0),A($o,this,e.domain),A(ei,this,"https://".concat(e.domain)),A(ti,this,e.clientId),A(ni,this,e.clientSecret),A(ri,this,e.clientAssertionSigningKey),A(oi,this,e.clientAssertionSigningAlg),A(ii,this,e.useMtls),A(ai,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:E(ti,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await y(si,this,Ha).call(this,t);if(!n.sessionToken)throw new Ua("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await y(si,this,Fa).call(this,e.sessionToken,e)}catch(t){if(t instanceof Ua&&Da.has(t.code))return O(O({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(E(ei,this),"/anonymous/logout"),t={client_id:E(ti,this)},n=await E(ai,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await Ba(n);throw new Ua(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function Fa(e,t){const n={client_id:E(ti,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const r=await y(si,this,Ha).call(this,n);return{sessionToken:e,accessToken:r.accessToken,expiresAt:r.expiresAt,sessionTokenExpiresAt:r.sessionTokenExpiresAt,scope:r.scope,sessionReplaced:!1}}async function Ha(e){const t="".concat(E(ei,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await Ao(e.clientAssertionSigningKey,o);return{client_assertion:await new no({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:E(ni,this),clientAssertionSigningKey:E(ri,this),clientAssertionSigningAlg:E(oi,this),useMtls:E(ii,this)},E(ti,this),E($o,this));Object.assign(e,n);const r=await E(ai,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!r.ok){const e=await Ba(r);throw new Ua(e.error,e.error_description||"Anonymous token request failed",e)}let o;try{o=await r.json()}catch(e){throw new Ua("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new Ua("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new Ua("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(o)}var Ga=(ci=new WeakMap,ui=new WeakMap,li=new WeakMap,class{constructor(e,t){b(this,ci,new Map),b(this,ui,void 0),b(this,li,void 0),A(li,this,Math.max(1,Math.floor(e))),A(ui,this,Math.max(0,Math.floor(t)))}get(e){const t=E(ci,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return E(ci,this).delete(e),E(ci,this).set(e,t),t.value;E(ci,this).delete(e)}}set(e,t,n){E(ci,this).has(e)&&E(ci,this).delete(e);const r=null!=n&&Number.isFinite(n)&&n>0?n:E(ui,this);for(E(ci,this).set(e,{value:t,expiresAt:Date.now()+r});E(ci,this).size>E(li,this);){const e=E(ci,this).keys().next().value;if(void 0===e)break;E(ci,this).delete(e)}}}),Wa=new Map;function Ka(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 Ja=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Wa.get(i));var i;return o||(o=new Ga(e.maxEntries,e.ttlMs),Wa.set(t,o)),o}static createJwksCache(){return{}}},Xa="openid profile email offline_access",Va=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 Ya(e){if(null==e)throw new Pi("subject_token is required");if("string"!=typeof e)throw new Pi("subject_token must be a string");if(0===e.trim().length)throw new Pi("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Pi("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Pi("subject_token must not include the 'Bearer ' prefix")}function qa(e,t){if(t)for(const r of Object.entries(t)){var n=N(r,2);const t=n[0],o=n[1];if(!Va.has(t))if(Array.isArray(o)){if(o.length>20)throw new Pi("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}
8else e.append(t,o)}}var za="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",Za="urn:ietf:params:oauth:grant-type:token-exchange",Qa="urn:ietf:params:oauth:token-type:access_token";function $a(e,t){return(n,r)=>{const o=null==r?void 0:r.body;if(t!==pa||!(o instanceof URLSearchParams))return e(n,r);const i={};for(const e of o){var a=N(e,2);const t=a[0],n=a[1];i[t]="authn_response"===t?JSON.parse(n):n}const s=new Headers(null==r?void 0:r.headers);return s.set("Content-Type","application/json"),e(n,O(O({},r),{},{headers:s,body:JSON.stringify(i)}))}}di=new WeakMap,hi=new WeakMap,fi=new WeakMap,pi=new WeakMap,mi=new WeakMap,wi=new WeakMap,yi=new WeakMap,gi=new WeakMap,vi=new WeakMap,Ei=new WeakMap,bi=new WeakMap,Ai=new WeakSet;function es(){const e=E(mi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(E(mi,this).useMtls?"1":"0")}async function ts(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await y(Ai,this,ls).call(this,n),o=new lr(e,E(mi,this).clientId,{client_secret:E(mi,this).clientSecret,use_mtls_endpoint_aliases:E(mi,this).useMtls},r);return o[tr]=null!=t?t:E(wi,this),o}function ns(e){return ia(E(wi,this),e,E(yi,this))}async function rs(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await y(Ai,this,os).call(this,t),r=n.configuration,o=n.serverMetadata;if(!e)return{configuration:r,serverMetadata:o};const i=y(Ai,this,ns).call(this,e);return{configuration:await y(Ai,this,ts).call(this,o,i,t),serverMetadata:o}}async function os(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=E(e?hi:di,this);if(t&&E(fi,this))return{configuration:t,serverMetadata:E(fi,this)};const n=y(Ai,this,es).call(this);e||await y(Ai,this,ls).call(this,!1);const r=E(vi,this).get(n);if(r)return y(Ai,this,is).call(this,r.serverMetadata,e);const o=E(Ei,this).get(n);if(o){const t=await o;return y(Ai,this,is).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await cr(new URL("https://".concat(E(mi,this).domain)),E(mi,this).clientId,{use_mtls_endpoint_aliases:E(mi,this).useMtls},(e,t,n,r)=>{n.set("client_id",t.client_id)},{[tr]:E(wi,this)})).serverMetadata();return E(vi,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),E(Ei,this).set(n,i);try{const t=(await i).serverMetadata;return y(Ai,this,is).call(this,t,e)}finally{E(Ei,this).delete(n)}}async function is(e,t){const n=await y(Ai,this,ts).call(this,e,void 0,t);return A(fi,this,e),A(t?hi:di,this,n),{configuration:n,serverMetadata:e}}async function as(e,t,n){var r,o,i;const a=(await y(Ai,this,rs).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new Pi("audience and resource parameters are not supported for Token Vault exchanges");Ya(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==r?r:Qa,requested_token_type:null!==e.requestedTokenType&&void 0!==o?o:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&s.append("login_hint",e.loginHint),e.scope&&s.append("scope",e.scope),qa(s,e.extra),n){var c;const t=oa(null!==a[tr]&&void 0!==c?c:E(wi,this)),r=await y(Ai,this,ts).call(this,a.serverMetadata(),t);try{const e=await Rr(r,za,s),n=ta.fromTokenEndpointResponse(e),o=t.getCapturedResponse();if(!o)throw new Gi;return{data:n,response:o}}catch(n){if(n instanceof Gi)throw n;const r=new Pi("Failed to exchange token for connection '".concat(e.connection,"'."),Ti(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Wi(o.headers):void 0,r}}const u=oa(null!==a[tr]&&void 0!==i?i:E(wi,this)),l=await y(Ai,this,ts).call(this,a.serverMetadata(),u);try{const e=await Rr(l,za,s);return ta.fromTokenEndpointResponse(e)}catch(t){const n=new Pi("Failed to exchange token for connection '".concat(e.connection,"'."),Ti(t)),r=u.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Wi(r.headers):void 0,n}}function ss(e,t,n){var r;if(n.organization&&Vi(e.claims,n.organization),n.actorToken)if(null!==e.claims&&void 0!==r&&r.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new rn("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],r=t.length;if(5===r)throw new rn("Only JWTs using Compact JWS serialization can be decoded");
8if(3!==r)throw new rn("Invalid JWT");if(!n)throw new rn("JWTs must contain a payload");let o,i;try{fn(n)}catch(e){throw new rn("Failed to base64url decode the payload")}try{JSON.parse(Xt.decode(o))}catch(e){throw new rn("Failed to parse the decoded payload as JSON")}if(!mn(i))throw new rn("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function cs(e,t,n){var r;const o=(await y(Ai,this,rs).call(this,t)).configuration;if(Ya(e.subjectToken),void 0!==e.organization&&Xi(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new Pi("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),qa(i,e.extra),n){var a;const t=oa(null!==o[tr]&&void 0!==a?a:E(wi,this)),r=await y(Ai,this,ts).call(this,o.serverMetadata(),t);let s,c,u;try{if(await Rr(r,Za,i),ta.fromTokenEndpointResponse(c),t.getCapturedResponse(),!u)throw new Gi}catch(n){if(n instanceof Gi)throw n;const r=new Pi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ti(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Wi(o.headers):void 0,r}return y(Ai,this,ss).call(this,s,c,e),{data:s,response:u}}const s=oa(null!==o[tr]&&void 0!==r?r:E(wi,this)),c=await y(Ai,this,ts).call(this,o.serverMetadata(),s);let u,l;try{await Rr(c,Za,i),ta.fromTokenEndpointResponse(l)}catch(t){const n=new Pi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ti(t)),r=s.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Wi(r.headers):void 0,n}return y(Ai,this,ss).call(this,u,l,e),u}async function us(e,t,n){var r;const o=(await y(Ai,this,rs).call(this,t)).configuration;if(n){var i;const t=oa(null!==o[tr]&&void 0!==i?i:E(wi,this)),n=await y(Ai,this,ts).call(this,o.serverMetadata(),t);try{const r=await Rr(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),o=ta.fromTokenEndpointResponse(r),i=t.getCapturedResponse();if(!i)throw new Gi;return{data:o,response:i}}catch(e){if(e instanceof Gi)throw e;const n=new Ea("There was an error while trying to request a token.",Ti(e)),r=t.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Wi(r.headers):void 0,n}}const a=oa(null!==o[tr]&&void 0!==r?r:E(wi,this)),s=await y(Ai,this,ts).call(this,o.serverMetadata(),a);try{const t=await Rr(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return ta.fromTokenEndpointResponse(t)}catch(e){const t=new Ea("There was an error while trying to request a token.",Ti(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Wi(n.headers):void 0,t}}async function ls(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!E(mi,this).clientSecret||!!E(mi,this).clientAssertionSigningKey||!!E(mi,this).useMtls;return e&&!t?(e,t,n,r)=>{n.set("client_id",t.client_id)}:(E(pi,this)||A(pi,this,(async()=>{if(!E(mi,this).clientSecret&&!E(mi,this).clientAssertionSigningKey&&!E(mi,this).useMtls)throw new Fi;if(E(mi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=E(mi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await Ao(e,E(mi,this).clientAssertionSigningAlg||"RS256"),e?function(e){return xe(e,void 0)}(e):$n(E(mi,this).clientSecret)})().catch(e=>{throw A(pi,this,void 0),e})),E(pi,this))}async function ds(e){const t=(await y(Ai,this,os).call(this)).configuration,n=_e(),r=await function(e){return async function(e){return Se(e,"codeVerifier"),pe(await crypto.subtle.digest("SHA-256",de(e)))}(e)}(n),o=Ji(O(O({},E(mi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(O(O({scope:Xa},o),{},{client_id:E(mi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await br(t,i):await Er(t,i),codeVerifier:n}}new Ga(1e3,6e4);Error;new WeakMap,new WeakMap;const hs="auth0_sub",fs="mng-entitlements",ps="__MNG_Session",ms="regwallUserIsSubscribed";function ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ys(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,u(r.key),r)}}function gs(e,t,n){return t&&ys(e.prototype,t),n&&ys(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var vs=function(){function e(){ws(this,e),l(this,"readyPromise",null),l(this,"readyResolved",!1),l(this,"readyValue",!1)}return gs(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 s("BlueConicUtils | blueConicReady | returning c
8ached 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(vs,"DEFAULT_TIMEOUT",3e3);new vs;var Es,bs;function As(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 Ss(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?As(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):As(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){Es||(Es=e,bs&&(s("utils | Dispatching mng-auth-complete event (islands were not ready): ",bs),window.dispatchEvent(bs)))}),s("Waiting for islands ready");var Ts=function(){var e=window.location.href;return new URL(e)},_s=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),r=0;r<n.length;r+=1){var o=n[r].trimLeft();if(0===o.indexOf(t))return o.substring(t.length,o.length)}return!1},Os=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=Ts().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])},Rs=function(){var e=Os();return".".concat(e)},Ns=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=h(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},Cs=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=Os(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=h(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,";")})},ks=function(){return Ts().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Is=function(e){return function(e,t){if("string"!=typeof e)throw new f("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new f(`Invalid token specified: missing part #${n+1}`);let o;try{o=p(r)}catch(e){throw new f(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}
8catch(e){throw new f(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},Ps=function(){return"complete"===document.readyState},xs=function(){return new Promise(function(e){if(("interactive"===document.readyState||Ps())&&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)}})},Ls=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,xs();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)}}(),Ms=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,Ls(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)}}(),Us=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))})},Ds=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)}}(),Bs=function(){s("Clearing entitlements...");try{Cs(fs,{path:"/"})}catch(e){s("Failed to delete legacy cookie: ",e)}try{Cs(fs,{path:"/",domain:Os(),expires:365,secure:!0})}catch(e){s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(ps)}catch(e){s("Failed to remove local storage: ",e)}},js=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","COMM
8BANK","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","SO
8CIAL","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=js;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Fs=function(e){bs=new CustomEvent("mng-auth-check-complete",{detail:e}),Es?(s("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(bs)):s("Islands not ready")};window.addEventListener("authenticationReady",function(e){return Fs(e.detail)});var Hs=function(e){a.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Gs=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,h,f,p,m,w,y;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:Ss({},i)}));case 1:return r.next=2,Ms();case 2:return u=r.sent,r.next=3,Ls("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,Ds();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,s("checkPaywallStatus - Sophi is running: ",h),!h){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:Ss({},i)})},{once:!0}),r.next=12;break;case 8:if(h){r.next=12;break}return f=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([f,p]);case 10:!0===(m=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m)),r.next=12;break;case 11:r.prev=11,w=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(w);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:Ss({},i)}));case 13:r.prev=13,y=r.catch(0),n(y);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Gs);var Ws=function(){function e(){ws(this,e),l(this,"pendingSets",new Map),l(this,"flushTimer",null),l(this,"hasFlushed",!1),l(this,"isPaused",!1)}return gs(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,s("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){c("AdmiralUtils | pauseTargeting | failed",e)}else s("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)s('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return s("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
8try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),s('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),s("AdmiralUtils | flush | targeting ready.")}catch(e){c("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)s("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),s("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();l(Ws,"DEFAULT_READY_DELAY_MS",2e3);const Ks=Ws;function Js(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xs}=Object.prototype,{getPrototypeOf:Vs}=Object,{iterator:Ys,toStringTag:qs}=Symbol,zs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zs=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),Qs=(e,t,n)=>e===Object.prototype||!n&&null===t,$s=(e,t)=>{let n=e;const r=[];for(;null!=n;){if(-1!==r.indexOf(n))return!1;r.push(n);const o=Vs(n);if(Qs(n,o,n===e))return!1;if(zs(n,t))return!0;n=o}return!1},ec=(tc=Object.create(null),e=>{const t=Xs.call(e);return tc[t]||(tc[t]=t.slice(8,-1).toLowerCase())});var tc;const nc=e=>(e=e.toLowerCase(),t=>ec(t)===e),rc=e=>t=>typeof t===e,{isArray:oc}=Array,ic=rc("undefined");function ac(e){return null!==e&&!ic(e)&&null!==e.constructor&&!ic(e.constructor)&&uc(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const sc=nc("ArrayBuffer");const cc=rc("string"),uc=rc("function"),lc=rc("number"),dc=e=>null!==e&&"object"==typeof e,hc=e=>{if(!dc(e))return!1;const t=Vs(e);return!(null!==t&&t!==Object.prototype&&null!==Vs(t)||$s(e,qs)||$s(e,Ys))},fc=nc("Date"),pc=nc("File"),mc=nc("Blob"),wc=nc("FileList"),yc=nc("Set");const gc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},vc=void 0!==gc.FormData?gc.FormData:void 0,Ec=nc("URLSearchParams"),[bc,Ac,Sc,Tc]=["ReadableStream","Request","Response","Headers"].map(nc);function _c(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),oc(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(ac(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(r=0;r<i;r++)a=o[r],t.call(null,e[a],a,e)}}function Oc(e,t){if(ac(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Rc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Nc=e=>!ic(e)&&e!==Rc;const Cc=(kc="undefined"!=typeof Uint8Array&&Vs(Uint8Array),e=>kc&&e instanceof kc);var kc;const Ic=nc("HTMLFormElement"),{propertyIsEnumerable:Pc}=Object.prototype,xc=nc("RegExp"),Lc=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_c(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Mc=nc("AsyncFunction"),Uc=(Dc="function"==typeof setImmediate,Bc=uc(Rc.postMessage),Dc?setImmediate:Bc?(jc=`axios@${Math.random()}`,Fc=[],Rc.addEventListener("message",({source:e,data:t})=>{e===Rc&&t===jc&&Fc.length&&Fc.shift()()},!1),e=>{Fc.push(e),Rc.postMessage(jc,"*")}):e=>setTimeout(e));var Dc,Bc,jc,Fc;const Hc="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Rc):"undefined"!=typeof process&&process.nextTick||Uc,Gc=e=>null!=e&&uc(e[Ys]),Wc={isArray:oc,isArrayBuffer:sc,isBuffer:ac,isFormData:e=>{if(!e)return!1;if(vc&&e instanceof vc)return!0;const t=Vs(e);if(!t||t===Object.prototype)return!1;if(!uc(e.append))return!1;const n=ec(e);return"formdata"===n||"object"===n&&uc(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&sc(e.buffer),t},isString:cc,isNumber:lc,isBoolean:e=>!0===e||!1===e,isObject:dc,isPlainObject:hc,isEmptyObject:e=>{if(!dc(e)||ac(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:bc,isRequest:Ac,isResponse:Sc,isHeaders:Tc,isUndefined:ic,isDate:fc,isFile:pc,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:mc,isRegExp:xc,isFunction:uc,isStream:e=>dc(e)&&uc(e.pipe),isURLSearchParams:Ec,isTypedArray:Cc,isFileList:wc,forEach:_c,merge:function e(...t){const{caseless:n,skipUndefined:r}=Nc(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&"string"==typeof i&&Oc(o,i)||i,s=zs(o,a)?o[a]:void 0;hc(s)&&hc(t)?o[a]=e(s,t):hc(t)?o[a]=e({},t):oc(t)?o[a]=t.slice():r&&ic(t)||(o[a]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||ac(n))continue;if(_c(n,i),"object"!=typeof n||oc(n))continue;const r=Object.getOwnPropertySymbols(n);for(let e=0;e<r.length;e++){const t=r[e];Pc.call(n,t)&&i(n[t],t)}}return o},extend:(e,t,n,{allOwnKeys:r}={})=>(_c(t,(t,r)=>{n&&uc(t)?Object.defineProperty(e,r,{__proto__:null,value:Js(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,
vendor: 4,686 bytes, line 8
8configurable:!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&&Vs(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:ec,kindOfTest:nc,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(oc(e))return e;let t=e.length;if(!lc(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ys]).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:Ic,hasOwnProperty:zs,hasOwnProp:zs,hasOwnInPrototypeChain:$s,getSafeProp:(e,t)=>null!=e&&$s(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=Vs(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(Zs(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),r=Object.create(null),o=[];let i=e;for(;null!=i&&-1===o.indexOf(i);){o.push(i);const a=i===e?t:Vs(i);if(Qs(i,a,i===e))break;const s=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&s.push(...Object.getOwnPropertySymbols(i));for(const t of s)Zs(t)||zs(r,t)||(n[t]=e[t],r[t]=!0);i=a}return n},reduceDescriptors:Lc,freezeMethods:e=>{Lc(e,(t,n)=>{if(uc(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];uc(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 oc(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:Oc,global:Rc,isContextDefined:Nc,isSpecCompliantForm:function(e){return!!(e&&uc(e.append)&&"FormData"===e[qs]&&e[Ys])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(dc(e)){if(t.has(e))return;if(ac(e))return e;if(!("toJSON"in e)){let r;if(t.add(e),yc(e)){r=[];for(const t of e){const e=n(t);!ic(e)&&r.push(e)}}else r=oc(e)?[]:{},_c(e,(e,t)=>{const o=n(e);!ic(o)&&(r[t]=o)});return t.delete(e),r}}return e};return n(e)},isAsyncFn:Mc,isThenable:e=>e&&(dc(e)||uc(e))&&uc(e.then)&&uc(e.catch),setImmediate:Uc,asap:Hc,isIterable:Gc,isSafeIterable:e=>null!=e&&$s(e,Ys)&&Gc(e)},Kc=Wc.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"]),Jc=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();const i=Wc.hasOwnProp(t,n);!n||i&&Wc.hasOwnProp(Kc,n)||("set-cookie"===n?i?t[n].push(r):t[n]=[r]:t[n]=i?t[n]+", "+r:r)}),t};n.dn(Jc);const Xc=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Vc=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Yc(e,t){return Wc.isArray(e)?e.map(e=>Yc(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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 qc(e){const t=Object.create(null);return Wc.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>Yc(e,Vc))(e)}),t}const zc=Symbol("internals");function Zc(e){return e&&String(e).trim().toLowerCase()}function Qc(e){return!1===e||null==e?e:Wc.isArray(e)?e.map(Qc):(e=>Yc(e,Xc))(String(e))}const $c=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function eu(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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)}function tu(e,t,n,r,o){return Wc.isFunction(r)?r.call(this,t,n):(o&&(t=n),Wc.isString(t)?Wc.isString(r)?-1!==t.indexOf(r):Wc.isRegExp(r)?r.test(t):void 0:void 0)}class nu{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Zc(t);if(!o)return;const i=Wc.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Qc(e))}const i=(e,t)=>
vendor: 4,314 bytes, line 8
8Wc.forEach(e,(e,n)=>o(e,n,t));if(Wc.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Wc.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(Jc(e),t);else if(Wc.isObject(e)&&Wc.isSafeIterable(e)){let n,r,o=Object.create(null);for(const t of e){if(!Wc.isArray(t))throw new TypeError("Object iterator must return a key-value pair");r=t[0],Wc.hasOwnProp(o,r)?(n=o[r],o[r]=Wc.isArray(n)?[...n,t[1]]:[n,t[1]]):o[r]=t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Zc(e)){const n=Wc.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(Wc.isFunction(t))return t.call(this,e,n);if(Wc.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Zc(e)){const n=Wc.findKey(this,e);return!(!n||void 0===this[n]||t&&!tu(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Zc(e)){const o=Wc.findKey(n,e);!o||t&&!tu(0,n[o],o,t)||(delete n[o],r=!0)}}return Wc.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&&!tu(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Wc.forEach(this,(r,o)=>{const i=Wc.findKey(n,o);if(i)return t[i]=Qc(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]=Qc(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Wc.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Wc.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(){const e=this.get("set-cookie");return Wc.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let r=0,o=!1,i=!1;function a(e){const o=eu(n.slice(r,e)),i=o.indexOf("=");if(i<1)return;const a=eu(o.slice(0,i));if(!$c.test(a))return;const s=a.toLowerCase();if("__proto__"===s||"constructor"===s||"prototype"===s)return;const c=eu(o.slice(i+1));t[s]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let r=1;r<t;r++){const o=e.charCodeAt(r);if(34===o)return e;if(92===o&&(r+=1,r>=t))return e;n+=e[r]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);o?i?i=!1:92===t?i=!0:34===t&&(o=!1):34===t?o=!0:44!==t&&59!==t||(a(e),r=e+1)}return a(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[zc]=this[zc]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Zc(e);t[r]||(!function(e,t){const n=Wc.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 Wc.isArray(e)?e.forEach(r):r(e),this}}nu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Wc.reduceDescriptors(nu.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Wc.freezeMethods(nu);const ru=nu,ou="[REDACTED ****]";function iu(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(Wc.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ru&&(e=e.toJSON()),r.push(e),Wc.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);Wc.isUndefined(r)||(t[n]=r)});else{if(!Wc.isPlainObject(e)&&function(e){if(Wc.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Wc.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())?ou:o(i);Wc.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}function au(e){try{return String(e)}catch(e){return""}}
vendor: 4,872 bytes, line 8
8class su extends Error{static from(e,t,n,r,o,i){let a=e.message;!a&&Wc.isArray(e.errors)&&e.errors.length&&(a=function(e){return e.errors.map(e=>{try{return e&&e.message?au(e.message):au(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const s=new su(a,t||e.code,n,r,o);return Object.defineProperty(s,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),i&&Object.assign(s,i),s}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&&Wc.hasOwnProp(e,"redact")?e.redact:void 0,n=Wc.isArray(t)&&t.length>0?iu(e,t):Wc.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}}}su.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",su.ERR_BAD_OPTION="ERR_BAD_OPTION",su.ECONNABORTED="ECONNABORTED",su.ETIMEDOUT="ETIMEDOUT",su.ECONNREFUSED="ECONNREFUSED",su.ERR_NETWORK="ERR_NETWORK",su.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",su.ERR_DEPRECATED="ERR_DEPRECATED",su.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",su.ERR_BAD_REQUEST="ERR_BAD_REQUEST",su.ERR_CANCELED="ERR_CANCELED",su.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",su.ERR_INVALID_URL="ERR_INVALID_URL",su.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const cu=su;function uu(e){return Wc.isPlainObject(e)||Wc.isArray(e)}function lu(e){return Wc.endsWith(e,"[]")?e.slice(0,-2):e}function du(e,t,n){return e?e.concat(t).map(function(e,t){return e=lu(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const hu=Wc.toFlatObject(Wc,{},null,function(e){return/^is[A-Z]/.test(e)});const fu=function(e,t,n){if(!Wc.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(e,t)=>{const r=Wc.getSafeProp(n,e);return Wc.isUndefined(r)?t:r},o=r("metaTokens",!0),i=r("visitor")||p,a=r("dots",!1),s=r("indexes",!1),c=r("Blob")||"undefined"!=typeof Blob&&Blob,u=r("maxDepth",100),l=c&&Wc.isSpecCompliantForm(t),d=[];if(!Wc.isFunction(i))throw new TypeError("visitor must be a function");function h(e){if(null===e)return"";if(Wc.isDate(e))return e.toISOString();if(Wc.isBoolean(e))return e.toString();if(!l&&Wc.isBlob(e))throw new cu("Blob is not supported. Use a Buffer instead.");if(Wc.isArrayBuffer(e)||Wc.isTypedArray(e)){if(l&&"function"==typeof c)return new c([e]);throw new cu("Blob is not supported. Use a Buffer instead.",cu.ERR_NOT_SUPPORT)}return e}function f(e){if(e>u)throw new cu("Object is too deeply nested ("+e+" levels). Max depth: "+u,cu.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(e,n,r){let i=e;if(Wc.isReactNative(t)&&Wc.isReactNativeBlob(e))return t.append(du(r,n,a),h(e)),!1;if(e&&!r&&"object"==typeof e)if(Wc.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,r){if(!Wc.isObject(r))return r;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(r),f(t+n.length-1),r})}(e,1);else if(Wc.isArray(e)&&function(e){return Wc.isArray(e)&&!e.some(uu)}(e)||(Wc.isFileList(e)||Wc.endsWith(n,"[]"))&&(i=Wc.toArray(e)))return n=lu(n),i.forEach(function(e,r){!Wc.isUndefined(e)&&null!==e&&t.append(!0===s?du([n],r,a):null===s?n:n+"[]",h(e))}),!1;return!!uu(e)||(t.append(du(r,n,a),h(e)),!1)}const m=Object.assign(hu,{defaultVisitor:p,convertValue:h,isVisitable:uu});if(!Wc.isObject(e))throw new TypeError("data must be an object");return function e(n,r,o=0){if(!Wc.isUndefined(n)){if(f(o),-1!==d.indexOf(n))throw new Error("Circular reference detected in "+r.join("."));d.push(n),Wc.forEach(n,function(n,a){!0===(!(Wc.isUndefined(n)||null===n)&&i.call(t,n,Wc.isString(a)?a.trim():a,r,m))&&e(n,r?r.concat(a):[a],o+1)}),d.pop()}}(e),t};function pu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function mu(e,t){this._pairs=[],e&&fu(e,this,t)}const wu=mu.prototype;wu.append=function(e,t){this._pairs.push([e,t])},wu.toString=function(e){const t=e?t=>e.call(this,t,pu):pu;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const yu=mu;function gu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vu(e,t,n){if(!t)return e;e=e||"";const r=Wc.isFunction(n)?{serialize:n}:n,o=Wc.getSafeProp(r,"encode")||gu,i=Wc.getSafeProp(r,"serialize");let a;if(a=i?i(t,r):Wc.isURLSearchParams(t)?t.toString():new yu(t,r).toString(o),a){const t=e.indexOf("#");
vendor: 18,814 bytes, line 8
8-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Eu=Symbol("internals");function bu(e){return e?e.length:0}function Au(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Su(e,t){const n=e.handlers,r=bu(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(e,r){n[e.index]!==e.handler&&t.handlerEntries.delete(r)}):t.handlerEntries.clear()),t.handlersLength=r}const Tu=class{constructor(){this.handlers=[],this[Eu]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const r={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},o=this[Eu];null==this.handlers&&(this.handlers=[]),Su(this,o);const i=o.nextId++;return this.handlers.push(r),o.handlerEntries.set(i,{handler:r,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,i}eject(e){const t=this[Eu];Su(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(Au(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Su(this,this[Eu]))}forEach(e){const t=this[Eu];Su(this,t),t.iterationDepth++;try{Wc.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Su(this,t),Au(this.handlers),t.handlersLength=bu(this.handlers))}}},_u={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Ou={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:yu,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ru="undefined"!=typeof window&&"undefined"!=typeof document,Nu="object"==typeof navigator&&navigator||void 0,Cu=Ru&&(!Nu||["ReactNative","NativeScript","NS"].indexOf(Nu.product)<0),ku="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Iu=Ru&&window.location.href||"http://localhost",Pu={...e,...Ou};function xu(e){if(e>100)throw new cu("FormData field is too deeply nested ("+e+" levels). Max depth: 100",cu.ERR_FORM_DATA_DEPTH_EXCEEDED)}const Lu=function(e){function t(e,n,r,o){xu(o);let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&Wc.isArray(r)?r.length:i,s)return Wc.hasOwnProp(r,i)?r[i]=Wc.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;Wc.hasOwnProp(r,i)&&Wc.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Wc.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<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!a}if(Wc.isFormData(e)&&Wc.isFunction(e.entries)){const n={};return Wc.forEachEntry(e,(e,r)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;null!==(r=n.exec(e));)xu(t.length),t.push("[]"===r[0]?"":r[1]||r[0]);return t}(e),r,n,0)}),n}return null},Mu=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Uu=(e,t)=>null!=e&&Wc.hasOwnProp(e,t)?e[t]:void 0;const Du={transitional:_u,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Wc.isObject(e);o&&Wc.isHTMLForm(e)&&(e=new FormData(e));if(Wc.isFormData(e))return r?JSON.stringify(Lu(e)):e;if(Wc.isArrayBuffer(e)||Wc.isBuffer(e)||Wc.isStream(e)||Wc.isFile(e)||Wc.isBlob(e)||Wc.isReadableStream(e))return e;if(Wc.isArrayBufferView(e))return e.buffer;if(Wc.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Uu(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return fu(e,new Pu.classes.URLSearchParams,{visitor:function(e,t,n,r){return Pu.isNode&&Wc.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=Wc.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Uu(this,"env"),r=n&&n.FormData;return fu(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Wc.isString(e))try{return(t||JSON.parse)(e),Wc.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Uu(this,"transitional")||Du.transitional,n=t&&t.forcedJSONParsing,r=Uu(this,"responseType"),o="json"===r;if(Wc.isResponse(e)||Wc.isReadableStream(e))return e;if(e&&Wc.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Uu(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw cu.from(e,cu.ERR_BAD_RESPONSE,this,null,Uu(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Pu.classes.FormData,Blob:Pu.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Wc.forEach(Mu,e=>{Du.headers[e]={}});const Bu=Du;function ju(e,t){const n=this||Bu,r=t||n,o=ru.from(r.headers);let i=r.data;return Wc.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Fu(e){return!(!e||!e.__CANCEL__)}const Hu=class extends cu{constructor(e,t,n){super(e??"canceled",cu.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Gu(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new cu("Request failed with status code "+n.status,n.status>=400&&n.status<500?cu.ERR_BAD_REQUEST:cu.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const Wu=/[\t\n\r]/g;function Ku(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(Wu,"")}function Ju(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const Xu=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<t)return;const h=u&&c-u;return h?Math.round(1e3*d/h):void 0}};const Vu=function(e,t){let n,r,o=0,i=1e3/t;const a=(t,i=Date.now())=>{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),(...e)=>a(e)]},Yu=(e,t,n=3)=>{let r=0;const o=Xu(50,250);return Vu(n=>{if(!n||!Wc.isNumber(n.loaded))return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=Math.max(0,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)},qu=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zu=(e,t=Wc.asap)=>(...n)=>t(()=>e(...n)),Zu=Pu.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Pu.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Pu.origin),Pu.navigator&&/(msie|trident)/i.test(Pu.navigator.userAgent)):()=>!0,Qu=Pu.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Wc.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Wc.isString(r)&&s.push(`path=${r}`),Wc.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),Wc.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;n<t.length;n++){const r=t[n].replace(/^\s+/,""),o=r.indexOf("=");if(-1!==o&&r.slice(0,o)===e)try{return decodeURIComponent(r.slice(o+1))}catch(e){return r.slice(o+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const $u=/^https?:(?!\/\/)/i;function el(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${ou}@`),n=t.indexOf("#"),r=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${ou}`);return-1===n?r:`${r}#${o=t.slice(n+1),o?o.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${ou}`):o}`;var o}function tl(e,t){if("string"==typeof e){const n=Ku(e);if($u.test(n))throw new cu(`Invalid URL ${JSON.stringify(el(n))}: missing "//" after protocol`,cu.ERR_INVALID_URL,t)}}function nl(e,t,n,r){tl(t,r);let o=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(o||!1===n)?(tl(e,r),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const rl=e=>e instanceof ru?{...e}:e;function ol(e,t){e=e||{},t=t||{};const n=Object.create(null);function r(e,t,n,r){return Wc.isPlainObject(e)&&Wc.isPlainObject(t)?Wc.merge.call({caseless:r},e,t):Wc.isPlainObject(t)?Wc.merge({},t):Wc.isArray(t)?t.slice():t}function o(e,t,n,o){return Wc.isUndefined(t)?Wc.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Wc.isUndefined(t))return r(void 0,t)}function a(e,t){return Wc.isUndefined(t)?Wc.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return Wc.hasOwnProp(t,i)?r(n,o):Wc.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,timeoutErrorMessage: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(rl(e),rl(t),0,!0)};var u;return Wc.forEach((u={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(u).concat(Object.getOwnPropertySymbols(u).filter(e=>Object.getOwnPropertyDescriptor(u,e).enumerable)):Object.keys(u)),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Wc.hasOwnProp(c,r)?c[r]:o,a=i(Wc.hasOwnProp(e,r)?e[r]:void 0,Wc.hasOwnProp(t,r)?t[r]:void 0,r);Wc.isUndefined(a)&&i!==s||(n[r]=a)}),Wc.hasOwnProp(t,"validateStatus")&&Wc.isUndefined(t.validateStatus)&&!1===function(n){const r=Wc.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!Wc.isUndefined(r)){if(!Wc.isPlainObject(r))return;if(Wc.hasOwnProp(r,n))return r[n]}const o=Wc.hasOwnProp(e,"transitional")?e.transitional:void 0;if(Wc.isPlainObject(o)&&Wc.hasOwnProp(o,n))return o[n]}("validateStatusUndefinedResolves")&&(Wc.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const il=["content-type","content-length"];const al=function(e){const t=ol({},e),n=e=>Wc.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");if(t.headers=s=ru.from(s),t.url=vu(nl(u,d,l,t),n("params"),n("paramsSerializer")),c){const t=Wc.getSafeProp(c,"username")||"",n=Wc.getSafeProp(c,"password")||"";try{s.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw cu.from(t,cu.ERR_BAD_OPTION_VALUE,e)}}if(Wc.isFormData(r)){const e=Wc.getSafeProp(r,"getHeaders");Pu.hasStandardBrowserEnv||Pu.hasStandardBrowserWebWorkerEnv||Wc.isReactNative(r)?s.setContentType(void 0):Wc.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{il.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,e.call(r),n("formDataHeaderPolicy"))}if(Pu.hasStandardBrowserEnv){Wc.isFunction(o)&&(o=o(t));if(!0===o||null==o&&Zu(t.url)){const e=i&&a&&Qu.read(a);e&&s.set(i,e)}}return t},sl="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=al(e);let o=r.data;const i=ru.from(r.headers).normalize();let a,s,c,u,l,d,{responseType:h,onUploadProgress:f,onDownloadProgress:p}=r;function m(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let w=new XMLHttpRequest;function y(o){if(!w)return;if(!(0!==w.status||"file"===(Ju(Ku(r.url))||Ju(Pu.origin))||w.responseURL&&w.responseURL.startsWith("file:")))return n(new cu("Request aborted",cu.ECONNABORTED,e,w)),m(),void(w=null);try{o?d&&d(o):l&&l()}catch(e){setTimeout(()=>{throw e})}if(!w)return;const i=ru.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders());Gu(function(e){t(e),m()},function(e){n(e),m()},{data:h&&"text"!==h&&"json"!==h?w.response:w.responseText,status:w.status,statusText:w.statusText,headers:i,config:e,request:w}),w=null}w.open(r.method.toUpperCase(),r.url,!0),w.timeout=r.timeout,"onloadend"in w?w.onloadend=y:w.onreadystatechange=function(){w&&4===w.readyState&&(0!==w.status||w.responseURL&&w.responseURL.startsWith("file:"))&&setTimeout(y)},w.onabort=function(){w&&(n(new cu("Request aborted",cu.ECONNABORTED,e,w)),m(),w=null)},w.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new cu(r,cu.ERR_NETWORK,e,w);o.event=t||null,n(o),m(),w=null},w.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||_u;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new cu(t,o.clarifyTimeoutError?cu.ETIMEDOUT:cu.ECONNABORTED,e,w)),m(),w=null},void 0===o&&i.setContentType(null),"setRequestHeader"in w&&Wc.forEach(qc(i),function(e,t){w.setRequestHeader(t,e)}),Wc.isUndefined(r.withCredentials)||(w.withCredentials=!!r.withCredentials),h&&"json"!==h&&(w.responseType=r.responseType),p&&([c,l,d]=Yu(p,!0),w.addEventListener("progress",c)),f&&w.upload&&([s,u]=Yu(f),w.upload.addEventListener("progress",s),w.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{w&&(n(!t||t.type?new Hu(null,e,w):t),w.abort(),m(),w=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const g=Ju(r.url);if(g&&!Pu.protocols.includes(g))return n(new cu("Unsupported protocol "+g+":",cu.ERR_BAD_REQUEST,e)),void m();w.send(o||null)})},cl=(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 cu?t:new Hu(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new cu(`timeout of ${t}ms exceeded`,cu.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=>{r||(e.aborted?o.call(e):e.addEventListener("abort",o,{once:!0}))});const{signal:s}=n;return s.unsubscribe=()=>Wc.asap(a),s},ul=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},ll=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},dl=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of ll(e))yield*ul(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})},hl=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,fl=(e,t,n)=>t+2<n&&hl(e.charCodeAt(t+1))&&hl(e.charCodeAt(t+2)),pl=e=>e<=57?e-48:(223&e)-55,ml=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,wl=e=>9===e||10===e||12===e||13===e||32===e,yl=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},gl=e=>{const t=e.length;let n=0,r=0,o=!1;for(let i=0;i<t;i++){let a=e.charCodeAt(i);37===a&&fl(e,i,t)&&(a=16*pl(e.charCodeAt(i+1))+pl(e.charCodeAt(i+2)),i+=2),wl(a)||(61!==a?!ml(a)||r>0?o=!0:n++:r++)}return o||r>2||r>0&&(n+r)%4!=0||n%4==1?yl(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},vl=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const r=e.slice(5,n),o=e.slice(n+1);if(/;base64/i.test(r))return t(o);let i=0;for(let e=0,t=o.length;e<t;e++){const n=o.charCodeAt(e);if(37===n&&fl(o,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=o.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const El={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:bl}=Wc,Al=e=>{if(!Wc.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Sl=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Tl=e=>{const t=void 0!==Wc.global&&null!==Wc.global?Wc.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Wc.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?bl(o):"function"==typeof fetch,c=bl(i),u=bl(a);if(!s)return!1;const l=s&&bl(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 f=c&&l&&Sl(()=>{let e=!1;const t=new i(Pu.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&&Sl(()=>Wc.isReadableStream(new a("").body)),m={stream:p&&(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 cu(`Response type '${e}' is not supported`,cu.ERR_NOT_SUPPORT,n)})});const w=async e=>{if(null==e)return 0;if(Wc.isBlob(e))return e.size;if(Wc.isSpecCompliantForm(e)){const t=new i(Pu.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Wc.isArrayBufferView(e)||Wc.isArrayBuffer(e)?e.byteLength:(Wc.isURLSearchParams(e)&&(e+=""),Wc.isString(e)?(await d(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:d,timeout:h,onDownloadProgress:y,onUploadProgress:g,responseType:v,headers:E,withCredentials:b="same-origin",fetchOptions:A,maxContentLength:S,maxBodyLength:T,maxRedirects:_}=al(e);const O=Wc.isNumber(S)&&S>-1,R=Wc.isNumber(T)&&T>-1;let N=o||fetch;v=v?(v+"").toLowerCase():"text";
vendor: 11,519 bytes, line 8
8let C=cl([u,d&&d.toAbortSignal()],h),k=null;const I=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let P,x=null;const L=()=>new cu("Request body larger than maxBodyLength limit",cu.ERR_BAD_REQUEST,e,k);try{let o;const u=(U="auth",Wc.hasOwnProp(e,U)?e[U]:void 0);if(u){const e=Wc.getSafeProp(u,"username")||"";o={username:e,password:Wc.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,Pu.origin);if(!o&&(e.username||e.password)){const t=Al(e.username);o={username:t,password:Al(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(o&&(E.delete("authorization"),E.set("Authorization","Basic "+btoa((M=(o.username||"")+":"+(o.password||""),encodeURIComponent(M).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),O&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return vl(-1===t?e:e.slice(0,t),gl)}(t);if(n>S)throw new cu("maxContentLength size of "+S+" exceeded",cu.ERR_BAD_RESPONSE,e,k)}if(R&&"get"!==n&&"head"!==n){const e=await w(s);if("number"==typeof e&&isFinite(e)&&(P=e,e>T))throw L()}const d=R&&(Wc.isReadableStream(s)||Wc.isStream(s)),h=(e,t,n)=>dl(e,65536,e=>{if(R&&e>T)throw x=L();t&&t(e)},n);if(f&&"get"!==n&&"head"!==n&&(g||d)){if(P=P??await(async(e,t)=>{const n=Wc.toFiniteNumber(e.getContentLength());return n??w(t)})(E,s),0!==P||d){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(Wc.isFormData(s)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=g&&qu(P,Yu(zu(g)))||[];s=h(n.body,e,t)}}}else if(d&&!c&&l&&"get"!==n&&"head"!==n)s=h(s);else if(d&&c&&!f&&"get"!==n&&"head"!==n)throw new cu("Stream request bodies are not supported by the current fetch implementation",cu.ERR_NOT_SUPPORT,e,k);Wc.isString(b)||(b=b?"include":"omit");const D=c&&"credentials"in i.prototype;if(Wc.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/1.20.0",!1);const B=null==A?A:Object.assign(Object.create(null),A);B&&(delete B.body,delete B.headers,delete B.method,delete B.signal,delete B.duplex,delete B.credentials);const j=Object.assign(Object.create(null),B,{signal:C,method:n.toUpperCase(),headers:qc(E.normalize()),body:s,duplex:"half",credentials:D?b:void 0});c&&(Wc.forEach(El,(e,t)=>{void 0===j[t]&&(j[t]=e)}),void 0===j.signal&&(j.signal=null),void 0===j.body&&(j.body=null)),0===_&&(j.redirect="manual",B&&(B.redirect="manual")),k=c&&new i(t,j);let F=await(c?N(k,B):N(t,j));const H=ru.from(F.headers);if(O){const t=Wc.toFiniteNumber(H.getContentLength());if(null!=t&&t>S)throw new cu("maxContentLength size of "+S+" exceeded",cu.ERR_BAD_RESPONSE,e,k)}const G=p&&("stream"===v||"response"===v);if(p&&F.body&&(y||O||G&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=F[e]});const n=Wc.toFiniteNumber(H.getContentLength()),[r,o]=y&&qu(n,Yu(zu(y),!0))||[];let i=0;const s=t=>{if(O&&(i=t,i>S))throw new cu("maxContentLength size of "+S+" exceeded",cu.ERR_BAD_RESPONSE,e,k);r&&r(t)};F=new a(dl(F.body,65536,s,()=>{o&&o(),I&&I()}),t)}v=v||"text";let W=await m[Wc.findKey(m,v)||"text"](F,e);if(O&&!p&&!G){let t;if(null!=W&&("number"==typeof W.byteLength?t=W.byteLength:"number"==typeof W.size?t=W.size:"string"==typeof W&&(t="function"==typeof r?(new r).encode(W).byteLength:W.length)),"number"==typeof t&&t>S)throw new cu("maxContentLength size of "+S+" exceeded",cu.ERR_BAD_RESPONSE,e,k)}return!G&&I&&I(),await new Promise((t,n)=>{Gu(t,n,{data:W,headers:ru.from(F.headers),status:F.status,statusText:F.statusText,config:e,request:k})})}catch(t){if(I&&I(),C&&C.aborted&&C.reason instanceof cu){const n=C.reason;throw n.config=e,k&&(n.request=k),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(x)throw k&&!x.request&&(x.request=k),x;if(t instanceof cu)throw k&&!t.request&&(t.request=k),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new cu("Network Error",cu.ERR_NETWORK,e,k,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw cu.from(t,t&&t.code,e,k,t&&t.response)}var M,U}},_l=new Map,Ol=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=_l;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Tl(t)),u=s;return s},Rl=(Ol(),{http:null,xhr:sl,fetch:{get:Ol}});Wc.forEach(Rl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Nl=e=>`- ${e}`,Cl=e=>Wc.isFunction(e)||null===e||!1===e;const kl={getAdapter:function(e,t){e=Wc.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a<n;a++){let n;if(r=e[a],o=r,!Cl(r)&&(o=Rl[(n=String(r)).toLowerCase()],void 0===o))throw new cu(`Unknown adapter '${n}'`);if(o&&(Wc.isFunction(o)||(o=o.get(t))))break;i[n||"#"+a]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`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(Nl).join("\n"):" "+Nl(e[0]):"as no adapter specified";throw new cu("There is no suitable adapter to dispatch the request "+t,cu.ERR_NOT_SUPPORT)}return o},adapters:Rl};function Il(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Hu(null,e)}function Pl(e){const t=Wc.toSafeFlatObject(e);Il(t),t.headers=ru.from(Wc.getSafeProp(t,"headers")),t.data=ju.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return kl.getAdapter(t.adapter||Bu.adapter,t)(t).then(function(e){Il(t),t.response=e;try{e.data=ju.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=ru.from(e.headers),e},function(e){if(!Fu(e)&&(Il(t),e&&e.response)){t.response=e.response;try{e.response.data=ju.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=ru.from(e.response.headers)}return Promise.reject(e)})}const xl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{xl[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Ll={};xl.transitional=function(e,t,n){function r(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new cu(r(o," has been removed"+(t?" in "+t:"")),cu.ERR_DEPRECATED);return t&&!Ll[o]&&(Ll[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)}},xl.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Ml={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new cu("options must be an object",cu.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 cu("option "+i+" must be "+n,cu.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new cu("Unknown option "+i,cu.ERR_BAD_OPTION)}},validators:xl},Ul=Ml.validators;class Dl{constructor(e){this.defaults=e||{},this.interceptors={request:new Tu,response:new Tu}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let r="";if("string"==typeof n){const e=n.indexOf("\n");r=-1===e?"":n.slice(e+1)}if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),o=-1===n?"":r.slice(n+1);String(e.stack).endsWith(o)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ol(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ml.assertOptions(n,{silentJSONParsing:Ul.transitional(Ul.boolean),forcedJSONParsing:Ul.transitional(Ul.boolean),clarifyTimeoutError:Ul.transitional(Ul.boolean),legacyInterceptorReqResOrdering:Ul.transitional(Ul.boolean),advertiseZstdAcceptEncoding:Ul.transitional(Ul.boolean),validateStatusUndefinedResolves:Ul.transitional(Ul.boolean)},!1),null!=r&&(Wc.isFunction(r)?t.paramsSerializer={serialize:r}:Ml.assertOptions(r,{encode:Ul.function,serialize:Ul.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ml.assertOptions(t,{baseUrl:Ul.spelling("baseURL"),withXsrfToken:Ul.spelling("withXSRFToken")},!0),t.method=(Wc.getSafeProp(t,"method")||Wc.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=o&&Wc.merge(o.common,o[t.method]);o&&Wc.forEach(Mu.concat("common"),e=>{delete o[e]}),t.headers=ru.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||_u;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=[Pl.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=a.length;let h=t;for(;d<l;){const e=a[d++],t=a[d++];try{h=e?e(h):h}catch(e){if(!t){u=Promise.reject(e);break}try{const n=t.call(this,e);Wc.isThenable(n)&&(u=Promise.resolve(n).then(()=>Pl.call(this,h)))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=Pl.call(this,h)}catch(e){u=Promise.reject(e)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return vu(nl((e=ol(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}Wc.forEach(["delete","get","head","options"],function(e){Dl.prototype[e]=function(t,n){return this.request(ol(n||{},{method:e,url:t,data:n&&Wc.hasOwnProp(n,"data")?n.data:void 0}))}}),Wc.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,r,o){return this.request(ol(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Dl.prototype[e]=t(),"query"!==e&&(Dl.prototype[e+"Form"]=t(!0))});const Bl=Dl;class jl{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{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 Hu(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 jl(function(t){e=t});return{token:t,cancel:e}}}const Fl=jl;const Hl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
8alContent: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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Hl).forEach(([e,t])=>{void 0===Hl[t]&&(Hl[t]=e)});const Gl=Hl;const Wl=function e(t){const n=new Bl(t),r=Js(Bl.prototype.request,n);return Wc.extend(r,Bl.prototype,n,{allOwnKeys:!0}),Wc.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ol(t,n))},r}(Bu);Wl.Axios=Bl,Wl.CanceledError=Hu,Wl.CancelToken=Fl,Wl.isCancel=Fu,Wl.VERSION="1.20.0",Wl.toFormData=fu,Wl.AxiosError=cu,Wl.Cancel=Wl.CanceledError,Wl.all=function(e){return Promise.all(e)},Wl.spread=function(e){return function(t){return e.apply(null,t)}},Wl.isAxiosError=function(e){return Wc.isObject(e)&&!0===e.isAxiosError},Wl.mergeConfig=ol,Wl.AxiosHeaders=ru,Wl.formToJSON=e=>Lu(Wc.isHTMLForm(e)?new FormData(e):e),Wl.getAdapter=kl.getAdapter,Wl.HttpStatusCode=Gl,Wl.default=Wl;const Kl=Wl;var Jl,Xl,Vl=function(){try{var e=localStorage.getItem(ps);return"string"==typeof e?e:"{}"}catch(e){s("Unable to get session from local storage: ",e)}return"{}"},Yl=function(e){try{s("Setting local storage session",e),localStorage.setItem(ps,e)}catch(e){s("Unable to save session from local storage: ",e)}},ql=function(e){try{Ns(fs,e,{path:"/",domain:Rs(),expires:365,secure:!0})}catch(e){s("Unable to save session to cookie storage: ",e)}},zl=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,h,f,p,m,w,y,g,v,E,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,Kl.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return h=r.data.entitlementTokenDecoded,f=r.data,p=f.accessToken,m=f.idToken,w=f.entitlementToken,y=null!==(i=null==h?void 0:h.entitlement_expiry)&&void 0!==i?i:null,g=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,v=null!==(u=null==h?void 0:h.entitlement_entitled)&&void 0!==u?u:null,E=null!==(l=null==h?void 0:h.entitlement_extras_adfree)&&void 0!==l?l:null,b=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,Yl(JSON.stringify({accessToken:p,idToken:m,entitlementToken:w,expiration:y,entitlementSource:g,isEntitled:v,adFree:E,entitlementLevel:b})),""!==w&&"string"==typeof w&&ql(w),e.abrupt("return",{accessToken:p,idToken:m,entitlementToken:w,expiration:y,entitlementSource:g,isEntitled:v,adFree:E,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)}}(),Zl=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,Kl.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)}}(),Ql=function(){var e=r(o.mark(function e(){var t,n,r,i,a,c,u,l,d,h,f,p,m,w,y,g,v,E,b,A,S,T,_,O,R,N,C,k;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Inside getSession"),e.prev=1,d=Vl(),s("Session: __MNG_Session = ",d),h=JSON.parse(d),f=h.accessToken,p=h.idToken,m=h.entitlementToken,w=h.expiration,y=h.entitlementSource,g=h.isEntitled,v=h.adFree,E=h.entitlementLevel,n=f,i=w,a=y,c=g,u=v,l=E,s("Session: check both tokens: ",t=p,r=m),void 0!==p&&void 0!==m&&null!==p&&null!==m){e.next=3;break}
8return s("Session: missing id or entitlements, try session server"),e.next=2,zl();case 2:b=e.sent,A=b.accessToken,S=b.idToken,T=b.entitlementToken,_=b.expiration,O=b.entitlementSource,R=b.isEntitled,N=b.adFree,C=b.entitlementLevel,n=A,t=S,r=T,i=_,a=O,c=R,u=N,l=C;case 3:e.next=5;break;case 4:e.prev=4,k=e.catch(1),s("Failed to get session: ",k);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)}}(),$l=function(){var e=r(o.mark(function e(t){var n,r,i,a,c,u,l,d,h,f,p,m,w,y,g,v,E,b,A,S,T,_,O,R,N,C,k,I,P;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Vl(),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,h=r.expiration,f=void 0===h?null:h,p=r.entitlementSource,m=void 0===p?null:p,w=r.isEntitled,y=void 0===w?null:w,g=r.adFree,v=void 0===g?null:g,E=r.entitlementLevel,b=void 0===E?null:E,A=t.accessToken,S=t.idToken,T=t.entitlementToken,_=t.expiration,O=t.entitlementSource,R=t.isEntitled,N=t.adFree,C=t.entitlementLevel,k={accessToken:A??a,idToken:S??u,entitlementToken:T??d,expiration:_??f,entitlementSource:O??m,isEntitled:R??y,adFree:N??v,entitlementLevel:C??b},s("Current session data: ",r),s("New session data: ",t),s("Updated session data:",k),I=JSON.stringify(k),Yl(I),""!==k.entitlementToken&&"string"==typeof k.entitlementToken&&ql(k.entitlementToken),n===I){e.next=1;break}return e.next=1,Zl(k);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)}}(),ed="1"===window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){Jl||(Jl=e,Xl&&(s("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",Xl),window.dispatchEvent(Xl)))});var td=function(){var e=window.localStorage.getItem(ps);return JSON.parse(e)},nd=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,Ql();case 1:return t=e.sent,e.abrupt("return",t);case 2:return n=td(),e.abrupt("return",n);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),rd=function(e){Ns(fs,e,{path:"/",domain:Rs(),expires:365,secure:!0})},od=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,rd(t),s("About to decode token before saving: ",t),n=Is(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,$l({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(ps,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)}}(),id=function(){var e=r(o.mark(function e(t){var n,r,i,u,l,d,h,f,p,m,w,y,g,v;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,Ql();case 1:"string"==typeof(r=e.sent).idToken&&""!==r.idToken&&(i=Is(r.idToken),n=void 0!==i&&i.email_verified),e.next=4;break;case 2:return e.next=3,Us();case 3:u=e.sent,(l=u.idToken)&&""!==l&&(n=Is(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},h="".concat(a.A.entitlementsEndpoint,"session/refresh"),e.prev=6,e.next=7,$.ajax({type:"POST",url:h,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(f=e.sent).success){e.next=10;break}if(!f.success){e.next=8;break}
8p=null===(m=f.data)||void 0===m?void 0:m.jwt,e.next=9;break;case 8:throw w=f.error||{},y=w.message||w.error||"Entitlements API returned an unknown error",new Error("API error: ".concat(y));case 9:e.next=11;break;case 10:p=f.jwt;case 11:return s("Entitlements: Request successful: ",p),e.next=12,od(p);case 12:return e.abrupt("return",p);case 13:if(e.prev=13,g=e.catch(6),c("Entitlements: Create Token Failure: ",g),Bs(),!window.authentication_config.sessionManagementEnabled){e.next=17;break}return e.prev=14,e.next=15,$l({entitlementToken:null});case 15:e.next=17;break;case 16:e.prev=16,v=e.catch(14),c("Entitlements: Save Session Failure during error handling: ",v);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)}}(),ad=function(){var e=r(o.mark(function e(t){var n,r,u,l,d,h,f,p,m,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=Os(n),t.sub&&(u=t.sub),t.idToken&&(l=t.idToken),l||u){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return d={publication:r.replace("vipdev.lndo.site","com"),requestSource:"website"},l?d.idToken=l:u&&(d.uuid=u),h="".concat(a.A.entitlementsEndpoint,"session/create"),s("Entitlements: create payload",d),e.prev=3,e.next=4,$.ajax({type:"POST",url:h,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 4:if("boolean"!=typeof(f=e.sent).success){e.next=6;break}if(f.success){e.next=5;break}return e.abrupt("return",new Error("Entitlements | API returned no JWT"));case 5:p=f.data.jwt,s("Entitlements: Token Created: ",p),e.next=7;break;case 6:p=f.jwt;case 7:return e.next=8,od(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,m=e.catch(3),s("Entitlements: Create Token Failure: ",m),Bs(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,$l({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)}}(),sd=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,nd();case 1:if((t=e.sent)&&t.entitlementToken){e.next=2;break}return e.abrupt("return",!1);case 2:if(!((n=Date.now()/1e3)<t.expiration)){e.next=3;break}return e.abrupt("return",t.entitlementToken);case 3:return s("checkLocalStorageForToken, Refreshing token, ".concat(n," > ").concat(t.expiration)),e.abrupt("return",id(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)}}(),cd=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=_s(fs)){e.next=1;break}return e.abrupt("return",!1);case 1:return s("checkCookiesForToken, Refreshing token, ".concat(t)),e.next=2,id(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)}}(),ud=function(e){Xl=new CustomEvent("mng-entitlement-check-complete",{detail:e}),Jl?(s("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",e),window.dispatchEvent(Xl)):s("Islands not ready")};window.addEventListener("entitlementsReady",function(e){return ud(e.detail)});var ld=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=Is(e);!function(e){var t=_s("mng-jwt-decoded");t&&t===e||Ns("mng-jwt-decoded",JSON.stringify(e),{path:"/",domain:Rs(),expires:365,secure:!0})}(n),t=Object.assign(t,{isEntitled:n.entitlement_entitled,adfree:n.entitlement_extras_adfree||!1,subscriptionLevel:n.entitlement_level})}
8var 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"),Hs("entitlementsReady"),ud(t)}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)}},dd=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,ad({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)}}(),hd=function(){void 0!==window.MNGAuthentication&&Array.isArray(window.MNGAuthentication.oidcLoginCallbacks)&&window.MNGAuthentication.oidcLoginCallbacks.push(dd)},fd=function(){var e=JSON.parse(window.localStorage.getItem(ps));return null!=e&&(s("Subscriber Check: : ",e.isEntitled),e.isEntitled)},pd=function(){var e=Ks.getInstance(),t=fd();e.queueSet("entitled",t?"true":"false"),e.scheduleReady(),s("Admiral `entitled` KVP queued:",t?"true":"false")},md=function(e){var t=e.searchParams.get("entitlement_jwt");s("Webview JWT param provided: ",t),rd(t);var n=Is(t);window.localStorage.setItem(ps,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}))},wd=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,h,f,p,m,w,y,g,v,E,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(ms),i=_s(hs),c=Ts(),u=ks(),l=_s("clearEntCache"),!(n||l||c.searchParams.has("newUser"))){e.next=7;break}return d="".concat(a.A.entitlementsEndpoint,"session/create"),e.next=2,Us();case 2:return h=e.sent,f={uuid:h.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(f)});case 4:e.sent&&(s("loggedOutNewSubscriberActions","Entitlements: Cache cleared"),Cs("clearEntCache")),e.next=6;break;case 5:e.prev=5,v=e.catch(3),s("loggedOutNewSubscriberActions","Entitlements:  Cache clear Failure - ".concat(v.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,m={sub:i,email_verified:!0},e.next=9,ad(m);case 9:if((w=e.sent)&&""!==w&&(y=Is(w),g=y.entitlement_entitled,p=g),s("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(p)),!p){e.next=10;break}return window.localStorage.setItem(ms,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 10:case 11:return e.abrupt("return",!1);case 12:return e.prev=12,E=e.catch(1),s("loggedOutNewSubscriberActions error",E),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,null,[[1,12],[3,5]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(ps));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=fd,window.MNGAuthentication.loggedOutNewSubscriberActions=wd;var yd=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,h,f,p,m,w,y,g,v,E,b,A,S;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!ed){e.next=1;break}return pd(),s("Embed login is enabled, skipping entitlements.js init"),e.abrupt("return",!1);case 1:if(!a.A.entitlementsEnabled){e.next=40;break}return pd(),e.next=2,wd();case 2:if(!e.sent){e.next=3;break}return e.abrupt("return",ld(!1));case 3:return t=window.location,n=new URL(t.href),e.next=4,Us();case 4:if(r=e.sent,i=r.idToken,c=r.accessToken,u=r.isAuthenticated,l=r.claims,hd(),e.prev=5,!n.searchParams.has("newUser")){e.next=9;break}if("string"!=typeof i||""===i){e.next=8;break}return e.next=6,ad({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",ld(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")&&md(n)}catch(e){s("Error during webview JWT retrieval: ",e)}return e.prev=12,e.next=13,sd();case 13:if(!((h=e.sent)instanceof Error)){e.next=14;break}throw h;case 14:h&&(d=h,s("Entitlements Init: Local Storage Token exists")),e.next=16;break;case 15:e.prev=15,v=e.catch(12),s("Error during Local Storage Token check: ",v);case 16:if(e.prev=16,d){e.next=19;break}return e.next=17,cd();case 17:if(!((f=e.sent)instanceof Error)){e.next=18;break}throw f;case 18:f&&(d=f,s("Entitlements Init: Cookie Token exists"));case 19:e.next=21;break;case 20:e.prev=20,E=e.catch(16),s("Error during Cookie Token check: ",E);case 21:if(!u&&d&&(s("Entitled-only flow: User is not authenticated but entitlement token exists."),Is(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",ld(!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,ad(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(m=Is(d),w=m.entitlement_entitled,y=m.iat,s("LINA check: isEntitled: ".concat(w,", token created at: ").concat(y)),!(a.A.linaCheckOnArticles&&!w&&Date.now()/1e3-new Date(y)>45)){e.next=31;break}if(s("Checking entitlements again for LINA user."),""===i){e.next=30;break}return e.next=27,ad({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,Ms();case 28:return"article"===e.sent&&window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",ld(g));case 29:e.next=31;break;case 30:s("LINA check, no idToken.");case 31:return e.abrupt("return",ld(d));case 32:e.next=34;break;case 33:e.prev=33,A=e.catch(26),s("LINA check error: ",A);case 34:if(e.prev=34,"string"!=typeof i||""===i){e.next=37;break}return e.next=35,ad({idToken:i});case 35:if(!(d=e.sent)){e.next=36;break}return s("Entitlements Init: Created new token"),e.abrupt("return",ld(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",ld(!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 gd={init:yd};(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,gd.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})();
9//# sourceMappingURL=mng-digisubs.entitlements.bundle.js.map;
10/*! For license information please see mng-digisubs.uiHandler.bundle.js.LICENSE.txt */
11(()=>{var e={5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports}
vendor: 4,557 bytes, line 11
11,6993(e,t,n){var o=n(5546);function r(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,r,i,a){var s=r&&r.prototype instanceof u?r:u,c=Object.create(s.prototype);return o(c,"_invoke",function(e,o,r){var i,a,s,c=0,u=r||[],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,l}};function p(e,o){for(a=e,s=o,n=0;!d&&c&&!r&&n<u.length;n++){var r,i=u[n],p=h.p,f=i[2];e>3?(r=f===o)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((r=e<2&&p<i[1])?(a=0,h.v=o,h.n=i[1]):p<f&&(r=e<3||i[0]>o||o>f)&&(i[4]=e,i[5]=o,h.n=f,a=0))}if(r||e>1)return l;throw d=!0,o}return function(r,u,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,f),a=u,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||(r="next"),n=i[r]){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 '"+r+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(o,h))!==l)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var l={};function u(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(o(n={},a,function(){return this}),n),f=h.prototype=u.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,o(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,o(f,"constructor",h),o(h,"constructor",d),d.displayName="GeneratorFunction",o(h,s,"GeneratorFunction"),o(f),o(f,s,"Generator"),o(f,a,function(){return this}),o(f,"toString",function(){return"[object Generator]"}),(e.exports=r=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var o=n(887);e.exports=function(e,t,n,r,i){var a=o(e,t,n,r,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 o=n(6993),r=n(1791);e.exports=function(e,t,n,i,a){return new r(o().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var o=n(5172),r=n(5546);e.exports=function e(t,n){function i(e,r,a,s){try{var c=t[e](r),l=c.value;return l instanceof o?n.resolve(l.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(l).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(r(e.prototype),r(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(e,t,o){function r(){return new n(function(t,n){i(e,o,t,n)})}return a=a?a.then(r,r):r()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,o,r,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,o,r){function i(n,o){t(e,n,function(e){return this._invoke(n,o,e)})}n?a?a(e,n,{value:o,enumerable:!r,configurable:!r,writable:!r}):e[n]=o:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,o,r,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 o in t)n.unshift(o);return function e(){for(;n.length;)if((o=n.pop())in t)return e.value=o,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var o=n(5172),r=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),l=n(579);function u(){"use strict";var t=r(),n=t.m(u),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(o){t||(t={stop:function(){return n(o.a,2)},catch:function(){return o.v},abrupt:function(e,t){return n(o.a,p[e],t)},delegateYield:function(e,r,i){return t.resultName=r,n(o.d,l(e),i)},finish:function(e){return n(o.f,e)}},n=function(e,n,r){o.p=t.prev,o.n=t.next;try{return e(n,r)}finally{t.next=o.n}}),t.resultName&&(t[t.resultName]=o.v,t.resultName=void 0),t.sent=o.v,t.next=o.n;try{return e.call(this,t)}finally{o.p=t.prev,o.n=t.next}}}return(e.exports=u=function(){return{wrap:function(e,n,o,r){return t.w(f(e),n,o,r&&r.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new o(e,t)}
11,AsyncIterator:s,async:function(e,t,n,o,r){return(h(t)?a:i)(f(e),t,n,o,r)},keys:c,values:l}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=u,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var o=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(o(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 o=n(4633)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}},467(e,t,n){"use strict";function o(e,t,n,o,r,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(o,r)}function r(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function s(e){o(a,r,i,s,c,"next",e)}function c(e){o(a,r,i,s,c,"throw",e)}s(void 0)})}}n.d(t,{A:()=>r})},3029(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{A:()=>o})},2901(e,t,n){"use strict";n.d(t,{A:()=>i});var o=n(9922);function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(0,o.A)(r.key),r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}},4467(e,t,n){"use strict";n.d(t,{A:()=>r});var o=n(9922);function r(e,t,n){return(t=(0,o.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:()=>r});var o=n(2284);function r(e,t){if("object"!=(0,o.A)(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=(0,o.A)(r))return r;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 o=n(2284),r=n(2327);function i(e){var t=(0,r.A)(e,"string");return"symbol"==(0,o.A)(t)?t:t+""}},2284(e,t,n){"use strict";function o(e){return o="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},o(e)}n.d(t,{A:()=>o})},1834(e,t,n){"use strict";var o=n(467),r=n(3029),i=n(2901),a=n(4467),s=n(4756),c=n(3153);window.disableAuth0AuthFlow=!0;var l=function(){function e(){var t,n;(0,r.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,o.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",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*e.backupTimeoutLength,r=this.readyInstances.get(n);if(r)return c.A.log("connextReady promise already exists for ".concat(n,", status is ").concat(r.status,".")),"pending"===r.status&&o<r.timeoutMs&&(c.A.log("Shorter timeout of ".concat(o,"ms requested, replacing existing ").concat(r.timeoutMs,"ms timeout.")),clearTimeout(r.timeout),r.timeoutMs=o,r.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void r.resolveOnce(!0);
11c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),r.resolveOnce(!1)},o)),r.promise;c.A.log('Creating new connext ready promise for "'.concat(n,'" with timeout of ').concat(o,"ms."));var i={promise:null,timeout:null,status:"pending",timeoutMs:o,resolveOnce:null};return i.promise=new Promise(function(e){var r=!1;if(i.resolveOnce=function(t){r||(i.status=t,e(t),r=!0,i.timeout&&(clearTimeout(i.timeout),i.timeout=null))},"undefined"!=typeof Connext&&"onInit"===n)return c.A.log('Connext already ready for event "'.concat(n,'".')),t.removeEventListener(n),void i.resolveOnce(!0);i.timeout=setTimeout(function(){if(t.removeEventListener(n),"undefined"!=typeof Connext&&"onInit"===n)return c.A.log("Connext actually did load..."),void i.resolveOnce(!0);c.A.log('Connext did not fire "'.concat(n,'" in time. Resolving false...')),i.resolveOnce(!1)},o),c.A.log('Listening for Connext event "'.concat(n,'"...'));var a=function(){c.A.log('Connext event "'.concat(n,'" fired!')),t.removeEventListener(n),i.resolveOnce(!0)};document.addEventListener(n,a),t.eventListeners[n]=a,c.A.log('Connext added event listener for "'.concat(n,'"'))}),this.readyInstances.set(n,i),i.promise}},{key:"runConnext",value:function(){"undefined"!=typeof Connext&&(c.A.log("Running Connext now..."),Connext.Run(),this.connextAlreadyRan=!0,this.runConnextIfSilentTimer&&clearTimeout(this.runConnextIfSilentTimer))}},{key:"rerunConnextEntitlements",value:(n=(0,o.A)(s.mark(function t(){var n,o,r=arguments;return s.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>0&&void 0!==r[0]&&r[0],o=r.length>1&&void 0!==r[1]&&!r[1]||this.runningSophi?1e3*e.backupTimeoutLength:1e3*e.defaultTimeoutLength,t.next=1,this.connextReady("onInit",o);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,o.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)(l,"defaultTimeoutLength",300),(0,a.A)(l,"backupTimeoutLength",1e5),(0,a.A)(l,"subTimeoutInterval",5e3),window.ConnextUtils=window.ConnextUtils||new l;const u=l;n.d(t,["A",0,u])},3153(e,t,n){"use strict";var o=n(3612);const r={log:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(o.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}}};n.d(t,["A",0,r])},3612(e,t,n){"use strict";var o,r,i,a,s;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===(o=window.authentication_config)||void 0===o?void 0:o.articleSharingEnabled)&&"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.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.linaC
11heckOnArticles,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,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var r=t[o++],i=t[o++],a=0===i?{enumerable:!0,value:t[o++]}:{enumerable:!0,get:i};n.o(e,r)||Object.defineProperty(e,r,a)}else 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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{hasBrowserEnv:()=>Qu,hasStandardBrowserEnv:()=>ed,hasStandardBrowserWebWorkerEnv:()=>td,navigator:()=>$u,origin:()=>nd});var t=n(467),o=n(4756),r=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,o=Array(t);n<t;n++)o[n]=e[n];return o}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}class d extends Error{}function h(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function p(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function f(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function m(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function g(e,t){this.v=e,this.k=t}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function y(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function v(e){return new g(e,0)}function b(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function A(e,t){return e.get(y(e,t))}function S(e,t,n){b(e,t),t.set(e,n)}function E(e,t,n){return e.set(y(e,t),n),n}function k(e,t){b(e,t),t.add(e)}function _(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
11t%2?T(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e){return function(){return new x(e.apply(this,arguments))}}function x(e){var t,n;function o(t,n){try{var i=e[t](n),a=i.value,s=a instanceof g;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return o(c,n);n=e[c](n).value}r(!!i.done,n)},function(e){o("throw",e)})}catch(e){r(2,e)}}function r(e,r){2===e?t.reject(r):t.resolve({value:r,done:e}),(t=t.next)?o(t.key,t.arg):n=null}this._invoke=function(e,r){return new Promise(function(i,a){var s={key:e,arg:r,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,o(e,r))})},"function"!=typeof e.return&&(this.return=void 0)}d.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,x.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},x.prototype.next=function(e){return this._invoke("next",e)},x.prototype.throw=function(e){return this._invoke("throw",e)},x.prototype.return=function(e){return this._invoke("return",e)};const N={timeoutInSeconds:60},L=1e4,P="memory",U="Multifactor authentication required",M="online_access",D={name:"auth0-spa-js",version:"2.27.0"},j=()=>Date.now(),B="default";class W extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,W.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new W(t,n)}}class G extends W{constructor(e,t){super("invalid_configuration","".concat(e," ").concat(t)),this.suggestion=t,Object.setPrototypeOf(this,G.prototype)}}class K extends W{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=o,Object.setPrototypeOf(this,K.prototype)}}class H extends W{constructor(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=o,this.appState=r,Object.setPrototypeOf(this,H.prototype)}}class F extends W{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,F.prototype)}}class X extends F{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,X.prototype)}}class J extends W{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,J.prototype)}}class z extends W{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,z.prototype)}}class V extends W{constructor(e,t,n,o){super(e,t),this.mfa_token=n,this.mfa_requirements=o,Object.setPrototypeOf(this,V.prototype)}}class Z extends W{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(Q(e,["default"]),"', scope: '").concat(Q(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,Z.prototype)}}class Y extends W{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(Q(e,["default"]),"', missing scope: '").concat(Q(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,Y.prototype)}}class q extends W{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,q.prototype)}}function Q(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const ee=()=>window.crypto,te=()=>{let e="";for(;e.length<43;){const t=ee().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},ne=e=>btoa(e),oe=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],re=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,o)=>
11{if(t&&"env"===o)return n;const r=oe.find(e=>e.key===o);return r&&r.type.includes(typeof e[o])&&(n[o]=e[o]),n},{})},ie=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()},ae=async e=>{const t=ee().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},se=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),ce=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 le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},ue={},de={};Object.defineProperty(de,"__esModule",{value:!0});var he=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var o=e.locked.get(t);void 0===o?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(o.unshift(n),e.locked.set(t,o))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,o){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 o=n.pop();e.locked.set(t,n),void 0!==o&&setTimeout(o,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();de.default=function(){return he.getInstance()};var pe=le&&le.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})},fe=le&&le.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},me=le;Object.defineProperty(ue,"__esModule",{value:!0});var ge=de,we="browser-tabs-lock-key",ye={key:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},clear:function(){return pe(me,void 0,void 0,function(){return fe(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return pe(me,void 0,void 0,function(){return fe(this,function(e){throw new Error("Unsupported")})})},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function ve(e){return new Promise(function(t){return setTimeout(t,e)})}function be(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var Ae=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+be(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),pe(this,void 0,void 0,function(){var o,r,i,a,s,c,l;return fe(this,function(u){switch(u.label){case 0:o=Date.now()+be(4),r=Date.now()+n,i=we+"-"+t,a=void 0===this.storageHandler?ye:this.storageHandler,u.label=1;case 1:return Date.now()<r?[4,ve(30)]:[3,8];case 2:return u.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+
11o,[4,ve(Math.floor(25*Math.random()))]);case 3:return u.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:o,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,ve(30)];case 4:return u.sent(),null!==(c=a.getItemSync(i))&&(l=JSON.parse(c)).id===this.id&&l.iat===o?(this.acquiredIatSet.add(o),this.refreshLockWhileAcquired(i,o),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?ye:this.storageHandler),[4,this.waitForSomethingToChange(r)];case 6:u.sent(),u.label=7;case 7:return o=Date.now()+be(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return pe(this,void 0,void 0,function(){var n=this;return fe(this,function(o){return setTimeout(function(){return pe(n,void 0,void 0,function(){var n,o,r;return fe(this,function(i){switch(i.label){case 0:return[4,ge.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?ye:this.storageHandler,null===(o=n.getItemSync(e))?(ge.default().unlock(t),[2]):((r=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(r)),ge.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(ge.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return pe(this,void 0,void 0,function(){return fe(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var o=!1,r=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!o){o=!0;var t=50-(Date.now()-r);t>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 pe(this,void 0,void 0,function(){return fe(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 pe(this,void 0,void 0,function(){var n,o,r,i;return fe(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?ye:this.storageHandler,o=we+"-"+t,null===(r=n.getItemSync(o))?[2]:(i=JSON.parse(r)).id!==this.id?[3,2]:[4,ge.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(o),ge.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,o=t,r=[],i=0;;){var a=o.keySync(i);if(null===a)break;r.push(a),i++}for(var s=!1,c=0;c<r.length;c++){var l=r[c];if(l.includes(we)){var u=o.getItemSync(l);if(null!==u){var d=JSON.parse(u);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(o.removeItemSync(l),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),Se=ue.default=Ae;class Ee{async runWithLock(e,t,n){const o=new AbortController,r=setTimeout(()=>o.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:o.signal},async e=>{if(clearTimeout(r),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(r),"AbortError"===(null==e?void 0:e.name))throw new F;throw e}}}class ke{constructor(){this.activeLocks=new Set,this.lock=new Se,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let o=!1;for(let n=0;n<10&&!o;n++)o=await this.lock.acquireLock(e,t);if(!o)throw new F;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 _e=null;function Te(){return _e||(_e=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new Ee:new ke;var e}()),_e}const Oe=new TextEncoder,Ce=new TextDecoder;function Re(e){return"string"==typeof e?Oe.encode(e):Ce.decode(e)}function Ie(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new Pe(`${e.name} modulusLength must be at least 2048 bits`)}let xe;if(Uint8Array.prototype.toBase64)xe=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;xe=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Ne(e){return xe(e)}
11class Le extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class Pe extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}function Ue(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new Le("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(e){if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new Le("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(e){if("P-256"===e.algorithm.namedCurve)return"ES256";throw new Le("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new Le("unsupported CryptoKey algorithm name")}}function Me(e){return e instanceof CryptoKey}function De(e){return Me(e)&&"public"===e.type}async function je(e,t,n,o,r,i){const a=null==e?void 0:e.privateKey,s=null==e?void 0:e.publicKey;if(!Me(c=a)||"private"!==c.type)throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!De(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==s.extractable)throw new TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw new TypeError('"htu" must be a string');if("string"!=typeof n)throw new TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw new TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw new TypeError('"accessToken" must be a string or undefined');if(void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)))throw new TypeError('"additional" must be an object');const l=Object.assign(Object.create(null),i,{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:o,htu:t,ath:r?Ne(await crypto.subtle.digest("SHA-256",Re(r))):void 0});return async function(e,t,n){if(!1===n.usages.includes("sign"))throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const o=`${Ne(Re(JSON.stringify(e)))}.${Ne(Re(JSON.stringify(t)))}`;return`${o}.${Ne(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Ie(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Ie(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new Le}(n),n,Re(o)))}`}({alg:Ue(a),typ:"dpop+jwt",jwk:await Be(s)},l,a)}async function Be(e){const{kty:t,e:n,n:o,x:r,y:i,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:o,x:r,y:i}}const We="dpop-nonce",Ge=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","urn:okta:params:oauth:grant-type:webauthn","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-rec
11overy-code"];const Ke=(e,t)=>new Promise(function(n,o){const r=new MessageChannel;r.port1.onmessage=function(e){e.data.error?o(new Error(e.data.error)):n(e.data),r.port1.close()},t.postMessage(e,[r.port2])}),He=(e,t,n)=>{const o=new AbortController;let r;return t.signal=o.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{r=setTimeout(()=>{o.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},Fe=async function(e,t,n,o,r,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:L;return r?(async(e,t,n,o,r,i,a,s,c,l)=>Ke({type:"refresh",auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:o,useFormData:a,useMrrt:s,skipTokenStorage:c,preserveRefreshToken:l},i))(e,t,n,o,a,r,i,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0,arguments.length>9?arguments[9]:void 0):(async(e,t,n)=>{const o=await He(e,t,n);return{ok:o.ok,json:await o.json(),headers:(r=o.headers,[...r].reduce((e,t)=>{let n=R(t,2),o=n[0],r=n[1];return e[o]=r,e},{}))};var r})(e,o,a)};async function Xe(e,t,n,o,r,i,a,s,c,l,u,d){if(c){const t=await c.generateProof({url:e,method:r.method||"GET",nonce:await c.getNonce()});r.headers=Object.assign(Object.assign({},r.headers),{dpop:t})}let h,f=null;for(let c=0;c<3;c++)try{h=await Fe(e,n,o,r,i,a,t,s,u,d),f=null;break}catch(e){f=e}if(f)throw f;const m=h.json,g=m.error,w=m.error_description,y=p(m,["error","error_description"]),v=h,b=v.headers,A=v.ok;let S;if(c&&(S=b[We],S&&await c.setNonce(S)),!A){const h=w||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===g)throw new V(g,h,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===g)throw new Z(n,o);if("use_dpop_nonce"===g){if(!c||!S||l)throw new q(S);return Xe(e,t,n,o,r,i,a,s,c,!0,u,d)}throw new W(g||"request_error",h)}return y}async function Je(e,t,n){var o=e.baseUrl,r=e.timeout,i=e.audience,a=e.scope,s=e.auth0Client,c=e.useFormData,l=e.useMrrt,u=e.dpop,d=e.preserveRefreshToken,h=p(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop","preserveRefreshToken"]);const f="urn:ietf:params:oauth:grant-type:token-exchange"===h.grant_type,m="urn:okta:params:oauth:grant-type:webauthn"===h.grant_type,g="refresh_token"===h.grant_type&&l,w=f||m||g,y=Object.assign(Object.assign(Object.assign({},h),w&&i&&{audience:i}),w&&a&&{scope:a}),v=m||!c,b=v?JSON.stringify(y):ie(y),A=(S=h.grant_type,Ge.includes(S));var S;return await Xe("".concat(o,"/oauth/token"),r,i||B,a,{method:"POST",body:b,headers:{"Content-Type":v?"application/json":"application/x-www-form-urlencoded","Auth0-Client":btoa(JSON.stringify(re(s||D)))}},t,c,l,A?u:void 0,void 0,n,d)}const ze=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(o=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(o))).join(" ");var o},Ve=(e,t,n)=>{let o;return n&&(o=e[n]),o||(o=e[B]),ze(o,t)},Ze="@@auth0spajs@@",Ye="@@user@@";class qe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ze,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=R(e.split("::"),4),n=t[0],o=t[1],r=t[2],i=t[3];return new qe({clientId:o,scope:i,audience:r},n)}static fromCacheEntry(e){const t=e.scope,n=e.audience,o=e.client_id;return new qe({scope:t,audience:n,clientId:o})}}class Qe{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(Ze))}}class $e{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class et{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||j}async setIdToken(e,t,n){var o;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(o=this.keyManifest)||void 0===o?void 0:o.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0;var r;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const r=this.matchExistingCacheKey(e,t);
11if(r&&(i=await this.cache.get(r),a=qe.fromKey(r)),!i&&n&&"cache-only"!==o)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/1e3);return i.expiresAt-t<c?i.body.refresh_token?this.modifiedCachedEntry(i,a):(await this.cache.remove(a.toKey()),void await(null===(r=this.keyManifest)||void 0===r?void 0:r.remove(a.toKey()))):i.body}async modifiedCachedEntry(e,t){const n={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},o={body:n,expiresAt:e.expiresAt};return await this.cache.set(t.toKey(),o),{refresh_token:n.refresh_token,audience:n.audience,scope:n.scope}}async set(e){var t;const n=new qe({clientId:e.client_id,scope:e.scope,audience:e.audience}),o=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),o),await(null===(t=this.keyManifest)||void 0===t?void 0:t.add(n.toKey()))}async remove(e,t,n){const o=new qe({clientId:e,scope:n,audience:t});await this.cache.remove(o.toKey())}async stripRefreshToken(e){var t;const n=await this.getCacheKeys();if(n)for(const o of n){const n=await this.cache.get(o);(null===(t=null==n?void 0:n.body)||void 0===t?void 0:t.refresh_token)===e&&(delete n.body.refresh_token,await this.cache.set(o,n))}}async clear(e){var t;const n=await this.getCacheKeys();n&&(await n.filter(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 qe({clientId:e},Ze,Ye).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const o=qe.fromKey(t),r=new Set(o.scope&&o.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=o.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return o.prefix===Ze&&o.clientId===e.clientId&&o.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const o of t){const t=qe.fromKey(o);if(t.prefix===Ze&&t.clientId===e.clientId){const e=await this.cache.get(o);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 o=await this.getCacheKeys();if(!o)return[];const r=new Set;for(const i of o){const o=qe.fromKey(i);if(o.prefix===Ze&&o.clientId===t&&o.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)&&r.add(e.body.refresh_token)}}return Array.from(r)}async updateEntry(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=await this.getCacheKeys();if(r)for(const i of r){if(qe.fromKey(i).clientId!==n)continue;const r=await this.cache.get(i);if(!(null==r?void 0:r.body))continue;const a=r.body.refresh_token;a&&(o||a===e)&&(r.body.refresh_token=t,await this.cache.set(i,r))}}}class tt{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 nt=e=>"number"==typeof e,ot=["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 rt=le&&le.__assign||function(){return rt=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},rt.apply(this,arguments)};function it(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}var at=function(e){return function(e){for(var t={},n=e?e.split("; "):[],o=/(%[\dA-F]{2})+/gi,r=0;r<n.length;r++){var i=n[r].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}(document.cookie)[e]};function st(e,t,n){document.cookie=function(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decode
11URIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return it("Expires",e.expires?e.expires.toUTCString():"")+it("Domain",e.domain)+it("Path",e.path)+it("Secure",e.secure)+it("SameSite",e.sameSite)}(n)}(e,t,rt({path:"/"},n))}var ct=st,lt=function(e,t){st(e,"",rt(rt({},t),{expires:-1}))};const ut={get(e){const t=at(e);if(void 0!==t)return JSON.parse(t)},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),ct(e,JSON.stringify(t),o)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),lt(e,n)}},dt="_legacy_",ht={get:e=>ut.get(e)||ut.get("".concat(dt).concat(e)),save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(o.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(o.domain=n.cookieDomain),ct("".concat(dt).concat(e),JSON.stringify(t),o),ut.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),lt(e,n),ut.remove(e,t),ut.remove("".concat(dt).concat(e),t)}},pt={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 ft;!function(e){e.Code="code",e.ConnectCode="connect_code"}(ft||(ft={}));var mt,gt=function(e){return mt=mt||function(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,i=n.length;r<i;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),i=r.indexOf("\n",10)+1,a=r.substring(i)+(o?"//# sourceMappingURL="+o:""),s=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(s)}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQpeyhudWxsPT10fHx0PmUubGVuZ3RoKSYmKHQ9ZS5sZW5ndGgpO2Zvcih2YXIgcj0wLG89QXJyYXkodCk7cjx0O3IrKylvW3JdPWVbcl07cmV0dXJuIG99ZnVuY3Rpb24gdCh0LHIpe3JldHVybiBmdW5jdGlvbihlKXtpZihBcnJheS5pc0FycmF5KGUpKXJldHVybiBlfSh0KXx8ZnVuY3Rpb24oZSx0KXt2YXIgcj1udWxsPT1lP251bGw6InVuZGVmaW5lZCIhPXR5cGVvZiBTeW1ib2wmJmVbU3ltYm9sLml0ZXJhdG9yXXx8ZVsiQEBpdGVyYXRvciJdO2lmKG51bGwhPXIpe3ZhciBvLG4scyxhLGk9W10sYz0hMCxsPSExO3RyeXtpZihzPShyPXIuY2FsbChlKSkubmV4dCwwPT09dCl7aWYoT2JqZWN0KHIpIT09cilyZXR1cm47Yz0hMX1lbHNlIGZvcig7IShjPShvPXMuY2FsbChyKSkuZG9uZSkmJihpLnB1c2goby52YWx1ZSksaS5sZW5ndGghPT10KTtjPSEwKTt9Y2F0Y2goZSl7bD0hMCxuPWV9ZmluYWxseXt0cnl7aWYoIWMmJm51bGwhPXIucmV0dXJuJiYoYT1yLnJldHVybigpLE9iamVjdChhKSE9PWEpKXJldHVybn1maW5hbGx5e2lmKGwpdGhyb3cgbn19cmV0dXJuIGl9fSh0LHIpfHxmdW5jdGlvbih0LHIpe2lmKHQpe2lmKCJzdHJpbmciPT10eXBlb2YgdClyZXR1cm4gZSh0LHIpO3ZhciBvPXt9LnRvU3RyaW5nLmNhbGwodCkuc2xpY2UoOCwtMSk7cmV0dXJuIk9iamVjdCI9PT1vJiZ0LmNvbnN0cnVjdG9yJiYobz10LmNvbnN0cnVjdG9yLm5hbWUpLCJNYXAiPT09b3x8IlNldCI9PT1vP0FycmF5LmZyb20odCk6IkFyZ3VtZW50cyI9PT1vfHwvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChvKT9lKHQscik6dm9pZCAwfX0odCxyKXx8ZnVuY3Rpb24oKXt0aHJvdyBuZXcgVHlwZUVycm9yKCJJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLiIpfSgpfWNsYXNzIHIgZXh0ZW5kcyBFcnJvcntjb25zdHJ1Y3RvcihlLHQpe3N1cGVyKHQpLHRoaXMuZXJyb3I9ZSx0aGlzLmVycm9yX2Rlc2NyaXB0aW9uPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsci5wcm90b3R5cGUpfXN0YXRpYyBmcm9tUGF5bG9hZChlKXtsZXQgdD1lLmVycm9yLG89ZS5lcnJvcl9kZXNjcmlwdGlvbjtyZXR1cm4gbmV3IHIodCxvKX19Y2xhc3MgbyBleHRlbmRzIHJ7Y29uc3RydWN0b3IoZSx0KXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIiwiTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyIuY29uY2F0KG4oZSxbImRlZmF1bHQiXSksIicsIHNjb3BlOiAnIikuY29uY2F0KG4odCksIicpIikpLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsby5wcm90b3R5cGUpfX1mdW5jdGlvbiBuKGUpe3JldHVybiBlJiYhKGFyZ3VtZW50cy5sZW5ndGg+MSYmdm9pZCAwIT09YXJndW1lbnRzWzFdP2FyZ3VtZW50c1sxXTpbXSkuaW5jbHVkZXMoZSk/ZToiIn0iZnVuY3Rpb24iPT10eXBlb2YgU3VwcHJlc3NlZEVycm9yJiZTdXBwcmVzc2VkRXJyb3I7Y29uc3Qgcz1lPT57dmFyIHQ9ZS5jbGllbnRJZCxyPWZ1bmN0aW9uKGUsdCl7dmFyIHI9e307Zm9yKHZhciBvIGluIGUpT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbykmJnQuaW5kZXhPZihvKTwwJiYocltvXT1lW29dKTtpZihudWxsIT1lJiYiZnVuY3Rpb24iPT10eXBlb2YgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyl7dmFyIG49MDtmb3Iobz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO248by5sZW5ndGg7bisrKXQuaW5kZXhPZihvW25dKTwwJiZPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLmNhbGwoZSxvW25dKSYmKHJbb1tuXV09ZVtvW25dXSl9cmV0dXJuIHJ9KGUsWyJjbGllbnRJZCJdKTtyZXR1cm4gbmV3IFVSTFNlYXJjaFBhcmFtcygoZT0+T2JqZWN0LmtleXMoZSkuZmlsdGVyKHQ9PnZvaWQgMCE9PWVbdF0pLnJlZHVjZSgodCxyKT0+T2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHQpLHtbcl06ZVtyXX0pLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmc
11oKX07bGV0IGE9e30saT1udWxsO2NvbnN0IGM9KGUsdCk9PiIiLmNvbmNhdChlLCJ8IikuY29uY2F0KHQpLGw9KGUsdCk9PnQuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSx1PShlLHQpPT5hW2MoZSx0KV0sZj1lPT57T2JqZWN0LmVudHJpZXMoYSkuZm9yRWFjaChyPT57bGV0IG89dChyLDIpLG49b1swXTtvWzFdPT09ZSYmZGVsZXRlIGFbbl19KX0saD1lPT57Y29uc3QgdD1uZXcgVVJMU2VhcmNoUGFyYW1zKGUpLHI9e307cmV0dXJuIHQuZm9yRWFjaCgoZSx0KT0+e3JbdF09ZX0pLHJ9LGQ9YXN5bmMgZT0+e2xldCByLG4saT1lLmRhdGEsZj1pLnRpbWVvdXQsZD1pLmF1dGgscD1pLmZldGNoVXJsLHk9aS5mZXRjaE9wdGlvbnMsZz1pLnVzZUZvcm1EYXRhLGI9aS51c2VNcnJ0LE89aS5za2lwVG9rZW5TdG9yYWdlLGs9aS5wcmVzZXJ2ZVJlZnJlc2hUb2tlbixtPXQoZS5wb3J0cywxKVswXSxqPXt9O2NvbnN0IHY9ZHx8e30sXz12LmF1ZGllbmNlLHc9di5zY29wZTt0cnl7Y29uc3QgZT1nP2goeS5ib2R5KTpKU09OLnBhcnNlKHkuYm9keSk7aWYoZS5yZWZyZXNoX3Rva2VufHwicmVmcmVzaF90b2tlbiIhPT1lLmdyYW50X3R5cGUpZS5tZmFfdG9rZW4mJihuPXUoXyx3KSwhbiYmYiYmKG49YS5sYXRlc3RfcmVmcmVzaF90b2tlbikpO2Vsc2V7aWYobj11KF8sdyksIW4mJmIpe2NvbnN0IGU9YS5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+ISFPYmplY3Qua2V5cyhhKS5maW5kKHI9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09cil7Y29uc3Qgbz1sKHQsciksbj1yLnNwbGl0KCJ8IilbMV0uc3BsaXQoIiAiKSxzPWUuc3BsaXQoIiAiKS5ldmVyeShlPT5uLmluY2x1ZGVzKGUpKTtyZXR1cm4gbyYmc319KSkodyxfKTtlJiYhdCYmKG49ZSl9aWYoIW4pdGhyb3cgbmV3IG8oXyx3KTt5LmJvZHk9Zz9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpfWxldCBpLGQ7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGk9bmV3IEFib3J0Q29udHJvbGxlcix5LnNpZ25hbD1pLnNpZ25hbCk7dHJ5e2Q9YXdhaXQgUHJvbWlzZS5yYWNlKFsoUD1mLG5ldyBQcm9taXNlKGU9PnNldFRpbWVvdXQoZSxQKSkpLGZldGNoKHAsT2JqZWN0LmFzc2lnbih7fSx5KSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBtLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZClyZXR1cm4gaSYmaS5hYm9ydCgpLHZvaWQgbS5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtpZihVPWQuaGVhZGVycyxqPVsuLi5VXS5yZWR1Y2UoKGUscik9PntsZXQgbz10KHIsMiksbj1vWzBdLHM9b1sxXTtyZXR1cm4gZVtuXT1zLGV9LHt9KSxyPWF3YWl0IGQuanNvbigpLE8pcmV0dXJuIGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4sdm9pZCBtLnBvc3RNZXNzYWdlKHtvazpkLm9rLGpzb246cixoZWFkZXJzOmp9KTtyLnJlZnJlc2hfdG9rZW4/KGImJihhLmxhdGVzdF9yZWZyZXNoX3Rva2VuPXIucmVmcmVzaF90b2tlbixTPW4sTT1yLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVud
11HJpZXMoYSkuZm9yRWFjaChlPT57bGV0IHI9dChlLDIpLG89clswXTtyWzFdPT09UyYmKGFbb109TSl9KSksKChlLHQscik9PnthW2ModCxyKV09ZX0pKHIucmVmcmVzaF90b2tlbixfLHcpLGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4pOmt8fCgoZSx0KT0+e2RlbGV0ZSBhW2MoZSx0KV19KShfLHcpLG0ucG9zdE1lc3NhZ2Uoe29rOmQub2ssanNvbjpyLGhlYWRlcnM6an0pfWNhdGNoKGUpe20ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOmp9KX12YXIgUyxNLFUsUH0scD1hc3luYyBlPT57bGV0IHI9ZS5kYXRhLG89ci50aW1lb3V0LG49ci5hdXRoLGk9ci5mZXRjaFVybCxjPXIuZmV0Y2hPcHRpb25zLHU9ci51c2VGb3JtRGF0YSxkPXQoZS5wb3J0cywxKVswXTtjb25zdCBwPShufHx7fSkuYXVkaWVuY2U7dHJ5e2NvbnN0IGU9KGU9Pntjb25zdCByPW5ldyBTZXQ7cmV0dXJuIE9iamVjdC5lbnRyaWVzKGEpLmZvckVhY2gobz0+e2xldCBuPXQobywyKSxzPW5bMF0sYT1uWzFdO2woZSxzKSYmci5hZGQoYSl9KSxBcnJheS5mcm9tKHIpfSkocCk7aWYoMD09PWUubGVuZ3RoKXJldHVybiB2b2lkIGQucG9zdE1lc3NhZ2Uoe29rOiEwfSk7Y29uc3Qgcj11P2goYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7Zm9yKGNvbnN0IHQgb2YgZSl7Y29uc3QgZT11P3MoT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHIpLHt0b2tlbjp0fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7dG9rZW46dH0pKTtsZXQgbixhLGwsaDsiZnVuY3Rpb24iPT10eXBlb2YgQWJvcnRDb250cm9sbGVyJiYobj1uZXcgQWJvcnRDb250cm9sbGVyLGE9bi5zaWduYWwpO3RyeXtoPWF3YWl0IFByb21pc2UucmFjZShbbmV3IFByb21pc2UoZT0+e2w9c2V0VGltZW91dChlLG8pfSksZmV0Y2goaSxPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sYykse2JvZHk6ZSxzaWduYWw6YX0pKV0pLmZpbmFsbHkoKCk9PmNsZWFyVGltZW91dChsKSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIWgpcmV0dXJuIG4mJm4uYWJvcnQoKSx2b2lkIGQucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7aWYoIWgub2spe2xldCBlO3RyeXtjb25zdCB0PUpTT04ucGFyc2UoYXdhaXQgaC50ZXh0KCkpO2U9dC5lcnJvcl9kZXNjcmlwdGlvbn1jYXRjaChlKXt9cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZXx8IkhUVFAgZXJyb3IgIi5jb25jYXQoaC5zdGF0dXMpfSl9Zih0KX1kLnBvc3RNZXNzYWdlKHtvazohMH0pfWNhdGNoKGUpe2QucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZXx8IlVua25vd24gZXJyb3IgZHVyaW5nIHRva2VuIHJldm9jYXRpb24ifSl9fSx5PShlLHQpPT57aWYoIWkpcmV0dXJuITE7dHJ5e2NvbnN0IHI9bmV3IFVSTChpKS5vcmlnaW4sbz1uZXcgVVJMKGUuZmV0Y2hVcmwpO3JldHVybiBvLm9yaWdpbj09PXImJm8ucGF0aG5hbWU9PT10fWNhdGNoKGUpe3JldHVybiExfX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZT0+e2NvbnN0IHI9ZS5kYXRhLG89dChlLnBvcnRzLDEpWzBdO2lmKCEoInR5cGUiaW4gcil8fCJpbml0IiE9PXIudHlwZSlyZXR1cm4idHlwZSJpbiByJiYiY2xlYXIiPT09ci50eXBlPyhhPXt9LHZvaWQobnVsbD09b3x8by5wb3N0TWVzc2FnZSh7b2s6ITB9KSkpOiJ0eXBlImluIHImJiJyZXZva2UiPT09ci50eXBlP3kociwiL29hdXRoL3Jldm9rZSIpP3ZvaWQgcChlKTp2b2lkKG51bGw9PW98fG8ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSkpOnZvaWQoImZldGNoVXJsImluIHImJnkociwiL29hdXRoL3Rva2VuIik/ZChlKTpudWxsPT1vfHxvLnBvc3RNZXNzYWdlKHtvazohMSxqc29uOntlcnJvcjoiaW52YWxpZF9mZXRjaF91cmwiLGVycm9yX2Rlc2NyaXB0aW9uOiJVbmF1dGhvcml6ZWQgZmV0Y2ggVVJMIn0saGVhZGVyczp7fX0pKTtpZihudWxsPT09aSl0cnl7bmV3IFVSTChyLmFsbG93ZWRCYXNlVXJsKSxpPXIuYWxsb3dlZEJhc2VVcmx9Y2F0Y2goZSl7cmV0dXJufX0pfSgpOwoK",null,false),new Worker(mt,e)};class wt{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return"".concat(Ze,"::").concat(e)}}const yt="auth0.is.authenticated",vt={memory:()=>(new $e).enclosedCache,localstorage:()=>new Qe},bt=e=>vt[e],At=e=>{const t=e.openUrl,n=e.onRedirect,o=p(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},o),{openUrl:!1===t||t?t:n})},St={NONCE:"nonce",KEYPAIR:"keypair"};class Et{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(St).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 o=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>
11{o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(St.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(St.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(St.NONCE,this.buildKey(e))}findKeyPair(){return this.find(St.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(St.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(St.KEYPAIR,this.clientId)}}class kt{constructor(e){this.storage=new Et(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 o;return o={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(o,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,o=e.method,r=e.nonce,i=e.accessToken;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return je(t,a,o,r,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!De(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 Be(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new Le("unsupported JWK kty")}return Ne(await crypto.subtle.digest({name:"SHA-256"},Re(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var _t;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(_t||(_t={}));class Tt{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)),o=e instanceof Request?new Request(n,e):n;return new Request(o,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_t.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),o=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",o)}async prepareRequest(e,t){const n=await this.getAccessToken(t);if(void 0===n)throw new W("missing_access_token","No access token available");let o,r;"string"==typeof n?(o=this.config.dpopNonceId?_t.DPoP:_t.Bearer,r=n):(o=n.token_type,r=n.access_token),this.setAuthorizationHeader(e,r,o),o===_t.DPoP&&await this.setDpopProofHeader(e,r)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,We);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new q(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,o){const r=this.buildBaseRequest
11(e,t);await this.prepareRequest(r,o);const i=await this.config.fetch(r);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const o={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},o),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,o,n)}}class Ot{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)},{scope:["create:me:connected_accounts"]});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)},{scope:["create:me:connected_accounts"]});return this._handleResponse(t)}async getFactors(){const e=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/factors"),{method:"GET"},{scope:["read:me:factors"]});return(await this._handleResponse(e)).factors}async getAuthenticationMethods(e){const t=e?"?".concat(new URLSearchParams({type:e})):"",n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods").concat(t),{method:"GET"},{scope:["read:me:authentication_methods"]});return(await this._handleResponse(n)).authentication_methods}async getAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"GET"},{scope:["read:me:authentication_methods"]});return this._handleResponse(t)}async deleteAuthenticationMethod(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"DELETE"},{scope:["delete:me:authentication_methods"]});t.ok||await this._handleResponse(t)}async updateAuthenticationMethod(e,t){const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},{scope:["update:me:authentication_methods"]});return this._handleResponse(n)}async enrollmentChallenge(e){var t;const n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:authentication_methods"]}),o=await this._handleResponse(n),r=null!==(t=n.headers.get("location"))&&void 0!==t?t:"",i=decodeURIComponent(r.split("/").pop()||"");return Object.assign(Object.assign({},o),{id:i,location:r})}async enrollmentVerify(e){const t=e,n=t.location;t.type;const o=p(t,["location","type"]),r=await this.myAccountFetcher.fetchWithAuth("".concat(n,"/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},{scope:["create:me:authentication_methods"]});return this._handleResponse(r)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new Ct({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new Ct(t)}}class Ct extends Error{constructor(e){let t=e.type,n=e.status,o=e.title,r=e.detail,i=e.validation_errors;super(r),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=o,this.detail=r,this.validation_errors=i,Object.setPrototypeOf(this,Ct.prototype)}}const Rt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};var It,xt;let Nt;if("undefined"==typeof navigator||null===(It=navigator.userAgent)||void 0===It||null===(xt=It.startsWith)||void 0===xt||!xt.call(It,"Mozilla/5.0 ")){const e="v3.8.6";Nt="".concat("oauth4webapi","/").concat(e)}function Lt(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 Pt="ERR_INVALID_ARG_VALUE",Ut="ERR_INVALID_ARG_TYPE";function Mt(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}const Dt=Symbol(),jt=Symbol(),Bt=Symbol(),Wt=Symbol(),Gt=Symbol(),Kt=Symbol(),Ht=new TextEncoder,Ft=new TextDecoder;function Xt(e){return"string"==typeof e?Ht.encode(e):Ft.decode(e)}let Jt,zt;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 o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Vt(e){return"string"==typeof e?zt(e):Jt(e)}zt=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Mt("The input to be decoded is not correctly encoded.",Pt,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw Mt("The input to be decoded is not correctly encoded.",Pt,e)}};
11class Zt extends Error{constructor(e,t){var n;super(e,t),_(this,"code",void 0),this.name=this.constructor.name,this.code=$n,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Yt extends Error{constructor(e,t){var n;super(e,t),_(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function qt(e,t,n){return new Yt(e,{code:t,cause:n})}function Qt(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function $t(e){Lt(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Nt&&!t.has("user-agent")&&t.set("user-agent",Nt),t.has("authorization"))throw Mt('"options.headers" must not include the "authorization" header name',Pt);return t}function en(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw Mt('"options.signal" must return or be an instance of AbortSignal',Ut);return t}}function tn(e){return e.includes("//")?e.replace("//","/"):e}function nn(e,t,n,o,r){try{if("number"!=typeof e||!Number.isFinite(e))throw Mt("".concat(n," must be a number"),Ut,r);if(e>0)return;if(t){if(0!==e)throw Mt("".concat(n," must be a non-negative number"),Pt,r);return}throw Mt("".concat(n," must be a positive number"),Pt,r)}catch(e){if(o)throw qt(e.message,o,r);throw e}}function on(e,t,n,o){try{if("string"!=typeof e)throw Mt("".concat(t," must be a string"),Ut,o);if(0===e.length)throw Mt("".concat(t," must not be empty"),Pt,o)}catch(e){if(n)throw qt(e.message,n,o);throw e}}function rn(e){!function(e,t){if(Nn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(o.length>2){const e=o.pop();t+="".concat(o.join(", "),", or ").concat(e)}else 2===o.length?t+="".concat(o[0]," or ").concat(o[1]):t+=o[0];return qt(t,ro,e)}(e,t)}(e,"application/json")}function an(){return Vt(crypto.getRandomValues(new Uint8Array(32)))}function sn(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 Zt("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 Zt("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 Zt("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 Zt("unsupported CryptoKey algorithm name",{cause:e})}}function cn(e){const t=null==e?void 0:e[jt];return"number"==typeof t&&Number.isFinite(t)?t:0}function ln(e){const t=null==e?void 0:e[Bt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function un(){return Math.floor(Date.now()/1e3)}function dn(e){if("object"!=typeof e||null===e)throw Mt('"as" must be an object',Ut);on(e.issuer,'"as.issuer"')}function hn(e){if("object"!=typeof e||null===e)throw Mt('"client" must be an object',Ut);on(e.client_id,'"client.client_id"')}function pn(e){return on(e,'"clientSecret"'),(t,n,o,r)=>{o.set("client_id",n.client_id),o.set("client_secret",e)}}function fn(e,t){const n=(i=e)instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&on(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},o=n.key,r=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Mt("".concat(t," must be a CryptoKey"),Ut)}(e,t),"private"!==e.type)throw Mt("".concat(t," must be a private CryptoKey"),Pt)}(o,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:sn(o),kid:r},l=function(e,t){const n=un()+cn(t);return{jti:an(),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[Gt])||void 0===s||s.call(t,c,l),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 Mt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Pt);const o="".concat(Vt(Xt(JSON.stringify(e))),".").concat(Vt(Xt(JSON.stringify(t)))),r=Vt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:wo(e)};case"RSA-PSS":switch(go(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 Zt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return go(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Zt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Xt(o)));return"".concat(o,".").concat(r)}(c,l,o))}}const mn=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function gn(e,t){if(t&&"https:"!==e.protocol)throw qt("only requests to HTTPS are allowed",ao,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw qt("only HTTP and HTTPS requests are allowed",so,e)}function wn(e,t,n,o){let r;if("string"!=typeof e||!(r=mn(e)))throw qt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?ho:po,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return gn(r,o),r}function yn(e,t,n,o){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?wn(e.mtls_endpoint_aliases[t],t,n,o):wn(e[t],t,n,o)}
11class vn extends Error{constructor(e,t){var n;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"error",void 0),_(this,"status",void 0),_(this,"error_description",void 0),_(this,"response",void 0),this.name=this.constructor.name,this.code=Qn,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 bn extends Error{constructor(e,t){var n,o;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"error",void 0),_(this,"error_description",void 0),this.name=this.constructor.name,this.code=eo,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===(o=Error.captureStackTrace)||void 0===o||o.call(Error,this,this.constructor)}}class An extends Error{constructor(e,t){var n;super(e,t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"response",void 0),_(this,"status",void 0),this.name=this.constructor.name,this.code=qn,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 Sn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",En="("+Sn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',kn="("+Sn+")\\s*=\\s*("+Sn+")",_n=new RegExp("^[,\\s]*("+Sn+")"),Tn=new RegExp("^[,\\s]*"+En+"[,\\s]*(.*)"),On=new RegExp("^[,\\s]*"+kn+"[,\\s]*(.*)"),Cn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Rn(e,t,n){if(e.status!==t){let t;var o;if(Wn(e),t=await async function(e){if(e.status>399&&e.status<500){mo(e),rn(e);try{const t=await e.clone().json();if(Qt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(o=e.body)||void 0===o?void 0:o.cancel()),new vn("server responded with an error in the response body",{cause:t,response:e});throw qt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),io,e)}}function In(e){if(!Xn.has(e))throw Mt('"options.DPoP" is not a valid DPoPHandle',Pt)}const xn=Symbol();function Nn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function Ln(e,t,n,o,r){if(dn(e),hn(t),!Lt(o,Response))throw Mt('"response" must be an instance of Response',Ut);if(Wn(o),200!==o.status)throw qt('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',io,o);let i;if(mo(o),"application/jwt"===Nn(o)){const n=await yo(await o.text(),vo.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),cn(t),ln(t),null==r?void 0:r[Kt]).then(Gn.bind(void 0,t.client_id)).then(Hn.bind(void 0,e)),a=n.claims,s=n.jwt;Dn.set(o,s),i=a}else{if(t.userinfo_signed_response_alg)throw qt("JWT UserInfo Response expected",to,o);i=await Eo(o)}if(on(i.sub,'"response" body "sub" property',oo,{body:i}),n===xn);else if(on(n,'"expectedSubject"'),i.sub!==n)throw qt('unexpected "response" body "sub" property value',uo,{expected:n,body:i,attribute:"sub"});return i}async function Pn(e,t,n,o,r,i,a){return await n(e,t,r,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Wt])||fetch)(o.href,{body:r,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:en(o,null==a?void 0:a.signal)})}async function Un(e,t,n,o,r,i){var a;const s=yn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Dt]));r.set("grant_type",o);const c=$t(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(In(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const l=await Pn(e,t,n,s,r,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(l,s),l}const Mn=new WeakMap,Dn=new WeakMap;function jn(e){if(!e.id_token)return;const t=Mn.get(e);if(!t)throw Mt('"ref" was already garbage collected or did not resolve from the proper sources',Pt);return t}async function Bn(e,t,n,o,r,i){if(dn(e),hn(t),!Lt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Rn(n,200,"Token Endpoint"),mo(n);const a=await Eo(n);if(on(a.access_token,'"response" body "access_token" property',oo,{body:a}),on(a.token_type,'"response" body "token_type" property',oo,{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;nn(e,!0,'"response" body "expires_in" property',oo,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&on(a.refresh_token,'"response" body "refresh_token" property',oo,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw qt('"response" body "scope" property must be a string',oo,{body:a});if(void 0!==a.id_token){on(a.id_token,'"response" body "id_token" property',oo,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(nn(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=o&&o.length&&i.push(...o);const s=await yo(a.id_token,vo.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),cn(t),ln(t),r).then(Vn.bind(void 0,i)).then(Fn.bind(void 0,e)).then(Kn.bind(void 0,t.client_id)),c=s.claims,l=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw qt('ID Token "aud" (audience) claim includes additional untrusted audiences',lo,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw qt('unexpected ID Token "azp" (authorized party) claim value',lo,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&nn(c.auth_time,!0,'ID Token "auth_time" (authentication time)',oo,{claims:c}),Dn.set(n,l),Mn.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 Zt("unsupported `token_type` value",{cause:{body:a}});return a}function Wn(e){let t;if(t=function(e){if(!Lt(e,Response))throw Mt('"response" must be an instance of Response',Ut);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let o=t;for(;o;){var r;let t=o.match(_n);const c=null===(r=t)||void 0===r?void 0:r[1].toLowerCase();if(!c)return;const l=o.substring(t[0].length);if(l&&!l.match(/^[\s,]/))return;const u=l.match(/^\s+(.*)$/),d=!!u;o=u?u[1]:void 0;const h={};let p;if(d)for(;o;){let n,r;if(t=o.match(Tn)){var i=R(t,4);if(n=i[1],r=i[2],o=i[3],r.includes("\\"))try{r=JSON.parse('"'.concat(r,'"'))}catch(e){}h[n.toLowerCase()]=r}else{if(!(t=o.match(On))){if(t=o.match(Cn)){if(Object.keys(h).length)break;var a=R(t,3);p=a[1],o=a[2];break}return}var s=R(t,4);n=s[1],r=s[2],o=s[3],h[n.toLowerCase()]=r}}else o=l||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new An("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function Gn(e,t){return void 0!==t.claims.aud?Kn(e,t):t}function Kn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw qt('unexpected JWT "aud" (audience) claim value',lo,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw qt('unexpected JWT "aud" (audience) claim value',lo,{expected:e,claims:t.claims,claim:"aud"});return t}function Hn(e,t){return void 0!==t.claims.iss?Fn(e,t):t}function Fn(e,t){var n,o;const r=null!==(n=null===(o=e[_o])||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==r)throw qt('unexpected JWT "iss" (issuer) claim value',lo,{expected:r,claims:t.claims,claim:"iss"});return t}const Xn=new WeakSet,Jn=Symbol(),zn={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 Vn(e,t){for(const n of e)if(void 0===t.claims[n])throw qt('JWT "'.concat(n,'" (').concat(zn[n],") claim missing"),oo,{claims:t.claims});return t}const Zn=Symbol(),Yn=Symbol();const qn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Qn="OAUTH_RESPONSE_BODY_ERROR",$n="OAUTH_UNSUPPORTED_OPERATION",eo="OAUTH_AUTHORIZATION_RESPONSE_E
11RROR",to="OAUTH_JWT_USERINFO_EXPECTED",no="OAUTH_PARSE_ERROR",oo="OAUTH_INVALID_RESPONSE",ro="OAUTH_RESPONSE_IS_NOT_JSON",io="OAUTH_RESPONSE_IS_NOT_CONFORM",ao="OAUTH_HTTP_REQUEST_FORBIDDEN",so="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",co="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",lo="OAUTH_JWT_CLAIM_COMPARISON_FAILED",uo="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",ho="OAUTH_MISSING_SERVER_METADATA",po="OAUTH_INVALID_SERVER_METADATA";async function fo(e){if(!Lt(e,Response))throw Mt('"response" must be an instance of Response',Ut);await Rn(e,200,"Revocation Endpoint")}function mo(e){if(e.bodyUsed)throw Mt('"response" body has been used already',Pt)}function go(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Zt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function wo(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 Zt("unsupported ECDSA namedCurve",{cause:e})}}async function yo(e,t,n,o,r){let i,a,s=e.split("."),c=s[0],l=s[1],u=s.length;if(5===u){if(void 0===r)throw new Zt("JWE decryption is not configured",{cause:e});var d=(e=await r(e)).split(".");c=d[0],l=d[1],u=d.length}if(3!==u)throw qt("Invalid JWT",oo,e);try{i=JSON.parse(Xt(Vt(c)))}catch(e){throw qt("failed to parse JWT Header body as base64url encoded JSON",no,e)}if(!Qt(i))throw qt("JWT Header must be a top level object",oo,e);if(t(i),void 0!==i.crit)throw new Zt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Xt(Vt(l)))}catch(e){throw qt("failed to parse JWT Payload body as base64url encoded JSON",no,e)}if(!Qt(a))throw qt("JWT Payload must be a top level object",oo,e);const h=un()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw qt('unexpected JWT "exp" (expiration time) claim type',oo,{claims:a});if(a.exp<=h-o)throw qt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',co,{claims:a,now:h,tolerance:o,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw qt('unexpected JWT "iat" (issued at) claim type',oo,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw qt('unexpected JWT "iss" (issuer) claim type',oo,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw qt('unexpected JWT "nbf" (not before) claim type',oo,{claims:a});if(a.nbf>h+o)throw qt('unexpected JWT "nbf" (not before) claim value',co,{claims:a,now:h,tolerance:o,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw qt('unexpected JWT "aud" (audience) claim type',oo,{claims:a});return{header:i,claims:a,jwt:e}}function vo(e,t,n,o){if(void 0===e)if(Array.isArray(t)){if(!t.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw qt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?o.alg!==n:"function"==typeof n?!n(o.alg):!n.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:n,reason:"default value"})}else if("string"==typeof e?o.alg!==e:!e.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',oo,{header:o,expected:e,reason:"client configuration"})}function bo(e,t){const n=e.getAll(t),o=n[0];if(n.length>1)throw qt('"'.concat(t,'" parameter must be provided only once'),oo);return o}const Ao=Symbol(),So=Symbol();async function Eo(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rn;try{t=await e.json()}catch(t){throw n(e),qt('failed to parse "response" body as JSON',no,t)}if(!Qt(t))throw qt('"response" body must be a top level object',oo,{body:t});return t}const ko=Symbol(),_o=Symbol(),To=new TextEncoder,Oo=new TextDecoder,Co=new TextDecoder("utf-8",{fatal:!0});function Ro(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(o);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}function Io(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const o=e.charCodeAt(n);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=o}return t}const xo=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const No=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if(o.length>2){const t=o.pop();e+="one of type ".concat(o.join(", "),", or ").concat(t,".")}else 2===o.length?e+="one of type ".concat(o[0]," or ").concat(o[1],"."):e+="of type ".concat(o[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}("Key for the ".concat(e," algorithm must be "),t,...o)};
11class Lo extends Error{constructor(e,t){var n;super(e,t),_(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}_(Lo,"code","ERR_JOSE_GENERIC");class Po extends Lo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),_(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),_(this,"claim",void 0),_(this,"reason",void 0),_(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}_(Po,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Uo extends Lo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),_(this,"code","ERR_JWT_EXPIRED"),_(this,"claim",void 0),_(this,"reason",void 0),_(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}_(Uo,"code","ERR_JWT_EXPIRED");class Mo extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}_(Mo,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Do extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JOSE_NOT_SUPPORTED")}}_(Do,"code","ERR_JOSE_NOT_SUPPORTED"),_(class extends Lo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),_(class extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class jo extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JWS_INVALID")}}_(jo,"code","ERR_JWS_INVALID");class Bo extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JWT_INVALID")}}_(Bo,"code","ERR_JWT_INVALID"),_(class extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Wo extends Lo{constructor(){super(...arguments),_(this,"code","ERR_JWKS_INVALID")}}_(Wo,"code","ERR_JWKS_INVALID");class Go extends Lo{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),_(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}_(Go,"code","ERR_JWKS_NO_MATCHING_KEY");class Ko extends Lo{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),_(this,Symbol.asyncIterator,I(function*(){})),_(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}_(Ko,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Ho extends Lo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWKS_TIMEOUT")}}_(Ho,"code","ERR_JWKS_TIMEOUT");class Fo extends Lo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),_(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}_(Fo,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Xo=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function Jo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const zo="The input to be decoded is not correctly encoded.";function Vo(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Oo.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(zo,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Oo.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(zo);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return Jo(t)}catch(e){throw new TypeError(zo)}}function Zo(e){let t=e;return"string"==typeof t&&(t=To.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Yo(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function qo(e){return Yo(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(Yo)}
11function Qo(e,t,n){try{return Vo(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function $o(e,t){var n,o,r,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new Do('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new Do('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const a=null!==(n=null===(o=e.resolve)||void 0===o?void 0:o.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,s=!(!t.d&&!t.priv),c=O({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,a,null!==(r=t.ext)&&void 0!==r?r:!s,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[s?1:0])}function er(e){return O({__proto__:null},e)}const tr=e=>e[Symbol.toStringTag];function nr(e,t,n){const o=e.alg,r=e.secret,i="decrypt"===n||"sign"===n;if(r&&t instanceof Uint8Array)return[or,t];if(Yo(t)){const a=function(e){const t=er(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof a.kty)throw new TypeError(r?No(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):No(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(r?"oct"===a.kty&&"string"==typeof a.k:"oct"!==a.kty&&(i?"AKP"===a.kty&&"string"==typeof a.priv||"string"==typeof a.d:void 0===a.d&&void 0===a.priv)))throw new TypeError(r?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const o=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"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!==o)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(o,'" when present'));if(Array.isArray(t.key_ops)){var r;const o="encrypt"===n||"decrypt"===n?null===(r=e.ops)||void 0===r?void 0:r["encrypt"===n?0:1]:n;if(o&&!t.key_ops.includes(o))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(o,'" when present'))}})(e,a,n),[ar,t,a]}if(!(e=>Xo(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(r?No(o,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):No(o,t,"CryptoKey","KeyObject","JSON Web Key"));if(r){if("secret"!==t.type)throw new TypeError("".concat(tr(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(tr(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const o="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(tr(t)," instances for asymmetric algorithm ").concat(o,' must be of type "').concat(e,'"'))}}return Xo(t)?[rr,t]:[ir,t]}const or=0,rr=1,ir=2,ar=3;let sr;const cr={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function lr(e,t,n){sr||(sr=new WeakMap);const o=sr.get(e);return n&&(o?o[t]=n:sr.set(e,{[t]:n})),null!=n?n:null==o?void 0:o[t]}const ur=async(e,t,n)=>{var o;return null!==(o=lr(e,n.alg))&&void 0!==o?o:lr(e,n.alg,await $o(n,O(O({},t),{},{alg:n.alg})))};async function dr(e,t,n){const o=nr(e,t,n);switch(o[0]){case or:case rr:return o[1];case ar:{const t=o[1],n=o[2];if("oct"===n.kty)return Vo(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return ur(t,n,e)}case ir:{const t=o[1];
11return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,o,r;const i=lr(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,l=cr[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],u=null!==(o=null===(r=t.resolve)||void 0===r?void 0:r.call(t,{crv:l,asymmetricKeyType:c}))&&void 0!==o?o:t.subtle;return lr(e,t.alg,e.toCryptoKey(u,a,s))})(t,e):ur(t,t.export({format:"jwk"}),e)}}}function hr(e){const t={__proto__:null};for(const n in e)t[n]=O(O({},e[n]),{},{alg:n});return t}const pr=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],fr=[[],["deriveBits"]],mr=[[],[]];function gr(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:pr,ops:["wrapKey","unwrapKey"]}}function wr(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,o=e.asymmetricKeyType;if("X25519"===n||"x25519"===o)return{name:"X25519"};if("OKP"===t)throw new Do('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:fr,ops:[void 0,"deriveBits"]}}function yr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:mr,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function vr(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:mr,ops:["deriveBits","deriveBits"]}}const br=hr({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:mr,ops:["encrypt","decrypt"]},"RSA-OAEP":gr(1),"RSA-OAEP-256":gr(256),"RSA-OAEP-384":gr(384),"RSA-OAEP-512":gr(512),"ECDH-ES":wr(),"ECDH-ES+A128KW":wr(),"ECDH-ES+A192KW":wr(),"ECDH-ES+A256KW":wr(),A128KW:yr(128),A192KW:yr(192),A256KW:yr(256),A128GCMKW:yr(128,!0),A192GCMKW:yr(192,!0),A256GCMKW:yr(256,!0),"PBES2-HS256+A128KW":vr(),"PBES2-HS384+A192KW":vr(),"PBES2-HS512+A256KW":vr()}),Ar=["encrypt","decrypt"];function Sr(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:mr,ops:Ar,cekBits:e,ivBits:t?128:96,cbc:t}}hr({A128GCM:Sr(128),A192GCM:Sr(192),A256GCM:Sr(256),"A128CBC-HS256":Sr(256,!0),"A192CBC-HS384":Sr(384,!0),"A256CBC-HS512":Sr(512,!0)});const Er={__proto__:null,b64:!0};function kr(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function _r(e,t,n,o,r){if(void 0!==r.crit&&void 0===(null==o?void 0:o.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return[];if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:O(O({__proto__:null},n),t);for(const t of o.crit){if(!(t in i))throw new Do('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(r,t)||void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(o,t)||void 0===o[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return o.crit}function Tr(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new jo('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Or,Cr;let Rr,Ir;if("undefined"==typeof navigator||null===(Or=navigator.userAgent)||void 0===Or||null===(Cr=Or.startsWith)||void 0===Cr||!Cr.call(Or,"Mozilla/5.0 ")){const e="v6.8.4";Ir="".concat("openid-client","/").concat(e),Rr={"user-agent":Ir}}const xr=e=>Nr.get(e);let Nr,Lr;function Pr(e){return void 0!==e?pn(e):(Lr||(Lr=new WeakMap),(e,t,n,o)=>{let r;return(r=Lr.get(t))||(function(e,t){if("string"!=typeof e)throw Br("".concat(t," must be a string"),jr);if(0===e.length)throw Br("".concat(t," must not be empty"),Dr)}(t.client_secret,'"metadata.client_secret"'),r=pn(t.client_secret),Lr.set(t,r)),r(e,t,n,o)})}const Ur=xn,Mr=Wt,Dr="ERR_INVALID_ARG_VALUE",jr="ERR_INVALID_ARG_TYPE";function Br(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}
11class Wr extends Error{constructor(e,t){var n;super(e,t),_(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 Gr(e,t,n){return new Wr(e,{cause:t,code:n})}function Kr(e){if(e instanceof TypeError||e instanceof Wr||e instanceof vn||e instanceof bn||e instanceof An)throw e;if(e instanceof Yt)switch(e.code){case ao:throw Gr("only requests to HTTPS are allowed",e,e.code);case so:throw Gr("only requests to HTTP or HTTPS are allowed",e,e.code);case io:throw Gr("unexpected HTTP response status code",e.cause,e.code);case ro:throw Gr("unexpected response content-type",e.cause,e.code);case no:throw Gr("parsing error occured",e,e.code);case oo:throw Gr("invalid response encountered",e,e.code);case lo:throw Gr("unexpected JWT claim value encountered",e,e.code);case uo:throw Gr("unexpected JSON attribute value encountered",e,e.code);case co:throw Gr("JWT timestamp claim value failed validation",e,e.code);default:throw Gr(e.message,e,e.code)}if(e instanceof Zt)throw Gr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Gr("runtime operation error",e,$n);case"NotSupportedError":throw Gr("runtime unsupported operation",e,$n);case"TimeoutError":throw Gr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Gr("operation aborted",e,"OAUTH_ABORT")}throw new Wr("something went wrong",{cause:e})}async function Hr(e,t,n,o,r){const i=await async function(e,t){var n,o;if(!(e instanceof URL))throw Br('"server" must be an instance of URL',jr);const r=!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(r?async function(e,t){return async function(e,t,n,o){if(!(e instanceof URL))throw Mt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Ut);gn(e,!0!==(null==o?void 0:o[Dt]));const r=n(new URL(e.href)),i=$t(null==o?void 0:o.headers);return i.set("accept","application/json"),((null==o?void 0:o[Wt])||fetch)(r.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:en(r,null==o?void 0:o.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=tn("".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=tn("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Mt('"options.algorithm" must be "oidc" (default), or "oauth2"',Pt)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Wt]:null==t?void 0:t[Mr],[Dt]:null==t||null===(o=t.execute)||void 0===o?void 0:o.includes(qr),signal:a,headers:new Headers(Rr)}):((null==t?void 0:t[Mr])||fetch)((gn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(qr)),e.href),{headers:Object.fromEntries(new Headers(O({accept:"application/json"},Rr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==ko)throw Mt('"expectedIssuerIdentifier" must be an instance of URL',Ut);if(!Lt(t,Response))throw Mt('"response" must be an instance of Response',Ut);if(200!==t.status)throw qt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',io,t);mo(t);const o=await Eo(t);if(on(o.issuer,'"response" body "issuer" property',oo,{body:o}),n!==ko&&new URL(o.issuer).href!==n.href)throw qt('"response" body "issuer" property does not match the expected value',uo,{expected:n.href,body:o,attribute:"issuer"});return o}(ko,e)).catch(Kr);var c;return r&&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[Fr]=!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 Wr("discovered metadata issuer does not match the expected issuer",{code:uo,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,r),a=new Xr(i,t,n,o);let s=xr(a);if(null!=r&&r[Mr]&&(s.fetch=r[Mr]),null!=r&&r.timeout&&(s.timeout=r.timeout),null!=r&&r.execute)for(const e of r.execute)e(a);return a}new TextDecoder;const Fr=Symbol();class Xr{constructor(e,t,n,o){var r,i,a,s,c;
11if("string"!=typeof t||!t.length)throw Br('"clientId" must be a non-empty string',jr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(r=n)||void 0===r?void 0:r.client_id)&&t!==n.client_id)throw Br('"clientId" and "metadata.client_id" must be the same',Dr);const l=O(O({},structuredClone(n)),{},{client_id:t});let u;l[jt]=null!==(i=null===(a=n)||void 0===a?void 0:a[jt])&&void 0!==i?i:0,l[Bt]=null!==(s=null===(c=n)||void 0===c?void 0:c[Bt])&&void 0!==s?s:30,u=o||("string"==typeof l.client_secret&&l.client_secret.length?Pr(l.client_secret):(e,t,n,o)=>{n.set("client_id",t.client_id)});let d=Object.freeze(l);const h=structuredClone(e);Fr in e&&(h[_o]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Nr||(Nr=new WeakMap),Nr.set(this,{__proto__:null,as:p,c:d,auth:u,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(xr(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(xr(this).c)}get timeout(){return xr(this).timeout}set timeout(e){xr(this).timeout=e}get[Mr](){return xr(this).fetch}set[Mr](e){xr(this).fetch=e}}function Jr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}
11return{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 jn(this)}catch(e){return}}}}}(e))}async function zr(e,t,n){var o;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(o=e.headers.get("retry-after"))||void 0===o?void 0:o.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(r&&!Number.isFinite(a))throw new Yt("invalid Retry-After header value",{cause:e});a>t&&await Vr(a-t,n)}function Vr(e,t){return new Promise((n,o)=>{const r=e=>{try{t.throwIfAborted()}catch(e){return void o(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>r(e-i),1e3*i)};r(e)})}async function Zr(e,t){oi(e);const n=xr(e),o=n.as,r=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,o,r){dn(e),hn(t);const i=yn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),a=new URLSearchParams(o);a.set("client_id",t.client_id);const s=$t(null==r?void 0:r.headers);return s.set("accept","application/json"),Pn(e,t,n,i,a,s,r)}(o,r,i,t,{[Wt]:a,[Dt]:!s,headers:new Headers(Rr),signal:ri(c)}).then(e=>async function(e,t,n){if(dn(e),hn(t),!Lt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Rn(n,200,"Backchannel Authentication Endpoint"),mo(n);const o=await Eo(n);on(o.auth_req_id,'"response" body "auth_req_id" property',oo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',oo,{body:o}),o.expires_in=r,void 0!==o.interval&&nn(o.interval,!1,'"response" body "interval" property',oo,{body:o}),o}(o,r,e)).catch(Kr)}async function Yr(e,t,n,o){var r,i;oi(e),n=new URLSearchParams(n);let a=null!==(r=t.interval)&&void 0!==r?r:5;const s=null!==(i=null==o?void 0:o.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Vr(a,s)}catch(e){Kr(e)}const c=xr(e),l=c.as,u=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,m=c.timeout,g=c.decrypt,w=(r,i)=>Yr(e,O(O({},t),{},{interval:r}),n,O(O({},o),{},{signal:s,flag:i})),y=function(e,t){const n=ri(t);if(!n)return{signal:e,cleanup(){}};const o=new AbortController,r=e=>{const t=e.target;o.abort(t.reason)};return e.aborted?o.abort(e.reason):n.aborted?o.abort(n.reason):(e.addEventListener("abort",r,{once:!0}),n.addEventListener("abort",r,{once:!0})),{signal:o.signal,cleanup(){e.removeEventListener("abort",r),n.removeEventListener("abort",r)}}}(s,m),v=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"authReqId"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("auth_req_id",o),Un(e,t,n,"urn:openid:params:grant-type:ciba",i,r)}(l,u,d,t.auth_req_id,{[Wt]:h,[Dt]:!p,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Rr),signal:y.signal}).catch(Kr).finally(y.cleanup);var b;if(503===v.status&&v.headers.has("retry-after"))return await zr(v,a,s,!0),await(null===(b=v.body)||void 0===b?void 0:b.cancel()),w(a);const A=async function(e,t,n,o){return Bn(e,t,n,void 0,null==o?void 0:o[Kt],null==o?void 0:o.recognizedTokenTypes)}(l,u,v,{[Kt]:g});let S;try{S=await A}catch(e){if(ai(e,o))return w(a,si);if(e instanceof vn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await zr(e.response,a,s),w(a)}Kr(e)}return S.id_token&&await(null==f?void 0:f(v)),Jr(S),S}function qr(e){xr(e).tlsOnly=!1}async function Qr(e,t,n,o,r){if(oi(e),!((null==r?void 0:r.flag)===si||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Br('"currentUrl" must be an instance of URL, or Request',jr);let i,a;const s=xr(e),c=s.as,l=s.c,u=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,m=s.nonRepudiation,g=s.timeout,w=s.decrypt,y=s.implicit;if((null==r?void 0:r.flag)===si)i=r.authResponse,a=r.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Mt("form_post responses are expected to use the POST method",Pt,{cause:e});if("application/x-www-form-urlencoded"!==Nn(e))throw Mt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Pt,{cause:e});return async function(e){if(e.bodyUsed)throw Mt("form_post Request instances must contain a readable body",Pt,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var v=R(e,2);const n=v[0],o=v[1];t.searchParams.append(n,o)}break;
11default:throw Br("unexpected Request HTTP method",Dr)}}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!!y:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,o){if(dn(e),hn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Mt('"parameters" must be an instance of URLSearchParams, or URL',Ut);if(bo(n,"response"))throw qt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',oo,{parameters:n});const r=bo(n,"iss"),i=bo(n,"state");if(!r&&e.authorization_response_iss_parameter_supported)throw qt('response parameter "iss" (issuer) missing',oo,{parameters:n});if(r&&r!==e.issuer)throw qt('unexpected "iss" (issuer) response parameter value',oo,{expected:e.issuer,parameters:n});switch(o){case void 0:case So:if(void 0!==i)throw qt('unexpected "state" response parameter encountered',oo,{expected:void 0,parameters:n});break;case Ao:break;default:if(on(o,'"expectedState" argument'),i!==o)throw qt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',oo,{expected:o,parameters:n})}if(bo(n,"error"))throw new bn("authorization response from the server is an error",{cause:n});const a=bo(n,"id_token"),s=bo(n,"token");if(void 0!==a||void 0!==s)throw new Zt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Xn.add(c),c;var c}(c,l,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Kr(e)}}}const b=await async function(e,t,n,o,r,i,a){if(dn(e),hn(t),!Xn.has(o))throw Mt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Pt);on(r,'"redirectUri"');const s=bo(o,"code");if(!s)throw qt('no authorization code in "callbackParameters"',oo);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",r),c.set("code",s),i!==Jn&&(on(i,'"codeVerifier"'),c.set("code_verifier",i)),Un(e,t,n,"authorization_code",c,a)}(c,l,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Jn,{additionalParameters:o,[Wt]:d,[Dt]:!h,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Rr),signal:ri(g)}).catch(Kr);"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,o){return"string"==typeof(null==o?void 0:o.expectedNonce)||"number"==typeof(null==o?void 0:o.maxAge)||null!=o&&o.requireIdToken?async function(e,t,n,o,r,i,a){const s=[];
11switch(o){case void 0:o=Zn;break;case Zn:break;default:on(o,'"expectedNonce" argument'),s.push("nonce")}switch(null!=r||(r=t.default_max_age),r){case void 0:r=Yn;break;case Yn:break;default:nn(r,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Bn(e,t,n,s,i,a);on(c.id_token,'"response" body "id_token" property',oo,{body:c});const l=jn(c);if(r!==Yn){const e=un()+cn(t),n=ln(t);if(l.auth_time+r<e-n)throw qt("too much time has elapsed since the last End-User authentication",co,{claims:l,now:e,tolerance:n,claim:"auth_time"})}if(o===Zn){if(void 0!==l.nonce)throw qt('unexpected ID Token "nonce" claim value',lo,{expected:void 0,claims:l,claim:"nonce"})}else if(l.nonce!==o)throw qt('unexpected ID Token "nonce" claim value',lo,{expected:o,claims:l,claim:"nonce"});return c}(e,t,n,o.expectedNonce,o.maxAge,o[Kt],o.recognizedTokenTypes):async function(e,t,n,o,r){const i=await Bn(e,t,n,void 0,o,r),a=jn(i);if(a){if(void 0!==t.default_max_age){nn(t.default_max_age,!0,'"client.default_max_age"');const e=un()+cn(t),n=ln(t);if(a.auth_time+t.default_max_age<e-n)throw qt("too much time has elapsed since the last End-User authentication",co,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw qt('unexpected ID Token "nonce" claim value',lo,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==o?void 0:o[Kt],null==o?void 0:o.recognizedTokenTypes)}(c,l,b,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[Kt]:w});let S;try{S=await A}catch(t){if(ai(t,r))return Qr(e,void 0,n,o,O(O({},r),{},{flag:si,authResponse:i,redirectUri:a}));Kr(t)}return S.id_token&&await(null==m?void 0:m(b)),Jr(S),S}async function $r(e,t,n,o){oi(e),n=new URLSearchParams(n);const r=xr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,l=r.tlsOnly,u=r.nonRepudiation,d=r.timeout,h=r.decrypt,p=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"refreshToken"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("refresh_token",o),Un(e,t,n,"refresh_token",i,r)}(i,a,s,t,{[Wt]:c,[Dt]:!l,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Rr),signal:ri(d)}).catch(Kr),f=async function(e,t,n,o){return Bn(e,t,n,void 0,null==o?void 0:o[Kt],null==o?void 0:o.recognizedTokenTypes)}(i,a,p,{[Kt]:h});let m;try{m=await f}catch(r){if(ai(r,o))return $r(e,t,n,O(O({},o),{},{flag:si}));Kr(r)}return m.id_token&&await(null==u?void 0:u(p)),Jr(m),m}async function ei(e,t,n){oi(e),t=new URLSearchParams(t);const o=xr(e),r=o.as,i=o.c,a=o.auth,s=o.fetch,c=o.tlsOnly,l=o.timeout,u=await async function(e,t,n,o,r){return dn(e),hn(t),Un(e,t,n,"client_credentials",new URLSearchParams(o),r)}(r,i,a,t,{[Wt]:s,[Dt]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Rr),signal:ri(l)}).catch(Kr),d=async function(e,t,n){return Bn(e,t,n,void 0,void 0,void 0)}(r,i,u);let h;try{h=await d}catch(o){if(ai(o,n))return ei(e,t,O(O({},n),{},{flag:si}));Kr(o)}return Jr(h),h}function ti(e,t){oi(e);const n=xr(e),o=n.as,r=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,l=yn(o,"authorization_endpoint",!1,i);if((t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw Br("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",Dr);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var u=R(e,2);const t=u[0],n=u[1];l.searchParams.append(t,n)}return l}async function ni(e,t,n){oi(e);const o=ti(e,t),r=xr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,l=r.tlsOnly,u=r.timeout,d=await async function(e,t,n,o,r){var i;dn(e),hn(t);const a=yn(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),s=new URLSearchParams(o);s.set("client_id",t.client_id);const c=$t(null==r?void 0:r.headers);c.set("accept","application/json"),void 0!==(null==r?void 0:r.DPoP)&&(In(r.DPoP),await r.DPoP.addProof(a,c,"POST"));const l=await Pn(e,t,n,a,s,c,r);return null==r||null===(i=r.DPoP)||void 0===i||i.cacheNonce(l,a),l}(i,a,s,o.searchParams,{[Wt]:c,[Dt]:!l,DPoP:null==n?void 0:n.DPoP,headers:new Headers(Rr),signal:ri(u)}).catch(Kr),h=async function(e,t,n){if(dn(e),hn(t),!Lt(n,Response))throw Mt('"response" must be an instance of Response',Ut);await Rn(n,201,"Pushed Authorization Request Endpoint"),mo(n);const o=await Eo(n);on(o.request_uri,'"response" body "request_uri" property',oo,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',oo,{body:o}),o.expires_in=r,o}(i,a,d);let p;try{p=await h}catch(o){if(ai(o,n))return ni(e,t,O(O({},n),{},{flag:si}));Kr(o)}return ti(e,{request_uri:p.request_uri})}
11function oi(e){if(!(e instanceof Xr))throw Br('"config" must be an instance of Configuration',jr);if(Object.getPrototypeOf(e)!==Xr.prototype)throw Br("subclassing Configuration is not allowed",Dr)}function ri(e){return e?AbortSignal.timeout(1e3*e):void 0}async function ii(e,t,n,o){oi(e);const r=xr(e),i=r.as,a=r.c,s=r.fetch,c=r.tlsOnly,l=r.nonRepudiation,u=r.timeout,d=r.decrypt,h=await async function(e,t,n,o){dn(e),hn(t);const r=yn(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Dt])),i=$t(null==o?void 0:o.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,o,r,i){var a;if(on(e,'"accessToken"'),!(n instanceof URL))throw Mt('"url" must be an instance of URL',Ut);gn(n,!0!==(null==i?void 0:i[Dt])),o=$t(o),null!=i&&i.DPoP&&(In(i.DPoP),await i.DPoP.addProof(n,o,"GET".toUpperCase(),e)),o.set("authorization","".concat(o.has("dpop")?"DPoP":"Bearer"," ").concat(e));const s=await((null==i?void 0:i[Wt])||fetch)(n.href,{duplex:Lt(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(o.entries()),method:"GET",redirect:"manual",signal:en(n,null==i?void 0:i.signal)});return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(s,n),s}(n,0,r,i,0,O(O({},o),{},{[jt]:cn(t)}))}(i,a,t,{[Wt]:s,[Dt]:!c,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Rr),signal:ri(u)}).catch(Kr);let p,f=Ln(i,a,n,h,{[Kt]:d});try{p=await f}catch(r){if(ai(r,o))return ii(e,t,n,O(O({},o),{},{flag:si}));Kr(r)}return"application/jwt"===Nn(h)&&await(null==l?void 0:l(h)),p}function ai(e,t){return!(null==t||!t.DPoP||t.flag===si)&&function(e){if(e instanceof An){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof vn&&"use_dpop_nonce"===e.error}(e)}Object.freeze(Xr.prototype);const si=Symbol();async function ci(e,t,n,o){oi(e);const r=xr(e),i=r.as,a=r.c,s=r.auth,c=r.fetch,l=r.tlsOnly,u=r.timeout,d=r.decrypt,h=r.nonRepudiation,p=await async function(e,t,n,o,r,i){return dn(e),hn(t),on(o,'"grantType"'),Un(e,t,n,o,new URLSearchParams(r),i)}(i,a,s,t,new URLSearchParams(n),{[Wt]:c,[Dt]:!l,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Rr),signal:ri(u)}).catch(Kr);let f;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(f={n_a:()=>{}});const m=async function(e,t,n,o){return Bn(e,t,n,void 0,null==o?void 0:o[Kt],null==o?void 0:o.recognizedTokenTypes)}(i,a,p,{[Kt]:d,recognizedTokenTypes:f});let g;try{g=await m}catch(r){if(ai(r,o))return ci(e,t,n,O(O({},o),{},{flag:si}));Kr(r)}return g.id_token&&await(null==h?void 0:h(p)),Jr(g),g}async function li(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var o;const r=e.algorithm;if(r.name!==t.name)throw xo(t.name);if(t.hash&&(null===(o=r.hash)||void 0===o?void 0:o.name)!==t.hash)throw xo(t.hash,"algorithm.hash");if(t.namedCurve&&r.namedCurve!==t.namedCurve)throw xo(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&r.length!==t.length)throw xo(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){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.alg,t),t)}const ui=[["verify"],["sign"]];function di(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:ui}}function hi(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?O(O({},n),{},{saltLength:t}):n,usages:ui,minRsaBits:2048}}function pi(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:ui}}function fi(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:ui}}function mi(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:ui}}const gi=hr({HS256:di(256),HS384:di(384),HS512:di(512),RS256:hi(256),RS384:hi(384),RS512:hi(512),PS256:hi(256,32),PS384:hi(384,48),PS512:hi(512,64),ES256:pi("P-256",256),ES384:pi("P-384",384),ES512:pi("P-521",512),EdDSA:fi(),Ed25519:fi(),"ML-DSA-44":mi(44),"ML-DSA-65":mi(65),"ML-DSA-87":mi(87)});function wi(e){const t="string"==typeof e?gi[e]:void 0;if(!t)throw new Do("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function yi(e,t,n){if(e instanceof Uint8Array&&(e=Oo.decode(e)),"string"!=typeof e)throw new jo("Compact JWS must be a string or Uint8Array");const o=e.split("."),r=o[0],i=o[1],a=o[2];if(3!==o.length)throw new jo("Invalid Compact JWS");const s={payload:i,protected:r,signature:a},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let o;try{o=JSON.parse(Co.decode(Vo(e)))}catch(e){throw new t(n)}if(!Yo(o))throw new t(n);return o}
11(e,jo,"JWS Protected Header is invalid");return t}(r),l=function(e,t,n){const o=Tr(e,_r(jo,Er,n[1],e,t)),r=t.alg;if("string"!=typeof r||!r)throw new jo('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(r))throw new Mo('"alg" (Algorithm) Header Parameter value not allowed');return[o,r]}(c,c,t),u=R(l,2),d=u[0],h=u[1],p=d?i:function(e){try{return Io(e)}catch(e){throw new jo("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,o,r,i,a){var s;let c=!1;"function"==typeof n&&(n=await n(r,e),c=!0);const l="string"==typeof a,u=wi(i),d=Ro(void 0!==o?Io(o):new Uint8Array,Io("."),l?null!==(s=t[2])&&void 0!==s?s:t[2]=function(e,t,n){try{return Io(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,jo):a),h=Qo(e.signature,"signature",jo),p=await dr(u,n,"verify");if(!await async function(e,t,n,o){const r=await li(e,t,"verify");try{return await crypto.subtle.verify(e.signing,r,n,o)}catch(e){return!1}}(u,p,h,d))throw new Fo;return[l?Qo(a,"payload",jo):a,r,l,p,c]}(s,t,n,r,c,h,p)}const vi=e=>Math.floor(e.getTime()/1e3),bi={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Ai=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Si="check_failed";function Ei(){throw new TypeError("Invalid time period format")}function ki(e){"string"!=typeof e&&Ei();const t=Ai.exec(e);(!t||t[4]&&t[1])&&Ei();const n=parseFloat(t[2]),o=Math.round(n*bi[t[3][0].toLowerCase()]);return Number.isFinite(o)||Ei(),"-"===t[1]||"ago"===t[4]?-o:o}function _i(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function Ti(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Oi(e,t){return"number"==typeof e?_i(t,e):e instanceof Date?_i(t,vi(e)):vi(new Date)+ki(e)}const Ci=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function Ri(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=e[t];if(void 0!==o||n){if("number"!=typeof o)throw new Po('"'.concat(t,'" claim must be a number'),e,t,"invalid");return o}}function Ii(e,t){throw new Po('unexpected "'.concat(t,'" claim value'),e,t,Si)}function xi(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Co.decode(t))}catch(e){}if(!Yo(n))throw new Bo("JWT Claims Set must be a top-level JSON object");const r=o.typ;if(void 0!==r&&("string"!=typeof e.typ||Ci(e.typ)!==Ci(r)))throw new Po('unexpected "typ" JWT header value',n,"typ",Si);const i=o.requiredClaims,a=void 0===i?[]:i,s=o.issuer,c=o.subject,l=o.audience,u=o.maxTokenAge,d=[...a];void 0!==u&&d.push("iat"),void 0!==l&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!Object.hasOwn(n,e))throw new Po('missing required "'.concat(e,'" claim'),n,e,"missing");var h,p;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||Ii(n,"iss"),void 0!==c&&n.sub!==c&&Ii(n,"sub"),void 0===l||(p="string"==typeof l?[l]:l,"string"==typeof(h=n.aud)?p.includes(h):Array.isArray(h)&&p.some(e=>h.includes(e)))||Ii(n,"aud");const f=o.clockTolerance;let m=0;if("string"==typeof f)m=ki(f);else if(void 0!==f){if("number"!=typeof f)throw new TypeError("Invalid clockTolerance option type");m=f}_i("clockTolerance option",m);const g=o.currentDate,w=_i("currentDate option",vi(void 0===g?new Date:g)),y=Ri(n,"iat",void 0!==u),v=Ri(n,"nbf");if(void 0!==v&&v>w+m)throw new Po('"nbf" claim timestamp check failed',n,"nbf",Si);const b=Ri(n,"exp");if(void 0!==b&&b<=w-m)throw new Uo('"exp" claim timestamp check failed',n,"exp",Si);if(void 0!==u){const e=w-y;if(e-m>_i("maxTokenAge option","number"==typeof u?u:ki(u)))throw new Uo('"iat" claim timestamp check failed (too far in the past)',n,"iat",Si);if(e<-m)throw new Po('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Si)}return n}let Ni;function Li(e){return Ni.get(e)}async function Pi(e,t,n,o,r){const i=R(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,o;try{n=JSON.stringify(t),o=JSON.parse(n)}
11catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!Yo(o))throw new e("JOSE Header is not a JSON object");return[o,n]}(jo,e);return[t[0],Zo(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new jo("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}(jo,e),Tr(e,_r(jo,Er,n,e,t))})(a,a,n)||r();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new jo('JWS "alg" (Algorithm) Header Parameter missing or invalid');return wi(t)}(a),l=Zo(e),u=await async function(e,t,n,o){const r=Ro(Io(e),Io("."),t),i=await dr(n,o,"sign");return Zo(await async function(e,t,n){const o=await li(e,t,"sign"),r=await crypto.subtle.sign(e.signing,o,n);return new Uint8Array(r)}(n,i,r))}(s,Io(l),c,o);return"".concat(s,".").concat(l,".").concat(u)}const Ui=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Yo(e))throw new TypeError("JWT Claims Set MUST be an object");(Ni||(Ni=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return Ti("iss",e),Li(this).iss=e,this}setSubject(e){return Ti("sub",e),Li(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of strings')}(e),Li(this).aud=e,this}setJti(e){return Ti("jti",e),Li(this).jti=e,this}setNotBefore(e){return Li(this).nbf=Oi(e,"setNotBefore"),this}setExpirationTime(e){return Li(this).exp=Oi(e,"setExpirationTime"),this}setIssuedAt(e){return Li(this).iat=void 0===e?vi(new Date):"string"==typeof e?_i("setIssuedAt",vi(new Date)+ki(e)):Oi(e,"setIssuedAt"),this}};var Mi=new WeakMap;class Di extends Ui{constructor(){super(...arguments),S(this,Mi,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(A(Mi,this)),E(Mi,this,e),this}async sign(e,t){return Pi(function(e){const t=Li(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return To.encode(JSON.stringify(t))}(this),A(Mi,this),null==t?void 0:t.crit,e,()=>{throw new Bo("JWTs MUST NOT use unencoded payload")})}}const ji='"alg" (Algorithm)';function Bi(){throw new Do("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const Wi=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},Gi=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},Ki=e=>{const t=Gi(e);if(128&t){const n=127&t;let o=0;for(let t=0;t<n;t++)o=o<<8|Gi(e);return o}return t},Hi=(e,t,n)=>{if(Gi(e)!==t)throw new Error(n)},Fi=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Xi=e=>{const t=(e=>{Hi(e,6,"Expected algorithm OID");const t=Ki(e);return Fi(e,t)})(e);if(Wi(t,[43,101,110]))return"X25519";if(!Wi(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Hi(e,6,"Expected curve OID");const n=Ki(e),o=Fi(e,n);if(Wi(o,[42,134,72,206,61,3,1,7]))return"P-256";if(Wi(o,[43,129,4,0,34]))return"P-384";if(Wi(o,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},Ji=(e,t,n)=>{const o=(e=>Jo(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,o)=>{const r=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==o?void 0:o.extractable),i=function(e,t){var n,o;return null!==(n="string"==typeof e?null!==(o=gi[e])&&void 0!==o?o:br[e]:void 0)&&void 0!==n?n:Bi(t)}(n,ji);i.secret&&Bi(ji);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(Hi(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),Ki(e),"pkcs8"===t){Hi(e,2,"Expected version field");const t=Ki(e);e.pos+=t}Hi(e,48,"Expected algorithm identifier"),Ki(e)}(n,e),s=i.resolve({crv:Xi(n)})}catch(e){throw new Do("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,null!=r?r:a,i.usages[a?0:1])})("pkcs8",o,t,n)};async function zi(e,t,n){const o=e.get(t)||e.set(t,{}).get(t),r=n.alg;if(void 0===o[r]){const e=await $o(n,O(O({},t),{},{alg:r,ext:!0}));if("public"!==e.type)throw new Wo("JSON Web Key Set members must be public keys");o[r]=e}return o[r]}function Vi(e){let t;try{t=structuredClone(e)}catch(e){}if(!qo(t))throw new Wo("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,o)=>{const r=O(O({},e),null==o?void 0:o.header),i=r.alg,a=r.kid,s="string"==typeof i?gi[i]:void 0;if(!s||s.secret)throw new Do('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,o){const r=er(e),i=r.kty,a=r.key_ops,s=r.ext,c=r.kid,l=r.alg,u=r.use,d=r.crv,h=Array.isArray(a)?[...a]:a;return(void 0===s||"boolean"==typeof s)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===o||"string"==typeof o&&o===c)&&(void 0===l?"AKP"!==i:n===l)&&(void 0===u||"sig"===u)&&(!t.crv||d===t.crv)}(e,s,i,a)),l=c[0],u=c.length;if(!u)throw new Go;if(1!==u){const e=new Ko;throw e[Symbol.asyncIterator]=I(function*(){for(const e of c)try{yield yield v(zi(n,e,s))}catch(e){}}),e}return zi(n,l,s)},"jwks",{value:()=>structuredClone(t)})}var Zi,Yi;let qi;if("undefined"==typeof navigator||null===(Zi=navigator.userAgent)||void 0===Zi||null===(Yi=Zi.startsWith)||void 0===Yi||!Yi.call(Zi,"Mozilla/5.0 ")){const e="v6.2.10";qi="".concat("jose","/").concat(e)}const Qi=Symbol(),$i=Symbol();function ea(e,t){return Number.isFinite(e)&&Date.now()<e+t}function ta(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function na(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
11return Ji(e,t,n)}const oa=["mfaToken"],ra=["mfaToken"];var ia,aa,sa,ca,la,ua,da,ha,pa,fa,ma,ga,wa,ya,va,ba,Aa,Sa,Ea,ka,_a,Ta,Oa,Ca,Ra,Ia,xa,Na,La,Pa,Ua,Ma,Da,ja,Ba,Wa,Ga,Ka,Ha,Fa,Xa,Ja,za,Va,Za,Ya,qa,Qa,$a,es,ts,ns;function os(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function rs(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const o=e;let r;if(o.response instanceof Response)try{r=new Headers(o.response.headers),r.delete("set-cookie")}catch(e){r=void 0}const i={error:null!==(t=o.error)&&void 0!==t?t:"",error_description:null!==(n=o.error_description)&&void 0!==n?n:"",message:o.message,statusCode:"number"==typeof o.status?o.status:void 0,headers:r};if("mfa_required"===o.error&&o.cause){i.mfa_token="string"==typeof o.cause.mfa_token?o.cause.mfa_token:void 0;const e=o.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var is=class extends Error{constructor(e,t){super(t),_(this,"code",void 0),this.name="NotSupportedError",this.code=e}},as=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},ss=class extends as{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},cs=class extends as{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},ls=class extends as{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},us=class extends as{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},ds=class extends as{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},hs=class extends as{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ps=class extends as{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},fs=class extends as{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}},ms=class extends Error{constructor(e){super(e),_(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},gs=class extends as{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),_(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ws=class extends as{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ys=class extends as{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},vs=class extends as{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},bs=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),_(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}},As=class extends Error{constructor(e){super(e),_(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Ss=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),_(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function Es(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function ks(e,t,n){var o;const r="object"==typeof t&&null!==t?t:void 0,i=null!==(o=null==r?void 0:r.response)&&void 0!==o?o:n,a="number"==typeof(null==r?void 0:r.status)?r.status:null==i?void 0:i.status;"number"==typeof a&&(e.statusCode=a),null!=i&&i.headers&&(e.headers=Es(i.headers))}function _s(e){return Object.entries(e).filter(e=>void 0!==R(e,2)[1]).reduce((e,t)=>
11O(O({},e),{},{[t[0]]:t[1]}),{})}function Ts(e){if(!e.trim())throw new As("organization must not be blank")}function Os(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new As("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new As('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new As("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new As('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var Cs=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},Rs=class extends Cs{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Is=class extends Cs{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},xs=class extends Cs{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ns=class extends Cs{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},Ls=class extends Cs{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function Ps(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Us=class e{constructor(e,t,n,o,r,i,a){_(this,"accessToken",void 0),_(this,"idToken",void 0),_(this,"refreshToken",void 0),_(this,"expiresAt",void 0),_(this,"scope",void 0),_(this,"claims",void 0),_(this,"authorizationDetails",void 0),_(this,"tokenType",void 0),_(this,"issuedTokenType",void 0),_(this,"recoveryCode",void 0),_(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=o,this.expiresAt=t,this.scope=r,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,o=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 o.tokenType=t.token_type,o.issuedTokenType=t.issued_token_type,o}};function Ms(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},o=btoa(JSON.stringify(n));return async(t,n)=>{const r=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{r.set(t,e)}),r.set("Auth0-Client",o),e(t,O(O({},n),{},{headers:r}))}}function Ds(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function js(e){let t;const n=async(n,o)=>{const r=await e(n,o);return t=r.clone(),r};return n.getCapturedResponse=()=>t,n}function Bs(e,t,n){if(!t)return e;const o=t.signal,r=t.headers,i=t.customFetch,a=i?Ms(i,n):e;return o||r?async(e,t)=>{const n=r?new Headers(e instanceof Request?e.headers:void 0):void 0;if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),r)for(const e of Object.entries(r)){var i=R(e,2);const t=i[0],o=i[1],r=t.toLowerCase();"authorization"!==r&&"auth0-client"!==r&&n.set(t,o)}const s=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,o=[e,t],r=o.find(e=>e.aborted);if(r)return n.abort(r.reason),{signal:n.signal};const i=[],a=()=>{o.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return o.forEach((e,t)=>{const o=()=>{a(),n.abort(e.reason)};i[t]=o,e.addEventListener("abort",o,{once:!0})}),{signal:n.signal,cleanup:a}}(o,null==t?void 0:t.signal);try{return await a(e,O(O(O({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var Ws={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
11overy-code"},Gs=(ia=new WeakMap,aa=new WeakMap,sa=new WeakMap,ca=new WeakMap,la=new WeakMap,ua=new WeakMap,da=new WeakMap,ha=new WeakSet,class{constructor(e){var t,n;k(this,ha),S(this,ia,void 0),S(this,aa,void 0),S(this,sa,void 0),S(this,ca,void 0),S(this,la,void 0),S(this,ua,void 0),S(this,da,void 0),E(ia,this,"https://".concat(e.domain)),E(aa,this,e.clientId),E(sa,this,e.clientSecret),E(ca,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(la,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(ua,this,e.getConfiguration),E(da,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(A(ia,this),"/mfa/authenticators"),o=e.mfaToken,r=await y(ha,this,Ks).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!r.ok){const e=await r.clone().text(),t=r.status,n=Es(r.headers);let i;try{i=JSON.parse(e)}catch(o){throw new Rs("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new Rs(i.error_description||"Failed to list authenticators",O(O({},i),{},{statusCode:t,headers:n,body:e}))}return(await r.json()).map(Ps)}async enrollAuthenticator(e,t){const n="".concat(A(ia,this),"/mfa/associate"),o=e.mfaToken,r=C(e,oa),i={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(i.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(i.phone_number=r.phoneNumber),"email"in r&&r.email&&(i.email=r.email);const a=await y(ha,this,Ks).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Es(a.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Is("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new Is(r.error_description||"Failed to enroll authenticator",O(O({},r),{},{statusCode:t,headers:n,body: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 a.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,o=e.mfaToken,r="".concat(A(ia,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await y(ha,this,Ks).call(this,t)(r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(o),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=Es(i.headers);let r;try{r=JSON.parse(e)}catch(o){throw new xs("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new xs(r.error_description||"Failed to delete authenticator",O(O({},r),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(A(ia,this),"/mfa/challenge"),o=e.mfaToken,r=C(e,ra),i={mfa_token:o,client_id:A(aa,this),challenge_type:r.challengeType};A(sa,this)&&(i.client_secret=A(sa,this)),r.authenticatorId&&(i.authenticator_id=r.authenticatorId);const a=await y(ha,this,Ks).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Es(a.headers);let r;try{r=JSON.parse(e)}catch(o){throw new Ns("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new Ns(r.error_description||"Failed to challenge authenticator",O(O({},r),{},{statusCode:t,headers:n,body: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 a.json())}async verify(e,t){if(!A(ua,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var o;if(!A(da,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=js(null!==(o=(await A(ua,this).call(this,t))[Mr])&&void 0!==o?o:fetch),c=await A(da,this).call(this,s);try{const t=await ci(c,Ws[e.factorType],n),o=Us.fromTokenEndpointResponse(t);
11t.recovery_code&&(o.recoveryCode=t.recovery_code);const r=s.getCapturedResponse();if(!r)throw new Ss;return{data:o,response:r}}catch(e){var r,i,a;if(e instanceof Ss)throw e;if(e instanceof Ls)throw e;const t=e,n=new Ls(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(r=t.error)&&void 0!==r?r:"mfa_verify_error",error_description:null!==(i=null!==(a=t.error_description)&&void 0!==a?a:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw ks(n,e,s.getCapturedResponse()),n}}const s=await A(ua,this).call(this,t);try{const t=await ci(s,Ws[e.factorType],n),o=Us.fromTokenEndpointResponse(t);return t.recovery_code&&(o.recoveryCode=t.recovery_code),o}catch(e){var c,l,u;if(e instanceof Ls)throw e;const t=e,n=new Ls(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(l=null!==(u=t.error_description)&&void 0!==u?u:t.message)&&void 0!==l?l:"Failed to verify MFA challenge"});throw ks(n,e),n}}});function Ks(e){return Bs(A(ca,this),e,A(la,this))}var Hs=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},Fs=class extends Hs{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},Xs=class extends Hs{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},Js=class extends Hs{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function zs(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var Vs="urn:okta:params:oauth:grant-type:webauthn",Zs=(pa=new WeakMap,fa=new WeakMap,ma=new WeakMap,ga=new WeakMap,wa=new WeakMap,ya=new WeakMap,va=new WeakSet,class{constructor(e){var t,n;k(this,va),S(this,pa,void 0),S(this,fa,void 0),S(this,ma,void 0),S(this,ga,void 0),S(this,wa,void 0),S(this,ya,void 0),E(pa,this,"https://".concat(e.domain)),E(fa,this,e.clientId),E(ma,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),E(ga,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(wa,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(ya,this,e.grantRequest)}async register(e,t){const n="".concat(A(pa,this),"/passkey/register"),o=O(O(O(O(O(O(O(O({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),r=O(O({client_id:A(fa,this)},zs(A(ma,this))),{},{user_profile:o});e.realm&&(r.realm=e.realm),e.organization&&(r.organization=e.organization),e.userMetadata&&(r.user_metadata=e.userMetadata);const i=await y(va,this,Ys).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){const e=await y(va,this,qs).call(this,i),t=new Fs(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=Es(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:O({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(A(pa,this),"/passkey/challenge"),o=O({client_id:A(fa,this)},zs(A(ma,this)));null!=e&&e.realm&&(o.realm=e.realm),null!=e&&e.organization&&(o.organization=e.organization);const r=await y(va,this,Ys).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const e=await y(va,this,qs).call(this,r),t=new Xs(e.error_description||"Failed to request login challenge",e);throw t.statusCode=r.status,t.headers=Es(r.headers),t}return{authSession:(i=await r.json()).auth_session,authnParamsPublicKey:O({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&Ts(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let o;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
11nce),e.organization&&n.append("organization",e.organization);try{o=await A(ya,this).call(this,Vs,n,t,e.fullResponse)}catch(e){if(e instanceof Ss)throw e;const t=rs(e),n=new Js(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw ks(n,e),n}if(e.fullResponse){const t=o;return e.organization&&Os(t.data.claims,e.organization),t}const r=o;return e.organization&&Os(r.claims,e.organization),r}});function Ys(e){return Bs(A(ga,this),e,A(wa,this))}async function qs(e){const t=await e.clone().text();try{return O(O({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var Qs=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},$s=class extends Qs{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},ec=class extends Qs{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},tc=class extends Qs{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},nc=class extends Qs{constructor(e,t,n,o,r){super("passwordless_challenge_error",e,n),_(this,"statusCode",void 0),_(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=o,this.headers=null!=r?r:this.headers}};function oc(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function rc(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await na(e.clientAssertionSigningKey,r);return{client_assertion:await new Di({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new bs}var ic=(ba=new WeakMap,Aa=new WeakMap,Sa=new WeakMap,Ea=new WeakMap,ka=new WeakMap,_a=new WeakMap,Ta=new WeakMap,Oa=new WeakSet,class{constructor(e){var t,n;k(this,Oa),S(this,ba,void 0),S(this,Aa,void 0),S(this,Sa,void 0),S(this,Ea,void 0),S(this,ka,void 0),S(this,_a,void 0),S(this,Ta,void 0),E(Aa,this,e.domain),E(ba,this,"https://".concat(e.domain)),E(Sa,this,e.clientId),E(Ea,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(ka,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds()),E(_a,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),E(Ta,this,e.grantRequest)}async sendEmail(e,t){const n=await y(Oa,this,sc).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",o={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(o.authParams=e.authParams),o}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!oc(e.phoneNumber))throw new $s("Phone number must be in E.164 format (e.g. +14155550100).");const n=await y(Oa,this,sc).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return y(Oa,this,cc).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!oc(e.phoneNumber))throw new nc("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return y(Oa,this,cc).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
11nce),!A(Ta,this))throw new tc("Missing grant request delegate.",rs(new Error("missing grantRequest")));try{return await A(Ta,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Ss)throw e;const t=new tc("There was an error while trying to request a token.",rs(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function ac(e){return Bs(A(Ea,this),e,A(ka,this))}async function sc(e,t,n,o){var r;const i=await rc(A(_a,this),A(Sa,this),A(Aa,this)),a=O(O({client_id:A(Sa,this)},e),i);let s;try{s=await y(Oa,this,ac).call(this,o)("".concat(A(ba,this),"/passwordless/start"),{method:"POST",headers:O({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new $s("".concat(t,": a network error occurred."))}if(s.ok)return s;const c=await s.clone().text();let l;if(204!==s.status)try{l=JSON.parse(c)}catch(e){l=void 0}const u=new $s((null===(r=l)||void 0===r?void 0:r.error_description)||t,l);throw u.statusCode=s.status,u.headers=Es(s.headers),u.body=c,u}async function cc(e,t,n){var o,r;const i=await rc(A(_a,this),A(Sa,this),A(Aa,this)),a=O(O({client_id:A(Sa,this)},e),i);let s;try{s=await y(Oa,this,ac).call(this,n)("".concat(A(ba,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new nc("challenge error: a network error occurred.",0,void 0,void 0)}if(s.ok){let n;try{n=await s.json()}catch(e){throw new nc("".concat(t,": could not parse the response body."),s.status,void 0,void 0,Es(s.headers))}return{authSession:n.auth_session}}const c=await s.clone().text();let l;try{l=JSON.parse(c)}catch(e){l=void 0}const u=l?O(O({},l),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new nc((null===(o=l)||void 0===o?void 0:o.error_description)||t,s.status,u,null===(r=l)||void 0===r?void 0:r.validation_errors,Es(s.headers))}var lc=class extends Error{constructor(e,t,n){super(t),_(this,"cause",void 0),_(this,"code",void 0),_(this,"statusCode",void 0),_(this,"headers",void 0),_(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const o=os(n);this.statusCode=o.statusCode,this.headers=o.headers,this.body=o.body}},uc=class extends lc{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},dc=class extends lc{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function hc(e,t,n){for(const o of t)if(null===e[o]||void 0===e[o]||""===e[o])throw new n('Required parameter "'.concat(String(o),'" was null, undefined, or empty.'))}function pc(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var fc=(Ca=new WeakMap,Ra=new WeakMap,Ia=new WeakMap,xa=new WeakMap,Na=new WeakSet,class{constructor(e){var t,n;k(this,Na),S(this,Ca,void 0),S(this,Ra,void 0),S(this,Ia,void 0),S(this,xa,void 0),E(Ca,this,"https://".concat(e.domain)),E(Ra,this,e.clientId),E(Ia,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),E(xa,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:Ds())}async signUp(e,t){var n;hc(e,["email","password","connection"],uc);const o=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:A(Ra,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),r=await y(Na,this,mc).call(this,"/dbconnections/signup",o,uc,"Failed to sign up",t);if(e.fullResponse){const e=r.clone();return{data:pc(await r.json()),response:e}}return pc(await r.json())}async changePassword(e,t){var n;if(hc(e,["connection"],dc),!e.email&&!e.username)throw new dc('Either "email" or "username" is required.');const o=O({client_id:null!==(n=e.clientId)&&void 0!==n?n:A(Ra,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),r=await y(Na,this,mc).call(this,"/dbconnections/change_password",o,dc,"Failed to request a password change",t);if(e.fullResponse){const e=r.clone();return{data:await r.text(),response:e}}return r.text()}});async function mc(e,t,n,o,r){const i=Bs(A(Ia,this),r,A(xa,this));let a;try{a=await i("".concat(A(Ca,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(o,": a network error occurred."))}if(a.ok)return a;const s=await a.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(a.clone()),l=new n((null==c?void 0:c.error_description)||o,null!=c?c:{error:"unknown_error",error_description:o});throw l.statusCode=a.status,l.headers=Es(a.headers),l.body=s,l}
11var gc=class extends Error{constructor(e,t,n){super(t),_(this,"code",void 0),_(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},wc=new Set(["session_expired","invalid_session_token"]);async function yc(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var vc=(La=new WeakMap,Pa=new WeakMap,Ua=new WeakMap,Ma=new WeakMap,Da=new WeakMap,ja=new WeakMap,Ba=new WeakMap,Wa=new WeakMap,Ga=new WeakSet,class{constructor(e){var t;k(this,Ga),S(this,La,void 0),S(this,Pa,void 0),S(this,Ua,void 0),S(this,Ma,void 0),S(this,Da,void 0),S(this,ja,void 0),S(this,Ba,void 0),S(this,Wa,void 0),E(La,this,e.domain),E(Pa,this,"https://".concat(e.domain)),E(Ua,this,e.clientId),E(Ma,this,e.clientSecret),E(Da,this,e.clientAssertionSigningKey),E(ja,this,e.clientAssertionSigningAlg),E(Ba,this,e.useMtls),E(Wa,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:A(Ua,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await y(Ga,this,Ac).call(this,t);if(!n.sessionToken)throw new gc("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await y(Ga,this,bc).call(this,e.sessionToken,e)}catch(t){if(t instanceof gc&&wc.has(t.code))return O(O({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(A(Pa,this),"/anonymous/logout"),t={client_id:A(Ua,this)},n=await A(Wa,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await yc(n);throw new gc(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function bc(e,t){const n={client_id:A(Ua,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const o=await y(Ga,this,Ac).call(this,n);return{sessionToken:e,accessToken:o.accessToken,expiresAt:o.expiresAt,sessionTokenExpiresAt:o.sessionTokenExpiresAt,scope:o.scope,sessionReplaced:!1}}async function Ac(e){const t="".concat(A(Pa,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var o;const r=null!==(o=e.clientAssertionSigningAlg)&&void 0!==o?o:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await na(e.clientAssertionSigningKey,r);return{client_assertion:await new Di({}).setProtectedHeader({alg:r}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:A(Ma,this),clientAssertionSigningKey:A(Da,this),clientAssertionSigningAlg:A(ja,this),useMtls:A(Ba,this)},A(Ua,this),A(La,this));Object.assign(e,n);const o=await A(Wa,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!o.ok){const e=await yc(o);throw new gc(e.error,e.error_description||"Anonymous token request failed",e)}let r;try{r=await o.json()}catch(e){throw new gc("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new gc("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new gc("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(r)}var Sc=(Ka=new WeakMap,Ha=new WeakMap,Fa=new WeakMap,class{constructor(e,t){S(this,Ka,new Map),S(this,Ha,void 0),S(this,Fa,void 0),E(Fa,this,Math.max(1,Math.floor(e))),E(Ha,this,Math.max(0,Math.floor(t)))}get(e){const t=A(Ka,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return A(Ka,this).delete(e),A(Ka,this).set(e,t),t.value;A(Ka,this).delete(e)}}set(e,t,n){A(Ka,this).has(e)&&A(Ka,this).delete(e);const o=null!=n&&Number.isFinite(n)&&n>0?n:A(Ha,this);for(A(Ka,this).set(e,{value:t,expiresAt:Date.now()+o});A(Ka,this).size>A(Fa,this);){const e=A(Ka,this).keys().next().value;if(void 0===e)break;A(Ka,this).delete(e)}}}),Ec=new Map;function kc(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 _c=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,o=e.ttlMs,"".concat(n,":").concat(o));var n,o;let r=(i=t,Ec.get(i));var i;return r||(r=new Sc(e.maxEntries,e.ttlMs),Ec.set(t,r)),r}static createJwksCache(){return{}}},Tc="openid profile email offline_access",Oc=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 Cc(e){if(null==e)throw new hs("subject_token is required");if("string"!=typeof e)throw new hs("subject_token must be a string");if(0===e.trim().length)throw new hs("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new hs("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new hs("subject_token must not include the 'Bearer ' prefix")}function Rc(e,t){if(t)for(const o of Object.entries(t)){var n=R(o,2);const t=n[0],r=n[1];if(!Oc.has(t))if(Array.isArray(r)){if(r.length>20)throw new hs("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));r.forEach(n=>{e.append(t,n)})}
11else e.append(t,r)}}var Ic="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",xc="urn:ietf:params:oauth:grant-type:token-exchange",Nc="urn:ietf:params:oauth:token-type:access_token";function Lc(e,t){return(n,o)=>{const r=null==o?void 0:o.body;if(t!==Vs||!(r instanceof URLSearchParams))return e(n,o);const i={};for(const e of r){var a=R(e,2);const t=a[0],n=a[1];i[t]="authn_response"===t?JSON.parse(n):n}const s=new Headers(null==o?void 0:o.headers);return s.set("Content-Type","application/json"),e(n,O(O({},o),{},{headers:s,body:JSON.stringify(i)}))}}var Pc=(Xa=new WeakMap,Ja=new WeakMap,za=new WeakMap,Va=new WeakMap,Za=new WeakMap,Ya=new WeakMap,qa=new WeakMap,Qa=new WeakMap,$a=new WeakMap,es=new WeakMap,ts=new WeakMap,ns=new WeakSet,class{constructor(e){var t;if(k(this,ns),S(this,Xa,void 0),S(this,Ja,void 0),S(this,za,void 0),S(this,Va,void 0),S(this,Za,void 0),S(this,Ya,void 0),S(this,qa,void 0),S(this,Qa,void 0),S(this,$a,void 0),S(this,es,void 0),S(this,ts,void 0),_(this,"mfa",void 0),_(this,"passkey",void 0),_(this,"passwordless",void 0),_(this,"database",void 0),_(this,"anonymous",void 0),E(Za,this,e),e.useMtls&&!e.customFetch)throw new is("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");E(qa,this,Ds(e.telemetry)),E(Ya,this,Ms(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},A(qa,this)));const n=kc(e.discoveryCache);E($a,this,_c.createDiscoveryCache(n)),E(es,this,new Map),E(ts,this,_c.createJwksCache()),this.mfa=new Gs({domain:A(Za,this).domain,clientId:A(Za,this).clientId,clientSecret:A(Za,this).clientSecret,customFetch:A(Ya,this),telemetryConfig:A(qa,this),getConfiguration:async e=>(await y(ns,this,jc).call(this,e)).configuration,createCaptureConfiguration:async e=>{const t=(await y(ns,this,Bc).call(this)).serverMetadata;return y(ns,this,Mc).call(this,t,e)}}),this.passkey=new Zs({domain:A(Za,this).domain,clientId:A(Za,this).clientId,clientSecret:A(Za,this).clientSecret,useMtls:A(Za,this).useMtls,customFetch:A(Ya,this),telemetryConfig:A(qa,this),grantRequest:async(e,t,n,o)=>{const r=(await y(ns,this,Bc).call(this)).serverMetadata,i=y(ns,this,Dc).call(this,n);if(o){const n=js(i),o=await y(ns,this,Mc).call(this,r,n);o[Mr]=Lc(n,e);const a=await ci(o,e,t),s=Us.fromTokenEndpointResponse(a),c=n.getCapturedResponse();if(!c)throw new Ss;return{data:s,response:c}}const a=await y(ns,this,Mc).call(this,r);a[Mr]=Lc(i,e);const s=await ci(a,e,t);return Us.fromTokenEndpointResponse(s)}}),this.passwordless=new ic({domain:A(Za,this).domain,clientId:A(Za,this).clientId,customFetch:A(Ya,this),telemetryConfig:A(qa,this),clientSecret:A(Za,this).clientSecret,clientAssertionSigningKey:A(Za,this).clientAssertionSigningKey,clientAssertionSigningAlg:A(Za,this).clientAssertionSigningAlg,useMtls:A(Za,this).useMtls,grantRequest:async(e,t,n,o)=>{const r=(await y(ns,this,jc).call(this,n)).configuration;if(o){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:A(Ya,this)),o=await y(ns,this,Mc).call(this,r.serverMetadata(),n),a=await ci(o,e,t),s=Us.fromTokenEndpointResponse(a),c=n.getCapturedResponse();if(!c)throw new Ss;return{data:s,response:c}}try{const n=await ci(r,e,t);return Us.fromTokenEndpointResponse(n)}catch(e){const t=e,n={};throw ks(n,e),t._statusCode=n.statusCode,t._headers=n.headers,e}}}),this.database=new fc({domain:A(Za,this).domain,clientId:A(Za,this).clientId,customFetch:A(Ya,this),telemetryConfig:A(qa,this)}),this.anonymous=new vc({domain:A(Za,this).domain,clientId:A(Za,this).clientId,clientSecret:A(Za,this).clientSecret,clientAssertionSigningKey:A(Za,this).clientAssertionSigningKey,clientAssertionSigningAlg:A(Za,this).clientAssertionSigningAlg,useMtls:A(Za,this).useMtls,customFetch:A(Ya,this)})}async getServerMetadata(){return(await y(ns,this,Bc).call(this)).serverMetadata}async buildAuthorizationUrl(e){const t=(await y(ns,this,Bc).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new is("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(ns,this,Jc).call(this,e)}catch(e){throw new ws(e)}}async buildLinkUserUrl(e){try{const t=await y(ns,this,Jc).call(this,{authorizationParams:O(O({},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 ys(e)}}async buildUnlinkUserUrl(e){try{const t=await y(ns,this,Jc).call(this,{authorizationParams:O(O({},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 vs(e)}}async backchannelAuthentication(e,t){var n;const o=await y(ns,this,jc).call(this,t),r=o.configuration,i=o.serverMetadata,a=_s(O
11(O({},A(Za,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(O(O({scope:Tc},a),{},{client_id:A(Za,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));if(e.requestedExpiry&&s.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&s.append("authorization_details",JSON.stringify(e.authorizationDetails)),e.fullResponse){var c;const e=js(null!==(c=r[Mr])&&void 0!==c?c:A(Ya,this)),n=await y(ns,this,Mc).call(this,r.serverMetadata(),e);try{const t=await Zr(r,s),o=await Yr(n,t),i=e.getCapturedResponse();if(!i)throw new Ss;return{data:Us.fromTokenEndpointResponse(o),response:i}}catch(t){if(t instanceof Ss)throw t;const n=new gs(t);throw ks(n,t,e.getCapturedResponse()),n}}const l=js(null!==(n=r[Mr])&&void 0!==n?n:A(Ya,this)),u=await y(ns,this,Mc).call(this,r.serverMetadata(),l);try{const e=await Zr(r,s),t=await Yr(u,e);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new gs(e);throw ks(t,e,l.getCapturedResponse()),t}}async initiateBackchannelAuthentication(e,t){var n;const o=await y(ns,this,jc).call(this,t),r=o.configuration,i=o.serverMetadata,a=_s(O(O({},A(Za,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(O(O({scope:Tc},a),{},{client_id:A(Za,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:i.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&s.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&s.append("authorization_details",JSON.stringify(e.authorizationDetails));const c=js(null!==(n=r[Mr])&&void 0!==n?n:A(Ya,this)),l=await y(ns,this,Mc).call(this,r.serverMetadata(),c);try{const e=await Zr(l,s);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){const t=new gs(e),n=c.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async backchannelAuthenticationGrant(e,t){var n;let o=e.authReqId;const r=(await y(ns,this,jc).call(this,t)).configuration,i=new URLSearchParams({auth_req_id:o}),a=js(null!==(n=r[Mr])&&void 0!==n?n:A(Ya,this)),s=await y(ns,this,Mc).call(this,r.serverMetadata(),a);try{const e=await ci(s,"urn:openid:params:grant-type:ciba",i);return Us.fromTokenEndpointResponse(e)}catch(e){const t=new gs(e),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async getTokenForConnection(e,t){var n;if(e.refreshToken&&e.accessToken)throw new ds("Either a refresh or access token should be specified, but not both.");const o=null!==(n=e.accessToken)&&void 0!==n?n:e.refreshToken;if(!o)throw new ds("Either a refresh or access token must be specified.");try{return await this.exchangeToken(O({connection:e.connection,subjectToken:o,subjectTokenType:e.accessToken?Nc:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint},e.fullResponse?{fullResponse:!0}:{}),t)}catch(e){if(e instanceof hs){const t=new ds(e.message,e.cause);throw t.statusCode=e.statusCode,t.headers=e.headers,t}throw e}}async exchangeToken(e,t){return e.fullResponse?"connection"in e?y(ns,this,Gc).call(this,e,t,!0):y(ns,this,Hc).call(this,e,t,!0):"connection"in e?y(ns,this,Gc).call(this,e,t):y(ns,this,Hc).call(this,e,t)}async getTokenByCode(e,t,n){var o;const r=(await y(ns,this,jc).call(this,n)).configuration;if(void 0!==t.organization&&Ts(t.organization),t.fullResponse){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:A(Ya,this)),o=await y(ns,this,Mc).call(this,r.serverMetadata(),n);let a,s;try{const r=await Qr(o,e,{pkceCodeVerifier:t.codeVerifier});if(a=Us.fromTokenEndpointResponse(r),s=n.getCapturedResponse(),!s)throw new Ss}catch(e){if(e instanceof Ss)throw e;const t=new ss("There was an error while trying to request a token.",rs(e)),o=n.getCapturedResponse();throw t.statusCode=null==o?void 0:o.status,t.headers=o?Es(o.headers):void 0,t}return t.organization&&Os(a.claims,t.organization),{data:a,response:s}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:A(Ya,this)),s=await y(ns,this,Mc).call(this,r.serverMetadata(),a);let c;try{const n=await Qr(s,e,{pkceCodeVerifier:t.codeVerifier});c=Us.fromTokenEndpointResponse(n)}catch(e){const t=new ss("There was an error while trying to request a token.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}return t.organization&&Os(c.claims,t.organization),c}async getTokenByMagicLinkCode(e,t,n){var o;const r=(await y(ns,this,jc).call(this,n)).configuration;if(null!=t&&t.fullResponse){var i;const n=js(null!==(i=r[Mr])&&void 0!==i?i:A(Ya,this)),o=await y(ns,this,Mc).call(this,r.serverMetadata(),n);try{const r=await Qr(o,e,{expectedState:null==t?void 0:t.expectedState}),i=Us.fromTokenEndpointResponse(r),a=n.getCapturedResponse();if(!a)throw new Ss;return{data:i,response:a}}catch(e){if(e instanceof Ss)throw e;const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",o=new ss(t,e),r=n.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?Es(r.headers):void 0,o}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:A(Ya,this)),s=await y(ns,this,Mc).call(this,r.serverMetadata(),a);try{const n=await Qr(s,e,{expectedState:null==t?void 0:t.expectedState});return Us.fromTokenEndpointResponse(n)}catch(e){const t=e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",n=new ss(t,e),o=a.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}async getTokenByRefreshToken(e,t){var n;const o=(await y(ns,this,jc).call(this,t)).configuration,r=new URLSearchParams;
11if(e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.fullResponse){var i;const t=js(null!==(i=o[Mr])&&void 0!==i?i:A(Ya,this)),n=await y(ns,this,Mc).call(this,o.serverMetadata(),t);try{const o=await $r(n,e.refreshToken,r),i=Us.fromTokenEndpointResponse(o),a=t.getCapturedResponse();if(!a)throw new Ss;return{data:i,response:a}}catch(e){if(e instanceof Ss)throw e;const n=new ls("The access token has expired and there was an error while trying to refresh it.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}const a=js(null!==(n=o[Mr])&&void 0!==n?n:A(Ya,this)),s=await y(ns,this,Mc).call(this,o.serverMetadata(),a);try{const t=await $r(s,e.refreshToken,r);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new ls("The access token has expired and there was an error while trying to refresh it.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async revokeToken(e,t){var n;const o=(await y(ns,this,jc).call(this,t)).configuration,r={};e.tokenTypeHint&&(r.token_type_hint=e.tokenTypeHint);const i=js(null!==(n=o[Mr])&&void 0!==n?n:A(Ya,this)),a=await y(ns,this,Mc).call(this,o.serverMetadata(),i);try{await async function(e,t,n){oi(e);const o=xr(e),r=o.as,i=o.c,a=o.auth,s=o.fetch,c=o.tlsOnly,l=o.timeout;return async function(e,t,n,o,r){dn(e),hn(t),on(o,'"token"');const i=yn(e,"revocation_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),a=new URLSearchParams(null==r?void 0:r.additionalParameters);a.set("token",o);const s=$t(null==r?void 0:r.headers);return s.delete("accept"),Pn(e,t,n,i,a,s,r)}(r,i,a,t,{[Wt]:s,[Dt]:!c,additionalParameters:new URLSearchParams(n),headers:new Headers(Rr),signal:ri(l)}).then(fo).catch(Kr)}(a,e.token,r)}catch(e){const t=new ps("An error occurred while trying to revoke the token.",rs(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async getUserInfo(e,t){const n=(await y(ns,this,jc).call(this,t,!0)).configuration;try{var o;return await ii(n,e.accessToken,null!==(o=e.expectedSubject)&&void 0!==o?o:Ur)}catch(e){throw new fs("There was an error while trying to retrieve the user info.",rs(e))}}async getTokenByPassword(e,t){var n;const o=(await y(ns,this,jc).call(this,t)).configuration,r=new URLSearchParams({username:e.username,password:e.password});e.audience&&r.append("audience",e.audience),e.scope&&r.append("scope",e.scope),e.realm&&r.append("realm",e.realm);let i=o;if(e.auth0ForwardedFor){const t=await y(ns,this,Xc).call(this);i=new Xr(o.serverMetadata(),A(Za,this).clientId,{client_secret:A(Za,this).clientSecret,use_mtls_endpoint_aliases:A(Za,this).useMtls},t);const n=o[Mr];i[Mr]=(t,o)=>n(t,O(O({},o),{},{headers:O(O({},o.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}if(e.fullResponse){var a;const e=js(null!==(a=i[Mr])&&void 0!==a?a:A(Ya,this)),n=await y(ns,this,Mc).call(this,i.serverMetadata(),e);try{const t=await ci(n,"password",r),o=Us.fromTokenEndpointResponse(t),i=e.getCapturedResponse();if(!i)throw new Ss;return{data:o,response:i}}catch(t){if(t instanceof Ss)throw t;const n=new us("There was an error while trying to request a token.",rs(t)),o=e.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}const s=js(null!==(n=i[Mr])&&void 0!==n?n:A(Ya,this)),c=await y(ns,this,Mc).call(this,i.serverMetadata(),s);try{const e=await ci(c,"password",r);return Us.fromTokenEndpointResponse(e)}catch(e){const t=new us("There was an error while trying to request a token.",rs(e)),n=s.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async getTokenByPasswordlessEmail(e,t){const n=new URLSearchParams({username:e.email,otp:e.code,realm:"email"});return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),y(ns,this,Fc).call(this,n,t,e.fullResponse)}async getTokenByPasswordlessSms(e,t){if(!oc(e.phoneNumber))throw new ec("Phone number must be in E.164 format (e.g. +14155550100).");const n=new URLSearchParams({username:e.phoneNumber,otp:e.code,realm:"sms"});
11return e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),y(ns,this,Fc).call(this,n,t,e.fullResponse)}async getTokenByClientCredentials(e,t){var n;const o=(await y(ns,this,jc).call(this,t)).configuration;if(e.fullResponse){var r;const t=js(null!==(r=o[Mr])&&void 0!==r?r:A(Ya,this)),n=await y(ns,this,Mc).call(this,o.serverMetadata(),t),i=new URLSearchParams({audience:e.audience});e.organization&&i.append("organization",e.organization);try{const e=await ei(n,i),o=Us.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new Ss;return{data:o,response:r}}catch(e){if(e instanceof Ss)throw e;const n=new cs("There was an error while trying to request a token.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}const i=js(null!==(n=o[Mr])&&void 0!==n?n:A(Ya,this)),a=await y(ns,this,Mc).call(this,o.serverMetadata(),i);try{const t=new URLSearchParams({audience:e.audience});e.organization&&t.append("organization",e.organization);const n=await ei(a,t);return Us.fromTokenEndpointResponse(n)}catch(e){const t=new cs("There was an error while trying to request a token.",rs(e)),n=i.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async buildLogoutUrl(e){const t=await y(ns,this,Bc).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){const t=new URL("https://".concat(A(Za,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",A(Za,this).clientId),e.federated&&t.searchParams.set("federated",""),t}const o={post_logout_redirect_uri:e.returnTo};return e.federated&&(o.federated=""),function(e,t){oi(e);const n=xr(e),o=n.as,r=n.c,i=yn(o,"end_session_endpoint",!1,n.tlsOnly);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const e of t.entries()){var a=R(e,2);const t=a[0],n=a[1];i.searchParams.append(t,n)}return i}(n,o)}async verifyLogoutToken(e){const t=(await y(ns,this,Bc).call(this)).serverMetadata,n=kc(A(Za,this).discoveryCache),o=t.jwks_uri;A(Qa,this)||E(Qa,this,function(e,t){if(!(e instanceof URL))throw new TypeError("url must be an instance of URL");const n=new URL(e.href).href,o=null!=t?t:{},r=o.timeoutDuration;if("number"==typeof r&&(!Number.isInteger(r)||r<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');const i="number"==typeof r?r:5e3,a=ta(o.cooldownDuration,3e4,"cooldownDuration"),s=ta(o.cacheMaxAge,6e5,"cacheMaxAge"),c=new Headers(o.headers);qi&&!c.has("User-Agent")&&c.set("User-Agent",qi),c.has("accept")||c.set("accept","application/json, application/jwk-set+json");const l=o[Qi],u=o[$i];let d,h,p,f=0,m=0;if(u&&"object"==typeof u){const e=u.uat,t=u.jwks;ea(e,s)&&qo(t)&&(d=e,p=Vi(t))}const g=async()=>{if(h&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(h=void 0),!h){const e=++f,t=h=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch;const r=await o(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Ho;throw e});if(200!==r.status)throw new Lo("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch(e){throw new Lo("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(n,c,AbortSignal.timeout(i),l).then(t=>{const n=Vi(t);if(e<=m)return;p=n;const o=Date.now();u&&(u.uat=o,u.jwks=t),d=o,m=e}).finally(()=>{h===t&&(h=void 0)})}await h};return Object.defineProperties(async(e,t)=>{p&&ea(d,s)||await g();try{return await p(e,t)}catch(n){if(n instanceof Go&&!ea(d,a))return await g(),p(e,t);throw n}},{coolingDown:{get:()=>ea(d,a),enumerable:!0},fresh:{get:()=>ea(d,s),enumerable:!0},reload:{value:g,enumerable:!0},reloading:{get:()=>!!h,enumerable:!0},jwks:{value:()=>{var e;return null===(e=p)||void 0===e?void 0:e.jwks()},enumerable:!0}})}(new URL(o),{cacheMaxAge:n.ttlMs,[Qi]:A(Ya,this),[$i]:A(ts,this)}));const r=(await async function(e,t,n){const o=await yi(e,function(e){return[e&&kr("algorithms",e.algorithms),null==e?void 0:e.crit]}(n),t);
11if(!o[2])throw new Bo("JWTs MUST NOT use unencoded payload");const r={payload:xi(o[1],o[0],n),protectedHeader:o[1]};return"function"==typeof t?O(O({},r),{},{key:o[3]}):r}(e.logoutToken,A(Qa,this),{issuer:t.issuer,audience:A(Za,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in r)&&!("sub"in r))throw new ms('either "sid" or "sub" (or both) claims must be present');if("sid"in r&&"string"!=typeof r.sid)throw new ms('"sid" claim must be a string');if("sub"in r&&"string"!=typeof r.sub)throw new ms('"sub" claim must be a string');if("nonce"in r)throw new ms('"nonce" claim is prohibited');if(!("events"in r))throw new ms('"events" claim is missing');if("object"!=typeof r.events||null===r.events)throw new ms('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in r.events))throw new ms('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof r.events["http://schemas.openid.net/event/backchannel-logout"])throw new ms('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:r.sid,sub:r.sub}}});function Uc(){const e=A(Za,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(A(Za,this).useMtls?"1":"0")}async function Mc(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const o=await y(ns,this,Xc).call(this,n),r=new Xr(e,A(Za,this).clientId,{client_secret:A(Za,this).clientSecret,use_mtls_endpoint_aliases:A(Za,this).useMtls},o);return r[Mr]=null!=t?t:A(Ya,this),r}function Dc(e){return Bs(A(Ya,this),e,A(qa,this))}async function jc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await y(ns,this,Bc).call(this,t),o=n.configuration,r=n.serverMetadata;if(!e)return{configuration:o,serverMetadata:r};const i=y(ns,this,Dc).call(this,e);return{configuration:await y(ns,this,Mc).call(this,r,i,t),serverMetadata:r}}async function Bc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=A(e?Ja:Xa,this);if(t&&A(za,this))return{configuration:t,serverMetadata:A(za,this)};const n=y(ns,this,Uc).call(this);e||await y(ns,this,Xc).call(this,!1);const o=A($a,this).get(n);if(o)return y(ns,this,Wc).call(this,o.serverMetadata,e);const r=A(es,this).get(n);if(r){const t=await r;return y(ns,this,Wc).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await Hr(new URL("https://".concat(A(Za,this).domain)),A(Za,this).clientId,{use_mtls_endpoint_aliases:A(Za,this).useMtls},(e,t,n,o)=>{n.set("client_id",t.client_id)},{[Mr]:A(Ya,this)})).serverMetadata();return A($a,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),A(es,this).set(n,i);try{const t=(await i).serverMetadata;return y(ns,this,Wc).call(this,t,e)}finally{A(es,this).delete(n)}}async function Wc(e,t){const n=await y(ns,this,Mc).call(this,e,void 0,t);return E(za,this,e),E(t?Ja:Xa,this,n),{configuration:n,serverMetadata:e}}async function Gc(e,t,n){var o,r,i;const a=(await y(ns,this,jc).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new hs("audience and resource parameters are not supported for Token Vault exchanges");Cc(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(o=e.subjectTokenType)&&void 0!==o?o:Nc,requested_token_type:null!==(r=e.requestedTokenType)&&void 0!==r?r:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&s.append("login_hint",e.loginHint),e.scope&&s.append("scope",e.scope),Rc(s,e.extra),n){var c;const t=js(null!==(c=a[Mr])&&void 0!==c?c:A(Ya,this)),o=await y(ns,this,Mc).call(this,a.serverMetadata(),t);try{const e=await ci(o,Ic,s),n=Us.fromTokenEndpointResponse(e),r=t.getCapturedResponse();if(!r)throw new Ss;return{data:n,response:r}}catch(n){if(n instanceof Ss)throw n;const o=new hs("Failed to exchange token for connection '".concat(e.connection,"'."),rs(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?Es(r.headers):void 0,o}}const l=js(null!==(i=a[Mr])&&void 0!==i?i:A(Ya,this)),u=await y(ns,this,Mc).call(this,a.serverMetadata(),l);try{const e=await ci(u,Ic,s);return Us.fromTokenEndpointResponse(e)}catch(t){const n=new hs("Failed to exchange token for connection '".concat(e.connection,"'."),rs(t)),o=l.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}function Kc(e,t,n){var o;if(n.organization&&Os(e.claims,n.organization),n.actorToken)if(null!==(o=e.claims)&&void 0!==o&&o.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new Bo("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],o=t.length;if(5===o)throw new Bo("Only JWTs using Compact JWS serialization can be decoded");
11if(3!==o)throw new Bo("Invalid JWT");if(!n)throw new Bo("JWTs must contain a payload");let r,i;try{r=Vo(n)}catch(e){throw new Bo("Failed to base64url decode the payload")}try{i=JSON.parse(Co.decode(r))}catch(e){throw new Bo("Failed to parse the decoded payload as JSON")}if(!Yo(i))throw new Bo("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function Hc(e,t,n){var o;const r=(await y(ns,this,jc).call(this,t)).configuration;if(Cc(e.subjectToken),void 0!==e.organization&&Ts(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new hs("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),Rc(i,e.extra),n){var a;const t=js(null!==(a=r[Mr])&&void 0!==a?a:A(Ya,this)),o=await y(ns,this,Mc).call(this,r.serverMetadata(),t);let s,c,l;try{if(c=await ci(o,xc,i),s=Us.fromTokenEndpointResponse(c),l=t.getCapturedResponse(),!l)throw new Ss}catch(n){if(n instanceof Ss)throw n;const o=new hs("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),rs(n)),r=t.getCapturedResponse();throw o.statusCode=null==r?void 0:r.status,o.headers=r?Es(r.headers):void 0,o}return y(ns,this,Kc).call(this,s,c,e),{data:s,response:l}}const s=js(null!==(o=r[Mr])&&void 0!==o?o:A(Ya,this)),c=await y(ns,this,Mc).call(this,r.serverMetadata(),s);let l,u;try{u=await ci(c,xc,i),l=Us.fromTokenEndpointResponse(u)}catch(t){const n=new hs("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),rs(t)),o=s.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}return y(ns,this,Kc).call(this,l,u,e),l}async function Fc(e,t,n){var o;const r=(await y(ns,this,jc).call(this,t)).configuration;if(n){var i;const t=js(null!==(i=r[Mr])&&void 0!==i?i:A(Ya,this)),n=await y(ns,this,Mc).call(this,r.serverMetadata(),t);try{const o=await ci(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),r=Us.fromTokenEndpointResponse(o),i=t.getCapturedResponse();if(!i)throw new Ss;return{data:r,response:i}}catch(e){if(e instanceof Ss)throw e;const n=new ec("There was an error while trying to request a token.",rs(e)),o=t.getCapturedResponse();throw n.statusCode=null==o?void 0:o.status,n.headers=o?Es(o.headers):void 0,n}}const a=js(null!==(o=r[Mr])&&void 0!==o?o:A(Ya,this)),s=await y(ns,this,Mc).call(this,r.serverMetadata(),a);try{const t=await ci(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return Us.fromTokenEndpointResponse(t)}catch(e){const t=new ec("There was an error while trying to request a token.",rs(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Es(n.headers):void 0,t}}async function Xc(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!A(Za,this).clientSecret||!!A(Za,this).clientAssertionSigningKey||!!A(Za,this).useMtls;return e&&!t?(e,t,n,o)=>{n.set("client_id",t.client_id)}:(A(Va,this)||E(Va,this,(async()=>{if(!A(Za,this).clientSecret&&!A(Za,this).clientAssertionSigningKey&&!A(Za,this).useMtls)throw new bs;if(A(Za,this).useMtls)return(e,t,n,o)=>{n.set("client_id",t.client_id)};let e=A(Za,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await na(e,A(Za,this).clientAssertionSigningAlg||"RS256")),e?function(e){return fn(e,void 0)}(e):Pr(A(Za,this).clientSecret)})().catch(e=>{throw E(Va,this,void 0),e})),A(Va,this))}async function Jc(e){const t=(await y(ns,this,Bc).call(this)).configuration,n=an(),o=await function(e){return async function(e){return on(e,"codeVerifier"),Vt(await crypto.subtle.digest("SHA-256",Xt(e)))}(e)}(n),r=_s(O(O({},A(Za,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(O(O({scope:Tc},r),{}
11,{client_id:A(Za,this).clientId,code_challenge:o,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await ni(t,i):await ti(t,i),codeVerifier:n}}var zc,Vc;new Sc(1e3,6e4);class Zc extends W{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Zc.prototype)}static fromPayload(e){let t=e.error,n=e.error_description;return new Zc(t,n)}}class Yc extends Zc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Yc.prototype)}}class qc extends Zc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,qc.prototype)}}class Qc extends Zc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Qc.prototype)}}class $c extends Zc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,$c.prototype)}}class el extends Zc{constructor(e,t){super(e,t),Object.setPrototypeOf(this,el.prototype)}}class tl{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=R(n,2);const o=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(o)}}get size(){return this.contexts.size}}class nl{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new tl}setMFAAuthDetails(e,t,n,o){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:o})}async getAuthenticators(e){var t,n,o;const r=this.contextManager.get(e);if(!r)throw new Yc("invalid_request","MFA context not found for this MFA token");const i=null===(n=null===(t=r.mfaRequirements)||void 0===t?void 0:t.challenge)||void 0===n?void 0:n.map(e=>e.type);try{const t=await this.authJsMfaClient.listAuthenticators({mfaToken:e});return i&&0!==i.length?t.filter(e=>!!e.type&&i.includes(e.type)):t}catch(e){if(e instanceof Rs)throw new Yc(null===(o=e.cause)||void 0===o?void 0:o.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=Rt[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 Is)throw new qc(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 Ns)throw new Qc(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 el("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 $c("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-rec
11overy-code":void 0}(e);if(!n)throw new $c("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const o=t.scope,r=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:o,audience:r,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof $c)throw new $c(e.error,e.error_description);throw e}}}class ol extends Error{constructor(e,t,n){super(t),this.name="PasskeyError",this.code=e,this.cause=n,Object.setPrototypeOf(this,ol.prototype)}}class rl{constructor(e,t){zc.set(this,void 0),Vc.set(this,void 0),m(this,zc,e,"f"),m(this,Vc,t,"f")}async signup(e){if(!window.PublicKeyCredential)throw new ol("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.scope,n=e.audience,o=p(e,["scope","audience"]),r=await f(this,zc,"f").register(o),i=sl(r.authnParamsPublicKey),a=await navigator.credentials.create({publicKey:i});if(!a)throw new ol("passkey_cancelled","Passkey creation was cancelled or no credential was returned.");const s=ll(a);return f(this,Vc,"f")._requestTokenForPasskey({authSession:r.authSession,credential:s,realm:o.realm,organization:o.organization,scope:t,audience:n})}async login(e){if(!window.PublicKeyCredential)throw new ol("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e||{},n=t.scope,o=t.audience,r=p(t,["scope","audience"]),i=await f(this,zc,"f").challenge(Object.keys(r).length>0?r:void 0),a=cl(i.authnParamsPublicKey),s=await navigator.credentials.get({publicKey:a});if(!s)throw new ol("passkey_cancelled","Passkey authentication was cancelled or no credential was returned.");const c=ul(s);return f(this,Vc,"f")._requestTokenForPasskey({authSession:i.authSession,credential:c,realm:r.realm,organization:r.organization,scope:n,audience:o})}async getSignupChallenge(e){if(!window.PublicKeyCredential)throw new ol("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await f(this,zc,"f").register(e);return{authSession:t.authSession,publicKey:sl(t.authnParamsPublicKey)}}async getLoginChallenge(e){if(!window.PublicKeyCredential)throw new ol("passkey_not_supported","WebAuthn is not supported in this browser.");const t=await f(this,zc,"f").challenge(e);return{authSession:t.authSession,publicKey:cl(t.authnParamsPublicKey)}}async getTokenWithPasskey(e){if(!window.PublicKeyCredential)throw new ol("passkey_not_supported","WebAuthn is not supported in this browser.");const t=e.authSession,n=e.credential,o=e.realm,r=e.organization,i=e.scope,a=e.audience,s=n.response;let c;if(s instanceof AuthenticatorAttestationResponse)c=ll(n);else{if(!(s instanceof AuthenticatorAssertionResponse))throw new ol("passkey_invalid_credential","The provided credential is not a valid attestation or assertion response.");c=ul(n)}return f(this,Vc,"f")._requestTokenForPasskey({authSession:t,credential:c,realm:o,organization:r,scope:i,audience:a})}}function il(e){const t=new Uint8Array(e),n=Array.from(t,e=>String.fromCharCode(e)).join("");return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function al(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),o=atob(n),r=new Uint8Array(o.length);for(let e=0;e<o.length;e++)r[e]=o.charCodeAt(e);return r.buffer}function sl(e){return Object.assign(Object.assign({},e),{challenge:al(e.challenge),user:Object.assign(Object.assign({},e.user),{id:al(e.user.id)}),pubKeyCredParams:e.pubKeyCredParams,authenticatorSelection:e.authenticatorSelection})}function cl(e){return Object.assign(Object.assign({},e),{challenge:al(e.challenge)})}function ll(e){var t;const n=e.response;return{id:e.id,rawId:il(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:il(n.clientDataJSON),attestationObject:il(n.attestationObject)},clientExtensionResults:e.getClientExtensionResults()}}function ul(e){var t;const n=e.response;return{id:e.id,rawId:il(e.rawId),type:e.type,authenticatorAttachment:null!==(t=e.authenticatorAttachment)&&void 0!==t?t:void 0,response:{clientDataJSON:il(n.clientDataJSON),authenticatorData:il(n.authenticatorData),signature:il(n.signature),userHandle:n.userHandle?il(n.userHandle):void 0},clientExtensionResults:e.getClientExtensionResults()}}function dl(e){return{get(){try{const t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return null}},set(t){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}},remove(){try{window.localStorage.removeItem(e)}catch(e){}}}}function hl(){let e=null;return{get:()=>e,set:t=>{e=t},remove:()=>{e=null}}}zc=new WeakMap,Vc=new WeakMap;class pl{constructor(e,t){this.slots=new Map,this.baseKey="".concat("@@auth0spajs@@","::").concat(e,"::anonymous"),this.useLocalStorage="localStorage"===t&&"undefined"!=typeof window&&!!window.localStorage,this.sessionKey="".concat(this.baseKey,"::").concat("session"),this.sessionStore=this.useLocalStorage?dl(this.sessionKey):hl()}getStore(e,t){const n="".concat(this.baseKey,"::").concat(JSON.stringify([null!=e?e:"",null!=t?t:""]));return this.slots.has(n)||this.slots.set(n,this.useLocalStorage?dl(n):hl()),this.slots.get(n)}getSessionToken(){return this.sessionStore.get()}setSessionToken(e){this.sessionStore.set(e)}
11removeAll(){if(this.sessionStore.remove(),this.slots.forEach(e=>e.remove()),this.slots.clear(),this.useLocalStorage)try{const e=this.baseKey+"::",t=[];for(let n=0;n<window.localStorage.length;n++){const o=window.localStorage.key(n);(null==o?void 0:o.startsWith(e))&&t.push(o)}t.forEach(e=>window.localStorage.removeItem(e))}catch(e){}}}class fl{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"localStorage",o=arguments.length>3?arguments[3]:void 0;this.authJsClient=e,this.clientId=t,this.cache=new pl(t,n),this.lockManager=null!=o?o:Te()}async createSession(e){const t=await this.authJsClient.createSession(e);return this.cache.setSessionToken(Object.assign({sessionToken:t.sessionToken},void 0!==t.sessionTokenExpiresAt&&{sessionTokenExpiresAt:t.sessionTokenExpiresAt})),this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:t.accessToken,expiresAt:t.expiresAt},void 0!==t.scope&&{scope:t.scope})),t}async getTokenSilently(e){const t=this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope),n=t.get();return n&&n.expiresAt-60>Date.now()/1e3?n:this.lockManager.runWithLock("anonymous::".concat(this.clientId),5e3,async()=>{var n;const o=t.get();if(o&&o.expiresAt-60>Date.now()/1e3)return o;const r=null===(n=this.cache.getSessionToken())||void 0===n?void 0:n.sessionToken,i=await this.authJsClient.getAccessToken(Object.assign(Object.assign({},e),{sessionToken:r}));return this.cache.getStore(null==e?void 0:e.audience,null==e?void 0:e.scope).set(Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})),!i.sessionReplaced&&this.cache.getSessionToken()||this.cache.setSessionToken(Object.assign({sessionToken:i.sessionToken},void 0!==i.sessionTokenExpiresAt&&{sessionTokenExpiresAt:i.sessionTokenExpiresAt})),Object.assign({accessToken:i.accessToken,expiresAt:i.expiresAt},void 0!==i.scope&&{scope:i.scope})})}async logout(){await this.authJsClient.logout(),this.cache.removeAll()}hasSession(){var e;return!!(null===(e=this.cache.getSessionToken())||void 0===e?void 0:e.sessionToken)}getClaims(){return null}}class ml{resolveOnlineAccess(e){if("online"!==e.refreshTokenMode)return!1;if(!0!==e.useRefreshTokens)throw new G('`refreshTokenMode: "online"` requires the refresh-token grant.',"Set `useRefreshTokens: true`.");if(!0!==e.useDpop)throw new G('`refreshTokenMode: "online"` requires DPoP, which is missing or disabled.',"Set `useDpop: true` (DPoP is mandatory for online access).");return!0}warnEnterpriseConnectConfig(e){var t,n;if(!0!==e.enterpriseConnect)return;const o=null===(t=e.authorizationParams)||void 0===t?void 0:t.scope;(!0===e.useRefreshTokens||"string"==typeof o&&o.includes("offline_access"))&&console.warn("Enterprise Connect issues no refresh token; `useRefreshTokens` and `offline_access` in `scope` have no effect."),(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)&&console.warn("Enterprise Connect resolves the organization from the email domain (Home Realm Discovery); a static `organization` breaks multi-customer setups.")}constructor(e){let t,n;if(this.userCache=(new $e).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0,refreshTokenMode:"offline",anonymousSessionsCacheMode:"localStorage"},this.onlineAccess=this.resolveOnlineAccess(e),this.warnEnterpriseConnectConfig(e),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(!ee())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===ee().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=Te(),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||P,!bt(t))throw new Error('Invalid cac
11he location "'.concat(t,'"'));n=bt(t)()}var o;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:L,this.cookieStorage=!1===e.legacySameSiteCookie?ut:ht,this.orgHintCookieName=(o=this.options.clientId,"auth0.".concat(o,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:pt;let i="";var a;this.onlineAccess?i=M:this.options.useRefreshTokens&&(i="offline_access"),this.scope=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if("object"!=typeof e)return{[B]:ze(t,e,...o)};let i={[B]:ze(t,...o)};return Object.keys(e).forEach(n=>{const r=e[n];i[n]=ze(t,r,...o)}),i}(this.options.authorizationParams.scope,"openid",i),this.transactionManager=new tt(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||j,this.cacheManager=new et(n,n.allKeys?void 0:new wt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new kt(this.options.clientId):void 0,this.domainUrl=(a=this.options.domain,/^https?:\/\//.test(a)?a:"https://".concat(a)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const s="".concat(this.domainUrl,"/me/"),c=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{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:s},detailedResponse:!0})}}));this.myAccount=new Ot(c,s),this.authJsClient=new Pc({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new nl(this.authJsClient.mfa,this),this.anonymous=new fl(this.authJsClient.anonymous,this.options.clientId,this.options.anonymousSessionsCacheMode,this.lockManager),this.passkey=new rl(this.authJsClient.passkey,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===P&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new gt,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||D,n=re(t,!0),o=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(o)}_authorizeUrl(e){return this._url("/authorize?".concat(ie(e)))}async _verifyIdToken(e,t,n){const o=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),n=R(t,3),o=n[0],r=n[1],i=n[2];if(3!==t.length||!o||!r||!i)throw new Error("ID token could not be decoded");const a=JSON.parse(se(r)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],ot.includes(e)||(c[e]=a[e])}),{encoded:{header:o,payload:r,signature:i},header:JSON.parse(se(o)),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");
11if(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&&!nt(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||!nt(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!nt(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,o=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),o>r)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(o,") is after expiration time (").concat(r,")"));if(null!=t.claims.nbf&&nt(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),o<e)throw new Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(o,") is before ").concat(e))}if(null!=t.claims.auth_time&&nt(t.claims.auth_time)){const r=new Date(0);if(r.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),o>r)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(o,") is after last auth at ").concat(r))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.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:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:o});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_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 o;const r=ne(te()),i=ne(te()),a=te(),s=await ae(a),c=ce(s),l=await(null===(o=this.dpop)||void 0===o?void 0:o.calculateThumbprint()),u=((e,t,n,o,r,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:Ve(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:o,nonce:r,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,r,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,l),d=this._authorizeUrl(u);return{nonce:i,code_verifier:a,scope:u.scope,audience:u.audience||B,redirect_uri:u.redirect_uri,state:r,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 z;const o=this._applySessionTransferToken(e.authorizationParams||{}),r=await this._prepareAuthorizeUrl(o,{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const i=await((e,t)=>new Promise((n,o)=>{let r;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",r,!1),o(new J(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),o(new X(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return o(W.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(r.url).origin);if(r.state!==i.state)throw new W("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:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;if(await this._isSessionCeilingReached())return;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;if(await this._isSessionCeilingReached())return;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=At(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
11),n=t.openUrl,o=t.fragment,r=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),l=c.url,u=p(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:r,response_type:ft.Code}),a&&{organization:a}));const d=o?"".concat(l,"#").concat(o):l;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 W("missing_transaction","Invalid state");this.transactionManager.remove();const n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===ft.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const n=e.code,o=e.state,r=e.error,i=e.error_description;if(r)throw new K(r,i||r,o,t.appState);if(!t.code_verifier||t.state&&t.state!==o)throw new W("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:ft.Code}}async _handleConnectAccountRedirectCallback(e,t){const n=e.connect_code,o=e.state,r=e.error,i=e.error_description;if(r)throw new H(r,i||r,t.connection,o,t.appState);if(!n)throw new W("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===o))throw new W("state_mismatch","Invalid state");const a=await this.myAccount.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:ft.ConnectCode})}async _maybeCreateAnonymousSession(){if(this.options.createAnonymousSessionOnFailedSilentAuth){if(this.anonymous.hasSession())return;try{await this.anonymous.getTokenSilently()}catch(e){console.debug("[auth0-spa-js] Anonymous session creation failed",e)}}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(yt))return void await this._maybeCreateAnonymousSession();this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(yt)}try{await this.getTokenSilently(e)}catch(e){e instanceof W&&"login_required"===e.error&&e.error_description!==U&&await this._maybeCreateAnonymousSession()}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const o=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ve(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)})}),r=await this._getTokenSilently(o);return e.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const t=e.cacheMode,n=p(e,["cacheMode"]);if(await this._isSessionCeilingReached())return;if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||B,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const o=(r=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(r,".").concat(i));var r,i;try{return await this.lockManager.runWithLock(o,5e3,async()=>
11{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||B,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),o=e.id_token,r=e.token_type,i=e.access_token,a=e.oauthTokenScope,s=e.expires_in;return Object.assign(Object.assign({id_token:o,token_type:r,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 V||e instanceof W&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&e.error_description===U}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||B,clientId:this.options.clientId});if(!t)throw new W("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,o;const r=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ve(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(o=e.authorizationParams)||void 0===o?void 0:o.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},N),t),await this.loginWithPopup(r,t),(await this.cacheManager.get(new qe({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||B,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},n=t.federated,o=p(t,["federated"]),r=n?"&federated":"";return this._url("/v2/logout?".concat(ie(Object.assign({clientId:e.clientId},o))))+r}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||B,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.auth0Client,o=e.useFormData,r=e.refreshTokens,i=e.audience,a=e.client_id,s=e.onRefreshTokenRevoked;const c=e.timeout||L,l="refresh_token",u="".concat(e.baseUrl,"/oauth/revoke"),d={"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(re(n||D)))};if(t){const n={client_id:a,token_type_hint:l},r=o?ie(n):JSON.stringify(n);try{return await Ke({type:"revoke",timeout:c,fetchUrl:u,fetchOptions:{method:"POST",body:r,headers:d},useFormData:o,auth:{audience:null!=i?i:B}},t)}catch(e){throw new W("revoke_error",e.message)}}for(const t of r){const n={client_id:a,token_type_hint:l,token:t},r=o?ie(n):JSON.stringify(n),i=await He(u,{method:"POST",body:r,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 W(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),this.onlineAccess&&await this._clearLocalSession()}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;this.options.enterpriseConnect&&!0!==(null===(t=e.logoutParams)||void 0===t?void 0:t.federated)&&console.warn("Enterprise Connect logout without `federated: true` leaves the enterprise IdP session alive; the next login may silently reuse the previous user.");const n=At(e),o=n.openUrl,r=p(n,["openUrl"]);await this._clearLocalSession(e.clientId);const i=this._buildLogoutUrl(r);o?await o(i):!1!==o&&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 o=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"}
11,window.location.origin),r=o.url,i=o.state,a=o.nonce,s=o.code_verifier,c=o.redirect_uri,l=o.scope,u=o.audience;if(window.crossOriginIsolated)throw new W("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const 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((o,r)=>{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(()=>{r(new F),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(W.fromPayload(e.data.response)):o(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,h,d);if(i!==p.state)throw new W("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:l,oauthTokenScope:f.scope,audience:u})})}catch(e){throw"login_required"===e.error&&(e instanceof W&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new qe({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||B,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new Z(e.authorizationParams.audience||B,e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,r=((e,t,n,o)=>{var r;if(e&&n&&o){if(t.audience!==n)return t.scope;const e=o.split(" "),i=(null===(r=t.scope)||void 0===r?void 0:r.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?o:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==t?void 0:t.audience,null==t?void 0:t.scope);try{const l=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),o&&{timeout:o}),{scopesToRequest:r});if(await this._propagateRotatedRefreshToken(null==t?void 0:t.refresh_token,l.refresh_token),this.options.useMrrt&&(i=null==t?void 0:t.audience,a=null==t?void 0:t.scope,s=e.authorizationParams.audience,c=e.authorizationParams.scope,i!==s||!((e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))})(c,a))){const t=((e,t,n)=>{const o=(null==e?void 0:e.split(" "))||[],r=n?o.filter(e=>e!==M):o,i=(null==t?void 0:t.split(" "))||[];return r.filter(e=>-1==i.indexOf(e)).join(",")})(r,l.scope,this.onlineAccess);if(t){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope),new Y(e.authorizationParams.audience||"default",t)}}return Object.assign(Object.assign({},l),{scope:e.authorizationParams.scope,oauthTokenScope:l.scope,audience:e.authorizationParams.audience||B})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw t}var i,a,s,c}async _propagateRotatedRefreshToken(e,t){!this.onlineAccess&&t&&e&&await this.cacheManager.updateEntry(e,t,this.options.clientId,this.options.useMrrt)}async _saveEntryInCache(e){const t=e.decodedToken.claims,n=t.session_expiry,o=t.iat;
11if(void 0!==n){if("number"!=typeof n)throw new W("invalid_token","Invalid session_expiry: value must be a number.");if(n>=1e10)throw new W("invalid_token","Invalid session_expiry: value appears to be in milliseconds; expected a Unix timestamp in seconds.");if(void 0===o||n<=o)throw new W("invalid_token","Invalid session_expiry: session ceiling is before or at the token issue time.")}const r=e.id_token,i=e.decodedToken,a=p(e,["id_token","decodedToken"]);this.userCache.set(Ye,{id_token:r,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(a)}async _clearLocalSession(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.clientId;var t;null===e?await this.cacheManager.clear():await this.cacheManager.clear(e),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(Ye);try{await(null===(t=this.dpop)||void 0===t?void 0:t.clear())}catch(e){}if(this.worker)try{await Ke({type:"clear"},this.worker)}catch(e){}}async _isSessionCeilingReached(){var e,t;const n=this.userCache.get(Ye),o=null!=n?n:await this.cacheManager.getIdToken(new qe({clientId:this.options.clientId})),r=null===(t=null===(e=null==o?void 0:o.decodedToken)||void 0===e?void 0:e.claims)||void 0===t?void 0:t.session_expiry;if(void 0===r)return!1;const i=await this.nowProvider();return Math.floor(i/1e3)>=r-30&&(await this._clearLocalSession(),!0)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||B,t=this.scope[e],n=await this.cacheManager.getIdToken(new qe({clientId:this.options.clientId,audience:e,scope:t})),o=this.userCache.get(Ye);return n&&n.id_token===(null==o?void 0:o.id_token)?o:(this.userCache.set(Ye,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,o=e.clientId,r=e.cacheMode;const i=await this.cacheManager.get(new qe({scope:t,audience:n,clientId:o}),60,this.options.useMrrt,r);if(i&&i.access_token){const e=i.token_type,t=i.access_token,n=i.oauthTokenScope,o=i.expires_in,r=await this._getIdTokenFromCache();return r&&Object.assign(Object.assign({id_token:r.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:o})}}_storeMfaContext(e,t,n){e instanceof V&&this.mfa.setMFAAuthDetails(e.mfa_token,t,n,e.mfa_requirements)}async _requestToken(e,t){var n,o,r,i,a,s;const c=t||{},l=c.nonceIn,u=c.organization,d=c.scopesToRequest;try{const t=await Je(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,preserveRefreshToken:this.onlineAccess},e),{scope:d||e.scope}),this.worker);let c=await this._verifyIdToken(t.id_token,l,u);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(o=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===o?void 0:o.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ye))}if("authorization_code"!==e.grant_type){const e=await this._getIdTokenFromCache(),t=null===(i=null===(r=null==e?void 0:e.decodedToken)||void 0===r?void 0:r.claims)||void 0===i?void 0:i.session_expiry;void 0!==t&&(c=Object.assign(Object.assign({},c),{claims:Object.assign(Object.assign({},c.claims),{session_expiry:t})}))}return!t.refresh_token&&this.onlineAccess&&(t.refresh_token=null!==(a=e.refresh_token)&&void 0!==a?a:null===(s=await this.cacheManager.get(new qe({scope:d||e.scope,audience:e.audience||B,clientId:this.options.clientId}),void 0,this.options.useMrrt))||void 0===s?void 0:s.refresh_token),await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},t),{decodedToken:c,scope:e.scope,audience:e.audience||B}),t.scope?{oauthTokenScope:t.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(u||c.claims.org_id),Object.assign(Object.assign({},t),{decodedToken:c})}catch(t){throw"authorization_code"!==e.grant_type&&this._storeMfaContext(t,d||e.scope,e.audie
11nce),t}}_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:Ve(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=this._buildTokenExchangeParams(e);try{const n=await Je(Object.assign(Object.assign({},t),{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 n.id_token&&await this._verifyIdToken(n.id_token,void 0,e.organization),n}catch(e){throw this._storeMfaContext(e,t.scope,t.audience),e}}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 Tt(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,o=e.connection,r=e.scopes,i=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!o)throw new Error("connection is required");const c=ne(te()),l=te(),u=await ae(l),d=ce(u),h=await this.myAccount.connectAccount({connection:o,scopes:r,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:l,auth_session:m,redirect_uri:s,appState:n,connection:o,response_type:ft.ConnectCode});const g=new URL(p);g.searchParams.set("ticket",f.ticket),t?await t(g.toString()):window.location.assign(g)}async _requestTokenForPasskey(e){const t=e.audience||this.options.authorizationParams.audience,n=e.organization||this.options.authorizationParams.organization;return this._requestToken(Object.assign(Object.assign(Object.assign({grant_type:"urn:okta:params:oauth:grant-type:webauthn",auth_session:e.authSession,authn_response:e.credential},e.realm&&{realm:e.realm}),n&&{organization:n}),{scope:Ve(this.scope,e.scope,t),audience:t}))}async _requestTokenForMfa(e,t){const n=e.mfaToken,o=p(e,["mfaToken"]),r=await this.cacheManager.get(new qe({scope:o.scope,audience:o.audience||B,clientId:this.options.clientId}),void 0,this.options.useMrrt),i=await this._requestToken(Object.assign(Object.assign({},o),{mfa_token:n}),t);return await this._propagateRotatedRefreshToken(null==r?void 0:r.refresh_token,i.refresh_token),i}}function gl(e,t){return function(){return e.apply(t,arguments)}}const{toString:wl}=Object.prototype,{getPrototypeOf:yl}=Object,{iterator:vl,toStringTag:bl}=Symbol,Al=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Sl=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),El=(e,t,n)=>e===Object.prototype||!n&&null===t,kl=(e,t)=>{let n=e;const o=[];for(;null!=n;){if(-1!==o.indexOf(n))return!1;o.push(n);const r=yl(n);if(El(n,r,n===e))return!1;if(Al(n,t))return!0;n=r}return!1},_l=(Tl=Object.create(null),e=>{const t=wl.call(e);return Tl[t]||(Tl[t]=t.slice(8,-1).toLowerCase())});var Tl;const Ol=e=>(e=e.toLowerCase(),t=>_l(t)===e),Cl=e=>t=>typeof t===e,{isArray:Rl}=Array,Il=Cl("undefined");function xl(e){return null!==e&&!Il(e)&&null!==e.constructor&&!Il(e.constructor)&&Pl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Nl=Ol("ArrayBuffer");const Ll=Cl("string"),Pl=Cl("function"),Ul=Cl("number"),Ml=e=>null!==e&&"object"==typeof e,Dl=e=>{if(!Ml(e))return!1;const t=yl(e);return!(null!==t&&t!==Object.prototype&&null!==yl(t)||kl(e,bl)||kl(e,vl))},jl=Ol("Date"),Bl=Ol("File"),Wl=Ol("Blob"),Gl=Ol("FileList"),Kl=Ol("Set");const Hl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Fl=void 0!==Hl.FormData?Hl.FormData:void 0,Xl=Ol("URLSearchParams"),[Jl,zl,Vl,Zl]=["ReadableStream","Request","Response","Headers"].map(Ol);function Yl(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let o,r;if("object"!=typeof e&&(e=[e]),Rl(e))for(o=0,r=e.length;o<r;o++)t.call(null,e[o],o,e);else{if(xl(e))return;const r=n?Object.getOwnPropertyNames(e):Object.keys(e),i=r.length;let a;for(o=0;o<i;o++)a=r[o],t.call(null,e[a],a,e)}}function ql(e,t){if(xl(e))return null;t=t.toLowerCase();const n=Object.keys(e);let o,r=n.length;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const Ql="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,$l=e=>!Il(e)&&e!==Ql;const eu=(tu="undefined"!=typeof Uint8Array&&yl(Uint8Array),e=>tu&&e instanceof tu);var tu;
vendor: 4,227 bytes, line 11
11const nu=Ol("HTMLFormElement"),{propertyIsEnumerable:ou}=Object.prototype,ru=Ol("RegExp"),iu=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};Yl(n,(n,r)=>{let i;!1!==(i=t(n,r,e))&&(o[r]=i||n)}),Object.defineProperties(e,o)};const au=Ol("AsyncFunction"),su=(cu="function"==typeof setImmediate,lu=Pl(Ql.postMessage),cu?setImmediate:lu?(uu=`axios@${Math.random()}`,du=[],Ql.addEventListener("message",({source:e,data:t})=>{e===Ql&&t===uu&&du.length&&du.shift()()},!1),e=>{du.push(e),Ql.postMessage(uu,"*")}):e=>setTimeout(e));var cu,lu,uu,du;const hu="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ql):"undefined"!=typeof process&&process.nextTick||su,pu=e=>null!=e&&Pl(e[vl]),fu={isArray:Rl,isArrayBuffer:Nl,isBuffer:xl,isFormData:e=>{if(!e)return!1;if(Fl&&e instanceof Fl)return!0;const t=yl(e);if(!t||t===Object.prototype)return!1;if(!Pl(e.append))return!1;const n=_l(e);return"formdata"===n||"object"===n&&Pl(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Nl(e.buffer),t},isString:Ll,isNumber:Ul,isBoolean:e=>!0===e||!1===e,isObject:Ml,isPlainObject:Dl,isEmptyObject:e=>{if(!Ml(e)||xl(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Jl,isRequest:zl,isResponse:Vl,isHeaders:Zl,isUndefined:Il,isDate:jl,isFile:Bl,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Wl,isRegExp:ru,isFunction:Pl,isStream:e=>Ml(e)&&Pl(e.pipe),isURLSearchParams:Xl,isTypedArray:eu,isFileList:Gl,forEach:Yl,merge:function e(...t){const{caseless:n,skipUndefined:o}=$l(this)&&this||{},r={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&"string"==typeof i&&ql(r,i)||i,s=Al(r,a)?r[a]:void 0;Dl(s)&&Dl(t)?r[a]=e(s,t):Dl(t)?r[a]=e({},t):Rl(t)?r[a]=t.slice():o&&Il(t)||(r[a]=t)};for(let e=0,n=t.length;e<n;e++){const n=t[e];if(!n||xl(n))continue;if(Yl(n,i),"object"!=typeof n||Rl(n))continue;const o=Object.getOwnPropertySymbols(n);for(let e=0;e<o.length;e++){const t=o[e];ou.call(n,t)&&i(n[t],t)}}return r},extend:(e,t,n,{allOwnKeys:o}={})=>(Yl(t,(t,o)=>{n&&Pl(t)?Object.defineProperty(e,o,{__proto__:null,value:gl(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:o}),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,o)=>{e.prototype=Object.create(t.prototype,o),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,o)=>{let r,i,a;const s={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)a=r[i],o&&!o(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&yl(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:_l,kindOfTest:Ol,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const o=e.indexOf(t,n);return-1!==o&&o===n},toArray:e=>{if(!e)return null;if(Rl(e))return e;let t=e.length;if(!Ul(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[vl]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const o=[];for(;null!==(n=e.exec(t));)o.push(n);return o},isHTMLForm:nu,hasOwnProperty:Al,hasOwnProp:Al,hasOwnInPrototypeChain:kl,getSafeProp:(e,t)=>null!=e&&kl(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=yl(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(t=>{if(Sl(t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&n.configurable&&!0===n.writable})})(e))return e;const n=Object.create(null),o=Object.create(null),r=[];let i=e;for(;null!=i&&-1===r.indexOf(i);
vendor: 15,247 bytes, line 11
11){r.push(i);const a=i===e?t:yl(i);if(El(i,a,i===e))break;const s=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&s.push(...Object.getOwnPropertySymbols(i));for(const t of s)Sl(t)||Al(o,t)||(n[t]=e[t],o[t]=!0);i=a}return n},reduceDescriptors:iu,freezeMethods:e=>{iu(e,(t,n)=>{if(Pl(e)&&["arguments","caller","callee"].includes(n))return!1;const o=e[n];Pl(o)&&(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={},o=e=>{e.forEach(e=>{n[e]=!0})};return Rl(e)?o(e):o(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:ql,global:Ql,isContextDefined:$l,isSpecCompliantForm:function(e){return!!(e&&Pl(e.append)&&"FormData"===e[bl]&&e[vl])},toJSONObject:e=>{const t=new WeakSet,n=e=>{if(Ml(e)){if(t.has(e))return;if(xl(e))return e;if(!("toJSON"in e)){let o;if(t.add(e),Kl(e)){o=[];for(const t of e){const e=n(t);!Il(e)&&o.push(e)}}else o=Rl(e)?[]:{},Yl(e,(e,t)=>{const r=n(e);!Il(r)&&(o[t]=r)});return t.delete(e),o}}return e};return n(e)},isAsyncFn:au,isThenable:e=>e&&(Ml(e)||Pl(e))&&Pl(e.then)&&Pl(e.catch),setImmediate:su,asap:hu,isIterable:pu,isSafeIterable:e=>null!=e&&kl(e,vl)&&pu(e)},mu=fu.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"]),gu=e=>{const t={};let n,o,r;return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),o=e.substring(r+1).trim();const i=fu.hasOwnProp(t,n);!n||i&&fu.hasOwnProp(mu,n)||("set-cookie"===n?i?t[n].push(o):t[n]=[o]:t[n]=i?t[n]+", "+o:o)}),t};n.dn(gu);const wu=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),yu=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function vu(e,t){return fu.isArray(e)?e.map(e=>vu(e,t)):function(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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 bu(e){const t=Object.create(null);return fu.forEach(e.toJSON(),(e,n)=>{t[n]=(e=>vu(e,yu))(e)}),t}const Au=Symbol("internals");function Su(e){return e&&String(e).trim().toLowerCase()}function Eu(e){return!1===e||null==e?e:fu.isArray(e)?e.map(Eu):(e=>vu(e,wu))(String(e))}const ku=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function _u(e){let t=0,n=e.length;for(;t<n;){const n=e.charCodeAt(t);if(9!==n&&32!==n)break;t+=1}for(;n>t;){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)}function Tu(e,t,n,o,r){return fu.isFunction(o)?o.call(this,t,n):(r&&(t=n),fu.isString(t)?fu.isString(o)?-1!==t.indexOf(o):fu.isRegExp(o)?o.test(t):void 0:void 0)}class Ou{constructor(e){e&&this.set(e)}set(e,t,n){const o=this;function r(e,t,n){const r=Su(t);if(!r)return;const i=fu.findKey(o,r);(!i||void 0===o[i]||!0===n||void 0===n&&!1!==o[i])&&(o[i||t]=Eu(e))}const i=(e,t)=>fu.forEach(e,(e,n)=>r(e,n,t));if(fu.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(fu.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(gu(e),t);else if(fu.isObject(e)&&fu.isSafeIterable(e)){let n,o,r=Object.create(null);for(const t of e){if(!fu.isArray(t))throw new TypeError("Object iterator must return a key-value pair");o=t[0],fu.hasOwnProp(r,o)?(n=r[o],r[o]=fu.isArray(n)?[...n,t[1]]:[n,t[1]]):r[o]=t[1]}i(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=Su(e)){const n=fu.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 o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}(e);if(fu.isFunction(t))return t.call(this,e,n);if(fu.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Su(e)){const n=fu.findKey(this,e);return!(!n||void 0===this[n]||t&&!Tu(0,this[n],n,t))}return!1}delete(e,t){const n=this;let o=!1;function r(e){if(e=Su(e)){const r=fu.findKey(n,e);!r||t&&!Tu(0,n[r],r,t)||(delete n[r],o=!0)}}return fu.isArray(e)?e.forEach(r):r(e),o}clear(e){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const r=t[n];e&&!Tu(0,this[r],r,e,!0)||(delete this[r],o=!0)}return o}normalize(e){const t=this,n={};return fu.forEach(this,(o,r)=>{const i=fu.findKey(n,r);if(i)return t[i]=Eu(o),void delete t[r];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(r):String(r).trim();a!==r&&delete t[r],t[a]=Eu(o),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fu.forEach(this,(n,o)=>{null!=n&&!1!==n&&(t[o]=e&&fu.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(){const e=this.get("set-cookie");return fu.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),n=String(e);let o=0,r=!1,i=!1;function a(e){const r=_u(n.slice(o,e)),i=r.indexOf("=");if(i<1)return;const a=_u(r.slice(0,i));if(!ku.test(a))return;const s=a.toLowerCase();if("__proto__"===s||"constructor"===s||"prototype"===s)return;const c=_u(r.slice(i+1));t[s]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let n="";for(let o=1;o<t;o++){const r=e.charCodeAt(o);if(34===r)return e;if(92===r&&(o+=1,o>=t))return e;n+=e[o]}return n}(c)}for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);r?i?i=!1:92===t?i=!0:34===t&&(r=!1):34===t?r=!0:44!==t&&59!==t||(a(e),o=e+1)}return a(n.length),t}(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Au]=this[Au]={accessors:{}}).accessors,n=this.prototype;function o(e){const o=Su(e);t[o]||(!function(e,t){const n=fu.toCamelCase(" "+t);["get","set","has"].forEach(o=>{Object.defineProperty(e,o+n,{__proto__:null,value:function(e,n,r){return this[o].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[o]=!0)}return fu.isArray(e)?e.forEach(o):o(e),this}}Ou.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fu.reduceDescriptors(Ou.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),fu.freezeMethods(Ou);const Cu=Ou,Ru="[REDACTED ****]";function Iu(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),o=[],r=e=>{if(null===e||"object"!=typeof e)return e;if(fu.isBuffer(e))return e;if(-1!==o.indexOf(e))return;let t;if(e instanceof Cu&&(e=e.toJSON()),o.push(e),fu.isArray(e))t=[],e.forEach((e,n)=>{const o=r(e);fu.isUndefined(o)||(t[n]=o)});else{if(!fu.isPlainObject(e)&&function(e){if(fu.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(fu.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return o.pop(),e;t=Object.create(null);for(const[o,i]of Object.entries(e)){const e=n.has(o.toLowerCase())?Ru:r(i);fu.isUndefined(e)||(t[o]=e)}}return o.pop(),t};return r(e)}function xu(e){try{return String(e)}catch(e){return""}}class Nu extends Error{static from(e,t,n,o,r,i){let a=e.message;!a&&fu.isArray(e.errors)&&e.errors.length&&(a=function(e){return e.errors.map(e=>{try{return e&&e.message?xu(e.message):xu(e)}catch(e){return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const s=new Nu(a,t||e.code,n,o,r);return Object.defineProperty(s,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),i&&Object.assign(s,i),s}constructor(e,t,n,o,r){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),o&&(this.request=o),r&&(this.response=r,this.status=r.status)}toJSON(){const e=this.config,t=e&&fu.hasOwnProp(e,"redact")?e.redact:void 0,n=fu.isArray(t)&&t.length>0?Iu(e,t):fu.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}}}Nu.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Nu.ERR_BAD_OPTION="ERR_BAD_OPTION",Nu.ECONNABORTED="ECONNABORTED",Nu.ETIMEDOUT="ETIMEDOUT",Nu.ECONNREFUSED="ECONNREFUSED",Nu.ERR_NETWORK="ERR_NETWORK",Nu.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Nu.ERR_DEPRECATED="ERR_DEPRECATED",Nu.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Nu.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Nu.ERR_CANCELED="ERR_CANCELED",Nu.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Nu.ERR_INVALID_URL="ERR_INVALID_URL",Nu.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Lu=Nu;function Pu(e){return fu.isPlainObject(e)||fu.isArray(e)}function Uu(e){return fu.endsWith(e,"[]")?e.slice(0,-2):e}function Mu(e,t,n){return e?e.concat(t).map(function(e,t){return e=Uu(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Du=fu.toFlatObject(fu,{},null,function(e){return/^is[A-Z]/.test(e)});const ju=function(e,t,n){if(!fu.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const o=(e,t)=>{const o=fu.getSafeProp(n,e);return fu.isUndefined(o)?t:o},r=o("metaTokens",!0),i=o("visitor")||f,a=o("dots",!1),s=o("indexes",!1),c=o("Blob")||"undefined"!=typeof Blob&&Blob,l=o("maxDepth",100),u=c&&fu.isSpecCompliantForm(t),d=[];if(!fu.isFunction(i))throw new TypeError("visitor must be a function");function h(e){if(null===e)return"";if(fu.isDate(e))return e.toISOString();if(fu.isBoolean(e))return e.toString();if(!u&&fu.isBlob(e))throw new Lu("Blob is not supported. Use a Buffer instead.");if(fu.isArrayBuffer(e)||fu.isTypedArray(e)){if(u&&"function"==typeof c)return new c([e]);throw new Lu("Blob is not supported. Use a Buffer instead.",Lu.ERR_NOT_SUPPORT)}return e}function p(e){if(e>l)throw new Lu("Object is too deeply nested ("+e+" levels). Max depth: "+l,Lu.ERR_FORM_DATA_DEPTH_EXCEEDED)}function f(e,n,o){let i=e;if(fu.isReactNative(t)&&fu.isReactNativeBlob(e))return t.append(Mu(o,n,a),h(e)),!1;if(e&&!o&&"object"==typeof e)if(fu.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=function(e,t){if(l===1/0)return JSON.stringify(e);const n=[];return JSON.stringify(e,function(e,o){if(!fu.isObject(o))return o;for(;n.length&&n[n.length-1]!==this;)n.pop();return n.push(o),p(t+n.length-1),o})}(e,1);else if(fu.isArray(e)&&function(e){return fu.isArray(e)&&!e.some(Pu)}(e)||(fu.isFileList(e)||fu.endsWith(n,"[]"))&&(i=fu.toArray(e)))return n=Uu(n),i.forEach(function(e,o){!fu.isUndefined(e)&&null!==e&&t.append(!0===s?Mu([n],o,a):null===s?n:n+"[]",h(e))}),!1;return!!Pu(e)||(t.append(Mu(o,n,a),h(e)),!1)}const m=Object.assign(Du,{defaultVisitor:f,convertValue:h,isVisitable:Pu});if(!fu.isObject(e))throw new TypeError("data must be an object");return function e(n,o,r=0){if(!fu.isUndefined(n)){if(p(r),-1!==d.indexOf(n))throw new Error("Circular reference detected in "+o.join("."));d.push(n),fu.forEach(n,function(n,a){!0===(!(fu.isUndefined(n)||null===n)&&i.call(t,n,fu.isString(a)?a.trim():a,o,m))&&e(n,o?o.concat(a):[a],r+1)}),d.pop()}}(e),t};function Bu(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Wu(e,t){this._pairs=[],e&&ju(e,this,t)}const Gu=Wu.prototype;Gu.append=function(e,t){this._pairs.push([e,t])},Gu.toString=function(e){const t=e?t=>e.call(this,t,Bu):Bu;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ku=Wu;function Hu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fu(e,t,n){if(!t)return e;e=e||"";const o=fu.isFunction(n)?{serialize:n}:n,r=fu.getSafeProp(o,"encode")||Hu,i=fu.getSafeProp(o,"serialize");let a;if(a=i?i(t,o):fu.isURLSearchParams(t)?t.toString():new Ku(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Xu=Symbol("internals");function Ju(e){return e?e.length:0}function zu(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Vu(e,t){const n=e.handlers,o=Ju(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):o!==t.handlersLength&&(o?t.handlerEntries.forEach(function(e,o){n[e.index]!==e.handler&&t.handlerEntries.delete(o)}):t.handlerEntries.clear()),t.handlersLength=o}const Zu=class{constructor(){this.handlers=[],this[Xu]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,n){const o={fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null},r=this[Xu];null==this.handlers&&(this.handlers=[]),Vu(this,r);const i=r.nextId++;return this.handlers.push(o),r.handlerEntries.set(i,{handler:o,index:this.handlers.length-1}),r.handlersLength=this.handlers.length,i}eject(e){const t=this[Xu];Vu(this,t);const n=t.handlerEntries.get(e);if(n){if(t.handlerEntries.delete(e),this.handlers[n.index]!==n.handler)return;this.handlers[n.index]=null,t.iterationDepth||(zu(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Vu(this,this[Xu]))}forEach(e){const t=this[Xu];Vu(this,t),t.iterationDepth++;try{fu.forEach(this.handlers,function(t){null!==t&&e(t)})}finally{--t.iterationDepth||(Vu(this,t),zu(this.handlers),t.handlersLength=Ju(this.handlers))}}},Yu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},qu={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ku,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Qu="undefined"!=typeof window&&"undefined"!=typeof document,$u="object"==typeof navigator&&navigator||void 0,ed=Qu&&(!$u||["ReactNative","NativeScript","NS"].indexOf($u.product)<0),td="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,nd=Qu&&window.location.href||"http://localhost",od={...e,...qu};function rd(e){if(e>100)throw new Lu("FormData field is too deeply nested ("+e+" levels). Max depth: 100",Lu.ERR_FORM_DATA_DEPTH_EXCEEDED)}const id=function(e){function t(e,n,o,r){rd(r);let i=e[r++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=r>=e.length;if(i=!i&&fu.isArray(o)?o.length:i,s)return fu.hasOwnProp(o,i)?o[i]=fu.isArray(o[i])?o[i].concat(n):[o[i],n]:o[i]=n,!a;fu.hasOwnProp(o,i)&&fu.isObject(o[i])||(o[i]=[]);return t(e,n,o[i],r)&&fu.isArray(o[i])&&(o[i]=function(e){const t={},n=Object.keys(e);let o;const r=n.length;let i;for(o=0;o<r;o++)i=n[o],t[i]=e[i];return t}(o[i])),!a}
vendor: 17,283 bytes, line 11
11if(fu.isFormData(e)&&fu.isFunction(e.entries)){const n={};return fu.forEachEntry(e,(e,o)=>{t(function(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let o;for(;null!==(o=n.exec(e));)rd(t.length),t.push("[]"===o[0]?"":o[1]||o[0]);return t}(e),o,n,0)}),n}return null},ad=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),sd=(e,t)=>null!=e&&fu.hasOwnProp(e,t)?e[t]:void 0;const cd={transitional:Yu,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,r=fu.isObject(e);r&&fu.isHTMLForm(e)&&(e=new FormData(e));if(fu.isFormData(e))return o?JSON.stringify(id(e)):e;if(fu.isArrayBuffer(e)||fu.isBuffer(e)||fu.isStream(e)||fu.isFile(e)||fu.isBlob(e)||fu.isReadableStream(e))return e;if(fu.isArrayBufferView(e))return e.buffer;if(fu.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(r){const t=sd(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ju(e,new od.classes.URLSearchParams,{visitor:function(e,t,n,o){return od.isNode&&fu.isBuffer(e)?(this.append(t,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=fu.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=sd(this,"env"),o=n&&n.FormData;return ju(i?{"files[]":e}:e,o&&new o,t)}}return r||o?(t.setContentType("application/json",!1),function(e,t,n){if(fu.isString(e))try{return(t||JSON.parse)(e),fu.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=sd(this,"transitional")||cd.transitional,n=t&&t.forcedJSONParsing,o=sd(this,"responseType"),r="json"===o;if(fu.isResponse(e)||fu.isReadableStream(e))return e;if(e&&fu.isString(e)&&(n&&!o||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,sd(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Lu.from(e,Lu.ERR_BAD_RESPONSE,this,null,sd(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:od.classes.FormData,Blob:od.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fu.forEach(ad,e=>{cd.headers[e]={}});const ld=cd;function ud(e,t){const n=this||ld,o=t||n,r=Cu.from(o.headers);let i=o.data;return fu.forEach(e,function(e){i=e.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function dd(e){return!(!e||!e.__CANCEL__)}const hd=class extends Lu{constructor(e,t,n){super(e??"canceled",Lu.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function pd(e,t,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new Lu("Request failed with status code "+n.status,n.status>=400&&n.status<500?Lu.ERR_BAD_REQUEST:Lu.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const fd=/[\t\n\r]/g;function md(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(fd,"")}function gd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const wd=function(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=o[a];r||(r=c),n[i]=s,o[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-r<t)return;const h=l&&c-l;return h?Math.round(1e3*d/h):void 0}};const yd=function(e,t){let n,o,r=0,i=1e3/t;const a=(t,i=Date.now())=>{r=i,n=null,o&&(clearTimeout(o),o=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-r;s>=i?a(e,t):(n=e,o||(o=setTimeout(()=>{o=null,a(n)},i-s)))},()=>n&&a(n),(...e)=>a(e)]},vd=(e,t,n=3)=>{let o=0;const r=wd(50,250);return yd(n=>{if(!n||!fu.isNumber(n.loaded))return;const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=Math.max(0,null!=a?Math.min(i,a):i),c=Math.max(0,s-o),l=r(c);o=Math.max(o,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a?(a-s)/l:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},bd=(e,t)=>{const n=null!=e;return[o=>t[0]({lengthComputable:n,total:e,loaded:o}),t[1]]},Ad=(e,t=fu.asap)=>(...n)=>t(()=>e(...n)),Sd=od.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,od.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(od.origin),od.navigator&&/(msie|trident)/i.test(od.navigator.userAgent)):()=>!0,Ed=od.hasStandardBrowserEnv?{write(e,t,n,o,r,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];fu.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),fu.isString(o)&&s.push(`path=${o}`),fu.isString(r)&&s.push(`domain=${r}`),!0===i&&s.push("secure"),fu.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;n<t.length;n++){const o=t[n].replace(/^\s+/,""),r=o.indexOf("=");if(-1!==r&&o.slice(0,r)===e)try{return decodeURIComponent(o.slice(r+1))}catch(e){return o.slice(r+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const kd=/^https?:(?!\/\/)/i;function _d(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Ru}@`),n=t.indexOf("#"),o=(-1===n?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Ru}`);return-1===n?o:`${o}#${r=t.slice(n+1),r?r.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,t,n="")=>`${t}${n}${Ru}`):r}`;var r}function Td(e,t){if("string"==typeof e){const n=md(e);if(kd.test(n))throw new Lu(`Invalid URL ${JSON.stringify(_d(n))}: missing "//" after protocol`,Lu.ERR_INVALID_URL,t)}}function Od(e,t,n,o){Td(t,o);let r=!("string"==typeof(i=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i));var i;return e&&(r||!1===n)?(Td(e,o),function(e,t){if(!t)return e;let n=e.length;for(;n>0&&47===e.charCodeAt(n-1);)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const Cd=e=>e instanceof Cu?{...e}:e;function Rd(e,t){e=e||{},t=t||{};const n=Object.create(null);function o(e,t,n,o){return fu.isPlainObject(e)&&fu.isPlainObject(t)?fu.merge.call({caseless:o},e,t):fu.isPlainObject(t)?fu.merge({},t):fu.isArray(t)?t.slice():t}function r(e,t,n,r){return fu.isUndefined(t)?fu.isUndefined(e)?void 0:o(void 0,e,0,r):o(e,t,0,r)}function i(e,t){if(!fu.isUndefined(t))return o(void 0,t)}function a(e,t){return fu.isUndefined(t)?fu.isUndefined(e)?void 0:o(void 0,e):o(void 0,t)}function s(n,r,i){return fu.hasOwnProp(t,i)?o(n,r):fu.hasOwnProp(e,i)?o(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,timeoutErrorMessage: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)=>r(Cd(e),Cd(t),0,!0)};var l;return fu.forEach((l={...e,...t},Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(l).concat(Object.getOwnPropertySymbols(l).filter(e=>Object.getOwnPropertyDescriptor(l,e).enumerable)):Object.keys(l)),function(o){if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=fu.hasOwnProp(c,o)?c[o]:r,a=i(fu.hasOwnProp(e,o)?e[o]:void 0,fu.hasOwnProp(t,o)?t[o]:void 0,o);fu.isUndefined(a)&&i!==s||(n[o]=a)}),fu.hasOwnProp(t,"validateStatus")&&fu.isUndefined(t.validateStatus)&&!1===function(n){const o=fu.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!fu.isUndefined(o)){if(!fu.isPlainObject(o))return;if(fu.hasOwnProp(o,n))return o[n]}const r=fu.hasOwnProp(e,"transitional")?e.transitional:void 0;if(fu.isPlainObject(r)&&fu.hasOwnProp(r,n))return r[n]}("validateStatusUndefinedResolves")&&(fu.hasOwnProp(e,"validateStatus")?n.validateStatus=o(void 0,e.validateStatus):delete n.validateStatus),n}const Id=["content-type","content-length"];const xd=function(e){const t=Rd({},e),n=e=>fu.hasOwnProp(t,e)?t[e]:void 0,o=n("data");let r=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),l=n("baseURL"),u=n("allowAbsoluteUrls"),d=n("url");if(t.headers=s=Cu.from(s),t.url=Fu(Od(l,d,u,t),n("params"),n("paramsSerializer")),c){const t=fu.getSafeProp(c,"username")||"",n=fu.getSafeProp(c,"password")||"";try{s.set("Authorization","Basic "+btoa(t+":"+(n?encodeURIComponent(n).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))):"")))}catch(t){throw Lu.from(t,Lu.ERR_BAD_OPTION_VALUE,e)}}if(fu.isFormData(o)){const e=fu.getSafeProp(o,"getHeaders");od.hasStandardBrowserEnv||od.hasStandardBrowserWebWorkerEnv||fu.isReactNative(o)?s.setContentType(void 0):fu.isFunction(e)&&function(e,t,n){"content-only"===n?Object.entries(t||{}).forEach(([t,n])=>{Id.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,e.call(o),n("formDataHeaderPolicy"))}if(od.hasStandardBrowserEnv){fu.isFunction(r)&&(r=r(t));if(!0===r||null==r&&Sd(t.url)){const e=i&&a&&Ed.read(a);e&&s.set(i,e)}}return t},Nd="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const o=xd(e);let r=o.data;const i=Cu.from(o.headers).normalize();let a,s,c,l,u,d,{responseType:h,onUploadProgress:p,onDownloadProgress:f}=o;function m(){l&&l(),u&&u(),o.cancelToken&&o.cancelToken.unsubscribe(a),o.signal&&o.signal.removeEventListener("abort",a)}let g=new XMLHttpRequest;function w(r){if(!g)return;if(!(0!==g.status||"file"===(gd(md(o.url))||gd(od.origin))||g.responseURL&&g.responseURL.startsWith("file:")))return n(new Lu("Request aborted",Lu.ECONNABORTED,e,g)),m(),void(g=null);try{r?d&&d(r):u&&u()}catch(e){setTimeout(()=>{throw e})}if(!g)return;const i=Cu.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders());pd(function(e){t(e),m()},function(e){n(e),m()},{data:h&&"text"!==h&&"json"!==h?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:i,config:e,request:g}),g=null}g.open(o.method.toUpperCase(),o.url,!0),g.timeout=o.timeout,"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&g.responseURL.startsWith("file:"))&&setTimeout(w)},g.onabort=function(){g&&(n(new Lu("Request aborted",Lu.ECONNABORTED,e,g)),m(),g=null)},g.onerror=function(t){const o=t&&t.message?t.message:"Network Error",r=new Lu(o,Lu.ERR_NETWORK,e,g);r.event=t||null,n(r),m(),g=null},g.ontimeout=function(){let t=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const r=o.transitional||Yu;o.timeoutErrorMessage&&(t=o.timeoutErrorMessage),n(new Lu(t,r.clarifyTimeoutError?Lu.ETIMEDOUT:Lu.ECONNABORTED,e,g)),m(),g=null},void 0===r&&i.setContentType(null),"setRequestHeader"in g&&fu.forEach(bu(i),function(e,t){g.setRequestHeader(t,e)}),fu.isUndefined(o.withCredentials)||(g.withCredentials=!!o.withCredentials),h&&"json"!==h&&(g.responseType=o.responseType),f&&([c,u,d]=vd(f,!0),g.addEventListener("progress",c)),p&&g.upload&&([s,l]=vd(p),g.upload.addEventListener("progress",s),g.upload.addEventListener("loadend",l)),(o.cancelToken||o.signal)&&(a=t=>{g&&(n(!t||t.type?new hd(null,e,g):t),g.abort(),m(),g=null)},o.cancelToken&&o.cancelToken.subscribe(a),o.signal&&(o.signal.aborted?a():o.signal.addEventListener("abort",a)));const y=gd(o.url);if(y&&!od.protocols.includes(y))return n(new Lu("Unsupported protocol "+y+":",Lu.ERR_BAD_REQUEST,e)),void m();g.send(r||null)})},Ld=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let o=!1;const r=function(e){if(!o){o=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Lu?t:new hd(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,r(new Lu(`timeout of ${t}ms exceeded`,Lu.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)}),e=null)};e.forEach(e=>{o||(e.aborted?r.call(e):e.addEventListener("abort",r,{once:!0}))});const{signal:s}=n;return s.unsubscribe=()=>fu.asap(a),s},Pd=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let o,r=0;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},Ud=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Md=(e,t,n,o)=>{const r=async function*(e,t){for await(const n of Ud(e))yield*Pd(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,o&&o(e))};return new ReadableStream({async pull(e){try{const{done:t,value:o}=await r.next();if(t)return s(),void e.close();let i=o.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(o))}catch(e){throw s(e),e}},cancel:e=>(s(e),r.return())},{highWaterMark:2})},Dd=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,jd=(e,t,n)=>t+2<n&&Dd(e.charCodeAt(t+1))&&Dd(e.charCodeAt(t+2)),Bd=e=>e<=57?e-48:(223&e)-55,Wd=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Gd=e=>9===e||10===e||12===e||13===e||32===e,Kd=e=>{const t=e.length;let n=0;return t>0&&61===e.charCodeAt(t-1)&&(n++,t>1&&61===e.charCodeAt(t-2)&&n++),Math.floor(3*(t-n)/4)},Hd=e=>{const t=e.length;let n=0,o=0,r=!1;for(let i=0;i<t;i++){let a=e.charCodeAt(i);37===a&&jd(e,i,t)&&(a=16*Bd(e.charCodeAt(i+1))+Bd(e.charCodeAt(i+2)),i+=2),Gd(a)||(61!==a?!Wd(a)||o>0?r=!0:n++:o++)}return r||o>2||o>0&&(n+o)%4!=0||n%4==1?Kd(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(n)},Fd=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const o=e.slice(5,n),r=e.slice(n+1);if(/;base64/i.test(o))return t(r);let i=0;for(let e=0,t=r.length;e<t;e++){const n=r.charCodeAt(e);if(37===n&&jd(r,e,t))i+=1,e+=2;else if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){const t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i};const Xd={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:Jd}=fu,zd=e=>{if(!fu.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Vd=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Zd=e=>{const t=void 0!==fu.global&&null!==fu.global?fu.global:globalThis,{ReadableStream:n,TextEncoder:o}=t;e=fu.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:r,Request:i,Response:a}=e,s=r?Jd(r):"function"==typeof fetch,c=Jd(i),l=Jd(a);if(!s)return!1;const u=s&&Jd(n),d=s&&("function"==typeof o?(h=new o,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&u&&Vd(()=>{let e=!1;const t=new i(od.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),o=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!o}),f=l&&u&&Vd(()=>fu.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 o=t&&t[e];if(o)return o.call(t);throw new Lu(`Response type '${e}' is not supported`,Lu.ERR_NOT_SUPPORT,n)})});const g=async e=>{if(null==e)return 0;if(fu.isBlob(e))return e.size;if(fu.isSpecCompliantForm(e)){const t=new i(od.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return fu.isArrayBufferView(e)||fu.isArrayBuffer(e)?e.byteLength:(fu.isURLSearchParams(e)&&(e+=""),fu.isString(e)?(await d(e)).byteLength:void 0)};return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:d,timeout:h,onDownloadProgress:w,onUploadProgress:y,responseType:v,headers:b,withCredentials:A="same-origin",fetchOptions:S,maxContentLength:E,maxBodyLength:k,maxRedirects:_}=xd(e);const T=fu.isNumber(E)&&E>-1,O=fu.isNumber(k)&&k>-1;let C=r||fetch;v=v?(v+"").toLowerCase():"text";let R=Ld([l,d&&d.toAbortSignal()],h),I=null;const x=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let N,L=null;const P=()=>new Lu("Request body larger than maxBodyLength limit",Lu.ERR_BAD_REQUEST,e,I);try{let r;const l=(M="auth",fu.hasOwnProp(e,M)?e[M]:void 0);if(l){const e=fu.getSafeProp(l,"username")||"";r={username:e,password:fu.getSafeProp(l,"password")||""}}if((e=>{const t=e.indexOf("://");let n=e;return-1!==t&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")})(t)){const e=new URL(t,od.origin);if(!r&&(e.username||e.password)){const t=zd(e.username);r={username:t,password:zd(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(r&&(b.delete("authorization"),b.set("Authorization","Basic "+btoa((U=(r.username||"")+":"+(r.password||""),encodeURIComponent(U).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))))),T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Fd(-1===t?e:e.slice(0,t),Hd)}(t);if(n>E)throw new Lu("maxContentLength size of "+E+" exceeded",Lu.ERR_BAD_RESPONSE,e,I)}if(O&&"get"!==n&&"head"!==n){const e=await g(s);if("number"==typeof e&&isFinite(e)&&(N=e,e>k))throw P()}const d=O&&(fu.isReadableStream(s)||fu.isStream(s)),h=(e,t,n)=>Md(e,65536,e=>{if(O&&e>k)throw L=P();t&&t(e)},n);
vendor: 5,490 bytes, line 11
11if(p&&"get"!==n&&"head"!==n&&(y||d)){if(N=N??await(async(e,t)=>{const n=fu.toFiniteNumber(e.getContentLength());return n??g(t)})(b,s),0!==N||d){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(fu.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=y&&bd(N,vd(Ad(y)))||[];s=h(n.body,e,t)}}}else if(d&&!c&&u&&"get"!==n&&"head"!==n)s=h(s);else if(d&&c&&!p&&"get"!==n&&"head"!==n)throw new Lu("Stream request bodies are not supported by the current fetch implementation",Lu.ERR_NOT_SUPPORT,e,I);fu.isString(A)||(A=A?"include":"omit");const D=c&&"credentials"in i.prototype;if(fu.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/1.20.0",!1);const j=null==S?S:Object.assign(Object.create(null),S);j&&(delete j.body,delete j.headers,delete j.method,delete j.signal,delete j.duplex,delete j.credentials);const B=Object.assign(Object.create(null),j,{signal:R,method:n.toUpperCase(),headers:bu(b.normalize()),body:s,duplex:"half",credentials:D?A:void 0});c&&(fu.forEach(Xd,(e,t)=>{void 0===B[t]&&(B[t]=e)}),void 0===B.signal&&(B.signal=null),void 0===B.body&&(B.body=null)),0===_&&(B.redirect="manual",j&&(j.redirect="manual")),I=c&&new i(t,B);let W=await(c?C(I,j):C(t,B));const G=Cu.from(W.headers);if(T){const t=fu.toFiniteNumber(G.getContentLength());if(null!=t&&t>E)throw new Lu("maxContentLength size of "+E+" exceeded",Lu.ERR_BAD_RESPONSE,e,I)}const K=f&&("stream"===v||"response"===v);if(f&&W.body&&(w||T||K&&x)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=W[e]});const n=fu.toFiniteNumber(G.getContentLength()),[o,r]=w&&bd(n,vd(Ad(w),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>E))throw new Lu("maxContentLength size of "+E+" exceeded",Lu.ERR_BAD_RESPONSE,e,I);o&&o(t)};W=new a(Md(W.body,65536,s,()=>{r&&r(),x&&x()}),t)}v=v||"text";let H=await m[fu.findKey(m,v)||"text"](W,e);if(T&&!f&&!K){let t;if(null!=H&&("number"==typeof H.byteLength?t=H.byteLength:"number"==typeof H.size?t=H.size:"string"==typeof H&&(t="function"==typeof o?(new o).encode(H).byteLength:H.length)),"number"==typeof t&&t>E)throw new Lu("maxContentLength size of "+E+" exceeded",Lu.ERR_BAD_RESPONSE,e,I)}return!K&&x&&x(),await new Promise((t,n)=>{pd(t,n,{data:H,headers:Cu.from(W.headers),status:W.status,statusText:W.statusText,config:e,request:I})})}catch(t){if(x&&x(),R&&R.aborted&&R.reason instanceof Lu){const n=R.reason;throw n.config=e,I&&(n.request=I),t!==n&&Object.defineProperty(n,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),n}if(L)throw I&&!L.request&&(L.request=I),L;if(t instanceof Lu)throw I&&!t.request&&(t.request=I),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const n=new Lu("Network Error",Lu.ERR_NETWORK,e,I,t&&t.response);throw Object.defineProperty(n,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),n}throw Lu.from(t,t&&t.code,e,I,t&&t.response)}var U,M}},Yd=new Map,qd=e=>{let t=e&&e.env||{};const{fetch:n,Request:o,Response:r}=t,i=[o,r,n];let a,s,c=i.length,l=Yd;for(;c--;)a=i[c],s=l.get(a),void 0===s&&l.set(a,s=c?new Map:Zd(t)),l=s;return s},Qd=(qd(),{http:null,xhr:Nd,fetch:{get:qd}});fu.forEach(Qd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const $d=e=>`- ${e}`,eh=e=>fu.isFunction(e)||null===e||!1===e;const th={getAdapter:function(e,t){e=fu.isArray(e)?e:[e];const{length:n}=e;let o,r;const i={};for(let a=0;a<n;a++){let n;if(o=e[a],r=o,!eh(o)&&(r=Qd[(n=String(o)).toLowerCase()],void 0===r))throw new Lu(`Unknown adapter '${n}'`);if(r&&(fu.isFunction(r)||(r=r.get(t))))break;i[n||"#"+a]=r}if(!r){const e=Object.entries(i).map(([e,t])=>`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($d).join("\n"):" "+$d(e[0]):"as no adapter specified";throw new Lu("There is no suitable adapter to dispatch the request "+t,Lu.ERR_NOT_SUPPORT)}return r},adapters:Qd};function nh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new hd(null,e)}function oh(e){const t=fu.toSafeFlatObject(e);nh(t),t.headers=Cu.from(fu.getSafeProp(t,"headers")),t.data=ud.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return th.getAdapter(t.adapter||ld.adapter,t)(t).then(function(e){nh(t),t.response=e;try{e.data=ud.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=Cu.from(e.headers),e},function(e){if(!dd(e)&&(nh(t),e&&e.response)){t.response=e.response;try{e.response.data=ud.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=Cu.from(e.response.headers)}return Promise.reject(e)})}const rh={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{rh[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ih={};rh.transitional=function(e,t,n){function o(e,t){return"[Axios v1.20.0] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,i)=>{if(!1===e)throw new Lu(o(r," has been removed"+(t?" in "+t:"")),Lu.ERR_DEPRECATED);return t&&!ih[r]&&(ih[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,i)}},rh.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}
11`),!0)};const ah={assertOptions:function(e,t,n){if("object"!=typeof e||null===e)throw new Lu("options must be an object",Lu.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const i=o[r],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 Lu("option "+i+" must be "+n,Lu.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Lu("Unknown option "+i,Lu.ERR_BAD_OPTION)}},validators:rh},sh=ah.validators;class ch{constructor(e){this.defaults=e||{},this.interceptors={request:new Zu,response:new Zu}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack;let o="";if("string"==typeof n){const e=n.indexOf("\n");o=-1===e?"":n.slice(e+1)}if(e.stack){if(o){const t=o.indexOf("\n"),n=-1===t?-1:o.indexOf("\n",t+1),r=-1===n?"":o.slice(n+1);String(e.stack).endsWith(r)||(e.stack+="\n"+o)}}else e.stack=o}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Rd(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:r}=t;void 0!==n&&ah.assertOptions(n,{silentJSONParsing:sh.transitional(sh.boolean),forcedJSONParsing:sh.transitional(sh.boolean),clarifyTimeoutError:sh.transitional(sh.boolean),legacyInterceptorReqResOrdering:sh.transitional(sh.boolean),advertiseZstdAcceptEncoding:sh.transitional(sh.boolean),validateStatusUndefinedResolves:sh.transitional(sh.boolean)},!1),null!=o&&(fu.isFunction(o)?t.paramsSerializer={serialize:o}:ah.assertOptions(o,{encode:sh.function,serialize:sh.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ah.assertOptions(t,{baseUrl:sh.spelling("baseURL"),withXsrfToken:sh.spelling("withXSRFToken")},!0),t.method=(fu.getSafeProp(t,"method")||fu.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=r&&fu.merge(r.common,r[t.method]);r&&fu.forEach(ad.concat("common"),e=>{delete r[e]}),t.headers=Cu.concat(i,r);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||Yu;n&&n.legacyInterceptorReqResOrdering?a.unshift(e.fulfilled,e.rejected):a.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!s){const e=[oh.bind(this),void 0];for(e.unshift(...a),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=a.length;let h=t;for(;d<u;){const e=a[d++],t=a[d++];try{h=e?e(h):h}catch(e){if(!t){l=Promise.reject(e);break}try{const n=t.call(this,e);fu.isThenable(n)&&(l=Promise.resolve(n).then(()=>oh.call(this,h)))}catch(e){l=Promise.reject(e)}break}}if(!l)try{l=oh.call(this,h)}catch(e){l=Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Fu(Od((e=Rd(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}}fu.forEach(["delete","get","head","options"],function(e){ch.prototype[e]=function(t,n){return this.request(Rd(n||{},{method:e,url:t,data:n&&fu.hasOwnProp(n,"data")?n.data:void 0}))}}),fu.forEach(["post","put","patch","query"],function(e){function t(t){return function(n,o,r){return this.request(Rd(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}ch.prototype[e]=t(),"query"!==e&&(ch.prototype[e+"Form"]=t(!0))});const lh=ch;class uh{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{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 o=new Promise(e=>{n.subscribe(e),t=e}).then(e);return o.cancel=function(){n.unsubscribe(t)},o},e(function(e,o,r){n.reason||(n.reason=new hd(e,o,r),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 uh(function(t){e=t});return{token:t,cancel:e}}}const dh=uh;const hh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,Re
11setContent: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,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent: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,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(hh).forEach(([e,t])=>{void 0===hh[t]&&(hh[t]=e)});const ph=hh;const fh=function e(t){const n=new lh(t),o=gl(lh.prototype.request,n);return fu.extend(o,lh.prototype,n,{allOwnKeys:!0}),fu.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(Rd(t,n))},o}(ld);fh.Axios=lh,fh.CanceledError=hd,fh.CancelToken=dh,fh.isCancel=dd,fh.VERSION="1.20.0",fh.toFormData=ju,fh.AxiosError=Lu,fh.Cancel=fh.CanceledError,fh.all=function(e){return Promise.all(e)},fh.spread=function(e){return function(t){return e.apply(null,t)}},fh.isAxiosError=function(e){return fu.isObject(e)&&!0===e.isAxiosError},fh.mergeConfig=Rd,fh.AxiosHeaders=Cu,fh.formToJSON=e=>id(fu.isHTMLForm(e)?new FormData(e):e),fh.getAdapter=th.getAdapter,fh.HttpStatusCode=ph,fh.default=fh;const mh=fh,gh={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 wh=n(3029),yh=n(2901),vh=function(){function e(){(0,wh.A)(this,e),(0,a.A)(this,"readyPromise",null),(0,a.A)(this,"readyResolved",!1),(0,a.A)(this,"readyValue",!1)}return(0,yh.A)(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,o=Date.now();if(this.readyResolved&&!0===this.readyValue)return r.A.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return r.A.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var i=null!=n?n:e.DEFAULT_TIMEOUT;return r.A.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,a=setTimeout(function(){t.readyResolved||(r.A.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-o)/1e3,"s"),t.resolveReady(!1,e))},i);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return r.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){r.A.log("BlueConicUtils | blueConicReady | BC client detected");var i=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(a),r.A.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-o)/1e3,"s"),null==i||i(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(r.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)(vh,"DEFAULT_TIMEOUT",3e3);const bh=new vh;var Ah,Sh;function Eh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function kh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
11t%2?Eh(Object(n),!0).forEach(function(t){(0,a.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){Ah||(Ah=e,Sh&&(r.A.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",Sh),window.dispatchEvent(Sh)))}),r.A.log("Waiting for islands ready");var _h=function(){var e=window.location.href;return new URL(e)},Th=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),o=0;o<n.length;o+=1){var r=n[o].trimLeft();if(0===r.indexOf(t))return r.substring(t.length,r.length)}return!1},Oh=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=_h().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])},Ch=function(){var e=Oh();return".".concat(e)},Rh=function(e,t,n){var o="".concat(e,"=").concat(t,";");void 0!==n?(r.A.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=u(e,2),n=t[0],r=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),o+="expires=".concat(i.toUTCString(),";")}else o+="".concat(n,"=").concat(r,";")})):o+="path=/;",document.cookie=o},Ih=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),r=Oh(),i=[r,"www".concat(r),".www".concat(r)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=u(e,2),n=t[0],r=t[1];o+="".concat(n,"=").concat(r,";")}),0===Object.keys(t).length&&(o+="path=/;"),document.cookie=o,i.forEach(function(e){document.cookie=o.concat("domain=",e,";")})},xh=function(){return _h().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Nh=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,o=e.split(".")[n];if("string"!=typeof o)throw new d(`Invalid token specified: missing part #${n+1}`);let r;try{r=h(o)}catch(e){throw new d(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new d(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},Lh=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Oh().split(".")[0],e.prev=1,e.next=2,mh({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 r.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),r.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)}}(),Ph=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,mh({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(xh())),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)}}(),Uh=function(){return"complete"===document.readyState},Mh=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n){var i=!0;if(Uh())n();else{r.A.log("UIHandler: ","Waiting for the body to load...");var a=setInterval((0,t.A)(o.mark(function t(){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e&&(i=Uh()),document.querySelector("body")&&i&&(clearInterval(a),n(!0));case 1:case"end":return t.stop()}},t)})),200)}})},Dh=function(){return new Promise(function(e){if(Uh())e();else{r.A.log("UIHandler: ","Waiting for the log-in-button class to load...");var n=setInterval((0,t.A)(o.mark(function t(){return o.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)}})},jh=function(){return new Promise(function(e){if(("interactive"===document.readyState||Uh())&&window.dataLayer)r.A.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{r.A.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval((0,t.A)(o.mark(function t(){return o.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)}})},Bh=function(){return new Promise(function(e){if(Uh())e();else{r.A.log("UIHandler: Employee Debugger:  ","Waiting for the digisubs debugger toolbox to load...");var n=setInterval((0,t.A)(o.mark(function t(){return o.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)}})},Wh=function(){var e=(0,t.A)(o.mark(function e(t){var n,i,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,jh();case 1:return r.A.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",r.A.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),i=function(e){return r.A.log("Utils dataLayerLoop:  look for this element ",e),e[t]?(r.A.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(r.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)}}(),Gh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"Page Type",e.next=1,Wh(t);case 1:return n=e.sent,r.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)}}(),Kh=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.log("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return r.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(){r.A.log("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),r.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)}}(),Hh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:if(t=e.sent,r.A.log("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,Kh();case 2:if(n=e.sent,r.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"),r.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)}}(),Fh=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a,s,c,l,u,d,h=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>
110&&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,bh.blueConicReady();case 1:if(s=e.sent,r.A.log("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(c=window.blueConicClient.getSegments(),r.A.log("bcLowaCheck | BC segments for users: ",c),l=c.filter(function(e){return a.includes(e.name)}),r.A.log("bcLowaCheck | BC userSubSegments: ",l),!(l.length>0)){e.next=3;break}return e.next=2,Hh();case 2:(u=e.sent)&&(n=!0,i=u);case 3:return t&&n&&Xh(),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)}}(),Xh=function(){Rh("bc_lowa_status",1,{path:"/",domain:Ch(),expires:7,secure:!0})},Jh=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(r.A.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(r.A.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var o=n.detail||{};r.A.log("utils | Event: authentication ready: ",o),e(o)}catch(e){r.A.log(e),t(e)}},!1))})},zh=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return i.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(r.A.log("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var o=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=o,r.A.log("Received entitlementsReady event:",o),e(o)}catch(e){r.A.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(r.A.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Vh=function(){r.A.log("Clearing entitlements...");try{Ih(gh.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){r.A.log("Failed to delete legacy cookie: ",e)}try{Ih(gh.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:Oh(),expires:365,secure:!0})}catch(e){r.A.log("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(gh.LOCAL_STORAGE_SESSION_KEY)}catch(e){r.A.log("Failed to remove local storage: ",e)}},Zh=function(){Ih(gh.AUTH0_SUB_COOKIE_KEY),Ih("mng-jwt-decoded"),localStorage.removeItem(gh.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),Vh()},Yh=function(e){r.A.log("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),r.A.log("Storage Object removed : ",e))},qh=function(e){r.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","COMM
11BANK","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","SO
11CIAL","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 r.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=qh;var Qh;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var $h=function(){var e=(0,t.A)(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;
11)switch(e.prev=e.next){case 0:if(void 0===Qh){e.next=1;break}return e.abrupt("return",Qh);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Qh=new ml({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",Qh);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ep=function(e){Sh=new CustomEvent("mng-auth-check-complete",{detail:e}),Ah?(r.A.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(Sh)):r.A.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return ep(e.detail)});var tp=function(e){r.A.log("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,r.A.log("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),r.A.log("utils | Dispatched authenticationReady event"),ep(e)};var np=function(){var e=window.localStorage.getItem("__MNG_Session");if(e){var t=JSON.parse(e);if(t.idToken){var n=Nh(t.idToken);if(n.home_paper)return r.A.log("Util.js | home paper: Home paper is ",n.home_paper),n.home_paper.replace("www.","").replace("develop.","").replace("preprod.","").replace("staging.","")}}return r.A.log("Util.js | home paper: Home paper is not set ",xh()),xh()},op=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},rp=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,c,l,u,d;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r.A.log("deleteUserCache","Setting up cache deletion for ".concat(t)),n=xh(),r.A.log("deleteUSerCache","Domain is: ".concat(n)),a={publication:n,uuid:t},e.next=1,mh({method:"DELETE",url:"".concat(i.A.entitlementsEndpoint,"session/create"),data:a,headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:if(c=e.sent,l=c.data,u=/Succesfully deleted/i,!("object"===(0,s.A)(l)&&Object.prototype.hasOwnProperty.call(l,"message"))||!u.test(l.message)){e.next=2;break}return r.A.log("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return r.A.log("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(l)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),r.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)}}(),ip=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)(o.mark(function t(){var s,c,l,u,d,h,p,f,m,g,w;return o.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:kh({},a)}));case 1:return t.next=2,Gh();case 2:return l=t.sent,t.next=3,Wh("Paywall_Level");case 3:if(u=t.sent,"article"===l&&"free"!==u){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==l?"Page type is not an article":"Free article"}));case 4:return t.next=5,zh();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"!==u){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,r.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:kh({},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:kh({},a)}));case 13:t.prev=13,w=t.catch(0),i(w);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})},ap=function(e){return r.A.log("is7DaySub: Checking 7-day subscription status"),e?/7day/i.test(e)?(r.A.log("is7DaySub: Found 7-day subscription ",e),!0):(r.A.log("is7DaySub: Is not 7-day subscription"),!1):(r.A.log("is7DaySub: No service code provided"),!1)};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=ip);var sp="#primary-menu",cp="#pushnav",lp=".log-in-button",up=".subscribe-visibility",dp=".log-out-button",hp="dfm-digisubs-menu",pp="digisubs-push-container",fp="dfm-digisubs-push-menu",mp="mega-subscribe-button",gp=function(){return document.querySelector(sp)},wp=function(){return document.querySelector(cp)},yp=function(){return document.getElementById(hp)},vp=function(){return document.getElementById(pp)},bp=function(){return document.getElementById(fp)},Ap=function(){return yp()?yp().querySelector(lp):null},Sp=function(){return bp()?bp().querySelector(lp):null},Ep=function(){return Sp()?Sp().querySelector("a"):null},kp=function(){return document.getElementById(mp)},_p=function(){return wp()?wp().querySelector(lp):null},Tp=function(){return _p()?_p().querySelector("a"):null},Op=function(){return document.querySelectorAll(lp)},Cp=function(){return document.querySelectorAll(up)},Rp=function(){var e=document.querySelectorAll("".concat(up," a"));return e.length>0?e[0]:null};function Ip(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)||l(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 xp=function(){function e(){(0,wh.A)(this,e),(0,a.A)(this,"pendingSets",new Map),(0,a.A)(this,"flushTimer",null),(0,a.A)(this,"hasFlushed",!1),(0,a.A)(this,"isPaused",!1)}return(0,yh.A)(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,r.A.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){r.A.error("AdmiralUtils | pauseTargeting | failed",e)}else r.A.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)r.A.log('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return r.A.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
11try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),r.A.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),r.A.log("AdmiralUtils | flush | targeting ready.")}catch(e){r.A.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)r.A.log("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),r.A.log("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();(0,a.A)(xp,"DEFAULT_READY_DELAY_MS",2e3);var Np=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,bh.blueConicReady();case 1:return e.next=2,Jh();case 2:return e.abrupt("return",new Promise(function(e){r.A.log("ANALYTICS: inside BCregwall events");var t=_h();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)}}(),Lp=function(e){try{window.dataLayer.push({event:e}),r.A.log("ANALYTICS: ".concat(e," event")),r.A.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){r.A.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Pp=n(1834),Up=function(){try{var e=localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){r.A.log("Unable to get session from local storage: ",e)}return"{}"},Mp=function(e){try{r.A.log("Setting local storage session",e),localStorage.setItem(gh.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){r.A.log("Unable to save session from local storage: ",e)}},Dp=function(e){try{Rh(gh.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:Ch(),expires:365,secure:!0})}catch(e){r.A.log("Unable to save session to cookie storage: ",e)}},jp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.A.sessionServer,n="".concat(t,"/api/session"),r.A.log("Checking server session: ",n),e.next=1,mh.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,w=null!==(s=null==h?void 0:h.entitlement_expiry)&&void 0!==s?s:null,y=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,v=null!==(l=null==h?void 0:h.entitlement_entitled)&&void 0!==l?l:null,b=null!==(u=null==h?void 0:h.entitlement_extras_adfree)&&void 0!==u?u:null,A=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,Mp(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:w,entitlementSource:y,isEntitled:v,adFree:b,entitlementLevel:A})),""!==g&&"string"==typeof g&&Dp(g),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:g,expiration:w,entitlementSource:y,isEntitled:v,adFree:b,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)}}(),Bp=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=i.A.sessionServer,a="".concat(n,"/api/session"),r.A.log("Updating server session: ",a),e.next=1,mh.post(a,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),r.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)}}(),Wp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=i.A.sessionServer,n="".concat(t,"/api/session"),r.A.log("Deleting server session: ",n),e.next=1,mh.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,a=e.catch(0),r.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)}}(),Gp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S,E,k,_,T,O,C,R,I;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.log("Inside getSession"),e.prev=1,d=Up(),r.A.log("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,g=h.expiration,w=h.entitlementSource,y=h.isEntitled,v=h.adFree,b
11=h.entitlementLevel,n=p,t=f,i=m,a=g,s=w,c=y,l=v,u=b,r.A.log("Session: check both tokens: ",t,i),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return r.A.log("Session: missing id or entitlements, try session server"),e.next=2,jp();case 2:A=e.sent,S=A.accessToken,E=A.idToken,k=A.entitlementToken,_=A.expiration,T=A.entitlementSource,O=A.isEntitled,C=A.adFree,R=A.entitlementLevel,n=S,t=E,i=k,a=_,s=T,c=O,l=C,u=R;case 3:e.next=5;break;case 4:e.prev=4,I=e.catch(1),r.A.log("Failed to get session: ",I);case 5:return r.A.log("Returning session: ",t,n,i),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:i,expiration:a,entitlementSource:s,isEntitled:c,adFree:l,entitlementLevel:u});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),Kp=function(){var e=(0,t.A)(o.mark(function e(t){var n,i,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S,E,k,_,T,O,C,R,I,x,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Up(),i=JSON.parse(n),a=i.accessToken,s=void 0===a?null:a,c=i.idToken,l=void 0===c?null:c,u=i.entitlementToken,d=void 0===u?null:u,h=i.expiration,p=void 0===h?null:h,f=i.entitlementSource,m=void 0===f?null:f,g=i.isEntitled,w=void 0===g?null:g,y=i.adFree,v=void 0===y?null:y,b=i.entitlementLevel,A=void 0===b?null:b,S=t.accessToken,E=t.idToken,k=t.entitlementToken,_=t.expiration,T=t.entitlementSource,O=t.isEntitled,C=t.adFree,R=t.entitlementLevel,I={accessToken:S??s,idToken:E??l,entitlementToken:k??d,expiration:_??p,entitlementSource:T??m,isEntitled:O??w,adFree:C??v,entitlementLevel:R??A},r.A.log("Current session data: ",i),r.A.log("New session data: ",t),r.A.log("Updated session data:",I),x=JSON.stringify(I),Mp(x),""!==I.entitlementToken&&"string"==typeof I.entitlementToken&&Dp(I.entitlementToken),n===x){e.next=1;break}return e.next=1,Bp(I);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),r.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)}}(),Hp=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.A.log("Ending session..."),Zh(),e.next=1,Wp();case 1:localStorage.removeItem(gh.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Fp="1"===window.authentication_config.isEmbedLoginEnabled,Xp=function(){return"logout"===(_h().searchParams.get("state")||"").toLowerCase()};Fp||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var Jp=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,$h();case 1:n=e.sent,r.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)}}(),zp=function(){r.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){r.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=/")}},Vp=function(){return new Promise(function(e){r.A.log("About to call Connext Logout..."),Connext.Logout(),setTimeout(function(){e()},300)})},Zp=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a,s,c,l,u,d,h;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.log("Attempting to logout..."),zp(),r.A.log("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?Nh(n):"")){e.next=2;break}return a=i.auth0Id,e.next=1,rp(a);case 1:e.sent.success?r.A.log("User cache cleared."):r.A.log("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,Hp();case 3:e.next=5;break;case 4:Zh();case 5:return e.prev=5,r.A.log("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:r.A.log("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),r.A.log("Failed to cycle through logout callbacks: ",h);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}
11).forEach(function(e){window.localStorage.removeItem(e),r.A.log("Removed Auth0 storage object...")}),Yh("hhsl"),Yh("userNewsLetterData"),Yh(gh.REGWALL_USER_IS_SUBSCRIBED),Yh(gh.USER_PROFILE_HASH),c=_h(),l=window.location.origin;try{c.searchParams.get("returnURL")&&(u=decodeURIComponent(c.searchParams.get("returnURL")),l=u)}catch(e){r.A.log(e),l=window.location.origin}return l=new URL(l),e.next=9,window.ConnextUtils.connextReady("onInit",Pp.A.defaultTimeoutLength);case 9:if(!e.sent){e.next=11;break}return r.A.log("Auth | Connext silent mode enabled ",Connext.GetOptions().Silentmode),r.A.log("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),d=l,l.origin!==window.location.origin&&(d=new URL(window.location.origin)).searchParams.append("returnAfterLogout",l),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",d),e.next=10,Vp();case 10:e.next=12;break;case 11:r.A.log("Connext Logout was NOT called");case 12:return r.A.log("Calling Auth0 logout now."),e.next=13,Jp(l);case 13:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Yp=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},qp=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Lp(e)}),r.A.log("Cycled through preauth GTM events.")},Qp=function(){var e=(0,t.A)(o.mark(function e(t,n,i,a,s){var c,l,u,d,h,p,f,m,g,w,y,v,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.A.log("Attempting to login..."),Yp()>4.5&&window.localStorage.clear(),qp(),a&&(c=[],l=window.localStorage.getItem("callbackEvents"),u=JSON.parse(l),c=u&&u.length>0?Ip(new Set([].concat(Ip(a),Ip(u)))):a,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),d=null,e.next=1,$h();case 1:if(h=e.sent,p=_h(),f=p.origin,m=new URL("".concat(f,"/callback")),g={},p.searchParams.get("regwall")&&(p.searchParams.get("returnUrl")&&(w=p.searchParams.get("returnUrl")),p.searchParams.get("auth_redirect")&&(w=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()),w&&"regwall"!==t&&m.searchParams.set("auth_redirect",w),"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,Hp();case 2:e.next=4;break;case 3:Zh();case 4:return null!==(d=p.searchParams.get("login-with"))?g.connection=d:n&&(g.connection=n),y="none",t&&"regwall"===t&&(m.searchParams.set("regwall","true"),y="signUp",r.A.log("Logging in with regwall")),t&&(m.searchParams.set("loginsource",t),r.A.log("Logging in with ".concat(t))),i&&(g.login_hint=i),g.redirect_uri=m.toString(),g.initialScreen=y,"googleonetap"!==t&&(g.prompt="select_account"),null!==(v=p.searchParams.get("ampRegiWall"))&&(b=window.location.hostname,g.ampRegiWall=v,g.sourceDomain=b.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,o,r,i){return e.apply(this,arguments)}}(),$p=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),o=JSON.parse(n);if(!o||0===o.length)return void e();r.A.log("Adding listeners to events we need to wait for...");var i=o.map(function(e){return t=e,new Promise(function(e){r.A.log("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var o=n.detail||{};r.A.log("Event: ".concat(t,"} ready: "),o),e(o)}catch(t){r.A.log(t),e()}},!1)});var t});Promise.all(i).then(function(){clearTimeout(t),e()})}catch(t){r.A.log("Failed to wait for callback events",t),e()}})},ef=function(){var e=(0,t.A)(o.mark(function e(){var n,i,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S,E,k,_;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(zp(),n=_h(),i=!1,a=n.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=n.searchParams.get("redirect_uri")||"",s.includes("applenews")?(r.A.log("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),r.A.log("Post callback Apple redirect URL is ".concat(c)),Qp(!1,!1,!1,[],c)):Qp()):a.includes("post-apple-login")&&(r.A.log("This is Apple Callback flow."),i=!0,(l=new URL(decodeURIComponent(a))).searchParams.delete("post-apple-login"),a=l),r.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",Qp(!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,$h();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,r.A.log("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,r.A.log("Cycling through login callbacks..."),e.next=9,$p();case 9:return g=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(f));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(g);case 10:r.A.log("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,E=e.catch(8),r.A.log("Failed to cycle through login callbacks: ",E);case 12:if(w={accessToken:m,userId:p.sub,email:p.email,picture:p.picture},y=!1,v="",!i){e.next=17;break}return e.prev=13,e.next=14,Ph(w.userId);case 14:return v=e.sent,r.A.log("Encrypted apple uuid is: ".concat(v)),e.next=15,Lh(v);case 15:y=e.sent,r.A.log("Apple sub status is: ".concat(y)),e.next=17;break;case 16:e.prev=16,k=e.catch(13),r.A.log("Apple sub check error: ".concat(k)),alert("There was an error in logging you in, please try again.");case 17:if(Yh(gh.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}
11return r.A.log("Saving idToken to session server"),e.next=18,Kp({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 b=n.searchParams.get("loginsource"),A=window.MNGAuthentication.postAuthEvents.map(function(){var e=(0,t.A)(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(b));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(A);case 20:return e.prev=20,S=new URL(a),i&&y&&S.searchParams.append("access_token",v),r.A.log("Apple redirect URL:",S),e.abrupt("return",window.location.assign(S));case 21:return e.prev=21,_=e.catch(20),r.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)}}(),tf=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.A.log("ANALYTICS: fireBC events"),e.next=1,Np();case 1:r.A.log("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),nf=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a,s,c,l,u,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Jh();case 1:if(t=e.sent,n=t.idToken,i=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=Nh(n),c=s.email,l=s.picture,u=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,u.split("|").pop(),e.abrupt("return",{authenticated:i,nickname:f||h||d,email:c,picture:l,userId:u,connectionSource:p});case 3:e.prev=3,m=e.catch(2),r.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)}}();Fp||(window.MNGAuthentication.login=Qp,window.MNGAuthentication.logout=Zp,window.MNGAuthentication.getUserInfo=nf);var of=function(){var e=(0,t.A)(o.mark(function e(){var n,a,c,l,u,d,h,p,f,m,g,w,y,v,b,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Fp){e.next=1;break}return r.A.log("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(n=_h(),a=!1,c="",l=!1,u={},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)(o.mark(function e(){var t,n,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,$h();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return u=e.sent,e.next=3,t.isAuthenticated();case 3:if(a=e.sent,c="object"===(0,s.A)(u)?u.__raw:"",n=Th(gh.ENTITLEMENT_COOKIE_KEY),a||!n){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:l=e.sent;case 5:e.next=7;break;case 6:e.prev=6,i=e.catch(0),r.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 r.A.log("Page is logout. Routing to logout function..."),e.next=2,Zp();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(gh.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Up()){e.next=5;break}return f&&(p=f.jwt),e.next=5,Kp({idToken:c,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,Gp();case 7:m=e.sent,c=m.idToken,(a="string"==typeof c)&&(u=Nh(c)),e.next=9;break;case 8:e.prev=8,A=e.catch(6),r.A.log("Unable to initialize session: ",A);case 9:e.next=11;break;case 10:return e.next=11,h();case 11:if(r.A.log("Authentication Init | isAuthenticated:",a),r.A.log("Authentication Init | accessToken:",l),!a||!i.A.forceLogoutOnExpiredIdToken){e.next=13;break}if(w=null,u&&"object"===(0,s.A)(u)?w=u:c&&(w=Nh(c)),!((y=null===(g=w)||void 0===g?void 0:g.exp)&&Date.now()/1e3>y)){e.next=13;break}return r.A.log("Authentication Init | IdToken is expired, treating as non-authenticated."),e.next=12,Zp();case 12:a=!1,c="",u={};case 13:if(a||l||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=15;break}return r.A.log("BlueConic LOWA | entering bcLowaCheck"),e.next=14,Fh(!0);case 14:v=e.sent,r.A.log("BlueConic LOWA | bcLowaCheck result:",v),v.isSub?(r.A.log("BlueConic LOWA | authenticated as LOWA"),a=gh.USER_IS_LOWA,u={sub:v.uuid}):r.A.log("BlueConic LOWA | NOT a subscriber");case 15:if(tp({isAuthenticated:a,idToken:c,accessToken:l,claims:u}),op("authenticationReady"),!0===a?(r.A.log("User is authenticated."),n.searchParams.get("auth_redirect")&&(r.A.log("Auth Redirect is present, sending user to auth redirect..."),(b=n.searchParams.get("auth_redirect")).endsWith("#")&&(b=b.slice(0,b.length)),window.location.assign(b)),n.pathname.startsWith("/login")&&!Xp()&&(r.A.log("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(n.origin))):r.A.log("User is not authenticated."),n.pathname.startsWith("/login")&&!Xp()?(r.A.log("Page is login. Attempting to log user in..."),Q
11p()):n.pathname.startsWith("/login")&&Xp()?(r.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"))),r.A.log("Auth | Connext 300ms logout state expired. Manually reloading page.",Connext.GetOptions().Silentmode),window.location.assign(e)},300)):r.A.log("Page is not login or Connext state is present"),!n.pathname.startsWith("/callback")||!n.searchParams.get("regwall")){e.next=17;break}return r.A.log("Page is callback with regwall param. Routing to regwall receiver..."),e.next=16,tf();case 16:r.A.log("Now login from regwall"),Qp(),e.next=18;break;case 17:if(!n.pathname.startsWith("/callback")){e.next=18;break}return r.A.log("Page is callback without regwall param. Routing to callback receiver..."),e.next=18,ef();case 18:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=of;var rf,af;window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){rf||(rf=e,af&&(r.A.log("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",af),window.dispatchEvent(af)))});var sf=function(e){Rh(gh.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:Ch(),expires:365,secure:!0})},cf=function(){var e=(0,t.A)(o.mark(function e(t){var n,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,sf(t),r.A.log("About to decode token before saving: ",t),n=Nh(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,Kp({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(gh.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),r.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)}}(),lf=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,c,l,u,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.log("Entitlements: create token start..."),r.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=Oh(n),t.sub&&(c=t.sub),t.idToken&&(l=t.idToken),l||c){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return u={publication:a.replace("vipdev.lndo.site","com"),requestSource:"website"},l?u.idToken=l:c&&(u.uuid=c),d="".concat(i.A.entitlementsEndpoint,"session/create"),r.A.log("Entitlements: create payload",u),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(u)});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,r.A.log("Entitlements: Token Created: ",p),e.next=7;break;case 6:p=h.jwt;case 7:return e.next=8,cf(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,f=e.catch(3),r.A.log("Entitlements: Create Token Failure: ",f),Vh(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,Kp({entitlementToken:null});case 11:e.next=13;break;case 12:e.prev=12,m=e.catch(10),r.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)}}(),uf=function(e){af=new CustomEvent("mng-entitlement-check-complete",{detail:e}),rf?(r.A.log("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",e),window.dispatchEvent(af)):r.A.log("Islands not ready")};window.addEventListener("entitlementsReady",function(e){return uf(e.detail)});var df=function(){var e=JSON.parse(window.localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY));return null!=e&&(r.A.log("Subscriber Check: : ",e.isEntitled),e.isEntitled)},hf=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(A.length>0&&void 0!==A[0]?A[0]:{}).forceRecheck,n=void 0!==t&&t,e.prev=1,a=window.localStorage.getItem(gh.REGWALL_USER_IS_SUBSCRIBED),s=Th(gh.AUTH0_SUB_COOKIE_KEY),c=_h(),l=xh(),u=Th("clearEntCache"),!(n||u||c.searchParams.has("newUser"))){e.next=7;break}return d="".concat(i.A.entitlementsEndpoint,"session/create"),e.next=2,Jh();case 2:return h=e.sent,p={uuid:h.claims.auth0Id,publication:l},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":i.A.entitlementsApiKey},data:JSON.stringify(p)});case 4:e.sent&&(r.A.log("loggedOutNewSubscriberActions","Entitlements: Cache 
11cleared"),Ih("clearEntCache")),e.next=6;break;case 5:e.prev=5,v=e.catch(3),r.A.log("loggedOutNewSubscriberActions","Entitlements:  Cache clear Failure - ".concat(v.message));case 6:e.next=8;break;case 7:r.A.log("loggedOutNewSubscriberActions","There is no clearEntCache cookie");case 8:if(r.A.log("loggedOutNewSubscriberActions","Checking if this is a new regwall subscriber"),!(n||u||"false"===a&&c.searchParams.has("newUser")&&s)){e.next=11;break}return f=!1,m={sub:s,email_verified:!0},e.next=9,lf(m);case 9:if((g=e.sent)&&""!==g&&(w=Nh(g),y=w.entitlement_entitled,f=y),r.A.log("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(f)),!f){e.next=10;break}return window.localStorage.setItem(gh.REGWALL_USER_IS_SUBSCRIBED,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 10:case 11:return e.abrupt("return",!1);case 12:return e.prev=12,b=e.catch(1),r.A.log("loggedOutNewSubscriberActions error",b),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,null,[[1,12],[3,5]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(gh.LOCAL_STORAGE_SESSION_KEY));return null!=t?(r.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=df,window.MNGAuthentication.loggedOutNewSubscriberActions=hf;var pf=function(e,t){var n=e.toLowerCase(),o="";return["@medianewsgroup.com","@tribpub.com","@activeone.co"].forEach(function(e){t&&t.endsWith(e)&&(o="corporate")}),!!n.includes("employee")&&{employeeAccess:!0,accessGroup:o}},ff=function(e){return new Promise(function(t,n){r.A.log("Entitlements: get UUID from email start...");var o=Oh(),a="".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(e,"?all=true&spoofUser=true&domain=").concat(o);$.ajax({type:"GET",url:a,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":i.A.entitlementsApiKey}}).then(function(e){r.A.log("Entitlements: Request successful: ",e);var n=e&&e.identities&&e.identities.find(function(e){return"Trib"!==e.connection.split("-")[0]});if(!n)return r.A.log("Entitlements: No matching user identity found."),t(!1);var o=JSON.stringify(e),i=btoa(encodeURIComponent(o));localStorage.setItem("spoofed-user-profile",i);var a={uuid:n.user_id,provider:n.provider};return t(a)}).catch(function(e){r.A.error("Entitlements: UUID request Failure: ",e),n(e)})})},mf=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){var n=Connext,o={},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();r.A.log("Employee tools: Checking Connext UserState, state is: ".concat(t)),void 0!==t&&"Logged Out"!==t&&(o.conversation=n.Storage.GetCurrentConversation().Name,o.userState=t,o.campaign=n.Storage.GetLocalConfiguration().Campaign.Name,o.meter=n.Storage.GetLocalConfiguration().DynamicMeter.Name,clearInterval(s),clearTimeout(a),e(o))},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)}}(),gf=function(){function e(t,n,o){(0,wh.A)(this,e),this.source=t,this.email=n,this.employeeId=o,this.spoofContent=document.createElement("p"),this.spoofBanner=document.createElement("div")}return(0,yh.A)(e,[{key:"clearSpoofedUser",value:(a=(0,t.A)(o.mark(function t(){var n;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return document.getElementById("spoof-banner").remove(),this.userSpoofCheckbox.checked=!1,e.deleteLocalStorageSpoofUser(),t.next=1,lf({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,Wp();case 2:return t.next=3,Kp({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)(o.mark(function t(n){var i,a,s,c,l,u,d;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.A.log("employee tools: handling spoof"),t.next=1,Jh();case 1:if(i=t.sent,a=i.idToken,s=localStorage.getItem(gh.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,ff(c);case 4:if(l=t.sent,r.A.log("employee tools: spoof user data: ",l),l&&"string"==typeof l.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,lf({sub:"".concat(l.provider,"|").concat(l.uuid),email:c,email_verified:!0});case 6:if(u=t.sent,!window.authentication_config.sessionManagementEnabled){t.next=9;break}return t.next=7,Wp();case 7:return t.next=8,Kp({idToken:a,entitlementToken:u});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),r.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()))})}}
11,{key:"addSpoofBannerToPage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deeppink";r.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)(o.mark(function n(){var i,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S,E,k,_,T,O,C,R;return o.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=pf(this.source,this.email),r.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",(l=document.createElement("div")).id="employee-debugger-button",l.innerHTML='\n\t\t\t<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"/></svg>\n\t\t',(u=document.createElement("div")).id="employee-debugger-content",u.innerHTML="\n\t\t\t<h4>MNG Debugger</h4>\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",(w=document.createElement("label")).textContent="Set expiration",this.datePickerCheckbox=document.createElement("input"),this.datePickerCheckbox.type="checkbox",this.datePickerCheckbox.id="expiration-control",(y=document.createElement("div")).id="datepicker-wrapper",(v=document.createElement("input")).id="expiration-picker",v.type="datetime-local",(b=document.createElement("button")).id="apply-exp-btn",b.className="expiration-btn",(A=document.createElement("button")).id="reset-exp-btn",A.className="expiration-btn",(S=b.appendChild(document.createElement("span"))).className="tooltiptext",S.textContent="Apply date",(E=A.appendChild(document.createElement("span"))).className="tooltiptext",E.textContent="Reset to original",document.body.append(c),document.getElementById("employee-debugger").append(l,u),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(w,this.datePickerCheckbox,y),document.getElementById("datepicker-wrapper").append(v,b,A),document.getElementById("employee-debugger").append(l,u),k=JSON.parse(localStorage.getItem("__MNG_Session")),_=Nh(k.entitlementToken),T=new Date(1e3*k.expiration),O=new Date(1e3*_.session_exp),v.value=T.toISOString().replace(/.\d+Z$/g,""),(C=document.createElement("div")).style.padding="5px 0px 0px 10px",C.innerHTML='\n\t\t<h3 class="section-heading">Entitlements JWT</h3>\n\t\t',Object.keys(_).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<span class="symbol-prop" id="').concat(e,'-expand">&#43;</span>\n\t\t\t<span class="symbol-prop" id="').concat(e,'-reduce">&#8722;</span>\n\t\t\t');var o=n.firstChild.nextElementSibling;o.style.display="inline";var r=n.lastChild.previousElementSibling,i=document.createElement("small");i.className="obj-value",i.innerHTML='&rdca; <span id="'.concat(e,'_value">
11').concat(_[e],"</span>"),t.append(n,i),C.append(t),n.addEventListener("click",function(){var e=n.nextElementSibling;"block"===e.style.display?(e.style.display="none",o.style.display="inline",r.style.display="none"):(e.style.display="block",r.style.display="inline",o.style.display="none")}),i.addEventListener("click",function(){var t=document.getElementById("".concat(e,"_value")).innerHTML;navigator.clipboard&&navigator.clipboard.writeText(t)})}),(R=document.createElement("div")).style.padding="5px 0px 0px 10px",R.innerHTML='\n\t\t\t\t<h3 class="section-heading">Connext answer</h3>\n\t\t\t\t',document.addEventListener("onInit",(0,t.A)(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof Connext){e.next=1;break}(t=document.createElement("p")).className="connext-error-message",t.innerHTML="Something went wrong, reload may solve the issue.",R.append(t),e.next=3;break;case 1:return e.next=2,mf();case 2:n=e.sent,Object.keys(n).forEach(function(e){var t=document.createElement("div");t.className="list-content";var o=document.createElement("p");o.className="collapsible-list",o.innerHTML="\n\t\t\t\t".concat(e,'\n\t\t\t\t<span class="symbol-prop" id="').concat(e,'-expand">&#43;</span>\n\t\t\t\t<span class="symbol-prop" id="').concat(e,'-reduce">&#8722;</span>\n\t\t\t\t');var r=o.firstChild.nextElementSibling;r.style.display="inline";var i=o.lastChild.previousElementSibling,a=document.createElement("small");a.className="obj-value",a.innerHTML='&rdca; <span id="'.concat(e,'_value">').concat(n[e],"</span>"),t.append(o,a),R.append(t),o.addEventListener("click",function(){var e=o.nextElementSibling;"block"===e.style.display?(e.style.display="none",r.style.display="inline",i.style.display="none"):(e.style.display="block",i.style.display="inline",r.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,C,R),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")&&Ip(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee",t.style.color="blue"}),i&&(this.addSpoofBannerToPage(f),this.userSpoofCheckbox.checked=!0,Ip(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(v.value))||void 0===t?void 0:t.getTime(),o=Math.floor(n/1e3);k.expiration=o,localStorage.setItem("__MNG_Session",JSON.stringify(k)),window.localStorage.setItem("manual-expiration",!0),e.interval&&clearInterval(e.interval),e.timeLeftPopUp(k.expiration)}),document.getElementById("reset-exp-btn").addEventListener("click",function(){v.value=O.toISOString().replace(/.\d+Z$/g,"")}),this.addEventListeners(),a&&(this.datePickerCheckbox.click(),e.timeLeftPopUp(k.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"),r.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 o=n.appendChild(document.createElement("p"));o.id="time-left-text",o.textContent="Calculating time...",document.getElementById("employee-debugger").prepend(n)}
11var r=new Date(1e3*e).toLocaleString(),i=new Date(r).getTime();this.interval=setInterval(function(){var e=(new Date).getTime(),n=i-e,o=Math.floor(Math.abs(n/864e5))||0,r=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(o,"d ").concat(r,"h ").concat(a,"m ").concat(s,"s 🕛"),n<0&&(document.getElementById("time-left-text").textContent="Token expired by: ".concat(o,"d ").concat(r,"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(gh.USER_PROFILE_HASH)}}]);var n,i,a}(),wf=function(){var e=(0,t.A)(o.mark(function e(t,n){var i,a,s,c,l;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.A.log("Employee Tools: employeeAds: "),i=pf(t,n),r.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,Bh();case 2:if(a=document.createElement("div"),s=document.getElementById("employee-debugger-toggles"),c=document.getElementById("employee-adfree-toggle"),a.id="employee-debugger-adfree",a.innerHTML='\n\t\t<label>Ad Free: </label>\n\t\t<input type="checkbox" id="employee-adfree-toggle" >\n\t\t<p class="employee-notes">(page will reload)</p>\n\t',s&&c){e.next=3;break}return r.A.log("employee tools: employee toggles not found"),e.abrupt("return",!1);case 3:return s.append(a),(void 0!==(l=localStorage.getItem("hhsl"))&&"access"===l||"undefined"!=typeof MNGAuthentication&&"function"==typeof MNGAuthentication.isUserAdFree&&MNGAuthentication.isUserAdFree())&&(c.checked=!0,window.MNGAuthentication.isUserAdFree=!0),c.addEventListener("click",function(e){r.A.log("employee tools: employee ad toggle clicked"),e.target.checked?(r.A.log("Employee tools: employee ads: turn off"),localStorage.setItem("hhsl","access"),window.MNGAuthentication.isUserAdFree=!0,setTimeout(function(){window.location.reload()},500)):(r.A.log("Employee tools: employee ads: turn on"),localStorage.removeItem("hhsl"),setTimeout(function(){window.location.reload()},500))}),e.abrupt("return",!0);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();var yf,vf,bf,Af,Sf,Ef=[],kf=xh();kf=kf.replace("local","com");var _f="".concat(i.A.entitlementsEndpoint,"newsletters"),Tf=function(e){var t=new Date,n=Math.round(t.getTime()/1e3)-86400;return new Date(e)>=new Date(1e3*n).getTime()},Of=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=_f,"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,mh({method:t.method,url:n,headers:{"X-Api-Key":i.A.entitlementsApiKey},data:t.dataToSend});case 2:a=e.sent,"get"===t.method&&((Ef=a.data.responseData).sort(function(e,t){return e.title>t.title?1:-1}),"limited"===vf?(s=Ef.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:Ef})),Nf()),e.next=4;break;case 3:e.prev=3,c=e.catch(1),r.A.log("newsletter: ",c);case 4:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Cf=function(){var e,t,n=navigator.userAgent,o=/^((?!chrome|android).)*safari/i.test(n),r=/Chrome/.test(n);return o?"calc(100vh - 8.5rem)":r?"calc(100vh - ".concat((e=window.innerHeight,(t=(window.screen.height-e)/16)>0?t:0),"rem)"):"calc(100vh - 64px)"},Rf=function(e){e.stopPropagation();var t={},n=e.target,o=e.target.classList.contains("dropDownNewsLetter")?".slideOutNewsLetter":".dropDownNewsLetter",r=parseInt(n.getAttribute("data-id"),10),i=n.checked;document.querySelector("".concat(o,'[data-id="').concat(r,'"]')).checked=i,Ef.find(function(e){return e.id===r}).isSubscribed=i,t.method=i?"post":"delete",t.dataToSend={email:yf,domain:kf,preferenceId:r},xf(t)},If=function(e){e.stopPropagation();var t,n,o=e.target;if(o.matches("span")||o.matches("label")){var r,i=o.closest("div"),a=i.querySelector(".newsletter-icon"),s="block"===(r=i.classList.contains("show-digisubs-push")?document.querySelector("#newsLetterItem-push"):document.querySelector("#newsLetterContent-dropdown")).style.display,c=document.querySelector(".wrapper-nav-sub
11s.pushnav.pushnav-right"),l=/iPad|iPhone|iPod/.test(navigator.userAgent),u=/Android/i.test(navigator.userAgent);s?(a.classList.remove("icon-arrow-down"),a.classList.add("icon-arrow-right"),r.style.display="none",""!==c.style.height&&(c.style.height="")):(a.classList.remove("icon-arrow-right"),a.classList.add("icon-arrow-down"),r.style.display="block",l&&window.innerHeight<c.offsetHeight&&""===c.style.height&&(c.style.height=Cf()),u&&(t=document.querySelector(".wrapper-nav-subs.pushnav.pushnav-right.push-from-right .newsletter-nav"),(n=t.getBoundingClientRect()).top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)||""!==c.style.height||(c.style.height=Cf())))}},xf=function(e){localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:bf,newsLetterData:Ef})),Of({method:e.method,dataToSend:e.dataToSend})},Nf=function(){var e=document.querySelector("#newsLetterContent-dropdown"),t=document.querySelector("#newsLetterItem-push");if(e&&t){var n=document.createElement("div"),o=document.createElement("span");o.classList.add("icon-arrow-right","newsletter-icon"),o.addEventListener("click",If),n.append(o);var r=document.createElement("label");r.textContent="Manage Newsletters",r.id="newsletterHead",n.append(r),n.classList.add("newsletter-dropdown-title"),n.addEventListener("click",If);var i=n.cloneNode(!0);i.classList.add("show-digisubs-push","newsletter-dropdown-title"),i.style.display="flex",i.addEventListener("click",If),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('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 16 16">\n\t\t<title>info</title>\n\t\t<path d="M7 4.75c0-0.412 0.338-0.75 0.75-0.75h0.5c0.412 0 0.75 0.338 0.75 0.75v0.5c0 0.412-0.338 0.75-0.75 0.75h-0.5c-0.412 0-0.75-0.338-0.75-0.75v-0.5z"></path>\n\t\t<path d="M10 12h-4v-1h1v-3h-1v-1h3v4h1z"></path>\n\t\t<path d="M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM8 14.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5 6.5 2.91 6.5 6.5-2.91 6.5-6.5 6.5z"></path>\n\t</svg>'),l="url(data:image/svg+xml;base64,".concat(c,")");s.style.background=l;var u=document.createElement("p"),d=document.createElement("a"),h=np();d.setAttribute("href","https://myaccount.".concat(h)),d.setAttribute("id","myAccountLink"),d.textContent="MyAccount",u.appendChild(document.createTextNode("Manage your newsletters here or visit ")),u.appendChild(d),u.appendChild(document.createTextNode(" for more information")),a.append(s),a.append(u);var p=a.cloneNode(!0);e.append(a),t.append(p);var f,m,g,w=(f={},Ef.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),y=(m=w,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(Sf," Newsletters:")):g=["".concat(Sf," Newsletters:")].concat(Ip(g)),g);w["".concat(Sf," Newsletters:")]=[],y.forEach(function(n){if("Media News Group"!==n&&"MediaNews Group"!==n&&"MediaNewsGroup"!==n&&"Not Active"!==n){var o=document.createElement("li");o.classList.add("titleContainer");var r=document.createElement("li");r.classList.add("titleContainer");var i=document.createElement("label");i.classList.add("newsletterCategoryTitle"),i.textContent=n,"My Newsletters:"!==n&&n!=="".concat(Sf," Newsletters:")||i.classList.add("newsLetterTitleBold");var a=i.cloneNode(!0);
11o.append(i),r.append(a),e.append(o),t.append(r),w[n].forEach(function(n){var o=document.createElement("li");o.classList.add("dropdown-item-newsletter");var r=document.createElement("li");r.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",Rf),Af&&(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",Rf),i.classList.add("dropDownNewsLetter"),s.classList.add("slideOutNewsLetter"),o.append(i,a),r.append(s,c),e.append(o),t.append(r)})}}),e.style.display="none",t.style.display="none"}};const Lf=function(e,t,n,o){if(yf=e,vf=t,Sf=o,Af=n){Yh("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(r.A.log("host for newsletter prefs",kf),localStorage.getItem("userNewsLetterData")){var s=JSON.parse(localStorage.getItem("userNewsLetterData"));bf=s.expoDate,Tf(bf)?(Ef=s.newsLetterData,Nf()):Of({method:"get",dataToSend:{email:yf,domain:kf}})}else Of({method:"get",dataToSend:{email:yf,domain:kf}})};var Pf=function(){var e=gp()?gp().querySelector(dp):null,t=gp();null!==e&&t.removeChild(e)},Uf=function(){var e=(0,t.A)(o.mark(function e(t){var n,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S,E,k,_,T,O,C,R,I,x,N,L,P,U,M,D,j,B,W,G,K,H,F,X,J,z,V,Z,Y,q,Q,$,ee,te,ne,oe,re,ie,ae,se,ce,le,ue,de,he,pe,fe,me,ge,we,ye,ve,be,Ae,Se,Ee,ke,_e,Te,Oe,Ce;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.authenticatedStatus,a=t.email,s=t.nickname,c=t.picture,l=t.connectionSource,u=t.entitlementSource,d=t.entitlementOrganization,h=t.entitlementLevel,p=t.serviceCode,f=t.isEedition,m=t.accountHref,g=t.userId,w="",y=" | Logged in with ",v=[],b=a,A=ap(p),S=function(e){var t=(e||"").trim();if(!t)return" ";var n=t.split("@"),o=n.shift()||"",r=o.length,i=-1*(r>24?Math.min(8,Math.ceil(r/6)):0);return'<div class="dsub-truncated-text" title="'.concat(t,'"><span class="dsub-truncated-text__username"><span class="dsub-truncated-text__username-left">').concat(o.slice(0,i),'</span><span class="dsub-truncated-text__username-right">').concat(o.slice(i),'</span></span><span class="dsub-truncated-text__domain">@').concat(n.shift(),"</span></div>")},void 0!==a&&"undefined"!==a&&a&&!a.endsWith("@example.com")||(b=s||"Logged In"),E=null==l?void 0:l.replace("Trib-","").toLowerCase(),r.A.log("Validate connection source: ",E),e.prev=1,Te=E,e.next="google-oauth2"===Te||"google"===Te?2:"facebook"===Te?3:"apple"===Te?4:5;break;case 2:return y+="Google",e.abrupt("continue",6);case 3:return y+="Facebook",e.abrupt("continue",6);case 4:return y+="Apple",e.abrupt("continue",6);case 5:return y="",e.abrupt("continue",6);case 6:Oe=h,e.next="limited"===Oe?7:"subscriber"===Oe||"freeTrial"===Oe?8:"premium"===Oe?9:"comp"===Oe?10:"partner-access"===Oe?11:12;break;case 7:return w="Limited Access",e.abrupt("continue",13);case 8:return w="Standard Digital Access",e.abrupt("continue",13);case 9:return w=A?"Standard Digital Access":"Premium Ad-Free Access",e.abrupt("continue",13);case 10:return w="Standard Digital Trial",e.abrupt("continue",13);case 11:return w="Partner Access",e.abrupt("continue",13);case 12:return w="Anonymous",e.abrupt("continue",13);case 13:if(n===gh.USER_IS_LOWA&&(y="",w="Anonymous"),f&&p&&p.includes("P")&&(w="Limited Subscription - e-Edition access"),d&&(w="".concat("Standard Digital Access"===w?"Access":"Premium Ad-Free Access"===w?"Ad-Free Access":w," provided by ").concat(d)),Pf(),vp().style.display="none",yp().dataset.status="logged-in",(_=Ap()).removeChild(_.firstChild),(T=document.createElement("a")).id="anchorProfileDropDown",T.className="nav-link dropdown-toggle dropdown-toogle-mobile",T.setAttribute("aria-label","Account menu dropdown"),T.style.cursor="pointer",T.setAttribute("tabindex","0"),T.setAttribute("aria-expanded","fal
11se"),O=document.createElement("img"),C=document.getElementById("pushnav-icon"),O.className="rounded-circle",O.alt="Profile image",C.className="rounded-circle",O.src=c,C.src=c,c||(O.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png",C.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png"),(R=document.createElement("span")).className="icon-arrow-down",R.id="icon-caret",R.setAttribute("aria-hidden","true"),I=document.createElement("div"),(x=document.createElement("div")).id="account-content",x.className="dropdown-menu",I.id="account-content-container",document.body.appendChild(I),_.append(T,x),N="",window.dataLayer.forEach(function(e){Object.prototype.hasOwnProperty.call(e,"SiteName")&&(N=e.SiteName)}),L=window,P=L.location,U=new URL(P),B=null,n!==gh.USER_IS_LOWA?((B=document.createElement("a")).className="dropdown-item dropdown-profile account-link",B.text=b):document.getElementById("push-email-link").style.display="none",n===gh.USER_IS_LOWA&&((W=document.createElement("li")).className="dropdown-item log-in-button subscribe-special custom-button",G=document.createElement("a"),K=_h(),G.href="/login?returnUrl=".concat(K),G.target="_blank",G.text="Complete Log In",G.style.cursor="pointer",G.style.margin="0",G.style.width="auto"),H=Mf('\n\t\t\t<div class="dropdown-item account-settings">\n\t\t\t\t<div class="digisubs-subscriber-information-content avatar-placeholder"></div>\n\t\t\t</div>'),F=S(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=Rp(),z=Oh(),V="https://checkout.".concat(z),J){V=J.href,r.A.log("Original sub URL: ",V);try{(Z=new URL(V)).searchParams.has("newUser")||Z.searchParams.set("newUser","true"),V=Z.toString()}catch(e){r.A.log("Error processing subscription URL: ",e)}}for(Y="subscriber"===h||"premium"===h?"\n\t\t\t\t<div class='digisubs-subscriber-information-content'>\n\t\t\t\t\t<div class='digisubs-user-information-text'>".concat(s||"User","</div>\n\t\t\t\t\t<div id=\"digisubs-email\" class='digisubs-information-small-text'>").concat(F,"</div>\n\t\t\t\t</div>"):"\n\t\t\t\t<div class='digisubs-user-information-content'>\n\t\t\t\t\t<div class='digisubs-user-information-text'>".concat(s||"User","</div>\n\t\t\t\t\t<div id=\"digisubs-email\" class='digisubs-information-small-text'>").concat(F,"</div>\n\t\t\t\t\t<div class='digisubs-user-information-subscribe-button'>\n\t\t\t\t\t\t<a href=\"").concat(V,"\" class='digisubs-subscribe-now-button'>Subscribe Now</a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>"),q=Mf(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<div class='digisubs-subscription-content'>\n\t\t\t\t<div class='digisubs-subscription-level'>\n\t\t\t\t\t<div class='digisubs-subscription-text'>Subscription</div>\n\t\t\t\t\t<div class='digisubs-entitlement-text'>".concat(w,'</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t</div>'),ee=Mf($),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=Mf('\n\t\t\t<div class=\'digisubs-reader-dashboard-content\'>\n\t\t\t\t<div class=\'digisubs-reader-dashboard\'>\n\t\t\t\t\t<div class=\'digisubs-reader-dashboard-text\'>Reader Dashboard</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t</div>'),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<div class=\'digisubs-gift-article-content\'>\n\t\t\t\t\t<div class=\'digisubs-gift-article-text-container\'>\n\t\t\t\t\t\t<div class=\'digisubs-gift-article-text\'>Gifted Articles</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>':"\n\t\t\t\t<div class='digisubs-gift-article-content'>\n\t\t\t\t\t<div class='digisubs-gift-article-text-container'>\n\t\t\t\t\t\t<div class='digisubs-gift-article-text'>Gifted Articles</div>\n\t\t\t\t\t\t\x3c!-- <a class='digisubs-gift-article-link-text' href=\"".concat(V,'">Subscribe for access</a> --\x3e\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>'),oe=Mf(ne),D.appendChild(oe)),i.A.enableSavedArticlesLink&&((j=document.createElement("a")).className="dropdown-item",i.A.enableReaderDashboardv2?j.href="".concat(U.origin,"/dashboard/saved-articles"):(j.href="".concat(U.origin,"/user-tools/dashboard/#saved-article-container"),j.target="_blank"),re="subscriber"===h?"\n\t\t\t\t<div class='digisubs-saved-article-content'>\n\t\t\t\t\t<div class='digisubs-saved-article-text-container'>\n\t\t\t\t\t\t<div class='digisubs-saved-article-text'>Saved Articles</div>\n\t\t\t\t\t\t\x3c!-- <a class='digisubs-gift-article-link-text' href=\"".concat(V,'">Subscribe for access</a> --\x3e\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>'):"premium"===h?'\n\t\t\t\t<div class=\'digisubs-saved-article-content\'>\n\t\t\t\t\t<div class=\'digisubs-saved-article-text-container\'>\n\t\t\t\t\t\t<div class=\'digisubs-saved-article-text\'>Saved Articles</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>':'\n\t\t\t\t<div class=\'digisubs-saved-article-content\'>\n\t\t\t\t\t<div class=\'digisubs-saved-article-text-container\'>\n\t\t\t\t\t\t<div class=\'digisubs-saved-article-text\'>Saved Articles</div>\n\x3c!--\t\t\t\t\t\t<div class=\'digisubs-saved-article-link-text\'>Subscribe to Premium for access</div>--\x3e\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</div>',ie=Mf(re),j.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=Mf('\n\t\t<div class=\'digisubs-contact-us-content\'>\n\t\t\t<div class=\'digisubs-contact-us\'>\n\t\t\t\t<div class=\'digisubs-contact-us-text\'>Contact Us</div>\n\t\t\t</div>\n\t\t\t<div class=\'digisubs-right-arrow\'>\n\t\t\t\t<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t<path d="M1.9 -0.000366211L0.5 1.49963L4.7 5.99963L0.5 10.4996L1.9 11.9996L7.5 5.99963L1.9 -0.000366211Z" fill="black"/>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t</div>'),ae.appendChild(se),(ce=document.createElement("a")).className="dropdown-item","1"!==window.authentication_config.isEmbedLoginEnabled?ce.href="".concat(U.origin,"/logout"):ce.style.cursor="pointer",ae.setAttribute("data-mng-click","logout"),ae.setAttribute("data-mng-category","account-link"),ae.setAttribute("data-mng-action","logout"),le=Mf("\n\t\t<div class='digisubs-logout-content'>\n\t\t\t<div class='digisubs-logout'>\n\t\t\t\t<div class='digisubs-logout-text'>Log Out</div>\n\t\t\t</div>\n\t\t</div>"),ce.appendChild(le),ce.addEventListener("click",function(){var e=ce.querySelector(".digisubs-logout-text");e&&(e.innerHTML='Logging out<span class="animating-dots">...</span>')}),(ue=document.createElement("a")).className="dropdown-item",ue.setAttribute("data-mng-click","marketing-content"),ue.setAttribute("data-mng-category","marketing-content"),ue.setAttribute("data-mng-action","marketing-content"),de=Mf("\n\t\t<div class='digisubs-marketing-content hide'>\n\t\t\t<div class='digisubs-marketing'>\n\t\t\t\tSAMPLE MARKETING ITEM HERE\n\t\t\t</div>\n\t\t</div>"),ue.appendChild(de),_.id="profileDropDown",_.className="nav-item dropdown auth-visible show",T.append(O,R),W&&document.getElementById("account-content").append(W),he=[H,X].concat(Ip(M?[M]:[]),[Q],Ip(D?[D]:[]),Ip(j?[j]:[]),[ae,ce,ue]),(k=document.getElementById("account-content")).append.apply(k,Ip(he)),document.getElementById("push-auth-source").textContent="".concat(w).c
11oncat(y),document.getElementById("push-email-link").textContent=b,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)),r.A.log("Employee tools: start tools here",u,a,g),!1===(fe=u)&&(fe="none"),(me=new gf(fe,a,g)).init(),wf(fe,a),i.A.newslettersEnabled&&h&&(ge=b,we=!1,me.userSpoofCheckbox&&(we=me.userSpoofCheckbox.checked),localStorage.getItem("spoof-user")&&(ge=localStorage.getItem("spoof-user")),!0===n&&Lf(ge,h,we,N)),ye=document.getElementById("account-content"),ve=document.querySelector(".search-icon-wrapper"),be=function(){var e=ye.classList.contains("show");R.className=e?"icon-arrow-up":"icon-arrow-down",T.setAttribute("aria-expanded",e.toString()),e?(null==ve||ve.classList.add("search-icon-wrapper-hide"),I.style.display="block"):(null==ve||ve.classList.remove("search-icon-wrapper-hide"),I.style.display="none")},window.addEventListener("resize",be),T.addEventListener("click",function(){ye.classList.toggle("show"),be()}),document.getElementById("anchorProfileDropDown").addEventListener("keydown",function(e){"Enter"===e.key&&(ye.classList.toggle("show"),be())}),document.addEventListener("click",function(e){T.contains(e.target)||ye.contains(e.target)||(ye.classList.remove("show"),be())}),v=document.getElementsByClassName("account-link"),Ae=0;Ae<v.length;Ae+=1)v[Ae].setAttribute("href",m);e.next=15;break;case 14:e.prev=14,Ce=e.catch(1),r.A.error("UIHandler Error in dropdown rendering",{message:Ce.message,stack:Ce.stack,userContext:{nickname:null!=s?s:"undefined",connectionSource:null!=l?l:"undefined"}});case 15:(Se=_p())&&n!==gh.USER_IS_LOWA?Se.style.display="none":n===gh.USER_IS_LOWA&&(Ee=Tp())&&(Ee.text="Complete Log In"),(ke=Sp())&&n!==gh.USER_IS_LOWA?ke.style.display="none":n===gh.USER_IS_LOWA&&(_e=Ep())&&(_e.text="Complete Log In");case 16:case"end":return e.stop()}},e,null,[[1,14]])}));return function(t){return e.apply(this,arguments)}}();function Mf(e){var t=document.createElement("div");return t.innerHTML=e.trim(),t.firstChild}const Df=Uf;var jf=function(){return(0,yh.A)(function e(){(0,wh.A)(this,e),(0,a.A)(this,"targetsToWatch",new Map),(0,a.A)(this,"targetProcessedStatus",new Map),(0,a.A)(this,"observer",void 0),this.mutationCallback=this.mutationCallback.bind(this),this.observer=new MutationObserver(this.mutationCallback)},[{key:"addTarget",value:function(e,t){this.targetsToWatch.has(e)&&r.A.log('ContentObserver: Target with key "'.concat(e,'" already exists. Overwriting.')),this.targetsToWatch.set(e,t),this.targetProcessedStatus.set(e,!1),r.A.log('ContentObserver: Added target "'.concat(e,'".'))}},{key:"addTargetsFromObject",value:function(e){var t=this;Object.entries(e).forEach(function(e){var n=u(e,2),o=n[0],r=n[1];t.addTarget(o,r)})}},{key:"processTargetIfConditionMet",value:function(e,t,n){if(!this.targetProcessedStatus.get(n)&&t.condition){var o=e.matches(t.selector)?e:e.querySelector(t.selector);if(o)return t.action(o),!0}return!1}},{key:"mutationCallback",value:function(e,t){var n=this;e.forEach(function(e){"childList"===e.type&&e.addedNodes.length>0&&e.addedNodes.forEach(function(e){1===e.nodeType&&n.targetsToWatch.forEach(function(t,o){(e.matches(t.selector)?[e]:Array.from(e.querySelectorAll(t.selector))).forEach(function(e){n.processTargetIfConditionMet(e,t,o)&&n.targetProcessedStatus.set(o,!0)})})})}),this.checkAndDisconnectObserver(t)}},{key:"checkAndDisconnectObserver",value:function(e){var t=this,n=!0;this.targetsToWatch.forEach(function(e,o){e.condition&&!t.targetProcessedStatus.get(o)&&(n=!1)}),n&&(e.disconnect(),r.A.log("MutationObserver disconnected: All relevant elements processed or conditions not met."))}},{key:"startObserving",value:(e=(0,t.A)(o.mark(function e(){var t,n=this,i=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:document.body,e.next=1,jh();case 1:r.A.log("ContentObserver: Starting observation process."),this.observer.observe(t,{childList:!0,subtree:!0}),r.A.log("MutationObserver started for ".concat(t.tagName||"document.body"," elements.")),Object.entries(this.targetsToWatch).forEac
11h(function(e){var o=u(e,2),r=o[0],i=o[1];if(i.condition){var a=t.querySelector(i.selector);a&&n.processTargetIfConditionMet(a,i,r)&&n.targetProcessedStatus.set(r,!0)}}),this.checkAndDisconnectObserver(this.observer);case 2:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})}]);var e}();var Bf=new jf,Wf=function(){var e=(0,t.A)(o.mark(function e(){var t,n,r,a,s,c,l,u,d,h,p,f,m,g,w,y,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n="Naviga",r="",a="Anonymous",s=!1,c=!1,l="",!i.A.entitlementsEnabled){e.next=2;break}return e.next=1,zh();case 1:(u=e.sent)&&u.token&&(d=u.token,h=Nh(d),p=h.entitlement_entitled,f=h.entitlement_source,m=h.entitlement_organizationName,g=h.entitlement_level,w=h.entitlement_serviceCode,y=h.entitlement_isEedition,v=h.email,t=p||!1,n=f||!1,a=g||"Anonymous",s=w||!1,c=y||!1,l=v||"",r=m||""),e.next=3;break;case 2:"undefined"!=typeof Connext&&"Subscribed"===Connext.Storage.GetUserState()&&(t=!0);case 3:return e.abrupt("return",{userIsEntitled:t,entitlementSource:n,entitlementOrganization:r,entitlementLevel:a,serviceCode:s,isEedition:c,tokenEmail:l});case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Gf=function(){var e=(0,t.A)(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=_h(),r=t.querySelector("a"),(i=new URL(r.href)).searchParams.set("returnUrl",encodeURIComponent("".concat(n.href,"?newUser=true"))),r.setAttribute("href",i.href);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Kf=function(e){var t,n=e.siteUrl,o=["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))?(r.A.log("UIHandler: ","Account Settings link provided by wp-admin"),new URL("".concat(window.authentication_config.myAccountLink))):o.length>0?new URL("https://membership.".concat(n)):new URL("https://myaccount.".concat(n))},Hf=function(){var e=(0,t.A)(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.accountHref,Op().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)}}(),Ff=function(e){try{void 0!==window.MNGAuthentication&&("keydown"===e.type&&"Enter"===e.key||"click"===e.type)&&(e.preventDefault(),window.MNGAuthentication.logout())}catch(e){r.A.log(e)}},Xf=function(e){r.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)},Jf=function(){r.A.log("UIHandler: ","show logout buttons"),Xf("engageLogoutLink"),document.querySelectorAll(dp).forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.addEventListener("click",Ff),t.addEventListener("keydown",Ff)})},zf=function(){r.A.log("UIHandler: ","show login buttons"),Xf("engageLoginLink"),Op().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),o=new URLSearchParams(n);o.append("returnUrl",_h()),t.querySelector("a").setAttribute("href","".concat(n,"?").concat(o))})},Vf=function(){var e=(0,t.A)(o.mark(function e(){var t,n,a,s,c,l,u,d,h,p,f,m,g,w,y,v,b,A,S;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r.A.log("UIHandler: ","setup"),e.next=1,nf();case 1:return t=e.sent,n=t.authenticated,a=t.email,s=t.picture,c=t.connectionSource,l=t.userId,u=t.nickname,e.next=2,Wf();case 2:if(d=e.sent,h=d.userIsEntitled,p=d.entitlementSource,f=d.entitlementOrganization,m=d.entitlementLevel,g=d.serviceCode,w=d.isEedition,y=d.tokenEmail,v=Kf({siteUrl:np()}),!n){e.next=6;break}if(!i.A.dropdownEnabled){e.next=4;break}return n===gh.USER_IS_LOWA||a&&!a.includes("@example.com")||(a=y),e.next=3,Df({authenticatedStatus:n,email:a,nickname:u,picture:s,connectionSource:c,entitlementSource:p,entitlementOrganization:f,entitlementLevel:m,serviceCode:g,isEedition:w,accountHref:v,userId:l});case 3:e.next=5;break;case 4:return e.next=5,Hf({entitlementSource:p,siteUrl:xh(),accountHref:v});case 5:Jf(),e.next=7;break;case 6:zf();
11case 7:b=kp(),h?(Cp().forEach(function(e){e.style.display="none"}),b&&(b.style.display="none")):(Cp().forEach(function(e){var t=e;t.style.display="block",Gf(t)}),b&&(b.style.display="flex",A=_h(),(S=new URL(b.getAttribute("href"))).searchParams.set("returnUrl",encodeURIComponent(A.href)),b.setAttribute("href",S.href)));case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Zf=function(){var e=Ap();e&&(e.style.display="block",e.style.visibility="visible");var t=Ap()?Ap().querySelector("a"):null;t&&(t.textContent="Loading..."),yp().dataset.status="logged-out"},Yf=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Zf(),e.next=1,Vf();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 qf=function(){var e=(0,t.A)(o.mark(function e(){var t,n,i,a;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Mh();case 1:return e.next=2,Gh();case 2:if("article"===e.sent){e.next=3;break}return r.A.log("addArticleContentObservers: Non-article page detected, leaving."),e.abrupt("return");case 3:return e.next=4,Wh("Paywall_Level");case 4:return t=e.sent,e.next=5,Wf();case 5:n=e.sent,i=n.userIsEntitled,a=n.entitlementLevel,Bf.addTargetsFromObject({"stn-player":{selector:".stn-player",condition:i&&"premium"===a,action:function(e){r.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){r.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()}}}),Bf.addTargetsFromObject({".article-bottom-share":{selector:".article-bottom-share",condition:!0,action:function(e){r.A.log("addArticleContentObservers: Bottom article share buttons found, updating styles."),e.style.margin="0 auto"}}}),Bf.addTargetsFromObject({"wp-remixd-voice-wrapper":{selector:".wp-remixd-voice-wrapper",condition:"premium"===t&&!i,action:function(e){r.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)}}(),Qf=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Dh();case 1:return(0,t.A)(o.mark(function e(){var t;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,qf();case 1:return e.next=2,Bf.startObserving();case 2:e.next=4;break;case 3:e.prev=3,t=e.catch(0),r.A.log("Error: Failed to start ContentObserver:",t);case 4:case"end":return e.stop()}},e,null,[[0,3]])}))(),e.next=2,Yf();case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),$f=function(){var e=(0,t.A)(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Qf();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();$f()})()})();
12//# sourceMappingURL=mng-digisubs.uiHandler.bundle.js.map;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.