1let domainToNumberMap={"dailypress.com":"197837618","courant.com":"197837617","mcall.com":"197837616","orlandosentinel.com":"197837614","sun-sentinel.com":"197837613","pilotonline.com":"197837701","bostonherald.com":"239876507","advocate-news.com":"239876509","chicoer.com":"239876509","dailydemocrat.com":"239876509","marinij.com":"239876509","mendocinobeacon.com":"239876509","montereyherald.com":"239876509","orovillemr.com":"239876509","paradisepost.com":"239876509","record-bee.com":"239876509","redbluffdailynews.com":"239876509","santacruzsentinel.com":"239876509","thereporter.com":"239876509","timesheraldonline.com":"239876509","times-standard.com":"239876509","ukiahdailyjournal.com":"239876509","willitsnews.com":"239876509","morningjournal.com":"239876511","news-herald.com":"239876511","dailylocal.com":"239876512","delcotimes.com":"239876512","mainlinemedianews.com":"239876512","pottsmerc.com":"239876512","readingeagle.com":"239876512","thereporteronline.com":"239876512","timesherald.com":"239876512","trentonian.com":"239876512","twincities.com":"239876515","denverpost.com":"239876503","lowellsun.com":"239876505","nashobavalleyvoice.com":"239876505","sentinelandenterprise.com":"239876505","macombdaily.com":"239876508","themorningsun.com":"239876508","thenewsherald.com":"239876508","theoaklandpress.com":"239876508","dailyfreeman.com":"239876510","oneidadispatch.com":"239876510","saratogian.com":"239876510","troyrecord.com":"239876510","eastbaytimes.com":"239876506","mercurynews.com":"239876506","siliconvalley.com":"239876506","coloradohometownweekly.com":"239876513","dailycamera.com":"239876513","timescall.com":"239876513","broomfieldenterprise.com":"239876513","canoncitydailyrecord.com":"239876513","eptrail.com":"239876513","reporterherald.com":"239876513","akronnewsreporter.com":"239876513","brushnewstribune.com":"239876513","julesburgadvocate.com":"239876513","fortmorgantimes.com":"239876513","journal-advocate.com":"239876513","greeleytribune.com":"239876513","dailybreeze.com":"239876514","dailybulletin.com":"239876514","nydailynews.com":"197837700","excelsiorcalifornia.com":"239876514","ocregister.com":"239876514","pasadenastarnews.com":"239876514","pressenterprise.com":"239876514","presstelegram.com":"239876514","redlandsdailyfacts.com":"239876514","sbsun.com":"239876514","sgvtribune.com":"239876514","whittierdailynews.com":"239876514","dailynews.com":"239876514","baltimoresun.com":"197837615","capitalgazette.com":"197837619","chicagotribune.com":"197837611","sandiegouniontribune.com":"239876514","republicanherald.com":"239876516","standardspeaker.com":"239876516","citizensvoice.com":"239876516","thetimes-tribune.com":"239876516","wcexaminer.com":"239876516","petalumanews.com":"239876517","pressdemocrat.com":"239876517","sonomanews.com":"239876517"};let currentDomain=window.location.hostname.toLowerCase().replace(/^(www\.|preprod\.|staging\.|develop\.)/,'');let TRIB_DOMAINS=['mcall.com','courant.com','sun-sentinel.com','orlandosentinel.com','growthspotter.com','dailypress.com','pilotonline.com','nydailynews.com','baltimoresun.com','capitalgazette.com','chicagotribune.com'];const isTrib=TRIB_DOMAINS.includes(currentDomain);let gtmId=isTrib?"ma89701":"ma23578";let matherId=domainToNumberMap[currentDomain]||null;(function(cid,mkt,config,domain){var ml=document.createElement('script');var s=document.getElementsByTagName('script')[0]||document.head;var cb;try{if(!(cb=localStorage._matherVer)){throw false;}}catch(e){cb=Math.round(new Date()/1.0368e9);}ml.type='text/javascript';ml.async=true;ml.defer=true;
vendor: 2,706 bytes, lines 1-4
1ml.id='_mljs';ml.src=('https:'==window.location.protocol?'https':'http')+'://'+(domain||'js.matheranalytics.com/s')+'/'+cid+'/'+mkt+'/'+(config?config+'/': '')+'ml.js?cb='+cb;s.parentNode.insertBefore(ml,s);})(gtmId,matherId,'wp'); 2; 3/*! For license information please see mng-digisubs.sophi.bundle.js.LICENSE.txt */ 4(()=>{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:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n<l.length;n++){var o,i=l[n],p=h.p,f=i[2];e>3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&p<i[1])?(a=0,h.v=r,h.n=i[1]):p<f&&(o=e<3||i[0]>r||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function w(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:w}},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}
4,1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;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
4heckOnArticles,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),(()=>{"use strict";function e(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 t(t){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=t.apply(n,r);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}function i(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}function a(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,i(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=n(4756);function l(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 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 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}
4finally{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 l(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)?l(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 h extends Error{}function p(e,t){this.v=e,this.k=t}function f(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 w(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 y(e){return new p(e,0)}function m(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g(e,t){return e.get(w(e,t))}function v(e,t,n){m(e,t),t.set(e,n)}function A(e,t,n){return e.set(w(e,t),n),n}function E(e,t){m(e,t),t.add(e)}function S(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 b(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 T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(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 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 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 f(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)?f(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 O(e){return function(){return new N(e.apply(this,arguments))}}function N(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof p;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))})},"function"!=typeof e.return&&(this.return=void 0)}h.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,N.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},N.prototype.next=function(e){return this._invoke("next",e)},N.prototype.throw=function(e){return this._invoke("throw",e)},N.prototype.return=function(e){return this._invoke("return",e)};Error;var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},I={},k={};Object.defineProperty(k,"__esModule",{value:!0});var P=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();k.default=function(){return P.getInstance()};
4var L=C&&C.__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())})},M=C&&C.__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])}}},x=C;Object.defineProperty(I,"__esModule",{value:!0});var D=k,U="browser-tabs-lock-key",B={key:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},clear:function(){return L(x,void 0,void 0,function(){return M(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return L(x,void 0,void 0,function(){return M(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),L(this,void 0,void 0,function(){var r,o,i,a,s,c,u;return M(this,function(l){switch(l.label){case 0:r=Date.now()+G(4),o=Date.now()+n,i=U+"-"+t,a=void 0===this.storageHandler?B: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?B: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 L(this,void 0,void 0,function(){var n=this;return M(this,function(r){return setTimeout(function(){return L(n,void 0,void 0,function(){var n,r,o;return M(this,function(i){switch(i.label){case 0:return[4,D.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?B:this.storageHandler,null===(r=n.getItemSync(e))?(D.default().unlock(t),[2]):((o=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(o)),D.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(D.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return L(this,void 0,void 0,function(){return M(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
4h(function(e){return e()})},e.prototype.releaseLock=function(e){return L(this,void 0,void 0,function(){return M(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return L(this,void 0,void 0,function(){var n,r,o,i;return M(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?B:this.storageHandler,r=U+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,D.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),D.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;c<o.length;c++){var u=o[c];if(u.includes(U)){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}();I.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 F=C&&C.__assign||function(){return F=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},F.apply(this,arguments)};var X;!function(e){e.Code="code",e.ConnectCode="connect_code"}(X||(X={}));var j;var J;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(J||(J={}));Error;var V,Y;let z;if("undefined"==typeof navigator||null===(V=navigator.userAgent)||void 0===V||null===(Y=V.startsWith)||void 0===Y||!Y.call(V,"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 Z="ERR_INVALID_ARG_VALUE",Q="ERR_INVALID_ARG_TYPE";function $(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const ee=Symbol(),te=Symbol(),ne=Symbol(),re=Symbol(),oe=Symbol(),ie=Symbol(),ae=new TextEncoder,se=new TextDecoder;function ce(e){return"string"==typeof e?ae.encode(e):se.decode(e)}let ue,le;if(Uint8Array.prototype.toBase64)ue=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ue=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 de(e){return"string"==typeof e?le(e):ue(e)}le=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw $("The input to be decoded is not correctly encoded.",Z,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw $("The input to be decoded is not correctly encoded.",Z,e)}};class he extends Error{constructor(e,t){var n;super(e,t),S(this,"code",void 0),this.name=this.constructor.name,this.code=wt,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class pe extends Error{constructor(e,t){var n;super(e,t),S(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 fe(e,t,n){return new pe(e,{code:t,cause:n})}function we(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ye(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 $('"options.headers" must not include the "authorization" header name',Z);return t}function me(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw $('"options.signal" must return or be an instance of AbortSignal',Q);return t}}function ge(e){return e.includes("//")?e.replace("//","/"):e}function ve(e,t,n,r,o){try{if("number"!=typeof e||!Number.isFinite(e))throw $("".concat(n," must be a number"),Q,o);if(e>0)return;if(t){if(0!==e)throw $("".concat(n," must be a non-negative number"),Z,o);return}throw $("".concat(n," must be a positive number"),Z,o)}catch(e){if(r)throw fe(e.message,r,o);throw e}}function Ae(e,t,n,r){try{if("string"!=typeof e)throw $("".concat(t," must be a string"),Q,r);if(0===e.length)throw $("".concat(t," must not be empty"),Z,r)}catch(e){if(n)throw fe(e.message,n,r);throw e}}function Ee(e){!function(e,t){if(Ye(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;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 fe(t,At,e)}(e,t)}(e,"application/json")}function Se(){return de(crypto.getRandomValues(new Uint8Array(32)))}function be(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new he("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new he("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new he("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new he("unsupported CryptoKey algorithm name",{cause:e})}}function Te(e){const t=null==e?void 0:e[te];return"number"==typeof t&&Number.isFinite(t)?t:0}function _e(e){const t=null==e?void 0:e[ne];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Re(){return Math.floor(Date.now()/1e3)}function Oe(e){if("object"!=typeof e||null===e)throw $('"as" must be an object',Q);Ae(e.issuer,'"as.issuer"')}function Ne(e){if("object"!=typeof e||null===e)throw $('"client" must be an object',Q);Ae(e.client_id,'"client.client_id"')}function Ce(e){return Ae(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Ie(e,t){const n=e instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&Ae(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 $("".concat(t," must be a CryptoKey"),Q)}(e,t),"private"!==e.type)throw $("".concat(t," must be a private CryptoKey"),Z)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:be(r),kid:o},u=function(e,t){const n=Re()+Te(t);return{jti:Se(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===t[oe]||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 $('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Z);const r="".concat(de(ce(JSON.stringify(e))),".").concat(de(ce(JSON.stringify(t)))),o=de(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Pt(e)};case"RSA-PSS":switch(kt(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new he("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return kt(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new he("unsupported CryptoKey algorithm name",{cause:e})}(n),n,ce(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const ke=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Pe(e,t){if(t&&"https:"!==e.protocol)throw fe("only requests to HTTPS are allowed",St,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw fe("only HTTP and HTTPS requests are allowed",bt,e)}function Le(e,t,n,r){let o;if("string"!=typeof e||!(o=ke(e)))throw fe("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Ot:Nt,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Pe(o,r),o}function Me(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Le(e.mtls_endpoint_aliases[t],t,n,r):Le(e[t],t,n,r)}
4class xe extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"status",void 0),S(this,"error_description",void 0),S(this,"response",void 0),this.name=this.constructor.name,this.code=ft,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 De extends Error{constructor(e,t){var n,r;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"error_description",void 0),this.name=this.constructor.name,this.code=yt,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 Ue extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"response",void 0),S(this,"status",void 0),this.name=this.constructor.name,this.code=pt,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 Be="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",He="("+Be+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',Ge="("+Be+")\\s*=\\s*("+Be+")",We=new RegExp("^[,\\s]*("+Be+")"),Ke=new RegExp("^[,\\s]*"+He+"[,\\s]*(.*)"),Fe=new RegExp("^[,\\s]*"+Ge+"[,\\s]*(.*)"),Xe=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function je(e,t,n){if(e.status!==t){let t;var r;if(nt(e),t=await async function(e){if(e.status>399&&e.status<500){It(e),Ee(e);try{const t=await e.clone().json();if(we(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new xe("server responded with an error in the response body",{cause:t,response:e});throw fe('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Et,e)}}function Je(e){if(!st.has(e))throw $('"options.DPoP" is not a valid DPoPHandle',Z)}const Ve=Symbol();function Ye(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function ze(e,t,n,r,o){if(Oe(e),Ne(t),!q(r,Response))throw $('"response" must be an instance of Response',Q);if(nt(r),200!==r.status)throw fe('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',Et,r);let i;if(It(r),"application/jwt"===Ye(r)){const n=await Lt(await r.text(),Mt.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),Te(t),_e(t),null==o?void 0:o[ie]).then(rt.bind(void 0,t.client_id)).then(it.bind(void 0,e)),i=n.claims,a=n.jwt;$e.set(r,a)}else{if(t.userinfo_signed_response_alg)throw fe("JWT UserInfo Response expected",mt,r);await Bt(r)}if(Ae(i.sub,'"response" body "sub" property',vt,{body:i}),n===Ve);else if(Ae(n,'"expectedSubject"'),i.sub!==n)throw fe('unexpected "response" body "sub" property value',Rt,{expected:n,body:i,attribute:"sub"});return i}async function qe(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[re])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:me(r,null==a?void 0:a.signal)})}async function Ze(e,t,n,r,o,i){var a;const s=Me(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[ee]));o.set("grant_type",r);const c=ye(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Je(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await qe(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Qe=new WeakMap,$e=new WeakMap;function et(e){if(!e.id_token)return;const t=Qe.get(e);if(!t)throw $('"ref" was already garbage collected or did not resolve from the proper sources',Z);return t}
4async function tt(e,t,n,r,o,i){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,200,"Token Endpoint"),It(n);const a=await Bt(n);if(Ae(a.access_token,'"response" body "access_token" property',vt,{body:a}),Ae(a.token_type,'"response" body "token_type" property',vt,{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;ve(e,!0,'"response" body "expires_in" property',vt,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Ae(a.refresh_token,'"response" body "refresh_token" property',vt,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw fe('"response" body "scope" property must be a string',vt,{body:a});if(void 0!==a.id_token){Ae(a.id_token,'"response" body "id_token" property',vt,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(ve(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await Lt(a.id_token,Mt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Te(t),_e(t),o).then(lt.bind(void 0,i)).then(at.bind(void 0,e)).then(ot.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 fe('ID Token "aud" (audience) claim includes additional untrusted audiences',_t,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw fe('unexpected ID Token "azp" (authorized party) claim value',_t,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&ve(c.auth_time,!0,'ID Token "auth_time" (authentication time)',vt,{claims:c}),$e.set(n,u),Qe.set(a,c)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new he("unsupported `token_type` value",{cause:{body:a}});return a}function nt(e){let t;if(t=function(e){if(!q(e,Response))throw $('"response" must be an instance of Response',Q);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(We);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let p;if(d)for(;r;){let n,o;if(t=r.match(Ke)){var i=R(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(Fe))){if(t=r.match(Xe)){if(Object.keys(h).length)break;var a=R(t,3);p=a[1],r=a[2];break}return}var s=R(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new Ue("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function rt(e,t){return void 0!==t.claims.aud?ot(e,t):t}function ot(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw fe('unexpected JWT "aud" (audience) claim value',_t,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw fe('unexpected JWT "aud" (audience) claim value',_t,{expected:e,claims:t.claims,claim:"aud"});return t}function it(e,t){return void 0!==t.claims.iss?at(e,t):t}function at(e,t){var n,r;const o=null!==(n=null===(r=e[Gt])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw fe('unexpected JWT "iss" (issuer) claim value',_t,{expected:o,claims:t.claims,claim:"iss"});return t}const st=new WeakSet,ct=Symbol(),ut={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 lt(e,t){for(const n of e)if(void 0===t.claims[n])throw fe('JWT "'.concat(n,'" (').concat(ut[n],") claim missing"),vt,{claims:t.claims});return t}const dt=Symbol(),ht=Symbol();const pt="OAUTH_WWW_AUTHENTICATE_CHALLENGE",ft="OAUTH_RESPONSE_BODY_ERROR",wt="OAUTH_UNSUPPORTED_OPERATION",yt="OAUTH_AUTHORIZATION_RESPONSE_E
4RROR",mt="OAUTH_JWT_USERINFO_EXPECTED",gt="OAUTH_PARSE_ERROR",vt="OAUTH_INVALID_RESPONSE",At="OAUTH_RESPONSE_IS_NOT_JSON",Et="OAUTH_RESPONSE_IS_NOT_CONFORM",St="OAUTH_HTTP_REQUEST_FORBIDDEN",bt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Tt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",_t="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Rt="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Ot="OAUTH_MISSING_SERVER_METADATA",Nt="OAUTH_INVALID_SERVER_METADATA";async function Ct(e){if(!q(e,Response))throw $('"response" must be an instance of Response',Q);await je(e,200,"Revocation Endpoint")}function It(e){if(e.bodyUsed)throw $('"response" body has been used already',Z)}function kt(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new he("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Pt(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new he("unsupported ECDSA namedCurve",{cause:e})}}async function Lt(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new he("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw fe("Invalid JWT",vt,e);try{i=JSON.parse(ce(de(c)))}catch(e){throw fe("failed to parse JWT Header body as base64url encoded JSON",gt,e)}if(!we(i))throw fe("JWT Header must be a top level object",vt,e);if(t(i),void 0!==i.crit)throw new he('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(ce(de(u)))}catch(e){throw fe("failed to parse JWT Payload body as base64url encoded JSON",gt,e)}if(!we(a))throw fe("JWT Payload must be a top level object",vt,e);const h=Re()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw fe('unexpected JWT "exp" (expiration time) claim type',vt,{claims:a});if(a.exp<=h-r)throw fe('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Tt,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw fe('unexpected JWT "iat" (issued at) claim type',vt,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw fe('unexpected JWT "iss" (issuer) claim type',vt,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw fe('unexpected JWT "nbf" (not before) claim type',vt,{claims:a});if(a.nbf>h+r)throw fe('unexpected JWT "nbf" (not before) claim value',Tt,{claims:a,now:h,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw fe('unexpected JWT "aud" (audience) claim type',vt,{claims:a});return{header:i,claims:a,jwt:e}}function Mt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw fe('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 fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:e,reason:"client configuration"})}function xt(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw fe('"'.concat(t,'" parameter must be provided only once'),vt);return r}const Dt=Symbol(),Ut=Symbol();async function Bt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee;try{t=await e.json()}catch(t){throw n(e),fe('failed to parse "response" body as JSON',gt,t)}if(!we(t))throw fe('"response" body must be a top level object',vt,{body:t});return t}const Ht=Symbol(),Gt=Symbol(),Wt=new TextEncoder,Kt=new TextDecoder,Ft=new TextDecoder("utf-8",{fatal:!0});function Xt(){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 jt(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 Jt=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const Vt=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)};
4class Yt extends Error{constructor(e,t){var n;super(e,t),S(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}S(Yt,"code","ERR_JOSE_GENERIC");class zt extends Yt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(zt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class qt extends Yt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_EXPIRED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(qt,"code","ERR_JWT_EXPIRED");class Zt extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}S(Zt,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Qt extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_NOT_SUPPORTED")}}S(Qt,"code","ERR_JOSE_NOT_SUPPORTED"),S(class extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),S(class extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class $t extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWS_INVALID")}}S($t,"code","ERR_JWS_INVALID");class en extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWT_INVALID")}}S(en,"code","ERR_JWT_INVALID"),S(class extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class tn extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWKS_INVALID")}}S(tn,"code","ERR_JWKS_INVALID");class nn extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}S(nn,"code","ERR_JWKS_NO_MATCHING_KEY");class rn extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),S(this,Symbol.asyncIterator,O(function*(){})),S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}S(rn,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class on extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_TIMEOUT")}}S(on,"code","ERR_JWKS_TIMEOUT");class an extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}S(an,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const sn=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function cn(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 un="The input to be decoded is not correctly encoded.";function ln(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Kt.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(un,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Kt.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(un);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return cn(t)}catch(e){throw new TypeError(un)}}function dn(e){let t=e;return"string"==typeof t&&(t=Wt.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 hn(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 pn(e){return hn(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(hn)}function fn(e,t,n){try{return ln(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function wn(e,t){var n,r,o,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new Qt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new Qt('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=T({},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 yn(e){return T({__proto__:null},e)}const mn=e=>e[Symbol.toStringTag];function gn(e,t,n){const r=e.alg,o=e.secret,i="decrypt"===n||"sign"===n;if(o&&t instanceof Uint8Array)return[vn,t];if(hn(t)){const a=function(e){const t=yn(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?Vt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Vt(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),[Sn,t,a]}if(!(e=>sn(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(o?Vt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Vt(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if("secret"!==t.type)throw new TypeError("".concat(mn(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(mn(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(mn(t)," instances for asymmetric algorithm ").concat(r,' must be of type "').concat(e,'"'))}}return sn(t)?[An,t]:[En,t]}const vn=0,An=1,En=2,Sn=3;let bn;const Tn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};
4function _n(e,t,n){bn||(bn=new WeakMap);const r=bn.get(e);return n&&(r?r[t]=n:bn.set(e,{[t]:n})),null!=n?n:null==r?void 0:r[t]}const Rn=async(e,t,n)=>{var r;return null!==(r=_n(e,n.alg))&&void 0!==r?r:_n(e,n.alg,await wn(n,T(T({},t),{},{alg:n.alg})))};async function On(e,t,n){const r=gn(e,t,n);switch(r[0]){case vn:case An:return r[1];case Sn:{const t=r[1],n=r[2];if("oct"===n.kty)return ln(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return Rn(t,n,e)}case En:{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=_n(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,u=Tn[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 _n(e,t.alg,e.toCryptoKey(l,a,s))})(t,e):Rn(t,t.export({format:"jwk"}),e)}}}function Nn(e){const t={__proto__:null};for(const n in e)t[n]=T(T({},e[n]),{},{alg:n});return t}const Cn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],In=[[],["deriveBits"]],kn=[[],[]];function Pn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:Cn,ops:["wrapKey","unwrapKey"]}}function Ln(){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 Qt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:In,ops:[void 0,"deriveBits"]}}function Mn(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:kn,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function xn(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:kn,ops:["deriveBits","deriveBits"]}}const Dn=Nn({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:kn,ops:["encrypt","decrypt"]},"RSA-OAEP":Pn(1),"RSA-OAEP-256":Pn(256),"RSA-OAEP-384":Pn(384),"RSA-OAEP-512":Pn(512),"ECDH-ES":Ln(),"ECDH-ES+A128KW":Ln(),"ECDH-ES+A192KW":Ln(),"ECDH-ES+A256KW":Ln(),A128KW:Mn(128),A192KW:Mn(192),A256KW:Mn(256),A128GCMKW:Mn(128,!0),A192GCMKW:Mn(192,!0),A256GCMKW:Mn(256,!0),"PBES2-HS256+A128KW":xn(),"PBES2-HS384+A192KW":xn(),"PBES2-HS512+A256KW":xn()}),Un=["encrypt","decrypt"];function Bn(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:kn,ops:Un,cekBits:e,ivBits:t?128:96,cbc:t}}Nn({A128GCM:Bn(128),A192GCM:Bn(192),A256GCM:Bn(256),"A128CBC-HS256":Bn(256,!0),"A192CBC-HS384":Bn(384,!0),"A256CBC-HS512":Bn(512,!0)});const Hn={__proto__:null,b64:!0};function Gn(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 Wn(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:T(T({__proto__:null},n),t);for(const t of r.crit){if(!(t in i))throw new Qt('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 Kn(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new $t('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Fn,Xn;let jn,Jn;if("undefined"==typeof navigator||null===(Fn=navigator.userAgent)||void 0===Fn||null===(Xn=Fn.startsWith)||void 0===Xn||!Xn.call(Fn,"Mozilla/5.0 ")){const e="v6.8.4";Jn="".concat("openid-client","/").concat(e),jn={"user-agent":Jn}}const Vn=e=>Yn.get(e);let Yn,zn;function qn(e){return void 0!==e?Ce(e):(zn||(zn=new WeakMap),(e,t,n,r)=>{let o;return(o=zn.get(t))||(function(e,t){if("string"!=typeof e)throw tr("".concat(t," must be a string"),er);if(0===e.length)throw tr("".concat(t," must not be empty"),$n)}(t.client_secret,'"metadata.client_secret"'),o=Ce(t.client_secret),zn.set(t,o)),o(e,t,n,r)})}const Zn=Ve,Qn=re,$n="ERR_INVALID_ARG_VALUE",er="ERR_INVALID_ARG_TYPE";function tr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}
4class nr extends Error{constructor(e,t){var n;super(e,t),S(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function rr(e,t,n){return new nr(e,{cause:t,code:n})}function or(e){if(e instanceof TypeError||e instanceof nr||e instanceof xe||e instanceof De||e instanceof Ue)throw e;if(e instanceof pe)switch(e.code){case St:throw rr("only requests to HTTPS are allowed",e,e.code);case bt:throw rr("only requests to HTTP or HTTPS are allowed",e,e.code);case Et:throw rr("unexpected HTTP response status code",e.cause,e.code);case At:throw rr("unexpected response content-type",e.cause,e.code);case gt:throw rr("parsing error occured",e,e.code);case vt:throw rr("invalid response encountered",e,e.code);case _t:throw rr("unexpected JWT claim value encountered",e,e.code);case Rt:throw rr("unexpected JSON attribute value encountered",e,e.code);case Tt:throw rr("JWT timestamp claim value failed validation",e,e.code);default:throw rr(e.message,e,e.code)}if(e instanceof he)throw rr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw rr("runtime operation error",e,wt);case"NotSupportedError":throw rr("runtime unsupported operation",e,wt);case"TimeoutError":throw rr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw rr("operation aborted",e,"OAUTH_ABORT")}throw new nr("something went wrong",{cause:e})}async function ir(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw tr('"server" must be an instance of URL',er);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 $('"'.concat("issuerIdentifier",'" must be an instance of URL'),Q);Pe(e,!0!==(null==r?void 0:r[ee]));const o=n(new URL(e.href)),i=ye(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[re])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:me(o,null==r?void 0:r.signal)}
4)}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=ge("".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=ge("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw $('"options.algorithm" must be "oidc" (default), or "oauth2"',Z)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[re]:null==t?void 0:t[Qn],[ee]:null==t||null===t.execute||void 0===r?void 0:r.includes(pr),signal:a,headers:new Headers(jn)}):((null==t?void 0:t[Qn])||fetch)((Pe(e,null==t||null===t.execute||void 0===c||!c.includes(pr)),e.href),{headers:Object.fromEntries(new Headers(T({accept:"application/json"},jn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Ht)throw $('"expectedIssuerIdentifier" must be an instance of URL',Q);if(!q(t,Response))throw $('"response" must be an instance of Response',Q);if(200!==t.status)throw fe('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Et,t);It(t);const r=await Bt(t);if(Ae(r.issuer,'"response" body "issuer" property',vt,{body:r}),n!==Ht&&new URL(r.issuer).href!==n.href)throw fe('"response" body "issuer" property does not match the expected value',Rt,{expected:n.href,body:r,attribute:"issuer"});return r}(Ht,e)).catch(or);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[ar]=!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 nr("discovered metadata issuer does not match the expected issuer",{code:Rt,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new sr(i,t,n,r);let s=Vn(a);if(null!=o&&o[Qn]&&(s.fetch=o[Qn]),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 ar=Symbol();class sr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw tr('"clientId" must be a non-empty string',er);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 tr('"clientId" and "metadata.client_id" must be the same',$n);const u=T(T({},structuredClone(n)),{},{client_id:t});let l;u[te]=null!==(i=null===(a=n)||void 0===a?void 0:a[te])&&void 0!==i?i:0,u[ne]=null!==(s=null===(c=n)||void 0===c?void 0:c[ne])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?qn(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);ar in e&&(h[Gt]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Yn||(Yn=new WeakMap),Yn.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Vn(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(Vn(this).c)}get timeout(){return Vn(this).timeout}set timeout(e){Vn(this).timeout=e}get[Qn](){return Vn(this).fetch}set[Qn](e){Vn(this).fetch=e}}function cr(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()}
4return{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 et(this)}catch(e){return}}}}}(e))}async function ur(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===e.headers.get("retry-after")||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&Math.ceil(n/1e3)}}if(o&&!Number.isFinite(a))throw new pe("invalid Retry-After header value",{cause:e});a>t&&await lr(a-t,n)}function lr(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 dr(e,t){vr(e);const n=Vn(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){Oe(e),Ne(t);const i=Me(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ee])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=ye(null==o?void 0:o.headers);return s.set("accept","application/json"),qe(e,t,n,i,a,s,o)}(r,o,i,t,{[re]:a,[ee]:!s,headers:new Headers(jn),signal:Ar(c)}).then(e=>async function(e,t,n){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,200,"Backchannel Authentication Endpoint"),It(n);const r=await Bt(n);Ae(r.auth_req_id,'"response" body "auth_req_id" property',vt,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ve(o,!0,'"response" body "expires_in" property',vt,{body:r}),r.expires_in=o,void 0!==r.interval&&ve(r.interval,!1,'"response" body "interval" property',vt,{body:r}),r}(r,o,e)).catch(or)}async function hr(e,t,n,r){var o,i;vr(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 lr(a,s)}catch(e){or(e)}const c=Vn(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,w=c.timeout,y=c.decrypt,m=(o,i)=>hr(e,T(T({},t),{},{interval:o}),n,T(T({},r),{},{signal:s,flag:i})),g=function(e,t){const n=Ar(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,w),v=await async function(e,t,n,r,o){Oe(e),Ne(t),Ae(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Ze(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[re]:h,[ee]:!p,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:g.signal}).catch(or).finally(g.cleanup);var A;if(503===v.status&&v.headers.has("retry-after"))return await ur(v,a,s,!0),await(null===v.body||void 0===A?void 0:A.cancel()),m(a);const E=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(u,l,v,{[ie]:y});let S;try{await E}catch(e){if(Sr(e,r))return m(a,br);if(e instanceof xe)switch(e.error){case"slow_down":0;case"authorization_pending":return await ur(e.response,a,s),m(a)}or(e)}return S.id_token&&await(null==f?void 0:f(v)),cr(S),S}function pr(e){Vn(e).tlsOnly=!1}async function fr(e,t,n,r,o){if(vr(e),!((null==o?void 0:o.flag)===br||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw tr('"currentUrl" must be an instance of URL, or Request',er);let i,a;const s=Vn(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,w=s.nonRepudiation,y=s.timeout,m=s.decrypt,g=s.implicit;if((null==o?void 0:o.flag)===br)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 $("form_post responses are expected to use the POST method",Z,{cause:e});if("application/x-www-form-urlencoded"!==Ye(e))throw $("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Z,{cause:e});return async function(e){if(e.bodyUsed)throw $("form_post Request instances must contain a readable body",Z,{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],r=v[1];t.searchParams.append(n,r)}break;default:throw tr("unexpected Request HTTP method",$n)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!p:await p(t,null==n?void 0:n.expectedState);break;case!!f:await f(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(Oe(e),Ne(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw $('"parameters" must be an instance of URLSearchParams, or URL',Q);if(xt(n,"response"))throw fe('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',vt,{parameters:n});
4const o=xt(n,"iss"),i=xt(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw fe('response parameter "iss" (issuer) missing',vt,{parameters:n});if(o&&o!==e.issuer)throw fe('unexpected "iss" (issuer) response parameter value',vt,{expected:e.issuer,parameters:n});switch(r){case void 0:case Ut:if(void 0!==i)throw fe('unexpected "state" response parameter encountered',vt,{expected:void 0,parameters:n});break;case Dt:break;default:if(Ae(r,'"expectedState" argument'),i!==r)throw fe(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',vt,{expected:r,parameters:n})}if(xt(n,"error"))throw new De("authorization response from the server is an error",{cause:n});const a=xt(n,"id_token"),s=xt(n,"token");if(void 0!==a||void 0!==s)throw new he("implicit and hybrid flows are not supported");return new URLSearchParams(n),st.add(c),c;var c})(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){or(e)}}}const A=await async function(e,t,n,r,o,i,a){if(Oe(e),Ne(t),!st.has(r))throw $('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Z);Ae(o,'"redirectUri"');const s=xt(r,"code");if(!s)throw fe('no authorization code in "callbackParameters"',vt);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==ct&&(Ae(i,'"codeVerifier"'),c.set("code_verifier",i)),Ze(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||ct,{additionalParameters:r,[re]:d,[ee]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(jn),signal:Ar(y)}).catch(or);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const E=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];
4switch(r){case void 0:0;break;case dt:break;default:Ae(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case ht:break;default:ve(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await tt(e,t,n,s,i,a);Ae(c.id_token,'"response" body "id_token" property',vt,{body:c});const u=et(c);if(o!==ht){const e=Re()+Te(t),n=_e(t);if(u.auth_time+o<e-n)throw fe("too much time has elapsed since the last End-User authentication",Tt,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(r===dt){if(void 0!==u.nonce)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==r)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:r,claims:u,claim:"nonce"});return c}(e,t,n,r.expectedNonce,r.maxAge,r[ie],r.recognizedTokenTypes):async function(e,t,n,r,o){const i=await tt(e,t,n,void 0,r,o),a=et(i);if(a){if(void 0!==t.default_max_age){ve(t.default_max_age,!0,'"client.default_max_age"');const e=Re()+Te(t),n=_e(t);if(a.auth_time+t.default_max_age<e-n)throw fe("too much time has elapsed since the last End-User authentication",Tt,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(c,u,A,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[ie]:m});let S;try{await E}catch(t){if(Sr(t,o))return fr(e,void 0,n,r,T(T({},o),{},{flag:br,authResponse:i,redirectUri:a}));or(t)}return S.id_token&&await(null==w?void 0:w(A)),cr(S),S}async function wr(e,t,n,r){vr(e),new URLSearchParams(n);const o=Vn(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,p=await async function(e,t,n,r,o){Oe(e),Ne(t),Ae(r,'"refreshToken"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("refresh_token",r),Ze(e,t,n,"refresh_token",i,o)}(i,a,s,t,{[re]:c,[ee]:!u,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(d)}).catch(or),f=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[ie]:h});let w;try{await f}catch(o){if(Sr(o,r))return wr(e,t,n,T(T({},r),{},{flag:br}));or(o)}return w.id_token&&await(null==l?void 0:l(p)),cr(w),w}async function yr(e,t,n){vr(e),new URLSearchParams(t);const r=Vn(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 Oe(e),Ne(t),Ze(e,t,n,"client_credentials",new URLSearchParams(r),o)}(o,i,a,t,{[re]:s,[ee]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(jn),signal:Ar(u)}).catch(or),d=async function(e,t,n){return tt(e,t,n,void 0,void 0,void 0)}(o,i,l);let h;try{await d}catch(r){if(Sr(r,n))return yr(e,t,T(T({},n),{},{flag:br}));or(r)}return cr(h),h}function mr(e,t){vr(e);const n=Vn(e),r=n.as,o=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,u=Me(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 tr("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",$n);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=R(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function gr(e,t,n){vr(e);const r=mr(e,t),o=Vn(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;Oe(e),Ne(t);const a=Me(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ee])),s=new URLSearchParams(r);s.set("client_id",t.client_id);const c=ye(null==o?void 0:o.headers);c.set("accept","application/json"),void 0!==(null==o?void 0:o.DPoP)&&(Je(o.DPoP),await o.DPoP.addProof(a,c,"POST"));const u=await qe(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,{[re]:c,[ee]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or),h=async function(e,t,n){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,201,"Pushed Authorization Request Endpoint"),It(n);const r=await Bt(n);Ae(r.request_uri,'"response" body "request_uri" property',vt,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ve(o,!0,'"response" body "expires_in" property',vt,{body:r}),r.expires_in=o,r}(i,a,d);let p;try{await h}catch(r){if(Sr(r,n))return gr(e,t,T(T({},n),{},{flag:br}));or(r)}return mr(e,{request_uri:p.request_uri})}function vr(e){if(!(e instanceof sr))throw tr('"config" must be an instance of Configuration',er);if(Object.getPrototypeOf(e)!==sr.prototype)throw tr("subclassing Configuration is not allowed",$n)}function Ar(e){return e?AbortSignal.timeout(1e3*e):void 0}async function Er(e,t,n,r){vr(e);const o=Vn(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){Oe(e),Ne(t);const o=Me(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[ee])),i=ye(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(Ae(e,'"accessToken"'),!(n instanceof URL))throw $('"url" must be an instance of URL',Q);Pe(n,!0!==(null==i?void 0:i[ee])),ye(r),null!=i&&i.DPoP&&(Je(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[re])||fetch)(n.href,{duplex:q(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:me(n,null==i?void 0:i.signal)}
4);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(s,n),s}(n,0,o,i,0,T(T({},r),{},{[te]:Te(t)}))}(i,a,t,{[re]:s,[ee]:!c,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or);let p,f=ze(i,a,n,h,{[ie]:d});try{await f}catch(o){if(Sr(o,r))return Er(e,t,n,T(T({},r),{},{flag:br}));or(o)}return"application/jwt"===Ye(h)&&await(null==u?void 0:u(h)),p}function Sr(e,t){return!(null==t||!t.DPoP||t.flag===br)&&function(e){if(e instanceof Ue){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof xe&&"use_dpop_nonce"===e.error}(e)}Object.freeze(sr.prototype);const br=Symbol();async function Tr(e,t,n,r){vr(e);const o=Vn(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,p=await async function(e,t,n,r,o,i){return Oe(e),Ne(t),Ae(r,'"grantType"'),Ze(e,t,n,r,new URLSearchParams(o),i)}(i,a,s,t,new URLSearchParams(n),{[re]:c,[ee]:!u,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or);let f;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(f={n_a:()=>{}});const w=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[ie]:d,recognizedTokenTypes:f});let y;try{y=await w}catch(o){if(Sr(o,r))return Tr(e,t,n,T(T({},r),{},{flag:br}));or(o)}return y.id_token&&await(null==h?void 0:h(p)),cr(y),y}async function _r(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 Jt(t.name);if(t.hash&&(null===(r=o.hash)||void 0===r?void 0:r.name)!==t.hash)throw Jt(t.hash,"algorithm.hash");if(t.namedCurve&&o.namedCurve!==t.namedCurve)throw Jt(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&o.length!==t.length)throw Jt(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 Rr=[["verify"],["sign"]];function Or(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:Rr}}function Nr(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:Rr,minRsaBits:2048}}function Cr(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:Rr}}function Ir(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:Rr}}function kr(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:Rr}}const Pr=Nn({HS256:Or(256),HS384:Or(384),HS512:Or(512),RS256:Nr(256),RS384:Nr(384),RS512:Nr(512),PS256:Nr(256,32),PS384:Nr(384,48),PS512:Nr(512,64),ES256:Cr("P-256",256),ES384:Cr("P-384",384),ES512:Cr("P-521",512),EdDSA:Ir(),Ed25519:Ir(),"ML-DSA-44":kr(44),"ML-DSA-65":kr(65),"ML-DSA-87":kr(87)});function Lr(e){const t="string"==typeof e?Pr[e]:void 0;if(!t)throw new Qt("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function Mr(e,t,n){if(e instanceof Uint8Array&&Kt.decode(e),"string"!=typeof e)throw new $t("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 $t("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(Ft.decode(ln(e)))}catch(e){throw new t(n)}if(!hn(r))throw new t(n);return r}(e,$t,"JWS Protected Header is invalid");return t}(o),u=function(e,t,n){const r=Kn(e,Wn($t,Hn,n[1],e,t)),o=t.alg;if("string"!=typeof o||!o)throw new $t('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(o))throw new Zt('"alg" (Algorithm) Header Parameter value not allowed');return[r,o]}
4(c,c,t),l=R(u,2),d=l[0],h=l[1],p=d?i:function(e){try{return jt(e)}catch(e){throw new $t("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=Lr(i),d=Xt(void 0!==r?jt(r):new Uint8Array,jt("."),u?null!==t[2]&&void 0!==s?s:t[2]=function(e,t,n){try{return jt(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,$t):a),h=fn(e.signature,"signature",$t),p=await On(l,n,"verify");if(!await async function(e,t,n,r){const o=await _r(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,n,r)}catch(e){return!1}}(l,p,h,d))throw new an;return[u?fn(a,"payload",$t):a,o,u,p,c]}(s,t,n,o,c,h,p)}const xr=e=>Math.floor(e.getTime()/1e3),Dr={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Ur=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Br="check_failed";function Hr(){throw new TypeError("Invalid time period format")}function Gr(e){"string"!=typeof e&&Hr();const t=Ur.exec(e);(!t||t[4]&&t[1])&&Hr();const n=parseFloat(t[2]),r=Math.round(n*Dr[t[3][0].toLowerCase()]);return Number.isFinite(r)||Hr(),"-"===t[1]||"ago"===t[4]?-r:r}function Wr(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function Kr(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Fr(e,t){return"number"==typeof e?Wr(t,e):e instanceof Date?Wr(t,xr(e)):xr(new Date)+Gr(e)}const Xr=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function jr(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 zt('"'.concat(t,'" claim must be a number'),e,t,"invalid");return r}}function Jr(e,t){throw new zt('unexpected "'.concat(t,'" claim value'),e,t,Br)}function Vr(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Ft.decode(t))}catch(e){}if(!hn(n))throw new en("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(void 0!==o&&("string"!=typeof e.typ||Xr(e.typ)!==Xr(o)))throw new zt('unexpected "typ" JWT header value',n,"typ",Br);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 zt('missing required "'.concat(e,'" claim'),n,e,"missing");var h,p;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||Jr(n,"iss"),void 0!==c&&n.sub!==c&&Jr(n,"sub"),void 0===u||("string"==typeof n.aud?p.includes(h):Array.isArray(h)&&p.some(e=>h.includes(e)))||Jr(n,"aud");const f=r.clockTolerance;let w=0;if("string"==typeof f)Gr(f);else if(void 0!==f){if("number"!=typeof f)throw new TypeError("Invalid clockTolerance option type");0}Wr("clockTolerance option",w);const y=r.currentDate,m=Wr("currentDate option",xr(void 0===y?new Date:y)),g=jr(n,"iat",void 0!==l),v=jr(n,"nbf");if(void 0!==v&&v>m+w)throw new zt('"nbf" claim timestamp check failed',n,"nbf",Br);const A=jr(n,"exp");if(void 0!==A&&A<=m-w)throw new qt('"exp" claim timestamp check failed',n,"exp",Br);if(void 0!==l){const e=m-g;if(e-w>Wr("maxTokenAge option","number"==typeof l?l:Gr(l)))throw new qt('"iat" claim timestamp check failed (too far in the past)',n,"iat",Br);if(e<-w)throw new zt('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Br)}return n}let Yr;function zr(e){return Yr.get(e)}async function qr(e,t,n,r,o){const i=R(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)}catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!hn(r))throw new e("JOSE Header is not a JSON object");return[r,n]}($t,e);return[t[0],dn(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new $t("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')}($t,e),Kn(e,Wn($t,Hn,n,e,t))})(a,a,n)||o();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new $t('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Lr(t)}(a),u=dn(e),l=await async function(e,t,n,r){const o=Xt(jt(e),jt("."),t),i=await On(n,r,"sign");return dn(await async function(e,t,n){const r=await _r(e,t,"sign"),o=await crypto.subtle.sign(e.signing,r,n);return new Uint8Array(o)}(n,i,o))}(s,jt(u),c,r);return"".concat(s,".").concat(u,".").concat(l)}const Zr=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!hn(e))throw new TypeError("JWT Claims Set MUST be an object");(Yr||(Yr=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return Kr("iss",e),zr(this).iss=e,this}setSubject(e){return Kr("sub",e),zr(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 str
4ings')}(e),zr(this).aud=e,this}setJti(e){return Kr("jti",e),zr(this).jti=e,this}setNotBefore(e){return zr(this).nbf=Fr(e,"setNotBefore"),this}setExpirationTime(e){return zr(this).exp=Fr(e,"setExpirationTime"),this}setIssuedAt(e){return zr(this).iat=void 0===e?xr(new Date):"string"==typeof e?Wr("setIssuedAt",xr(new Date)+Gr(e)):Fr(e,"setIssuedAt"),this}};var Qr=new WeakMap;class $r extends Zr{constructor(){super(...arguments),v(this,Qr,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(g(Qr,this)),A(Qr,this,e),this}async sign(e,t){return qr(function(e){const t=zr(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 Wt.encode(JSON.stringify(t))}(this),g(Qr,this),null==t?void 0:t.crit,e,()=>{throw new en("JWTs MUST NOT use unencoded payload")})}}const eo='"alg" (Algorithm)';function to(){throw new Qt("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const no=(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},ro=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},oo=e=>{const t=ro(e);if(128&t){const n=127&t;let r=0;for(let t=0;t<n;t++)r=r<<8|ro(e);return r}return t},io=(e,t,n)=>{if(ro(e)!==t)throw new Error(n)},ao=(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},so=e=>{const t=(e=>{io(e,6,"Expected algorithm OID");const t=oo(e);return ao(e,t)})(e);if(no(t,[43,101,110]))return"X25519";if(!no(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");io(e,6,"Expected curve OID");const n=oo(e),r=ao(e,n);if(no(r,[42,134,72,206,61,3,1,7]))return"P-256";if(no(r,[43,129,4,0,34]))return"P-384";if(no(r,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},co=(e,t,n)=>{const r=(e=>cn(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=Pr[e])&&void 0!==r?r:Dn[e]:void 0)&&void 0!==n?n:to(t)}(n,eo);i.secret&&to(eo);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(io(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),oo(e),"pkcs8"===t){io(e,2,"Expected version field");const t=oo(e);e.pos+=t}io(e,48,"Expected algorithm identifier"),oo(e)}(n,e),s=i.resolve({crv:so(n)})}catch(e){throw new Qt("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 uo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t),o=n.alg;if(void 0===r[o]){const e=await wn(n,T(T({},t),{},{alg:o,ext:!0}));if("public"!==e.type)throw new tn("JSON Web Key Set members must be public keys");r[o]=e}return r[o]}function lo(e){let t;try{structuredClone(e)}catch(e){}if(!pn(t))throw new tn("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,r)=>{const o=T(T({},e),null==r?void 0:r.header),i=o.alg,a=o.kid,s="string"==typeof i?Pr[i]:void 0;if(!s||s.secret)throw new Qt('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,r){const o=yn(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 nn;if(1!==l){const e=new rn;throw e[Symbol.asyncIterator]=O(function*(){for(const e of c)try{yield yield y(uo(n,e,s))}catch(e){}}),e}return uo(n,u,s)},"jwks",{value:()=>structuredClone(t)})}var ho,po;let fo;
4if("undefined"==typeof navigator||null===(ho=navigator.userAgent)||void 0===ho||null===(po=ho.startsWith)||void 0===po||!po.call(ho,"Mozilla/5.0 ")){const e="v6.2.10";fo="".concat("jose","/").concat(e)}const wo=Symbol(),yo=Symbol();function mo(e,t){return Number.isFinite(e)&&Date.now()<e+t}function go(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 vo(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return co(e,t,n)}const Ao=["mfaToken"],Eo=["mfaToken"];var So,bo,To,_o,Ro,Oo,No,Co,Io,ko,Po,Lo,Mo,xo,Do,Uo,Bo,Ho,Go,Wo,Ko,Fo,Xo,jo,Jo,Vo,Yo,zo,qo,Zo,Qo,$o,ei,ti,ni,ri,oi,ii,ai,si,ci,ui,li,di,hi,pi,fi,wi,yi,mi,gi,vi;function Ai(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 Ei(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 Si=class extends Error{constructor(e,t){super(t),S(this,"code",void 0),this.name="NotSupportedError",this.code=e}},bi=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(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=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ti=class extends bi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},_i=class extends bi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Ri=class extends bi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Oi=class extends bi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ni=class extends bi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Ci=class extends bi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Ii=class extends bi{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},ki=class extends bi{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}},Pi=class extends Error{constructor(e){super(e),S(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Li=class extends bi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),S(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Mi=class extends bi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},xi=class extends bi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Di=class extends bi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Ui=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),S(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}}
4,Bi=class extends Error{constructor(e){super(e),S(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Hi=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),S(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function Gi(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function Wi(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=Gi(i.headers))}function Ki(e){return Object.entries(e).filter(e=>void 0!==R(e,2)[1]).reduce((e,t)=>T(T({},e),{},{[t[0]]:t[1]}),{})}function Fi(e){if(!e.trim())throw new Bi("organization must not be blank")}function Xi(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new Bi("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new Bi('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 Bi("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new Bi('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var ji=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ji=class extends ji{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Vi=class extends ji{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Yi=class extends ji{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},zi=class extends ji{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},qi=class extends ji{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function Zi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Qi=class e{constructor(e,t,n,r,o,i,a){S(this,"accessToken",void 0),S(this,"idToken",void 0),S(this,"refreshToken",void 0),S(this,"expiresAt",void 0),S(this,"scope",void 0),S(this,"claims",void 0),S(this,"authorizationDetails",void 0),S(this,"tokenType",void 0),S(this,"issuedTokenType",void 0),S(this,"recoveryCode",void 0),S(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 $i(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,T(T({},n),{},{headers:o}))}}function ea(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 ta(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 na(e,t,n){if(!t)return e;const r=t.signal,o=t.headers,i=t.customFetch,a=i?$i(i,n):e;return r||o?async(e,t)=>{const n=o?new Headers(e instanceof Request?e.headers:void 0):void 0;
4if(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=R(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,T(T(T({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var ra={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
4overy-code"},oa=(So=new WeakMap,bo=new WeakMap,To=new WeakMap,_o=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,No=new WeakMap,Co=new WeakSet,class{constructor(e){var t,n;E(this,Co),v(this,So,void 0),v(this,bo,void 0),v(this,To,void 0),v(this,_o,void 0),v(this,Ro,void 0),v(this,Oo,void 0),v(this,No,void 0),A(So,this,"https://".concat(e.domain)),A(bo,this,e.clientId),A(To,this,e.clientSecret),A(_o,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Ro,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(Oo,this,e.getConfiguration),A(No,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(g(So,this),"/mfa/authenticators"),r=e.mfaToken,o=await w(Co,this,ia).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=Gi(o.headers);let i;try{i=JSON.parse(e)}catch(r){throw new Ji("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new Ji(i.error_description||"Failed to list authenticators",T(T({},i),{},{statusCode:t,headers:n,body:e}))}return(await o.json()).map(Zi)}async enrollAuthenticator(e,t){const n="".concat(g(So,this),"/mfa/associate"),r=e.mfaToken,o=_(e,Ao),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 w(Co,this,ia).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=Gi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Vi("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new Vi(o.error_description||"Failed to enroll authenticator",T(T({},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(g(So,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await w(Co,this,ia).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=Gi(i.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Yi("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new Yi(o.error_description||"Failed to delete authenticator",T(T({},o),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(g(So,this),"/mfa/challenge"),r=e.mfaToken,o=_(e,Eo),i={mfa_token:r,client_id:g(bo,this),challenge_type:o.challengeType};g(To,this)&&(i.client_secret=g(To,this)),o.authenticatorId&&(i.authenticator_id=o.authenticatorId);const a=await w(Co,this,ia).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=Gi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new zi("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new zi(o.error_description||"Failed to challenge authenticator",T(T({},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(!g(Oo,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(!g(No,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=ta(null!==(r=(await g(Oo,this).call(this,t))[Qn])&&void 0!==r?r:fetch),c=await g(No,this).call(this,s);
4try{const t=await Tr(c,ra[e.factorType],n),r=Qi.fromTokenEndpointResponse(t);t.recovery_code&&(r.recoveryCode=t.recovery_code);const o=s.getCapturedResponse();if(!o)throw new Hi;return{data:r,response:o}}catch(e){var o,i,a;if(e instanceof Hi)throw e;if(e instanceof qi)throw e;const t=e,n=new qi(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 Wi(n,e,s.getCapturedResponse()),n}}const s=await g(Oo,this).call(this,t);try{const t=await Tr(s,ra[e.factorType],n),r=Qi.fromTokenEndpointResponse(t);return t.recovery_code&&(r.recoveryCode=t.recovery_code),r}catch(e){var c,u,l;if(e instanceof qi)throw e;const t=e,n=new qi(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 Wi(n,e),n}}});function ia(e){return na(g(_o,this),e,g(Ro,this))}var aa=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},sa=class extends aa{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},ca=class extends aa{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},ua=class extends aa{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 la(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var da="urn:okta:params:oauth:grant-type:webauthn",ha=(Io=new WeakMap,ko=new WeakMap,Po=new WeakMap,Lo=new WeakMap,Mo=new WeakMap,xo=new WeakMap,Do=new WeakSet,class{constructor(e){var t,n;E(this,Do),v(this,Io,void 0),v(this,ko,void 0),v(this,Po,void 0),v(this,Lo,void 0),v(this,Mo,void 0),v(this,xo,void 0),A(Io,this,"https://".concat(e.domain)),A(ko,this,e.clientId),A(Po,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),A(Lo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Mo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(xo,this,e.grantRequest)}async register(e,t){const n="".concat(g(Io,this),"/passkey/register"),r=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}),o=T(T({client_id:g(ko,this)},la(g(Po,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 w(Do,this,pa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await w(Do,this,fa).call(this,i),t=new sa(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=Gi(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:T({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(g(Io,this),"/passkey/challenge"),r=T({client_id:g(ko,this)},la(g(Po,this)));null!=e&&e.realm&&(r.realm=e.realm),null!=e&&e.organization&&(r.organization=e.organization);const o=await w(Do,this,pa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){const e=await w(Do,this,fa).call(this,o),t=new ca(e.error_description||"Failed to request login challenge",e);throw t.statusCode=o.status,t.headers=Gi(o.headers),t}return{authSession:(i=await o.json()).auth_session,authnParamsPublicKey:T({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&Fi(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
4nce),e.organization&&n.append("organization",e.organization);try{r=await g(xo,this).call(this,da,n,t,e.fullResponse)}catch(e){if(e instanceof Hi)throw e;const t=Ei(e),n=new ua(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw Wi(n,e),n}if(e.fullResponse){const t=r;return e.organization&&Xi(t.data.claims,e.organization),t}const o=r;return e.organization&&Xi(o.claims,e.organization),o}});function pa(e){return na(g(Lo,this),e,g(Mo,this))}async function fa(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 wa=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(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=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},ya=class extends wa{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},ma=class extends wa{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},ga=class extends wa{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},va=class extends wa{constructor(e,t,n,r,o){super("passwordless_challenge_error",e,n),S(this,"statusCode",void 0),S(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=r,this.headers=null!=o?o:this.headers}};function Aa(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function Ea(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 vo(e.clientAssertionSigningKey,o);return{client_assertion:await new $r({}).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 Ui}var Sa=(Uo=new WeakMap,Bo=new WeakMap,Ho=new WeakMap,Go=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Fo=new WeakMap,Xo=new WeakSet,class{constructor(e){var t,n;E(this,Xo),v(this,Uo,void 0),v(this,Bo,void 0),v(this,Ho,void 0),v(this,Go,void 0),v(this,Wo,void 0),v(this,Ko,void 0),v(this,Fo,void 0),A(Bo,this,e.domain),A(Uo,this,"https://".concat(e.domain)),A(Ho,this,e.clientId),A(Go,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Wo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(Ko,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),A(Fo,this,e.grantRequest)}async sendEmail(e,t){const n=await w(Xo,this,Ta).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(!Aa(e.phoneNumber))throw new ya("Phone number must be in E.164 format (e.g. +14155550100).");const n=await w(Xo,this,Ta).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 w(Xo,this,_a).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!Aa(e.phoneNumber))throw new va("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 w(Xo,this,_a).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
4nce),!g(Fo,this))throw new ga("Missing grant request delegate.",Ei(new Error("missing grantRequest")));try{return await g(Fo,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Hi)throw e;const t=new ga("There was an error while trying to request a token.",Ei(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function ba(e){return na(g(Go,this),e,g(Wo,this))}async function Ta(e,t,n,r){var o;const i=await Ea(g(Ko,this),g(Ho,this),g(Bo,this)),a=T(T({client_id:g(Ho,this)},e),i);let s;try{s=await w(Xo,this,ba).call(this,r)("".concat(g(Uo,this),"/passwordless/start"),{method:"POST",headers:T({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new ya("".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 ya((null===(o=u)||void 0===o?void 0:o.error_description)||t,u);throw l.statusCode=s.status,l.headers=Gi(s.headers),l.body=c,l}async function _a(e,t,n){var r,o;const i=await Ea(g(Ko,this),g(Ho,this),g(Bo,this)),a=T(T({client_id:g(Ho,this)},e),i);let s;try{s=await w(Xo,this,ba).call(this,n)("".concat(g(Uo,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new va("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 va("".concat(t,": could not parse the response body."),s.status,void 0,void 0,Gi(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?T(T({},u),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new va((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,Gi(s.headers))}var Ra=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(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=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Oa=class extends Ra{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},Na=class extends Ra{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function Ca(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 Ia(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 ka=(jo=new WeakMap,Jo=new WeakMap,Vo=new WeakMap,Yo=new WeakMap,zo=new WeakSet,class{constructor(e){var t,n;E(this,zo),v(this,jo,void 0),v(this,Jo,void 0),v(this,Vo,void 0),v(this,Yo,void 0),A(jo,this,"https://".concat(e.domain)),A(Jo,this,e.clientId),A(Vo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Yo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea())}async signUp(e,t){var n;Ca(e,["email","password","connection"],Oa);const r=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:g(Jo,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 w(zo,this,Pa).call(this,"/dbconnections/signup",r,Oa,"Failed to sign up",t);if(e.fullResponse){const e=o.clone();return{data:Ia(await o.json()),response:e}}return Ia(await o.json())}async changePassword(e,t){var n;if(Ca(e,["connection"],Na),!e.email&&!e.username)throw new Na('Either "email" or "username" is required.');const r=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:g(Jo,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 w(zo,this,Pa).call(this,"/dbconnections/change_password",r,Na,"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 Pa(e,t,n,r,o){const i=na(g(Vo,this),o,g(Yo,this));let a;try{a=await i("".concat(g(jo,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=Gi(a.headers),u.body=s,u}
4var La=class extends Error{constructor(e,t,n){super(t),S(this,"code",void 0),S(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ma=new Set(["session_expired","invalid_session_token"]);async function xa(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 Da=(qo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakSet,class{constructor(e){var t;E(this,oi),v(this,qo,void 0),v(this,Zo,void 0),v(this,Qo,void 0),v(this,$o,void 0),v(this,ei,void 0),v(this,ti,void 0),v(this,ni,void 0),v(this,ri,void 0),A(qo,this,e.domain),A(Zo,this,"https://".concat(e.domain)),A(Qo,this,e.clientId),A($o,this,e.clientSecret),A(ei,this,e.clientAssertionSigningKey),A(ti,this,e.clientAssertionSigningAlg),A(ni,this,e.useMtls),A(ri,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:g(Qo,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 w(oi,this,Ba).call(this,t);if(!n.sessionToken)throw new La("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 w(oi,this,Ua).call(this,e.sessionToken,e)}catch(t){if(t instanceof La&&Ma.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(g(Zo,this),"/anonymous/logout"),t={client_id:g(Qo,this)},n=await g(ri,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 xa(n);throw new La(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function Ua(e,t){const n={client_id:g(Qo,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const r=await w(oi,this,Ba).call(this,n);return{sessionToken:e,accessToken:r.accessToken,expiresAt:r.expiresAt,sessionTokenExpiresAt:r.sessionTokenExpiresAt,scope:r.scope,sessionReplaced:!1}}async function Ba(e){const t="".concat(g(Zo,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 vo(e.clientAssertionSigningKey,o);return{client_assertion:await new $r({}).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:g($o,this),clientAssertionSigningKey:g(ei,this),clientAssertionSigningAlg:g(ti,this),useMtls:g(ni,this)},g(Qo,this),g(qo,this));Object.assign(e,n);const r=await g(ri,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 xa(r);throw new La(e.error,e.error_description||"Anonymous token request failed",e)}let o;try{o=await r.json()}catch(e){throw new La("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 La("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 La("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 Ha=(ii=new WeakMap,ai=new WeakMap,si=new WeakMap,class{constructor(e,t){v(this,ii,new Map),v(this,ai,void 0),v(this,si,void 0),A(si,this,Math.max(1,Math.floor(e))),A(ai,this,Math.max(0,Math.floor(t)))}get(e){const t=g(ii,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return g(ii,this).delete(e),g(ii,this).set(e,t),t.value;g(ii,this).delete(e)}}set(e,t,n){g(ii,this).has(e)&&g(ii,this).delete(e);const r=null!=n&&Number.isFinite(n)&&n>0?n:g(ai,this);for(g(ii,this).set(e,{value:t,expiresAt:Date.now()+r});g(ii,this).size>g(si,this);){const e=g(ii,this).keys().next().value;if(void 0===e)break;g(ii,this).delete(e)}}}),Ga=new Map;function Wa(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 Ka=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Ga.get(i));var i;return o||(o=new Ha(e.maxEntries,e.ttlMs),Ga.set(t,o)),o}static createJwksCache(){return{}}},Fa="openid profile email offline_access",Xa=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 ja(e){if(null==e)throw new Ci("subject_token is required");if("string"!=typeof e)throw new Ci("subject_token must be a string");if(0===e.trim().length)throw new Ci("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Ci("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Ci("subject_token must not include the 'Bearer ' prefix")}function Ja(e,t){if(t)for(const r of Object.entries(t)){var n=R(r,2);const t=n[0],o=n[1];if(!Xa.has(t))if(Array.isArray(o)){if(o.length>20)throw new Ci("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}
4else e.append(t,o)}}var Va="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",Ya="urn:ietf:params:oauth:grant-type:token-exchange",za="urn:ietf:params:oauth:token-type:access_token";function qa(e,t){return(n,r)=>{const o=null==r?void 0:r.body;if(t!==da||!(o instanceof URLSearchParams))return e(n,r);const i={};for(const e of o){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==r?void 0:r.headers);return s.set("Content-Type","application/json"),e(n,T(T({},r),{},{headers:s,body:JSON.stringify(i)}))}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap,di=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,wi=new WeakMap,yi=new WeakMap,mi=new WeakMap,gi=new WeakMap,vi=new WeakSet;function Za(){const e=g(hi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(g(hi,this).useMtls?"1":"0")}async function Qa(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await w(vi,this,ss).call(this,n),o=new sr(e,g(hi,this).clientId,{client_secret:g(hi,this).clientSecret,use_mtls_endpoint_aliases:g(hi,this).useMtls},r);return o[Qn]=null!=t?t:g(pi,this),o}function $a(e){return na(g(pi,this),e,g(fi,this))}async function es(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await w(vi,this,ts).call(this,t),r=n.configuration,o=n.serverMetadata;if(!e)return{configuration:r,serverMetadata:o};const i=w(vi,this,$a).call(this,e);return{configuration:await w(vi,this,Qa).call(this,o,i,t),serverMetadata:o}}async function ts(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=g(e?ui:ci,this);if(t&&g(li,this))return{configuration:t,serverMetadata:g(li,this)};const n=w(vi,this,Za).call(this);e||await w(vi,this,ss).call(this,!1);const r=g(yi,this).get(n);if(r)return w(vi,this,ns).call(this,r.serverMetadata,e);const o=g(mi,this).get(n);if(o){const t=await o;return w(vi,this,ns).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await ir(new URL("https://".concat(g(hi,this).domain)),g(hi,this).clientId,{use_mtls_endpoint_aliases:g(hi,this).useMtls},(e,t,n,r)=>{n.set("client_id",t.client_id)},{[Qn]:g(pi,this)})).serverMetadata();return g(yi,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),g(mi,this).set(n,i);try{const t=(await i).serverMetadata;return w(vi,this,ns).call(this,t,e)}finally{g(mi,this).delete(n)}}async function ns(e,t){const n=await w(vi,this,Qa).call(this,e,void 0,t);return A(li,this,e),A(t?ui:ci,this,n),{configuration:n,serverMetadata:e}}async function rs(e,t,n){var r,o,i;const a=(await w(vi,this,es).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new Ci("audience and resource parameters are not supported for Token Vault exchanges");ja(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==r?r:za,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),Ja(s,e.extra),n){var c;const t=ta(null!==a[Qn]&&void 0!==c?c:g(pi,this)),r=await w(vi,this,Qa).call(this,a.serverMetadata(),t);try{const e=await Tr(r,Va,s),n=Qi.fromTokenEndpointResponse(e),o=t.getCapturedResponse();if(!o)throw new Hi;return{data:n,response:o}}catch(n){if(n instanceof Hi)throw n;const r=new Ci("Failed to exchange token for connection '".concat(e.connection,"'."),Ei(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Gi(o.headers):void 0,r}}const u=ta(null!==a[Qn]&&void 0!==i?i:g(pi,this)),l=await w(vi,this,Qa).call(this,a.serverMetadata(),u);try{const e=await Tr(l,Va,s);return Qi.fromTokenEndpointResponse(e)}catch(t){const n=new Ci("Failed to exchange token for connection '".concat(e.connection,"'."),Ei(t)),r=u.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}}function os(e,t,n){var r;if(n.organization&&Xi(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 en("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 en("Only JWTs using Compact JWS serialization can be decoded");
4if(3!==r)throw new en("Invalid JWT");if(!n)throw new en("JWTs must contain a payload");let o,i;try{ln(n)}catch(e){throw new en("Failed to base64url decode the payload")}try{JSON.parse(Ft.decode(o))}catch(e){throw new en("Failed to parse the decoded payload as JSON")}if(!hn(i))throw new en("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function is(e,t,n){var r;const o=(await w(vi,this,es).call(this,t)).configuration;if(ja(e.subjectToken),void 0!==e.organization&&Fi(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new Ci("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),Ja(i,e.extra),n){var a;const t=ta(null!==o[Qn]&&void 0!==a?a:g(pi,this)),r=await w(vi,this,Qa).call(this,o.serverMetadata(),t);let s,c,u;try{if(await Tr(r,Ya,i),Qi.fromTokenEndpointResponse(c),t.getCapturedResponse(),!u)throw new Hi}catch(n){if(n instanceof Hi)throw n;const r=new Ci("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ei(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Gi(o.headers):void 0,r}return w(vi,this,os).call(this,s,c,e),{data:s,response:u}}const s=ta(null!==o[Qn]&&void 0!==r?r:g(pi,this)),c=await w(vi,this,Qa).call(this,o.serverMetadata(),s);let u,l;try{await Tr(c,Ya,i),Qi.fromTokenEndpointResponse(l)}catch(t){const n=new Ci("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ei(t)),r=s.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}return w(vi,this,os).call(this,u,l,e),u}async function as(e,t,n){var r;const o=(await w(vi,this,es).call(this,t)).configuration;if(n){var i;const t=ta(null!==o[Qn]&&void 0!==i?i:g(pi,this)),n=await w(vi,this,Qa).call(this,o.serverMetadata(),t);try{const r=await Tr(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),o=Qi.fromTokenEndpointResponse(r),i=t.getCapturedResponse();if(!i)throw new Hi;return{data:o,response:i}}catch(e){if(e instanceof Hi)throw e;const n=new ma("There was an error while trying to request a token.",Ei(e)),r=t.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}}const a=ta(null!==o[Qn]&&void 0!==r?r:g(pi,this)),s=await w(vi,this,Qa).call(this,o.serverMetadata(),a);try{const t=await Tr(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return Qi.fromTokenEndpointResponse(t)}catch(e){const t=new ma("There was an error while trying to request a token.",Ei(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Gi(n.headers):void 0,t}}async function ss(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!g(hi,this).clientSecret||!!g(hi,this).clientAssertionSigningKey||!!g(hi,this).useMtls;return e&&!t?(e,t,n,r)=>{n.set("client_id",t.client_id)}:(g(di,this)||A(di,this,(async()=>{if(!g(hi,this).clientSecret&&!g(hi,this).clientAssertionSigningKey&&!g(hi,this).useMtls)throw new Ui;if(g(hi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=g(hi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await vo(e,g(hi,this).clientAssertionSigningAlg||"RS256"),e?function(e){return Ie(e,void 0)}(e):qn(g(hi,this).clientSecret)})().catch(e=>{throw A(di,this,void 0),e})),g(di,this))}async function cs(e){const t=(await w(vi,this,ts).call(this)).configuration,n=Se(),r=await function(e){return async function(e){return Ae(e,"codeVerifier"),de(await crypto.subtle.digest("SHA-256",ce(e)))}(e)}(n),o=Ki(T(T({},g(hi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:Fa},o),{},{client_id:g(hi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await gr(t,i):await mr(t,i),codeVerifier:n}}new Ha(1e3,6e4);Error;new WeakMap,new WeakMap;var us=n(3612);const ls={log:function(){if(us.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];
4(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(us.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))}}};var ds=function(){function e(){r(this,e),c(this,"readyPromise",null),c(this,"readyResolved",!1),c(this,"readyValue",!1)}return s(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 ls.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return ls.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return ls.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(ls.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return ls.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){ls.log("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),ls.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(ls.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();c(ds,"DEFAULT_TIMEOUT",3e3);new ds;var hs,ps;function fs(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 ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fs(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){hs||(hs=e,ps&&(ls.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",ps),window.dispatchEvent(ps)))}),ls.log("Waiting for islands ready");var ys=function(){var e=window.location.href;return new URL(e)},ms=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},gs=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(ls.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=d(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},vs=function(){return ys().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},As=function(){return"complete"===document.readyState},Es=function(){return new Promise(function(e){if(("interactive"===document.readyState||As())&&window.dataLayer)ls.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{ls.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval(t(u.mark(function t(){return u.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)}})},Ss=function(){var e,t=new Promise(function(t){e=setTimeout(function(){ls.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])},bs=function(){var e=t(u.mark(function e(t){var n,r,o;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Es();case 1:return ls.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",ls.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return ls.log("Utils dataLayerLoop: look for this element ",e),e[t]?(ls.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(ls.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},o=window.dataLayer.some(r),e.abrupt("return",o?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Ts=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.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,bs(t);case 1:return n=e.sent,ls.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)}}(),_s=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(ls.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(ls.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};ls.log("utils | Event: authentication ready: ",r),e(r)}catch(e){ls.log(e),t(e)}},!1))})},Rs=function(){var e=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return us.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(ls.log("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,ls.log("Received entitlementsReady event:",r),e(r)}catch(e){ls.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(ls.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Os=function(e){ls.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
4BANK","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
4CIAL","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 ls.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=Os;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ns=function(e){ps=new CustomEvent("mng-auth-check-complete",{detail:e}),hs?(ls.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(ps)):ls.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return Ns(e.detail)});var Cs=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Content ID",e.next=1,bs(t);case 1:return n=e.sent,ls.log("utils | contentId: Content ID is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Is=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Section",e.next=1,bs(t);case 1:return n=e.sent,ls.log("utils | section: Section is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ks=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,r){var o={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},i=function(){var i=t(u.mark(function t(){var i,a,s,c,l,d,h,p,f,w,y;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"1"!==(null===(i=window.sophi_config)||void 0===i?void 0:i.enableSophiSSPW)){t.next=1;break}if(!document.getElementById("server-paywall")){t.next=1;break}return o.sspw=!0,t.abrupt("return",n({paywall:!0,details:ws({},o)}));case 1:return t.next=2,Ts();case 2:return s=t.sent,t.next=3,bs("Paywall_Level");case 3:if(c=t.sent,"article"===s&&"free"!==c){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==s?"Page type is not an article":"Free article"}));case 4:return t.next=5,Rs();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"!==c){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,ls.log("checkPaywallStatus - Sophi is running: ",d),!d){t.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(o.sophiClient=!0,o.engageStatus=!0,o.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(o.sophiClient=!0),n({paywall:!0,details:ws({},o)})},{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)?(o.engagePaywall=!0,o.engageStatus="Engage paywall detected"):(o.engagePaywall=!1,o.engageStatus="Engage response: ".concat(f)),t.next=12;break;case 11:t.prev=11,w=t.catch(9),o.engagePaywall=!1,o.engageStatus="Engage response: ".concat(w);case 12:return t.abrupt("return",n({paywall:Object.values(o).some(function(e){return e}),details:ws({},o)}));case 13:t.prev=13,y=t.catch(0),r(y);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return i.apply(this,arguments)}}();i()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=ks);var Ps=function(){function e(){r(this,e),c(this,"pendingSets",new Map),c(this,"flushTimer",null),c(this,"hasFlushed",!1),c(this,"isPaused",!1)}return s(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,ls.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){ls.error("AdmiralUtils | pauseTargeting | failed",e)}else ls.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)ls.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 ls.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
4try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),ls.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),ls.log("AdmiralUtils | flush | targeting ready.")}catch(e){ls.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)ls.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),ls.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}}])}();c(Ps,"DEFAULT_READY_DELAY_MS",2e3);const Ls=Ps;var Ms=function(){return s(function e(){var t,n,o,i,a,s;r(this,e),c(this,"simpleHostname",void 0),c(this,"sophiHostname",void 0),c(this,"sophiCallStartTime",void 0),c(this,"section",void 0),c(this,"contentId",void 0),c(this,"visitorType",void 0),c(this,"admiralUtils",Ls.getInstance()),this.simpleHostname=vs();var u=window.location.hostname;""!==window.sophi_config.sophiHostname?this.sophiHostname=window.sophi_config.sophiHostname:this.sophiHostname=u,this.onDeviceEnabled=!(null===(t=window.authentication_config)||void 0===t||!t.sophiOnDevice)&&"1"===(null===(n=window.authentication_config)||void 0===n?void 0:n.sophiOnDevice),this.sdkEnabled=!(null===(o=window.authentication_config)||void 0===o||!o.sophiSDKEnabled)&&"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.sophiSDKEnabled),this.useEventListener=!(null===(a=window.sophi_config)||void 0===a||!a.useEventListener)&&(this.sdkEnabled&&"1"===(null===(s=window.sophi_config)||void 0===s?void 0:s.useEventListener)),this.log("site settings: onDeviceEnabled = ".concat(this.onDeviceEnabled,", sdkEnabled = ").concat(this.sdkEnabled))},[{key:"init",value:(l=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pauseAdmiralTargeting(),this.log("Starting normal SDK flow."),this.sdkEnabled){e.next=1;break}return this.resumeAdmiralTargeting(),e.abrupt("return");case 1:return e.next=2,this.setupSophiDecision();case 2:if(!e.sent){e.next=3;break}return e.next=3,this.makeSophiCall();case 3:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"getSophiDecisionTimeout",value:function(){var e,t,n=4e3;if(""!==(null===(e=window.sophi_config)||void 0===e?void 0:e.sophiGetDesicionTimer)&&"number"!=typeof(null===(t=window.sophi_config)||void 0===t?void 0:t.sophiGetDesicionTimer)){var r=parseInt(window.sophi_config.sophiGetDesicionTimer,10);Number.isNaN(r)||(n=r)}return this.log("getSophiDecisionTimeout is equal to: ",n),n}},{key:"waitForSophiReady",value:(a=t(u.mark(function e(){var n=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.useEventListener){e.next=1;break}return this.log("Not using AB test listener, will call Sophi decision directly."),e.abrupt("return",!1);case 1:return e.abrupt("return",new Promise(function(e){window.addEventListener("sophi.abTests:ready",t(u.mark(function t(){var r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=window.sophi)||void 0===r||!r.abTests||"function"!=typeof window.sophi.abTests.getAllExperiments){t.next=2;break}return t.next=1,window.sophi.abTests.getAllExperiments();case 1:o=t.sent,e(o);case 2:n.log("AB Tests loaded successfully!"),e(!1);case 3:case"end":return t.stop()}},t)}))),n.log("Added A/B test listener...")}));case 2:case"end":return e.stop()}},e,this)})),function(){return a.apply(this,arguments)})},{key:"getVisitorType",value:(i=t(u.mark(function e(){var t,n,r;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t="anonymous",e.prev=1,e.next=2,Rs();case 2:"isEntitled"in(n=e.sent)&&(t=n.isEntitled?"subscriber":"registered"),"yes"===window.localStorage.getItem("sophiRegiliteUser")&&"anonymous"===t&&(this.log("User is regilite and anonymous. Setting to registered."),t="registered"),e.next=4;break;case 3:e.prev=3,r=e.catch(1),this.error("Unable to determine visitorType Using",t,r);case 4:return window.sophiUserType=t,this.log("visitorType is",t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this,[[1,3]])}
4)),function(){return i.apply(this,arguments)})},{key:"setupSophiDecision",value:(o=t(u.mark(function e(){var t,n,r,o,i,a,s,c=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!0,n=!1,e.prev=1,!this.useEventListener){e.next=5;break}return e.next=2,this.waitForSophiReady();case 2:if(t=e.sent,!(!this.onDeviceEnabled&&!t||t&&t.length<1)){e.next=3;break}return this.log("experiments variable was not in the expected format.",t),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 3:if(t){e.next=4;break}return this.log("window.sophi.abTests.getAllExperiments is not available"),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 4:n=null===(r=t[0])||void 0===r?void 0:r.assignedGroup,this.log("onSuccess callback:",n);case 5:if(o=function(e){console.error("onError callback, rerunning Connext if silent:",e),c.rerunConnextIfIsSilent()},i=this.section){e.next=7;break}return e.next=6,Is();case 6:i=e.sent;case 7:return this.section=i,e.prev=8,e.next=9,this.getVisitorType();case 9:if(this.visitorType=e.sent,!(this.useEventListener&&"control"===n||"subscriber"===this.visitorType)){e.next=10;break}return this.log("User is in ".concat(n,", and is ").concat(this.visitorType,". Ending sophi flow.")),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 10:return e.next=11,Ts();case 11:if("article"===e.sent){e.next=12;break}return this.log("Page type was not article, returning."),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 12:return e.next=13,Es();case 13:return this.useEventListener&&(window.dataLayer.push({event:"sophi_cookie",sophi_type:"".concat(this.simpleHostname,"UserIsInVariantOrHoldout"),sophi_cookie_val:n}),window.sophiCookie=n),e.next=14,Cs();case 14:return this.contentId=e.sent,this.log("Content ID ",this.contentId),e.abrupt("return",!0);case 15:return e.prev=15,a=e.catch(8),o(a),e.abrupt("return",!1);case 16:return e.prev=16,s=e.catch(1),this.log("Event listener",s),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 17:case"end":return e.stop()}},e,this,[[1,16],[8,15]])})),function(){return o.apply(this,arguments)})},{key:"rerunConnextIfIsSilent",value:(n=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.resumeAdmiralTargeting(),this.log("About to call rerunConnextEntitlements."),e.next=1,window.ConnextUtils.rerunConnextEntitlements(!1,!1);case 1:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"handleSophiResponse",value:function(e){var t=Date.now()-this.sophiCallStartTime;this.log("response with response time of ".concat(t," ms: "),e),this.resumeAdmiralTargeting((null==e?void 0:e.wallType)||"no_wall"),delete e.trace;var n="";this.useEventListener||(n=window.sophi.dataLayer.assignedGroup,window.sophiCookie=n),(!this.useEventListener&&"variant"===n||this.useEventListener)&&window.dataLayer.push({event:"sophi_decision",sophi_type:"getDecision",sophi_time:t,sophi_response:JSON.stringify(e)}),window.sophiWallConfig=e,this.rerunConnextIfIsSilent()}},{key:"makeSophiCall",value:(e=t(u.mark(function e(){var t=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){try{var n=window.sophi.paywall.init({hostname:t.sophiHostname,getContentId:Cs});if(t.log("2.0 SDK init complete: ",n),!window.sophi.paywall)return t.log("window.sophi.paywall was undefined. About to run Connext"),void t.rerunConnextIfIsSilent();t.useEventListener&&(window.dataLayer.push({event:"sophi_cookie",sophi_type:"beforeSDKCall",sophi_cookie_val:window.sophiCookie}),t.log("about to call SDK, cookie is ".concat(window.sophiCookie))),t.sophiCallStartTime=Date.now()}catch(e){t.log("logic error 1",e),t.rerunConnextIfIsSilent()}var r=t.getSophiDecisionTimeout();window.sophi.paywall.getDecision({contentId:t.contentId,section:t.section,visitor:t.visitorType,timeout:r}).then(function(n){t.handleSophiResponse(n),e()}).catch(function(n){var r=Date.now()-t.sophiCallStartTime;t.log("error sdk, response time of ".concat(r," ms: "),n),window.dataLayer.push({event:"sophi_error",sophi_time:r,sophi_err_msg:n}),t.rerunConnextIfIsSilent(),e()})}));case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})},{key:"pauseAdmiralTargeting",value:function(){if(!this.admiralPaused&&!this.admiralResumed){this.admiralPaused=!0,this.admiralResumed=!1;var e=this.getSophiDecisionTimeout()+2e3;this.admiralUtils.pauseTargeting(e)}}},{key:"resumeAdmiralTargeting",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no_wall";this.admiralResumed||(this.admiralResumed=!0,this.admiralPaused=!1,this.admiralUtils.queueSet("sophi_wall",e),this.admiralUtils.scheduleReady(),this.log("Admiral sophi_wall queued (".concat(e,").")))}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ls.log.apply(ls,["Sophi: "].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ls.error.apply(ls,["Sophi: "].concat(t))}}]);var e,n,o,i,a,l}();const xs=Ms;function Ds(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}
4function Us(e){return Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Us(e)}function Bs(){return Bs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Us(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Bs.apply(null,arguments)}function Hs(e,t){return Hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hs(e,t)}function Gs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Gs=function(){return!!e})()}function Ws(e,t,n,r){var o=Bs(Us(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}var Ks,Fs=function(e){function n(){return r(this,n),function(e,t,n){return t=Us(t),Ds(e,Gs()?Reflect.construct(t,n||[],Us(e).constructor):t.apply(e,n))}(this,n,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hs(e,t)}(n,e),s(n,[{key:"init",value:(l=t(u.mark(function e(){var t;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pauseAdmiralTargeting(),!this.sdkEnabled){e.next=1;break}return this.resumeAdmiralTargeting(),e.abrupt("return");case 1:if("undefined"!=typeof demeter){e.next=2;break}return this.log("demeter undefined, aborting on-device init."),this.resumeAdmiralTargeting(),e.abrupt("return");case 2:return demeter("config",{args:{logLevel:"1"===window.authentication_config.debug?"debug":"warn"}}),demeter("enableAllFeatures"),this.sspwEnabled="1"===window.sophi_config.enableSophiSSPW,this.sophiEngageVsSophiSSPWEnabled="1"===window.sophi_config.enableSophiEngageVsSophiSSPW,this.log("Sophi Engage vs Sophi SSPW A/B Test Enabled: ".concat(this.sophiEngageVsSophiSSPWEnabled)),e.next=3,Is();case 3:return this.section=e.sent,e.next=4,Ts();case 4:if(this.pageType=e.sent,!this.onDeviceEnabled){e.next=6;break}return this.log("On-Device module is enabled."),e.next=5,this.listenForEventForDemeter();case 5:e.next=7;break;case 6:return this.log("On-Device module is NOT enabled, aborting."),this.resumeAdmiralTargeting(),e.abrupt("return");case 7:if(!this.sophiEngageVsSophiSSPWEnabled){e.next=9;break}if(t=this.setEngageVsSophiCookie(),this.sspwEnabled&&"engage"!==t){e.next=8;break}return this.log(this.sspwEnabled?"(".concat(this.sspwEnabled?"SSPW ON":"SSPW OFF",", and cookie=").concat(t,")"):"(".concat(this.sspwEnabled?"SSPW ON":"SSPW OFF"," â About to setup Sophi decision)")),this.handleSophiProcess(),e.abrupt("return");case 8:return this.log("SSPW is active, skipping client-side Sophi decision call."),this.handleSSPWProcess(),e.abrupt("return");case 9:if(this.sspwEnabled){e.next=10;break}return this.log("About to setup Sophi decision."),this.handleSophiProcess(),e.abrupt("return");case 10:return this.log("SSPW is active, skipping client-side Sophi decision call."),e.next=11,this.getVisitorType();case 11:this.visitorType=e.sent,this.handleSSPWProcess();case 12:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"sendPageViewEvent",value:function(){var e;demeter("pageview",{args:{article:null!==(e="article"===this.pageType)&&void 0!==e&&e,section:this.section}}),this.log("demeter pagetype tracking sent, pagetype is ".concat(this.pageType," and section is ").concat(this.section))}},{key:"listenForEventForDemeter",value:(c=t(u.mark(function e(){var t,n,r,o,i=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log("Setting up listeners for demeter..."),this.sendPageViewEvent(),this.sspwEnabled||(this.log("adding paywall listener"),document.addEventListener("onPaywallShown",function(e){var t,n=((null===(t=e.detail)||void 0===t||null===(t=t.EventData)||void 0===t?void 0:t.Name)||"").toLowerCase().includes("regwall")?"regwall":"paywall";i.log("paywall event, is ".concat(n)),demeter("wall",{args:{wallType:n,section:i.section}}),i.log("demeter paywall tracking sent, wall type is ".concat(n,", section is ").concat(i.section))})),e.next=1,_s();case 1:t=e.sent,n=window.localStorage.getItem("sophiRegiliteUser"),r=t.isAuthenticated,o=r||"yes"===n?"registered":"anonymous",demeter("userProperties",{args:{visitorType:o}}),this.log("demeter userProperties tracking sent, user type is ".concat(o));case 2:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"makeSophiCall",value:(a=t(u.mark(function e(){var t=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){var r=function(n){var r=Date.now()-t.sophiCallStartTime;t.log("error sdk, response time of ".concat(r," ms: "),n),window.dataLayer.push({event:"sophi_error",sophi_time:r,sophi_err_msg:n}),t.resumeAdmiralTargeting(),t.rerunConnextIfIsSilent(),e()};try{t.sophiCallStartTime=Date.now(),demeter("getDecision",{args:{visitor:t.visitorType,section:t.section}}).then(function(r){r&&r.outcome?(Ws(n,"handleSophiResponse",t,3)([r.outcome]),e()):function(n){var r=Date.now()-t.sophiCallStartTime;t.log("getDecision resolved without an outcome, response time of ".concat(r," ms: "),n);var o=[t.contentId,t.section,t.pageType,t.visitorType].join("|");window.dataLayer.push({event:"sophi_null_decision",sophi_type:"getDecision",sophi_time:r,sophi_response:JSON.stringify(null!=n?n:null),sophi_data:o}),t.rerunConnextIfIsSilent(),t.resumeAdmiralTargeting(),e()}(r)}).catch(r)}catch(e){r(e)}}));case 1:case"end":return e.stop()}},e)})),function(){return a.apply(this,arguments)})},{key:"setSspwTemplateCookie",value:function(){try{var e=ms("sspw-template-test");
4if(e&&""!==e)this.log("Entitlements-setSspwTemplateCookie: User already segmented");else{var t=Math.random()<.5?"GroupA":"GroupB";gs("sspw-template-test",t,{expires:60,path:"/"}),this.log("Entitlements-setSspwTemplateCookie: User segmented in group: ".concat(t))}}catch(e){this.log("Entitlements-setSspwTemplateCookie: There was an error trying to create the sspw template cookie for AB testing, error: ",e)}}},{key:"setEngageVsSophiCookie",value:function(){try{var e=ms("engage_vs_sophi_sspw");return e&&""!==e?this.log("Entitlements-setEngageVsSophiCookie: User already segmented in group: ".concat(e)):(e=Math.random()<.5?"sspw":"engage",gs("engage_vs_sophi_sspw",e,{expires:60,path:"/"}),this.log("Entitlements-setEngageVsSophiCookie: User segmented in group: ".concat(e))),e}catch(e){return this.log("Entitlements-setEngageVsSophiCookie: There was an error trying to create the engage vs sophi cookie for AB testing, error: ",e),null}}},{key:"handleServerSidePaywall",value:function(){this.log("Checking for server-side paywall..."),document.querySelector("#server-paywall, #nav-api-sspw")?(this.log("Server-side paywall detected."),demeter("wall",{args:{wallType:"paywall",section:this.section}}),(window._matherq=window._matherq||[]).push(["paywallEvent",{type:"paywall",category:"block",action:"stop"}]),this.log("demeter and mather events sent for server-side paywall. Section is ".concat(this.section))):this.log("No server-side paywall detected. Element not found.")}},{key:"handleServerSideRegwall",value:(i=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(document.querySelector("#server-regwall .regwall-input-holder.flex-container, #nav-api-ssrw")){e.next=1;break}return this.log("No server-side regwall detected. Element not found."),e.abrupt("return");case 1:return this.log("Server-side regwall detected."),demeter("wall",{args:{wallType:"regwall",section:this.section}}),(window._matherq=window._matherq||[]).push(["paywallEvent",{type:"paywall",category:"block",action:"stop",wall_type:"regwall"}]),this.log("demeter and mather events sent for server-side regwall. Section is ".concat(this.section)),e.next=2,Ss();case 2:if(e.sent){e.next=3;break}return this.log("engageLibrary failed to load within 10 seconds, skipping serverRegwall()."),e.abrupt("return");case 3:window.engageLibrary.serverRegwall();case 4:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})},{key:"handleSSPWProcess",value:function(){this.resumeAdmiralTargeting(),this.setSspwTemplateCookie(),"article"===this.pageType&&(this.handleServerSidePaywall(),this.handleServerSideRegwall())}},{key:"handleSophiProcess",value:(o=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this.setupSophiDecision();case 1:if(!e.sent){e.next=2;break}return e.next=2,this.makeSophiCall();case 2:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)})}]);var o,i,a,c,l}(xs);"1"===(null===(Ks=window.authentication_config)||void 0===Ks?void 0:Ks.sophiOnDevice)?(new Fs).init():(new xs).init()})()})(); 5//# sourceMappingURL=mng-digisubs.sophi.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.