@auth0/auth0-spa-js 2.18.2 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth0-spa-js.development.js +70 -3
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/auth0-spa-js.worker.development.js +41 -1
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +70 -3
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/version.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +5 -0
- package/package.json +2 -2
- package/src/Auth0Client.ts +5 -0
- package/src/version.ts +1 -1
- package/src/worker/__mocks__/token.worker.ts +3 -3
- package/src/worker/token.worker.ts +59 -3
- package/src/worker/worker.types.ts +7 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).auth0={})}(this,function(e){"use strict";function t(e,t){this.v=e,this.k=t}function n(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 o(e){return new t(e,0)}function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(e,t){return e.get(n(e,t))}function a(e,t,n){r(e,t),t.set(e,n)}function s(e,t,o){return e.set(n(e,t),o),o}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");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 u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function d(e){return function(){return new p(e.apply(this,arguments))}}function p(e){var n,o;function r(n,o){try{var a=e[n](o),s=a.value,c=s instanceof t;Promise.resolve(c?s.v:s).then(function(t){if(c){var o="return"===n&&s.k?n:"next";if(!s.k||t.done)return r(o,t);t=e[o](t).value}i(!!a.done,t)},function(e){r("throw",e)})}catch(e){i(2,e)}}function i(e,t){2===e?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?r(n.key,n.arg):o=null}this._invoke=function(e,t){return new Promise(function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};o?o=o.next=s:(n=o=s,r(e,t))})},"function"!=typeof e.return&&(this.return=void 0)}p.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},p.prototype.next=function(e){return this._invoke("next",e)},p.prototype.throw=function(e){return this._invoke("throw",e)},p.prototype.return=function(e){return this._invoke("return",e)};const f={timeoutInSeconds:60},m="memory",y={name:"auth0-spa-js",version:"2.18.2"},w=()=>Date.now(),g="default";class v extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,v.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new v(t,n)}}class b extends v{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=o,Object.setPrototypeOf(this,b.prototype)}}class _ extends v{constructor(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=o,this.appState=r,Object.setPrototypeOf(this,_.prototype)}}class k extends v{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,k.prototype)}}class S extends k{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,S.prototype)}}class T extends v{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,T.prototype)}}class E extends v{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,E.prototype)}}class P extends v{constructor(e,t,n,o){super(e,t),this.mfa_token=n,this.mfa_requirements=o,Object.setPrototypeOf(this,P.prototype)}}class A extends v{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(R(e,["default"]),"', scope: '").concat(R(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,A.prototype)}}class x extends v{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(R(e,["default"]),"', missing scope: '").concat(R(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,x.prototype)}}class I extends v{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,I.prototype)}}function R(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const C=["clientId"],O=()=>window.crypto,W=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";for(;t.length<43;){const n=O().getRandomValues(new Uint8Array(43-t.length));for(const o of n)t.length<43&&o<198&&(t+=e[o%66])}return t},U=e=>btoa(e),D=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],K=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,o)=>{if(t&&"env"===o)return n;const r=D.find(e=>e.key===o);return r&&r.type.includes(typeof e[o])&&(n[o]=e[o]),n},{})},H=e=>{let{clientId:t}=e,n=h(e,C);return new URLSearchParams((e=>Object.keys(e).filter(t=>void 0!==e[t]).reduce((t,n)=>l(l({},t),{},{[n]:e[n]}),{}))(l({client_id:t},n))).toString()},L=async e=>{const t=O().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},j=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),M=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))};var N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},z={},J={};Object.defineProperty(J,"__esModule",{value:!0});var Z=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var o=e.locked.get(t);void 0===o?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(o.unshift(n),e.locked.set(t,o))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,o){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var o=n.pop();e.locked.set(t,n),void 0!==o&&setTimeout(o,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();J.default=function(){return Z.getInstance()};var V=N&&N.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})},F=N&&N.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},G=N;Object.defineProperty(z,"__esModule",{value:!0});var X=J,q="browser-tabs-lock-key",Y={key:function(e){return V(G,void 0,void 0,function(){return F(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return V(G,void 0,void 0,function(){return F(this,function(e){throw new Error("Unsupported")})})},clear:function(){return V(G,void 0,void 0,function(){return F(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return V(G,void 0,void 0,function(){return F(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return V(G,void 0,void 0,function(){return F(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 B(e){return new Promise(function(t){return setTimeout(t,e)})}function Q(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",o=0;o<e;o++){n+=t[Math.floor(61*Math.random())]}return n}var $=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+Q(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),V(this,void 0,void 0,function(){var o,r,i,a,s,c,u;return F(this,function(l){switch(l.label){case 0:o=Date.now()+Q(4),r=Date.now()+n,i=q+"-"+t,a=void 0===this.storageHandler?Y:this.storageHandler,l.label=1;case 1:return Date.now()<r?[4,B(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+o,[4,B(Math.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:o,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,B(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===o?(this.acquiredIatSet.add(o),this.refreshLockWhileAcquired(i,o),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?Y:this.storageHandler),[4,this.waitForSomethingToChange(r)];case 6:l.sent(),l.label=7;case 7:return o=Date.now()+Q(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return V(this,void 0,void 0,function(){var n=this;return F(this,function(o){return setTimeout(function(){return V(n,void 0,void 0,function(){var n,o,r;return F(this,function(i){switch(i.label){case 0:return[4,X.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?Y:this.storageHandler,null===(o=n.getItemSync(e))?(X.default().unlock(t),[2]):((r=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(r)),X.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(X.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return V(this,void 0,void 0,function(){return F(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var o=!1,r=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!o){o=!0;var t=50-(Date.now()-r);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return V(this,void 0,void 0,function(){return F(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return V(this,void 0,void 0,function(){var n,o,r,i;return F(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?Y:this.storageHandler,o=q+"-"+t,null===(r=n.getItemSync(o))?[2]:(i=JSON.parse(r)).id!==this.id?[3,2]:[4,X.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(o),X.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,o=t,r=[],i=0;;){var a=o.keySync(i);if(null===a)break;r.push(a),i++}for(var s=!1,c=0;c<r.length;c++){var u=r[c];if(u.includes(q)){var l=o.getItemSync(u);if(null!==l){var h=JSON.parse(l);(void 0===h.timeRefreshed&&h.timeAcquired<n||void 0!==h.timeRefreshed&&h.timeRefreshed<n)&&(o.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),ee=z.default=$;class te{async runWithLock(e,t,n){const o=new AbortController,r=setTimeout(()=>o.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:o.signal},async e=>{if(clearTimeout(r),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(r),"AbortError"===(null==e?void 0:e.name))throw new k;throw e}}}class ne{constructor(){c(this,"activeLocks",new Set),this.lock=new ee,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let o=!1;for(let n=0;n<10&&!o;n++)o=await this.lock.acquireLock(e,t);if(!o)throw new k;this.activeLocks.add(e),1===this.activeLocks.size&&"undefined"!=typeof window&&window.addEventListener("pagehide",this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),0===this.activeLocks.size&&"undefined"!=typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}function oe(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new te:new ne;var e}let re=null;const ie=new TextEncoder,ae=new TextDecoder;function se(e){return"string"==typeof e?ie.encode(e):ae.decode(e)}function ce(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new pe(`${e.name} modulusLength must be at least 2048 bits`)}async function ue(e,t,n){if(!1===n.usages.includes("sign"))throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const o=`${he(se(JSON.stringify(e)))}.${he(se(JSON.stringify(t)))}`;return`${o}.${he(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return ce(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return ce(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new de}(n),n,se(o)))}`}let le;if(Uint8Array.prototype.toBase64)le=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;le=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function he(e){return le(e)}class de extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class pe extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}function fe(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new de("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(e){if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new de("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(e){if("P-256"===e.algorithm.namedCurve)return"ES256";throw new de("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new de("unsupported CryptoKey algorithm name")}}function me(e){return e instanceof CryptoKey}function ye(e){return me(e)&&"public"===e.type}async function we(e,t,n,o,r,i){const a=null==e?void 0:e.privateKey,s=null==e?void 0:e.publicKey;if(!me(c=a)||"private"!==c.type)throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!ye(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==s.extractable)throw new TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw new TypeError('"htu" must be a string');if("string"!=typeof n)throw new TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw new TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw new TypeError('"accessToken" must be a string or undefined');if(void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)))throw new TypeError('"additional" must be an object');return ue({alg:fe(a),typ:"dpop+jwt",jwk:await ge(s)},Object.assign(Object.assign({},i),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:o,htu:t,ath:r?he(await crypto.subtle.digest("SHA-256",se(r))):void 0}),a)}async function ge(e){const{kty:t,e:n,n:o,x:r,y:i,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:o,x:r,y:i}}const ve="dpop-nonce",be=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-recovery-code"];function _e(){return async function(e,t){var n;let o;if("string"!=typeof e||0===e.length)throw new TypeError('"alg" must be a non-empty string');switch(e){case"PS256":o={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":o={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":o={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":o={name:"Ed25519"};break;default:throw new de}return crypto.subtle.generateKey(o,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}("ES256",{extractable:!1})}function ke(e){return async function(e){if(!ye(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ge(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new de("unsupported JWK kty")}return he(await crypto.subtle.digest({name:"SHA-256"},se(JSON.stringify(n))))}(e.publicKey)}function Se(e){let{keyPair:t,url:n,method:o,nonce:r,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return we(t,a,o,r,i)}const Te=["error","error_description"],Ee=async(e,t)=>{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(o=n.headers,[...o].reduce((e,t)=>{let[n,o]=t;return e[n]=o,e},{}))};var o},Pe=async(e,t,n)=>{const o=new AbortController;let r;return t.signal=o.signal,Promise.race([Ee(e,t),new Promise((e,t)=>{r=setTimeout(()=>{o.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},Ae=async(e,t,n,o,r,i,a,s)=>((e,t)=>new Promise(function(n,o){const r=new MessageChannel;r.port1.onmessage=function(e){e.data.error?o(new Error(e.data.error)):n(e.data),r.port1.close()},t.postMessage(e,[r.port2])}))({auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:o,useFormData:a,useMrrt:s},i),xe=async function(e,t,n,o,r,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return r?Ae(e,t,n,o,a,r,i,arguments.length>7?arguments[7]:void 0):Pe(e,o,a)};async function Ie(e,t,n,o,r,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:r.method||"GET",nonce:await c.getNonce()});r.headers=l(l({},r.headers),{},{dpop:t})}let d,p=null;for(let c=0;c<3;c++)try{d=await xe(e,n,o,r,i,a,t,s),p=null;break}catch(e){p=e}if(p)throw p;const{json:{error:f,error_description:m},headers:y,ok:w}=d,g=h(d.json,Te);let b;if(c&&(b=y[ve],b&&await c.setNonce(b)),!w){const l=m||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===f)throw new P(f,l,g.mfa_token,g.mfa_requirements);if("missing_refresh_token"===f)throw new A(n,o);if("use_dpop_nonce"===f){if(!c||!b||u)throw new I(b);return Ie(e,t,n,o,r,i,a,s,c,!0)}throw new v(f||"request_error",l)}return g}const Re=["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"];async function Ce(e,t){let{baseUrl:n,timeout:o,audience:r,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,d=h(e,Re);const p="urn:ietf:params:oauth:grant-type:token-exchange"===d.grant_type,f="refresh_token"===d.grant_type&&c,m=l(l(l(l({},d),p&&r&&{audience:r}),p&&i&&{scope:i}),f&&{audience:r,scope:i}),w=s?H(m):JSON.stringify(m),v=(b=d.grant_type,be.includes(b));var b;return await Ie("".concat(n,"/oauth/token"),o,r||g,i,{method:"POST",body:w,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(K(a||y)))}},t,s,c,v?u:void 0)}const Oe=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(o=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(o))).join(" ");var o},We=(e,t,n)=>{let o;return n&&(o=e[n]),o||(o=e[g]),Oe(o,t)},Ue="@@auth0spajs@@",De="@@user@@";class Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ue,n=arguments.length>2?arguments[2]:void 0;this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[t,n,o,r]=e.split("::");return new Ke({clientId:n,scope:r,audience:o},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:o}=e;return new Ke({scope:t,audience:n,clientId:o})}}class He{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith(Ue))}}class Le{constructor(){c(this,"enclosedCache",function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}())}}class je{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||w}async setIdToken(e,t,n){var o;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(o=this.keyManifest)||void 0===o?void 0:o.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0,r=await this.cache.get(e.toKey());if(!r){const t=await this.getCacheKeys();if(!t)return;const i=this.matchExistingCacheKey(e,t);if(i&&(r=await this.cache.get(i)),!r&&n&&"cache-only"!==o)return this.getEntryWithRefreshToken(e,t)}if(!r)return;const i=await this.nowProvider(),a=Math.floor(i/1e3);var s;return r.expiresAt-t<a?r.body.refresh_token?this.modifiedCachedEntry(r,e):(await this.cache.remove(e.toKey()),void await(null===(s=this.keyManifest)||void 0===s?void 0:s.remove(e.toKey()))):r.body}async modifiedCachedEntry(e,t){return e.body={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},await this.cache.set(t.toKey(),e),{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}async set(e){var t;const n=new Ke({clientId:e.client_id,scope:e.scope,audience:e.audience}),o=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),o),await(null===(t=this.keyManifest)||void 0===t?void 0:t.add(n.toKey()))}async remove(e,t,n){const o=new Ke({clientId:e,scope:n,audience:t});await this.cache.remove(o.toKey())}async clear(e){var t;const n=await this.getCacheKeys();n&&(await n.filter(t=>!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Ke({clientId:e},Ue,De).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const o=Ke.fromKey(t),r=new Set(o.scope&&o.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=o.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return o.prefix===Ue&&o.clientId===e.clientId&&o.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){for(const o of t){const t=Ke.fromKey(o);if(t.prefix===Ue&&t.clientId===e.clientId){var n;const t=await this.cache.get(o);if(null!=t&&null!==(n=t.body)&&void 0!==n&&n.refresh_token)return this.modifiedCachedEntry(t,e)}}}async updateEntry(e,t){const n=await this.getCacheKeys();if(n)for(const r of n){var o;const n=await this.cache.get(r);(null==n||null===(o=n.body)||void 0===o?void 0:o.refresh_token)===e&&(n.body.refresh_token=t,await this.cache.set(r,n))}}}class Me{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(this.clientId)}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const Ne=e=>"number"==typeof e,ze=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],Je=e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,o,r]=t;if(3!==t.length||!n||!o||!r)throw new Error("ID token could not be decoded");const i=JSON.parse(j(o)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],ze.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:o,signature:r},header:JSON.parse(j(n)),claims:a,user:s}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error('Issuer (iss) claim mismatch in the ID token; expected "'.concat(e.iss,'", found "').concat(t.claims.iss,'"'));if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new Error('Signature algorithm of "'.concat(t.header.alg,'" is not supported. Expected the ID token to be signed with "RS256".'));if(!t.claims.aud||"string"!=typeof t.claims.aud&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but was not one of "').concat(t.claims.aud.join(", "),'"'));if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error('Authorized Party (azp) claim mismatch in the ID token; expected "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(t.claims.aud,'"'));if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error('Nonce (nonce) claim mismatch in the ID token; expected "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Ne(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!Ne(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ne(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,o=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),o>r)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(o,") is after expiration time (").concat(r,")"));if(null!=t.claims.nbf&&Ne(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),o<e)throw new Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(o,") is before ").concat(e))}if(null!=t.claims.auth_time&&Ne(t.claims.auth_time)){const r=new Date(0);if(r.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),o>r)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(o,") is after last auth at ").concat(r))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t};var Ze=N&&N.__assign||function(){return Ze=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ze.apply(this,arguments)};function Ve(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}function Fe(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return Ve("Expires",e.expires?e.expires.toUTCString():"")+Ve("Domain",e.domain)+Ve("Path",e.path)+Ve("Secure",e.secure)+Ve("SameSite",e.sameSite)}(n)}function Ge(){return function(e){for(var t={},n=e?e.split("; "):[],o=/(%[\dA-F]{2})+/gi,r=0;r<n.length;r++){var i=n[r].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}(document.cookie)}var Xe=function(e){return Ge()[e]};function qe(e,t,n){document.cookie=Fe(e,t,Ze({path:"/"},n))}var Ye=qe;var Be=function(e,t){qe(e,"",Ze(Ze({},t),{expires:-1}))};const Qe={get(e){const t=Xe(e);if(void 0!==t)return JSON.parse(t)},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0,sameSite:"none"}),null!=n&&n.daysUntilExpire&&(o.expires=n.daysUntilExpire),null!=n&&n.cookieDomain&&(o.domain=n.cookieDomain),Ye(e,JSON.stringify(t),o)},remove(e,t){let n={};null!=t&&t.cookieDomain&&(n.domain=t.cookieDomain),Be(e,n)}},$e="_legacy_",et={get(e){const t=Qe.get(e);return t||Qe.get("".concat($e).concat(e))},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0}),null!=n&&n.daysUntilExpire&&(o.expires=n.daysUntilExpire),null!=n&&n.cookieDomain&&(o.domain=n.cookieDomain),Ye("".concat($e).concat(e),JSON.stringify(t),o),Qe.save(e,t,n)},remove(e,t){let n={};null!=t&&t.cookieDomain&&(n.domain=t.cookieDomain),Be(e,n),Qe.remove(e,t),Qe.remove("".concat($e).concat(e),t)}},tt={get(e){if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};let nt=function(e){return e.Code="code",e.ConnectCode="connect_code",e}({});function ot(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,i=n.length;r<i;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),i=r.indexOf("\n",10)+1,a=r.substring(i)+(o?"//# sourceMappingURL="+o:""),s=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(s)}var rt,it,at,st,ct=(rt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQscil7cmV0dXJuKHQ9ZnVuY3Rpb24oZSl7dmFyIHQ9ZnVuY3Rpb24oZSx0KXtpZigib2JqZWN0IiE9dHlwZW9mIGV8fCFlKXJldHVybiBlO3ZhciByPWVbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT1yKXt2YXIgbj1yLmNhbGwoZSx0fHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgbilyZXR1cm4gbjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PXQ/U3RyaW5nOk51bWJlcikoZSl9KGUsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2YgdD90OnQrIiJ9KHQpKWluIGU/T2JqZWN0LmRlZmluZVByb3BlcnR5KGUsdCx7dmFsdWU6cixlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOmVbdF09cixlfWZ1bmN0aW9uIHQoZSx0KXt2YXIgcj1PYmplY3Qua2V5cyhlKTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO3QmJihuPW4uZmlsdGVyKGZ1bmN0aW9uKHQpe3JldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUsdCkuZW51bWVyYWJsZX0pKSxyLnB1c2guYXBwbHkocixuKX1yZXR1cm4gcn1mdW5jdGlvbiByKHIpe2Zvcih2YXIgbj0xO248YXJndW1lbnRzLmxlbmd0aDtuKyspe3ZhciBvPW51bGwhPWFyZ3VtZW50c1tuXT9hcmd1bWVudHNbbl06e307biUyP3QoT2JqZWN0KG8pLCEwKS5mb3JFYWNoKGZ1bmN0aW9uKHQpe2Uocix0LG9bdF0pfSk6T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnM/T2JqZWN0LmRlZmluZVByb3BlcnRpZXMocixPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhvKSk6dChPYmplY3QobykpLmZvckVhY2goZnVuY3Rpb24oZSl7T2JqZWN0LmRlZmluZVByb3BlcnR5KHIsZSxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG8sZSkpfSl9cmV0dXJuIHJ9Y2xhc3MgbiBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKGUsdCl7c3VwZXIodCksdGhpcy5lcnJvcj1lLHRoaXMuZXJyb3JfZGVzY3JpcHRpb249dCxPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxuLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKGUpe2xldHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9PWU7cmV0dXJuIG5ldyBuKHQscil9fWNsYXNzIG8gZXh0ZW5kcyBue2NvbnN0cnVjdG9yKGUsdCl7c3VwZXIoIm1pc3NpbmdfcmVmcmVzaF90b2tlbiIsIk1pc3NpbmcgUmVmcmVzaCBUb2tlbiAoYXVkaWVuY2U6ICciLmNvbmNhdChzKGUsWyJkZWZhdWx0Il0pLCInLCBzY29wZTogJyIpLmNvbmNhdChzKHQpLCInKSIpKSx0aGlzLmF1ZGllbmNlPWUsdGhpcy5zY29wZT10LE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLG8ucHJvdG90eXBlKX19ZnVuY3Rpb24gcyhlKXtyZXR1cm4gZSYmIShhcmd1bWVudHMubGVuZ3RoPjEmJnZvaWQgMCE9PWFyZ3VtZW50c1sxXT9hcmd1bWVudHNbMV06W10pLmluY2x1ZGVzKGUpP2U6IiJ9Y29uc3QgaT1bImNsaWVudElkIl0sYz1lPT57bGV0e2NsaWVudElkOnR9PWUsbj1mdW5jdGlvbihlLHQpe2lmKG51bGw9PWUpcmV0dXJue307dmFyIHIsbixvPWZ1bmN0aW9uKGUsdCl7aWYobnVsbD09ZSlyZXR1cm57fTt2YXIgcj17fTtmb3IodmFyIG4gaW4gZSlpZih7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbikpe2lmKC0xIT09dC5pbmRleE9mKG4pKWNvbnRpbnVlO3Jbbl09ZVtuXX1yZXR1cm4gcn0oZSx0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO2ZvcihuPTA7bjxzLmxlbmd0aDtuKyspcj1zW25dLC0xPT09dC5pbmRleE9mKHIpJiZ7fS5wcm9wZXJ0eUlzRW51bWVyYWJsZS5jYWxsKGUscikmJihvW3JdPWVbcl0pfXJldHVybiBvfShlLGkpO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIodD0+dm9pZCAwIT09ZVt0XSkucmVkdWNlKCh0LG4pPT5yKHIoe30sdCkse30se1tuXTplW25dfSkse30pKShyKHtjbGllbnRfaWQ6dH0sbikpKS50b1N0cmluZygpfTtsZXQgYT17fTtjb25zdCBmPShlLHQpPT4iIi5jb25jYXQoZSwifCIpLmNvbmNhdCh0KTthZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhc3luYyBlPT57bGV0IHQsbix7ZGF0YTp7dGltZW91dDpzLGF1dGg6aSxmZXRjaFVybDp1LGZldGNoT3B0aW9uczpsLHVzZUZvcm1EYXRhOnAsdXNlTXJydDpofSxwb3J0czpbeV19PWUsZD17fTtjb25zdHthdWRpZW5jZTpiLHNjb3BlOk99PWl8fHt9O3RyeXtjb25zdCBlPXA/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKChlLHQpPT57clt0XT1lfSkscn0pKGwuYm9keSk6SlNPTi5wYXJzZShsLmJvZHkpO2lmKCFlLnJlZnJlc2hfdG9rZW4mJiJyZWZyZXNoX3Rva2VuIj09PWUuZ3JhbnRfdHlwZSl7aWYobj0oKGUsdCk9PmFbZihlLHQpXSkoYixPKSwhbiYmaCl7Y29uc3QgZT1hLmxhdGVzdF9yZWZyZXNoX3Rva2VuLHQ9KChlLHQpPT57Y29uc3Qgcj1PYmplY3Qua2V5cyhhKS5maW5kKHI9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09cil7Y29uc3Qgbj0oKGUsdCk9PnQuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSkodCxyKSxvPXIuc3BsaXQoInwiKVsxXS5zcGxpdCgiICIpLHM9ZS5zcGxpdCgiICIpLmV2ZXJ5KGU9Pm8uaW5jbHVkZXMoZSkpO3JldHVybiBuJiZzfX0pO3JldHVybiEhcn0pKE8sYik7ZSYmIXQmJihuPWUpfWlmKCFuKXRocm93IG5ldyBvKGIsTyk7bC5ib2R5PXA/YyhyKHIoe30sZSkse30se3JlZnJlc2hfdG9rZW46bn0pKTpKU09OLnN0cmluZ2lmeShyKHIoe30sZSkse30se3JlZnJlc2hfdG9rZW46bn0pKX1sZXQgaSx3OyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihpPW5ldyBBYm9ydENvbnRyb2xsZXIsbC5zaWduYWw9aS5zaWduYWwpO3RyeXt3PWF3YWl0IFByb21pc2UucmFjZShbKHY9cyxuZXcgUHJvbWlzZShlPT5zZXRUaW1lb3V0KGUsdikpKSxmZXRjaCh1LHIoe30sbCkpXSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgeS5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIXcpcmV0dXJuIGkmJmkuYWJvcnQoKSx2b2lkIHkucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7aj13LmhlYWRlcnMsZD1bLi4ual0ucmVkdWNlKChlLHQpPT57bGV0W3Isbl09dDtyZXR1cm4gZVtyXT1uLGV9LHt9KSx0PWF3YWl0IHcuanNvbigpLHQucmVmcmVzaF90b2tlbj8oaCYmKGEubGF0ZXN0X3JlZnJlc2hfdG9rZW49dC5yZWZyZXNoX3Rva2VuLGc9bixtPXQucmVmcmVzaF90b2tlbixPYmplY3QuZW50cmllcyhhKS5mb3JFYWNoKGU9PntsZXRbdCxyXT1lO3I9PT1nJiYoYVt0XT1tKX0pKSwoKGUsdCxyKT0+e2FbZih0LHIpXT1lfSkodC5yZWZyZXNoX3Rva2VuLGIsTyksZGVsZXRlIHQucmVmcmVzaF90b2tlbik6KChlLHQpPT57ZGVsZXRlIGFbZihlLHQpXX0pKGIsTykseS5wb3N0TWVzc2FnZSh7b2s6dy5vayxqc29uOnQsaGVhZGVyczpkfSl9Y2F0Y2goZSl7eS5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9LGhlYWRlcnM6ZH0pfXZhciBnLG0saix2fSl9KCk7Cgo=",it=null,at=!1,function(e){return st=st||ot(rt,it,at),new Worker(st,e)});const ut={};class lt{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return"".concat(Ue,"::").concat(e)}}const ht=["openUrl","onRedirect"],dt="auth0.is.authenticated",pt={memory:()=>(new Le).enclosedCache,localstorage:()=>new He},ft=e=>pt[e],mt=e=>{const{openUrl:t,onRedirect:n}=e;return l(l({},h(e,ht)),{},{openUrl:!1===t||t?t:n})},yt=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},wt={NONCE:"nonce",KEYPAIR:"keypair"};class gt{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(wt).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const o=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(wt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(wt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(wt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(wt.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(wt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(wt.KEYPAIR,this.clientId)}}class vt{constructor(e){this.storage=new gt(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await _e(),await this.storage.setKeyPair(e)),e}async generateProof(e){return Se(l({keyPair:await this.getOrGenerateKeyPair()},e))}async calculateThumbprint(){return ke(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var bt=function(e){return e.Bearer="Bearer",e.DPoP="DPoP",e}(bt||{});class _t{constructor(e,t){this.hooks=t,this.config=l(l({},e),{},{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),o=e instanceof Request?new Request(n,e):n;return new Request(o,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bt.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),o=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",o)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let o,r;"string"==typeof n?(o=this.config.dpopNonceId?bt.DPoP:bt.Bearer,r=n):(o=n.token_type,r=n.access_token),this.setAuthorizationHeader(e,r,o),o===bt.DPoP&&await this.setDpopProofHeader(e,r)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,ve);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new I(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,o){const r=this.buildBaseRequest(e,t);await this.prepareRequest(r,o);const i=await this.config.fetch(r);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const o={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,l(l({},o),{},{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,o,n)}}class kt{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new St({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new St(t)}}class St extends Error{constructor(e){let{type:t,status:n,title:o,detail:r,validation_errors:i}=e;super(r),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=o,this.detail=r,this.validation_errors=i,Object.setPrototypeOf(this,St.prototype)}}const Tt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}},Et="http://auth0.com/oauth/grant-type/mfa-otp",Pt="http://auth0.com/oauth/grant-type/mfa-oob",At="http://auth0.com/oauth/grant-type/mfa-recovery-code";var xt,It;let Rt;if("undefined"==typeof navigator||null===(xt=navigator.userAgent)||void 0===xt||null===(It=xt.startsWith)||void 0===It||!It.call(xt,"Mozilla/5.0 ")){const e="v3.8.5";Rt="".concat("oauth4webapi","/").concat(e)}function Ct(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Ot="ERR_INVALID_ARG_VALUE",Wt="ERR_INVALID_ARG_TYPE";function Ut(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}const Dt=Symbol(),Kt=Symbol(),Ht=Symbol(),Lt=Symbol(),jt=Symbol(),Mt=Symbol(),Nt=new TextEncoder,zt=new TextDecoder;function Jt(e){return"string"==typeof e?Nt.encode(e):zt.decode(e)}let Zt,Vt;if(Uint8Array.prototype.toBase64)Zt=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Zt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Ft(e){return"string"==typeof e?Vt(e):Zt(e)}Vt=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Ut("The input to be decoded is not correctly encoded.",Ot,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw Ut("The input to be decoded is not correctly encoded.",Ot,e)}};class Gt extends Error{constructor(e,t){var n;super(e,t),c(this,"code",void 0),this.name=this.constructor.name,this.code=qn,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Xt extends Error{constructor(e,t){var n;super(e,t),c(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function qt(e,t,n){return new Xt(e,{code:t,cause:n})}function Yt(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Ut("".concat(t," must be a CryptoKey"),Wt)}(e,t),"private"!==e.type)throw Ut("".concat(t," must be a private CryptoKey"),Ot)}function Bt(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Qt(e){Ct(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Rt&&!t.has("user-agent")&&t.set("user-agent",Rt),t.has("authorization"))throw Ut('"options.headers" must not include the "authorization" header name',Ot);return t}function $t(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw Ut('"options.signal" must return or be an instance of AbortSignal',Wt);return t}}function en(e){return e.includes("//")?e.replace("//","/"):e}async function tn(e,t){return async function(e,t,n,o){if(!(e instanceof URL))throw Ut('"'.concat(t,'" must be an instance of URL'),Wt);yn(e,!0!==(null==o?void 0:o[Dt]));const r=n(new URL(e.href)),i=Qt(null==o?void 0:o.headers);return i.set("accept","application/json"),((null==o?void 0:o[Lt])||fetch)(r.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:$t(r,null==o?void 0:o.signal)})}(e,"issuerIdentifier",e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e,t){e.pathname=en("".concat(e.pathname,"/").concat(t))}(e,".well-known/openid-configuration");break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=en("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Ut('"options.algorithm" must be "oidc" (default), or "oauth2"',Ot)}return e},t)}function nn(e,t,n,o,r){try{if("number"!=typeof e||!Number.isFinite(e))throw Ut("".concat(n," must be a number"),Wt,r);if(e>0)return;if(t){if(0!==e)throw Ut("".concat(n," must be a non-negative number"),Ot,r);return}throw Ut("".concat(n," must be a positive number"),Ot,r)}catch(e){if(o)throw qt(e.message,o,r);throw e}}function on(e,t,n,o){try{if("string"!=typeof e)throw Ut("".concat(t," must be a string"),Wt,o);if(0===e.length)throw Ut("".concat(t," must not be empty"),Ot,o)}catch(e){if(n)throw qt(e.message,n,o);throw e}}function rn(e){!function(e,t){if(Cn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(o.length>2){const e=o.pop();t+="".concat(o.join(", "),", or ").concat(e)}else 2===o.length?t+="".concat(o[0]," or ").concat(o[1]):t+=o[0];return qt(t,$n,e)}(e,t)}(e,"application/json")}function an(){return Ft(crypto.getRandomValues(new Uint8Array(32)))}function sn(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Gt("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 Gt("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 Gt("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 Gt("unsupported CryptoKey algorithm name",{cause:e})}}function cn(e){const t=null==e?void 0:e[Kt];return"number"==typeof t&&Number.isFinite(t)?t:0}function un(e){const t=null==e?void 0:e[Ht];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function ln(){return Math.floor(Date.now()/1e3)}function hn(e){if("object"!=typeof e||null===e)throw Ut('"as" must be an object',Wt);on(e.issuer,'"as.issuer"')}function dn(e){if("object"!=typeof e||null===e)throw Ut('"client" must be an object',Wt);on(e.client_id,'"client.client_id"')}function pn(e){return on(e,'"clientSecret"'),(t,n,o,r)=>{o.set("client_id",n.client_id),o.set("client_secret",e)}}function fn(e,t){const{key:n,kid:o}=(r=e)instanceof CryptoKey?{key:r}:(null==r?void 0:r.key)instanceof CryptoKey?(void 0!==r.kid&&on(r.kid,'"kid"'),{key:r.key,kid:r.kid}):{};var r;return Yt(n,'"clientPrivateKey.key"'),async(e,r,i,a)=>{var s;const c={alg:sn(n),kid:o},u=function(e,t){const n=ln()+cn(t);return{jti:an(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,r);null==t||null===(s=t[jt])||void 0===s||s.call(t,c,u),i.set("client_id",r.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 Ut('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Ot);const o="".concat(Ft(Jt(JSON.stringify(e))),".").concat(Ft(Jt(JSON.stringify(t)))),r=Ft(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:lo(e)};case"RSA-PSS":switch(uo(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 Gt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return uo(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Gt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Jt(o)));return"".concat(o,".").concat(r)}(c,u,n))}}const mn=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function yn(e,t){if(t&&"https:"!==e.protocol)throw qt("only requests to HTTPS are allowed",to,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw qt("only HTTP and HTTPS requests are allowed",no,e)}function wn(e,t,n,o){let r;if("string"!=typeof e||!(r=mn(e)))throw qt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?ao:so,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return yn(r,o),r}function gn(e,t,n,o){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?wn(e.mtls_endpoint_aliases[t],t,n,o):wn(e[t],t,n,o)}class vn extends Error{constructor(e,t){var n;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"error",void 0),c(this,"status",void 0),c(this,"error_description",void 0),c(this,"response",void 0),this.name=this.constructor.name,this.code=Xn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class bn extends Error{constructor(e,t){var n,o;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"error",void 0),c(this,"error_description",void 0),this.name=this.constructor.name,this.code=Yn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(o=Error.captureStackTrace)||void 0===o||o.call(Error,this,this.constructor)}}class _n extends Error{constructor(e,t){var n;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"response",void 0),c(this,"status",void 0),this.name=this.constructor.name,this.code=Gn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const kn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Sn="("+kn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',Tn="("+kn+")\\s*=\\s*("+kn+")",En=new RegExp("^[,\\s]*("+kn+")"),Pn=new RegExp("^[,\\s]*"+Sn+"[,\\s]*(.*)"),An=new RegExp("^[,\\s]*"+Tn+"[,\\s]*(.*)"),xn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function In(e,t,n){if(e.status!==t){let t;var o;if(function(e){let t;if(t=function(e){if(!Ct(e,Response))throw Ut('"response" must be an instance of Response',Wt);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let o=t;for(;o;){var r;let e=o.match(En);const t=null===(r=e)||void 0===r?void 0:r[1].toLowerCase();if(!t)return;const i=o.substring(e[0].length);if(i&&!i.match(/^[\s,]/))return;const a=i.match(/^\s+(.*)$/),s=!!a;o=a?a[1]:void 0;const c={};let u;if(s)for(;o;){let t,n;if(e=o.match(Pn)){if([,t,n,o]=e,n.includes("\\"))try{n=JSON.parse('"'.concat(n,'"'))}catch(e){}c[t.toLowerCase()]=n}else{if(!(e=o.match(An))){if(e=o.match(xn)){if(Object.keys(c).length)break;[,u,o]=e;break}return}[,t,n,o]=e,c[t.toLowerCase()]=n}}else o=i||void 0;const l={scheme:t,parameters:c};u&&(l.token68=u),n.push(l)}return n.length?n:void 0}(e))throw new _n("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){co(e),rn(e);try{const t=await e.clone().json();if(Bt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(o=e.body)||void 0===o?void 0:o.cancel()),new vn("server responded with an error in the response body",{cause:t,response:e});throw qt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),eo,e)}}function Rn(e){if(!Mn.has(e))throw Ut('"options.DPoP" is not a valid DPoPHandle',Ot)}function Cn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function On(e,t,n,o,r,i,a){return await n(e,t,r,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Lt])||fetch)(o.href,{body:r,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:$t(o,null==a?void 0:a.signal)})}async function Wn(e,t,n,o,r,i){var a;const s=gn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Dt]));r.set("grant_type",o);const c=Qt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Rn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await On(e,t,n,s,r,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Un=new WeakMap,Dn=new WeakMap;function Kn(e){if(!e.id_token)return;const t=Un.get(e);if(!t)throw Ut('"ref" was already garbage collected or did not resolve from the proper sources',Ot);return t}async function Hn(e,t,n,o,r,i){if(hn(e),dn(t),!Ct(n,Response))throw Ut('"response" must be an instance of Response',Wt);await In(n,200,"Token Endpoint"),co(n);const a=await go(n);if(on(a.access_token,'"response" body "access_token" property',Qn,{body:a}),on(a.token_type,'"response" body "token_type" property',Qn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;nn(e,!0,'"response" body "expires_in" property',Qn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&on(a.refresh_token,'"response" body "refresh_token" property',Qn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw qt('"response" body "scope" property must be a string',Qn,{body:a});if(void 0!==a.id_token){on(a.id_token,'"response" body "id_token" property',Qn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(nn(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=o&&o.length&&i.push(...o);const{claims:s,jwt:c}=await async function(e,t,n,o,r){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===r)throw new Gt("JWE decryption is not configured",{cause:e});e=await r(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw qt("Invalid JWT",Qn,e);try{i=JSON.parse(Jt(Ft(s)))}catch(e){throw qt("failed to parse JWT Header body as base64url encoded JSON",Bn,e)}if(!Bt(i))throw qt("JWT Header must be a top level object",Qn,e);if(t(i),void 0!==i.crit)throw new Gt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Jt(Ft(c)))}catch(e){throw qt("failed to parse JWT Payload body as base64url encoded JSON",Bn,e)}if(!Bt(a))throw qt("JWT Payload must be a top level object",Qn,e);const l=ln()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw qt('unexpected JWT "exp" (expiration time) claim type',Qn,{claims:a});if(a.exp<=l-o)throw qt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',oo,{claims:a,now:l,tolerance:o,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw qt('unexpected JWT "iat" (issued at) claim type',Qn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw qt('unexpected JWT "iss" (issuer) claim type',Qn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw qt('unexpected JWT "nbf" (not before) claim type',Qn,{claims:a});if(a.nbf>l+o)throw qt('unexpected JWT "nbf" (not before) claim value',oo,{claims:a,now:l,tolerance:o,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw qt('unexpected JWT "aud" (audience) claim type',Qn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,po.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),cn(t),un(t),r).then(Jn.bind(void 0,i)).then(jn.bind(void 0,e)).then(Ln.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw qt('ID Token "aud" (audience) claim includes additional untrusted audiences',ro,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw qt('unexpected ID Token "azp" (authorized party) claim value',ro,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&nn(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Qn,{claims:s}),Dn.set(n,c),Un.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Gt("unsupported `token_type` value",{cause:{body:a}});return a}function Ln(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw qt('unexpected JWT "aud" (audience) claim value',ro,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw qt('unexpected JWT "aud" (audience) claim value',ro,{expected:e,claims:t.claims,claim:"aud"});return t}function jn(e,t){var n,o;const r=null!==(n=null===(o=e[bo])||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==r)throw qt('unexpected JWT "iss" (issuer) claim value',ro,{expected:r,claims:t.claims,claim:"iss"});return t}const Mn=new WeakSet;const Nn=Symbol();const zn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Jn(e,t){for(const n of e)if(void 0===t.claims[n])throw qt('JWT "'.concat(n,'" (').concat(zn[n],") claim missing"),Qn,{claims:t.claims});return t}const Zn=Symbol(),Vn=Symbol();async function Fn(e,t,n,o){return"string"==typeof(null==o?void 0:o.expectedNonce)||"number"==typeof(null==o?void 0:o.maxAge)||null!=o&&o.requireIdToken?async function(e,t,n,o,r,i,a){const s=[];switch(o){case void 0:o=Zn;break;case Zn:break;default:on(o,'"expectedNonce" argument'),s.push("nonce")}switch(null!=r||(r=t.default_max_age),r){case void 0:r=Vn;break;case Vn:break;default:nn(r,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Hn(e,t,n,s,i,a);on(c.id_token,'"response" body "id_token" property',Qn,{body:c});const u=Kn(c);if(r!==Vn){const e=ln()+cn(t),n=un(t);if(u.auth_time+r<e-n)throw qt("too much time has elapsed since the last End-User authentication",oo,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(o===Zn){if(void 0!==u.nonce)throw qt('unexpected ID Token "nonce" claim value',ro,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==o)throw qt('unexpected ID Token "nonce" claim value',ro,{expected:o,claims:u,claim:"nonce"});return c}(e,t,n,o.expectedNonce,o.maxAge,o[Mt],o.recognizedTokenTypes):async function(e,t,n,o,r){const i=await Hn(e,t,n,void 0,o,r),a=Kn(i);if(a){if(void 0!==t.default_max_age){nn(t.default_max_age,!0,'"client.default_max_age"');const e=ln()+cn(t),n=un(t);if(a.auth_time+t.default_max_age<e-n)throw qt("too much time has elapsed since the last End-User authentication",oo,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw qt('unexpected ID Token "nonce" claim value',ro,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==o?void 0:o[Mt],null==o?void 0:o.recognizedTokenTypes)}const Gn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Xn="OAUTH_RESPONSE_BODY_ERROR",qn="OAUTH_UNSUPPORTED_OPERATION",Yn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Bn="OAUTH_PARSE_ERROR",Qn="OAUTH_INVALID_RESPONSE",$n="OAUTH_RESPONSE_IS_NOT_JSON",eo="OAUTH_RESPONSE_IS_NOT_CONFORM",to="OAUTH_HTTP_REQUEST_FORBIDDEN",no="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",oo="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",ro="OAUTH_JWT_CLAIM_COMPARISON_FAILED",io="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",ao="OAUTH_MISSING_SERVER_METADATA",so="OAUTH_INVALID_SERVER_METADATA";function co(e){if(e.bodyUsed)throw Ut('"response" body has been used already',Ot)}function uo(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Gt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function lo(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Gt("unsupported ECDSA namedCurve",{cause:e})}}async function ho(e){if("POST"!==e.method)throw Ut("form_post responses are expected to use the POST method",Ot,{cause:e});if("application/x-www-form-urlencoded"!==Cn(e))throw Ut("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Ot,{cause:e});return async function(e){if(e.bodyUsed)throw Ut("form_post Request instances must contain a readable body",Ot,{cause:e});return e.text()}(e)}function po(e,t,n,o){if(void 0===e)if(Array.isArray(t)){if(!t.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw qt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?o.alg!==n:"function"==typeof n?!n(o.alg):!n.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:n,reason:"default value"})}else if("string"==typeof e?o.alg!==e:!e.includes(o.alg))throw qt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:e,reason:"client configuration"})}function fo(e,t){const{0:n,length:o}=e.getAll(t);if(o>1)throw qt('"'.concat(t,'" parameter must be provided only once'),Qn);return n}const mo=Symbol(),yo=Symbol();function wo(e,t,n,o){if(hn(e),dn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Ut('"parameters" must be an instance of URLSearchParams, or URL',Wt);if(fo(n,"response"))throw qt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Qn,{parameters:n});const r=fo(n,"iss"),i=fo(n,"state");if(!r&&e.authorization_response_iss_parameter_supported)throw qt('response parameter "iss" (issuer) missing',Qn,{parameters:n});if(r&&r!==e.issuer)throw qt('unexpected "iss" (issuer) response parameter value',Qn,{expected:e.issuer,parameters:n});switch(o){case void 0:case yo:if(void 0!==i)throw qt('unexpected "state" response parameter encountered',Qn,{expected:void 0,parameters:n});break;case mo:break;default:if(on(o,'"expectedState" argument'),i!==o)throw qt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Qn,{expected:o,parameters:n})}if(fo(n,"error"))throw new bn("authorization response from the server is an error",{cause:n});const a=fo(n,"id_token"),s=fo(n,"token");if(void 0!==a||void 0!==s)throw new Gt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Mn.add(c),c;var c}async function go(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rn;try{t=await e.json()}catch(t){throw n(e),qt('failed to parse "response" body as JSON',Bn,t)}if(!Bt(t))throw qt('"response" body must be a top level object',Qn,{body:t});return t}const vo=Symbol(),bo=Symbol(),_o=new TextEncoder,ko=new TextDecoder;function So(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const o=e.charCodeAt(n);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=o}return t}function To(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}function Eo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:ko.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=ko.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return To(t)}catch(e){throw new TypeError("The input to be decoded is not correctly encoded.")}}const Po=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))},Ao=(e,t)=>e.name===t;function xo(e,t){var n;if((n=e.hash,parseInt(n.name.slice(4),10))!==t)throw Po("SHA-".concat(t),"algorithm.hash")}function Io(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":if(!Ao(e.algorithm,"HMAC"))throw Po("HMAC");xo(e.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if(!Ao(e.algorithm,"RSASSA-PKCS1-v1_5"))throw Po("RSASSA-PKCS1-v1_5");xo(e.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if(!Ao(e.algorithm,"RSA-PSS"))throw Po("RSA-PSS");xo(e.algorithm,parseInt(t.slice(2),10));break;case"Ed25519":case"EdDSA":if(!Ao(e.algorithm,"Ed25519"))throw Po("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":if(!Ao(e.algorithm,t))throw Po(t);break;case"ES256":case"ES384":case"ES512":{if(!Ao(e.algorithm,"ECDSA"))throw Po("ECDSA");const n=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==n)throw Po(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}!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)}function Ro(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if((o=o.filter(Boolean)).length>2){const t=o.pop();e+="one of type ".concat(o.join(", "),", or ").concat(t,".")}else 2===o.length?e+="one of type ".concat(o[0]," or ").concat(o[1],"."):e+="of type ".concat(o[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Co=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return Ro("Key for the ".concat(e," algorithm must be "),t,...o)};class Oo extends Error{constructor(e,t){var n;super(e,t),c(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}c(Oo,"code","ERR_JOSE_GENERIC");class Wo extends Oo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),c(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),c(this,"claim",void 0),c(this,"reason",void 0),c(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}c(Wo,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Uo extends Oo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),c(this,"code","ERR_JWT_EXPIRED"),c(this,"claim",void 0),c(this,"reason",void 0),c(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}c(Uo,"code","ERR_JWT_EXPIRED");class Do extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}c(Do,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Ko extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JOSE_NOT_SUPPORTED")}}c(Ko,"code","ERR_JOSE_NOT_SUPPORTED");c(class extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED");c(class extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Ho extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWS_INVALID")}}c(Ho,"code","ERR_JWS_INVALID");class Lo extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWT_INVALID")}}c(Lo,"code","ERR_JWT_INVALID");c(class extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class jo extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWKS_INVALID")}}c(jo,"code","ERR_JWKS_INVALID");class Mo extends Oo{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),c(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}c(Mo,"code","ERR_JWKS_NO_MATCHING_KEY");class No extends Oo{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),c(this,Symbol.asyncIterator,void 0),c(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}c(No,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class zo extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWKS_TIMEOUT")}}c(zo,"code","ERR_JWKS_TIMEOUT");class Jo extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}c(Jo,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Zo=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Vo=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Fo=e=>Zo(e)||Vo(e);function Go(e,t,n){try{return Eo(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Xo(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const qo=e=>Xo(e)&&"string"==typeof e.kty;async function Yo(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ro("Key must be ",e,...n)}(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:"SHA-".concat(e.slice(-3)),name:"HMAC"},!1,[n])}return Io(t,e,n),t}async function Bo(e,t,n,o){const r=await Yo(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,r);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Ko("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,r.algorithm);try{return await crypto.subtle.verify(i,r,n,o)}catch(e){return!1}}const Qo='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function $o(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:o,keyUsages:r}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new Ko(Qo)}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Ko(Qo)}break;case"EC":switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[e.alg]},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Ko(Qo)}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Ko(Qo)}break;default:throw new Ko('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=l({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,o,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:r)}const er="given KeyObject instance cannot be used for this algorithm";let tr;const nr=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];tr||(tr=new WeakMap);let r=tr.get(e);if(null!=r&&r[n])return r[n];const i=await $o(l(l({},t),{},{alg:n}));return o&&Object.freeze(e),r?r[n]=i:tr.set(e,{[n]:i}),i};async function or(e,t){if(e instanceof Uint8Array)return e;if(Zo(e))return e;if(Vo(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{tr||(tr=new WeakMap);let n=tr.get(e);if(null!=n&&n[t])return n[t];const o="public"===e.type,r=!!o;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(er)}i=e.toCryptoKey(e.asymmetricKeyType,r,o?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(er);i=e.toCryptoKey(e.asymmetricKeyType,r,[o?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(er);i=e.toCryptoKey(e.asymmetricKeyType,r,[o?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(er)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},r,o?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},r,[o?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(er);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},r,[o?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},r,o?[]:["deriveBits"]))}if(!i)throw new TypeError(er);return n?n[t]=i:tr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return nr(e,n,t)}if(qo(e))return e.k?Eo(e.k):nr(e,e,t,!0);throw new Error("unreachable")}const rr=(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},ir=e=>{const t=e.data[e.pos++];if(128&t){const n=127&t;let o=0;for(let t=0;t<n;t++)o=o<<8|e.data[e.pos++];return o}return t},ar=(e,t,n)=>{if(e.data[e.pos++]!==t)throw new Error(n)},sr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n};const cr=e=>{const t=(e=>{ar(e,6,"Expected algorithm OID");const t=ir(e);return sr(e,t)})(e);if(rr(t,[43,101,110]))return"X25519";if(!rr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");ar(e,6,"Expected curve OID");const n=ir(e),o=sr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(rr(o,t))return e;throw new Error("Unsupported named curve")},ur=async(e,t,n,o)=>{var r;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=o.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Ko("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Ko('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(r=null==o?void 0:o.extractable)&&void 0!==r?r:!!s,a)},lr=(e,t,n)=>{var o;const r=((e,t)=>To(e.replace(t,"")))(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);let i=n;return null!=t&&null!==(o=t.startsWith)&&void 0!==o&&o.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){ar(e,48,"Invalid PKCS#8 structure"),ir(e),ar(e,2,"Expected version field");const t=ir(e);e.pos+=t,ar(e,48,"Expected algorithm identifier");const n=ir(e);e.pos}(t),cr(t)}),ur("pkcs8",r,t,i)};const hr=e=>null==e?void 0:e[Symbol.toStringTag],dr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var o,r;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(o=t.key_ops)||void 0===o||null===(r=o.includes)||void 0===r?void 0:r.call(o,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};function pr(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(qo(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&dr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Fo(t))throw new TypeError(Co(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(hr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(qo(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&dr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&dr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Fo(t))throw new TypeError(Co(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(hr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(hr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(hr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(hr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(hr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}var fr,mr;let yr,wr;if("undefined"==typeof navigator||null===(fr=navigator.userAgent)||void 0===fr||null===(mr=fr.startsWith)||void 0===mr||!mr.call(fr,"Mozilla/5.0 ")){const e="v6.8.2";wr="".concat("openid-client","/").concat(e),yr={"user-agent":wr}}const gr=e=>vr.get(e);let vr,br;function _r(e){return void 0!==e?pn(e):(br||(br=new WeakMap),(e,t,n,o)=>{let r;return(r=br.get(t))||(!function(e,t){if("string"!=typeof e)throw Er("".concat(t," must be a string"),Tr);if(0===e.length)throw Er("".concat(t," must not be empty"),Sr)}(t.client_secret,'"metadata.client_secret"'),r=pn(t.client_secret),br.set(t,r)),r(e,t,n,o)})}const kr=Lt,Sr="ERR_INVALID_ARG_VALUE",Tr="ERR_INVALID_ARG_TYPE";function Er(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}function Pr(e){return async function(e){return on(e,"codeVerifier"),Ft(await crypto.subtle.digest("SHA-256",Jt(e)))}(e)}function Ar(){return an()}class xr extends Error{constructor(e,t){var n;super(e,t),c(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 Ir(e,t,n){return new xr(e,{cause:t,code:n})}function Rr(e){if(e instanceof TypeError||e instanceof xr||e instanceof vn||e instanceof bn||e instanceof _n)throw e;if(e instanceof Xt)switch(e.code){case to:throw Ir("only requests to HTTPS are allowed",e,e.code);case no:throw Ir("only requests to HTTP or HTTPS are allowed",e,e.code);case eo:throw Ir("unexpected HTTP response status code",e.cause,e.code);case $n:throw Ir("unexpected response content-type",e.cause,e.code);case Bn:throw Ir("parsing error occured",e,e.code);case Qn:throw Ir("invalid response encountered",e,e.code);case ro:throw Ir("unexpected JWT claim value encountered",e,e.code);case io:throw Ir("unexpected JSON attribute value encountered",e,e.code);case oo:throw Ir("JWT timestamp claim value failed validation",e,e.code);default:throw Ir(e.message,e,e.code)}if(e instanceof Gt)throw Ir("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Ir("runtime operation error",e,qn);case"NotSupportedError":throw Ir("runtime unsupported operation",e,qn);case"TimeoutError":throw Ir("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Ir("operation aborted",e,"OAUTH_ABORT")}throw new xr("something went wrong",{cause:e})}async function Cr(e,t,n,o,r){const i=await async function(e,t){var n,o;if(!(e instanceof URL))throw Er('"server" must be an instance of URL',Tr);const r=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(r?tn(e,{algorithm:null==t?void 0:t.algorithm,[Lt]:null==t?void 0:t[kr],[Dt]:null==t||null===(o=t.execute)||void 0===o?void 0:o.includes(jr),signal:a,headers:new Headers(yr)}):((null==t?void 0:t[kr])||fetch)((yn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(jr)),e.href),{headers:Object.fromEntries(new Headers(l({accept:"application/json"},yr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==vo)throw Ut('"expectedIssuerIdentifier" must be an instance of URL',Wt);if(!Ct(t,Response))throw Ut('"response" must be an instance of Response',Wt);if(200!==t.status)throw qt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',eo,t);co(t);const o=await go(t);if(on(o.issuer,'"response" body "issuer" property',Qn,{body:o}),n!==vo&&new URL(o.issuer).href!==n.href)throw qt('"response" body "issuer" property does not match the expected value',io,{expected:n.href,body:o,attribute:"issuer"});return o}(vo,e)).catch(Rr);var c;r&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Or]=!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 xr("discovered metadata issuer does not match the expected issuer",{code:io,cause:{expected:e.href,body:s,attribute:"issuer"}})})());return s}(e,r),a=new Wr(i,t,n,o);let s=gr(a);if(null!=r&&r[kr]&&(s.fetch=r[kr]),null!=r&&r.timeout&&(s.timeout=r.timeout),null!=r&&r.execute)for(const e of r.execute)e(a);return a}new TextDecoder;const Or=Symbol();class Wr{constructor(e,t,n,o){var r,i,a,s,c;if("string"!=typeof t||!t.length)throw Er('"clientId" must be a non-empty string',Tr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(r=n)||void 0===r?void 0:r.client_id)&&t!==n.client_id)throw Er('"clientId" and "metadata.client_id" must be the same',Sr);const u=l(l({},structuredClone(n)),{},{client_id:t});let h;u[Kt]=null!==(i=null===(a=n)||void 0===a?void 0:a[Kt])&&void 0!==i?i:0,u[Ht]=null!==(s=null===(c=n)||void 0===c?void 0:c[Ht])&&void 0!==s?s:30,h=o||("string"==typeof u.client_secret&&u.client_secret.length?_r(u.client_secret):(e,t,n,o)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const p=structuredClone(e);Or in e&&(p[bo]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let f=Object.freeze(p);vr||(vr=new WeakMap),vr.set(this,{__proto__:null,as:f,c:d,auth:h,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(gr(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(gr(this).c)}get timeout(){return gr(this).timeout}set timeout(e){gr(this).timeout=e}get[kr](){return gr(this).fetch}set[kr](e){gr(this).fetch=e}}function Ur(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Kn(this)}catch(e){return}}}}}(e))}async function Dr(e,t,n){var o;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(o=e.headers.get("retry-after"))||void 0===o?void 0:o.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(r&&!Number.isFinite(a))throw new Xt("invalid Retry-After header value",{cause:e});a>t&&await Kr(a-t,n)}function Kr(e,t){return new Promise((n,o)=>{const r=e=>{try{t.throwIfAborted()}catch(e){return void o(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>r(e-i),1e3*i)};r(e)})}async function Hr(e,t){Vr(e);const{as:n,c:o,auth:r,fetch:i,tlsOnly:a,timeout:s}=gr(e);return async function(e,t,n,o,r){hn(e),dn(t);const i=gn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),a=new URLSearchParams(o);a.set("client_id",t.client_id);const s=Qt(null==r?void 0:r.headers);return s.set("accept","application/json"),On(e,t,n,i,a,s,r)}(n,o,r,t,{[Lt]:i,[Dt]:!a,headers:new Headers(yr),signal:Fr(s)}).then(e=>async function(e,t,n){if(hn(e),dn(t),!Ct(n,Response))throw Ut('"response" must be an instance of Response',Wt);await In(n,200,"Backchannel Authentication Endpoint"),co(n);const o=await go(n);on(o.auth_req_id,'"response" body "auth_req_id" property',Qn,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',Qn,{body:o}),o.expires_in=r,void 0!==o.interval&&nn(o.interval,!1,'"response" body "interval" property',Qn,{body:o}),o}(n,o,e)).catch(Rr)}async function Lr(e,t,n,o){var r,i;Vr(e),n=new URLSearchParams(n);let a=null!==(r=t.interval)&&void 0!==r?r:5;const s=null!==(i=null==o?void 0:o.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Kr(a,s)}catch(e){Rr(e)}const{as:c,c:u,auth:h,fetch:d,tlsOnly:p,nonRepudiation:f,timeout:m,decrypt:y}=gr(e),w=(r,i)=>Lr(e,l(l({},t),{},{interval:r}),n,l(l({},o),{},{signal:s,flag:i})),g=await async function(e,t,n,o,r){hn(e),dn(t),on(o,'"authReqId"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("auth_req_id",o),Wn(e,t,n,"urn:openid:params:grant-type:ciba",i,r)}(c,u,h,t.auth_req_id,{[Lt]:d,[Dt]:!p,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:s.aborted?s:Fr(m)}).catch(Rr);var v;if(503===g.status&&g.headers.has("retry-after"))return await Dr(g,a,s,!0),await(null===(v=g.body)||void 0===v?void 0:v.cancel()),w(a);const b=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[Mt],null==o?void 0:o.recognizedTokenTypes)}(c,u,g,{[Mt]:y});let _;try{_=await b}catch(e){if(Gr(e,o))return w(a,Xr);if(e instanceof vn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await Dr(e.response,a,s),w(a)}Rr(e)}return _.id_token&&await(null==f?void 0:f(g)),Ur(_),_}function jr(e){gr(e).tlsOnly=!1}async function Mr(e,t,n,o,r){if(Vr(e),!((null==r?void 0:r.flag)===Xr||t instanceof URL||function(e,t){try{return Object.getPrototypeOf(e)[Symbol.toStringTag]===t}catch(e){return!1}}(t,"Request")))throw Er('"currentUrl" must be an instance of URL, or Request',Tr);let i,a;const{as:s,c:c,auth:u,fetch:h,tlsOnly:d,jarm:p,hybrid:f,nonRepudiation:m,timeout:y,decrypt:w,implicit:g}=gr(e);if((null==r?void 0:r.flag)===Xr)i=r.authResponse,a=r.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await ho(e));if(f)t.hash=n.toString();else for(const[e,o]of n.entries())t.searchParams.append(e,o);break;default:throw Er("unexpected Request HTTP method",Sr)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!p:i=await p(t,null==n?void 0:n.expectedState);break;case!!f:i=await f(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!g:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=wo(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Rr(e)}}}const v=await async function(e,t,n,o,r,i,a){if(hn(e),dn(t),!Mn.has(o))throw Ut('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Ot);on(r,'"redirectUri"');const s=fo(o,"code");if(!s)throw qt('no authorization code in "callbackParameters"',Qn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",r),c.set("code",s),i!==Nn&&(on(i,'"codeVerifier"'),c.set("code_verifier",i)),Wn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Nn,{additionalParameters:o,[Lt]:h,[Dt]:!d,DPoP:null==r?void 0:r.DPoP,headers:new Headers(yr),signal:Fr(y)}).catch(Rr);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=Fn(s,c,v,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[Mt]:w});let _;try{_=await b}catch(t){if(Gr(t,r))return Mr(e,void 0,n,o,l(l({},r),{},{flag:Xr,authResponse:i,redirectUri:a}));Rr(t)}return _.id_token&&await(null==m?void 0:m(v)),Ur(_),_}async function Nr(e,t,n,o){Vr(e),n=new URLSearchParams(n);const{as:r,c:i,auth:a,fetch:s,tlsOnly:c,nonRepudiation:u,timeout:h,decrypt:d}=gr(e),p=await async function(e,t,n,o,r){hn(e),dn(t),on(o,'"refreshToken"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("refresh_token",o),Wn(e,t,n,"refresh_token",i,r)}(r,i,a,t,{[Lt]:s,[Dt]:!c,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:Fr(h)}).catch(Rr),f=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[Mt],null==o?void 0:o.recognizedTokenTypes)}(r,i,p,{[Mt]:d});let m;try{m=await f}catch(r){if(Gr(r,o))return Nr(e,t,n,l(l({},o),{},{flag:Xr}));Rr(r)}return m.id_token&&await(null==u?void 0:u(p)),Ur(m),m}async function zr(e,t,n){Vr(e),t=new URLSearchParams(t);const{as:o,c:r,auth:i,fetch:a,tlsOnly:s,timeout:c}=gr(e),u=await async function(e,t,n,o,r){return hn(e),dn(t),Wn(e,t,n,"client_credentials",new URLSearchParams(o),r)}(o,r,i,t,{[Lt]:a,[Dt]:!s,DPoP:null==n?void 0:n.DPoP,headers:new Headers(yr),signal:Fr(c)}).catch(Rr),h=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[Mt],null==o?void 0:o.recognizedTokenTypes)}(o,r,u);let d;try{d=await h}catch(o){if(Gr(o,n))return zr(e,t,l(l({},n),{},{flag:Xr}));Rr(o)}return Ur(d),d}function Jr(e,t){Vr(e);const{as:n,c:o,tlsOnly:r,hybrid:i,jarm:a,implicit:s}=gr(e),c=gn(n,"authorization_endpoint",!1,r);if((t=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",i?"code id_token":s?"id_token":"code"),s&&!t.has("nonce"))throw Er("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",Sr);a&&t.set("response_mode","jwt")}for(const[e,n]of t.entries())c.searchParams.append(e,n);return c}async function Zr(e,t,n){Vr(e);const o=Jr(e,t),{as:r,c:i,auth:a,fetch:s,tlsOnly:c,timeout:u}=gr(e),h=await async function(e,t,n,o,r){var i;hn(e),dn(t);const a=gn(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Dt])),s=new URLSearchParams(o);s.set("client_id",t.client_id);const c=Qt(null==r?void 0:r.headers);c.set("accept","application/json"),void 0!==(null==r?void 0:r.DPoP)&&(Rn(r.DPoP),await r.DPoP.addProof(a,c,"POST"));const u=await On(e,t,n,a,s,c,r);return null==r||null===(i=r.DPoP)||void 0===i||i.cacheNonce(u,a),u}(r,i,a,o.searchParams,{[Lt]:s,[Dt]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(yr),signal:Fr(u)}).catch(Rr),d=async function(e,t,n){if(hn(e),dn(t),!Ct(n,Response))throw Ut('"response" must be an instance of Response',Wt);await In(n,201,"Pushed Authorization Request Endpoint"),co(n);const o=await go(n);on(o.request_uri,'"response" body "request_uri" property',Qn,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',Qn,{body:o}),o.expires_in=r,o}(r,i,h);let p;try{p=await d}catch(o){if(Gr(o,n))return Zr(e,t,l(l({},n),{},{flag:Xr}));Rr(o)}return Jr(e,{request_uri:p.request_uri})}function Vr(e){if(!(e instanceof Wr))throw Er('"config" must be an instance of Configuration',Tr);if(Object.getPrototypeOf(e)!==Wr.prototype)throw Er("subclassing Configuration is not allowed",Sr)}function Fr(e){return e?AbortSignal.timeout(1e3*e):void 0}function Gr(e,t){return!(null==t||!t.DPoP||t.flag===Xr)&&function(e){if(e instanceof _n){const{0:t,length:n}=e.cause;return 1===n&&"dpop"===t.scheme&&"use_dpop_nonce"===t.parameters.error}return e instanceof vn&&"use_dpop_nonce"===e.error}(e)}Object.freeze(Wr.prototype);const Xr=Symbol();async function qr(e,t,n,o){Vr(e);const{as:r,c:i,auth:a,fetch:s,tlsOnly:c,timeout:u,decrypt:l}=gr(e),h=await async function(e,t,n,o,r,i){return hn(e),dn(t),on(o,'"grantType"'),Wn(e,t,n,o,new URLSearchParams(r),i)}(r,i,a,t,new URLSearchParams(n),{[Lt]:s,[Dt]:!c,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:Fr(u)}).then(e=>{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[Mt],null==o?void 0:o.recognizedTokenTypes)}(r,i,e,{[Mt]:l,recognizedTokenTypes:n})}).catch(Rr);return Ur(h),h}async function Yr(e,t,n){if(!Xo(e))throw new Ho("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Ho('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Ho("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Ho("JWS Payload missing");if("string"!=typeof e.signature)throw new Ho("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Xo(e.header))throw new Ho("JWS Unprotected Header incorrect type");let o={};if(e.protected)try{const t=Eo(e.protected);o=JSON.parse(ko.decode(t))}catch(e){throw new Ho("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.filter(Boolean);if(0===o.length||1===o.length)return!0;let r;for(const e of o){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}(o,e.header))throw new Ho("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r=l(l({},o),e.header),i=function(e,t,n,o,r){if(void 0!==r.crit&&void 0===(null==o?void 0:o.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of o.crit){if(!i.has(t))throw new Ko('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(o.crit)}(Ho,new Map([["b64",!0]]),null==n?void 0:n.crit,o,r);let a=!0;if(i.has("b64")&&(a=o.b64,"boolean"!=typeof a))throw new Ho('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=r;if("string"!=typeof s||!s)throw new Ho('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}("algorithms",n.algorithms);if(c&&!c.has(s))throw new Do('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Ho("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Ho("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(o,e),u=!0),pr(s,t,"verify");const h=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.reduce((e,t)=>{let{length:n}=t;return e+n},0),r=new Uint8Array(o);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}(void 0!==e.protected?So(e.protected):new Uint8Array,So("."),"string"==typeof e.payload?a?So(e.payload):_o.encode(e.payload):e.payload),d=Go(e.signature,"signature",Ho),p=await or(t,s);if(!await Bo(s,p,d,h))throw new Jo;let f;f=a?Go(e.payload,"payload",Ho):"string"==typeof e.payload?_o.encode(e.payload):e.payload;const m={payload:f};return void 0!==e.protected&&(m.protectedHeader=o),void 0!==e.header&&(m.unprotectedHeader=e.header),u?l(l({},m),{},{key:p}):m}const Br=86400,Qr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function $r(e){const t=Qr.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let o;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(3600*n);break;case"day":case"days":case"d":o=Math.round(n*Br);break;case"week":case"weeks":case"w":o=Math.round(604800*n);break;default:o=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-o:o}const ei=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function ti(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(ko.decode(t))}catch(e){}if(!Xo(n))throw new Lo("JWT Claims Set must be a top-level JSON object");const{typ:r}=o;if(r&&("string"!=typeof e.typ||ei(e.typ)!==ei(r)))throw new Wo('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=o,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Wo('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Wo('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Wo('unexpected "sub" claim value',n,"sub","check_failed");if(c&&(h=n.aud,d="string"==typeof c?[c]:c,!("string"==typeof h?d.includes(h):Array.isArray(h)&&d.some(Set.prototype.has.bind(new Set(h))))))throw new Wo('unexpected "aud" claim value',n,"aud","check_failed");var h,d;let p;switch(typeof o.clockTolerance){case"string":p=$r(o.clockTolerance);break;case"number":p=o.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=o,m=(y=f||new Date,Math.floor(y.getTime()/1e3));var y;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Wo('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Wo('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new Wo('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Wo('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new Uo('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=m-n.iat;if(e-p>("number"==typeof u?u:$r(u)))throw new Uo('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new Wo('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}async function ni(e,t,n){var o;const r=await async function(e,t,n){if(e instanceof Uint8Array&&(e=ko.decode(e)),"string"!=typeof e)throw new Ho("Compact JWS must be a string or Uint8Array");const{0:o,1:r,2:i,length:a}=e.split(".");if(3!==a)throw new Ho("Invalid Compact JWS");const s=await Yr({payload:r,protected:o,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?l(l({},c),{},{key:s.key}):c}(e,t,n);if(null!==(o=r.protectedHeader.crit)&&void 0!==o&&o.includes("b64")&&!1===r.protectedHeader.b64)throw new Lo("JWTs MUST NOT use unencoded payload");const i={payload:ti(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return"function"==typeof t?l(l({},i),{},{key:r.key}):i}function oi(e){return Xo(e)}var ri,ii,ai=new WeakMap,si=new WeakMap;class ci{constructor(e){if(a(this,ai,void 0),a(this,si,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(oi)}(e))throw new jo("JSON Web Key Set malformed");s(ai,this,structuredClone(e))}jwks(){return i(ai,this)}async getKey(e,t){const{alg:n,kid:r}=l(l({},e),null==t?void 0:t.header),a=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Ko('Unsupported "alg" value for a JSON Web Key Set')}}(n),s=i(ai,this).keys.filter(e=>{let t=a===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==a||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:c,length:u}=s;if(0===u)throw new Mo;if(1!==u){const e=new No,t=i(si,this);throw e[Symbol.asyncIterator]=d(function*(){for(const e of s)try{yield yield o(ui(t,e,n))}catch(e){}}),e}return ui(i(si,this),c,n)}}async function ui(e,t,n){const o=e.get(t)||e.set(t,{}).get(t);if(void 0===o[n]){const e=await async function(e,t,n){var o;if(!Xo(e))throw new TypeError("JWK must be an object");let r;switch(null!=t||(t=e.alg),null!=r||(r=null!==(o=null==n?void 0:n.extractable)&&void 0!==o?o:e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Eo(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Ko('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return $o(l(l({},e),{},{alg:t,ext:r}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return $o(l(l({},e),{},{ext:r}));case"EC":case"OKP":return $o(l(l({},e),{},{alg:t,ext:r}));default:throw new Ko('Unsupported "kty" (Key Type) Parameter value')}}(l(l({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new jo("JSON Web Key Set members must be public keys");o[n]=e}return o[n]}function li(e){const t=new ci(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let hi;if("undefined"==typeof navigator||null===(ri=navigator.userAgent)||void 0===ri||null===(ii=ri.startsWith)||void 0===ii||!ii.call(ri,"Mozilla/5.0 ")){const e="v6.2.2";hi="".concat("jose","/").concat(e)}const di=Symbol();const pi=Symbol();var fi=new WeakMap,mi=new WeakMap,yi=new WeakMap,wi=new WeakMap,gi=new WeakMap,vi=new WeakMap,bi=new WeakMap,_i=new WeakMap,ki=new WeakMap,Si=new WeakMap;class Ti{constructor(e,t){if(a(this,fi,void 0),a(this,mi,void 0),a(this,yi,void 0),a(this,wi,void 0),a(this,gi,void 0),a(this,vi,void 0),a(this,bi,void 0),a(this,_i,void 0),a(this,ki,void 0),a(this,Si,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,o;s(fi,this,new URL(e.href)),s(mi,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),s(yi,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),s(wi,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),s(bi,this,new Headers(null==t?void 0:t.headers)),hi&&!i(bi,this).has("User-Agent")&&i(bi,this).set("User-Agent",hi),i(bi,this).has("accept")||(i(bi,this).set("accept","application/json"),i(bi,this).append("accept","application/jwk-set+json")),s(_i,this,null==t?void 0:t[di]),void 0!==(null==t?void 0:t[pi])&&(s(Si,this,null==t?void 0:t[pi]),n=null==t?void 0:t[pi],o=i(wi,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=o)&&"jwks"in n&&Xo(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Xo)&&(s(gi,this,i(Si,this).uat),s(ki,this,li(i(Si,this).jwks))))}pendingFetch(){return!!i(vi,this)}coolingDown(){return"number"==typeof i(gi,this)&&Date.now()<i(gi,this)+i(yi,this)}fresh(){return"number"==typeof i(gi,this)&&Date.now()<i(gi,this)+i(wi,this)}jwks(){var e;return null===(e=i(ki,this))||void 0===e?void 0:e.jwks()}async getKey(e,t){i(ki,this)&&this.fresh()||await this.reload();try{return await i(ki,this).call(this,e,t)}catch(n){if(n instanceof Mo&&!1===this.coolingDown())return await this.reload(),i(ki,this).call(this,e,t);throw n}}async reload(){i(vi,this)&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&s(vi,this,void 0),i(vi,this)||s(vi,this,async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch;const r=await o(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new zo;throw e});if(200!==r.status)throw new Oo("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch(e){throw new Oo("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(i(fi,this).href,i(bi,this),AbortSignal.timeout(i(mi,this)),i(_i,this)).then(e=>{s(ki,this,li(e)),i(Si,this)&&(i(Si,this).uat=Date.now(),i(Si,this).jwks=e),s(gi,this,Date.now()),s(vi,this,void 0)}).catch(e=>{throw s(vi,this,void 0),e})),await i(vi,this)}}const Ei=["mfaToken"],Pi=["mfaToken"];var Ai,xi,Ii,Ri,Ci,Oi,Wi,Ui,Di,Ki,Hi,Li,ji,Mi,Ni,zi,Ji=class extends Error{constructor(e,t){super(t),c(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Zi=class extends Error{constructor(e,t,n){super(t),c(this,"cause",void 0),c(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Vi=class extends Zi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Fi=class extends Zi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Gi=class extends Zi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Xi=class extends Zi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},qi=class extends Zi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Yi=class extends Zi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Bi=class extends Error{constructor(e){super(e),c(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Qi=class extends Zi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),c(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},$i=class extends Zi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ea=class extends Zi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ta=class extends Zi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},na=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),c(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function oa(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>l(l({},e),{},{[t[0]]:t[1]}),{})}var ra=class extends Error{constructor(e,t,n){super(t),c(this,"cause",void 0),c(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ia=class extends ra{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},aa=class extends ra{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},sa=class extends ra{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},ca=class extends ra{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function ua(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var la=(Ai=new WeakMap,xi=new WeakMap,Ii=new WeakMap,class{constructor(e){var t;a(this,Ai,void 0),a(this,xi,void 0),a(this,Ii,void 0),s(Ai,this,"https://".concat(e.domain)),s(xi,this,e.clientId),s(Ii,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(i(Ai,this),"/mfa/authenticators"),{mfaToken:n}=e,o=await i(Ii,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new ia(e.error_description||"Failed to list authenticators",e)}return(await o.json()).map(ua)}async enrollAuthenticator(e){const t="".concat(i(Ai,this),"/mfa/associate"),{mfaToken:n}=e,o=h(e,Ei),r={authenticator_types:o.authenticatorTypes};"oobChannels"in o&&(r.oob_channels=o.oobChannels),"phoneNumber"in o&&o.phoneNumber&&(r.phone_number=o.phoneNumber),"email"in o&&o.email&&(r.email=o.email);const a=await i(Ii,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const e=await a.json();throw new aa(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await a.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,o="".concat(i(Ai,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),r=await i(Ii,this).call(this,o,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new sa(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(i(Ai,this),"/mfa/challenge"),{mfaToken:n}=e,o=h(e,Pi),r={mfa_token:n,client_id:i(xi,this),challenge_type:o.challengeType};o.authenticatorId&&(r.authenticator_id=o.authenticatorId);const a=await i(Ii,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const e=await a.json();throw new ca(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await a.json())}});var ha=class e{constructor(e,t,n,o,r,i,a){c(this,"accessToken",void 0),c(this,"idToken",void 0),c(this,"refreshToken",void 0),c(this,"expiresAt",void 0),c(this,"scope",void 0),c(this,"claims",void 0),c(this,"authorizationDetails",void 0),c(this,"tokenType",void 0),c(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=o,this.expiresAt=t,this.scope=r,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,o=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return o.tokenType=t.token_type,o.issuedTokenType=t.issued_token_type,o}},da=(Ri=new WeakMap,Ci=new WeakMap,Oi=new WeakMap,class{constructor(e,t){a(this,Ri,new Map),a(this,Ci,void 0),a(this,Oi,void 0),s(Oi,this,Math.max(1,Math.floor(e))),s(Ci,this,Math.max(0,Math.floor(t)))}get(e){const t=i(Ri,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return i(Ri,this).delete(e),i(Ri,this).set(e,t),t.value;i(Ri,this).delete(e)}}set(e,t){for(i(Ri,this).has(e)&&i(Ri,this).delete(e),i(Ri,this).set(e,{value:t,expiresAt:Date.now()+i(Ci,this)});i(Ri,this).size>i(Oi,this);){const e=i(Ri,this).keys().next().value;if(void 0===e)break;i(Ri,this).delete(e)}}}),pa=new Map;function fa(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 ma=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,o=e.ttlMs,"".concat(n,":").concat(o));var n,o;let r=(i=t,pa.get(i));var i;return r||(r=new da(e.maxEntries,e.ttlMs),pa.set(t,r)),r}static createJwksCache(){return{}}},ya="openid profile email offline_access",wa=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 ga(e){if(null==e)throw new Yi("subject_token is required");if("string"!=typeof e)throw new Yi("subject_token must be a string");if(0===e.trim().length)throw new Yi("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Yi("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Yi("subject_token must not include the 'Bearer ' prefix")}function va(e,t){if(t)for(const[n,o]of Object.entries(t))if(!wa.has(n))if(Array.isArray(o)){if(o.length>20)throw new Yi("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));o.forEach(t=>{e.append(n,t)})}else e.append(n,o)}var ba="urn:ietf:params:oauth:token-type:access_token",_a=(Wi=new WeakMap,Ui=new WeakMap,Di=new WeakMap,Ki=new WeakMap,Hi=new WeakMap,Li=new WeakMap,ji=new WeakMap,Mi=new WeakMap,Ni=new WeakMap,zi=new WeakSet,class{constructor(e){var t,n,o,u;if(function(e,t){r(e,t),t.add(e)}(this,zi),a(this,Wi,void 0),a(this,Ui,void 0),a(this,Di,void 0),a(this,Ki,void 0),a(this,Hi,void 0),a(this,Li,void 0),a(this,ji,void 0),a(this,Mi,void 0),a(this,Ni,void 0),c(this,"mfa",void 0),s(Ki,this,e),e.useMtls&&!e.customFetch)throw new Ji("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");s(Hi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},o=btoa(JSON.stringify(n));return async(t,n)=>{const r=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{r.set(t,e)}),r.set("Auth0-Client",o),e(t,l(l({},n),{},{headers:r}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(o=null==n?void 0:n.name)&&void 0!==o?o:"@auth0/auth0-auth-js",version:null!==(u=null==n?void 0:n.version)&&void 0!==u?u:"1.6.0"}));const h=fa(e.discoveryCache);s(ji,this,ma.createDiscoveryCache(h)),s(Mi,this,new Map),s(Ni,this,ma.createJwksCache()),this.mfa=new la({domain:i(Ki,this).domain,clientId:i(Ki,this).clientId,customFetch:i(Hi,this)})}async getServerMetadata(){const{serverMetadata:e}=await n(zi,this,Ta).call(this);return e}async buildAuthorizationUrl(e){const{serverMetadata:t}=await n(zi,this,Ta).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ji("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await n(zi,this,xa).call(this,e)}catch(e){throw new $i(e)}}async buildLinkUserUrl(e){try{const t=await n(zi,this,xa).call(this,{authorizationParams:l(l({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ea(e)}}async buildUnlinkUserUrl(e){try{const t=await n(zi,this,xa).call(this,{authorizationParams:l(l({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ta(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this),r=oa(l(l({},i(Ki,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(l(l({scope:ya},r),{},{client_id:i(Ki,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:o.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&a.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Hr(t,a),n=await Lr(t,e);return ha.fromTokenEndpointResponse(n)}catch(e){throw new Qi(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this),r=oa(l(l({},i(Ki,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(l(l({scope:ya},r),{},{client_id:i(Ki,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:o.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&a.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Hr(t,a);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Qi(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:o}=await n(zi,this,Ta).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await qr(o,"urn:openid:params:grant-type:ciba",r);return ha.fromTokenEndpointResponse(e)}catch(e){throw new Qi(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new qi("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new qi("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?ba:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof Yi)throw new qi(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?n(zi,this,Ea).call(this,e):n(zi,this,Pa).call(this,e)}async getTokenByCode(e,t){const{configuration:o}=await n(zi,this,Ta).call(this);try{const n=await Mr(o,e,{pkceCodeVerifier:t.codeVerifier});return ha.fromTokenEndpointResponse(n)}catch(e){throw new Vi("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=new URLSearchParams;e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope);try{const n=await Nr(t,e.refreshToken,o);return ha.fromTokenEndpointResponse(n)}catch(e){throw new Gi("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=new URLSearchParams({username:e.username,password:e.password});e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope),e.realm&&o.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const o=await n(zi,this,Aa).call(this);r=new Wr(t.serverMetadata(),i(Ki,this).clientId,i(Ki,this).clientSecret,o),r[kr]=(t,n)=>i(Hi,this).call(this,t,l(l({},n),{},{headers:l(l({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await qr(r,"password",o);return ha.fromTokenEndpointResponse(e)}catch(e){throw new Xi("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await n(zi,this,Ta).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const o=await zr(t,n);return ha.fromTokenEndpointResponse(o)}catch(e){throw new Fi("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this);if(!o.end_session_endpoint){const t=new URL("https://".concat(i(Ki,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",i(Ki,this).clientId),t}return function(e,t){Vr(e);const{as:n,c:o,tlsOnly:r}=gr(e),i=gn(n,"end_session_endpoint",!1,r);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",o.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await n(zi,this,Ta).call(this),o=fa(i(Ki,this).discoveryCache),r=t.jwks_uri;i(Li,this)||s(Li,this,function(e,t){const n=new Ti(e,t),o=async(e,t)=>n.getKey(e,t);return Object.defineProperties(o,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),o}(new URL(r),{cacheMaxAge:o.ttlMs,[di]:i(Hi,this),[pi]:i(Ni,this)}));const{payload:a}=await ni(e.logoutToken,i(Li,this),{issuer:t.issuer,audience:i(Ki,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in a)&&!("sub"in a))throw new Bi('either "sid" or "sub" (or both) claims must be present');if("sid"in a&&"string"!=typeof a.sid)throw new Bi('"sid" claim must be a string');if("sub"in a&&"string"!=typeof a.sub)throw new Bi('"sub" claim must be a string');if("nonce"in a)throw new Bi('"nonce" claim is prohibited');if(!("events"in a))throw new Bi('"events" claim is missing');if("object"!=typeof a.events||null===a.events)throw new Bi('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in a.events))throw new Bi('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof a.events["http://schemas.openid.net/event/backchannel-logout"])throw new Bi('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:a.sid,sub:a.sub}}});function ka(){const e=i(Ki,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(i(Ki,this).useMtls?"1":"0")}async function Sa(e){const t=await n(zi,this,Aa).call(this),o=new Wr(e,i(Ki,this).clientId,i(Ki,this).clientSecret,t);return o[kr]=i(Hi,this),o}async function Ta(){if(i(Wi,this)&&i(Ui,this))return{configuration:i(Wi,this),serverMetadata:i(Ui,this)};const e=n(zi,this,ka).call(this),t=i(ji,this).get(e);if(t)return s(Ui,this,t.serverMetadata),s(Wi,this,await n(zi,this,Sa).call(this,t.serverMetadata)),{configuration:i(Wi,this),serverMetadata:i(Ui,this)};const o=i(Mi,this).get(e);if(o){const e=await o;return s(Ui,this,e.serverMetadata),s(Wi,this,await n(zi,this,Sa).call(this,e.serverMetadata)),{configuration:i(Wi,this),serverMetadata:i(Ui,this)}}const r=(async()=>{const t=await n(zi,this,Aa).call(this),o=await Cr(new URL("https://".concat(i(Ki,this).domain)),i(Ki,this).clientId,{use_mtls_endpoint_aliases:i(Ki,this).useMtls},t,{[kr]:i(Hi,this)}),r=o.serverMetadata();return i(ji,this).set(e,{serverMetadata:r}),{configuration:o,serverMetadata:r}})(),a=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});a.catch(()=>{}),i(Mi,this).set(e,a);try{const{configuration:e,serverMetadata:t}=await r;s(Wi,this,e),s(Ui,this,t),i(Wi,this)[kr]=i(Hi,this)}finally{i(Mi,this).delete(e)}return{configuration:i(Wi,this),serverMetadata:i(Ui,this)}}async function Ea(e){var t,o;const{configuration:r}=await n(zi,this,Ta).call(this);if("audience"in e||"resource"in e)throw new Yi("audience and resource parameters are not supported for Token Vault exchanges");ga(e.subjectToken);const i=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:ba,requested_token_type:null!==(o=e.requestedTokenType)&&void 0!==o?o:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&i.append("login_hint",e.loginHint),e.scope&&i.append("scope",e.scope),va(i,e.extra);try{const e=await qr(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",i);return ha.fromTokenEndpointResponse(e)}catch(t){throw new Yi("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Pa(e){const{configuration:t}=await n(zi,this,Ta).call(this);ga(e.subjectToken);const o=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope),e.requestedTokenType&&o.append("requested_token_type",e.requestedTokenType),e.organization&&o.append("organization",e.organization),va(o,e.extra);try{const e=await qr(t,"urn:ietf:params:oauth:grant-type:token-exchange",o);return ha.fromTokenEndpointResponse(e)}catch(t){throw new Yi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Aa(){return i(Di,this)||s(Di,this,(async()=>{if(!i(Ki,this).clientSecret&&!i(Ki,this).clientAssertionSigningKey&&!i(Ki,this).useMtls)throw new na;if(i(Ki,this).useMtls)return(e,t,n,o)=>{n.set("client_id",t.client_id)};let e=i(Ki,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return lr(e,t,n)}(e,i(Ki,this).clientAssertionSigningAlg||"RS256")),e?function(e,t){return fn(e,t)}(e):_r(i(Ki,this).clientSecret)})().catch(e=>{throw s(Di,this,void 0),e})),i(Di,this)}async function xa(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=Ar(),r=await Pr(o),a=oa(l(l({},i(Ki,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(l(l({scope:ya},a),{},{client_id:i(Ki,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Zr(t,s):await Jr(t,s),codeVerifier:o}}class Ia extends v{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ia.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new Ia(t,n)}}class Ra extends Ia{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ra.prototype)}}class Ca extends Ia{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ca.prototype)}}class Oa extends Ia{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Oa.prototype)}}class Wa extends Ia{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Wa.prototype)}}class Ua extends Ia{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ua.prototype)}}class Da{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;c(this,"contexts",new Map),this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,l(l({},t),{},{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class Ka{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Da}setMFAAuthDetails(e,t,n,o){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:o})}async getAuthenticators(e){var t;const n=this.contextManager.get(e);if(null==n||null===(t=n.mfaRequirements)||void 0===t||!t.challenge||0===n.mfaRequirements.challenge.length)throw new Ra("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=n.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){var r;if(e instanceof ia)throw new Ra(null===(r=e.cause)||void 0===r?void 0:r.error,e.message);throw e}}async enroll(e){const t=function(e){const t=Tt[e.factorType];return l(l(l({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(t)}catch(e){var n;if(e instanceof aa)throw new Ca(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async challenge(e){try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){var t;if(e instanceof ca)throw new Oa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new Ua("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new Wa("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?Et:"oobCode"in e&&e.oobCode?Pt:"recoveryCode"in e&&e.recoveryCode?At:void 0}(e);if(!n)throw new Wa("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const o=t.scope,r=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:o,audience:r,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof P)this.setMFAAuthDetails(e.mfa_token,o,r,e.mfa_requirements);else if(e instanceof Wa)throw new Wa(e.error,e.error_description);throw e}}}const Ha=["openUrl","fragment","appState"],La=["url"],ja=["cacheMode"],Ma=["federated"],Na=["openUrl"],za=["id_token","decodedToken"],Ja=["mfaToken"];class Za{constructor(e){let t,n;if(c(this,"userCache",(new Le).enclosedCache),c(this,"defaultOptions",{authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0}),this.options=l(l(l({},this.defaultOptions),e),{},{authorizationParams:l(l({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!O())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===O().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),this.lockManager=(re||(re=oe()),re),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||m,!ft(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=ft(t)()}var o;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Qe:et,this.orgHintCookieName=(o=this.options.clientId,"auth0.".concat(o,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:tt;var i;this.scope=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if("object"!=typeof e)return{[g]:Oe(t,e,...o)};let i={[g]:Oe(t,...o)};return Object.keys(e).forEach(n=>{const r=e[n];i[n]=Oe(t,r,...o)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Me(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||w,this.cacheManager=new je(n,n.allKeys?void 0:new lt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new vt(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(l(l({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{},{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new kt(s,a),this.authJsClient=new _a({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Ka(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===m&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ct)}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||y,n=K(t,!0),o=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(o)}_authorizeUrl(e){return this._url("/authorize?".concat(H(e)))}async _verifyIdToken(e,t,n){const o=await this.nowProvider();return Je({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:o});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),l(l({},e),{},{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var o;const r=U(W()),i=U(W()),a=W(),s=await L(a),c=M(s),u=await(null===(o=this.dpop)||void 0===o?void 0:o.calculateThumbprint()),h=((e,t,n,o,r,i,a,s,c)=>l(l(l({client_id:e.clientId},e.authorizationParams),n),{},{scope:We(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:o,nonce:r,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,r,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(h);return{nonce:i,code_verifier:a,scope:h.scope,audience:h.audience||g,redirect_uri:h.redirect_uri,state:r,url:d}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(e=>{const t=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open(e,"auth0:authorize:popup","left=".concat(t,",top=").concat(n,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(""),!t.popup))throw new E;const o=this._applySessionTransferToken(e.authorizationParams||{}),r=await this._prepareAuthorizeUrl(o,{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const i=await((e,t)=>new Promise((n,o)=>{let r;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",r,!1),o(new T(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),o(new S(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return o(v.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",r)}))(l(l({},t),{},{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(r.url).origin);if(r.state!==i.state)throw new v("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null==t||null===(e=t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null==t||null===(e=t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:o,appState:r}=t,i=h(t,Ha),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),{url:u}=c,d=h(c,La);this.transactionManager.create(l(l({},d),{},{appState:r,response_type:nt.Code},a&&{organization:a}));const p=o?"".concat(u,"#").concat(o):u;n?await n(p):window.location.assign(p)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new v("missing_transaction","Invalid state");this.transactionManager.remove();const n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===nt.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:o,error:r,error_description:i}=e;if(r)throw new b(r,i||r,o,t.appState);if(!t.code_verifier||t.state&&t.state!==o)throw new v("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(l({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:nt.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:o,error:r,error_description:i}=e;if(r)throw new _(r,i||r,t.connection,o,t.appState);if(!n)throw new v("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===o))throw new v("state_mismatch","Invalid state");return l(l({},await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier})),{},{appState:t.appState,response_type:nt.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(dt))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(dt)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=l(l({cacheMode:"on"},n),{},{authorizationParams:l(l(l({},this.options.authorizationParams),n.authorizationParams),{},{scope:We(this.scope,null===(e=n.authorizationParams)||void 0===e?void 0:e.scope,(null===(t=n.authorizationParams)||void 0===t?void 0:t.audience)||this.options.authorizationParams.audience)})}),r=await((e,t)=>{let n=ut[t];return n||(n=e().finally(()=>{delete ut[t],n=null}),ut[t]=n),n})(()=>this._getTokenSilently(o),"".concat(this.options.clientId,"::").concat(o.authorizationParams.audience,"::").concat(o.authorizationParams.scope));return n.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=h(e,ja);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||g,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const o=(r=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(r,".").concat(i));var r,i;try{return await this.lockManager.runWithLock(o,5e3,async()=>{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||g,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:o,token_type:r,access_token:i,oauthTokenScope:a,expires_in:s}=e;return l(l({id_token:o,token_type:r,access_token:i},a?{scope:a}:null),{},{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(n);throw e}}_isInteractiveError(e){return e instanceof P||e instanceof v&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&"Multifactor authentication required"===e.error_description}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||g,clientId:this.options.clientId});if(!t)throw new v("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=l(l({},n),{},{authorizationParams:l(l(l({},this.options.authorizationParams),n.authorizationParams),{},{scope:We(this.scope,null===(e=n.authorizationParams)||void 0===e?void 0:e.scope,(null===(t=n.authorizationParams)||void 0===t?void 0:t.audience)||this.options.authorizationParams.audience)})});o=l(l({},f),o),await this.loginWithPopup(r,o);return(await this.cacheManager.get(new Ke({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||g,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,o=h(t,Ma),r=n?"&federated":"";return this._url("/v2/logout?".concat(H(l({clientId:e.clientId},o))))+r}async logout(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=mt(t),{openUrl:o}=n,r=h(n,Na);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(De),await(null===(e=this.dpop)||void 0===e?void 0:e.clear());const i=this._buildLogoutUrl(r);o?await o(i):!1!==o&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=l(l({},e.authorizationParams),{},{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:o,state:r,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new v("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const h=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const p=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((o,r)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{r(new k),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(v.fromPayload(e.data.response)):o(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(o,d,h);if(r!==p.state)throw new v("state_mismatch","Invalid state");const f=await this._requestToken(l(l({},e.authorizationParams),{},{code_verifier:a,code:p.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return l(l({},f),{},{scope:c,oauthTokenScope:f.scope,audience:u})})}catch(e){if("login_required"===e.error){e instanceof v&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})}throw e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new Ke({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||g,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new A(e.authorizationParams.audience||g,e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,r=((e,t,n,o)=>{if(e&&n&&o){var r;if(t.audience!==n)return t.scope;const e=o.split(" "),i=(null===(r=t.scope)||void 0===r?void 0:r.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?o:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==t?void 0:t.audience,null==t?void 0:t.scope);try{const i=await this._requestToken(l(l({},e.authorizationParams),{},{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n},o&&{timeout:o}),{scopesToRequest:r});if(i.refresh_token&&null!=t&&t.refresh_token&&await this.cacheManager.updateEntry(t.refresh_token,i.refresh_token),this.options.useMrrt){if(s=null==t?void 0:t.audience,c=null==t?void 0:t.scope,u=e.authorizationParams.audience,h=e.authorizationParams.scope,s!==u||!yt(h,c)){if(!yt(r,i.scope)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const t=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],o=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==o.indexOf(e)).join(",")})(r,i.scope);throw new x(e.authorizationParams.audience||"default",t)}}}return l(l({},i),{},{scope:e.authorizationParams.scope,oauthTokenScope:i.scope,audience:e.authorizationParams.audience||g})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}var i,a;if(t instanceof P)this.mfa.setMFAAuthDetails(t.mfa_token,null===(i=e.authorizationParams)||void 0===i?void 0:i.scope,null===(a=e.authorizationParams)||void 0===a?void 0:a.audience,t.mfa_requirements);throw t}var s,c,u,h}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,o=h(e,za);this.userCache.set(De,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(o)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||g,t=this.scope[e],n=await this.cacheManager.getIdToken(new Ke({clientId:this.options.clientId,audience:e,scope:t})),o=this.userCache.get(De);return n&&n.id_token===(null==o?void 0:o.id_token)?o:(this.userCache.set(De,n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:o,cacheMode:r}=e;const i=await this.cacheManager.get(new Ke({scope:t,audience:n,clientId:o}),60,this.options.useMrrt,r);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:o}=i,r=await this._getIdTokenFromCache();return r&&l(l({id_token:r.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{},{expires_in:o})}}async _requestToken(e,t){const{nonceIn:n,organization:o,scopesToRequest:r}=t||{},i=await Ce(l(l({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{},{scope:r||e.scope}),this.worker),a=await this._verifyIdToken(i.id_token,n,o);if("authorization_code"===e.grant_type){var s;const e=await this._getIdTokenFromCache();null!=e&&null!==(s=e.decodedToken)&&void 0!==s&&null!==(s=s.claims)&&void 0!==s&&s.sub&&e.decodedToken.claims.sub!==a.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(De))}return await this._saveEntryInCache(l(l(l({},i),{},{decodedToken:a,scope:e.scope,audience:e.audience||g},i.scope?{oauthTokenScope:i.scope}:null),{},{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(o||a.claims.org_id),l(l({},i),{},{decodedToken:a})}async loginWithCustomTokenExchange(e){return this._requestToken(l(l({},e),{},{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:We(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _t(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null==e||null===(t=e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:o,scopes:r,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!o)throw new Error("connection is required");const s=U(W()),c=W(),u=await L(c),l=M(u),{connect_uri:h,connect_params:d,auth_session:p}=await this.myAccountApi.connectAccount({connection:o,scopes:r,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:o,response_type:nt.ConnectCode});const f=new URL(h);f.searchParams.set("ticket",d.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,o=h(e,Ja);return this._requestToken(l(l({},o),{},{mfa_token:n}),t)}}e.Auth0Client=Za,e.AuthenticationError=b,e.CacheKey=Ke,e.ConnectError=_,e.GenericError=v,e.InMemoryCache=Le,e.LocalStorageCache=He,e.MfaApiClient=Ka,e.MfaChallengeError=Oa,e.MfaEnrollmentError=Ca,e.MfaEnrollmentFactorsError=Ua,e.MfaError=Ia,e.MfaListAuthenticatorsError=Ra,e.MfaRequiredError=P,e.MfaVerifyError=Wa,e.MissingRefreshTokenError=A,e.MyAccountApiError=St,e.PopupCancelledError=T,e.PopupOpenError=E,e.PopupTimeoutError=S,e.ResponseType=nt,e.TimeoutError=k,e.UseDpopNonceError=I,e.User=class{},e.createAuth0Client=async function(e){const t=new Za(e);return await t.checkSession(),t},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).auth0={})}(this,function(e){"use strict";function t(e,t){this.v=e,this.k=t}function n(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 o(e){return new t(e,0)}function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function i(e,t){return e.get(n(e,t))}function a(e,t,n){r(e,t),t.set(e,n)}function s(e,t,o){return e.set(n(e,t),o),o}function c(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");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 u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function h(e){return function(){return new p(e.apply(this,arguments))}}function p(e){var n,o;function r(n,o){try{var a=e[n](o),s=a.value,c=s instanceof t;Promise.resolve(c?s.v:s).then(function(t){if(c){var o="return"===n&&s.k?n:"next";if(!s.k||t.done)return r(o,t);t=e[o](t).value}i(!!a.done,t)},function(e){r("throw",e)})}catch(e){i(2,e)}}function i(e,t){2===e?n.reject(t):n.resolve({value:t,done:e}),(n=n.next)?r(n.key,n.arg):o=null}this._invoke=function(e,t){return new Promise(function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};o?o=o.next=s:(n=o=s,r(e,t))})},"function"!=typeof e.return&&(this.return=void 0)}p.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},p.prototype.next=function(e){return this._invoke("next",e)},p.prototype.throw=function(e){return this._invoke("throw",e)},p.prototype.return=function(e){return this._invoke("return",e)};const f={timeoutInSeconds:60},m="memory",y={name:"auth0-spa-js",version:"2.18.3"},w=()=>Date.now(),g="default";class v extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,v.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new v(t,n)}}class b extends v{constructor(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=o,Object.setPrototypeOf(this,b.prototype)}}class _ extends v{constructor(e,t,n,o){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=o,this.appState=r,Object.setPrototypeOf(this,_.prototype)}}class k extends v{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,k.prototype)}}class S extends k{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,S.prototype)}}class T extends v{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,T.prototype)}}class E extends v{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,E.prototype)}}class P extends v{constructor(e,t,n,o){super(e,t),this.mfa_token=n,this.mfa_requirements=o,Object.setPrototypeOf(this,P.prototype)}}class A extends v{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(R(e,["default"]),"', scope: '").concat(R(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,A.prototype)}}class I extends v{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(R(e,["default"]),"', missing scope: '").concat(R(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,I.prototype)}}class x extends v{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,x.prototype)}}function R(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const C=["clientId"],O=()=>window.crypto,W=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";for(;t.length<43;){const n=O().getRandomValues(new Uint8Array(43-t.length));for(const o of n)t.length<43&&o<198&&(t+=e[o%66])}return t},K=e=>btoa(e),U=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],D=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,o)=>{if(t&&"env"===o)return n;const r=U.find(e=>e.key===o);return r&&r.type.includes(typeof e[o])&&(n[o]=e[o]),n},{})},H=e=>{let{clientId:t}=e,n=d(e,C);return new URLSearchParams((e=>Object.keys(e).filter(t=>void 0!==e[t]).reduce((t,n)=>l(l({},t),{},{[n]:e[n]}),{}))(l({client_id:t},n))).toString()},M=async e=>{const t=O().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},L=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),j=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))};var N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},z={},J={};Object.defineProperty(J,"__esModule",{value:!0});var Z=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var o=e.locked.get(t);void 0===o?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(o.unshift(n),e.locked.set(t,o))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,o){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var o=n.pop();e.locked.set(t,n),void 0!==o&&setTimeout(o,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();J.default=function(){return Z.getInstance()};var V=N&&N.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})},X=N&&N.__generator||function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},G=N;Object.defineProperty(z,"__esModule",{value:!0});var F=J,Y="browser-tabs-lock-key",q={key:function(e){return V(G,void 0,void 0,function(){return X(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return V(G,void 0,void 0,function(){return X(this,function(e){throw new Error("Unsupported")})})},clear:function(){return V(G,void 0,void 0,function(){return X(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return V(G,void 0,void 0,function(){return X(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return V(G,void 0,void 0,function(){return X(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 B(e){return new Promise(function(t){return setTimeout(t,e)})}function Q(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",n="",o=0;o<e;o++){n+=t[Math.floor(61*Math.random())]}return n}var $=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+Q(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),V(this,void 0,void 0,function(){var o,r,i,a,s,c,u;return X(this,function(l){switch(l.label){case 0:o=Date.now()+Q(4),r=Date.now()+n,i=Y+"-"+t,a=void 0===this.storageHandler?q:this.storageHandler,l.label=1;case 1:return Date.now()<r?[4,B(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+o,[4,B(Math.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:o,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,B(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===o?(this.acquiredIatSet.add(o),this.refreshLockWhileAcquired(i,o),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?q:this.storageHandler),[4,this.waitForSomethingToChange(r)];case 6:l.sent(),l.label=7;case 7:return o=Date.now()+Q(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return V(this,void 0,void 0,function(){var n=this;return X(this,function(o){return setTimeout(function(){return V(n,void 0,void 0,function(){var n,o,r;return X(this,function(i){switch(i.label){case 0:return[4,F.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?q:this.storageHandler,null===(o=n.getItemSync(e))?(F.default().unlock(t),[2]):((r=JSON.parse(o)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(r)),F.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(F.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return V(this,void 0,void 0,function(){return X(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var o=!1,r=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!o){o=!0;var t=50-(Date.now()-r);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return V(this,void 0,void 0,function(){return X(this,function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}})})},e.prototype.releaseLock__private__=function(t){return V(this,void 0,void 0,function(){var n,o,r,i;return X(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?q:this.storageHandler,o=Y+"-"+t,null===(r=n.getItemSync(o))?[2]:(i=JSON.parse(r)).id!==this.id?[3,2]:[4,F.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(o),F.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,o=t,r=[],i=0;;){var a=o.keySync(i);if(null===a)break;r.push(a),i++}for(var s=!1,c=0;c<r.length;c++){var u=r[c];if(u.includes(Y)){var l=o.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(o.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}(),ee=z.default=$;class te{async runWithLock(e,t,n){const o=new AbortController,r=setTimeout(()=>o.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:o.signal},async e=>{if(clearTimeout(r),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(r),"AbortError"===(null==e?void 0:e.name))throw new k;throw e}}}class ne{constructor(){c(this,"lock",void 0),c(this,"activeLocks",new Set),c(this,"pagehideHandler",void 0),this.lock=new ee,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let o=!1;for(let n=0;n<10&&!o;n++)o=await this.lock.acquireLock(e,t);if(!o)throw new k;this.activeLocks.add(e),1===this.activeLocks.size&&"undefined"!=typeof window&&window.addEventListener("pagehide",this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),0===this.activeLocks.size&&"undefined"!=typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}function oe(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new te:new ne;var e}let re=null;const ie=new TextEncoder,ae=new TextDecoder;function se(e){return"string"==typeof e?ie.encode(e):ae.decode(e)}function ce(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new pe(`${e.name} modulusLength must be at least 2048 bits`)}async function ue(e,t,n){if(!1===n.usages.includes("sign"))throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');const o=`${de(se(JSON.stringify(e)))}.${de(se(JSON.stringify(t)))}`;return`${o}.${de(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return ce(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return ce(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new he}(n),n,se(o)))}`}let le;if(Uint8Array.prototype.toBase64)le=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;le=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function de(e){return le(e)}class he extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class pe extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}function fe(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new he("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"RSASSA-PKCS1-v1_5":return function(e){if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new he("unsupported RsaHashedKeyAlgorithm hash name")}(e);case"ECDSA":return function(e){if("P-256"===e.algorithm.namedCurve)return"ES256";throw new he("unsupported EcKeyAlgorithm namedCurve")}(e);case"Ed25519":return"Ed25519";default:throw new he("unsupported CryptoKey algorithm name")}}function me(e){return e instanceof CryptoKey}function ye(e){return me(e)&&"public"===e.type}async function we(e,t,n,o,r,i){const a=null==e?void 0:e.privateKey,s=null==e?void 0:e.publicKey;if(!me(c=a)||"private"!==c.type)throw new TypeError('"keypair.privateKey" must be a private CryptoKey');var c;if(!ye(s))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==s.extractable)throw new TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof t)throw new TypeError('"htu" must be a string');if("string"!=typeof n)throw new TypeError('"htm" must be a string');if(void 0!==o&&"string"!=typeof o)throw new TypeError('"nonce" must be a string or undefined');if(void 0!==r&&"string"!=typeof r)throw new TypeError('"accessToken" must be a string or undefined');if(void 0!==i&&("object"!=typeof i||null===i||Array.isArray(i)))throw new TypeError('"additional" must be an object');return ue({alg:fe(a),typ:"dpop+jwt",jwk:await ge(s)},Object.assign(Object.assign({},i),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:n,nonce:o,htu:t,ath:r?de(await crypto.subtle.digest("SHA-256",se(r))):void 0}),a)}async function ge(e){const{kty:t,e:n,n:o,x:r,y:i,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:o,x:r,y:i}}const ve="dpop-nonce",be=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-recovery-code"];function _e(){return async function(e,t){var n;let o;if("string"!=typeof e||0===e.length)throw new TypeError('"alg" must be a non-empty string');switch(e){case"PS256":o={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":o={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":o={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":o={name:"Ed25519"};break;default:throw new he}return crypto.subtle.generateKey(o,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}("ES256",{extractable:!1})}function ke(e){return async function(e){if(!ye(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ge(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new he("unsupported JWK kty")}return de(await crypto.subtle.digest({name:"SHA-256"},se(JSON.stringify(n))))}(e.publicKey)}function Se(e){let{keyPair:t,url:n,method:o,nonce:r,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return we(t,a,o,r,i)}const Te=["error","error_description"],Ee=async(e,t)=>{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(o=n.headers,[...o].reduce((e,t)=>{let[n,o]=t;return e[n]=o,e},{}))};var o},Pe=async(e,t,n)=>{const o=new AbortController;let r;return t.signal=o.signal,Promise.race([Ee(e,t),new Promise((e,t)=>{r=setTimeout(()=>{o.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},Ae=async(e,t,n,o,r,i,a,s)=>((e,t)=>new Promise(function(n,o){const r=new MessageChannel;r.port1.onmessage=function(e){e.data.error?o(new Error(e.data.error)):n(e.data),r.port1.close()},t.postMessage(e,[r.port2])}))({auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:o,useFormData:a,useMrrt:s},i),Ie=async function(e,t,n,o,r,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return r?Ae(e,t,n,o,a,r,i,arguments.length>7?arguments[7]:void 0):Pe(e,o,a)};async function xe(e,t,n,o,r,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:r.method||"GET",nonce:await c.getNonce()});r.headers=l(l({},r.headers),{},{dpop:t})}let h,p=null;for(let c=0;c<3;c++)try{h=await Ie(e,n,o,r,i,a,t,s),p=null;break}catch(e){p=e}if(p)throw p;const{json:{error:f,error_description:m},headers:y,ok:w}=h,g=d(h.json,Te);let b;if(c&&(b=y[ve],b&&await c.setNonce(b)),!w){const l=m||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===f)throw new P(f,l,g.mfa_token,g.mfa_requirements);if("missing_refresh_token"===f)throw new A(n,o);if("use_dpop_nonce"===f){if(!c||!b||u)throw new x(b);return xe(e,t,n,o,r,i,a,s,c,!0)}throw new v(f||"request_error",l)}return g}const Re=["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"];async function Ce(e,t){let{baseUrl:n,timeout:o,audience:r,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,h=d(e,Re);const p="urn:ietf:params:oauth:grant-type:token-exchange"===h.grant_type,f="refresh_token"===h.grant_type&&c,m=l(l(l(l({},h),p&&r&&{audience:r}),p&&i&&{scope:i}),f&&{audience:r,scope:i}),w=s?H(m):JSON.stringify(m),v=(b=h.grant_type,be.includes(b));var b;return await xe("".concat(n,"/oauth/token"),o,r||g,i,{method:"POST",body:w,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(D(a||y)))}},t,s,c,v?u:void 0)}const Oe=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(o=t.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(o))).join(" ");var o},We=(e,t,n)=>{let o;return n&&(o=e[n]),o||(o=e[g]),Oe(o,t)},Ke="@@auth0spajs@@",Ue="@@user@@";class De{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ke,n=arguments.length>2?arguments[2]:void 0;this.prefix=t,this.suffix=n,c(this,"clientId",void 0),c(this,"scope",void 0),c(this,"audience",void 0),this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[t,n,o,r]=e.split("::");return new De({clientId:n,scope:r,audience:o},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:o}=e;return new De({scope:t,audience:n,clientId:o})}}class He{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith(Ke))}}class Me{constructor(){c(this,"enclosedCache",function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}())}}class Le{constructor(e,t,n){this.cache=e,this.keyManifest=t,c(this,"nowProvider",void 0),this.nowProvider=n||w}async setIdToken(e,t,n){var o;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(o=this.keyManifest)||void 0===o?void 0:o.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3?arguments[3]:void 0,r=await this.cache.get(e.toKey());if(!r){const t=await this.getCacheKeys();if(!t)return;const i=this.matchExistingCacheKey(e,t);if(i&&(r=await this.cache.get(i)),!r&&n&&"cache-only"!==o)return this.getEntryWithRefreshToken(e,t)}if(!r)return;const i=await this.nowProvider(),a=Math.floor(i/1e3);var s;return r.expiresAt-t<a?r.body.refresh_token?this.modifiedCachedEntry(r,e):(await this.cache.remove(e.toKey()),void await(null===(s=this.keyManifest)||void 0===s?void 0:s.remove(e.toKey()))):r.body}async modifiedCachedEntry(e,t){return e.body={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},await this.cache.set(t.toKey(),e),{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}async set(e){var t;const n=new De({clientId:e.client_id,scope:e.scope,audience:e.audience}),o=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),o),await(null===(t=this.keyManifest)||void 0===t?void 0:t.add(n.toKey()))}async remove(e,t,n){const o=new De({clientId:e,scope:n,audience:t});await this.cache.remove(o.toKey())}async clear(e){var t;const n=await this.getCacheKeys();n&&(await n.filter(t=>!e||t.includes(e)).reduce(async(e,t)=>{await e,await this.cache.remove(t)},Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new De({clientId:e},Ke,Ue).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const o=De.fromKey(t),r=new Set(o.scope&&o.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=o.scope&&i.reduce((e,t)=>e&&r.has(t),!0);return o.prefix===Ke&&o.clientId===e.clientId&&o.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){for(const o of t){const t=De.fromKey(o);if(t.prefix===Ke&&t.clientId===e.clientId){var n;const t=await this.cache.get(o);if(null!=t&&null!==(n=t.body)&&void 0!==n&&n.refresh_token)return this.modifiedCachedEntry(t,e)}}}async updateEntry(e,t){const n=await this.getCacheKeys();if(n)for(const r of n){var o;const n=await this.cache.get(r);(null==n||null===(o=n.body)||void 0===o?void 0:o.refresh_token)===e&&(n.body.refresh_token=t,await this.cache.set(r,n))}}}class je{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,c(this,"storageKey",void 0),this.storageKey="".concat("a0.spajs.txs",".").concat(this.clientId)}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const Ne=e=>"number"==typeof e,ze=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"],Je=e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,o,r]=t;if(3!==t.length||!n||!o||!r)throw new Error("ID token could not be decoded");const i=JSON.parse(L(o)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],ze.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:o,signature:r},header:JSON.parse(L(n)),claims:a,user:s}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error('Issuer (iss) claim mismatch in the ID token; expected "'.concat(e.iss,'", found "').concat(t.claims.iss,'"'));if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new Error('Signature algorithm of "'.concat(t.header.alg,'" is not supported. Expected the ID token to be signed with "RS256".'));if(!t.claims.aud||"string"!=typeof t.claims.aud&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but was not one of "').concat(t.claims.aud.join(", "),'"'));if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error('Authorized Party (azp) claim mismatch in the ID token; expected "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(t.claims.aud,'"'));if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error('Nonce (nonce) claim mismatch in the ID token; expected "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Ne(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!Ne(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Ne(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,o=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),o>r)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(o,") is after expiration time (").concat(r,")"));if(null!=t.claims.nbf&&Ne(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),o<e)throw new Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(o,") is before ").concat(e))}if(null!=t.claims.auth_time&&Ne(t.claims.auth_time)){const r=new Date(0);if(r.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),o>r)throw new Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(o,") is after last auth at ").concat(r))}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_id,'"'))}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t};var Ze=N&&N.__assign||function(){return Ze=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ze.apply(this,arguments)};function Ve(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}function Xe(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return Ve("Expires",e.expires?e.expires.toUTCString():"")+Ve("Domain",e.domain)+Ve("Path",e.path)+Ve("Secure",e.secure)+Ve("SameSite",e.sameSite)}(n)}function Ge(){return function(e){for(var t={},n=e?e.split("; "):[],o=/(%[\dA-F]{2})+/gi,r=0;r<n.length;r++){var i=n[r].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}(document.cookie)}var Fe=function(e){return Ge()[e]};function Ye(e,t,n){document.cookie=Xe(e,t,Ze({path:"/"},n))}var qe=Ye;var Be=function(e,t){Ye(e,"",Ze(Ze({},t),{expires:-1}))};const Qe={get(e){const t=Fe(e);if(void 0!==t)return JSON.parse(t)},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0,sameSite:"none"}),null!=n&&n.daysUntilExpire&&(o.expires=n.daysUntilExpire),null!=n&&n.cookieDomain&&(o.domain=n.cookieDomain),qe(e,JSON.stringify(t),o)},remove(e,t){let n={};null!=t&&t.cookieDomain&&(n.domain=t.cookieDomain),Be(e,n)}},$e="_legacy_",et={get(e){const t=Qe.get(e);return t||Qe.get("".concat($e).concat(e))},save(e,t,n){let o={};"https:"===window.location.protocol&&(o={secure:!0}),null!=n&&n.daysUntilExpire&&(o.expires=n.daysUntilExpire),null!=n&&n.cookieDomain&&(o.domain=n.cookieDomain),qe("".concat($e).concat(e),JSON.stringify(t),o),Qe.save(e,t,n)},remove(e,t){let n={};null!=t&&t.cookieDomain&&(n.domain=t.cookieDomain),Be(e,n),Qe.remove(e,t),Qe.remove("".concat($e).concat(e),t)}},tt={get(e){if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};let nt=function(e){return e.Code="code",e.ConnectCode="connect_code",e}({});function ot(e,t,n){var o=void 0===t?null:t,r=function(e,t){var n=atob(e);if(t){for(var o=new Uint8Array(n.length),r=0,i=n.length;r<i;++r)o[r]=n.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(o.buffer))}return n}(e,void 0!==n&&n),i=r.indexOf("\n",10)+1,a=r.substring(i)+(o?"//# sourceMappingURL="+o:""),s=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(s)}var rt,it,at,st,ct=(rt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHIsdCl7cmV0dXJuKHI9ZnVuY3Rpb24oZSl7dmFyIHI9ZnVuY3Rpb24oZSxyKXtpZigib2JqZWN0IiE9dHlwZW9mIGV8fCFlKXJldHVybiBlO3ZhciB0PWVbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT10KXt2YXIgbj10LmNhbGwoZSxyfHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgbilyZXR1cm4gbjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PXI/U3RyaW5nOk51bWJlcikoZSl9KGUsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2Ygcj9yOnIrIiJ9KHIpKWluIGU/T2JqZWN0LmRlZmluZVByb3BlcnR5KGUscix7dmFsdWU6dCxlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOmVbcl09dCxlfWZ1bmN0aW9uIHIoZSxyKXt2YXIgdD1PYmplY3Qua2V5cyhlKTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO3ImJihuPW4uZmlsdGVyKGZ1bmN0aW9uKHIpe3JldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUscikuZW51bWVyYWJsZX0pKSx0LnB1c2guYXBwbHkodCxuKX1yZXR1cm4gdH1mdW5jdGlvbiB0KHQpe2Zvcih2YXIgbj0xO248YXJndW1lbnRzLmxlbmd0aDtuKyspe3ZhciBvPW51bGwhPWFyZ3VtZW50c1tuXT9hcmd1bWVudHNbbl06e307biUyP3IoT2JqZWN0KG8pLCEwKS5mb3JFYWNoKGZ1bmN0aW9uKHIpe2UodCxyLG9bcl0pfSk6T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnM/T2JqZWN0LmRlZmluZVByb3BlcnRpZXModCxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhvKSk6cihPYmplY3QobykpLmZvckVhY2goZnVuY3Rpb24oZSl7T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsZSxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG8sZSkpfSl9cmV0dXJuIHR9Y2xhc3MgbiBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKGUscil7c3VwZXIociksdGhpcy5lcnJvcj1lLHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxuLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKGUpe2xldHtlcnJvcjpyLGVycm9yX2Rlc2NyaXB0aW9uOnR9PWU7cmV0dXJuIG5ldyBuKHIsdCl9fWNsYXNzIG8gZXh0ZW5kcyBue2NvbnN0cnVjdG9yKGUscil7c3VwZXIoIm1pc3NpbmdfcmVmcmVzaF90b2tlbiIsIk1pc3NpbmcgUmVmcmVzaCBUb2tlbiAoYXVkaWVuY2U6ICciLmNvbmNhdChzKGUsWyJkZWZhdWx0Il0pLCInLCBzY29wZTogJyIpLmNvbmNhdChzKHIpLCInKSIpKSx0aGlzLmF1ZGllbmNlPWUsdGhpcy5zY29wZT1yLE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLG8ucHJvdG90eXBlKX19ZnVuY3Rpb24gcyhlKXtyZXR1cm4gZSYmIShhcmd1bWVudHMubGVuZ3RoPjEmJnZvaWQgMCE9PWFyZ3VtZW50c1sxXT9hcmd1bWVudHNbMV06W10pLmluY2x1ZGVzKGUpP2U6IiJ9Y29uc3QgaT1bImNsaWVudElkIl0sYz1lPT57bGV0e2NsaWVudElkOnJ9PWUsbj1mdW5jdGlvbihlLHIpe2lmKG51bGw9PWUpcmV0dXJue307dmFyIHQsbixvPWZ1bmN0aW9uKGUscil7aWYobnVsbD09ZSlyZXR1cm57fTt2YXIgdD17fTtmb3IodmFyIG4gaW4gZSlpZih7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbikpe2lmKC0xIT09ci5pbmRleE9mKG4pKWNvbnRpbnVlO3Rbbl09ZVtuXX1yZXR1cm4gdH0oZSxyKTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO2ZvcihuPTA7bjxzLmxlbmd0aDtuKyspdD1zW25dLC0xPT09ci5pbmRleE9mKHQpJiZ7fS5wcm9wZXJ0eUlzRW51bWVyYWJsZS5jYWxsKGUsdCkmJihvW3RdPWVbdF0pfXJldHVybiBvfShlLGkpO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIocj0+dm9pZCAwIT09ZVtyXSkucmVkdWNlKChyLG4pPT50KHQoe30scikse30se1tuXTplW25dfSkse30pKSh0KHtjbGllbnRfaWQ6cn0sbikpKS50b1N0cmluZygpfTtsZXQgYT17fSxsPW51bGw7Y29uc3QgdT0oZSxyKT0+IiIuY29uY2F0KGUsInwiKS5jb25jYXQociksZj1hc3luYyBlPT57bGV0IHIsbix7ZGF0YTp7dGltZW91dDpzLGF1dGg6aSxmZXRjaFVybDpsLGZldGNoT3B0aW9uczpmLHVzZUZvcm1EYXRhOnAsdXNlTXJydDpofSxwb3J0czpbZF19PWUseT17fTtjb25zdHthdWRpZW5jZTpiLHNjb3BlOk99PWl8fHt9O3RyeXtjb25zdCBlPXA/KGU9Pntjb25zdCByPW5ldyBVUkxTZWFyY2hQYXJhbXMoZSksdD17fTtyZXR1cm4gci5mb3JFYWNoKChlLHIpPT57dFtyXT1lfSksdH0pKGYuYm9keSk6SlNPTi5wYXJzZShmLmJvZHkpO2lmKCFlLnJlZnJlc2hfdG9rZW4mJiJyZWZyZXNoX3Rva2VuIj09PWUuZ3JhbnRfdHlwZSl7aWYobj0oKGUscik9PmFbdShlLHIpXSkoYixPKSwhbiYmaCl7Y29uc3QgZT1hLmxhdGVzdF9yZWZyZXNoX3Rva2VuLHI9KChlLHIpPT57Y29uc3QgdD1PYmplY3Qua2V5cyhhKS5maW5kKHQ9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09dCl7Y29uc3Qgbj0oKGUscik9PnIuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSkocix0KSxvPXQuc3BsaXQoInwiKVsxXS5zcGxpdCgiICIpLHM9ZS5zcGxpdCgiICIpLmV2ZXJ5KGU9Pm8uaW5jbHVkZXMoZSkpO3JldHVybiBuJiZzfX0pO3JldHVybiEhdH0pKE8sYik7ZSYmIXImJihuPWUpfWlmKCFuKXRocm93IG5ldyBvKGIsTyk7Zi5ib2R5PXA/Yyh0KHQoe30sZSkse30se3JlZnJlc2hfdG9rZW46bn0pKTpKU09OLnN0cmluZ2lmeSh0KHQoe30sZSkse30se3JlZnJlc2hfdG9rZW46bn0pKX1sZXQgaSx2OyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihpPW5ldyBBYm9ydENvbnRyb2xsZXIsZi5zaWduYWw9aS5zaWduYWwpO3RyeXt2PWF3YWl0IFByb21pc2UucmFjZShbKGo9cyxuZXcgUHJvbWlzZShlPT5zZXRUaW1lb3V0KGUsaikpKSxmZXRjaChsLHQoe30sZikpXSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIXYpcmV0dXJuIGkmJmkuYWJvcnQoKSx2b2lkIGQucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7dz12LmhlYWRlcnMseT1bLi4ud10ucmVkdWNlKChlLHIpPT57bGV0W3Qsbl09cjtyZXR1cm4gZVt0XT1uLGV9LHt9KSxyPWF3YWl0IHYuanNvbigpLHIucmVmcmVzaF90b2tlbj8oaCYmKGEubGF0ZXN0X3JlZnJlc2hfdG9rZW49ci5yZWZyZXNoX3Rva2VuLGc9bixtPXIucmVmcmVzaF90b2tlbixPYmplY3QuZW50cmllcyhhKS5mb3JFYWNoKGU9PntsZXRbcix0XT1lO3Q9PT1nJiYoYVtyXT1tKX0pKSwoKGUscix0KT0+e2FbdShyLHQpXT1lfSkoci5yZWZyZXNoX3Rva2VuLGIsTyksZGVsZXRlIHIucmVmcmVzaF90b2tlbik6KChlLHIpPT57ZGVsZXRlIGFbdShlLHIpXX0pKGIsTyksZC5wb3N0TWVzc2FnZSh7b2s6di5vayxqc29uOnIsaGVhZGVyczp5fSl9Y2F0Y2goZSl7ZC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9LGhlYWRlcnM6eX0pfXZhciBnLG0sdyxqfTthZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixlPT57Y29uc3R7ZGF0YTpyLHBvcnRzOnR9PWUsW25dPXQ7aWYoInR5cGUiaW4gciYmImluaXQiPT09ci50eXBlKXtpZihudWxsPT09bCl0cnl7bmV3IFVSTChyLmFsbG93ZWRCYXNlVXJsKSxsPXIuYWxsb3dlZEJhc2VVcmx9Y2F0Y2goZSl7cmV0dXJufX1lbHNlImZldGNoVXJsImluIHImJihlPT57aWYoIWwpcmV0dXJuITE7dHJ5e2NvbnN0IHI9bmV3IFVSTChsKS5vcmlnaW4sdD1uZXcgVVJMKGUuZmV0Y2hVcmwpO3JldHVybiB0Lm9yaWdpbj09PXImJiIvb2F1dGgvdG9rZW4iPT09dC5wYXRobmFtZX1jYXRjaChlKXtyZXR1cm4hMX19KShyKT9mKGUpOm51bGw9PW58fG4ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSl9KX0oKTsKCg==",it=null,at=!1,function(e){return st=st||ot(rt,it,at),new Worker(st,e)});const ut={};class lt{constructor(e,t){this.cache=e,this.clientId=t,c(this,"manifestKey",void 0),this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return"".concat(Ke,"::").concat(e)}}const dt=["openUrl","onRedirect"],ht="auth0.is.authenticated",pt={memory:()=>(new Me).enclosedCache,localstorage:()=>new He},ft=e=>pt[e],mt=e=>{const{openUrl:t,onRedirect:n}=e;return l(l({},d(e,dt)),{},{openUrl:!1===t||t?t:n})},yt=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},wt={NONCE:"nonce",KEYPAIR:"keypair"};class gt{constructor(e){c(this,"clientId",void 0),c(this,"dbHandle",void 0),this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(wt).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const o=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{o.onsuccess=()=>e(o.result),o.onerror=()=>t(o.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(wt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(wt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(wt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(wt.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(wt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(wt.KEYPAIR,this.clientId)}}class vt{constructor(e){c(this,"storage",void 0),this.storage=new gt(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await _e(),await this.storage.setKeyPair(e)),e}async generateProof(e){return Se(l({keyPair:await this.getOrGenerateKeyPair()},e))}async calculateThumbprint(){return ke(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var bt=function(e){return e.Bearer="Bearer",e.DPoP="DPoP",e}(bt||{});class _t{constructor(e,t){c(this,"config",void 0),c(this,"hooks",void 0),this.hooks=t,this.config=l(l({},e),{},{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),o=e instanceof Request?new Request(n,e):n;return new Request(o,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bt.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),o=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",o)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let o,r;"string"==typeof n?(o=this.config.dpopNonceId?bt.DPoP:bt.Bearer,r=n):(o=n.token_type,r=n.access_token),this.setAuthorizationHeader(e,r,o),o===bt.DPoP&&await this.setDpopProofHeader(e,r)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,ve);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new x(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,o){const r=this.buildBaseRequest(e,t);await this.prepareRequest(r,o);const i=await this.config.fetch(r);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const o={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,l(l({},o),{},{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,o,n)}}class kt{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new St({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new St(t)}}class St extends Error{constructor(e){let{type:t,status:n,title:o,detail:r,validation_errors:i}=e;super(r),c(this,"type",void 0),c(this,"status",void 0),c(this,"title",void 0),c(this,"detail",void 0),c(this,"validation_errors",void 0),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=o,this.detail=r,this.validation_errors=i,Object.setPrototypeOf(this,St.prototype)}}const Tt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}},Et="http://auth0.com/oauth/grant-type/mfa-otp",Pt="http://auth0.com/oauth/grant-type/mfa-oob",At="http://auth0.com/oauth/grant-type/mfa-recovery-code";var It,xt;let Rt;if("undefined"==typeof navigator||null===(It=navigator.userAgent)||void 0===It||null===(xt=It.startsWith)||void 0===xt||!xt.call(It,"Mozilla/5.0 ")){const e="v3.8.5";Rt="".concat("oauth4webapi","/").concat(e)}function Ct(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Ot="ERR_INVALID_ARG_VALUE",Wt="ERR_INVALID_ARG_TYPE";function Kt(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}const Ut=Symbol(),Dt=Symbol(),Ht=Symbol(),Mt=Symbol(),Lt=Symbol(),jt=Symbol(),Nt=new TextEncoder,zt=new TextDecoder;function Jt(e){return"string"==typeof e?Nt.encode(e):zt.decode(e)}let Zt,Vt;if(Uint8Array.prototype.toBase64)Zt=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Zt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let o=0;o<t.byteLength;o+=e)n.push(String.fromCharCode.apply(null,t.subarray(o,o+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function Xt(e){return"string"==typeof e?Vt(e):Zt(e)}Vt=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Kt("The input to be decoded is not correctly encoded.",Ot,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw Kt("The input to be decoded is not correctly encoded.",Ot,e)}};class Gt extends Error{constructor(e,t){var n;super(e,t),c(this,"code",void 0),this.name=this.constructor.name,this.code=Yn,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Ft extends Error{constructor(e,t){var n;super(e,t),c(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 Yt(e,t,n){return new Ft(e,{code:t,cause:n})}function qt(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Kt("".concat(t," must be a CryptoKey"),Wt)}(e,t),"private"!==e.type)throw Kt("".concat(t," must be a private CryptoKey"),Ot)}function Bt(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Qt(e){Ct(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(Rt&&!t.has("user-agent")&&t.set("user-agent",Rt),t.has("authorization"))throw Kt('"options.headers" must not include the "authorization" header name',Ot);return t}function $t(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw Kt('"options.signal" must return or be an instance of AbortSignal',Wt);return t}}function en(e){return e.includes("//")?e.replace("//","/"):e}async function tn(e,t){return async function(e,t,n,o){if(!(e instanceof URL))throw Kt('"'.concat(t,'" must be an instance of URL'),Wt);yn(e,!0!==(null==o?void 0:o[Ut]));const r=n(new URL(e.href)),i=Qt(null==o?void 0:o.headers);return i.set("accept","application/json"),((null==o?void 0:o[Mt])||fetch)(r.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:$t(r,null==o?void 0:o.signal)})}(e,"issuerIdentifier",e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e,t){e.pathname=en("".concat(e.pathname,"/").concat(t))}(e,".well-known/openid-configuration");break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=en("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Kt('"options.algorithm" must be "oidc" (default), or "oauth2"',Ot)}return e},t)}function nn(e,t,n,o,r){try{if("number"!=typeof e||!Number.isFinite(e))throw Kt("".concat(n," must be a number"),Wt,r);if(e>0)return;if(t){if(0!==e)throw Kt("".concat(n," must be a non-negative number"),Ot,r);return}throw Kt("".concat(n," must be a positive number"),Ot,r)}catch(e){if(o)throw Yt(e.message,o,r);throw e}}function on(e,t,n,o){try{if("string"!=typeof e)throw Kt("".concat(t," must be a string"),Wt,o);if(0===e.length)throw Kt("".concat(t," must not be empty"),Ot,o)}catch(e){if(n)throw Yt(e.message,n,o);throw e}}function rn(e){!function(e,t){if(Cn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(o.length>2){const e=o.pop();t+="".concat(o.join(", "),", or ").concat(e)}else 2===o.length?t+="".concat(o[0]," or ").concat(o[1]):t+=o[0];return Yt(t,$n,e)}(e,t)}(e,"application/json")}function an(){return Xt(crypto.getRandomValues(new Uint8Array(32)))}function sn(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Gt("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 Gt("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 Gt("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 Gt("unsupported CryptoKey algorithm name",{cause:e})}}function cn(e){const t=null==e?void 0:e[Dt];return"number"==typeof t&&Number.isFinite(t)?t:0}function un(e){const t=null==e?void 0:e[Ht];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function ln(){return Math.floor(Date.now()/1e3)}function dn(e){if("object"!=typeof e||null===e)throw Kt('"as" must be an object',Wt);on(e.issuer,'"as.issuer"')}function hn(e){if("object"!=typeof e||null===e)throw Kt('"client" must be an object',Wt);on(e.client_id,'"client.client_id"')}function pn(e){return on(e,'"clientSecret"'),(t,n,o,r)=>{o.set("client_id",n.client_id),o.set("client_secret",e)}}function fn(e,t){const{key:n,kid:o}=(r=e)instanceof CryptoKey?{key:r}:(null==r?void 0:r.key)instanceof CryptoKey?(void 0!==r.kid&&on(r.kid,'"kid"'),{key:r.key,kid:r.kid}):{};var r;return qt(n,'"clientPrivateKey.key"'),async(e,r,i,a)=>{var s;const c={alg:sn(n),kid:o},u=function(e,t){const n=ln()+cn(t);return{jti:an(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,r);null==t||null===(s=t[Lt])||void 0===s||s.call(t,c,u),i.set("client_id",r.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 Kt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Ot);const o="".concat(Xt(Jt(JSON.stringify(e))),".").concat(Xt(Jt(JSON.stringify(t)))),r=Xt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:lo(e)};case"RSA-PSS":switch(uo(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 Gt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return uo(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Gt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Jt(o)));return"".concat(o,".").concat(r)}(c,u,n))}}const mn=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function yn(e,t){if(t&&"https:"!==e.protocol)throw Yt("only requests to HTTPS are allowed",to,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Yt("only HTTP and HTTPS requests are allowed",no,e)}function wn(e,t,n,o){let r;if("string"!=typeof e||!(r=mn(e)))throw Yt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?ao:so,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return yn(r,o),r}function gn(e,t,n,o){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?wn(e.mtls_endpoint_aliases[t],t,n,o):wn(e[t],t,n,o)}class vn extends Error{constructor(e,t){var n;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"error",void 0),c(this,"status",void 0),c(this,"error_description",void 0),c(this,"response",void 0),this.name=this.constructor.name,this.code=Fn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class bn extends Error{constructor(e,t){var n,o;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"error",void 0),c(this,"error_description",void 0),this.name=this.constructor.name,this.code=qn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(o=Error.captureStackTrace)||void 0===o||o.call(Error,this,this.constructor)}}class _n extends Error{constructor(e,t){var n;super(e,t),c(this,"cause",void 0),c(this,"code",void 0),c(this,"response",void 0),c(this,"status",void 0),this.name=this.constructor.name,this.code=Gn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const kn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Sn="("+kn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',Tn="("+kn+")\\s*=\\s*("+kn+")",En=new RegExp("^[,\\s]*("+kn+")"),Pn=new RegExp("^[,\\s]*"+Sn+"[,\\s]*(.*)"),An=new RegExp("^[,\\s]*"+Tn+"[,\\s]*(.*)"),In=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function xn(e,t,n){if(e.status!==t){let t;var o;if(function(e){let t;if(t=function(e){if(!Ct(e,Response))throw Kt('"response" must be an instance of Response',Wt);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let o=t;for(;o;){var r;let e=o.match(En);const t=null===(r=e)||void 0===r?void 0:r[1].toLowerCase();if(!t)return;const i=o.substring(e[0].length);if(i&&!i.match(/^[\s,]/))return;const a=i.match(/^\s+(.*)$/),s=!!a;o=a?a[1]:void 0;const c={};let u;if(s)for(;o;){let t,n;if(e=o.match(Pn)){if([,t,n,o]=e,n.includes("\\"))try{n=JSON.parse('"'.concat(n,'"'))}catch(e){}c[t.toLowerCase()]=n}else{if(!(e=o.match(An))){if(e=o.match(In)){if(Object.keys(c).length)break;[,u,o]=e;break}return}[,t,n,o]=e,c[t.toLowerCase()]=n}}else o=i||void 0;const l={scheme:t,parameters:c};u&&(l.token68=u),n.push(l)}return n.length?n:void 0}(e))throw new _n("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){co(e),rn(e);try{const t=await e.clone().json();if(Bt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(o=e.body)||void 0===o?void 0:o.cancel()),new vn("server responded with an error in the response body",{cause:t,response:e});throw Yt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),eo,e)}}function Rn(e){if(!jn.has(e))throw Kt('"options.DPoP" is not a valid DPoPHandle',Ot)}function Cn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function On(e,t,n,o,r,i,a){return await n(e,t,r,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Mt])||fetch)(o.href,{body:r,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:$t(o,null==a?void 0:a.signal)})}async function Wn(e,t,n,o,r,i){var a;const s=gn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Ut]));r.set("grant_type",o);const c=Qt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Rn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await On(e,t,n,s,r,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Kn=new WeakMap,Un=new WeakMap;function Dn(e){if(!e.id_token)return;const t=Kn.get(e);if(!t)throw Kt('"ref" was already garbage collected or did not resolve from the proper sources',Ot);return t}async function Hn(e,t,n,o,r,i){if(dn(e),hn(t),!Ct(n,Response))throw Kt('"response" must be an instance of Response',Wt);await xn(n,200,"Token Endpoint"),co(n);const a=await go(n);if(on(a.access_token,'"response" body "access_token" property',Qn,{body:a}),on(a.token_type,'"response" body "token_type" property',Qn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;nn(e,!0,'"response" body "expires_in" property',Qn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&on(a.refresh_token,'"response" body "refresh_token" property',Qn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Yt('"response" body "scope" property must be a string',Qn,{body:a});if(void 0!==a.id_token){on(a.id_token,'"response" body "id_token" property',Qn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(nn(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=o&&o.length&&i.push(...o);const{claims:s,jwt:c}=await async function(e,t,n,o,r){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===r)throw new Gt("JWE decryption is not configured",{cause:e});e=await r(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Yt("Invalid JWT",Qn,e);try{i=JSON.parse(Jt(Xt(s)))}catch(e){throw Yt("failed to parse JWT Header body as base64url encoded JSON",Bn,e)}if(!Bt(i))throw Yt("JWT Header must be a top level object",Qn,e);if(t(i),void 0!==i.crit)throw new Gt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Jt(Xt(c)))}catch(e){throw Yt("failed to parse JWT Payload body as base64url encoded JSON",Bn,e)}if(!Bt(a))throw Yt("JWT Payload must be a top level object",Qn,e);const l=ln()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Yt('unexpected JWT "exp" (expiration time) claim type',Qn,{claims:a});if(a.exp<=l-o)throw Yt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',oo,{claims:a,now:l,tolerance:o,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Yt('unexpected JWT "iat" (issued at) claim type',Qn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Yt('unexpected JWT "iss" (issuer) claim type',Qn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Yt('unexpected JWT "nbf" (not before) claim type',Qn,{claims:a});if(a.nbf>l+o)throw Yt('unexpected JWT "nbf" (not before) claim value',oo,{claims:a,now:l,tolerance:o,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Yt('unexpected JWT "aud" (audience) claim type',Qn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,po.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),cn(t),un(t),r).then(Jn.bind(void 0,i)).then(Ln.bind(void 0,e)).then(Mn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Yt('ID Token "aud" (audience) claim includes additional untrusted audiences',ro,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Yt('unexpected ID Token "azp" (authorized party) claim value',ro,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&nn(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Qn,{claims:s}),Un.set(n,c),Kn.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Gt("unsupported `token_type` value",{cause:{body:a}});return a}function Mn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Yt('unexpected JWT "aud" (audience) claim value',ro,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Yt('unexpected JWT "aud" (audience) claim value',ro,{expected:e,claims:t.claims,claim:"aud"});return t}function Ln(e,t){var n,o;const r=null!==(n=null===(o=e[bo])||void 0===o?void 0:o.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==r)throw Yt('unexpected JWT "iss" (issuer) claim value',ro,{expected:r,claims:t.claims,claim:"iss"});return t}const jn=new WeakSet;const Nn=Symbol();const zn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Jn(e,t){for(const n of e)if(void 0===t.claims[n])throw Yt('JWT "'.concat(n,'" (').concat(zn[n],") claim missing"),Qn,{claims:t.claims});return t}const Zn=Symbol(),Vn=Symbol();async function Xn(e,t,n,o){return"string"==typeof(null==o?void 0:o.expectedNonce)||"number"==typeof(null==o?void 0:o.maxAge)||null!=o&&o.requireIdToken?async function(e,t,n,o,r,i,a){const s=[];switch(o){case void 0:o=Zn;break;case Zn:break;default:on(o,'"expectedNonce" argument'),s.push("nonce")}switch(null!=r||(r=t.default_max_age),r){case void 0:r=Vn;break;case Vn:break;default:nn(r,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Hn(e,t,n,s,i,a);on(c.id_token,'"response" body "id_token" property',Qn,{body:c});const u=Dn(c);if(r!==Vn){const e=ln()+cn(t),n=un(t);if(u.auth_time+r<e-n)throw Yt("too much time has elapsed since the last End-User authentication",oo,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(o===Zn){if(void 0!==u.nonce)throw Yt('unexpected ID Token "nonce" claim value',ro,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==o)throw Yt('unexpected ID Token "nonce" claim value',ro,{expected:o,claims:u,claim:"nonce"});return c}(e,t,n,o.expectedNonce,o.maxAge,o[jt],o.recognizedTokenTypes):async function(e,t,n,o,r){const i=await Hn(e,t,n,void 0,o,r),a=Dn(i);if(a){if(void 0!==t.default_max_age){nn(t.default_max_age,!0,'"client.default_max_age"');const e=ln()+cn(t),n=un(t);if(a.auth_time+t.default_max_age<e-n)throw Yt("too much time has elapsed since the last End-User authentication",oo,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw Yt('unexpected ID Token "nonce" claim value',ro,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==o?void 0:o[jt],null==o?void 0:o.recognizedTokenTypes)}const Gn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Fn="OAUTH_RESPONSE_BODY_ERROR",Yn="OAUTH_UNSUPPORTED_OPERATION",qn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Bn="OAUTH_PARSE_ERROR",Qn="OAUTH_INVALID_RESPONSE",$n="OAUTH_RESPONSE_IS_NOT_JSON",eo="OAUTH_RESPONSE_IS_NOT_CONFORM",to="OAUTH_HTTP_REQUEST_FORBIDDEN",no="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",oo="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",ro="OAUTH_JWT_CLAIM_COMPARISON_FAILED",io="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",ao="OAUTH_MISSING_SERVER_METADATA",so="OAUTH_INVALID_SERVER_METADATA";function co(e){if(e.bodyUsed)throw Kt('"response" body has been used already',Ot)}function uo(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Gt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function lo(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Gt("unsupported ECDSA namedCurve",{cause:e})}}async function ho(e){if("POST"!==e.method)throw Kt("form_post responses are expected to use the POST method",Ot,{cause:e});if("application/x-www-form-urlencoded"!==Cn(e))throw Kt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Ot,{cause:e});return async function(e){if(e.bodyUsed)throw Kt("form_post Request instances must contain a readable body",Ot,{cause:e});return e.text()}(e)}function po(e,t,n,o){if(void 0===e)if(Array.isArray(t)){if(!t.includes(o.alg))throw Yt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Yt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?o.alg!==n:"function"==typeof n?!n(o.alg):!n.includes(o.alg))throw Yt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:n,reason:"default value"})}else if("string"==typeof e?o.alg!==e:!e.includes(o.alg))throw Yt('unexpected JWT "alg" header parameter',Qn,{header:o,expected:e,reason:"client configuration"})}function fo(e,t){const{0:n,length:o}=e.getAll(t);if(o>1)throw Yt('"'.concat(t,'" parameter must be provided only once'),Qn);return n}const mo=Symbol(),yo=Symbol();function wo(e,t,n,o){if(dn(e),hn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Kt('"parameters" must be an instance of URLSearchParams, or URL',Wt);if(fo(n,"response"))throw Yt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Qn,{parameters:n});const r=fo(n,"iss"),i=fo(n,"state");if(!r&&e.authorization_response_iss_parameter_supported)throw Yt('response parameter "iss" (issuer) missing',Qn,{parameters:n});if(r&&r!==e.issuer)throw Yt('unexpected "iss" (issuer) response parameter value',Qn,{expected:e.issuer,parameters:n});switch(o){case void 0:case yo:if(void 0!==i)throw Yt('unexpected "state" response parameter encountered',Qn,{expected:void 0,parameters:n});break;case mo:break;default:if(on(o,'"expectedState" argument'),i!==o)throw Yt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Qn,{expected:o,parameters:n})}if(fo(n,"error"))throw new bn("authorization response from the server is an error",{cause:n});const a=fo(n,"id_token"),s=fo(n,"token");if(void 0!==a||void 0!==s)throw new Gt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),jn.add(c),c;var c}async function go(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rn;try{t=await e.json()}catch(t){throw n(e),Yt('failed to parse "response" body as JSON',Bn,t)}if(!Bt(t))throw Yt('"response" body must be a top level object',Qn,{body:t});return t}const vo=Symbol(),bo=Symbol(),_o=new TextEncoder,ko=new TextDecoder;function So(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const o=e.charCodeAt(n);if(o>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=o}return t}function To(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}function Eo(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:ko.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=ko.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return To(t)}catch(e){throw new TypeError("The input to be decoded is not correctly encoded.")}}const Po=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))},Ao=(e,t)=>e.name===t;function Io(e,t){var n;if((n=e.hash,parseInt(n.name.slice(4),10))!==t)throw Po("SHA-".concat(t),"algorithm.hash")}function xo(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":if(!Ao(e.algorithm,"HMAC"))throw Po("HMAC");Io(e.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if(!Ao(e.algorithm,"RSASSA-PKCS1-v1_5"))throw Po("RSASSA-PKCS1-v1_5");Io(e.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if(!Ao(e.algorithm,"RSA-PSS"))throw Po("RSA-PSS");Io(e.algorithm,parseInt(t.slice(2),10));break;case"Ed25519":case"EdDSA":if(!Ao(e.algorithm,"Ed25519"))throw Po("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":if(!Ao(e.algorithm,t))throw Po(t);break;case"ES256":case"ES384":case"ES512":{if(!Ao(e.algorithm,"ECDSA"))throw Po("ECDSA");const n=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==n)throw Po(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}!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)}function Ro(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if((o=o.filter(Boolean)).length>2){const t=o.pop();e+="one of type ".concat(o.join(", "),", or ").concat(t,".")}else 2===o.length?e+="one of type ".concat(o[0]," or ").concat(o[1],"."):e+="of type ".concat(o[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Co=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return Ro("Key for the ".concat(e," algorithm must be "),t,...o)};class Oo extends Error{constructor(e,t){var n;super(e,t),c(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}c(Oo,"code","ERR_JOSE_GENERIC");class Wo extends Oo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),c(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),c(this,"claim",void 0),c(this,"reason",void 0),c(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}c(Wo,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Ko extends Oo{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:o,payload:t}}),c(this,"code","ERR_JWT_EXPIRED"),c(this,"claim",void 0),c(this,"reason",void 0),c(this,"payload",void 0),this.claim=n,this.reason=o,this.payload=t}}c(Ko,"code","ERR_JWT_EXPIRED");class Uo extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}c(Uo,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Do extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JOSE_NOT_SUPPORTED")}}c(Do,"code","ERR_JOSE_NOT_SUPPORTED");c(class extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED");c(class extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Ho extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWS_INVALID")}}c(Ho,"code","ERR_JWS_INVALID");class Mo extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWT_INVALID")}}c(Mo,"code","ERR_JWT_INVALID");c(class extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Lo extends Oo{constructor(){super(...arguments),c(this,"code","ERR_JWKS_INVALID")}}c(Lo,"code","ERR_JWKS_INVALID");class jo extends Oo{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),c(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}c(jo,"code","ERR_JWKS_NO_MATCHING_KEY");class No extends Oo{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),c(this,Symbol.asyncIterator,void 0),c(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}c(No,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class zo extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWKS_TIMEOUT")}}c(zo,"code","ERR_JWKS_TIMEOUT");class Jo extends Oo{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),c(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}c(Jo,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Zo=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Vo=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Xo=e=>Zo(e)||Vo(e);function Go(e,t,n){try{return Eo(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Fo(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const Yo=e=>Fo(e)&&"string"==typeof e.kty;async function qo(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Ro("Key must be ",e,...n)}(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:"SHA-".concat(e.slice(-3)),name:"HMAC"},!1,[n])}return xo(t,e,n),t}async function Bo(e,t,n,o){const r=await qo(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,r);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Do("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,r.algorithm);try{return await crypto.subtle.verify(i,r,n,o)}catch(e){return!1}}const Qo='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function $o(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:o,keyUsages:r}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new Do(Qo)}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new Do(Qo)}break;case"EC":switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[e.alg]},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Do(Qo)}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new Do(Qo)}break;default:throw new Do('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=l({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,o,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:r)}const er="given KeyObject instance cannot be used for this algorithm";let tr;const nr=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];tr||(tr=new WeakMap);let r=tr.get(e);if(null!=r&&r[n])return r[n];const i=await $o(l(l({},t),{},{alg:n}));return o&&Object.freeze(e),r?r[n]=i:tr.set(e,{[n]:i}),i};async function or(e,t){if(e instanceof Uint8Array)return e;if(Zo(e))return e;if(Vo(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{tr||(tr=new WeakMap);let n=tr.get(e);if(null!=n&&n[t])return n[t];const o="public"===e.type,r=!!o;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(er)}i=e.toCryptoKey(e.asymmetricKeyType,r,o?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(er);i=e.toCryptoKey(e.asymmetricKeyType,r,[o?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(er);i=e.toCryptoKey(e.asymmetricKeyType,r,[o?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(er)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},r,o?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},r,[o?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(er);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},r,[o?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},r,o?[]:["deriveBits"]))}if(!i)throw new TypeError(er);return n?n[t]=i:tr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return nr(e,n,t)}if(Yo(e))return e.k?Eo(e.k):nr(e,e,t,!0);throw new Error("unreachable")}const rr=(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},ir=e=>{const t=e.data[e.pos++];if(128&t){const n=127&t;let o=0;for(let t=0;t<n;t++)o=o<<8|e.data[e.pos++];return o}return t},ar=(e,t,n)=>{if(e.data[e.pos++]!==t)throw new Error(n)},sr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n};const cr=e=>{const t=(e=>{ar(e,6,"Expected algorithm OID");const t=ir(e);return sr(e,t)})(e);if(rr(t,[43,101,110]))return"X25519";if(!rr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");ar(e,6,"Expected curve OID");const n=ir(e),o=sr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(rr(o,t))return e;throw new Error("Unsupported named curve")},ur=async(e,t,n,o)=>{var r;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=o.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Do("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Do('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(r=null==o?void 0:o.extractable)&&void 0!==r?r:!!s,a)},lr=(e,t,n)=>{var o;const r=((e,t)=>To(e.replace(t,"")))(e,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);let i=n;return null!=t&&null!==(o=t.startsWith)&&void 0!==o&&o.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){ar(e,48,"Invalid PKCS#8 structure"),ir(e),ar(e,2,"Expected version field");const t=ir(e);e.pos+=t,ar(e,48,"Expected algorithm identifier");const n=ir(e);e.pos}(t),cr(t)}),ur("pkcs8",r,t,i)};const dr=e=>null==e?void 0:e[Symbol.toStringTag],hr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var o,r;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(o=t.key_ops)||void 0===o||null===(r=o.includes)||void 0===r?void 0:r.call(o,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};function pr(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(Yo(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&hr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Xo(t))throw new TypeError(Co(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(dr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Yo(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&hr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&hr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Xo(t))throw new TypeError(Co(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(dr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(dr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(dr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(dr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(dr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}var fr,mr;let yr,wr;if("undefined"==typeof navigator||null===(fr=navigator.userAgent)||void 0===fr||null===(mr=fr.startsWith)||void 0===mr||!mr.call(fr,"Mozilla/5.0 ")){const e="v6.8.2";wr="".concat("openid-client","/").concat(e),yr={"user-agent":wr}}const gr=e=>vr.get(e);let vr,br;function _r(e){return void 0!==e?pn(e):(br||(br=new WeakMap),(e,t,n,o)=>{let r;return(r=br.get(t))||(!function(e,t){if("string"!=typeof e)throw Er("".concat(t," must be a string"),Tr);if(0===e.length)throw Er("".concat(t," must not be empty"),Sr)}(t.client_secret,'"metadata.client_secret"'),r=pn(t.client_secret),br.set(t,r)),r(e,t,n,o)})}const kr=Mt,Sr="ERR_INVALID_ARG_VALUE",Tr="ERR_INVALID_ARG_TYPE";function Er(e,t,n){const o=new TypeError(e,{cause:n});return Object.assign(o,{code:t}),o}function Pr(e){return async function(e){return on(e,"codeVerifier"),Xt(await crypto.subtle.digest("SHA-256",Jt(e)))}(e)}function Ar(){return an()}class Ir extends Error{constructor(e,t){var n;super(e,t),c(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 xr(e,t,n){return new Ir(e,{cause:t,code:n})}function Rr(e){if(e instanceof TypeError||e instanceof Ir||e instanceof vn||e instanceof bn||e instanceof _n)throw e;if(e instanceof Ft)switch(e.code){case to:throw xr("only requests to HTTPS are allowed",e,e.code);case no:throw xr("only requests to HTTP or HTTPS are allowed",e,e.code);case eo:throw xr("unexpected HTTP response status code",e.cause,e.code);case $n:throw xr("unexpected response content-type",e.cause,e.code);case Bn:throw xr("parsing error occured",e,e.code);case Qn:throw xr("invalid response encountered",e,e.code);case ro:throw xr("unexpected JWT claim value encountered",e,e.code);case io:throw xr("unexpected JSON attribute value encountered",e,e.code);case oo:throw xr("JWT timestamp claim value failed validation",e,e.code);default:throw xr(e.message,e,e.code)}if(e instanceof Gt)throw xr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw xr("runtime operation error",e,Yn);case"NotSupportedError":throw xr("runtime unsupported operation",e,Yn);case"TimeoutError":throw xr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw xr("operation aborted",e,"OAUTH_ABORT")}throw new Ir("something went wrong",{cause:e})}async function Cr(e,t,n,o,r){const i=await async function(e,t){var n,o;if(!(e instanceof URL))throw Er('"server" must be an instance of URL',Tr);const r=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(r?tn(e,{algorithm:null==t?void 0:t.algorithm,[Mt]:null==t?void 0:t[kr],[Ut]:null==t||null===(o=t.execute)||void 0===o?void 0:o.includes(Lr),signal:a,headers:new Headers(yr)}):((null==t?void 0:t[kr])||fetch)((yn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Lr)),e.href),{headers:Object.fromEntries(new Headers(l({accept:"application/json"},yr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==vo)throw Kt('"expectedIssuerIdentifier" must be an instance of URL',Wt);if(!Ct(t,Response))throw Kt('"response" must be an instance of Response',Wt);if(200!==t.status)throw Yt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',eo,t);co(t);const o=await go(t);if(on(o.issuer,'"response" body "issuer" property',Qn,{body:o}),n!==vo&&new URL(o.issuer).href!==n.href)throw Yt('"response" body "issuer" property does not match the expected value',io,{expected:n.href,body:o,attribute:"issuer"});return o}(vo,e)).catch(Rr);var c;r&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Or]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new Ir("discovered metadata issuer does not match the expected issuer",{code:io,cause:{expected:e.href,body:s,attribute:"issuer"}})})());return s}(e,r),a=new Wr(i,t,n,o);let s=gr(a);if(null!=r&&r[kr]&&(s.fetch=r[kr]),null!=r&&r.timeout&&(s.timeout=r.timeout),null!=r&&r.execute)for(const e of r.execute)e(a);return a}new TextDecoder;const Or=Symbol();class Wr{constructor(e,t,n,o){var r,i,a,s,c;if("string"!=typeof t||!t.length)throw Er('"clientId" must be a non-empty string',Tr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(r=n)||void 0===r?void 0:r.client_id)&&t!==n.client_id)throw Er('"clientId" and "metadata.client_id" must be the same',Sr);const u=l(l({},structuredClone(n)),{},{client_id:t});let d;u[Dt]=null!==(i=null===(a=n)||void 0===a?void 0:a[Dt])&&void 0!==i?i:0,u[Ht]=null!==(s=null===(c=n)||void 0===c?void 0:c[Ht])&&void 0!==s?s:30,d=o||("string"==typeof u.client_secret&&u.client_secret.length?_r(u.client_secret):(e,t,n,o)=>{n.set("client_id",t.client_id)});let h=Object.freeze(u);const p=structuredClone(e);Or in e&&(p[bo]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let f=Object.freeze(p);vr||(vr=new WeakMap),vr.set(this,{__proto__:null,as:f,c:h,auth:d,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(gr(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(gr(this).c)}get timeout(){return gr(this).timeout}set timeout(e){gr(this).timeout=e}get[kr](){return gr(this).fetch}set[kr](e){gr(this).fetch=e}}function Kr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Dn(this)}catch(e){return}}}}}(e))}async function Ur(e,t,n){var o;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(o=e.headers.get("retry-after"))||void 0===o?void 0:o.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(r&&!Number.isFinite(a))throw new Ft("invalid Retry-After header value",{cause:e});a>t&&await Dr(a-t,n)}function Dr(e,t){return new Promise((n,o)=>{const r=e=>{try{t.throwIfAborted()}catch(e){return void o(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>r(e-i),1e3*i)};r(e)})}async function Hr(e,t){Vr(e);const{as:n,c:o,auth:r,fetch:i,tlsOnly:a,timeout:s}=gr(e);return async function(e,t,n,o,r){dn(e),hn(t);const i=gn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Ut])),a=new URLSearchParams(o);a.set("client_id",t.client_id);const s=Qt(null==r?void 0:r.headers);return s.set("accept","application/json"),On(e,t,n,i,a,s,r)}(n,o,r,t,{[Mt]:i,[Ut]:!a,headers:new Headers(yr),signal:Xr(s)}).then(e=>async function(e,t,n){if(dn(e),hn(t),!Ct(n,Response))throw Kt('"response" must be an instance of Response',Wt);await xn(n,200,"Backchannel Authentication Endpoint"),co(n);const o=await go(n);on(o.auth_req_id,'"response" body "auth_req_id" property',Qn,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',Qn,{body:o}),o.expires_in=r,void 0!==o.interval&&nn(o.interval,!1,'"response" body "interval" property',Qn,{body:o}),o}(n,o,e)).catch(Rr)}async function Mr(e,t,n,o){var r,i;Vr(e),n=new URLSearchParams(n);let a=null!==(r=t.interval)&&void 0!==r?r:5;const s=null!==(i=null==o?void 0:o.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Dr(a,s)}catch(e){Rr(e)}const{as:c,c:u,auth:d,fetch:h,tlsOnly:p,nonRepudiation:f,timeout:m,decrypt:y}=gr(e),w=(r,i)=>Mr(e,l(l({},t),{},{interval:r}),n,l(l({},o),{},{signal:s,flag:i})),g=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"authReqId"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("auth_req_id",o),Wn(e,t,n,"urn:openid:params:grant-type:ciba",i,r)}(c,u,d,t.auth_req_id,{[Mt]:h,[Ut]:!p,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:s.aborted?s:Xr(m)}).catch(Rr);var v;if(503===g.status&&g.headers.has("retry-after"))return await Ur(g,a,s,!0),await(null===(v=g.body)||void 0===v?void 0:v.cancel()),w(a);const b=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[jt],null==o?void 0:o.recognizedTokenTypes)}(c,u,g,{[jt]:y});let _;try{_=await b}catch(e){if(Gr(e,o))return w(a,Fr);if(e instanceof vn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await Ur(e.response,a,s),w(a)}Rr(e)}return _.id_token&&await(null==f?void 0:f(g)),Kr(_),_}function Lr(e){gr(e).tlsOnly=!1}async function jr(e,t,n,o,r){if(Vr(e),!((null==r?void 0:r.flag)===Fr||t instanceof URL||function(e,t){try{return Object.getPrototypeOf(e)[Symbol.toStringTag]===t}catch(e){return!1}}(t,"Request")))throw Er('"currentUrl" must be an instance of URL, or Request',Tr);let i,a;const{as:s,c:c,auth:u,fetch:d,tlsOnly:h,jarm:p,hybrid:f,nonRepudiation:m,timeout:y,decrypt:w,implicit:g}=gr(e);if((null==r?void 0:r.flag)===Fr)i=r.authResponse,a=r.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await ho(e));if(f)t.hash=n.toString();else for(const[e,o]of n.entries())t.searchParams.append(e,o);break;default:throw Er("unexpected Request HTTP method",Sr)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!p:i=await p(t,null==n?void 0:n.expectedState);break;case!!f:i=await f(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!g:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=wo(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Rr(e)}}}const v=await async function(e,t,n,o,r,i,a){if(dn(e),hn(t),!jn.has(o))throw Kt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Ot);on(r,'"redirectUri"');const s=fo(o,"code");if(!s)throw Yt('no authorization code in "callbackParameters"',Qn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",r),c.set("code",s),i!==Nn&&(on(i,'"codeVerifier"'),c.set("code_verifier",i)),Wn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Nn,{additionalParameters:o,[Mt]:d,[Ut]:!h,DPoP:null==r?void 0:r.DPoP,headers:new Headers(yr),signal:Xr(y)}).catch(Rr);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=Xn(s,c,v,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[jt]:w});let _;try{_=await b}catch(t){if(Gr(t,r))return jr(e,void 0,n,o,l(l({},r),{},{flag:Fr,authResponse:i,redirectUri:a}));Rr(t)}return _.id_token&&await(null==m?void 0:m(v)),Kr(_),_}async function Nr(e,t,n,o){Vr(e),n=new URLSearchParams(n);const{as:r,c:i,auth:a,fetch:s,tlsOnly:c,nonRepudiation:u,timeout:d,decrypt:h}=gr(e),p=await async function(e,t,n,o,r){dn(e),hn(t),on(o,'"refreshToken"');const i=new URLSearchParams(null==r?void 0:r.additionalParameters);return i.set("refresh_token",o),Wn(e,t,n,"refresh_token",i,r)}(r,i,a,t,{[Mt]:s,[Ut]:!c,additionalParameters:n,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:Xr(d)}).catch(Rr),f=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[jt],null==o?void 0:o.recognizedTokenTypes)}(r,i,p,{[jt]:h});let m;try{m=await f}catch(r){if(Gr(r,o))return Nr(e,t,n,l(l({},o),{},{flag:Fr}));Rr(r)}return m.id_token&&await(null==u?void 0:u(p)),Kr(m),m}async function zr(e,t,n){Vr(e),t=new URLSearchParams(t);const{as:o,c:r,auth:i,fetch:a,tlsOnly:s,timeout:c}=gr(e),u=await async function(e,t,n,o,r){return dn(e),hn(t),Wn(e,t,n,"client_credentials",new URLSearchParams(o),r)}(o,r,i,t,{[Mt]:a,[Ut]:!s,DPoP:null==n?void 0:n.DPoP,headers:new Headers(yr),signal:Xr(c)}).catch(Rr),d=async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[jt],null==o?void 0:o.recognizedTokenTypes)}(o,r,u);let h;try{h=await d}catch(o){if(Gr(o,n))return zr(e,t,l(l({},n),{},{flag:Fr}));Rr(o)}return Kr(h),h}function Jr(e,t){Vr(e);const{as:n,c:o,tlsOnly:r,hybrid:i,jarm:a,implicit:s}=gr(e),c=gn(n,"authorization_endpoint",!1,r);if((t=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",i?"code id_token":s?"id_token":"code"),s&&!t.has("nonce"))throw Er("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",Sr);a&&t.set("response_mode","jwt")}for(const[e,n]of t.entries())c.searchParams.append(e,n);return c}async function Zr(e,t,n){Vr(e);const o=Jr(e,t),{as:r,c:i,auth:a,fetch:s,tlsOnly:c,timeout:u}=gr(e),d=await async function(e,t,n,o,r){var i;dn(e),hn(t);const a=gn(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[Ut])),s=new URLSearchParams(o);s.set("client_id",t.client_id);const c=Qt(null==r?void 0:r.headers);c.set("accept","application/json"),void 0!==(null==r?void 0:r.DPoP)&&(Rn(r.DPoP),await r.DPoP.addProof(a,c,"POST"));const u=await On(e,t,n,a,s,c,r);return null==r||null===(i=r.DPoP)||void 0===i||i.cacheNonce(u,a),u}(r,i,a,o.searchParams,{[Mt]:s,[Ut]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(yr),signal:Xr(u)}).catch(Rr),h=async function(e,t,n){if(dn(e),hn(t),!Ct(n,Response))throw Kt('"response" must be an instance of Response',Wt);await xn(n,201,"Pushed Authorization Request Endpoint"),co(n);const o=await go(n);on(o.request_uri,'"response" body "request_uri" property',Qn,{body:o});let r="number"!=typeof o.expires_in?parseFloat(o.expires_in):o.expires_in;return nn(r,!0,'"response" body "expires_in" property',Qn,{body:o}),o.expires_in=r,o}(r,i,d);let p;try{p=await h}catch(o){if(Gr(o,n))return Zr(e,t,l(l({},n),{},{flag:Fr}));Rr(o)}return Jr(e,{request_uri:p.request_uri})}function Vr(e){if(!(e instanceof Wr))throw Er('"config" must be an instance of Configuration',Tr);if(Object.getPrototypeOf(e)!==Wr.prototype)throw Er("subclassing Configuration is not allowed",Sr)}function Xr(e){return e?AbortSignal.timeout(1e3*e):void 0}function Gr(e,t){return!(null==t||!t.DPoP||t.flag===Fr)&&function(e){if(e instanceof _n){const{0:t,length:n}=e.cause;return 1===n&&"dpop"===t.scheme&&"use_dpop_nonce"===t.parameters.error}return e instanceof vn&&"use_dpop_nonce"===e.error}(e)}Object.freeze(Wr.prototype);const Fr=Symbol();async function Yr(e,t,n,o){Vr(e);const{as:r,c:i,auth:a,fetch:s,tlsOnly:c,timeout:u,decrypt:l}=gr(e),d=await async function(e,t,n,o,r,i){return dn(e),hn(t),on(o,'"grantType"'),Wn(e,t,n,o,new URLSearchParams(r),i)}(r,i,a,t,new URLSearchParams(n),{[Mt]:s,[Ut]:!c,DPoP:null==o?void 0:o.DPoP,headers:new Headers(yr),signal:Xr(u)}).then(e=>{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,o){return Hn(e,t,n,void 0,null==o?void 0:o[jt],null==o?void 0:o.recognizedTokenTypes)}(r,i,e,{[jt]:l,recognizedTokenTypes:n})}).catch(Rr);return Kr(d),d}async function qr(e,t,n){if(!Fo(e))throw new Ho("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Ho('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Ho("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Ho("JWS Payload missing");if("string"!=typeof e.signature)throw new Ho("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Fo(e.header))throw new Ho("JWS Unprotected Header incorrect type");let o={};if(e.protected)try{const t=Eo(e.protected);o=JSON.parse(ko.decode(t))}catch(e){throw new Ho("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.filter(Boolean);if(0===o.length||1===o.length)return!0;let r;for(const e of o){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}(o,e.header))throw new Ho("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r=l(l({},o),e.header),i=function(e,t,n,o,r){if(void 0!==r.crit&&void 0===(null==o?void 0:o.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of o.crit){if(!i.has(t))throw new Do('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(o.crit)}(Ho,new Map([["b64",!0]]),null==n?void 0:n.crit,o,r);let a=!0;if(i.has("b64")&&(a=o.b64,"boolean"!=typeof a))throw new Ho('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=r;if("string"!=typeof s||!s)throw new Ho('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}("algorithms",n.algorithms);if(c&&!c.has(s))throw new Uo('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Ho("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Ho("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(o,e),u=!0),pr(s,t,"verify");const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const o=t.reduce((e,t)=>{let{length:n}=t;return e+n},0),r=new Uint8Array(o);let i=0;for(const e of t)r.set(e,i),i+=e.length;return r}(void 0!==e.protected?So(e.protected):new Uint8Array,So("."),"string"==typeof e.payload?a?So(e.payload):_o.encode(e.payload):e.payload),h=Go(e.signature,"signature",Ho),p=await or(t,s);if(!await Bo(s,p,h,d))throw new Jo;let f;f=a?Go(e.payload,"payload",Ho):"string"==typeof e.payload?_o.encode(e.payload):e.payload;const m={payload:f};return void 0!==e.protected&&(m.protectedHeader=o),void 0!==e.header&&(m.unprotectedHeader=e.header),u?l(l({},m),{},{key:p}):m}const Br=86400,Qr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function $r(e){const t=Qr.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let o;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(3600*n);break;case"day":case"days":case"d":o=Math.round(n*Br);break;case"week":case"weeks":case"w":o=Math.round(604800*n);break;default:o=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-o:o}const ei=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function ti(e,t){let n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(ko.decode(t))}catch(e){}if(!Fo(n))throw new Mo("JWT Claims Set must be a top-level JSON object");const{typ:r}=o;if(r&&("string"!=typeof e.typ||ei(e.typ)!==ei(r)))throw new Wo('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=o,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Wo('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Wo('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Wo('unexpected "sub" claim value',n,"sub","check_failed");if(c&&(d=n.aud,h="string"==typeof c?[c]:c,!("string"==typeof d?h.includes(d):Array.isArray(d)&&h.some(Set.prototype.has.bind(new Set(d))))))throw new Wo('unexpected "aud" claim value',n,"aud","check_failed");var d,h;let p;switch(typeof o.clockTolerance){case"string":p=$r(o.clockTolerance);break;case"number":p=o.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=o,m=(y=f||new Date,Math.floor(y.getTime()/1e3));var y;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Wo('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Wo('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new Wo('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Wo('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new Ko('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=m-n.iat;if(e-p>("number"==typeof u?u:$r(u)))throw new Ko('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new Wo('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}async function ni(e,t,n){var o;const r=await async function(e,t,n){if(e instanceof Uint8Array&&(e=ko.decode(e)),"string"!=typeof e)throw new Ho("Compact JWS must be a string or Uint8Array");const{0:o,1:r,2:i,length:a}=e.split(".");if(3!==a)throw new Ho("Invalid Compact JWS");const s=await qr({payload:r,protected:o,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?l(l({},c),{},{key:s.key}):c}(e,t,n);if(null!==(o=r.protectedHeader.crit)&&void 0!==o&&o.includes("b64")&&!1===r.protectedHeader.b64)throw new Mo("JWTs MUST NOT use unencoded payload");const i={payload:ti(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return"function"==typeof t?l(l({},i),{},{key:r.key}):i}function oi(e){return Fo(e)}var ri,ii,ai=new WeakMap,si=new WeakMap;class ci{constructor(e){if(a(this,ai,void 0),a(this,si,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(oi)}(e))throw new Lo("JSON Web Key Set malformed");s(ai,this,structuredClone(e))}jwks(){return i(ai,this)}async getKey(e,t){const{alg:n,kid:r}=l(l({},e),null==t?void 0:t.header),a=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Do('Unsupported "alg" value for a JSON Web Key Set')}}(n),s=i(ai,this).keys.filter(e=>{let t=a===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==a||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:c,length:u}=s;if(0===u)throw new jo;if(1!==u){const e=new No,t=i(si,this);throw e[Symbol.asyncIterator]=h(function*(){for(const e of s)try{yield yield o(ui(t,e,n))}catch(e){}}),e}return ui(i(si,this),c,n)}}async function ui(e,t,n){const o=e.get(t)||e.set(t,{}).get(t);if(void 0===o[n]){const e=await async function(e,t,n){var o;if(!Fo(e))throw new TypeError("JWK must be an object");let r;switch(null!=t||(t=e.alg),null!=r||(r=null!==(o=null==n?void 0:n.extractable)&&void 0!==o?o:e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Eo(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Do('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return $o(l(l({},e),{},{alg:t,ext:r}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return $o(l(l({},e),{},{ext:r}));case"EC":case"OKP":return $o(l(l({},e),{},{alg:t,ext:r}));default:throw new Do('Unsupported "kty" (Key Type) Parameter value')}}(l(l({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Lo("JSON Web Key Set members must be public keys");o[n]=e}return o[n]}function li(e){const t=new ci(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let di;if("undefined"==typeof navigator||null===(ri=navigator.userAgent)||void 0===ri||null===(ii=ri.startsWith)||void 0===ii||!ii.call(ri,"Mozilla/5.0 ")){const e="v6.2.2";di="".concat("jose","/").concat(e)}const hi=Symbol();const pi=Symbol();var fi=new WeakMap,mi=new WeakMap,yi=new WeakMap,wi=new WeakMap,gi=new WeakMap,vi=new WeakMap,bi=new WeakMap,_i=new WeakMap,ki=new WeakMap,Si=new WeakMap;class Ti{constructor(e,t){if(a(this,fi,void 0),a(this,mi,void 0),a(this,yi,void 0),a(this,wi,void 0),a(this,gi,void 0),a(this,vi,void 0),a(this,bi,void 0),a(this,_i,void 0),a(this,ki,void 0),a(this,Si,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,o;s(fi,this,new URL(e.href)),s(mi,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),s(yi,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),s(wi,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),s(bi,this,new Headers(null==t?void 0:t.headers)),di&&!i(bi,this).has("User-Agent")&&i(bi,this).set("User-Agent",di),i(bi,this).has("accept")||(i(bi,this).set("accept","application/json"),i(bi,this).append("accept","application/jwk-set+json")),s(_i,this,null==t?void 0:t[hi]),void 0!==(null==t?void 0:t[pi])&&(s(Si,this,null==t?void 0:t[pi]),n=null==t?void 0:t[pi],o=i(wi,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=o)&&"jwks"in n&&Fo(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Fo)&&(s(gi,this,i(Si,this).uat),s(ki,this,li(i(Si,this).jwks))))}pendingFetch(){return!!i(vi,this)}coolingDown(){return"number"==typeof i(gi,this)&&Date.now()<i(gi,this)+i(yi,this)}fresh(){return"number"==typeof i(gi,this)&&Date.now()<i(gi,this)+i(wi,this)}jwks(){var e;return null===(e=i(ki,this))||void 0===e?void 0:e.jwks()}async getKey(e,t){i(ki,this)&&this.fresh()||await this.reload();try{return await i(ki,this).call(this,e,t)}catch(n){if(n instanceof jo&&!1===this.coolingDown())return await this.reload(),i(ki,this).call(this,e,t);throw n}}async reload(){i(vi,this)&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&s(vi,this,void 0),i(vi,this)||s(vi,this,async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch;const r=await o(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new zo;throw e});if(200!==r.status)throw new Oo("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await r.json()}catch(e){throw new Oo("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(i(fi,this).href,i(bi,this),AbortSignal.timeout(i(mi,this)),i(_i,this)).then(e=>{s(ki,this,li(e)),i(Si,this)&&(i(Si,this).uat=Date.now(),i(Si,this).jwks=e),s(gi,this,Date.now()),s(vi,this,void 0)}).catch(e=>{throw s(vi,this,void 0),e})),await i(vi,this)}}const Ei=["mfaToken"],Pi=["mfaToken"];var Ai,Ii,xi,Ri,Ci,Oi,Wi,Ki,Ui,Di,Hi,Mi,Li,ji,Ni,zi,Ji=class extends Error{constructor(e,t){super(t),c(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Zi=class extends Error{constructor(e,t,n){super(t),c(this,"cause",void 0),c(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Vi=class extends Zi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Xi=class extends Zi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Gi=class extends Zi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Fi=class extends Zi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Yi=class extends Zi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},qi=class extends Zi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Bi=class extends Error{constructor(e){super(e),c(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Qi=class extends Zi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),c(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},$i=class extends Zi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ea=class extends Zi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ta=class extends Zi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},na=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),c(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function oa(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>l(l({},e),{},{[t[0]]:t[1]}),{})}var ra=class extends Error{constructor(e,t,n){super(t),c(this,"cause",void 0),c(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ia=class extends ra{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},aa=class extends ra{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},sa=class extends ra{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},ca=class extends ra{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function ua(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var la=(Ai=new WeakMap,Ii=new WeakMap,xi=new WeakMap,class{constructor(e){var t;a(this,Ai,void 0),a(this,Ii,void 0),a(this,xi,void 0),s(Ai,this,"https://".concat(e.domain)),s(Ii,this,e.clientId),s(xi,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(i(Ai,this),"/mfa/authenticators"),{mfaToken:n}=e,o=await i(xi,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new ia(e.error_description||"Failed to list authenticators",e)}return(await o.json()).map(ua)}async enrollAuthenticator(e){const t="".concat(i(Ai,this),"/mfa/associate"),{mfaToken:n}=e,o=d(e,Ei),r={authenticator_types:o.authenticatorTypes};"oobChannels"in o&&(r.oob_channels=o.oobChannels),"phoneNumber"in o&&o.phoneNumber&&(r.phone_number=o.phoneNumber),"email"in o&&o.email&&(r.email=o.email);const a=await i(xi,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const e=await a.json();throw new aa(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await a.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,o="".concat(i(Ai,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),r=await i(xi,this).call(this,o,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new sa(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(i(Ai,this),"/mfa/challenge"),{mfaToken:n}=e,o=d(e,Pi),r={mfa_token:n,client_id:i(Ii,this),challenge_type:o.challengeType};o.authenticatorId&&(r.authenticator_id=o.authenticatorId);const a=await i(xi,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const e=await a.json();throw new ca(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await a.json())}});var da=class e{constructor(e,t,n,o,r,i,a){c(this,"accessToken",void 0),c(this,"idToken",void 0),c(this,"refreshToken",void 0),c(this,"expiresAt",void 0),c(this,"scope",void 0),c(this,"claims",void 0),c(this,"authorizationDetails",void 0),c(this,"tokenType",void 0),c(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=o,this.expiresAt=t,this.scope=r,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,o=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return o.tokenType=t.token_type,o.issuedTokenType=t.issued_token_type,o}},ha=(Ri=new WeakMap,Ci=new WeakMap,Oi=new WeakMap,class{constructor(e,t){a(this,Ri,new Map),a(this,Ci,void 0),a(this,Oi,void 0),s(Oi,this,Math.max(1,Math.floor(e))),s(Ci,this,Math.max(0,Math.floor(t)))}get(e){const t=i(Ri,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return i(Ri,this).delete(e),i(Ri,this).set(e,t),t.value;i(Ri,this).delete(e)}}set(e,t){for(i(Ri,this).has(e)&&i(Ri,this).delete(e),i(Ri,this).set(e,{value:t,expiresAt:Date.now()+i(Ci,this)});i(Ri,this).size>i(Oi,this);){const e=i(Ri,this).keys().next().value;if(void 0===e)break;i(Ri,this).delete(e)}}}),pa=new Map;function fa(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 ma=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,o=e.ttlMs,"".concat(n,":").concat(o));var n,o;let r=(i=t,pa.get(i));var i;return r||(r=new ha(e.maxEntries,e.ttlMs),pa.set(t,r)),r}static createJwksCache(){return{}}},ya="openid profile email offline_access",wa=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 ga(e){if(null==e)throw new qi("subject_token is required");if("string"!=typeof e)throw new qi("subject_token must be a string");if(0===e.trim().length)throw new qi("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new qi("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new qi("subject_token must not include the 'Bearer ' prefix")}function va(e,t){if(t)for(const[n,o]of Object.entries(t))if(!wa.has(n))if(Array.isArray(o)){if(o.length>20)throw new qi("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));o.forEach(t=>{e.append(n,t)})}else e.append(n,o)}var ba="urn:ietf:params:oauth:token-type:access_token",_a=(Wi=new WeakMap,Ki=new WeakMap,Ui=new WeakMap,Di=new WeakMap,Hi=new WeakMap,Mi=new WeakMap,Li=new WeakMap,ji=new WeakMap,Ni=new WeakMap,zi=new WeakSet,class{constructor(e){var t,n,o,u;if(function(e,t){r(e,t),t.add(e)}(this,zi),a(this,Wi,void 0),a(this,Ki,void 0),a(this,Ui,void 0),a(this,Di,void 0),a(this,Hi,void 0),a(this,Mi,void 0),a(this,Li,void 0),a(this,ji,void 0),a(this,Ni,void 0),c(this,"mfa",void 0),s(Di,this,e),e.useMtls&&!e.customFetch)throw new Ji("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");s(Hi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},o=btoa(JSON.stringify(n));return async(t,n)=>{const r=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{r.set(t,e)}),r.set("Auth0-Client",o),e(t,l(l({},n),{},{headers:r}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(o=null==n?void 0:n.name)&&void 0!==o?o:"@auth0/auth0-auth-js",version:null!==(u=null==n?void 0:n.version)&&void 0!==u?u:"1.6.0"}));const d=fa(e.discoveryCache);s(Li,this,ma.createDiscoveryCache(d)),s(ji,this,new Map),s(Ni,this,ma.createJwksCache()),this.mfa=new la({domain:i(Di,this).domain,clientId:i(Di,this).clientId,customFetch:i(Hi,this)})}async getServerMetadata(){const{serverMetadata:e}=await n(zi,this,Ta).call(this);return e}async buildAuthorizationUrl(e){const{serverMetadata:t}=await n(zi,this,Ta).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ji("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await n(zi,this,Ia).call(this,e)}catch(e){throw new $i(e)}}async buildLinkUserUrl(e){try{const t=await n(zi,this,Ia).call(this,{authorizationParams:l(l({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ea(e)}}async buildUnlinkUserUrl(e){try{const t=await n(zi,this,Ia).call(this,{authorizationParams:l(l({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new ta(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this),r=oa(l(l({},i(Di,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(l(l({scope:ya},r),{},{client_id:i(Di,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:o.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&a.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Hr(t,a),n=await Mr(t,e);return da.fromTokenEndpointResponse(n)}catch(e){throw new Qi(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this),r=oa(l(l({},i(Di,this).authorizationParams),null==e?void 0:e.authorizationParams)),a=new URLSearchParams(l(l({scope:ya},r),{},{client_id:i(Di,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:o.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&a.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&a.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Hr(t,a);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Qi(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:o}=await n(zi,this,Ta).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await Yr(o,"urn:openid:params:grant-type:ciba",r);return da.fromTokenEndpointResponse(e)}catch(e){throw new Qi(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Yi("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new Yi("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?ba:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof qi)throw new Yi(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?n(zi,this,Ea).call(this,e):n(zi,this,Pa).call(this,e)}async getTokenByCode(e,t){const{configuration:o}=await n(zi,this,Ta).call(this);try{const n=await jr(o,e,{pkceCodeVerifier:t.codeVerifier});return da.fromTokenEndpointResponse(n)}catch(e){throw new Vi("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=new URLSearchParams;e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope);try{const n=await Nr(t,e.refreshToken,o);return da.fromTokenEndpointResponse(n)}catch(e){throw new Gi("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=new URLSearchParams({username:e.username,password:e.password});e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope),e.realm&&o.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const o=await n(zi,this,Aa).call(this);r=new Wr(t.serverMetadata(),i(Di,this).clientId,i(Di,this).clientSecret,o),r[kr]=(t,n)=>i(Hi,this).call(this,t,l(l({},n),{},{headers:l(l({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Yr(r,"password",o);return da.fromTokenEndpointResponse(e)}catch(e){throw new Fi("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await n(zi,this,Ta).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const o=await zr(t,n);return da.fromTokenEndpointResponse(o)}catch(e){throw new Xi("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:o}=await n(zi,this,Ta).call(this);if(!o.end_session_endpoint){const t=new URL("https://".concat(i(Di,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",i(Di,this).clientId),t}return function(e,t){Vr(e);const{as:n,c:o,tlsOnly:r}=gr(e),i=gn(n,"end_session_endpoint",!1,r);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",o.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await n(zi,this,Ta).call(this),o=fa(i(Di,this).discoveryCache),r=t.jwks_uri;i(Mi,this)||s(Mi,this,function(e,t){const n=new Ti(e,t),o=async(e,t)=>n.getKey(e,t);return Object.defineProperties(o,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),o}(new URL(r),{cacheMaxAge:o.ttlMs,[hi]:i(Hi,this),[pi]:i(Ni,this)}));const{payload:a}=await ni(e.logoutToken,i(Mi,this),{issuer:t.issuer,audience:i(Di,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in a)&&!("sub"in a))throw new Bi('either "sid" or "sub" (or both) claims must be present');if("sid"in a&&"string"!=typeof a.sid)throw new Bi('"sid" claim must be a string');if("sub"in a&&"string"!=typeof a.sub)throw new Bi('"sub" claim must be a string');if("nonce"in a)throw new Bi('"nonce" claim is prohibited');if(!("events"in a))throw new Bi('"events" claim is missing');if("object"!=typeof a.events||null===a.events)throw new Bi('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in a.events))throw new Bi('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof a.events["http://schemas.openid.net/event/backchannel-logout"])throw new Bi('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:a.sid,sub:a.sub}}});function ka(){const e=i(Di,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(i(Di,this).useMtls?"1":"0")}async function Sa(e){const t=await n(zi,this,Aa).call(this),o=new Wr(e,i(Di,this).clientId,i(Di,this).clientSecret,t);return o[kr]=i(Hi,this),o}async function Ta(){if(i(Wi,this)&&i(Ki,this))return{configuration:i(Wi,this),serverMetadata:i(Ki,this)};const e=n(zi,this,ka).call(this),t=i(Li,this).get(e);if(t)return s(Ki,this,t.serverMetadata),s(Wi,this,await n(zi,this,Sa).call(this,t.serverMetadata)),{configuration:i(Wi,this),serverMetadata:i(Ki,this)};const o=i(ji,this).get(e);if(o){const e=await o;return s(Ki,this,e.serverMetadata),s(Wi,this,await n(zi,this,Sa).call(this,e.serverMetadata)),{configuration:i(Wi,this),serverMetadata:i(Ki,this)}}const r=(async()=>{const t=await n(zi,this,Aa).call(this),o=await Cr(new URL("https://".concat(i(Di,this).domain)),i(Di,this).clientId,{use_mtls_endpoint_aliases:i(Di,this).useMtls},t,{[kr]:i(Hi,this)}),r=o.serverMetadata();return i(Li,this).set(e,{serverMetadata:r}),{configuration:o,serverMetadata:r}})(),a=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});a.catch(()=>{}),i(ji,this).set(e,a);try{const{configuration:e,serverMetadata:t}=await r;s(Wi,this,e),s(Ki,this,t),i(Wi,this)[kr]=i(Hi,this)}finally{i(ji,this).delete(e)}return{configuration:i(Wi,this),serverMetadata:i(Ki,this)}}async function Ea(e){var t,o;const{configuration:r}=await n(zi,this,Ta).call(this);if("audience"in e||"resource"in e)throw new qi("audience and resource parameters are not supported for Token Vault exchanges");ga(e.subjectToken);const i=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:ba,requested_token_type:null!==(o=e.requestedTokenType)&&void 0!==o?o:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&i.append("login_hint",e.loginHint),e.scope&&i.append("scope",e.scope),va(i,e.extra);try{const e=await Yr(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",i);return da.fromTokenEndpointResponse(e)}catch(t){throw new qi("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Pa(e){const{configuration:t}=await n(zi,this,Ta).call(this);ga(e.subjectToken);const o=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&o.append("audience",e.audience),e.scope&&o.append("scope",e.scope),e.requestedTokenType&&o.append("requested_token_type",e.requestedTokenType),e.organization&&o.append("organization",e.organization),va(o,e.extra);try{const e=await Yr(t,"urn:ietf:params:oauth:grant-type:token-exchange",o);return da.fromTokenEndpointResponse(e)}catch(t){throw new qi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Aa(){return i(Ui,this)||s(Ui,this,(async()=>{if(!i(Di,this).clientSecret&&!i(Di,this).clientAssertionSigningKey&&!i(Di,this).useMtls)throw new na;if(i(Di,this).useMtls)return(e,t,n,o)=>{n.set("client_id",t.client_id)};let e=i(Di,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return lr(e,t,n)}(e,i(Di,this).clientAssertionSigningAlg||"RS256")),e?function(e,t){return fn(e,t)}(e):_r(i(Di,this).clientSecret)})().catch(e=>{throw s(Ui,this,void 0),e})),i(Ui,this)}async function Ia(e){const{configuration:t}=await n(zi,this,Ta).call(this),o=Ar(),r=await Pr(o),a=oa(l(l({},i(Di,this).authorizationParams),null==e?void 0:e.authorizationParams)),s=new URLSearchParams(l(l({scope:ya},a),{},{client_id:i(Di,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Zr(t,s):await Jr(t,s),codeVerifier:o}}class xa extends v{constructor(e,t){super(e,t),Object.setPrototypeOf(this,xa.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new xa(t,n)}}class Ra extends xa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ra.prototype)}}class Ca extends xa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ca.prototype)}}class Oa extends xa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Oa.prototype)}}class Wa extends xa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Wa.prototype)}}class Ka extends xa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ka.prototype)}}class Ua{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;c(this,"contexts",new Map),c(this,"ttlMs",void 0),this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,l(l({},t),{},{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class Da{constructor(e,t){c(this,"authJsMfaClient",void 0),c(this,"auth0Client",void 0),c(this,"contextManager",void 0),this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Ua}setMFAAuthDetails(e,t,n,o){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:o})}async getAuthenticators(e){var t;const n=this.contextManager.get(e);if(null==n||null===(t=n.mfaRequirements)||void 0===t||!t.challenge||0===n.mfaRequirements.challenge.length)throw new Ra("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=n.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){var r;if(e instanceof ia)throw new Ra(null===(r=e.cause)||void 0===r?void 0:r.error,e.message);throw e}}async enroll(e){const t=function(e){const t=Tt[e.factorType];return l(l(l({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(t)}catch(e){var n;if(e instanceof aa)throw new Ca(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async challenge(e){try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){var t;if(e instanceof ca)throw new Oa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new Ka("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new Wa("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?Et:"oobCode"in e&&e.oobCode?Pt:"recoveryCode"in e&&e.recoveryCode?At:void 0}(e);if(!n)throw new Wa("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const o=t.scope,r=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:o,audience:r,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof P)this.setMFAAuthDetails(e.mfa_token,o,r,e.mfa_requirements);else if(e instanceof Wa)throw new Wa(e.error,e.error_description);throw e}}}const Ha=["openUrl","fragment","appState"],Ma=["url"],La=["cacheMode"],ja=["federated"],Na=["openUrl"],za=["id_token","decodedToken"],Ja=["mfaToken"];class Za{constructor(e){let t,n;if(c(this,"transactionManager",void 0),c(this,"cacheManager",void 0),c(this,"lockManager",void 0),c(this,"domainUrl",void 0),c(this,"tokenIssuer",void 0),c(this,"scope",void 0),c(this,"cookieStorage",void 0),c(this,"dpop",void 0),c(this,"sessionCheckExpiryDays",void 0),c(this,"orgHintCookieName",void 0),c(this,"isAuthenticatedCookieName",void 0),c(this,"nowProvider",void 0),c(this,"httpTimeoutMs",void 0),c(this,"options",void 0),c(this,"userCache",(new Me).enclosedCache),c(this,"myAccountApi",void 0),c(this,"mfa",void 0),c(this,"worker",void 0),c(this,"authJsClient",void 0),c(this,"defaultOptions",{authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0}),this.options=l(l(l({},this.defaultOptions),e),{},{authorizationParams:l(l({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!O())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===O().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),this.lockManager=(re||(re=oe()),re),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||m,!ft(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=ft(t)()}var o;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Qe:et,this.orgHintCookieName=(o=this.options.clientId,"auth0.".concat(o,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const r=e.useCookiesForTransactions?this.cookieStorage:tt;var i;this.scope=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];if("object"!=typeof e)return{[g]:Oe(t,e,...o)};let i={[g]:Oe(t,...o)};return Object.keys(e).forEach(n=>{const r=e[n];i[n]=Oe(t,r,...o)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new je(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||w,this.cacheManager=new Le(n,n.allKeys?void 0:new lt(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new vt(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(l(l({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{},{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new kt(s,a),this.authJsClient=new _a({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Da(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===m&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new ct,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||y,n=D(t,!0),o=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(o)}_authorizeUrl(e){return this._url("/authorize?".concat(H(e)))}async _verifyIdToken(e,t,n){const o=await this.nowProvider();return Je({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:o});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),l(l({},e),{},{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var o;const r=K(W()),i=K(W()),a=W(),s=await M(a),c=j(s),u=await(null===(o=this.dpop)||void 0===o?void 0:o.calculateThumbprint()),d=((e,t,n,o,r,i,a,s,c)=>l(l(l({client_id:e.clientId},e.authorizationParams),n),{},{scope:We(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:o,nonce:r,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,r,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),h=this._authorizeUrl(d);return{nonce:i,code_verifier:a,scope:d.scope,audience:d.audience||g,redirect_uri:d.redirect_uri,state:r,url:h}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(e=>{const t=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open(e,"auth0:authorize:popup","left=".concat(t,",top=").concat(n,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(""),!t.popup))throw new E;const o=this._applySessionTransferToken(e.authorizationParams||{}),r=await this._prepareAuthorizeUrl(o,{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const i=await((e,t)=>new Promise((n,o)=>{let r;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",r,!1),o(new T(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),o(new S(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return o(v.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",r)}))(l(l({},t),{},{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(r.url).origin);if(r.state!==i.state)throw new v("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null==t||null===(e=t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null==t||null===(e=t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(){var e;const t=mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:o,appState:r}=t,i=d(t,Ha),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),{url:u}=c,h=d(c,Ma);this.transactionManager.create(l(l({},h),{},{appState:r,response_type:nt.Code},a&&{organization:a}));const p=o?"".concat(u,"#").concat(o):u;n?await n(p):window.location.assign(p)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new v("missing_transaction","Invalid state");this.transactionManager.remove();const n=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===nt.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:o,error:r,error_description:i}=e;if(r)throw new b(r,i||r,o,t.appState);if(!t.code_verifier||t.state&&t.state!==o)throw new v("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(l({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:nt.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:o,error:r,error_description:i}=e;if(r)throw new _(r,i||r,t.connection,o,t.appState);if(!n)throw new v("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===o))throw new v("state_mismatch","Invalid state");return l(l({},await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier})),{},{appState:t.appState,response_type:nt.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(ht))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(ht)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=l(l({cacheMode:"on"},n),{},{authorizationParams:l(l(l({},this.options.authorizationParams),n.authorizationParams),{},{scope:We(this.scope,null===(e=n.authorizationParams)||void 0===e?void 0:e.scope,(null===(t=n.authorizationParams)||void 0===t?void 0:t.audience)||this.options.authorizationParams.audience)})}),r=await((e,t)=>{let n=ut[t];return n||(n=e().finally(()=>{delete ut[t],n=null}),ut[t]=n),n})(()=>this._getTokenSilently(o),"".concat(this.options.clientId,"::").concat(o.authorizationParams.audience,"::").concat(o.authorizationParams.scope));return n.detailedResponse?r:null==r?void 0:r.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=d(e,La);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||g,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const o=(r=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(r,".").concat(i));var r,i;try{return await this.lockManager.runWithLock(o,5e3,async()=>{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||g,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:o,token_type:r,access_token:i,oauthTokenScope:a,expires_in:s}=e;return l(l({id_token:o,token_type:r,access_token:i},a?{scope:a}:null),{},{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(n);throw e}}_isInteractiveError(e){return e instanceof P||e instanceof v&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&"Multifactor authentication required"===e.error_description}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||g,clientId:this.options.clientId});if(!t)throw new v("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=l(l({},n),{},{authorizationParams:l(l(l({},this.options.authorizationParams),n.authorizationParams),{},{scope:We(this.scope,null===(e=n.authorizationParams)||void 0===e?void 0:e.scope,(null===(t=n.authorizationParams)||void 0===t?void 0:t.audience)||this.options.authorizationParams.audience)})});o=l(l({},f),o),await this.loginWithPopup(r,o);return(await this.cacheManager.get(new De({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||g,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,o=d(t,ja),r=n?"&federated":"";return this._url("/v2/logout?".concat(H(l({clientId:e.clientId},o))))+r}async logout(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=mt(t),{openUrl:o}=n,r=d(n,Na);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(Ue),await(null===(e=this.dpop)||void 0===e?void 0:e.clear());const i=this._buildLogoutUrl(r);o?await o(i):!1!==o&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=l(l({},e.authorizationParams),{},{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:o,state:r,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new v("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const d=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let h;try{h=new URL(this.domainUrl).origin}catch(e){h=this.domainUrl}const p=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((o,r)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{r(new k),a()},1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(v.fromPayload(e.data.response)):o(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(o,h,d);if(r!==p.state)throw new v("state_mismatch","Invalid state");const f=await this._requestToken(l(l({},e.authorizationParams),{},{code_verifier:a,code:p.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return l(l({},f),{},{scope:c,oauthTokenScope:f.scope,audience:u})})}catch(e){if("login_required"===e.error){e instanceof v&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})}throw e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new De({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||g,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new A(e.authorizationParams.audience||g,e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,r=((e,t,n,o)=>{if(e&&n&&o){var r;if(t.audience!==n)return t.scope;const e=o.split(" "),i=(null===(r=t.scope)||void 0===r?void 0:r.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?o:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==t?void 0:t.audience,null==t?void 0:t.scope);try{const i=await this._requestToken(l(l({},e.authorizationParams),{},{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n},o&&{timeout:o}),{scopesToRequest:r});if(i.refresh_token&&null!=t&&t.refresh_token&&await this.cacheManager.updateEntry(t.refresh_token,i.refresh_token),this.options.useMrrt){if(s=null==t?void 0:t.audience,c=null==t?void 0:t.scope,u=e.authorizationParams.audience,d=e.authorizationParams.scope,s!==u||!yt(d,c)){if(!yt(r,i.scope)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const t=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],o=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==o.indexOf(e)).join(",")})(r,i.scope);throw new I(e.authorizationParams.audience||"default",t)}}}return l(l({},i),{},{scope:e.authorizationParams.scope,oauthTokenScope:i.scope,audience:e.authorizationParams.audience||g})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}var i,a;if(t instanceof P)this.mfa.setMFAAuthDetails(t.mfa_token,null===(i=e.authorizationParams)||void 0===i?void 0:i.scope,null===(a=e.authorizationParams)||void 0===a?void 0:a.audience,t.mfa_requirements);throw t}var s,c,u,d}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,o=d(e,za);this.userCache.set(Ue,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(o)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||g,t=this.scope[e],n=await this.cacheManager.getIdToken(new De({clientId:this.options.clientId,audience:e,scope:t})),o=this.userCache.get(Ue);return n&&n.id_token===(null==o?void 0:o.id_token)?o:(this.userCache.set(Ue,n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:o,cacheMode:r}=e;const i=await this.cacheManager.get(new De({scope:t,audience:n,clientId:o}),60,this.options.useMrrt,r);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:o}=i,r=await this._getIdTokenFromCache();return r&&l(l({id_token:r.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{},{expires_in:o})}}async _requestToken(e,t){const{nonceIn:n,organization:o,scopesToRequest:r}=t||{},i=await Ce(l(l({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{},{scope:r||e.scope}),this.worker),a=await this._verifyIdToken(i.id_token,n,o);if("authorization_code"===e.grant_type){var s;const e=await this._getIdTokenFromCache();null!=e&&null!==(s=e.decodedToken)&&void 0!==s&&null!==(s=s.claims)&&void 0!==s&&s.sub&&e.decodedToken.claims.sub!==a.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ue))}return await this._saveEntryInCache(l(l(l({},i),{},{decodedToken:a,scope:e.scope,audience:e.audience||g},i.scope?{oauthTokenScope:i.scope}:null),{},{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(o||a.claims.org_id),l(l({},i),{},{decodedToken:a})}async loginWithCustomTokenExchange(e){return this._requestToken(l(l({},e),{},{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:We(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _t(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null==e||null===(t=e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:o,scopes:r,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!o)throw new Error("connection is required");const s=K(W()),c=W(),u=await M(c),l=j(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:o,scopes:r,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:o,response_type:nt.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,o=d(e,Ja);return this._requestToken(l(l({},o),{},{mfa_token:n}),t)}}e.Auth0Client=Za,e.AuthenticationError=b,e.CacheKey=De,e.ConnectError=_,e.GenericError=v,e.InMemoryCache=Me,e.LocalStorageCache=He,e.MfaApiClient=Da,e.MfaChallengeError=Oa,e.MfaEnrollmentError=Ca,e.MfaEnrollmentFactorsError=Ka,e.MfaError=xa,e.MfaListAuthenticatorsError=Ra,e.MfaRequiredError=P,e.MfaVerifyError=Wa,e.MissingRefreshTokenError=A,e.MyAccountApiError=St,e.PopupCancelledError=T,e.PopupOpenError=E,e.PopupTimeoutError=S,e.ResponseType=nt,e.TimeoutError=k,e.UseDpopNonceError=x,e.User=class{constructor(){c(this,"name",void 0),c(this,"given_name",void 0),c(this,"family_name",void 0),c(this,"middle_name",void 0),c(this,"nickname",void 0),c(this,"preferred_username",void 0),c(this,"profile",void 0),c(this,"picture",void 0),c(this,"website",void 0),c(this,"email",void 0),c(this,"email_verified",void 0),c(this,"gender",void 0),c(this,"birthdate",void 0),c(this,"zoneinfo",void 0),c(this,"locale",void 0),c(this,"phone_number",void 0),c(this,"phone_number_verified",void 0),c(this,"address",void 0),c(this,"updated_at",void 0),c(this,"sub",void 0)}},e.createAuth0Client=async function(e){const t=new Za(e);return await t.checkSession(),t},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=auth0-spa-js.production.js.map
|