1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,52563,e=>{"use strict";let t,n,r,i,o,a,s,c,l;var u,h,d,p,f,m,y,g,w,b,v,k,_,S,T,P,E,A,C,I,R,x,O,W,j,U,K,L,N,M,D,z,J,H,Z,F,V=e.i(271645),G=function(e,t){return(G=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},X=function(){return(X=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function Y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function B(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})}function q(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){var l=[s,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function Q(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function $(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function ee(e,t,n,r,i){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function et(e,t){this.v=e,this.k=t}function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function er(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError("Private element is not present on this object")}function ei(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}function eo(e,t){return e.get(er(e,t))}function ea(e,t,n){ei(e,t),t.set(e,n)}
1function es(e,t,n){return e.set(er(e,t),n),n}function ec(e,t){ei(e,t),t.add(e)}function el(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?eu(Object(n),!0).forEach(function(t){el(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ed(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ep(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return en(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?en(e,t):void 0}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ef(e){var t,n;function r(t,n){try{var o=e[t](n),a=o.value,s=a instanceof et;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(c,n);n=e[c](n).value}i(!!o.done,n)},function(e){r("throw",e)})}catch(e){i(2,e)}}function i(e,i){2===e?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(o,a){var s={key:e,arg:i,resolve:o,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof SuppressedError&&SuppressedError,"function"==typeof SuppressedError&&SuppressedError,ef.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ef.prototype.next=function(e){return this._invoke("next",e)},ef.prototype.throw=function(e){return this._invoke("throw",e)},ef.prototype.return=function(e){return this._invoke("return",e)};let em={timeoutInSeconds:60},ey="memory",eg="online_access",ew={name:"auth0-spa-js",version:"2.24.1"},eb=()=>Date.now(),ev="default";class ek extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,ek.prototype)}static fromPayload(e){return new ek(e.error,e.error_description)}}class e_ extends ek{constructor(e,t){super("invalid_configuration","".concat(e," ").concat(t)),this.suggestion=t,Object.setPrototypeOf(this,e_.prototype)}}class eS extends ek{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,eS.prototype)}}class eT extends ek{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=i,Object.setPrototypeOf(this,eT.prototype)}}class eP extends ek{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,eP.prototype)}}class eE extends eP{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,eE.prototype)}}
1class eA extends ek{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,eA.prototype)}}class eC extends ek{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,eC.prototype)}}class eI extends ek{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,eI.prototype)}}class eR extends ek{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(eW(e,["default"]),"', scope: '").concat(eW(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,eR.prototype)}}class ex extends ek{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(eW(e,["default"]),"', missing scope: '").concat(eW(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,ex.prototype)}}class eO extends ek{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,eO.prototype)}}function eW(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}let ej=()=>window.crypto,eU=()=>{let e="";for(;e.length<43;)for(let t of ej().getRandomValues(new Uint8Array(43-e.length)))e.length<43&&t<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[t%66]);return e},eK=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],eL=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;let i=eK.find(e=>e.key===r);return i&&i.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},eN=e=>{let t;return new URLSearchParams(Object.keys(t=Object.assign({client_id:e.clientId},Q(e,["clientId"]))).filter(e=>void 0!==t[e]).reduce((e,n)=>Object.assign(Object.assign({},e),{[n]:t[n]}),{})).toString()},eM=async e=>{let t=ej().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},eD=e=>decodeURIComponent(atob(e.replace(/_/g,"/").replace(/-/g,"+")).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")),ez=e=>{var t;let n,r=new Uint8Array(e);return t=window.btoa(String.fromCharCode(...Array.from(r))),n={"+":"-","/":"_","=":""},t.replace(/[+/=]/g,e=>n[e])};var eJ="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,eH={},eZ={};Object.defineProperty(eZ,"__esModule",{value:!0});var eF=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();eZ.default=function(){return eF.getInstance()};var eV=eJ&&eJ.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},eG=eJ&&eJ.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){var c=[o,s];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(6===c[0]&&a.label<i[1]){a.label=i[1],i=c;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(c);break}i[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}};Object.defineProperty(eH,"__esModule",{value:!0});var eX="browser-tabs-lock-key",eY={key:function(e){return eV(eJ,void 0,void 0,function(){return eG(this,function(e){throw Error("Unsupported")})})},getItem:function(e){return eV(eJ,void 0,void 0,function(){return eG(this,function(e){throw Error("Unsupported")})})},clear:function(){return eV(eJ,void 0,void 0,function(){return eG(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return eV(eJ,void 0,void 0,function(){return eG(this,function(e){throw Error("Unsupported")})})},setItem:function(e,t){return eV(eJ,void 0,void 0,function(){return eG(this,function(e){throw 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 eB(e){return new Promise(function(t){return setTimeout(t,e)})}function eq(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var eQ=eH.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+eq(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),eV(this,void 0,void 0,function(){var r,i,o,a,s,c,l;return eG(this,function(u){switch(u.label){case 0:r=Date.now()+eq(4),i=Date.now()+n,o=eX+"-"+t,a=void 0===this.storageHandler?eY:this.storageHandler,u.label=1;case 1:return Date.now()<i?[4,eB(30)]:[3,8];case 2:return u.sent(),null!==a.getItemSync(o)?[3,5]:(s=this.id+"-"+t+"-"+r,[4,eB(Math.floor(25*Math.random()))]);case 3:return u.sent(),a.setItemSync(o,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,eB(30)];case 4:return u.sent(),null!==(c=a.getItemSync(o))&&(l=JSON.parse(c)).id===this.id&&l.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(o,r),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?eY:this.storageHandler),[4,this.waitForSomethingToChange(i)];case 6:u.sent(),u.label=7;case 7:return r=Date.now()+eq(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return eV(this,void 0,void 0,function(){var n=this;return eG(this,function(r){return setTimeout(function(){return eV(n,void 0,void 0,function(){var n,r,i;return eG(this,function(o){switch(o.label){case 0:return[4,eZ.default().lock(t)];case 1:return o.sent(),this.acquiredIatSet.has(t)?null===(r=(n=void 0===this.storageHandler?eY:this.storageHandler).getItemSync(e))?eZ.default().unlock(t):((i=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),eZ.default().unlock(t),this.refreshLockWhileAcquired(e,t)):eZ.default().unlock(t),[2]}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return eV(this,void 0,void 0,function(){return eG(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,i=Date.now(),o=!1;function a(){if(o||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),o=!0),!r){r=!0;var t=50-(Date.now()-i);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEac
1h(function(e){return e()})},e.prototype.releaseLock=function(e){return eV(this,void 0,void 0,function(){return eG(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 eV(this,void 0,void 0,function(){var n,r,i,o;return eG(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?eY:this.storageHandler,r=eX+"-"+t,null===(i=n.getItemSync(r))?[2]:(o=JSON.parse(i)).id!==this.id?[3,2]:[4,eZ.default().lock(o.iat)];case 1:a.sent(),this.acquiredIatSet.delete(o.iat),n.removeItemSync(r),eZ.default().unlock(o.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=[],i=0;;){var o=t.keySync(i);if(null===o)break;r.push(o),i++}for(var a=!1,s=0;s<r.length;s++){var c=r[s];if(c.includes(eX)){var l=t.getItemSync(c);if(null!==l){var u=JSON.parse(l);(void 0===u.timeRefreshed&&u.timeAcquired<n||void 0!==u.timeRefreshed&&u.timeRefreshed<n)&&(t.removeItemSync(c),a=!0)}}}a&&e.notifyWaiters()},e.waiters=void 0,e}();class e${async runWithLock(e,t,n){let r=new AbortController,i=setTimeout(()=>r.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:r.signal},async e=>{if(clearTimeout(i),!e)throw Error("Lock not available");return await n()})}catch(e){if(clearTimeout(i),"AbortError"===(null==e?void 0:e.name))throw new eP;throw e}}}class e0{constructor(){this.activeLocks=new Set,this.lock=new eQ,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let r=!1;for(let n=0;n<10&&!r;n++)r=await this.lock.acquireLock(e,t);if(!r)throw new eP;this.activeLocks.add(e),1===this.activeLocks.size&&"u">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&&"u">typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}let e2=null,e1=new TextEncoder,e5=new TextDecoder;function e3(e){return"string"==typeof e?e1.encode(e):e5.decode(e)}function e9(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new e8(`${e.name} modulusLength must be at least 2048 bits`)}async function e4(e,n,r){var i,o,a;if(!1===r.usages.includes("sign"))throw TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let s=`${(i=e3(JSON.stringify(e)),t(i))}.${(o=e3(JSON.stringify(n)),t(o))}`;return`${s}.${a=await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return e9(e.algorithm),{name:e.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return e9(e.algorithm),{name:e.algorithm.name};case"Ed25519":return{name:e.algorithm.name}}throw new e6}(r),r,e3(s)),t(a)}`}t=Uint8Array.prototype.toBase64?e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0})):e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let t=[];for(let n=0;n<e.byteLength;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};class e6 extends Error{constructor(e){var t;super(null!=e?e:"operation not supported"),this.name=this.constructor.name,null==(t=Error.captureStackTrace)||t.call(Error,this,this.constructor)}}class e8 extends Error{constructor(e){var t;super(e),this.name=this.constructor.name,null==(t=Error.captureStackTrace)||t.call(Error,this,this.constructor)}}function e7(e){return e instanceof CryptoKey}function te(e){return e7(e)&&"public"===e.type}async function tt(e,n,r,i,o,a){var s;let c=null==e?void 0:e.privateKey,l=null==e?void 0:e.publicKey;if(!e7(c)||"private"!==c.type)throw TypeError('"keypair.privateKey" must be a private CryptoKey');if(!te(l))throw TypeError('"keypair.publicKey" must be a public CryptoKey');if(!0!==l.extractable)throw TypeError('"keypair.publicKey.extractable" must be true');if("string"!=typeof n)throw TypeError('"htu" must be a string');
1if("string"!=typeof r)throw TypeError('"htm" must be a string');if(void 0!==i&&"string"!=typeof i)throw TypeError('"nonce" must be a string or undefined');if(void 0!==o&&"string"!=typeof o)throw TypeError('"accessToken" must be a string or undefined');if(void 0!==a&&("object"!=typeof a||null===a||Array.isArray(a)))throw TypeError('"additional" must be an object');return e4({alg:function(e){switch(e.algorithm.name){case"RSA-PSS":if("SHA-256"===e.algorithm.hash.name)return"PS256";throw new e6("unsupported RsaHashedKeyAlgorithm hash name");case"RSASSA-PKCS1-v1_5":if("SHA-256"===e.algorithm.hash.name)return"RS256";throw new e6("unsupported RsaHashedKeyAlgorithm hash name");case"ECDSA":if("P-256"===e.algorithm.namedCurve)return"ES256";throw new e6("unsupported EcKeyAlgorithm namedCurve");case"Ed25519":return"Ed25519";default:throw new e6("unsupported CryptoKey algorithm name")}}(c),typ:"dpop+jwt",jwk:await tn(l)},Object.assign(Object.assign({},a),{iat:Math.floor(Date.now()/1e3),jti:crypto.randomUUID(),htm:r,nonce:i,htu:n,ath:o?(s=await crypto.subtle.digest("SHA-256",e3(o)),t(s)):void 0}),c)}async function tn(e){let{kty:t,e:n,n:r,x:i,y:o,crv:a}=await crypto.subtle.exportKey("jwk",e);return{kty:t,crv:a,e:n,n:r,x:i,y:o}}let tr="dpop-nonce",ti=["authorization_code","refresh_token","urn:ietf:params:oauth:grant-type:token-exchange","urn:okta:params:oauth:grant-type:webauthn","http://auth0.com/oauth/grant-type/mfa-oob","http://auth0.com/oauth/grant-type/mfa-otp","http://auth0.com/oauth/grant-type/mfa-rec
1overy-code"],to=(e,t)=>new Promise(function(n,r){let i=new MessageChannel;i.port1.onmessage=function(e){e.data.error?r(Error(e.data.error)):n(e.data),i.port1.close()},t.postMessage(e,[i.port2])}),ta=(e,t,n)=>{let r,i=new AbortController;return t.signal=i.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{r=setTimeout(()=>{i.abort(),t(Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(r)})},ts=async function(e,t,n,r,i,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return i?(async(e,t,n,r,i,o,a,s,c,l)=>to({type:"refresh",auth:{audience:t,scope:n},timeout:i,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s,skipTokenStorage:c,preserveRefreshToken:l},o))(e,t,n,r,a,i,o,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0,arguments.length>9?arguments[9]:void 0):(async(e,t,n)=>{let r=await ta(e,t,n);return{ok:r.ok,json:await r.json(),headers:[...r.headers].reduce((e,t)=>{let n=ep(t,2),r=n[0],i=n[1];return e[r]=i,e},{})}})(e,r,a)};async function tc(e,t,n,r,i,o,a,s,c,l,u,h){let d;if(c){let t=await c.generateProof({url:e,method:i.method||"GET",nonce:await c.getNonce()});i.headers=Object.assign(Object.assign({},i.headers),{dpop:t})}let p,f=null;for(let c=0;c<3;c++)try{p=await ts(e,n,r,i,o,a,t,s,u,h),f=null;break}catch(e){f=e}if(f)throw f;let m=p.json,y=m.error,g=m.error_description,w=Q(m,["error","error_description"]),b=p,v=b.headers,k=b.ok;if(c&&(d=v[tr])&&await c.setNonce(d),!k){let p=g||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===y)throw new eI(y,p,w.mfa_token,w.mfa_requirements);if("missing_refresh_token"===y)throw new eR(n,r);if("use_dpop_nonce"===y){if(!c||!d||l)throw new eO(d);return tc(e,t,n,r,i,o,a,s,c,!0,u,h)}throw new ek(y||"request_error",p)}return w}async function tl(e,t,n){var r,i=e.baseUrl,o=e.timeout,a=e.audience,s=e.scope,c=e.auth0Client,l=e.useFormData,u=e.useMrrt,h=e.dpop,d=e.preserveRefreshToken,p=Q(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop","preserveRefreshToken"]);let f="urn:ietf:params:oauth:grant-type:token-exchange"===p.grant_type,m="urn:okta:params:oauth:grant-type:webauthn"===p.grant_type,y="refresh_token"===p.grant_type&&u,g=f||m||y,w=Object.assign(Object.assign(Object.assign({},p),g&&a&&{audience:a}),g&&s&&{scope:s}),b=m||!l,v=b?JSON.stringify(w):eN(w),k=(r=p.grant_type,ti.includes(r));return await tc("".concat(i,"/oauth/token"),o,a||ev,s,{method:"POST",body:v,headers:{"Content-Type":b?"application/json":"application/x-www-form-urlencoded","Auth0-Client":btoa(JSON.stringify(eL(c||ew)))}},t,l,u,k?h:void 0,void 0,n,d)}let tu=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return Array.from(new Set(t.filter(Boolean).join(" ").trim().split(/\s+/))).join(" ")},th=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e[ev]),tu(r,t)},td="@@auth0spajs@@",tp="@@user@@";class tf{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:td,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){let t=ep(e.split("::"),4),n=t[0],r=t[1],i=t[2];return new tf({clientId:r,scope:t[3],audience:i},n)}static fromCacheEntry(e){return new tf({scope:e.scope,audience:e.audience,clientId:e.client_id})}}class tm{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){let 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(td))}}class ty{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){let n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class tg{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||eb}async setIdToken(e,t,n){var r;let i=this.getIdTokenCacheKey(e);await this.cache.set(i,{id_token:t,decodedToken:n}),await (null==(r=this.keyManifest)?void 0:r.add(i))}async getIdToken(e){let t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){let t=await this.get(e);if(!t||!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){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,o=await this.cache.get(e.toKey()),a=e;if(!o){let t=await this.getCacheKeys();if(!t)return;let n=this.matchExistingCacheKey(e,t);if(n&&(o=await this.cache.get(n),a=tf.fromKey(n)),!o&&r&&"cache-only"!==i)return this.getEntryWithRefreshToken(e,t)}if(!o)return;let s=Math.floor(await this.nowProvider()/1e3);return o.expiresAt-n<s?o.body.refresh_token?this.modifiedCachedEntry(o,a):(await this.cache.remove(a.toKey()),void await (null==(t=this.keyManifest)?void 0:t.remove(a.toKey()))):o.body}async modifiedCachedEntry(e,t){let n={refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope},r={body:n,expiresAt:e.expiresAt};return await this.cache.set(t.toKey(),r),{refresh_token:n.refresh_token,audience:n.audience,scope:n.scope}}async set(e){var t;let n=new tf({clientId:e.client_id,scope:e.scope,audience:e.audience}),r=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),r),await (null==(t=this.keyManifest)?void 0:t.add(n.toKey()))}async remove(e,t,n){let r=new tf({clientId:e,scope:n,audience:t});await this.cache.remove(r.toKey())}async stripRefreshToken(e){var t;let n=await this.getCacheKeys();if(n)for(let r of n){let n=await this.cache.get(r);(null==(t=null==n?void 0:n.body)?void 0:t.refresh_token)===e&&(delete n.body.refresh_token,await this.cache.set(r,n))}}async clear(e){var t;let 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.clear()))}async wrapCacheEntry(e){return{body:e,expiresAt:Math.floor(await this.nowProvider()/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null==(e=await this.keyManifest.get())?void 0:e.keys:this.cache.allKe
1ys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new tf({clientId:e},td,tp).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;let r=tf.fromKey(t),i=new Set(r.scope&&r.scope.split(" ")),o=(null==(n=e.scope)?void 0:n.split(" "))||[],a=r.scope&&o.reduce((e,t)=>e&&i.has(t),!0);return r.prefix===td&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(let r of t){let t=tf.fromKey(r);if(t.prefix===td&&t.clientId===e.clientId){let e=await this.cache.get(r);if(null==(n=null==e?void 0:e.body)?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;let r=await this.getCacheKeys();if(!r)return[];let i=new Set;for(let o of r){let r=tf.fromKey(o);if(r.prefix===td&&r.clientId===t&&r.audience===e){let e=await this.cache.get(o);(null==(n=null==e?void 0:e.body)?void 0:n.refresh_token)&&i.add(e.body.refresh_token)}}return Array.from(i)}async updateEntry(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=await this.getCacheKeys();if(i)for(let o of i){if(tf.fromKey(o).clientId!==n)continue;let i=await this.cache.get(o);if(!(null==i?void 0:i.body))continue;let a=i.body.refresh_token;a&&(r||a===e)&&(i.body.refresh_token=t,await this.cache.set(o,i))}}}class tw{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})}}let tb=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var tv=eJ&&eJ.__assign||function(){return(tv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function tk(e,t){if(!t)return"";var n="; "+e;return!0===t?n:n+"="+t}function t_(e,t,n){var r;document.cookie=(r=tv({path:"/"},n),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 tk("Expires",e.expires?e.expires.toUTCString():"")+tk("Domain",e.domain)+tk("Path",e.path)+tk("Secure",e.secure)+tk("SameSite",e.sameSite)}(r))}var tS=function(e,t){t_(e,"",tv(tv({},t),{expires:-1}))};let tT={get(e){let t=function(e){for(var t={},n=e?e.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var o=n[i].split("="),a=o.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[o[0].replace(r,decodeURIComponent)]=a.replace(r,decodeURIComponent)}catch(e){}}return t}(document.cookie)[e];if(void 0!==t)return JSON.parse(t)},save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0,sameSite:"none"}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),t_(e,JSON.stringify(t),r)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),tS(e,n)}},tP="_legacy_",tE={get:e=>tT.get(e)||tT.get("".concat(tP).concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),t_("".concat(tP).concat(e),JSON.stringify(t),r),tT.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),tS(e,n),tT.remove(e,t),tT.remove("".concat(tP).concat(e),t)}},tA={get(e){if("u"<typeof sessionStorage)return;let 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)}};(tC=tI||(tI={})).Code="code",tC.ConnectCode="connect_code";var tC,tI,tR,tx=function(e){var t,n,r;return new Worker(tR=tR||(n=(t=function(e,t){var n=atob(e);
1if(t){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShlLHQpeyhudWxsPT10fHx0PmUubGVuZ3RoKSYmKHQ9ZS5sZW5ndGgpO2Zvcih2YXIgcj0wLG89QXJyYXkodCk7cjx0O3IrKylvW3JdPWVbcl07cmV0dXJuIG99ZnVuY3Rpb24gdCh0LHIpe3JldHVybiBmdW5jdGlvbihlKXtpZihBcnJheS5pc0FycmF5KGUpKXJldHVybiBlfSh0KXx8ZnVuY3Rpb24oZSx0KXt2YXIgcj1udWxsPT1lP251bGw6InVuZGVmaW5lZCIhPXR5cGVvZiBTeW1ib2wmJmVbU3ltYm9sLml0ZXJhdG9yXXx8ZVsiQEBpdGVyYXRvciJdO2lmKG51bGwhPXIpe3ZhciBvLG4scyxpLGE9W10sYz0hMCxsPSExO3RyeXtpZihzPShyPXIuY2FsbChlKSkubmV4dCwwPT09dCl7aWYoT2JqZWN0KHIpIT09cilyZXR1cm47Yz0hMX1lbHNlIGZvcig7IShjPShvPXMuY2FsbChyKSkuZG9uZSkmJihhLnB1c2goby52YWx1ZSksYS5sZW5ndGghPT10KTtjPSEwKTt9Y2F0Y2goZSl7bD0hMCxuPWV9ZmluYWxseXt0cnl7aWYoIWMmJm51bGwhPXIucmV0dXJuJiYoaT1yLnJldHVybigpLE9iamVjdChpKSE9PWkpKXJldHVybn1maW5hbGx5e2lmKGwpdGhyb3cgbn19cmV0dXJuIGF9fSh0LHIpfHxmdW5jdGlvbih0LHIpe2lmKHQpe2lmKCJzdHJpbmciPT10eXBlb2YgdClyZXR1cm4gZSh0LHIpO3ZhciBvPXt9LnRvU3RyaW5nLmNhbGwodCkuc2xpY2UoOCwtMSk7cmV0dXJuIk9iamVjdCI9PT1vJiZ0LmNvbnN0cnVjdG9yJiYobz10LmNvbnN0cnVjdG9yLm5hbWUpLCJNYXAiPT09b3x8IlNldCI9PT1vP0FycmF5LmZyb20odCk6IkFyZ3VtZW50cyI9PT1vfHwvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChvKT9lKHQscik6dm9pZCAwfX0odCxyKXx8ZnVuY3Rpb24oKXt0aHJvdyBuZXcgVHlwZUVycm9yKCJJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLiIpfSgpfWNsYXNzIHIgZXh0ZW5kcyBFcnJvcntjb25zdHJ1Y3RvcihlLHQpe3N1cGVyKHQpLHRoaXMuZXJyb3I9ZSx0aGlzLmVycm9yX2Rlc2NyaXB0aW9uPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsci5wcm90b3R5cGUpfXN0YXRpYyBmcm9tUGF5bG9hZChlKXtsZXQgdD1lLmVycm9yLG89ZS5lcnJvcl9kZXNjcmlwdGlvbjtyZXR1cm4gbmV3IHIodCxvKX19Y2xhc3MgbyBleHRlbmRzIHJ7Y29uc3RydWN0b3IoZSx0KXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIiwiTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyIuY29uY2F0KG4oZSxbImRlZmF1bHQiXSksIicsIHNjb3BlOiAnIikuY29uY2F0KG4odCksIicpIikpLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXQsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsby5wcm90b3R5cGUpfX1mdW5jdGlvbiBuKGUpe3JldHVybiBlJiYhKGFyZ3VtZW50cy5sZW5ndGg+MSYmdm9pZCAwIT09YXJndW1lbnRzWzFdP2FyZ3VtZW50c1sxXTpbXSkuaW5jbHVkZXMoZSk/ZToiIn0iZnVuY3Rpb24iPT10eXBlb2YgU3VwcHJlc3NlZEVycm9yJiZTdXBwcmVzc2VkRXJyb3I7Y29uc3Qgcz1lPT57dmFyIHQ9ZS5jbGllbnRJZCxyPWZ1bmN0aW9uKGUsdCl7dmFyIHI9e307Zm9yKHZhciBvIGluIGUpT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsbykmJnQuaW5kZXhPZihvKTwwJiYocltvXT1lW29dKTtpZihudWxsIT1lJiYiZnVuY3Rpb24iPT10eXBlb2YgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyl7dmFyIG49MDtmb3Iobz1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpO248by5sZW5ndGg7bisrKXQuaW5kZXhPZihvW25dKTwwJiZPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLmNhbGwoZSxvW25dKSYmKHJbb1tuXV09ZVtvW25dXSl9cmV0dXJuIHJ9KGUsWyJjbGllbnRJZCJdKTtyZXR1cm4gbmV3IFVSTFNlYXJjaFBhcmFtcygoZT0+T2JqZWN0LmtleXMoZSkuZmlsdGVyKHQ9PnZvaWQgMCE9PWVbdF0pLnJlZHVjZSgodCxyKT0+T2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHQpLHtbcl06ZVtyXX0pLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IGk9e30sYT1udWxsO2NvbnN0IGM9KGUsdCk9PiIiLmNvbmNhdChlLCJ8IikuY29uY2F0KHQpLGw9KGUsdCk9PnQuc3RhcnRzV2l0aCgiIi5jb25jYXQoZSwifCIpKSx1PWU9PntPYmplY3QuZW50cmllcyhpKS5mb3JFYWNoKHI9PntsZXQgbz10KHIsMiksbj1vWzBdO29bMV09PT1lJiZkZWxldGUgaVtuXX0pfSxmPWU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKChlLHQpPT57clt0XT1lfSkscn0saD1hc3luYyBlPT57bGV0IHIsbixhPWUuZGF0YSx1PWEudGltZW91dCxoPWEuYXV0aCxkPWEuZmV0Y2hVcmwscD1hLmZldGNoT3B0aW9ucyx5PWEudXNlRm9ybURhdGEsZz1hLnVzZU1ycnQsYj1hLnNraXBUb2tlblN0b3JhZ2UsTz1hLnByZXNlcnZlUmVmcmVzaFRva2VuLGs9dChlLnBvcnRzLDEpWzBdLG09e307Y29uc3Qgaj1ofHx7fSx2PWouYXVkaWVuY2UsXz1qLnNjb3BlO3RyeXtjb25zdCBlPXk/ZihwLmJvZHkpOkpTT04ucGFyc2UocC5ib2R5KTtpZighZS5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1lLmdyYW50X3R5cGUpe2lmKG49KChlLHQpPT5pW2MoZSx0KV0pKHYsXyksIW4mJmcpe2NvbnN0IGU9aS5sYXRlc3RfcmVmcmVzaF90b2tlbix0PSgoZSx0KT0+ISFPYmplY3Qua2V5cyhpKS5maW5kKHI9PntpZigibGF0ZXN0X3JlZnJlc2hfdG9rZW4iIT09cil7Y29uc3Qgbz1sKHQsciksbj1yLnNwbGl0KCJ8IilbMV0uc3BsaXQoIiAiKSxzPWUuc3BsaXQoIiAiKS5ldmVyeShlPT5uLmluY2x1ZGVzKGUpKTtyZXR1cm4gbyYm
1c319KSkoXyx2KTtlJiYhdCYmKG49ZSl9aWYoIW4pdGhyb3cgbmV3IG8odixfKTtwLmJvZHk9eT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxlKSx7cmVmcmVzaF90b2tlbjpufSkpfWxldCBhLGg7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGE9bmV3IEFib3J0Q29udHJvbGxlcixwLnNpZ25hbD1hLnNpZ25hbCk7dHJ5e2g9YXdhaXQgUHJvbWlzZS5yYWNlKFsoVT11LG5ldyBQcm9taXNlKGU9PnNldFRpbWVvdXQoZSxVKSkpLGZldGNoKGQsT2JqZWN0LmFzc2lnbih7fSxwKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBrLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighaClyZXR1cm4gYSYmYS5hYm9ydCgpLHZvaWQgay5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtpZihNPWguaGVhZGVycyxtPVsuLi5NXS5yZWR1Y2UoKGUscik9PntsZXQgbz10KHIsMiksbj1vWzBdLHM9b1sxXTtyZXR1cm4gZVtuXT1zLGV9LHt9KSxyPWF3YWl0IGguanNvbigpLGIpcmV0dXJuIGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4sdm9pZCBrLnBvc3RNZXNzYWdlKHtvazpoLm9rLGpzb246cixoZWFkZXJzOm19KTtyLnJlZnJlc2hfdG9rZW4/KGcmJihpLmxhdGVzdF9yZWZyZXNoX3Rva2VuPXIucmVmcmVzaF90b2tlbix3PW4sUz1yLnJlZnJlc2hfdG9rZW4sT2JqZWN0LmVud
1HJpZXMoaSkuZm9yRWFjaChlPT57bGV0IHI9dChlLDIpLG89clswXTtyWzFdPT09dyYmKGlbb109Uyl9KSksKChlLHQscik9PntpW2ModCxyKV09ZX0pKHIucmVmcmVzaF90b2tlbix2LF8pLGRlbGV0ZSByLnJlZnJlc2hfdG9rZW4pOk98fCgoZSx0KT0+e2RlbGV0ZSBpW2MoZSx0KV19KSh2LF8pLGsucG9zdE1lc3NhZ2Uoe29rOmgub2ssanNvbjpyLGhlYWRlcnM6bX0pfWNhdGNoKGUpe2sucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOmUuZXJyb3IsZXJyb3JfZGVzY3JpcHRpb246ZS5tZXNzYWdlfSxoZWFkZXJzOm19KX12YXIgdyxTLE0sVX0sZD1hc3luYyBlPT57bGV0IHI9ZS5kYXRhLG89ci50aW1lb3V0LG49ci5hdXRoLGE9ci5mZXRjaFVybCxjPXIuZmV0Y2hPcHRpb25zLGg9ci51c2VGb3JtRGF0YSxkPXQoZS5wb3J0cywxKVswXTtjb25zdCBwPShufHx7fSkuYXVkaWVuY2U7dHJ5e2NvbnN0IGU9KGU9Pntjb25zdCByPW5ldyBTZXQ7cmV0dXJuIE9iamVjdC5lbnRyaWVzKGkpLmZvckVhY2gobz0+e2xldCBuPXQobywyKSxzPW5bMF0saT1uWzFdO2woZSxzKSYmci5hZGQoaSl9KSxBcnJheS5mcm9tKHIpfSkocCk7aWYoMD09PWUubGVuZ3RoKXJldHVybiB2b2lkIGQucG9zdE1lc3NhZ2Uoe29rOiEwfSk7Y29uc3Qgcj1oP2YoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7Zm9yKGNvbnN0IHQgb2YgZSl7Y29uc3QgZT1oP3MoT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LHIpLHt0b2tlbjp0fSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7dG9rZW46dH0pKTtsZXQgbixpLGwsZjsiZnVuY3Rpb24iPT10eXBlb2YgQWJvcnRDb250cm9sbGVyJiYobj1uZXcgQWJvcnRDb250cm9sbGVyLGk9bi5zaWduYWwpO3RyeXtmPWF3YWl0IFByb21pc2UucmFjZShbbmV3IFByb21pc2UoZT0+e2w9c2V0VGltZW91dChlLG8pfSksZmV0Y2goYSxPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sYykse2JvZHk6ZSxzaWduYWw6aX0pKV0pLmZpbmFsbHkoKCk9PmNsZWFyVGltZW91dChsKSl9Y2F0Y2goZSl7cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZS5tZXNzYWdlfSl9aWYoIWYpcmV0dXJuIG4mJm4uYWJvcnQoKSx2b2lkIGQucG9zdE1lc3NhZ2Uoe2Vycm9yOiJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCcifSk7aWYoIWYub2spe2xldCBlO3RyeXtjb25zdCB0PUpTT04ucGFyc2UoYXdhaXQgZi50ZXh0KCkpO2U9dC5lcnJvcl9kZXNjcmlwdGlvbn1jYXRjaChlKXt9cmV0dXJuIHZvaWQgZC5wb3N0TWVzc2FnZSh7ZXJyb3I6ZXx8IkhUVFAgZXJyb3IgIi5jb25jYXQoZi5zdGF0dXMpfSl9dSh0KX1kLnBvc3RNZXNzYWdlKHtvazohMH0pfWNhdGNoKGUpe2QucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZXx8IlVua25vd24gZXJyb3IgZHVyaW5nIHRva2VuIHJldm9jYXRpb24ifSl9fSxwPShlLHQpPT57aWYoIWEpcmV0dXJuITE7dHJ5e2NvbnN0IHI9bmV3IFVSTChhKS5vcmlnaW4sbz1uZXcgVVJMKGUuZmV0Y2hVcmwpO3JldHVybiBvLm9yaWdpbj09PXImJm8ucGF0aG5hbWU9PT10fWNhdGNoKGUpe3JldHVybiExfX07YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZT0+e2NvbnN0IHI9ZS5kYXRhLG89dChlLnBvcnRzLDEpWzBdO2lmKCEoInR5cGUiaW4gcil8fCJpbml0IiE9PXIudHlwZSlyZXR1cm4idHlwZSJpbiByJiYiY2xlYXIiPT09ci50eXBlPyhpPXt9LHZvaWQobnVsbD09b3x8by5wb3N0TWVzc2FnZSh7b2s6ITB9KSkpOiJ0eXBlImluIHImJiJyZXZva2UiPT09ci50eXBlP3AociwiL29hdXRoL3Jldm9rZSIpP3ZvaWQgZChlKTp2b2lkKG51bGw9PW98fG8ucG9zdE1lc3NhZ2Uoe29rOiExLGpzb246e2Vycm9yOiJpbnZhbGlkX2ZldGNoX3VybCIsZXJyb3JfZGVzY3JpcHRpb246IlVuYXV0aG9yaXplZCBmZXRjaCBVUkwifSxoZWFkZXJzOnt9fSkpOnZvaWQoImZldGNoVXJsImluIHImJnAociwiL29hdXRoL3Rva2VuIik/aChlKTpudWxsPT1vfHxvLnBvc3RNZXNzYWdlKHtvazohMSxqc29uOntlcnJvcjoiaW52YWxpZF9mZXRjaF91cmwiLGVycm9yX2Rlc2NyaXB0aW9uOiJVbmF1dGhvcml6ZWQgZmV0Y2ggVVJMIn0saGVhZGVyczp7fX0pKTtpZihudWxsPT09YSl0cnl7bmV3IFVSTChyLmFsbG93ZWRCYXNlVXJsKSxhPXIuYWxsb3dlZEJhc2VVcmx9Y2F0Y2goZSl7cmV0dXJufX0pfSgpOwoK",!1)).indexOf("\n",10)+1,r=new Blob([t.substring(n)+""],{type:"application/javascript"}),URL.createObjectURL(r)),e)};class tO{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;let n=new Set((null==(t=await this.cache.get(this.manifestKey))?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){let t=await this.cache.get(this.manifestKey);if(t){let 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(td,"::").concat(e)}}let tW="auth0.is.authenticated",tj={memory:()=>(new ty).enclosedCache,localstorage:()=>new tm},tU=e=>tj[e],tK=e=>{let t=e.openUrl,n=e.onRedirect;return Object.assign(Object.assign({},Q(e,["openUrl","onRedirect"])),{openUrl:!1===t||t?t:n})},tL={NONCE:"nonce",KEYPAIR:"keypair"};class tN{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){let e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>
1Object.values(tL).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){let r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){return"".concat(this.clientId,"::").concat(e?"_".concat(e):"auth0")}setNonce(e,t){return this.save(tL.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(tL.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(tL.NONCE,this.buildKey(e))}findKeyPair(){return this.find(tL.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){let n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());await Promise.all((null==n?void 0:n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t))))||[])}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(tL.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(tL.KEYPAIR,this.clientId)}}class tM{constructor(e){this.storage=new tN(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;if("string"!=typeof e||0===e.length)throw TypeError('"alg" must be a non-empty string');switch(e){case"PS256":r={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":r={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":r={name:"Ed25519"};break;default:throw new e6}return crypto.subtle.generateKey(r,null!=(n=null==t?void 0:t.extractable)&&n,["sign","verify"])}("ES256",{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){var t;let n,r,i,o,a,s;return r=(t=Object.assign({keyPair:await this.getOrGenerateKeyPair()},e)).keyPair,i=t.url,o=t.method,a=t.nonce,s=t.accessToken,tt(r,((n=new URL(i)).search="",n.hash="",n.href),o,a,s)}async calculateThumbprint(){return async function(e){var n;let r;if(!te(e))throw TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw TypeError('"publicKey.extractable" must be true');let i=await tn(e);switch(i.kty){case"EC":r={crv:i.crv,kty:i.kty,x:i.x,y:i.y};break;case"OKP":r={crv:i.crv,kty:i.kty,x:i.x};break;case"RSA":r={e:i.e,kty:i.kty,n:i.n};break;default:throw new e6("unsupported JWK kty")}return n=await crypto.subtle.digest({name:"SHA-256"},e3(JSON.stringify(r))),t(n)}((await this.getOrGenerateKeyPair()).publicKey)}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}(iL=iN||(iN={})).Bearer="Bearer",iL.DPoP="DPoP";class tD{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("u"<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 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);let n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:iN.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;let n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}
1async prepareRequest(e,t){let n,r,i=await this.getAccessToken(t);"string"==typeof i?(n=this.config.dpopNonceId?iN.DPoP:iN.Bearer,r=i):(n=i.token_type,r=i.access_token),this.setAuthorizationHeader(e,r,n),n===iN.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;let t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){let n=this.getHeader(e.headers,tr);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new eO(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){let i=this.buildBaseRequest(e,t);await this.prepareRequest(i,r);let o=await this.config.fetch(i);return this.handleResponse(o,n)}fetchWithAuth(e,t,n){let r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class tz{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){let t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:connected_accounts"]});return this._handleResponse(t)}async completeAccount(e){let t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:connected_accounts"]});return this._handleResponse(t)}async getFactors(){let e=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/factors"),{method:"GET"},{scope:["read:me:factors"]});return(await this._handleResponse(e)).factors}async getAuthenticationMethods(e){let t=e?"?".concat(new URLSearchParams({type:e})):"",n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods").concat(t),{method:"GET"},{scope:["read:me:authentication_methods"]});return(await this._handleResponse(n)).authentication_methods}async getAuthenticationMethod(e){let t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"GET"},{scope:["read:me:authentication_methods"]});return this._handleResponse(t)}async deleteAuthenticationMethod(e){let t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"DELETE"},{scope:["delete:me:authentication_methods"]});t.ok||await this._handleResponse(t)}async updateAuthenticationMethod(e,t){let n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},{scope:["update:me:authentication_methods"]});return this._handleResponse(n)}async enrollmentChallenge(e){var t;let n=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/authentication-methods"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},{scope:["create:me:authentication_methods"]}),r=await this._handleResponse(n),i=null!=(t=n.headers.get("location"))?t:"",o=decodeURIComponent(i.split("/").pop()||"");return Object.assign(Object.assign({},r),{id:o,location:i})}async enrollmentVerify(e){let t=e.location;e.type;let n=Q(e,["location","type"]),r=await this.myAccountFetcher.fetchWithAuth("".concat(t,"/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},{scope:["create:me:authentication_methods"]});return this._handleResponse(r)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new tJ({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new tJ(t)}}class tJ extends Error{constructor(e){let t=e.type,n=e.status,r=e.title,i=e.detail,o=e.validation_errors;super(i),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=i,this.validation_errors=o,Object.setPrototypeOf(this,tJ.prototype)}}let tH={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function tZ(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}}("u"<typeof navigator||null==(iM=navigator.userAgent)||null==(iD=iM.startsWith)||!iD.call(iM,"Mozilla/5.0 "))&&(n="".concat("oauth4webapi","/").concat("v3.8.6"));let tF="ERR_INVALID_ARG_VALUE",tV="ERR_INVALID_ARG_TYPE";function tG(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}let tX=Symbol(),tY=Symbol(),tB=Symbol(),tq=Symbol(),tQ=Symbol(),t$=Symbol(),t0=new TextEncoder,t2=new TextDecoder;function t1(e){return"string"==typeof e?t0.encode(e):t2.decode(e)}function t5(e){return"string"==typeof e?i(e):r(e)}r=Uint8Array.prototype.toBase64?e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0})):e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let t=[];for(let n=0;n<e.byteLength;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},i=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw tG("The input to be decoded is not correctly encoded.",tF,e)}}:e=>{try{let 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 tG("The input to be decoded is not correctly encoded.",tF,e)}};
1class t3 extends Error{constructor(e,t){var n;super(e,t),el(this,"code",void 0),this.name=this.constructor.name,this.code=nZ,null==(n=Error.captureStackTrace)||n.call(Error,this,this.constructor)}}class t9 extends Error{constructor(e,t){var n;super(e,t),el(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)||n.call(Error,this,this.constructor)}}function t4(e,t,n){return new t9(e,{code:t,cause:n})}function t6(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function t8(e){tZ(e,Headers)&&(e=Object.fromEntries(e.entries()));let t=new Headers(null!=e?e:{});if(n&&!t.has("user-agent")&&t.set("user-agent",n),t.has("authorization"))throw tG('"options.headers" must not include the "authorization" header name',tF);return t}function t7(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw tG('"options.signal" must return or be an instance of AbortSignal',tV);return t}}function ne(e){return e.includes("//")?e.replace("//","/"):e}async function nt(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw tG('"'.concat(t,'" must be an instance of URL'),tV);np(e,!0!==(null==r?void 0:r[tX]));let i=n(new URL(e.href)),o=t8(null==r?void 0:r.headers);return o.set("accept","application/json"),((null==r?void 0:r[tq])||fetch)(i.href,{body:void 0,headers:Object.fromEntries(o.entries()),method:"GET",redirect:"manual",signal:t7(i,null==r?void 0:r.signal)}
1)}(e,"issuerIdentifier",e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":e.pathname=ne("".concat(e.pathname,"/").concat(".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=ne("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw tG('"options.algorithm" must be "oidc" (default), or "oauth2"',tF)}return e},t)}function nn(e,t,n,r,i){try{if("number"!=typeof e||!Number.isFinite(e))throw tG("".concat(n," must be a number"),tV,i);if(e>0)return;if(t){if(0!==e)throw tG("".concat(n," must be a non-negative number"),tF,i);return}throw tG("".concat(n," must be a positive number"),tF,i)}catch(e){if(r)throw t4(e.message,r,i);throw e}}function nr(e,t,n,r){try{if("string"!=typeof e)throw tG("".concat(t," must be a string"),tV,r);if(0===e.length)throw tG("".concat(t," must not be empty"),tF,r)}catch(e){if(n)throw t4(e.message,n,r);throw e}}function ni(e){var t="application/json";if(nE(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(r.length>2){let e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return t4(t,nX,e)}(e,t)}function no(){return t5(crypto.getRandomValues(new Uint8Array(32)))}function na(e){let t=null==e?void 0:e[tY];return"number"==typeof t&&Number.isFinite(t)?t:0}function ns(e){let t=null==e?void 0:e[tB];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function nc(){return Math.floor(Date.now()/1e3)}function nl(e){if("object"!=typeof e||null===e)throw tG('"as" must be an object',tV);nr(e.issuer,'"as.issuer"')}function nu(e){if("object"!=typeof e||null===e)throw tG('"client" must be an object',tV);nr(e.client_id,'"client.client_id"')}function nh(e){return nr(e,'"clientSecret"'),(t,n,r,i)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}let nd=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function np(e,t){if(t&&"https:"!==e.protocol)throw t4("only requests to HTTPS are allowed",nB,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw t4("only HTTP and HTTPS requests are allowed",nq,e)}function nf(e,t,n,r){let i;if("string"!=typeof e||!(i=nd(e)))throw t4("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?n2:n1,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return np(i,r),i}function nm(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?nf(e.mtls_endpoint_aliases[t],t,n,r):nf(e[t],t,n,r)}class ny extends Error{constructor(e,t){var n;super(e,t),el(this,"cause",void 0),el(this,"code",void 0),el(this,"error",void 0),el(this,"status",void 0),el(this,"error_description",void 0),el(this,"response",void 0),this.name=this.constructor.name,this.code=nH,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)||n.call(Error,this,this.constructor)}}class ng extends Error{constructor(e,t){var n,r;super(e,t),el(this,"cause",void 0),el(this,"code",void 0),el(this,"error",void 0),el(this,"error_description",void 0),this.name=this.constructor.name,this.code=nF,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!=(n=t.cause.get("error_description"))?n:void 0,null==(r=Error.captureStackTrace)||r.call(Error,this,this.constructor)}}
1class nw extends Error{constructor(e,t){var n;super(e,t),el(this,"cause",void 0),el(this,"code",void 0),el(this,"response",void 0),el(this,"status",void 0),this.name=this.constructor.name,this.code=nJ,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null==(n=Error.captureStackTrace)||n.call(Error,this,this.constructor)}}let nb="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",nv=RegExp("^[,\\s]*("+nb+")"),nk=RegExp("^[,\\s]*("+nb+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),n_=RegExp("^[,\\s]*"+("("+nb+")\\s*=\\s*(")+nb+")[,\\s]*(.*)"),nS=RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function nT(e,t,n){if(e.status!==t){var r;let t;if(function(e){let t;if(t=function(e){if(!tZ(e,Response))throw tG('"response" must be an instance of Response',tV);let t=e.headers.get("www-authenticate");if(null===t)return;let n=[],r=t;for(;r;){let e,t=r.match(nv),c=null==(i=t)?void 0:i[1].toLowerCase();if(!c)return;let l=r.substring(t[0].length);if(l&&!l.match(/^[\s,]/))return;let u=l.match(/^\s+(.*)$/),h=!!u;r=u?u[1]:void 0;let d={};if(h)for(;r;){let n,c;if(t=r.match(nk)){var i,o=ep(t,4);if(n=o[1],c=o[2],r=o[3],c.includes("\\"))try{c=JSON.parse('"'.concat(c,'"'))}catch(e){}d[n.toLowerCase()]=c}else{if(!(t=r.match(n_))){if(t=r.match(nS)){if(Object.keys(d).length)break;var a=ep(t,3);e=a[1],r=a[2];break}return}var s=ep(t,4);n=s[1],c=s[2],r=s[3],d[n.toLowerCase()]=c}}else r=l||void 0;let p={scheme:c,parameters:d};e&&(p.token68=e),n.push(p)}return n.length?n:void 0}(e))throw new nw("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){n3(e),ni(e);try{let t=await e.clone().json();if(t6(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await (null==(r=e.body)?void 0:r.cancel()),new ny("server responded with an error in the response body",{cause:t,response:e});throw t4('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),nY,e)}}function nP(e){if(!nU.has(e))throw tG('"options.DPoP" is not a valid DPoPHandle',tF)}function nE(e){var t;return null==(t=e.headers.get("content-type"))?void 0:t.split(";")[0]}async function nA(e,t,n,r,i,o,a){return await n(e,t,i,o),o.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[tq])||fetch)(r.href,{body:i,headers:Object.fromEntries(o.entries()),method:"POST",redirect:"manual",signal:t7(r,null==a?void 0:a.signal)})}async function nC(e,t,n,r,i,o){var a;let s=nm(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[tX]));i.set("grant_type",r);let c=t8(null==o?void 0:o.headers);c.set("accept","application/json"),void 0!==(null==o?void 0:o.DPoP)&&(nP(o.DPoP),await o.DPoP.addProof(s,c,"POST"));let l=await nA(e,t,n,s,i,c,o);return null==o||null==(a=o.DPoP)||a.cacheNonce(l,s),l}let nI=new WeakMap,nR=new WeakMap;function nx(e){if(!e.id_token)return;let t=nI.get(e);if(!t)throw tG('"ref" was already garbage collected or did not resolve from the proper sources',tF);return t}async function nO(e,t,n,r,i,o){if(nl(e),nu(t),!tZ(n,Response))throw tG('"response" must be an instance of Response',tV);await nT(n,200,"Token Endpoint"),n3(n);let a=await rt(n);if(nr(a.access_token,'"response" body "access_token" property',nG,{body:a}),nr(a.token_type,'"response" body "token_type" property',nG,{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',nG,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&nr(a.refresh_token,'"response" body "refresh_token" property',nG,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw t4('"response" body "scope" property must be a string',nG,{body:a});if(void 0!==a.id_token){nr(a.id_token,'"response" body "id_token" property',nG,{body:a});let o=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&o.push("auth_time"),void 0!==t.default_max_age&&(nn(t.default_max_age,!0,'"client.default_max_age"'),o.push("auth_time")),null!=r&&r.length&&o.push(...r);let s=await (async function(e,t,n,r,i){let o,a,s=e.split("."),c=s[0],l=s[1],u=s.length;if(5===u){if(void 0===i)throw new t3("JWE decryption is not configured",{cause:e});var h=(e=await i(e)).split(".");c=h[0],l=h[1],u=h.length}if(3!==u)throw t4("Invalid JWT",nG,e);try{o=JSON.parse(t1(t5(c)))}catch(e){throw t4("failed to parse JWT Header body as base64url encoded JSON",nV,e)}if(!t6(o))throw t4("JWT Header must be a top level object",nG,e);if(t(o),void 0!==o.crit)throw new t3('no JWT "crit" header parameter extensions are supported',{cause:{header:o}});try{a=JSON.parse(t1(t5(l)))}catch(e){throw t4("failed to parse JWT Payload body as base64url encoded JSON",nV,e)}if(!t6(a))throw t4("JWT Payload must be a top level object",nG,e);let d=nc()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw t4('unexpected JWT "exp" (expiration time) claim type',nG,{claims:a});if(a.exp<=d-r)throw t4('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',nQ,{claims:a,now:d,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw t4('unexpected JWT "iat" (issued at) claim type',nG,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw t4('unexpected JWT "iss" (issuer) claim type',nG,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw t4('unexpected JWT "nbf" (not before) claim type',nG,{claims:a});if(a.nbf>d+r)throw t4('unexpected JWT "nbf" (not before) claim value',nQ,{claims:a,now:d,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw t4('unexpected JWT "aud" (audience) claim type',nG,{claims:a});return{header:o,claims:a,jwt:e}})(a.id_token,n6.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),na(t),ns(t),i).then(nN.bind(void 0,o)).then(nj.bind(void 0,e)).then(nW.bind(void 0,t.client_id)),c=s.claims,l=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw t4('ID Token "aud" (audience) claim includes additional untrusted audiences',n$,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw t4('unexpected ID Token "azp" (authorized party) claim value',n$,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&nn(c.auth_time,!0,'ID Token "auth_time" (authentication time)',nG,{claims:c}),nR.set(n,l),nI.set(a,c)}if(void 0!==(null==o?void 0:o[a.token_type]))o[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new t3("unsupported `token_type` value",{cause:{body:a}});return a}function nW(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw t4('unexpected JWT "aud" (audience) claim value',n$,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw t4('unexpected JWT "aud" (audience) claim value',n$,{expected:e,claims:t.claims,claim:"aud"});return t}function nj(e,t){var n,r;let i=null!=(n=null==(r=e[rr])?void 0:r.call(e,t))?n:e.issuer;if(t.claims.iss!==i)throw t4('unexpected JWT "iss" (issuer) claim value',n$,{expected:i,claims:t.claims,claim:"iss"});return t}let nU=new WeakSet,nK=Symbol(),nL={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 nN(e,t){for(let n of e)if(void 0===t.claims[n])throw t4('JWT "'.concat(n,'" (').concat(nL[n],") claim missing"),nG,{claims:t.claims});return t}let nM=Symbol(),nD=Symbol();async function nz(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,i,o,a){let s=[];switch(r){case void 0:r=nM;break;case nM:break;default:nr(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=i||(i=t.default_max_age),i){case void 0:i=nD;break;case nD:break;default:nn(i,!0,'"maxAge" argument'),s.push("auth_time")}let c=await nO(e,t,n,s,o,a);nr(c.id_token,'"response" body "id_token" property',nG,{body:c});let l=nx(c);if(i!==nD){let e=nc()+na(t),n=ns(t);if(l.auth_time+i<e-n)throw t4("too much time has elapsed since the last End-User authentication",nQ,{claims:l,now:e,tolerance:n,claim:"auth_time"})}if(r===nM){if(void 0!==l.nonce)throw t4('unexpected ID Token "nonce" claim value',n$,{expected:void 0,claims:l,claim:"nonce"})}else if(l.nonce!==r)throw t4('unexpected ID Token "nonce" claim value',n$,{expected:r,claims:l,claim:"nonce"});return c}(e,t,n,r.expectedNonce,r.maxAge,r[t$],r.recognizedTokenTypes):async function(e,t,n,r,i){let o=await nO(e,t,n,void 0,r,i),a=nx(o);if(a){if(void 0!==t.default_max_age){nn(t.default_max_age,!0,'"client.default_max_age"');let e=nc()+na(t),n=ns(t);if(a.auth_time+t.default_max_age<e-n)throw t4("too much time has elapsed since the last End-User authentication",nQ,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw t4('unexpected ID Token "nonce" claim value',n$,{expected:void 0,claims:a,claim:"nonce"})}return o}(e,t,n,null==r?void 0:r[t$],null==r?void 0:r.recognizedTokenTypes)}let nJ="OAUTH_WWW_AUTHENTICATE_CHALLENGE",nH="OAUTH_RESPONSE_BODY_ERROR",nZ="OAUTH_UNSUPPORTED_OPERATION",nF="OAUTH_AUTHORIZATION_RESPONSE_E
1RROR",nV="OAUTH_PARSE_ERROR",nG="OAUTH_INVALID_RESPONSE",nX="OAUTH_RESPONSE_IS_NOT_JSON",nY="OAUTH_RESPONSE_IS_NOT_CONFORM",nB="OAUTH_HTTP_REQUEST_FORBIDDEN",nq="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",nQ="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",n$="OAUTH_JWT_CLAIM_COMPARISON_FAILED",n0="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",n2="OAUTH_MISSING_SERVER_METADATA",n1="OAUTH_INVALID_SERVER_METADATA";async function n5(e){if(!tZ(e,Response))throw tG('"response" must be an instance of Response',tV);await nT(e,200,"Revocation Endpoint")}function n3(e){if(e.bodyUsed)throw tG('"response" body has been used already',tF)}function n9(e){let t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new t3("unsupported ".concat(t.name," modulusLength"),{cause:e})}async function n4(e){if("POST"!==e.method)throw tG("form_post responses are expected to use the POST method",tF,{cause:e});if("application/x-www-form-urlencoded"!==nE(e))throw tG("form_post responses are expected to use the application/x-www-form-urlencoded content-type",tF,{cause:e});return async function(e){if(e.bodyUsed)throw tG("form_post Request instances must contain a readable body",tF,{cause:e});return e.text()}(e)}function n6(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw t4('unexpected JWT "alg" header parameter',nG,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw t4('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw t4('unexpected JWT "alg" header parameter',nG,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw t4('unexpected JWT "alg" header parameter',nG,{header:r,expected:e,reason:"client configuration"})}function n8(e,t){let n=e.getAll(t),r=n[0];if(n.length>1)throw t4('"'.concat(t,'" parameter must be provided only once'),nG);return r}let n7=Symbol(),re=Symbol();async function rt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ni;try{t=await e.json()}catch(t){throw n(e),t4('failed to parse "response" body as JSON',nV,t)}if(!t6(t))throw t4('"response" body must be a top level object',nG,{body:t});return t}let rn=Symbol(),rr=Symbol(),ri=new TextEncoder,ro=new TextDecoder;function ra(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=new Uint8Array(t.reduce((e,t)=>e+t.length,0)),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}function rs(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>127)throw TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function rc(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function rl(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64("string"==typeof e?e:ro.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=ro.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return rc(t)}catch(e){throw TypeError("The input to be decoded is not correctly encoded.")}}function ru(e){let t=e;return"string"==typeof t&&(t=ri.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}let rh=function(e){return TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};function rd(e,t){if(parseInt(e.hash.name.slice(4),10)!==t)throw rh("SHA-".concat(t),"algorithm.hash")}function rp(e,t){for(var n,r=arguments.length,i=Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];if((i=i.filter(Boolean)).length>2){let t=i.pop();e+="one of type ".concat(i.join(", "),", or ").concat(t,".")}else 2===i.length?e+="one of type ".concat(i[0]," or ").concat(i[1],"."):e+="of type ".concat(i[0],".");return null==t?e+=" Received ".concat(t):"function"==typeof t&&t.name?e+=" Received function ".concat(t.name):"object"==typeof t&&null!=t&&null!=(n=t.constructor)&&n.name&&(e+=" Received an instance of ".concat(t.constructor.name)),e}let rf=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return rp("Key for the ".concat(e," algorithm must be "),t,...r)};
1class rm extends Error{constructor(e,t){var n;super(e,t),el(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null==(n=Error.captureStackTrace)||n.call(Error,this,this.constructor)}}el(rm,"code","ERR_JOSE_GENERIC");class ry extends rm{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),el(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),el(this,"claim",void 0),el(this,"reason",void 0),el(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}el(ry,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class rg extends rm{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),el(this,"code","ERR_JWT_EXPIRED"),el(this,"claim",void 0),el(this,"reason",void 0),el(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}
1el(rg,"code","ERR_JWT_EXPIRED");class rw extends rm{constructor(){super(...arguments),el(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}el(rw,"code","ERR_JOSE_ALG_NOT_ALLOWED");class rb extends rm{constructor(){super(...arguments),el(this,"code","ERR_JOSE_NOT_SUPPORTED")}}el(rb,"code","ERR_JOSE_NOT_SUPPORTED"),el(class extends rm{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),el(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),el(class extends rm{constructor(){super(...arguments),el(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class rv extends rm{constructor(){super(...arguments),el(this,"code","ERR_JWS_INVALID")}}el(rv,"code","ERR_JWS_INVALID");class rk extends rm{constructor(){super(...arguments),el(this,"code","ERR_JWT_INVALID")}}el(rk,"code","ERR_JWT_INVALID"),el(class extends rm{constructor(){super(...arguments),el(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class r_ extends rm{constructor(){super(...arguments),el(this,"code","ERR_JWKS_INVALID")}}el(r_,"code","ERR_JWKS_INVALID");class rS extends rm{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),el(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}el(rS,"code","ERR_JWKS_NO_MATCHING_KEY");class rT extends rm{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),el(this,Symbol.asyncIterator,void 0),el(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}el(rT,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class rP extends rm{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),el(this,"code","ERR_JWKS_TIMEOUT")}}el(rP,"code","ERR_JWKS_TIMEOUT");class rE extends rm{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),el(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}el(rE,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");let rA=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},rC=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),rI=e=>rA(e)||rC(e);function rR(e,t){if(e)throw TypeError("".concat(t," can only be called once"))}function rx(e,t,n){try{return rl(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function rO(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function rW(){let e;for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];
1let i=n.filter(Boolean);if(0===i.length||1===i.length)return!0;for(let t of i){let n=Object.keys(t);if(e&&0!==e.size)for(let t of n){if(e.has(t))return!1;e.add(t)}else e=new Set(n)}return!0}let rj=e=>rO(e)&&"string"==typeof e.kty;function rU(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let n=t.algorithm.modulusLength;if("number"!=typeof n||n<2048)throw TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}function rK(e,t){let 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 rb("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}async function rL(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError(function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return rp("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 function(e,t,n){switch(t){case"HS256":case"HS384":case"HS512":if("HMAC"!==e.algorithm.name)throw rh("HMAC");rd(e.algorithm,parseInt(t.slice(2),10));break;case"RS256":case"RS384":case"RS512":if("RSASSA-PKCS1-v1_5"!==e.algorithm.name)throw rh("RSASSA-PKCS1-v1_5");rd(e.algorithm,parseInt(t.slice(2),10));break;case"PS256":case"PS384":case"PS512":if("RSA-PSS"!==e.algorithm.name)throw rh("RSA-PSS");rd(e.algorithm,parseInt(t.slice(2),10));break;
1case"Ed25519":case"EdDSA":if("Ed25519"!==e.algorithm.name)throw rh("Ed25519");break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":let r;if(r=e.algorithm,r.name!==t)throw rh(t);break;case"ES256":case"ES384":case"ES512":{if("ECDSA"!==e.algorithm.name)throw rh("ECDSA");let n=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==n)throw rh(n,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(n&&!e.usages.includes(n))throw TypeError("CryptoKey does not support this operation, its usages must include ".concat(n,"."))}(t,e,n),t}let rN='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';async function rM(e){var t,n;if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let 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 rb(rN)}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 rb(rN)}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 rb(rN)}break;
1case"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 rb(rN)}break;default:throw new rb('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=r.algorithm,o=r.keyUsages,a=eh({},e);return"AKP"!==a.kty&&delete a.alg,delete a.use,crypto.subtle.importKey("jwk",a,i,null!=(t=e.ext)?t:!e.d&&!e.priv,null!=(n=e.key_ops)?n:o)}let rD="given KeyObject instance cannot be used for this algorithm",rz=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];o||(o=new WeakMap);let i=o.get(e);if(null!=i&&i[n])return i[n];let a=await rM(eh(eh({},t),{},{alg:n}));return r&&Object.freeze(e),i?i[n]=a:o.set(e,{[n]:a}),a};async function rJ(e,t){if(e instanceof Uint8Array||rA(e))return e;if(rC(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{let n;o||(o=new WeakMap);let r=o.get(e);if(null!=r&&r[t])return r[t];let i="public"===e.type,a=!!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 TypeError(rD)}n=e.toCryptoKey(e.asymmetricKeyType,a,i?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw TypeError(rD);n=e.toCryptoKey(e.asymmetricKeyType,a,[i?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw TypeError(rD);n=e.toCryptoKey(e.asymmetricKeyType,a,[i?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let r;switch(t){case"RSA-OAEP":r="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":r="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":r="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":r="SHA-512";break;default:throw TypeError(rD)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:r},a,i?["encrypt"]:["decrypt"]);n=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:r},a,[i?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var s;let r=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null==(s=e.asymmetricKeyDetails)?void 0:s.namedCurve);if(!r)throw TypeError(rD);let o={ES256:"P-256",ES384:"P-384",ES512:"P-521"};o[t]&&r===o[t]&&(n=e.toCryptoKey({name:"ECDSA",namedCurve:r},a,[i?"verify":"sign"])),t.startsWith("ECDH-ES")&&(n=e.toCryptoKey({name:"ECDH",namedCurve:r},a,i?[]:["deriveBits"]))}if(!n)throw TypeError(rD);return r?r[t]=n:o.set(e,{[t]:n}),n})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return rz(e,n,t)}if(rj(e))return e.k?rl(e.k):rz(e,e,t,!0);throw Error("unreachable")}let rH=(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},rZ=e=>{let t=e.data[e.pos++];if(128&t){let n=127&t,r=0;for(let t=0;t<n;t++)r=r<<8|e.data[e.pos++];return r}return t},rF=(e,t,n)=>{if(e.data[e.pos++]!==t)throw Error(n)},rV=(e,t)=>{let n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},rG=async(e,t,n,r)=>{var i;let o,a,s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":o={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":o={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":o={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":o={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{let e=r.getNamedCurve(t);o="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new rb("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;
1case"Ed25519":case"EdDSA":o={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":o={name:n},a=c();break;default:throw new rb('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,o,null!=(i=null==r?void 0:r.extractable)?i:!!s,a)};async function rX(e,t,n){var r;let i,o,a;if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw TypeError('"pkcs8" must be PKCS#8 formatted string');return i=/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,o=rc(e.replace(i,"")),a=n,null!=t&&null!=(r=t.startsWith)&&r.call(t,"ECDH-ES")&&(a||(a={}),a.getNamedCurve=e=>{let t,n={data:e,pos:0};return rF(n,48,"Invalid PKCS#8 structure"),rZ(n),rF(n,2,"Expected version field"),t=rZ(n),n.pos+=t,rF(n,48,"Expected algorithm identifier"),rZ(n),n.pos,(e=>{let t,n=(rF(e,6,"Expected algorithm OID"),t=rZ(e),rV(e,t));if(rH(n,[43,101,110]))return"X25519";if(!rH(n,[42,134,72,206,61,2,1]))throw Error("Unsupported key algorithm");rF(e,6,"Expected curve OID");let r=rZ(e),i=rV(e,r);for(let e of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}]){let t=e.name;if(rH(i,e.oid))return t}throw Error("Unsupported named curve")})(n)}),rG("pkcs8",o,t,a)}function rY(e,t,n,r,i){let o;if(void 0!==i.crit&&void 0===(null==r?void 0:r.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return new Set;if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');for(let a of(o=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t,r.crit)){if(!o.has(a))throw new rb('Extension Header Parameter "'.concat(a,'" is not recognized'));if(void 0===i[a])throw new e('Extension Header Parameter "'.concat(a,'" is missing'));if(o.get(a)&&void 0===r[a])throw new e('Extension Header Parameter "'.concat(a,'" MUST be integrity protected'))}return new Set(r.crit)}let rB=e=>null==e?void 0:e[Symbol.toStringTag],rq=(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 TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,i;let o;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):o=n;break;case e.startsWith("PBES2"):o="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):o=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):o="wrapKey";break;case"decrypt"===n:o=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(o&&!1===(null==(r=t.key_ops)||null==(i=r.includes)?void 0:i.call(r,o)))throw TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(o,'" when present'))}return!0};function rQ(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(rj(t)){if("oct"===t.kty&&"string"==typeof t.k&&rq(e,t,n))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!rI(t))throw TypeError(rf(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw TypeError("".concat(rB(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(rj(t))switch(n){case"decrypt":case"sign":if("oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d)&&rq(e,t,n))return;throw TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if("oct"!==t.kty&&void 0===t.d&&void 0===t.priv&&rq(e,t,n))return;throw TypeError("JSON Web Key for this operation must be a public JWK")}if(!rI(t))throw TypeError(rf(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw TypeError("".concat(rB(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw TypeError("".concat(rB(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw TypeError("".concat(rB(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw TypeError("".concat(rB(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw TypeError("".concat(rB(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}function r$(e){return void 0!==e?nh(e):(c||(c=new WeakMap),(e,t,n,r)=>{let i;return(i=c.get(t))||(!function(e,t){if("string"!=typeof e)throw r1("".concat(t," must be a string"),r2);if(0===e.length)throw r1("".concat(t," must not be empty"),r0)}(t.client_secret,'"metadata.client_secret"'),i=nh(t.client_secret),c.set(t,i)),i(e,t,n,r)})}("u"<typeof navigator||null==(iz=navigator.userAgent)||null==(iJ=iz.startsWith)||!iJ.call(iz,"Mozilla/5.0 "))&&(a={"user-agent":"".concat("openid-client","/").concat("v6.8.4")});let r0="ERR_INVALID_ARG_VALUE",r2="ERR_INVALID_ARG_TYPE";
1function r1(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class r5 extends Error{constructor(e,t){var n;super(e,t),el(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null==(n=Error.captureStackTrace)||n.call(Error,this,this.constructor)}}function r3(e,t,n){return new r5(e,{cause:t,code:n})}function r9(e){if(e instanceof TypeError||e instanceof r5||e instanceof ny||e instanceof ng||e instanceof nw)throw e;if(e instanceof t9)switch(e.code){case nB:throw r3("only requests to HTTPS are allowed",e,e.code);case nq:throw r3("only requests to HTTP or HTTPS are allowed",e,e.code);case nY:throw r3("unexpected HTTP response status code",e.cause,e.code);case nX:throw r3("unexpected response content-type",e.cause,e.code);case nV:throw r3("parsing error occured",e,e.code);case nG:throw r3("invalid response encountered",e,e.code);case n$:throw r3("unexpected JWT claim value encountered",e,e.code);case n0:throw r3("unexpected JSON attribute value encountered",e,e.code);case nQ:throw r3("JWT timestamp claim value failed validation",e,e.code);default:throw r3(e.message,e,e.code)}if(e instanceof t3)throw r3("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw r3("runtime operation error",e,nZ);case"NotSupportedError":throw r3("runtime unsupported operation",e,nZ);case"TimeoutError":throw r3("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw r3("operation aborted",e,"OAUTH_ABORT")}throw new r5("something went wrong",{cause:e})}async function r4(e,t,n,r,i){let o=new r8(await async function(e,t){var n,r,i;if(!(e instanceof URL))throw r1('"server" must be an instance of URL',r2);let o=!e.href.includes("/.well-known/"),s=null!=(n=null==t?void 0:t.timeout)?n:30,c=AbortSignal.timeout(1e3*s),l=await (o?nt(e,{algorithm:null==t?void 0:t.algorithm,[tq]:null==t?void 0:t[tq],[tX]:null==t||null==(r=t.execute)?void 0:r.includes(io),signal:c,headers:new Headers(a)}):((null==t?void 0:t[tq])||fetch)((np(e,null==t||null==(i=t.execute)||!i.includes(io)),e.href),{headers:Object.fromEntries(new Headers(eh({accept:"application/json"},a)).entries()),body:void 0,method:"GET",redirect:"manual",signal:c})).then(e=>(async function(e,t){if(!(e instanceof URL)&&e!==rn)throw tG('"expectedIssuerIdentifier" must be an instance of URL',tV);if(!tZ(t,Response))throw tG('"response" must be an instance of Response',tV);if(200!==t.status)throw t4('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',nY,t);n3(t);let n=await rt(t);if(nr(n.issuer,'"response" body "issuer" property',nG,{body:n}),e!==rn&&new URL(n.issuer).href!==e.href)throw t4('"response" body "issuer" property does not match the expected value',n0,{expected:e.href,body:n,attribute:"issuer"});return n})(rn,e)).catch(r9);return o&&new URL(l.issuer).href!==e.href&&("https://login.microsoftonline.com"!==e.origin||null!=t&&t.algorithm&&"oidc"!==t.algorithm||(l[r6]=!0,0))&&(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)&&(()=>{throw new r5("discovered metadata issuer does not match the expected issuer",{code:n0,cause:{expected:e.href,body:l,attribute:"issuer"}})})(),l}(e,i),t,n,r),c=s.get(o);if(null!=i&&i[tq]&&(c.fetch=i[tq]),null!=i&&i.timeout&&(c.timeout=i.timeout),null!=i&&i.execute)for(let e of i.execute)e(o);return o}new TextDecoder;let r6=Symbol();class r8{constructor(e,t,n,r){var i,o,a,c,l;let u;if("string"!=typeof t||!t.length)throw r1('"clientId" must be a non-empty string',r2);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null==(i=n)?void 0:i.client_id)&&t!==n.client_id)throw r1('"clientId" and "metadata.client_id" must be the same',r0);const h=eh(eh({},structuredClone(n)),{},{client_id:t});h[tY]=null!=(o=null==(a=n)?void 0:a[tY])?o:0,h[tB]=null!=(c=null==(l=n)?void 0:l[tB])?c:30,u=r||("string"==typeof h.client_secret&&h.client_secret.length?r$(h.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(h);const p=structuredClone(e);r6 in e&&(p[rr]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let f=Object.freeze(p);s||(s=new WeakMap),s.set(this,{__proto__:null,as:f,c:d,auth:u,tlsOnly:!0,jwksCache:{}})}serverMetadata(){let e=structuredClone(s.get(this).as);return Object.defineProperties(e,{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.includes(n))}}}),e}clientMetadata(){return structuredClone(s.get(this).c)}get timeout(){return s.get(this).timeout}set timeout(e){s.get(this).timeout=e}get[tq](){return s.get(this).fetch}set[tq](e){s.get(this).fetch=e}}function r7(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){let n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}
1return{expiresIn:{__proto__:null,value(){if(t){let e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return nx(this)}catch(e){return}}}}}(e))}async function ie(e,t,n){var r;let i,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=null==(r=e.headers.get("retry-after"))?void 0:r.trim();if(void 0!==a){if(/^\d+$/.test(a))i=parseInt(a,10);else{let e=new Date(a);if(Number.isFinite(e.getTime())){let t=new Date,n=e.getTime()-t.getTime();n>0&&(i=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(i))throw new t9("invalid Retry-After header value",{cause:e});i>t&&await it(i-t,n)}}function it(e,t){return new Promise((n,r)=>{let i=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();let o=Math.min(e,5);setTimeout(()=>i(e-o),1e3*o)};i(e)})}async function ir(e,t){ih(e);let n=s.get(e),r=n.as,i=n.c,o=n.auth,c=n.fetch,l=n.tlsOnly,u=n.timeout;return(async function(e,t,n,r,i){nl(e),nu(t);let o=nm(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[tX])),a=new URLSearchParams(r);a.set("client_id",t.client_id);let s=t8(null==i?void 0:i.headers);return s.set("accept","application/json"),nA(e,t,n,o,a,s,i)})(r,i,o,t,{[tq]:c,[tX]:!l,headers:new Headers(a),signal:id(u)}).then(e=>(async function(e,t,n){if(nl(e),nu(t),!tZ(n,Response))throw tG('"response" must be an instance of Response',tV);await nT(n,200,"Backchannel Authentication Endpoint"),n3(n);let r=await rt(n);nr(r.auth_req_id,'"response" body "auth_req_id" property',nG,{body:r});let i="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return nn(i,!0,'"response" body "expires_in" property',nG,{body:r}),r.expires_in=i,void 0!==r.interval&&nn(r.interval,!1,'"response" body "interval" property',nG,{body:r}),r})(r,i,e)).catch(r9)}async function ii(e,t,n,r){var i,o,c;let l;ih(e),n=new URLSearchParams(n);let u=null!=(i=t.interval)?i:5,h=null!=(o=null==r?void 0:r.signal)?o:AbortSignal.timeout(1e3*t.expires_in);try{await it(u,h)}catch(e){r9(e)}let d=s.get(e),p=d.as,f=d.c,m=d.auth,y=d.fetch,g=d.tlsOnly,w=d.nonRepudiation,b=d.timeout,v=d.decrypt,k=(i,o)=>ii(e,eh(eh({},t),{},{interval:i}),n,eh(eh({},r),{},{signal:h,flag:o})),_=function(e,t){let n=id(t);if(!n)return{signal:e,cleanup(){}};let r=new AbortController,i=e=>{let t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",i,{once:!0}),n.addEventListener("abort",i,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",i),n.removeEventListener("abort",i)}}}(h,b),S=await (async function(e,t,n,r,i){nl(e),nu(t),nr(r,'"authReqId"');let o=new URLSearchParams(null==i?void 0:i.additionalParameters);return o.set("auth_req_id",r),nC(e,t,n,"urn:openid:params:grant-type:ciba",o,i)})(p,f,m,t.auth_req_id,{[tq]:y,[tX]:!g,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(a),signal:_.signal}).catch(r9).finally(_.cleanup);if(503===S.status&&S.headers.has("retry-after"))return await ie(S,u,h,!0),await (null==(c=S.body)?void 0:c.cancel()),k(u);let T=async function(e,t,n,r){return nO(e,t,n,void 0,null==r?void 0:r[t$],null==r?void 0:r.recognizedTokenTypes)}(p,f,S,{[t$]:v});try{l=await T}catch(e){if(ip(e,r))return k(u,im);if(e instanceof ny)switch(e.error){case"slow_down":u+=5;case"authorization_pending":return await ie(e.response,u,h),k(u)}r9(e)}return l.id_token&&await (null==w?void 0:w(S)),r7(l),l}function io(e){s.get(e).tlsOnly=!1}async function ia(e,t,n,r,i){let o,c,l;if(ih(e),!((null==i?void 0:i.flag)===im||t instanceof URL||function(e,t){try{return Object.getPrototypeOf(e)[Symbol.toStringTag]===t}catch(e){return!1}}(t,"Request")))throw r1('"currentUrl" must be an instance of URL, or Request',r2);let u=s.get(e),h=u.as,d=u.c,p=u.auth,f=u.fetch,m=u.tlsOnly,y=u.jarm,g=u.hybrid,w=u.nonRepudiation,b=u.timeout,v=u.decrypt,k=u.implicit;if((null==i?void 0:i.flag)===im)o=i.authResponse,c=i.redirectUri;else{if(!(t instanceof URL)){let e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":let n=new URLSearchParams(await n4(e));if(g)t.hash=n.toString();else for(let e of n.entries()){var _,S=ep(e,2);let n=S[0],r=S[1];t.searchParams.append(n,r)}break;default:throw r1("unexpected Request HTTP method",r0)}}switch((_=new URL(_=t)).search="",_.hash="",c=_.href,!0){case!!y:o=await y(t,null==n?void 0:n.expectedState);break;case!!g:o=await g(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!k:throw TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{o=function(e,t,n,r){var i;if(nl(e),nu(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw tG('"parameters" must be an instance of URLSearchParams, or URL',tV);if(n8(n,"response"))throw t4('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',nG,{parameters:n});let o=n8(n,"iss"),a=n8(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw t4('response parameter "iss" (issuer) missing',nG,{parameters:n});if(o&&o!==e.issuer)throw t4('unexpected "iss" (issuer) response parameter value',nG,{expected:e.issuer,parameters:n});switch(r){case void 0:case re:if(void 0!==a)throw t4('unexpected "state" response parameter encountered',nG,{expected:void 0,parameters:n});break;case n7:break;default:if(nr(r,'"expectedState" argument'),a!==r)throw t4(void 0===a?'response parameter "state" missing':'unexpected "state" response parameter value',nG,{expected:r,parameters:n})}if(n8(n,"error"))throw new ng("authorization response from the server is an error",{cause:n});let s=n8(n,"id_token"),c=n8(n,"token");if(void 0!==s||void 0!==c)throw new t3("implicit and hybrid flows are not supported");return i=new URLSearchParams(n),nU.add(i),i}(h,d,t.searchParams,null==n?void 0:n.expectedState)}catch(e){r9(e)}}}let T=await (async function(e,t,n,r,i,o,a){if(nl(e),nu(t),!nU.has(r))throw tG('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',tF);nr(i,'"redirectUri"');let s=n8(r,"code");if(!s)throw t4('no authorization code in "callbackParameters"',nG);let c=new URLSearchParams(null==a?void 0:a.additionalParameters);
1return c.set("redirect_uri",i),c.set("code",s),o!==nK&&(nr(o,'"codeVerifier"'),c.set("code_verifier",o)),nC(e,t,n,"authorization_code",c,a)})(h,d,p,o,c,(null==n?void 0:n.pkceCodeVerifier)||nK,{additionalParameters:r,[tq]:f,[tX]:!m,DPoP:null==i?void 0:i.DPoP,headers:new Headers(a),signal:id(b)}).catch(r9);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);let P=nz(h,d,T,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[t$]:v});try{l=await P}catch(t){if(ip(t,i))return ia(e,void 0,n,r,eh(eh({},i),{},{flag:im,authResponse:o,redirectUri:c}));r9(t)}return l.id_token&&await (null==w?void 0:w(T)),r7(l),l}async function is(e,t,n,r){let i;ih(e),n=new URLSearchParams(n);let o=s.get(e),c=o.as,l=o.c,u=o.auth,h=o.fetch,d=o.tlsOnly,p=o.nonRepudiation,f=o.timeout,m=o.decrypt,y=await (async function(e,t,n,r,i){nl(e),nu(t),nr(r,'"refreshToken"');let o=new URLSearchParams(null==i?void 0:i.additionalParameters);return o.set("refresh_token",r),nC(e,t,n,"refresh_token",o,i)})(c,l,u,t,{[tq]:h,[tX]:!d,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(a),signal:id(f)}).catch(r9),g=async function(e,t,n,r){return nO(e,t,n,void 0,null==r?void 0:r[t$],null==r?void 0:r.recognizedTokenTypes)}(c,l,y,{[t$]:m});try{i=await g}catch(i){if(ip(i,r))return is(e,t,n,eh(eh({},r),{},{flag:im}));r9(i)}return i.id_token&&await (null==p?void 0:p(y)),r7(i),i}async function ic(e,t,n){let r;ih(e),t=new URLSearchParams(t);let i=s.get(e),o=i.as,c=i.c,l=i.auth,u=i.fetch,h=i.tlsOnly,d=i.timeout,p=await (async function(e,t,n,r,i){return nl(e),nu(t),nC(e,t,n,"client_credentials",new URLSearchParams(r),i)})(o,c,l,t,{[tq]:u,[tX]:!h,DPoP:null==n?void 0:n.DPoP,headers:new Headers(a),signal:id(d)}).catch(r9),f=async function(e,t,n){return nO(e,t,n,void 0,void 0,void 0)}(o,c,p);try{r=await f}catch(r){if(ip(r,n))return ic(e,t,eh(eh({},n),{},{flag:im}));r9(r)}return r7(r),r}function il(e,t){ih(e);let n=s.get(e),r=n.as,i=n.c,o=n.tlsOnly,a=n.hybrid,c=n.jarm,l=n.implicit,u=nm(r,"authorization_endpoint",!1,o);if((t=new URLSearchParams(t)).has("client_id")||t.set("client_id",i.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":l?"id_token":"code"),l&&!t.has("nonce"))throw r1("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",r0);c&&t.set("response_mode","jwt")}for(let e of t.entries()){var h=ep(e,2);let t=h[0],n=h[1];u.searchParams.append(t,n)}return u}async function iu(e,t,n){let r;ih(e);let i=il(e,t),o=s.get(e),c=o.as,l=o.c,u=o.auth,h=o.fetch,d=o.tlsOnly,p=o.timeout,f=await (async function(e,t,n,r,i){var o;nl(e),nu(t);let a=nm(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[tX])),s=new URLSearchParams(r);s.set("client_id",t.client_id);let c=t8(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(nP(i.DPoP),await i.DPoP.addProof(a,c,"POST"));let l=await nA(e,t,n,a,s,c,i);return null==i||null==(o=i.DPoP)||o.cacheNonce(l,a),l})(c,l,u,i.searchParams,{[tq]:h,[tX]:!d,DPoP:null==n?void 0:n.DPoP,headers:new Headers(a),signal:id(p)}).catch(r9),m=async function(e,t,n){if(nl(e),nu(t),!tZ(n,Response))throw tG('"response" must be an instance of Response',tV);await nT(n,201,"Pushed Authorization Request Endpoint"),n3(n);let r=await rt(n);nr(r.request_uri,'"response" body "request_uri" property',nG,{body:r});let i="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return nn(i,!0,'"response" body "expires_in" property',nG,{body:r}),r.expires_in=i,r}(c,l,f);try{r=await m}catch(r){if(ip(r,n))return iu(e,t,eh(eh({},n),{},{flag:im}));r9(r)}return il(e,{request_uri:r.request_uri})}function ih(e){if(!(e instanceof r8))throw r1('"config" must be an instance of Configuration',r2);if(Object.getPrototypeOf(e)!==r8.prototype)throw r1("subclassing Configuration is not allowed",r0)}function id(e){return e?AbortSignal.timeout(1e3*e):void 0}function ip(e,t){return!(null==t||!t.DPoP||t.flag===im)&&function(e){if(e instanceof nw){let t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof ny&&"use_dpop_nonce"===e.error}(e)}Object.freeze(r8.prototype);let im=Symbol();async function iy(e,t,n,r){let i,o;ih(e);let c=s.get(e),l=c.as,u=c.c,h=c.auth,d=c.fetch,p=c.tlsOnly,f=c.timeout,m=c.decrypt,y=c.nonRepudiation,g=await (async function(e,t,n,r,i,o){return nl(e),nu(t),nr(r,'"grantType"'),nC(e,t,n,r,new URLSearchParams(i),o)})(l,u,h,t,new URLSearchParams(n),{[tq]:d,[tX]:!p,DPoP:null==r?void 0:r.DPoP,headers:new Headers(a),signal:id(f)}).catch(r9);"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(i={n_a:()=>{}});let w=async function(e,t,n,r){return nO(e,t,n,void 0,null==r?void 0:r[t$],null==r?void 0:r.recognizedTokenTypes)}(l,u,g,{[t$]:m,recognizedTokenTypes:i});try{o=await w}catch(i){if(ip(i,r))return iy(e,t,n,eh(eh({},r),{},{flag:im}));r9(i)}return o.id_token&&await (null==y?void 0:y(g)),r7(o),o}async function ig(e,t,n){ih(e);let r=s.get(e),i=r.as,o=r.c,c=r.auth,l=r.fetch,u=r.tlsOnly,h=r.timeout;return(async function(e,t,n,r,i){nl(e),nu(t),nr(r,'"token"');let o=nm(e,"revocation_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[tX])),a=new URLSearchParams(null==i?void 0:i.additionalParameters);a.set("token",r);let s=t8(null==i?void 0:i.headers);return s.delete("accept"),nA(e,t,n,o,a,s,i)})(i,o,c,t,{[tq]:l,[tX]:!u,additionalParameters:new URLSearchParams(n),headers:new Headers(a),signal:id(h)}).then(n5).catch(r9)}async function iw(e,t,n){if(!rO(e))throw new rv("Flattened JWS must be an object");
1if(void 0===e.protected&&void 0===e.header)throw new rv('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new rv("JWS Protected Header incorrect type");if(void 0===e.payload)throw new rv("JWS Payload missing");if("string"!=typeof e.signature)throw new rv("JWS Signature missing or incorrect type");if(void 0!==e.header&&!rO(e.header))throw new rv("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{let t=rl(e.protected);r=JSON.parse(ro.decode(t))}catch(e){throw new rv("JWS Protected Header is invalid")}if(!rW(r,e.header))throw new rv("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i=eh(eh({},r),e.header),o=!0;if(rY(rv,new Map([["b64",!0]]),null==n?void 0:n.crit,r,i).has("b64")&&"boolean"!=typeof(o=r.b64))throw new rv('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let a=i.alg;if("string"!=typeof a||!a)throw new rv('JWS "alg" (Algorithm) Header Parameter missing or invalid');let s=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}("algorithms",n.algorithms);if(s&&!s.has(a))throw new rw('"alg" (Algorithm) Header Parameter value not allowed');if(o){if("string"!=typeof e.payload)throw new rv("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new rv("JWS Payload must be a string or an Uint8Array instance");let c=!1;"function"==typeof t&&(t=await t(r,e),c=!0),rQ(a,t,"verify");let l=ra(void 0!==e.protected?rs(e.protected):new Uint8Array,rs("."),"string"==typeof e.payload?o?rs(e.payload):ri.encode(e.payload):e.payload),u=rx(e.signature,"signature",rv),h=await rJ(t,a);if(!await async function(e,t,n,r){let i=await rL(e,t,"verify");rU(e,i);let o=rK(e,i.algorithm);try{return await crypto.subtle.verify(o,i,n,r)}catch(e){return!1}}(a,h,u,l))throw new rE;let d={payload:o?rx(e.payload,"payload",rv):"string"==typeof e.payload?ri.encode(e.payload):e.payload};return void 0!==e.protected&&(d.protectedHeader=r),void 0!==e.header&&(d.unprotectedHeader=e.header),c?eh(eh({},d),{},{key:h}):d}let ib=e=>Math.floor(e.getTime()/1e3),iv=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function ik(e){let t,n=iv.exec(e);if(!n||n[4]&&n[1])throw TypeError("Invalid time period format");let r=parseFloat(n[2]);switch(n[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*r);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*r);break;case"day":case"days":case"d":t=Math.round(86400*r);break;case"week":case"weeks":case"w":t=Math.round(604800*r);break;default:t=Math.round(0x1e187e0*r)}return"-"===n[1]||"ago"===n[4]?-t:t}function i_(e,t){if(!Number.isFinite(t))throw TypeError("Invalid ".concat(e," input"));return t}let iS=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());var iT=new WeakMap;class iP{constructor(e){if(ea(this,iT,void 0),!rO(e))throw TypeError("JWT Claims Set MUST be an object");es(iT,this,structuredClone(e))}data(){return ri.encode(JSON.stringify(eo(iT,this)))}get iss(){return eo(iT,this).iss}set iss(e){eo(iT,this).iss=e}get sub(){return eo(iT,this).sub}set sub(e){eo(iT,this).sub=e}get aud(){return eo(iT,this).aud}set aud(e){eo(iT,this).aud=e}set jti(e){eo(iT,this).jti=e}set nbf(e){"number"==typeof e?eo(iT,this).nbf=i_("setNotBefore",e):e instanceof Date?eo(iT,this).nbf=i_("setNotBefore",ib(e)):eo(iT,this).nbf=ib(new Date)+ik(e)}set exp(e){"number"==typeof e?eo(iT,this).exp=i_("setExpirationTime",e):e instanceof Date?eo(iT,this).exp=i_("setExpirationTime",ib(e)):eo(iT,this).exp=ib(new Date)+ik(e)}set iat(e){void 0===e?eo(iT,this).iat=ib(new Date):e instanceof Date?eo(iT,this).iat=i_("setIssuedAt",ib(e)):eo(iT,this).iat=i_("setIssuedAt","string"==typeof e?ib(new Date)+ik(e):e)}}async function iE(e,t,n){var r;let i=await async function(e,t,n){if(e instanceof Uint8Array&&(e=ro.decode(e)),"string"!=typeof e)throw new rv("Compact JWS must be a string or Uint8Array");let r=e.split("."),i=r[0],o=r[1],a=r[2];if(3!==r.length)throw new rv("Invalid Compact JWS");let s=await iw({payload:o,protected:i,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?eh(eh({},c),{},{key:s.key}):c}(e,t,n);if(null!=(r=i.protectedHeader.crit)&&r.includes("b64")&&!1===i.protectedHeader.b64)throw new rk("JWTs MUST NOT use unencoded payload");let o={payload:function(e,t){var n,r;let i,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{o=JSON.parse(ro.decode(t))}catch(e){}if(!rO(o))throw new rk("JWT Claims Set must be a top-level JSON object");let s=a.typ;if(s&&("string"!=typeof e.typ||iS(e.typ)!==iS(s)))throw new ry('unex
1pected "typ" JWT header value',o,"typ","check_failed");let c=a.requiredClaims,l=a.issuer,u=a.subject,h=a.audience,d=a.maxTokenAge,p=[...void 0===c?[]:c];for(let e of(void 0!==d&&p.push("iat"),void 0!==h&&p.push("aud"),void 0!==u&&p.push("sub"),void 0!==l&&p.push("iss"),new Set(p.reverse())))if(!(e in o))throw new ry('missing required "'.concat(e,'" claim'),o,e,"missing");if(l&&!(Array.isArray(l)?l:[l]).includes(o.iss))throw new ry('unexpected "iss" claim value',o,"iss","check_failed");if(u&&o.sub!==u)throw new ry('unexpected "sub" claim value',o,"sub","check_failed");if(h&&(n=o.aud,r="string"==typeof h?[h]:h,!("string"==typeof n?r.includes(n):Array.isArray(n)&&r.some(Set.prototype.has.bind(new Set(n))))))throw new ry('unexpected "aud" claim value',o,"aud","check_failed");switch(typeof a.clockTolerance){case"string":i=ik(a.clockTolerance);break;case"number":i=a.clockTolerance;break;case"undefined":i=0;break;default:throw TypeError("Invalid clockTolerance option type")}let f=ib(a.currentDate||new Date);if((void 0!==o.iat||d)&&"number"!=typeof o.iat)throw new ry('"iat" claim must be a number',o,"iat","invalid");if(void 0!==o.nbf){if("number"!=typeof o.nbf)throw new ry('"nbf" claim must be a number',o,"nbf","invalid");if(o.nbf>f+i)throw new ry('"nbf" claim timestamp check failed',o,"nbf","check_failed")}if(void 0!==o.exp){if("number"!=typeof o.exp)throw new ry('"exp" claim must be a number',o,"exp","invalid");if(o.exp<=f-i)throw new rg('"exp" claim timestamp check failed',o,"exp","check_failed")}if(d){let e=f-o.iat;if(e-i>("number"==typeof d?d:ik(d)))throw new rg('"iat" claim timestamp check failed (too far in the past)',o,"iat","check_failed");if(e<0-i)throw new ry('"iat" claim timestamp check failed (it should be in the past)',o,"iat","check_failed")}return o}(i.protectedHeader,i.payload,n),protectedHeader:i.protectedHeader};return"function"==typeof t?eh(eh({},o),{},{key:i.key}):o}var iA=new WeakMap,iC=new WeakMap,iI=new WeakMap;class iR{constructor(e){if(ea(this,iA,void 0),ea(this,iC,void 0),ea(this,iI,void 0),!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");es(iA,this,e)}setProtectedHeader(e){return rR(eo(iC,this),"setProtectedHeader"),es(iC,this,e),this}setUnprotectedHeader(e){return rR(eo(iI,this),"setUnprotectedHeader"),es(iI,this,e),this}async sign(e,t){let n,r,i,o;if(!eo(iC,this)&&!eo(iI,this))throw new rv("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!rW(eo(iC,this),eo(iI,this)))throw new rv("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let a=eh(eh({},eo(iC,this)),eo(iI,this)),s=!0;if(rY(rv,new Map([["b64",!0]]),null==t?void 0:t.crit,eo(iC,this),a).has("b64")&&"boolean"!=typeof(s=eo(iC,this).b64))throw new rv('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let c=a.alg;if("string"!=typeof c||!c)throw new rv('JWS "alg" (Algorithm) Header Parameter missing or invalid');rQ(c,e,"sign"),s?r=rs(n=ru(eo(iA,this))):(r=eo(iA,this),n=""),eo(iC,this)?o=rs(i=ru(JSON.stringify(eo(iC,this)))):(i="",o=new Uint8Array);let l=ra(o,rs("."),r),u=await rJ(e,c),h={signature:ru(await async function(e,t,n){let r=await rL(e,t,"sign");return rU(e,r),new Uint8Array(await crypto.subtle.sign(rK(e,r.algorithm),r,n))}(c,u,l)),payload:n};return eo(iI,this)&&(h.header=eo(iI,this)),eo(iC,this)&&(h.protected=i),h}}var ix=new WeakMap;class iO{constructor(e){ea(this,ix,void 0),es(ix,this,new iR(e))}setProtectedHeader(e){return eo(ix,this).setProtectedHeader(e),this}async sign(e,t){let n=await eo(ix,this).sign(e,t);if(void 0===n.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return"".concat(n.protected,".").concat(n.payload,".").concat(n.signature)}}var iW=new WeakMap,ij=new WeakMap;class iU{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ea(this,iW,void 0),ea(this,ij,void 0),es(ij,this,new iP(e))}setIssuer(e){return eo(ij,this).iss=e,this}setSubject(e){return eo(ij,this).sub=e,this}setAudience(e){return eo(ij,this).aud=e,this}setJti(e){return eo(ij,this).jti=e,this}setNotBefore(e){return eo(ij,this).nbf=e,this}setExpirationTime(e){return eo(ij,this).exp=e,this}setIssuedAt(e){return eo(ij,this).iat=e,this}setProtectedHeader(e){return es(iW,this,e),this}async sign(e,t){var n;let r=new iO(eo(ij,this).data());if(r.setProtectedHeader(eo(iW,this)),Array.isArray(null==(n=eo(iW,this))?void 0:n.crit)&&eo(iW,this).crit.includes("b64")&&!1===eo(iW,this).b64)throw new rk("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}function iK(e){return rO(e)}var iL,iN,iM,iD,iz,iJ,iH,iZ,iF=new WeakMap,iV=new WeakMap;class iG{constructor(e){if(ea(this,iF,void 0),ea(this,iV,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(iK)}(e))throw new r_("JSON Web Key Set malformed");es(iF,this,structuredClone(e))}jwks(){return eo(iF,this)}async getKey(e,t){let n=eh(eh({},e),null==t?void 0:t.header),r=n.alg,i=n.kid,o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new rb('Unsupported "alg" value for a JSON Web Key Set')}}(r),a=eo(iF,this).keys.filter(e=>
1{let t=o===e.kty;if(t&&"string"==typeof i&&(t=i===e.kid),t&&("string"==typeof e.alg||"AKP"===o)&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),s=a[0],c=a.length;if(0===c)throw new rS;if(1!==c){var l;let e=new rT,t=eo(iV,this);throw e[Symbol.asyncIterator]=(l=function*(){for(let n of a)try{var e;yield yield(e=iX(t,n,r),new et(e,0))}catch(e){}},function(){return new ef(l.apply(this,arguments))}),e}return iX(eo(iV,this),s,r)}}async function iX(e,t,n){let r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){let e=await async function(e,t){let n;if(!rO(e))throw TypeError("JWK must be an object");switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return rl(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new rb('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return rM(eh(eh({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw TypeError("JWK alg and alg option value mismatch");return rM(eh(eh({},e),{},{ext:n}));case"EC":case"OKP":return rM(eh(eh({},e),{},{alg:t,ext:n}));default:throw new rb('Unsupported "kty" (Key Type) Parameter value')}}(eh(eh({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new r_("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function iY(e){let t=new iG(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}("u"<typeof navigator||null==(iH=navigator.userAgent)||null==(iZ=iH.startsWith)||!iZ.call(iH,"Mozilla/5.0 "))&&(l="".concat("jose","/").concat("v6.2.3"));let iB=Symbol(),iq=Symbol();var iQ=new WeakMap,i$=new WeakMap,i0=new WeakMap,i2=new WeakMap,i1=new WeakMap,i5=new WeakMap,i3=new WeakMap,i9=new WeakMap,i4=new WeakMap,i6=new WeakMap;class i8{constructor(e,t){var n,r;if(ea(this,iQ,void 0),ea(this,i$,void 0),ea(this,i0,void 0),ea(this,i2,void 0),ea(this,i1,void 0),ea(this,i5,void 0),ea(this,i3,void 0),ea(this,i9,void 0),ea(this,i4,void 0),ea(this,i6,void 0),!(e instanceof URL))throw TypeError("url must be an instance of URL");es(iQ,this,new URL(e.href)),es(i$,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),es(i0,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),es(i2,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),es(i3,this,new Headers(null==t?void 0:t.headers)),l&&!eo(i3,this).has("User-Agent")&&eo(i3,this).set("User-Agent",l),eo(i3,this).has("accept")||(eo(i3,this).set("accept","application/json"),eo(i3,this).append("accept","application/jwk-set+json")),es(i9,this,null==t?void 0:t[iB]),void 0!==(null==t?void 0:t[iq])&&(es(i6,this,null==t?void 0:t[iq]),n=null==t?void 0:t[iq],r=eo(i2,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&rO(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,rO)&&(es(i1,this,eo(i6,this).uat),es(i4,this,iY(eo(i6,this).jwks))))}pendingFetch(){return!!eo(i5,this)}coolingDown(){return"number"==typeof eo(i1,this)&&Date.now()<eo(i1,this)+eo(i0,this)}fresh(){return"number"==typeof eo(i1,this)&&Date.now()<eo(i1,this)+eo(i2,this)}jwks(){var e;return null==(e=eo(i4,this))?void 0:e.jwks()}async getKey(e,t){eo(i4,this)&&this.fresh()||await this.reload();try{return await eo(i4,this).call(this,e,t)}catch(n){if(n instanceof rS&&!1===this.coolingDown())return await this.reload(),eo(i4,this).call(this,e,t);throw n}}async reload(){eo(i5,this)&&("u">typeof WebSocketPair||"u">typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"u">typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&es(i5,this,void 0),eo(i5,this)||es(i5,this,(async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fetch,i=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new rP;throw e});if(200!==i.status)throw new rm("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch(e){throw new rm("Failed to parse the JSON Web Key Set HTTP response as JSON")}})(eo(iQ,this).href,eo(i3,this),AbortSignal.timeout(eo(i$,this)),eo(i9,this)).then(e=>{es(i4,this,iY(e)),eo(i6,this)&&(eo(i6,this).uat=Date.now(),eo(i6,this).jwks=e),es(i1,this,Date.now()),es(i5,this,void 0)}).catch(e=>{throw es(i5,this,void 0),e})),await eo(i5,this)}}let i7=["mfaToken"],oe=["mfaToken"];function ot(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};let r={error:null!=(t=e.error)?t:"",error_description:null!=(n=e.error_description)?n:"",message:e.message};if("mfa_required"===e.error&&e.cause){r.mfa_token="string"==typeof e.cause.mfa_token?e.cause.mfa_token:void 0;let t=e.cause.mfa_requirements;"object"==typeof t&&null!==t&&(r.mfa_requirements=t)}return r}
vendor: 4,358 bytes, line 1
1var on=class extends Error{constructor(e,t){super(t),el(this,"code",void 0),this.name="NotSupportedError",this.code=e}},or=class extends Error{constructor(e,t,n){super(t),el(this,"cause",void 0),el(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}}},oi=class extends or{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},oo=class extends or{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},oa=class extends or{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},os=class extends or{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},oc=class extends or{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ol=class extends or{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ou=class extends or{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},oh=class extends Error{constructor(e){super(e),el(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},od=class extends or{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),el(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},op=class extends or{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},of=class extends or{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},om=class extends or{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},oy=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),el(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}},og=class extends Error{constructor(e){super(e),el(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}};function ow(e){return Object.entries(e).filter(e=>void 0!==ep(e,2)[1]).reduce((e,t)=>eh(eh({},e),{},{[t[0]]:t[1]}),{})}function ob(e){if(!e.trim())throw new og("organization must not be blank")}function ov(e,t){if(!e)return;let n=t.trim();if(n.startsWith("org_")){let t=e.org_id;if("string"!=typeof t)throw new og("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new og('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{let t=e.org_name;if("string"!=typeof t)throw new og("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new og('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var ok=class extends Error{constructor(e,t,n){super(t),el(this,"cause",void 0),el(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},o_=class extends ok{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},oS=class extends ok{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},oT=class extends ok{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},oP=class extends ok{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},oE=class extends ok{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function oA(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var oC=class e{constructor(e,t,n,r,i,o,a){el(this,"accessToken",void 0),el(this,"idToken",void 0),el(this,"refreshToken",void 0),el(this,"expiresAt",void 0),el(this,"scope",void 0),el(this,"claims",void 0),el(this,"authorizationDetail
1s",void 0),el(this,"tokenType",void 0),el(this,"issuedTokenType",void 0),el(this,"recoveryCode",void 0),el(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=i,this.claims=o,this.authorizationDetails=a}static fromTokenEndpointResponse(t){let n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},oI={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-recovery-code"},oR=(u=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakMap,class{constructor(e){var t;ea(this,u,void 0),ea(this,h,void 0),ea(this,d,void 0),ea(this,p,void 0),ea(this,f,void 0),es(u,this,"https://".concat(e.domain)),es(h,this,e.clientId),es(d,this,e.clientSecret),es(p,this,null!=(t=e.customFetch)?t:function(){return fetch(...arguments)}),es(f,this,e.getConfiguration)}async listAuthenticators(e){let t="".concat(eo(u,this),"/mfa/authenticators"),n=e.mfaToken,r=await eo(p,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){let e;try{e=await r.json()}catch(e){throw new o_("Failed to list authenticators")}throw new o_(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(oA)}async enrollAuthenticator(e){let t="".concat(eo(u,this),"/mfa/associate"),n=e.mfaToken,r=ed(e,i7),i={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(i.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(i.phone_number=r.phoneNumber),"email"in r&&r.email&&(i.email=r.email);let o=await eo(p,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let e;try{e=await o.json()}catch(e){throw new oS("Failed to enroll authenticator")}throw new oS(e.error_description||"Failed to enroll authenticator",e)}var a=await o.json();if("otp"===a.authenticator_type)return{authenticatorType:"otp",secret:a.secret,barcodeUri:a.barcode_uri,recoveryCodes:a.recovery_codes,id:a.id};if("oob"===a.authenticator_type)return{authenticatorType:"oob",oobChannel:a.oob_channel,oobCode:a.oob_code,bindingMethod:a.binding_method,id:a.id,barcodeUri:a.barcode_uri,recoveryCodes:a.recovery_codes};throw Error("Unexpected authenticator type: ".concat(a.authenticator_type))}async deleteAuthenticator(e){let t=e.authenticatorId,n=e.mfaToken,r="".concat(eo(u,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),i=await eo(p,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!i.ok){let e;try{e=await i.json()}catch(e){throw new oT("Failed to delete authenticator")}throw new oT(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){var t;let n,r="".concat(eo(u,this),"/mfa/challenge"),i=e.mfaToken,o=ed(e,oe),a={mfa_token:i,client_id:eo(h,this),challenge_type:o.challengeType};eo(d,this)&&(a.client_secret=eo(d,this)),o.authenticatorId&&(a.authenticator_id=o.authenticatorId);let s=await eo(p,this).call(this,r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!s.ok){let e;try{e=await s.json()}catch(e){throw new oP("Failed to challenge authenticator")}throw new oP(e.error_description||"Failed to challenge authenticator",e)}return n={challengeType:(t=await s.json()).challenge_type},void 0!==t.oob_code&&(n.oobCode=t.oob_code),void 0!==t.binding_method&&(n.bindingMethod=t.binding_method),n}async verify(e){if(!eo(f,this))throw Error("MFA verify requires a configuration provider (getConfiguration was not set)");let t=await eo(f,this).call(this),n={mfa_token:e.mfaToken};e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode);try{let r=await iy(t,oI[e.factorType],n),i=oC.fromTokenEndpointResponse(r);return r.recovery_code&&(i.recoveryCode=r.recovery_code),i}catch(e){var r,i,o;if(e instanceof oE)throw e;throw new oE(e.error_description||e.message||"Failed to verify MFA challenge",{error:null!=(r=e.error)?r:"mfa_verify_error",error_description:null!=(i=null!=(o=e.error_description)?o:e.message)?i:"Failed to verify MFA challenge"})}}}
1),ox=class extends Error{constructor(e,t,n){super(t),el(this,"cause",void 0),el(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},oO=class extends ox{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},oW=class extends ox{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},oj=class extends ox{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}},oU="urn:okta:params:oauth:grant-type:webauthn",oK=(m=new WeakMap,y=new WeakMap,g=new WeakMap,w=new WeakMap,b=new WeakSet,class{constructor(e){var t;ec(this,b),ea(this,m,void 0),ea(this,y,void 0),ea(this,g,void 0),ea(this,w,void 0),es(m,this,"https://".concat(e.domain)),es(y,this,e.clientId),es(g,this,null!=(t=e.customFetch)?t:function(){return fetch(...arguments)}),es(w,this,e.grantRequest)}async register(e){let t="".concat(eo(m,this),"/passkey/register"),n=eh(eh(eh(eh(eh(eh(eh(eh({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),r={client_id:eo(y,this),user_profile:n};e.realm&&(r.realm=e.realm),e.organization&&(r.organization=e.organization),e.userMetadata&&(r.user_metadata=e.userMetadata);let i=await eo(g,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok){let e=await er(b,this,oL).call(this,i);throw new oO(e.error_description||"Failed to request signup challenge",e)}let o=await i.json();return{authSession:o.auth_session,authnParamsPublicKey:eh({},o.authn_params_public_key)}}async challenge(e){let t="".concat(eo(m,this),"/passkey/challenge"),n={client_id:eo(y,this)};null!=e&&e.realm&&(n.realm=e.realm),null!=e&&e.organization&&(n.organization=e.organization);let r=await eo(g,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){let e=await er(b,this,oL).call(this,r);throw new oW(e.error_description||"Failed to request login challenge",e)}let i=await r.json();return{authSession:i.auth_session,authnParamsPublicKey:eh({},i.authn_params_public_key)}}async getTokenByPasskey(e){let t;void 0!==e.organization&&ob(e.organization);let n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audience),e.organization&&n.append("organization",e.organization);try{t=await eo(w,this).call(this,oU,n)}catch(t){let e=ot(t);throw new oj(e.error_description||"Failed to exchange passkey credential for tokens.",e)}return e.organization&&ov(t.claims,e.organization),t}});async function oL(e){try{return await e.json()}catch(t){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText)}}}var oN=class extends Error{constructor(e,t,n){super(t),el(this,"cause",void 0),el(this,"code",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}}},oM=class extends oN{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},oD=class extends oN{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},oz=class extends oN{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},oJ=class extends oN{constructor(e,t,n,r){super("passwordless_challenge_error",e,n),el(this,"statusCode",void 0),el(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=r}};function oH(e){return/^\+[1-9]\d{1,14}$/.test(e)}
1async function oZ(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;let i=null!=(r=e.clientAssertionSigningAlg)?r:"RS256",o=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await rX(e.clientAssertionSigningKey,i);return{client_assertion:await new iU({}).setProtectedHeader({alg:i}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(o),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new oy}var oF=(v=new WeakMap,k=new WeakMap,_=new WeakMap,S=new WeakMap,T=new WeakMap,P=new WeakMap,E=new WeakSet,class{constructor(e){var t;ec(this,E),ea(this,v,void 0),ea(this,k,void 0),ea(this,_,void 0),ea(this,S,void 0),ea(this,T,void 0),ea(this,P,void 0),es(k,this,e.domain),es(v,this,"https://".concat(e.domain)),es(_,this,e.clientId),es(S,this,null!=(t=e.customFetch)?t:function(){return fetch(...arguments)}),es(T,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),es(P,this,e.grantRequest)}async sendEmail(e){var t;let n,r;await er(E,this,oV).call(this,(n=null!=(t=e.send)?t:"code",r={email:e.email,connection:"email",send:n},"link"===n&&e.authParams&&(r.authParams=e.authParams),r),"Failed to send passwordless email",e.language)}async sendSms(e){if(!oH(e.phoneNumber))throw new oM("Phone number must be in E.164 format (e.g. +14155550100).");await er(E,this,oV).call(this,{phone_number:e.phoneNumber,connection:"sms"},"Failed to send passwordless SMS",e.language)}async challengeWithEmail(e){var t;let n={email:e.email,connection:e.connection,allow_signup:null!=(t=e.allowSignup)&&t};return er(E,this,oG).call(this,n,"Failed to request email OTP challenge")}async challengeWithPhoneNumber(e){var t;let n;if(!oH(e.phoneNumber))throw new oJ("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);let r=(n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!=(t=e.allowSignup)&&t},e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n);return er(E,this,oG).call(this,r,"Failed to request phone OTP challenge")}async getTokenByPasswordlessDbConnection(e){let t=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&t.append("scope",e.scope),e.audience&&t.append("audience",e.audience),!eo(P,this))throw new oz("Missing grant request delegate.",ot(Error("missing grantRequest")));try{return await eo(P,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",t)}catch(e){throw new oz("There was an error while trying to request a token.",ot(e))}}});async function oV(e,t,n){var r;let i,o,a=await oZ(eo(T,this),eo(_,this),eo(k,this)),s=eh(eh({client_id:eo(_,this)},e),a);try{i=await eo(S,this).call(this,"".concat(eo(v,this),"/passwordless/start"),{method:"POST",headers:eh({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(s)})}catch(e){throw new oM("".concat(t,": a network error occurred."))}if(!i.ok){if(204!==i.status)try{o=await i.json()}catch(e){o=void 0}throw new oM((null==(r=o)?void 0:r.error_description)||t,o)}}async function oG(e,t){var n,r;let i,o,a=await oZ(eo(T,this),eo(_,this),eo(k,this)),s=eh(eh({client_id:eo(_,this)},e),a);try{i=await eo(S,this).call(this,"".concat(eo(v,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})}catch(e){throw new oJ("challenge error: a network error occurred.",0,void 0,void 0)}if(i.ok){let e;try{e=await i.json()}catch(e){throw new oJ("".concat(t,": could not parse the response body."),i.status,void 0,void 0)}return{authSession:e.auth_session}}try{o=await i.json()}catch(e){o=void 0}throw new oJ((null==(n=o)?void 0:n.error_description)||t,i.status,o,null==(r=o)?void 0:r.validation_errors)}var oX=class extends Error{constructor(e,t,n){super(t),el(this,"cause",void 0),el(this,"code",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},oY=class extends oX{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},oB=class extends oX{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function oq(e,t,n){for(let r of t)if(null===e[r]||void 0===e[r]||""===e[r])throw new n('Required parameter "'.concat(String(r),'" was null, undefined, or empty.'))}var oQ=(A=new WeakMap,C=new WeakMap,I=new WeakMap,R=new WeakSet,class{constructor(e){var t;ec(this,R),ea(this,A,void 0),ea(this,C,void 0),ea(this,I,void 0),es(A,this,"https://".concat(e.domain)),es(C,this,e.clientId),es(I,this,null!=(t=e.customFetch)?t:function(){return fetch(...arguments)})}async signUp(e){var t,n,r,i;let o;oq(e,["email","password","connection"],oY);let a=eh({client_id:null!=(t=e.clientId)?t:eo(C,this)},(o={email:e.email,password:e.password,connection:e.connection},void 0!==e.username&&(o.username=e.username),void 0!==e.givenName&&(o.given_name=e.givenName),void 0!==e.familyName&&(o.family_name=e.familyName),void 0!==e.name&&(o.name=e.name),void 0!==e.nickname&&(o.nickname=e.nickname),void 0!==e.picture&&(o.picture=e.picture),void 0!==e.userMetadata&&(o.user_metadata=e.userMetadata),o)),s=await er(R,this,o$).call(this,"/dbconnections/signup",a,oY,"Failed to sign up");
1return{id:null!=(r=null!=(i=(n=await s.json())._id)?i:n.user_id)?r:n.id,email:"string"==typeof n.email?n.email:"",emailVerified:!!n.email_verified,username:n.username,givenName:n.given_name,familyName:n.family_name,name:n.name,nickname:n.nickname,picture:n.picture,userMetadata:n.user_metadata}}async changePassword(e){var t;let n;if(oq(e,["connection"],oB),!e.email&&!e.username)throw new oB('Either "email" or "username" is required.');let r=eh({client_id:null!=(t=e.clientId)?t:eo(C,this)},(n={connection:e.connection},void 0!==e.email&&(n.email=e.email),void 0!==e.username&&(n.username=e.username),void 0!==e.organization&&(n.organization=e.organization),n));return(await er(R,this,o$).call(this,"/dbconnections/change_password",r,oB,"Failed to request a password change")).text()}});async function o$(e,t,n,r){let i;try{i=await eo(I,this).call(this,"".concat(eo(A,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(r,": a network error occurred."))}if(i.ok)return i;let o=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(i);throw new n((null==o?void 0:o.error_description)||r,o)}var o0=(x=new WeakMap,O=new WeakMap,W=new WeakMap,class{constructor(e,t){ea(this,x,new Map),ea(this,O,void 0),ea(this,W,void 0),es(W,this,Math.max(1,Math.floor(e))),es(O,this,Math.max(0,Math.floor(t)))}get(e){let t=eo(x,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return eo(x,this).delete(e),eo(x,this).set(e,t),t.value;eo(x,this).delete(e)}}set(e,t){for(eo(x,this).has(e)&&eo(x,this).delete(e),eo(x,this).set(e,{value:t,expiresAt:Date.now()+eo(O,this)});eo(x,this).size>eo(W,this);){let e=eo(x,this).keys().next().value;if(void 0===e)break;eo(x,this).delete(e)}}}),o2=new Map;function o1(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 o5=class{static createDiscoveryCache(e){var t,n;let r=(t=e.maxEntries,n=e.ttlMs,"".concat(t,":").concat(n)),i=o2.get(r);return i||(i=new o0(e.maxEntries,e.ttlMs),o2.set(r,i)),i}static createJwksCache(){return{}}},o3="openid profile email offline_access",o9=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 o4(e){if(null==e)throw new ol("subject_token is required");if("string"!=typeof e)throw new ol("subject_token must be a string");if(0===e.trim().length)throw new ol("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ol("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ol("subject_token must not include the 'Bearer ' prefix")}function o6(e,t){if(t)for(let r of Object.entries(t)){var n=ep(r,2);let t=n[0],i=n[1];if(!o9.has(t))if(Array.isArray(i)){if(i.length>20)throw new ol("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));i.forEach(n=>{e.append(t,n)})}else e.append(t,i)}}var o8="urn:ietf:params:oauth:token-type:access_token",o7=(j=new WeakMap,U=new WeakMap,K=new WeakMap,L=new WeakMap,N=new WeakMap,M=new WeakMap,D=new WeakMap,z=new WeakMap,J=new WeakMap,H=new WeakSet,class{constructor(e){var t,n,r,i;if(ec(this,H),ea(this,j,void 0),ea(this,U,void 0),ea(this,K,void 0),ea(this,L,void 0),ea(this,N,void 0),ea(this,M,void 0),ea(this,D,void 0),ea(this,z,void 0),ea(this,J,void 0),el(this,"mfa",void 0),el(this,"passkey",void 0),el(this,"passwordless",void 0),el(this,"database",void 0),es(L,this,e),e.useMtls&&!e.customFetch)throw new on("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");es(N,this,function(e,t){if(!1===t.enabled)return e;let n=btoa(JSON.stringify({name:t.name,version:t.version}));return async(t,r)=>{let i=t instanceof Request?new Headers(t.headers):new Headers;
1return null!=r&&r.headers&&new Headers(r.headers).forEach((e,t)=>{i.set(t,e)}),i.set("Auth0-Client",n),e(t,eh(eh({},r),{},{headers:i}))}}(null!=(t=e.customFetch)?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!=(r=null==n?void 0:n.name)?r:"@auth0/auth0-auth-js",version:null!=(i=null==n?void 0:n.version)?i:"1.12.0"}));const o=o1(e.discoveryCache);es(D,this,o5.createDiscoveryCache(o)),es(z,this,new Map),es(J,this,o5.createJwksCache()),this.mfa=new oR({domain:eo(L,this).domain,clientId:eo(L,this).clientId,clientSecret:eo(L,this).clientSecret,customFetch:eo(N,this),getConfiguration:async()=>(await er(H,this,an).call(this)).configuration}),this.passkey=new oK({domain:eo(L,this).domain,clientId:eo(L,this).clientId,customFetch:eo(N,this),grantRequest:async(e,t)=>{var n;let r=(await er(H,this,an).call(this)).serverMetadata,i=await er(H,this,at).call(this,r);i[tq]=(n=eo(N,this),(t,r)=>{let i=null==r?void 0:r.body;if(e!==oU||!(i instanceof URLSearchParams))return n(t,r);let o={};for(let e of i){var a=ep(e,2);let t=a[0],n=a[1];o[t]="authn_response"===t?JSON.parse(n):n}let s=new Headers(null==r?void 0:r.headers);return s.set("Content-Type","application/json"),n(t,eh(eh({},r),{},{headers:s,body:JSON.stringify(o)}))});let o=await iy(i,e,t);return oC.fromTokenEndpointResponse(o)}}),this.passwordless=new oF({domain:eo(L,this).domain,clientId:eo(L,this).clientId,customFetch:eo(N,this),clientSecret:eo(L,this).clientSecret,clientAssertionSigningKey:eo(L,this).clientAssertionSigningKey,clientAssertionSigningAlg:eo(L,this).clientAssertionSigningAlg,useMtls:eo(L,this).useMtls,grantRequest:async(e,t)=>{let n=(await er(H,this,an).call(this)).configuration,r=await iy(n,e,t);return oC.fromTokenEndpointResponse(r)}}),this.database=new oQ({domain:eo(L,this).domain,clientId:eo(L,this).clientId,customFetch:eo(N,this)})}async getServerMetadata(){return(await er(H,this,an).call(this)).serverMetadata}async buildAuthorizationUrl(e){let t=(await er(H,this,an).call(this)).serverMetadata;if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new on("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 er(H,this,as).call(this,e)}catch(e){throw new op(e)}}async buildLinkUserUrl(e){try{let t=await er(H,this,as).call(this,{authorizationParams:eh(eh({},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 of(e)}}async buildUnlinkUserUrl(e){try{let t=await er(H,this,as).call(this,{authorizationParams:eh(eh({},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 om(e)}}async backchannelAuthentication(e){let t=await er(H,this,an).call(this),n=t.configuration,r=t.serverMetadata,i=ow(eh(eh({},eo(L,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(eh(eh({scope:o3},i),{},{client_id:eo(L,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{let e=await ir(n,o),t=await ii(n,e);return oC.fromTokenEndpointResponse(t)}catch(e){throw new od(e)}}async initiateBackchannelAuthentication(e){let t=await er(H,this,an).call(this),n=t.configuration,r=t.serverMetadata,i=ow(eh(eh({},eo(L,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(eh(eh({scope:o3},i),{},{client_id:eo(L,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:r.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetail
1s&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{let e=await ir(n,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new od(e)}}async backchannelAuthenticationGrant(e){let t=e.authReqId,n=(await er(H,this,an).call(this)).configuration,r=new URLSearchParams({auth_req_id:t});try{let e=await iy(n,"urn:openid:params:grant-type:ciba",r);return oC.fromTokenEndpointResponse(e)}catch(e){throw new od(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new oc("Either a refresh or access token should be specified, but not both.");let n=null!=(t=e.accessToken)?t:e.refreshToken;if(!n)throw new oc("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?o8:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ol)throw new oc(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?er(H,this,ar).call(this,e):er(H,this,ai).call(this,e)}async getTokenByCode(e,t){let n,r=(await er(H,this,an).call(this)).configuration;void 0!==t.organization&&ob(t.organization);try{let i=await ia(r,e,{pkceCodeVerifier:t.codeVerifier});n=oC.fromTokenEndpointResponse(i)}catch(e){throw new oi("There was an error while trying to request a token.",ot(e))}return t.organization&&ov(n.claims,t.organization),n}async getTokenByMagicLinkCode(e,t){let n=(await er(H,this,an).call(this)).configuration;try{let r=await ia(n,e,{expectedState:null==t?void 0:t.expectedState});return oC.fromTokenEndpointResponse(r)}catch(e){throw new oi(e instanceof Error&&e.message?e.message:"There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){let t=(await er(H,this,an).call(this)).configuration,n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{let r=await is(t,e.refreshToken,n);return oC.fromTokenEndpointResponse(r)}catch(e){throw new oa("The access token has expired and there was an error while trying to refresh it.",ot(e))}}async revokeToken(e){let t=(await er(H,this,an).call(this)).configuration,n={};e.tokenTypeHint&&(n.token_type_hint=e.tokenTypeHint);try{await ig(t,e.token,n)}catch(e){throw new ou("An error occurred while trying to revoke the token.",ot(e))}}async getTokenByPassword(e){let t=(await er(H,this,an).call(this)).configuration,n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){let n=await er(H,this,aa).call(this);(r=new r8(t.serverMetadata(),eo(L,this).clientId,eo(L,this).clientSecret,n))[tq]=(t,n)=>eo(N,this).call(this,t,eh(eh({},n),{},{headers:eh(eh({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{let e=await iy(r,"password",n);return oC.fromTokenEndpointResponse(e)}catch(e){throw new os("There was an error while trying to request a token.",ot(e))}}async getTokenByPasswordlessEmail(e){let t=new URLSearchParams({username:e.email,otp:e.code,realm:"email"});return e.audience&&t.append("audience",e.audience),e.scope&&t.append("scope",e.scope),er(H,this,ao).call(this,t)}async getTokenByPasswordlessSms(e){if(!oH(e.phoneNumber))throw new oD("Phone number must be in E.164 format (e.g. +14155550100).");let t=new URLSearchParams({username:e.phoneNumber,otp:e.code,realm:"sms"});return e.audience&&t.append("audience",e.audience),e.scope&&t.append("scope",e.scope),er(H,this,ao).call(this,t)}async getTokenByClientCredentials(e){let t=(await er(H,this,an).call(this)).configuration;try{let n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);let r=await ic(t,n);return oC.fromTokenEndpointResponse(r)}catch(e){throw new oo("There was an error while trying to request a token.",ot(e))}}async buildLogoutUrl(e){let t=await er(H,this,an).call(this),n=t.configuration;if(!t.serverMetadata.end_session_endpoint){let t=new URL("https://".concat(eo(L,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",eo(L,this).clientId),t}return function(e,t){ih(e);let n=s.get(e),r=n.as,i=n.c,o=nm(r,"end_session_endpoint",!1,n.tlsOnly);for(let e of((t=new URLSearchParams(t)).has("client_id")||t.set("client_id",i.client_id),t.entries())){var a=ep(e,2);let t=a[0],n=a[1];o.searchParams.append(t,n)}return o}(n,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){let t,n,r=(await er(H,this,an).call(this)).serverMetadata,i=o1(eo(L,this).discoveryCache),o=r.jwks_uri;eo(M,this)||es(M,this,(t=new i8(new URL(o),{cacheMaxAge:i.ttlMs,[iB]:eo(N,this),[iq]:eo(J,this)}),Object.defineProperties(n=async(e,n)=>t.getKey(e,n),{coolingDown:{get:()=>t.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>t.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>t.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>
1t.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>t.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n));let a=(await iE(e.logoutToken,eo(M,this),{issuer:r.issuer,audience:eo(L,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]})).payload;if(!("sid"in a)&&!("sub"in a))throw new oh('either "sid" or "sub" (or both) claims must be present');if("sid"in a&&"string"!=typeof a.sid)throw new oh('"sid" claim must be a string');if("sub"in a&&"string"!=typeof a.sub)throw new oh('"sub" claim must be a string');if("nonce"in a)throw new oh('"nonce" claim is prohibited');if(!("events"in a))throw new oh('"events" claim is missing');if("object"!=typeof a.events||null===a.events)throw new oh('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in a.events))throw new oh('"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 oh('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:a.sid,sub:a.sub}}});function ae(){let e=eo(L,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(eo(L,this).useMtls?"1":"0")}async function at(e){let t=await er(H,this,aa).call(this),n=new r8(e,eo(L,this).clientId,eo(L,this).clientSecret,t);return n[tq]=eo(N,this),n}async function an(){if(eo(j,this)&&eo(U,this))return{configuration:eo(j,this),serverMetadata:eo(U,this)};let e=er(H,this,ae).call(this),t=eo(D,this).get(e);if(t)return es(U,this,t.serverMetadata),es(j,this,await er(H,this,at).call(this,t.serverMetadata)),{configuration:eo(j,this),serverMetadata:eo(U,this)};let n=eo(z,this).get(e);if(n){let e=await n;return es(U,this,e.serverMetadata),es(j,this,await er(H,this,at).call(this,e.serverMetadata)),{configuration:eo(j,this),serverMetadata:eo(U,this)}}let r=(async()=>{let t=await er(H,this,aa).call(this),n=await r4(new URL("https://".concat(eo(L,this).domain)),eo(L,this).clientId,{use_mtls_endpoint_aliases:eo(L,this).useMtls},t,{[tq]:eo(N,this)}),r=n.serverMetadata();return eo(D,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),i=r.then(e=>({serverMetadata:e.serverMetadata}));i.catch(()=>{}),eo(z,this).set(e,i);try{let e=await r,t=e.configuration,n=e.serverMetadata;es(j,this,t),es(U,this,n),eo(j,this)[tq]=eo(N,this)}finally{eo(z,this).delete(e)}return{configuration:eo(j,this),serverMetadata:eo(U,this)}}async function ar(e){var t,n;let r=(await er(H,this,an).call(this)).configuration;if("audience"in e||"resource"in e)throw new ol("audience and resource parameters are not supported for Token Vault exchanges");o4(e.subjectToken);let i=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!=(t=e.subjectTokenType)?t:o8,requested_token_type:null!=(n=e.requestedTokenType)?n:"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),o6(i,e.extra);try{let e=await iy(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",i);return oC.fromTokenEndpointResponse(e)}catch(t){throw new ol("Failed to exchange token for connection '".concat(e.connection,"'."),ot(t))}}async function ai(e){var t;let n,r,i=(await er(H,this,an).call(this)).configuration;if(o4(e.subjectToken),void 0!==e.organization&&ob(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new ol("actorTokenType is required when actorToken is provided");let 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),e.actorToken&&o.append("actor_token",e.actorToken),e.actorTokenType&&o.append("actor_token_type",e.actorTokenType),o6(o,e.extra);try{r=await iy(i,"urn:ietf:params:oauth:grant-type:token-exchange",o),n=oC.fromTokenEndpointResponse(r)}catch(t){throw new ol("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),ot(t))}if(e.organization&&ov(n.claims,e.organization),e.actorToken)if(null!=(t=n.claims)&&t.act)n.act=n.claims.act;else try{n.act=function(e){let t,n;if("string"!=typeof e)throw new rk("JWTs must use Compact JWS serialization, JWT must be a string");let r=e.split("."),i=r[1],o=r.length;if(5===o)throw new rk("Only JWTs using Compact JWS serialization can be decoded");
1if(3!==o)throw new rk("Invalid JWT");if(!i)throw new rk("JWTs must contain a payload");try{t=rl(i)}catch(e){throw new rk("Failed to base64url decode the payload")}try{n=JSON.parse(ro.decode(t))}catch(e){throw new rk("Failed to parse the decoded payload as JSON")}if(!rO(n))throw new rk("Invalid JWT Claims Set");return n}(r.access_token).act}catch(e){}return n}async function ao(e){let t=(await er(H,this,an).call(this)).configuration;try{let n=await iy(t,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return oC.fromTokenEndpointResponse(n)}catch(e){throw new oD("There was an error while trying to request a token.",ot(e))}}async function aa(){return eo(K,this)||es(K,this,(async()=>{var e,t;let n,r,i;if(!eo(L,this).clientSecret&&!eo(L,this).clientAssertionSigningKey&&!eo(L,this).useMtls)throw new oy;if(eo(L,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let o=eo(L,this).clientAssertionSigningKey;return!o||o instanceof CryptoKey||(o=await rX(o,eo(L,this).clientAssertionSigningAlg||"RS256")),o?(t=void 0,r=(n=(e=o)instanceof CryptoKey?{key:e}:(null==e?void 0:e.key)instanceof CryptoKey?(void 0!==e.kid&&nr(e.kid,'"kid"'),{key:e.key,kid:e.kid}):{}).key,i=n.kid,function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw tG("".concat(t," must be a CryptoKey"),tV)}(e,t),"private"!==e.type)throw tG("".concat(t," must be a private CryptoKey"),tF)}(r,'"clientPrivateKey.key"'),async(e,n,o,a)=>{var s;let c,l={alg:function(e){switch(e.algorithm.name){case"RSA-PSS":switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new t3("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new t3("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}case"ECDSA":switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new t3("unsupported EcKeyAlgorithm namedCurve",{cause: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 t3("unsupported CryptoKey algorithm name",{cause:e})}}(r),kid:i},u=(c=nc()+na(n),{jti:no(),aud:e.issuer,exp:c+60,iat:c,nbf:c,iss:n.client_id,sub:n.client_id});null==t||null==(s=t[tQ])||s.call(t,l,u),o.set("client_id",n.client_id),o.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),o.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw tG('CryptoKey instances used for signing assertions must include "sign" in their "usages"',tF);let r="".concat(t5(t1(JSON.stringify(e))),".").concat(t5(t1(JSON.stringify(t)))),i=t5(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:function(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new t3("unsupported ECDSA namedCurve",{cause:e})}}(e)};case"RSA-PSS":switch(n9(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 t3("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return n9(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new t3("unsupported CryptoKey algorithm name",{cause:e})}(n),n,t1(r)));return"".concat(r,".").concat(i)}(l,u,r))}):r$(eo(L,this).clientSecret)})().catch(e=>{throw es(K,this,void 0),e})),eo(K,this)}async function as(e){let t=(await er(H,this,an).call(this)).configuration,n=no(),r=await async function(e){return nr(e,"codeVerifier"),t5(await crypto.subtle.digest("SHA-256",t1(e)))}(n),i=ow(eh(eh({},eo(L,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(eh(eh({scope:o3},i),{},{client_id:eo(L,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await iu(t,o):await il(t,o),codeVerifier:n}}class ac extends ek{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ac.prototype)}static fromPayload(e){return new ac(e.error,e.error_description)}}class al extends ac{constructor(e,t){super(e,t),Object.setPrototypeOf(this,al.prototype)}}class au extends ac{constructor(e,t){super(e,t),Object.setPrototypeOf(this,au.prototype)}}class ah extends ac{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ah.prototype)}}class ad extends ac{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ad.prototype)}}class ap extends ac{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ap.prototype)}}class af{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){let 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(){let e=Date.now();for(let n of this.contexts){var t=ep(n,2);let r=t[0];e-t[1].createdAt>this.ttlMs&&this.contexts.delete(r)}}get size(){return this.contexts.size}}class am{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new af}
1setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n,r;let i=this.contextManager.get(e);if(!i)throw new al("invalid_request","MFA context not found for this MFA token");let o=null==(n=null==(t=i.mfaRequirements)?void 0:t.challenge)?void 0:n.map(e=>e.type);try{let t=await this.authJsMfaClient.listAuthenticators({mfaToken:e});return o&&0!==o.length?t.filter(e=>!!e.type&&o.includes(e.type)):t}catch(e){if(e instanceof o_)throw new al(null==(r=e.cause)?void 0:r.error,e.message);throw e}}async enroll(e){var t;let n,r=(n=tH[e.factorType],Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:n.authenticatorTypes},n.oobChannels&&{oobChannels:n.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email}));try{return await this.authJsMfaClient.enrollAuthenticator(r)}catch(e){if(e instanceof oS)throw new au(null==(t=e.cause)?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{let t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof oP)throw new ah(null==(t=e.cause)?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){let t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new ap("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){let t=this.contextManager.get(e.mfaToken);if(!t)throw new ad("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");let n="otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-rec
1overy-code":void 0;if(!n)throw new ad("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");let r=t.scope,i=t.audience;try{let t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:i,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 ad)throw new ad(e.error,e.error_description);throw e}}}class ay extends Error{constructor(e,t,n){super(t),this.name="PasskeyError",this.code=e,this.cause=n,Object.setPrototypeOf(this,ay.prototype)}}class ag{constructor(e,t){Z.set(this,void 0),F.set(this,void 0),ee(this,Z,e,"f"),ee(this,F,t,"f")}async signup(e){if(!window.PublicKeyCredential)throw new ay("passkey_not_supported","WebAuthn is not supported in this browser.");let t=e.scope,n=e.audience,r=Q(e,["scope","audience"]),i=await $(this,Z,"f").register(r),o=av(i.authnParamsPublicKey),a=await navigator.credentials.create({publicKey:o});if(!a)throw new ay("passkey_cancelled","Passkey creation was cancelled or no credential was returned.");let s=a_(a);return $(this,F,"f")._requestTokenForPasskey({authSession:i.authSession,credential:s,realm:r.realm,organization:r.organization,scope:t,audience:n})}async login(e){if(!window.PublicKeyCredential)throw new ay("passkey_not_supported","WebAuthn is not supported in this browser.");let t=e||{},n=t.scope,r=t.audience,i=Q(t,["scope","audience"]),o=await $(this,Z,"f").challenge(Object.keys(i).length>0?i:void 0),a=ak(o.authnParamsPublicKey),s=await navigator.credentials.get({publicKey:a});if(!s)throw new ay("passkey_cancelled","Passkey authentication was cancelled or no credential was returned.");let c=aS(s);return $(this,F,"f")._requestTokenForPasskey({authSession:o.authSession,credential:c,realm:i.realm,organization:i.organization,scope:n,audience:r})}async getSignupChallenge(e){if(!window.PublicKeyCredential)throw new ay("passkey_not_supported","WebAuthn is not supported in this browser.");let t=await $(this,Z,"f").register(e);return{authSession:t.authSession,publicKey:av(t.authnParamsPublicKey)}}async getLoginChallenge(e){if(!window.PublicKeyCredential)throw new ay("passkey_not_supported","WebAuthn is not supported in this browser.");let t=await $(this,Z,"f").challenge(e);return{authSession:t.authSession,publicKey:ak(t.authnParamsPublicKey)}}async getTokenWithPasskey(e){let t;if(!window.PublicKeyCredential)throw new ay("passkey_not_supported","WebAuthn is not supported in this browser.");let n=e.authSession,r=e.credential,i=e.realm,o=e.organization,a=e.scope,s=e.audience,c=r.response;if(c instanceof AuthenticatorAttestationResponse)t=a_(r);else{if(!(c instanceof AuthenticatorAssertionResponse))throw new ay("passkey_invalid_credential","The provided credential is not a valid attestation or assertion response.");t=aS(r)}return $(this,F,"f")._requestTokenForPasskey({authSession:n,credential:t,realm:i,organization:o,scope:a,audience:s})}}function aw(e){return btoa(Array.from(new Uint8Array(e),e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ab(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=atob(t+"=".repeat((4-t.length%4)%4)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}function av(e){return Object.assign(Object.assign({},e),{challenge:ab(e.challenge),user:Object.assign(Object.assign({},e.user),{id:ab(e.user.id)}),pubKeyCredParams:e.pubKeyCredParams,authenticatorSelection:e.authenticatorSelection})}function ak(e){return Object.assign(Object.assign({},e),{challenge:ab(e.challenge)})}function a_(e){var t;let n=e.response;return{id:e.id,rawId:aw(e.rawId),type:e.type,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0,response:{clientDataJSON:aw(n.clientDataJSON),attestationObject:aw(n.attestationObject)},clientExtensionResults:e.getClientExtensionResults()}}function aS(e){var t;let n=e.response;return{id:e.id,rawId:aw(e.rawId),type:e.type,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0,response:{clientDataJSON:aw(n.clientDataJSON),authenticatorData:aw(n.authenticatorData),signature:aw(n.signature),userHandle:n.userHandle?aw(n.userHandle):void 0},clientExtensionResults:e.getClientExtensionResults()}}Z=new WeakMap,F=new WeakMap;class aT{resolveOnlineAccess(e){if("online"!==e.refreshTokenMode)return!1;if(!0!==e.useRefreshTokens)throw new e_('`refreshTokenMode: "online"` requires the refresh-token grant.',"Set `useRefreshTokens: true`.");if(!0!==e.useDpop)throw new e_('`refreshTokenMode: "online"` requires DPoP, which is missing or disabled.',"Set `useDpop: true` (DPoP is mandatory for online access).");return!0}constructor(e){var t,n;let r,i;if(this.userCache=(new ty).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0,refreshTokenMode:"offline"},this.onlineAccess=this.resolveOnlineAccess(e),this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"u">typeof window&&(()=>{if(!ej())throw Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===ej().subtle)throw 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=(e2||(e2=function(){var e;return"u">typeof navigator&&"function"==typeof(null==(e=navigator.locks)?void 0:e.request)?new e$:new e0}()),e2),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)i=e.cache;
1else{if(!tU(r=e.cacheLocation||ey))throw Error('Invalid cache location "'.concat(r,'"'));i=tU(r)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?tT:tE,this.orgHintCookieName=(t=this.options.clientId,"auth0.".concat(t,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:tA;let a="";this.onlineAccess?a=eg:this.options.useRefreshTokens&&(a="offline_access"),this.scope=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("object"!=typeof e)return{[ev]:tu(t,e,...r)};let o={[ev]:tu(t,...r)};return Object.keys(e).forEach(n=>{let i=e[n];o[n]=tu(t,i,...r)}),o}(this.options.authorizationParams.scope,"openid",a),this.transactionManager=new tw(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||eb,this.cacheManager=new tg(i,i.allKeys?void 0:new tO(i,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new tM(this.options.clientId):void 0,this.domainUrl=(n=this.options.domain,/^https?:\/\//.test(n)?n:"https://".concat(n)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const s="".concat(this.domainUrl,"/me/"),c=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null==(t=null==e?void 0:e.scope)?void 0:t.join(" "),audience:s},detailedResponse:!0})}}));this.myAccount=new tz(c,s),this.authJsClient=new o7({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new am(this.authJsClient.mfa,this),this.passkey=new ag(this.authJsClient.passkey,this),"u">typeof window&&window.Worker&&this.options.useRefreshTokens&&r===ey&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new tx,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){let t=encodeURIComponent(btoa(JSON.stringify(eL(this.options.auth0Client||ew,!0))));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(t)}_authorizeUrl(e){return this._url("/authorize?".concat(eN(e)))}async _verifyIdToken(e,t,n){var r;let i=await this.nowProvider();return(e=>{if(!e.id_token)throw Error("ID token is required but missing");let t=(e=>{let t=e.split("."),n=ep(t,3),r=n[0],i=n[1],o=n[2];if(3!==t.length||!r||!i||!o)throw Error("ID token could not be decoded");let a=JSON.parse(eD(i)),s={__raw:e},c={};return Object.keys(a).forEach(e=>{s[e]=a[e],tb.includes(e)||(c[e]=a[e])}),{encoded:{header:r,payload:i,signature:o},header:JSON.parse(eD(r)),claims:s,user:c}})(e.id_token);if(!t.claims.iss)throw Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw Error('Issuer (iss) claim mismatch in the ID token; expected "'.concat(e.iss,'", found "').concat(t.claims.iss,'"'));if(!t.user.sub)throw Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw 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 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 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 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 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 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 Error("Nonce (nonce) claim must be a string present in the ID token");
1if(t.claims.nonce!==e.nonce)throw Error('Nonce (nonce) claim mismatch in the ID token; expected "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&"number"!=typeof t.claims.auth_time)throw 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||"number"!=typeof t.claims.exp)throw Error("Expiration Time (exp) claim must be a number present in the ID token");if("number"!=typeof t.claims.iat)throw Error("Issued At (iat) claim must be a number present in the ID token");let n=e.leeway||60,r=new Date(e.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(t.claims.exp+n),r>i)throw Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(i,")"));if(null!=t.claims.nbf&&"number"==typeof t.claims.nbf){let e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),r<e)throw Error("Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (".concat(r,") is before ").concat(e))}if(null!=t.claims.auth_time&&"number"==typeof t.claims.auth_time){let i=new Date(0);if(i.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),r>i)throw Error("Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (".concat(r,") is after last auth at ").concat(i))}if(e.organization){let n=e.organization.trim();if(n.startsWith("org_")){if(!t.claims.org_id)throw Error("Organization ID (org_id) claim must be a string present in the ID token");if(n!==t.claims.org_id)throw Error('Organization ID (org_id) claim mismatch in the ID token; expected "'.concat(n,'", found "').concat(t.claims.org_id,'"'))}else{let e=n.toLowerCase();if(!t.claims.org_name)throw Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw Error('Organization Name (org_name) claim mismatch in the ID token; expected "'.concat(e,'", found "').concat(t.claims.org_name,'"'))}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:"string"!=typeof(r=this.options.authorizationParams.max_age)?r:parseInt(r,10)||void 0,now:i})}_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{let t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){let t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;let n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;let i,o,a,s,c=btoa(eU()),l=btoa(eU()),u=eU(),h=ez(await eM(u)),d=await (null==(r=this.dpop)?void 0:r.calculateThumbprint()),p=(i=this.options,o=this.scope,a=e.redirect_uri||this.options.authorizationParams.redirect_uri||n,s=null==t?void 0:t.response_mode,Object.assign(Object.assign(Object.assign({client_id:i.clientId}
1,i.authorizationParams),e),{scope:th(o,e.scope,e.audience),response_type:"code",response_mode:s||"query",state:c,nonce:l,redirect_uri:a||i.authorizationParams.redirect_uri,code_challenge:h,code_challenge_method:"S256",dpop_jkt:d})),f=this._authorizeUrl(p);return{nonce:l,code_verifier:u,scope:p.scope,audience:p.audience||ev,redirect_uri:p.redirect_uri,state:c,url:f}}async loginWithPopup(e,t){var n;let r,i,o,a;if(e=e||{},!(t=t||{}).popup&&(t.popup=(r=window.screenX+(window.innerWidth-400)/2,i=window.screenY+(window.innerHeight-600)/2,window.open("","auth0:authorize:popup","left=".concat(r,",top=").concat(i,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))),!t.popup))throw new eC;let s=this._applySessionTransferToken(e.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s,{response_mode:"web_message"},window.location.origin);t.popup.location.href=c.url;let l=await (o=Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),a=new URL(c.url).origin,new Promise((e,t)=>{let n,r=setInterval(()=>{o.popup&&o.popup.closed&&(clearInterval(r),clearTimeout(i),window.removeEventListener("message",n,!1),t(new eA(o.popup)))},1e3),i=setTimeout(()=>{clearInterval(r),t(new eE(o.popup)),window.removeEventListener("message",n,!1)},1e3*(o.timeoutInSeconds||60));n=function(s){if(s.origin===a&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(i),clearInterval(r),window.removeEventListener("message",n,!1),!1!==o.closePopup&&o.popup.close(),s.data.response.error)return t(ek.fromPayload(s.data.response));e(s.data.response)}},window.addEventListener("message",n)}));if(c.state!==l.state)throw new ek("state_mismatch","Invalid state");let u=(null==(n=e.authorizationParams)?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:c.audience,scope:c.scope,code_verifier:c.code_verifier,grant_type:"authorization_code",code:l.code,redirect_uri:c.redirect_uri},{nonceIn:c.nonce,organization:u})}async getUser(){var e;if(await this._isSessionCeilingReached())return;let t=await this._getIdTokenFromCache();return null==(e=null==t?void 0:t.decodedToken)?void 0:e.user}async getIdTokenClaims(){var e;if(await this._isSessionCeilingReached())return;let t=await this._getIdTokenFromCache();return null==(e=null==t?void 0:t.decodedToken)?void 0:e.claims}async loginWithRedirect(){var e;let t=tK(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
1),n=t.openUrl,r=t.fragment,i=t.appState,o=Q(t,["openUrl","fragment","appState"]),a=(null==(e=o.authorizationParams)?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(o.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),l=c.url,u=Q(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:i,response_type:tI.Code}),a&&{organization:a}));let h=r?"".concat(l,"#").concat(r):l;n?await n(h):window.location.assign(h)}async handleRedirectCallback(){var e;let t,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===n.length)throw Error("There are no query params available for parsing.");let r=this.transactionManager.get();if(!r)throw new ek("missing_transaction","Invalid state");this.transactionManager.remove();let i=((e=n.join("")).indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#"))),{state:(t=new URLSearchParams(e)).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});return r.response_type===tI.ConnectCode?this._handleConnectAccountRedirectCallback(i,r):this._handleLoginRedirectCallback(i,r)}async _handleLoginRedirectCallback(e,t){let n=e.code,r=e.state,i=e.error,o=e.error_description;if(i)throw new eS(i,o||i,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new ek("state_mismatch","Invalid state");let a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:tI.Code}}async _handleConnectAccountRedirectCallback(e,t){let n=e.connect_code,r=e.state,i=e.error,o=e.error_description;if(i)throw new eT(i,o||i,t.connection,r,t.appState);if(!n)throw new ek("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new ek("state_mismatch","Invalid state");return Object.assign(Object.assign({},await this.myAccount.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier})),{appState:t.appState,response_type:tI.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(tW))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(tW)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){var e,t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=Object.assign(Object.assign({cacheMode:"on"},n),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),n.authorizationParams),{scope:th(this.scope,null==(e=n.authorizationParams)?void 0:e.scope,(null==(t=n.authorizationParams)?void 0:t.audience)||this.options.authorizationParams.audience)})}),i=await this._getTokenSilently(r);return n.detailedResponse?i:null==i?void 0:i.access_token}async _getTokenSilently(e){var t,n;let r=e.cacheMode,i=Q(e,["cacheMode"]);if(await this._isSessionCeilingReached())return;if("off"!==r){let e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||ev,clientId:this.options.clientId,cacheMode:r});if(e)return e}if("cache-only"===r)return;let o=(t=this.options.clientId,n=i.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(t,".").concat(n));try{return await this.lockManager.runWithLock(o,5e3,async()=>{if("off"!==r){let e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||ev,clientId:this.options.clientId});if(e)return e}let e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(i):await this._getTokenFromIFrame(i),t=e.id_token,n=e.token_type,o=e.access_token,a=e.oauthTokenScope,s=e.expires_in;return Object.assign(Object.assign({id_token:t,token_type:n,access_token:o},a?{scope:a}:null),{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(i);throw e}}_isInteractiveError(e){return e instanceof eI||e instanceof ek&&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});let t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||ev,clientId:this.options.clientId});if(!t)throw new ek("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]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Object.assign(Object.assign({},n),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),n.authorizationParams),{scope:th(this.scope,null==(e=n.authorizationParams)?void 0:e.scope,(null==(t=n.authorizationParams)?void 0:t.audience)||this.options.authorizationParams.audience)})});return r=Object.assign(Object.assign({},em),r),await this.loginWithPopup(i,r),(await this.cacheManager.get(new tf({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||ev,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;let t=e.logoutParams||{},n=t.federated,r=Q(t,["federated"]);return this._url("/v2/logout?".concat(eN(Object.assign({clientId:e.clientId},r))))+(n?"&federated":"")}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;let t=e.audience||this.options.authorizationParams.audience||ev,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let n=e.baseUrl,r=e.timeout,i=e.auth0Client,o=e.useFormData,a=e.refreshTokens,s=e.audience,c=e.client_id,l=e.onRefreshTokenRevoked,u=r||1e4,h="refresh_token",d="".concat(n,"/oauth/revoke"),p={"Content-Type":o?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(eL(i||ew)))};if(t){let e={client_id:c,token_type_hint:h},n=o?eN(e):JSON.stringify(e);try{return await to({type:"revoke",timeout:u,fetchUrl:d,fetchOptions:{method:"POST",body:n,headers:p},useFormData:o,auth:{audience:null!=s?s:ev}},t)}catch(e){throw new ek("revoke_error",e.message)}}for(let e of a){let t={client_id:c,token_type_hint:h,token:e},n=o?eN(t):JSON.stringify(t),r=await ta(d,{method:"POST",body:n,headers:p},u);if(!r.ok){let e,t;try{var f=JSON.parse(await r.text());e=f.error,t=f.error_description}catch(e){}throw new ek(e||"revoke_error",t||"HTTP error ".concat(r.status))}await (null==l?void 0:l(e))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker),this.onlineAccess&&await this._clearLocalSession()}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=tK(e),n=t.openUrl,r=Q(t,["openUrl"]);await this._clearLocalSession(e.clientId);let i=this._buildLogoutUrl(r);n?await n(i):!1!==n&&window.location.assign(i)}async _getTokenFromIFrame(e){var t;let n=(t=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(t));try{return await this.lockManager.runWithLock(n,5e3,async()=>{let t,n=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),r=this.cookieStorage.get(this.orgHintCookieName);r&&!n.organization&&(n.organization=r);let i=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin),o=i.url,a=i.state,s=i.nonce,c=i.code_verifier,l=i.redirect_uri,u=i.scope,h=i.audience;if(window.crossOriginIsolated)throw new ek("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");let d=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;try{t=new URL(this.domainUrl).origin}catch(e){t=this.domainUrl}let p=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,i)=>{let o,a=window.document.createElement("iframe");a.setAttribute("width","0"),a.setAttribute("height","0"),a.style.display="none";let s=()=>{window.document.body.contains(a)&&(window.document.body.removeChild(a),window.removeEventListener("message",o,!1))},c=setTimeout(()=>{i(new eP),s()},1e3*n);o=function(e){if(e.origin!=t||!e.data||"authorization_response"!==e.data.type)return;let n=e.source;n&&n.close(),e.data.response.error?i(ek.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",o,!1),setTimeout(s,2e3)},window.addEventListener("message",o,!1),window.document.body.appendChild(a),a.setAttribute("src",e)})}(o,t,d);if(a!==p.state)throw new ek("state_mismatch","Invalid state");let f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:c,code:p.code,grant_type:"authorization_code",redirect_uri:l,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:s,organization:n.organization});return Object.assign(Object.assign({},f),{scope:u,oauthTokenScope:f.scope,audience:h})})}catch(e){throw"login_required"===e.error&&(e instanceof ek&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n,r,i,o,a;let s=await this.cacheManager.get(new tf({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||ev,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(s&&s.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new eR(e.authorizationParams.audience||ev,e.authorizationParams.scope)}let c=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,l="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,u=((e,t,n,r)=>{var i;
1if(e&&n&&r){if(t.audience!==n)return t.scope;let e=r.split(" "),o=(null==(i=t.scope)?void 0:i.split(" "))||[],a=o.every(t=>e.includes(t));return e.length>=o.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==s?void 0:s.audience,null==s?void 0:s.scope);try{let h,d=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:s&&s.refresh_token,redirect_uri:c}),l&&{timeout:l}),{scopesToRequest:u});if(!this.onlineAccess&&d.refresh_token&&(null==s?void 0:s.refresh_token)&&await this.cacheManager.updateEntry(s.refresh_token,d.refresh_token,this.options.clientId,this.options.useMrrt),this.options.useMrrt&&(t=null==s?void 0:s.audience,n=null==s?void 0:s.scope,r=e.authorizationParams.audience,i=e.authorizationParams.scope,t!==r||(h=(null==n?void 0:n.split(" "))||[],!((null==i?void 0:i.split(" "))||[]).every(e=>h.includes(e))))){let t,n,r,i=(o=d.scope,a=this.onlineAccess,t=(null==u?void 0:u.split(" "))||[],n=a?t.filter(e=>e!==eg):t,r=(null==o?void 0:o.split(" "))||[],n.filter(e=>-1==r.indexOf(e)).join(","));if(i){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope),new ex(e.authorizationParams.audience||"default",i)}}return Object.assign(Object.assign({},d),{scope:e.authorizationParams.scope,oauthTokenScope:d.scope,audience:e.authorizationParams.audience||ev})}catch(t){if(t.message){if(t.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),t;if((t.message.includes("Missing Refresh Token")||t.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw t}}async _saveEntryInCache(e){let t=e.decodedToken.claims,n=t.session_expiry,r=t.iat;if(void 0!==n){if("number"!=typeof n)throw new ek("invalid_token","Invalid session_expiry: value must be a number.");if(n>=1e10)throw new ek("invalid_token","Invalid session_expiry: value appears to be in milliseconds; expected a Unix timestamp in seconds.");if(void 0===r||n<=r)throw new ek("invalid_token","Invalid session_expiry: session ceiling is before or at the token issue time.")}let i=e.id_token,o=e.decodedToken,a=Q(e,["id_token","decodedToken"]);this.userCache.set(tp,{id_token:i,decodedToken:o}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(a)}async _clearLocalSession(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.clientId;null===t?await this.cacheManager.clear():await this.cacheManager.clear(t),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(tp);try{await (null==(e=this.dpop)?void 0:e.clear())}catch(e){}if(this.worker)try{await to({type:"clear"},this.worker)}catch(e){}}async _isSessionCeilingReached(){var e,t;let n=this.userCache.get(tp),r=null!=n?n:await this.cacheManager.getIdToken(new tf({clientId:this.options.clientId})),i=null==(t=null==(e=null==r?void 0:r.decodedToken)?void 0:e.claims)?void 0:t.session_expiry;return void 0!==i&&Math.floor(await this.nowProvider()/1e3)>=i-30&&(await this._clearLocalSession(),!0)}async _getIdTokenFromCache(){let e=this.options.authorizationParams.audience||ev,t=this.scope[e],n=await this.cacheManager.getIdToken(new tf({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(tp);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(tp,n),n)}async _getEntryFromCache(e){let t=e.scope,n=e.audience,r=e.clientId,i=e.cacheMode,o=await this.cacheManager.get(new tf({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,i);if(o&&o.access_token){let e=o.token_type,t=o.access_token,n=o.oauthTokenScope,r=o.expires_in,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}_storeMfaContext(e,t,n){e instanceof eI&&this.mfa.setMFAAuthDetail
1s(e.mfa_token,t,n,e.mfa_requirements)}async _requestToken(e,t){var n,r,i,o,a,s;let c=t||{},l=c.nonceIn,u=c.organization,h=c.scopesToRequest;try{let t=await tl(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop,preserveRefreshToken:this.onlineAccess},e),{scope:h||e.scope}),this.worker),c=await this._verifyIdToken(t.id_token,l,u);if("authorization_code"===e.grant_type){let e=await this._getIdTokenFromCache();(null==(r=null==(n=null==e?void 0:e.decodedToken)?void 0:n.claims)?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(tp))}if("authorization_code"!==e.grant_type){let e=await this._getIdTokenFromCache(),t=null==(o=null==(i=null==e?void 0:e.decodedToken)?void 0:i.claims)?void 0:o.session_expiry;void 0!==t&&(c=Object.assign(Object.assign({},c),{claims:Object.assign(Object.assign({},c.claims),{session_expiry:t})}))}return!t.refresh_token&&this.onlineAccess&&(t.refresh_token=null!=(a=e.refresh_token)?a:null==(s=await this.cacheManager.get(new tf({scope:h||e.scope,audience:e.audience||ev,clientId:this.options.clientId}),void 0,this.options.useMrrt))?void 0:s.refresh_token),await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},t),{decodedToken:c,scope:e.scope,audience:e.audience||ev}),t.scope?{oauthTokenScope:t.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(u||c.claims.org_id),Object.assign(Object.assign({},t),{decodedToken:c})}catch(t){throw"authorization_code"!==e.grant_type&&this._storeMfaContext(t,h||e.scope,e.audie
1nce),t}}_buildTokenExchangeParams(e){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type}),e.actor_token&&{actor_token:e.actor_token}),e.actor_token_type&&{actor_token_type:e.actor_token_type}),{scope:th(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization})}async loginWithCustomTokenExchange(e){return this._requestToken(this._buildTokenExchangeParams(e))}async customTokenExchange(e){let t=this._buildTokenExchangeParams(e);try{let n=await tl(Object.assign(Object.assign({},t),{baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,dpop:this.dpop}),this.worker,!0);return n.id_token&&await this._verifyIdToken(n.id_token,void 0,e.organization),n}catch(e){throw this._storeMfaContext(e,t.scope,t.audience),e}}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw 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 tD(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null==(t=null==e?void 0:e.scope)?void 0:t.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){let t=e.openUrl,n=e.appState,r=e.connection,i=e.scopes,o=e.authorization_params,a=e.redirectUri,s=void 0===a?this.options.authorizationParams.redirect_uri||window.location.origin:a;if(!r)throw Error("connection is required");let c=btoa(eU()),l=eU(),u=ez(await eM(l)),h=await this.myAccount.connectAccount({connection:r,scopes:i,redirect_uri:s,state:c,code_challenge:u,code_challenge_method:"S256",authorization_params:o}),d=h.connect_uri,p=h.connect_params,f=h.auth_session;this.transactionManager.create({state:c,code_verifier:l,auth_session:f,redirect_uri:s,appState:n,connection:r,response_type:tI.ConnectCode});let m=new URL(d);m.searchParams.set("ticket",p.ticket),t?await t(m.toString()):window.location.assign(m)}async _requestTokenForPasskey(e){let t=e.audience||this.options.authorizationParams.audience,n=e.organization||this.options.authorizationParams.organization;return this._requestToken(Object.assign(Object.assign(Object.assign({grant_type:"urn:okta:params:oauth:grant-type:webauthn",auth_session:e.authSession,authn_response:e.credential},e.realm&&{realm:e.realm}),n&&{organization:n}),{scope:th(this.scope,e.scope,t),audience:t}))}async _requestTokenForMfa(e,t){let n=e.mfaToken,r=Q(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}var aP={isAuthenticated:!1,isLoading:!0,error:void 0,user:void 0},aE=function(){throw Error("You forgot to wrap your component in <Auth0Provider>.")},aA=X(X({},aP),{buildAuthorizeUrl:aE,buildLogoutUrl:aE,getAccessTokenSilently:aE,getAccessTokenWithPopup:aE,getIdTokenClaims:aE,loginWithCustomTokenExchange:aE,customTokenExchange:aE,exchangeToken:aE,loginWithRedirect:aE,loginWithPopup:aE,connectAccountWithRedirect:aE,logout:aE,revokeRefreshToken:aE,handleRedirectCallback:aE,getDpopNonce:aE,setDpopNonce:aE,generateDpopProof:aE,createFetcher:aE,getConfiguration:aE,mfa:{getAuthenticators:aE,enroll:aE,challenge:aE,verify:aE,getEnrollmentFactors:aE},passkey:{signup:aE,login:aE},myAccount:{getFactors:aE,getAuthenticationMethods:aE,getAuthenticationMethod:aE,updateAuthenticationMethod:aE,deleteAuthenticationMethod:aE,enrollmentChallenge:aE,enrollmentVerify:aE}}),aC=(0,V.createContext)(aA),aI=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}function n(t,r){var i=e.call(this,null!=r?r:t)||this;return i.error=t,i.error_description=r,Object.setPrototypeOf(i,n.prototype),i}return G(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),n}(Error),aR=/[?&](?:connect_)?code=[^&]+/,ax=/[?&]state=[^&]+/,aO=/[?&]error=[^&]+/,aW=function(e){return function(t){return t instanceof Error?t:null!==t&&"object"==typeof t&&"error"in t&&"string"==typeof t.error?"error_description"in t&&"string"==typeof t.error_description?new aI(t.error,t.error_description):new aI(t.error):Error(e)}},aj=aW("Login failed"),aU=aW("Get access token failed"),aK=function(e){var t,n;(null==e?void 0:e.redirectUri)&&(console.warn("Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version"),e.authorizationParams=null!=(t=e.authorizationParams)?t:{},e.authorizationParams.redirect_uri=e.redirectUri,delete e.redirectUri),(null==(n=null==e?void 0:e.authorizationParams)?void 0:n.redirectUri)&&(console.warn("Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version"),e.authorizationParams.redirect_uri=e.authorizationParams.redirectUri,delete e.authorizationParams.redirectUri)},aL=function(e,t){switch(t.type){case"LOGIN_POPUP_STARTED":return X(X({},e),{isLoading:!0});case"LOGIN_POPUP_COMPLETE":case"INITIALISED":return X(X({},e),{isAuthenticated:!!t.user,user:t.user,isLoading:!1,error:void 0});case"HANDLE_REDIRECT_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":case"SYNC_USER":if(e.user===t.user)return e;return X(X({},e),{isAuthenticated:!!t.user,user:t.user});case"LOGOUT":return X(X({},e),{isAuthenticated:!1,user:void 0});case"ERROR":return X(X({},e),{isLoading:!1,error:t.error})}},aN=function(e){var t;window.history.replaceState({},document.title,null!=(t=e.returnTo)?t:window.location.pathname)},aM=function(){var e,t,n=new Promise(function(n,r){e=n,t=r});return n.catch(function(){}),{promise:n,resolve:e,reject:t}};e.s(["Auth0Provider",0,function(e){var t=e.children,n=e.skipRedirectCallback,r=e.onRedirectCallback,i=void 0===r?aN:r,o=e.context,a=void 0===o?aC:o,s=e.client,c=Y(e,["children","skipRedirectCallback","onRedirectCallback","context","client"]);s&&(c.domain||c.clientId)&&console.warn("Auth0Provider: the `client` prop takes precedence over `domain`/`clientId` and other configuration options. Remove `domain`, `clientId`, and any other Auth0Client configuration props when using the `client` prop.");var l=(0,V.useState)(function(){return null!=s?s:new aT((aK(c),X(X({},c),{auth0Client:{name:"auth0-react",version:"2.24.1"}})))})[0],u=(0,V.useReducer)(aL,aP),h=u[0],d=u[1],p=(0,V.useState)(aM),f=p[0],m=p[1],y=(0,V.useState)(!1),g=y[0],w=y[1],b=(0,V.useRef)(!1),v=(0,V.useRef)(!1),k=(0,V.useCallback)(function(e){return d({type:"ERROR",error:e}),e},[]),_=(0,V.useCallback)(function(e,t){return B(void 0,void 0,void 0,function(){var r,o,a,s,c,u,h;return q(this,function(p){switch(p.label){case 0:var f;if(p.trys.push([0,7,,8]),r=void 0,!(t&&(void 0===f&&(f=window.location.search),(aR.test(f)||aO.test(f))&&ax.test(f))&&!n))return[3,3];return[4,l.handleRedirectCallback()];case 1:return s=void 0===(a=(o=p.sent()).appState)?{}
1:a,c=o.response_type,u=Y(o,["appState","response_type"]),[4,l.getUser()];case 2:return r=p.sent(),s.response_type=c,c===tI.ConnectCode&&(s.connectedAccount=u),i(s,r),[3,6];case 3:return[4,l.checkSession()];case 4:return p.sent(),[4,l.getUser()];case 5:r=p.sent(),p.label=6;case 6:return d({type:"INITIALISED",user:r}),e.resolve(),[3,8];case 7:return k(h=aj(p.sent())),w(!0),e.reject(h),[3,8];case 8:return[2]}})})},[l,i,n,k]);(0,V.useEffect)(function(){v.current||(v.current=!0,_(f,!0))},[_,f]),(0,V.useEffect)(function(){if(g&&!b.current&&h.isAuthenticated){b.current=!0;var e=aM();m(e),_(e,!1)}},[g,h.isAuthenticated,_]);var S=(0,V.useCallback)(function(e){return aK(e),l.loginWithRedirect(e)},[l]),T=(0,V.useCallback)(function(e,t){return B(void 0,void 0,void 0,function(){return q(this,function(n){switch(n.label){case 0:d({type:"LOGIN_POPUP_STARTED"}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,l.loginWithPopup(e,t)];case 2:return n.sent(),[3,4];case 3:return k(aj(n.sent())),[2];case 4:return[4,l.getUser()];case 5:return d({type:"LOGIN_POPUP_COMPLETE",user:n.sent()}),[2]}})})},[l,k]),P=(0,V.useCallback)(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B(void 0,function(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),void 0,function(e){return void 0===e&&(e={}),q(this,function(t){switch(t.label){case 0:return[4,l.logout(e)];case 1:return t.sent(),(e.openUrl||!1===e.openUrl)&&d({type:"LOGOUT"}),[2]}})})},[l]),E=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n;return q(this,function(r){switch(r.label){case 0:return r.trys.push([0,,2,4]),[4,l.revokeRefreshToken(e)];case 1:return r.sent(),[3,4];case 2:return t=d,n={type:"SYNC_USER"},[4,l.getUser()];case 3:return t.apply(void 0,[(n.user=r.sent(),n)]),[7];case 4:return[2]}})})},[l]),A=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n,r;return q(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,3,5]),[4,l.getTokenSilently(e)];case 1:return t=i.sent(),[3,5];case 2:throw aU(i.sent());case 3:return n=d,r={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return n.apply(void 0,[(r.user=i.sent(),r)]),[7];case 5:return[2,t]}})})},[l]),C=(0,V.useCallback)(function(e,t){return B(void 0,void 0,void 0,function(){var n,r,i;return q(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,5]),[4,l.getTokenWithPopup(e,t)];case 1:return n=o.sent(),[3,5];case 2:throw aU(o.sent());case 3:return r=d,i={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return r.apply(void 0,[(i.user=o.sent(),i)]),[7];case 5:return[2,n]}})})},[l]),I=(0,V.useCallback)(function(e){return l.connectAccountWithRedirect(e)},[l]),R=(0,V.useCallback)(function(){return l.getIdTokenClaims()},[l]),x=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n,r;return q(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,3,5]),[4,l.loginWithCustomTokenExchange(e)];case 1:return t=i.sent(),[3,5];case 2:throw aU(i.sent());case 3:return n=d,r={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return n.apply(void 0,[(r.user=i.sent(),r)]),[7];case 5:return[2,t]}})})},[l]),O=(0,V.useCallback)(function(e){return l.customTokenExchange(e)},[l]),W=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){return q(this,function(t){return[2,x(e)]})})},[x]),j=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n;return q(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,3,5]),[4,l.handleRedirectCallback(e)];case 1:return[2,r.sent()];case 2:throw aU(r.sent());case 3:return t=d,n={type:"HANDLE_REDIRECT_COMPLETE"},[4,l.getUser()];case 4:return t.apply(void 0,[(n.user=r.sent(),n)]),[7];case 5:return[2]}})})},[l]),U=(0,V.useCallback)(function(e){return l.getDpopNonce(e)},[l]),K=(0,V.useCallback)(function(e,t){return l.setDpopNonce(e,t)},[l]),L=(0,V.useCallback)(function(e){return l.generateDpopProof(e)},[l]),N=(0,V.useCallback)(function(e){return l.createFetcher(e)},[l]),M=(0,V.useCallback)(function(){return l.getConfiguration()},[l]),D=(0,V.useMemo)(function(){return l.mfa},[l]),z=(0,V.useMemo)(function(){return l.myAccount},[l]),J=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n,r;return q(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,3,5]),[4,l.passkey.signup(e)];case 1:return t=i.sent(),[3,5];case 2:throw aU(i.sent());case 3:return n=d,r={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return n.apply(void 0,[(r.user=i.sent(),r)]),[7];case 5:return[2,t]}})})},[l]),H=(0,V.useCallback)(function(e){return B(void 0,void 0,void 0,function(){var t,n,r;return q(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,3,5]),[4,l.passkey.login(e)];case 1:return t=i.sent(),[3,5];case 2:throw aU(i.sent());case 3:return n=d,r={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return n.apply(void 0,[(r.user=i.sent(),r)]),[7];case 5:return[2,t]}})})},[l]),Z=(0,V.useMemo)(function(){return{signup:J,login:H}},[J,H]),F=(0,V.useMemo)(function(){return X(X({},h),{getAccessTokenSilently:A,getAccessTokenWithPopup:C,getIdTokenClaims:R,loginWithCustomTokenExchange:x,customTokenExchange:O,exchangeToken:W,loginWithRedirect:S,loginWithPopup:T,connectAccountWithRedirect:I,logout:P,revokeRefreshToken:E,handleRedirectCallback:j,getDpopNonce:U,setDpopNonce:K,generateDpopProof:L,createFetcher:N,getConfiguration:M,mfa:D,passkey:Z,myAccount:z,_initPromise:f.promise})},[h,A,C,R,x,O,W,S,T,I,P,E,j,U,K,L,N,M,D,Z,z,f]);return V.default.createElement(a.Provider,{value:F},t)},"useAuth0",0,function(e){return void 0===e&&(e=aC),(0,V.useContext)(e)}])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.