@engine-web/website
Advanced tools
@@ -1,4 +0,4 @@ | ||
| "use strict";(()=>{var Ee=Object.defineProperty;var Te=(n,e,t)=>e in n?Ee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var W=(n,e,t)=>Te(n,typeof e!="symbol"?e+"":e,t);function S(n,e){var t={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(o=Object.getOwnPropertySymbols(n);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(n,o[i])&&(t[o[i]]=n[o[i]])}return t}var O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function oe(n,e){return n(e={exports:{}},e.exports),e.exports}var C=oe((function(n,e){Object.defineProperty(e,"__esModule",{value:!0});var t=(function(){function o(){var i=this;this.locked=new Map,this.addToLocked=function(r,c){var l=i.locked.get(r);l===void 0?c===void 0?i.locked.set(r,[]):i.locked.set(r,[c]):c!==void 0&&(l.unshift(c),i.locked.set(r,l))},this.isLocked=function(r){return i.locked.has(r)},this.lock=function(r){return new Promise((function(c,l){i.isLocked(r)?i.addToLocked(r,c):(i.addToLocked(r),c())}))},this.unlock=function(r){var c=i.locked.get(r);if(c!==void 0&&c.length!==0){var l=c.pop();i.locked.set(r,c),l!==void 0&&setTimeout(l,0)}else i.locked.delete(r)}}return o.getInstance=function(){return o.instance===void 0&&(o.instance=new o),o.instance},o})();e.default=function(){return t.getInstance()}}));te(C);var Ce=te(oe((function(n,e){var t=O&&O.__awaiter||function(a,s,u,h){return new(u||(u=Promise))((function(m,w){function g(v){try{b(h.next(v))}catch(f){w(f)}}function y(v){try{b(h.throw(v))}catch(f){w(f)}}function b(v){v.done?m(v.value):new u((function(f){f(v.value)})).then(g,y)}b((h=h.apply(a,s||[])).next())}))},o=O&&O.__generator||function(a,s){var u,h,m,w,g={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function y(b){return function(v){return(function(f){if(u)throw new TypeError("Generator is already executing.");for(;g;)try{if(u=1,h&&(m=2&f[0]?h.return:f[0]?h.throw||((m=h.return)&&m.call(h),0):h.next)&&!(m=m.call(h,f[1])).done)return m;switch(h=0,m&&(f=[2&f[0],m.value]),f[0]){case 0:case 1:m=f;break;case 4:return g.label++,{value:f[1],done:!1};case 5:g.label++,h=f[1],f=[0];continue;case 7:f=g.ops.pop(),g.trys.pop();continue;default:if(m=g.trys,!((m=m.length>0&&m[m.length-1])||f[0]!==6&&f[0]!==2)){g=0;continue}if(f[0]===3&&(!m||f[1]>m[0]&&f[1]<m[3])){g.label=f[1];break}if(f[0]===6&&g.label<m[1]){g.label=m[1],m=f;break}if(m&&g.label<m[2]){g.label=m[2],g.ops.push(f);break}m[2]&&g.ops.pop(),g.trys.pop();continue}f=s.call(a,g)}catch(I){f=[6,I],h=0}finally{u=m=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}})([b,v])}}},i=O;Object.defineProperty(e,"__esModule",{value:!0});var r="browser-tabs-lock-key",c={key:function(a){return t(i,void 0,void 0,(function(){return o(this,(function(s){throw new Error("Unsupported")}))}))},getItem:function(a){return t(i,void 0,void 0,(function(){return o(this,(function(s){throw new Error("Unsupported")}))}))},clear:function(){return t(i,void 0,void 0,(function(){return o(this,(function(a){return[2,window.localStorage.clear()]}))}))},removeItem:function(a){return t(i,void 0,void 0,(function(){return o(this,(function(s){throw new Error("Unsupported")}))}))},setItem:function(a,s){return t(i,void 0,void 0,(function(){return o(this,(function(u){throw new Error("Unsupported")}))}))},keySync:function(a){return window.localStorage.key(a)},getItemSync:function(a){return window.localStorage.getItem(a)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(a){return window.localStorage.removeItem(a)},setItemSync:function(a,s){return window.localStorage.setItem(a,s)}};function l(a){return new Promise((function(s){return setTimeout(s,a)}))}function d(a){for(var s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",u="",h=0;h<a;h++)u+=s[Math.floor(Math.random()*s.length)];return u}var p=(function(){function a(s){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+d(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=s,a.waiters===void 0&&(a.waiters=[])}return a.prototype.acquireLock=function(s,u){return u===void 0&&(u=5e3),t(this,void 0,void 0,(function(){var h,m,w,g,y,b,v;return o(this,(function(f){switch(f.label){case 0:h=Date.now()+d(4),m=Date.now()+u,w=r+"-"+s,g=this.storageHandler===void 0?c:this.storageHandler,f.label=1;case 1:return Date.now()<m?[4,l(30)]:[3,8];case 2:return f.sent(),g.getItemSync(w)!==null?[3,5]:(y=this.id+"-"+s+"-"+h,[4,l(Math.floor(25*Math.random()))]);case 3:return f.sent(),g.setItemSync(w,JSON.stringify({id:this.id,iat:h,timeoutKey:y,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,l(30)];case 4:return f.sent(),(b=g.getItemSync(w))!==null&&(v=JSON.parse(b)).id===this.id&&v.iat===h?(this.acquiredIatSet.add(h),this.refreshLockWhileAcquired(w,h),[2,!0]):[3,7];case 5:return a.lockCorrector(this.storageHandler===void 0?c:this.storageHandler),[4,this.waitForSomethingToChange(m)];case 6:f.sent(),f.label=7;case 7:return h=Date.now()+d(4),[3,1];case 8:return[2,!1]}}))}))},a.prototype.refreshLockWhileAcquired=function(s,u){return t(this,void 0,void 0,(function(){var h=this;return o(this,(function(m){return setTimeout((function(){return t(h,void 0,void 0,(function(){var w,g,y;return o(this,(function(b){switch(b.label){case 0:return[4,C.default().lock(u)];case 1:return b.sent(),this.acquiredIatSet.has(u)?(w=this.storageHandler===void 0?c:this.storageHandler,(g=w.getItemSync(s))===null?(C.default().unlock(u),[2]):((y=JSON.parse(g)).timeRefreshed=Date.now(),w.setItemSync(s,JSON.stringify(y)),C.default().unlock(u),this.refreshLockWhileAcquired(s,u),[2])):(C.default().unlock(u),[2])}}))}))}),1e3),[2]}))}))},a.prototype.waitForSomethingToChange=function(s){return t(this,void 0,void 0,(function(){return o(this,(function(u){switch(u.label){case 0:return[4,new Promise((function(h){var m=!1,w=Date.now(),g=!1;function y(){if(g||(window.removeEventListener("storage",y),a.removeFromWaiting(y),clearTimeout(b),g=!0),!m){m=!0;var v=50-(Date.now()-w);v>0?setTimeout(h,v):h(null)}}window.addEventListener("storage",y),a.addToWaiting(y);var b=setTimeout(y,Math.max(0,s-Date.now()))}))];case 1:return u.sent(),[2]}}))}))},a.addToWaiting=function(s){this.removeFromWaiting(s),a.waiters!==void 0&&a.waiters.push(s)},a.removeFromWaiting=function(s){a.waiters!==void 0&&(a.waiters=a.waiters.filter((function(u){return u!==s})))},a.notifyWaiters=function(){a.waiters!==void 0&&a.waiters.slice().forEach((function(s){return s()}))},a.prototype.releaseLock=function(s){return t(this,void 0,void 0,(function(){return o(this,(function(u){switch(u.label){case 0:return[4,this.releaseLock__private__(s)];case 1:return[2,u.sent()]}}))}))},a.prototype.releaseLock__private__=function(s){return t(this,void 0,void 0,(function(){var u,h,m,w;return o(this,(function(g){switch(g.label){case 0:return u=this.storageHandler===void 0?c:this.storageHandler,h=r+"-"+s,(m=u.getItemSync(h))===null?[2]:(w=JSON.parse(m)).id!==this.id?[3,2]:[4,C.default().lock(w.iat)];case 1:g.sent(),this.acquiredIatSet.delete(w.iat),u.removeItemSync(h),C.default().unlock(w.iat),a.notifyWaiters(),g.label=2;case 2:return[2]}}))}))},a.lockCorrector=function(s){for(var u=Date.now()-5e3,h=s,m=[],w=0;;){var g=h.keySync(w);if(g===null)break;m.push(g),w++}for(var y=!1,b=0;b<m.length;b++){var v=m[b];if(v.includes(r)){var f=h.getItemSync(v);if(f!==null){var I=JSON.parse(f);(I.timeRefreshed===void 0&&I.timeAcquired<u||I.timeRefreshed!==void 0&&I.timeRefreshed<u)&&(h.removeItemSync(v),y=!0)}}}y&&a.notifyWaiters()},a.waiters=void 0,a})();e.default=p}))),Oe={timeoutInSeconds:60},me={name:"auth0-spa-js",version:"2.3.0"},pe=()=>Date.now(),k=class n extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,n.prototype)}static fromPayload({error:e,error_description:t}){return new n(e,t)}},V=class n extends k{constructor(e,t,o,i=null){super(e,t),this.state=o,this.appState=i,Object.setPrototypeOf(this,n.prototype)}},F=class n extends k{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,n.prototype)}},A=class n extends F{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,n.prototype)}},J=class n extends k{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,n.prototype)}},G=class n extends k{constructor(e,t,o){super(e,t),this.mfa_token=o,Object.setPrototypeOf(this,n.prototype)}},D=class n extends k{constructor(e,t){super("missing_refresh_token",`Missing Refresh Token (audience: '${re(e,["default"])}', scope: '${re(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,n.prototype)}};function re(n,e=[]){return n&&!e.includes(n)?n:""}var U=()=>window.crypto,N=()=>{let n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="";return Array.from(U().getRandomValues(new Uint8Array(43))).forEach((t=>e+=n[t%n.length])),e},ae=n=>btoa(n),Y=n=>{var{clientId:e}=n,t=S(n,["clientId"]);return new URLSearchParams((o=>Object.keys(o).filter((i=>o[i]!==void 0)).reduce(((i,r)=>Object.assign(Object.assign({},i),{[r]:o[r]})),{}))(Object.assign({client_id:e},t))).toString()},se=n=>(e=>decodeURIComponent(atob(e).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(n.replace(/_/g,"/").replace(/-/g,"+")),Le=async(n,e)=>{let t=await fetch(n,e);return{ok:t.ok,json:await t.json()}},je=async(n,e,t)=>{let o=new AbortController,i;return e.signal=o.signal,Promise.race([Le(n,e),new Promise(((r,c)=>{i=setTimeout((()=>{o.abort(),c(new Error("Timeout when executing 'fetch'"))}),t)}))]).finally((()=>{clearTimeout(i)}))},xe=async(n,e,t,o,i,r,c)=>{return l={auth:{audience:e,scope:t},timeout:i,fetchUrl:n,fetchOptions:o,useFormData:c},d=r,new Promise((function(p,a){let s=new MessageChannel;s.port1.onmessage=function(u){u.data.error?a(new Error(u.data.error)):p(u.data),s.port1.close()},d.postMessage(l,[s.port2])}));var l,d},Pe=async(n,e,t,o,i,r,c=1e4)=>i?xe(n,e,t,o,c,i,r):je(n,o,c);async function ze(n,e){var{baseUrl:t,timeout:o,audience:i,scope:r,auth0Client:c,useFormData:l}=n,d=S(n,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);let p=d.grant_type==="urn:ietf:params:oauth:grant-type:token-exchange",a=Object.assign(Object.assign(Object.assign({},d),p&&i&&{audience:i}),p&&r&&{scope:r}),s=l?Y(a):JSON.stringify(a);return await(async function(u,h,m,w,g,y,b){let v,f=null;for(let x=0;x<3;x++)try{v=await Pe(u,m,w,g,y,b,h),f=null;break}catch(Se){f=Se}if(f)throw f;let I=v.json,{error:E,error_description:K}=I,_=S(I,["error","error_description"]),{ok:R}=v;if(!R){let x=K||`HTTP error. Unable to fetch ${u}`;throw E==="mfa_required"?new G(E,x,_.mfa_token):E==="missing_refresh_token"?new D(m,w):new k(E||"request_error",x)}return _})(`${t}/oauth/token`,o,i||"default",r,{method:"POST",body:s,headers:{"Content-Type":l?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(c||me))}},e,l)}var P=(...n)=>{return(e=n.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e},T=class n{constructor(e,t="@@auth0spajs@@",o){this.prefix=t,this.suffix=o,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,o,i,r]=e.split("::");return new n({clientId:o,scope:r,audience:i},t)}static fromCacheEntry(e){let{scope:t,audience:o,client_id:i}=e;return new n({scope:t,audience:o,clientId:i})}},$=class{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{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith("@@auth0spajs@@")))}},Z=class{constructor(){this.enclosedCache=(function(){let e={};return{set(t,o){e[t]=o},get(t){let o=e[t];if(o)return o},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}})()}},q=class{constructor(e,t,o){this.cache=e,this.keyManifest=t,this.nowProvider=o||pe}async setIdToken(e,t,o){var i;let r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:o}),await((i=this.keyManifest)===null||i===void 0?void 0:i.add(r))}async getIdToken(e){let t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){let o=await this.get(e);return!o||!o.id_token||!o.decodedToken?void 0:{id_token:o.id_token,decodedToken:o.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e,t=0){var o;let i=await this.cache.get(e.toKey());if(!i){let l=await this.getCacheKeys();if(!l)return;let d=this.matchExistingCacheKey(e,l);d&&(i=await this.cache.get(d))}if(!i)return;let r=await this.nowProvider(),c=Math.floor(r/1e3);return i.expiresAt-t<c?i.body.refresh_token?(i.body={refresh_token:i.body.refresh_token},await this.cache.set(e.toKey(),i),i.body):(await this.cache.remove(e.toKey()),void await((o=this.keyManifest)===null||o===void 0?void 0:o.remove(e.toKey()))):i.body}async set(e){var t;let o=new T({clientId:e.client_id,scope:e.scope,audience:e.audience}),i=await this.wrapCacheEntry(e);await this.cache.set(o.toKey(),i),await((t=this.keyManifest)===null||t===void 0?void 0:t.add(o.toKey()))}async clear(e){var t;let o=await this.getCacheKeys();o&&(await o.filter((i=>!e||i.includes(e))).reduce((async(i,r)=>{await i,await this.cache.remove(r)}),Promise.resolve()),await((t=this.keyManifest)===null||t===void 0?void 0:t.clear()))}async wrapCacheEntry(e){let t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new T({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter((o=>{var i;let r=T.fromKey(o),c=new Set(r.scope&&r.scope.split(" ")),l=((i=e.scope)===null||i===void 0?void 0:i.split(" "))||[],d=r.scope&&l.reduce(((p,a)=>p&&c.has(a)),!0);return r.prefix==="@@auth0spajs@@"&&r.clientId===e.clientId&&r.audience===e.audience&&d}))[0]}},B=class{constructor(e,t,o){this.storage=e,this.clientId=t,this.cookieDomain=o,this.storageKey=`a0.spajs.txs.${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})}},z=n=>typeof n=="number",Fe=["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"],Re=n=>{if(!n.id_token)throw new Error("ID token is required but missing");let e=(r=>{let c=r.split("."),[l,d,p]=c;if(c.length!==3||!l||!d||!p)throw new Error("ID token could not be decoded");let a=JSON.parse(se(d)),s={__raw:r},u={};return Object.keys(a).forEach((h=>{s[h]=a[h],Fe.includes(h)||(u[h]=a[h])})),{encoded:{header:l,payload:d,signature:p},header:JSON.parse(se(l)),claims:s,user:u}})(n.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==n.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${n.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(n.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${n.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==n.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${n.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==n.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${n.aud}" but found "${e.claims.aud}"`);if(n.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==n.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${n.nonce}", found "${e.claims.nonce}"`)}if(n.max_age&&!z(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!z(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!z(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");let t=n.leeway||60,o=new Date(n.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+t),o>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${o}) is after expiration time (${i})`);if(e.claims.nbf!=null&&z(e.claims.nbf)){let r=new Date(0);if(r.setUTCSeconds(e.claims.nbf-t),o<r)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${o}) is before ${r}`)}if(e.claims.auth_time!=null&&z(e.claims.auth_time)){let r=new Date(0);if(r.setUTCSeconds(parseInt(e.claims.auth_time)+n.max_age+t),o>r)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${o}) is after last auth at ${r}`)}if(n.organization){let r=n.organization.trim();if(r.startsWith("org_")){let c=r;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(c!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${c}", found "${e.claims.org_id}"`)}else{let c=r.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(c!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${c}", found "${e.claims.org_name}"`)}}return e},L=oe((function(n,e){var t=O&&O.__assign||function(){return t=Object.assign||function(d){for(var p,a=1,s=arguments.length;a<s;a++)for(var u in p=arguments[a])Object.prototype.hasOwnProperty.call(p,u)&&(d[u]=p[u]);return d},t.apply(this,arguments)};function o(d,p){if(!p)return"";var a="; "+d;return p===!0?a:a+"="+p}function i(d,p,a){return encodeURIComponent(d).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+(function(s){if(typeof s.expires=="number"){var u=new Date;u.setMilliseconds(u.getMilliseconds()+864e5*s.expires),s.expires=u}return o("Expires",s.expires?s.expires.toUTCString():"")+o("Domain",s.domain)+o("Path",s.path)+o("Secure",s.secure)+o("SameSite",s.sameSite)})(a)}function r(d){for(var p={},a=d?d.split("; "):[],s=/(%[\dA-F]{2})+/gi,u=0;u<a.length;u++){var h=a[u].split("="),m=h.slice(1).join("=");m.charAt(0)==='"'&&(m=m.slice(1,-1));try{p[h[0].replace(s,decodeURIComponent)]=m.replace(s,decodeURIComponent)}catch{}}return p}function c(){return r(document.cookie)}function l(d,p,a){document.cookie=i(d,p,t({path:"/"},a))}e.__esModule=!0,e.encode=i,e.parse=r,e.getAll=c,e.get=function(d){return c()[d]},e.set=l,e.remove=function(d,p){l(d,"",t(t({},p),{expires:-1}))}}));te(L),L.encode,L.parse,L.getAll;var Ue=L.get,fe=L.set,ge=L.remove,j={get(n){let e=Ue(n);if(e!==void 0)return JSON.parse(e)},save(n,e,t){let o={};window.location.protocol==="https:"&&(o={secure:!0,sameSite:"none"}),t?.daysUntilExpire&&(o.expires=t.daysUntilExpire),t?.cookieDomain&&(o.domain=t.cookieDomain),fe(n,JSON.stringify(e),o)},remove(n,e){let t={};e?.cookieDomain&&(t.domain=e.cookieDomain),ge(n,t)}},De={get(n){return j.get(n)||j.get(`_legacy_${n}`)},save(n,e,t){let o={};window.location.protocol==="https:"&&(o={secure:!0}),t?.daysUntilExpire&&(o.expires=t.daysUntilExpire),t?.cookieDomain&&(o.domain=t.cookieDomain),fe(`_legacy_${n}`,JSON.stringify(e),o),j.save(n,e,t)},remove(n,e){let t={};e?.cookieDomain&&(t.domain=e.cookieDomain),ge(n,t),j.remove(n,e),j.remove(`_legacy_${n}`,e)}},Ze={get(n){if(typeof sessionStorage>"u")return;let e=sessionStorage.getItem(n);return e!=null?JSON.parse(e):void 0},save(n,e){sessionStorage.setItem(n,JSON.stringify(e))},remove(n){sessionStorage.removeItem(n)}};function Ke(n,e,t){var o=e===void 0?null:e,i=(function(d,p){var a=atob(d);if(p){for(var s=new Uint8Array(a.length),u=0,h=a.length;u<h;++u)s[u]=a.charCodeAt(u);return String.fromCharCode.apply(null,new Uint16Array(s.buffer))}return a})(n,t!==void 0&&t),r=i.indexOf(` | ||
| `,10)+1,c=i.substring(r)+(o?"//# sourceMappingURL="+o:""),l=new Blob([c],{type:"application/javascript"});return URL.createObjectURL(l)}var ce,le,ue,H,We=(ce="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",le=null,ue=!1,function(n){return H=H||Ke(ce,le,ue),new Worker(H,n)}),M={},Q=class{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;let o=new Set(((t=await this.cache.get(this.manifestKey))===null||t===void 0?void 0:t.keys)||[]);o.add(e),await this.cache.set(this.manifestKey,{keys:[...o]})}async remove(e){let t=await this.cache.get(this.manifestKey);if(t){let o=new Set(t.keys);return o.delete(e),o.size>0?await this.cache.set(this.manifestKey,{keys:[...o]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}},Ne={memory:()=>new Z().enclosedCache,localstorage:()=>new $},de=n=>Ne[n],he=n=>{let{openUrl:e,onRedirect:t}=n,o=S(n,["openUrl","onRedirect"]);return Object.assign(Object.assign({},o),{openUrl:e===!1||e?e:t})},X=new Ce,ee=class{constructor(e){let t,o;if(this.userCache=new Z().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await X.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!U())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(U().subtle===void 0)throw new Error(` | ||
| "use strict";(()=>{var Ee=Object.defineProperty;var Te=(o,e,t)=>e in o?Ee(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var W=(o,e,t)=>Te(o,typeof e!="symbol"?e+"":e,t);function S(o,e){var t={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(n=Object.getOwnPropertySymbols(o);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(o,n[i])&&(t[n[i]]=o[n[i]])}return t}var O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function ne(o,e){return o(e={exports:{}},e.exports),e.exports}var C=ne((function(o,e){Object.defineProperty(e,"__esModule",{value:!0});var t=(function(){function n(){var i=this;this.locked=new Map,this.addToLocked=function(r,c){var l=i.locked.get(r);l===void 0?c===void 0?i.locked.set(r,[]):i.locked.set(r,[c]):c!==void 0&&(l.unshift(c),i.locked.set(r,l))},this.isLocked=function(r){return i.locked.has(r)},this.lock=function(r){return new Promise((function(c,l){i.isLocked(r)?i.addToLocked(r,c):(i.addToLocked(r),c())}))},this.unlock=function(r){var c=i.locked.get(r);if(c!==void 0&&c.length!==0){var l=c.pop();i.locked.set(r,c),l!==void 0&&setTimeout(l,0)}else i.locked.delete(r)}}return n.getInstance=function(){return n.instance===void 0&&(n.instance=new n),n.instance},n})();e.default=function(){return t.getInstance()}}));te(C);var Ce=te(ne((function(o,e){var t=O&&O.__awaiter||function(a,s,u,h){return new(u||(u=Promise))((function(m,w){function g(v){try{b(h.next(v))}catch(f){w(f)}}function y(v){try{b(h.throw(v))}catch(f){w(f)}}function b(v){v.done?m(v.value):new u((function(f){f(v.value)})).then(g,y)}b((h=h.apply(a,s||[])).next())}))},n=O&&O.__generator||function(a,s){var u,h,m,w,g={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function y(b){return function(v){return(function(f){if(u)throw new TypeError("Generator is already executing.");for(;g;)try{if(u=1,h&&(m=2&f[0]?h.return:f[0]?h.throw||((m=h.return)&&m.call(h),0):h.next)&&!(m=m.call(h,f[1])).done)return m;switch(h=0,m&&(f=[2&f[0],m.value]),f[0]){case 0:case 1:m=f;break;case 4:return g.label++,{value:f[1],done:!1};case 5:g.label++,h=f[1],f=[0];continue;case 7:f=g.ops.pop(),g.trys.pop();continue;default:if(m=g.trys,!((m=m.length>0&&m[m.length-1])||f[0]!==6&&f[0]!==2)){g=0;continue}if(f[0]===3&&(!m||f[1]>m[0]&&f[1]<m[3])){g.label=f[1];break}if(f[0]===6&&g.label<m[1]){g.label=m[1],m=f;break}if(m&&g.label<m[2]){g.label=m[2],g.ops.push(f);break}m[2]&&g.ops.pop(),g.trys.pop();continue}f=s.call(a,g)}catch(I){f=[6,I],h=0}finally{u=m=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}})([b,v])}}},i=O;Object.defineProperty(e,"__esModule",{value:!0});var r="browser-tabs-lock-key",c={key:function(a){return t(i,void 0,void 0,(function(){return n(this,(function(s){throw new Error("Unsupported")}))}))},getItem:function(a){return t(i,void 0,void 0,(function(){return n(this,(function(s){throw new Error("Unsupported")}))}))},clear:function(){return t(i,void 0,void 0,(function(){return n(this,(function(a){return[2,window.localStorage.clear()]}))}))},removeItem:function(a){return t(i,void 0,void 0,(function(){return n(this,(function(s){throw new Error("Unsupported")}))}))},setItem:function(a,s){return t(i,void 0,void 0,(function(){return n(this,(function(u){throw new Error("Unsupported")}))}))},keySync:function(a){return window.localStorage.key(a)},getItemSync:function(a){return window.localStorage.getItem(a)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(a){return window.localStorage.removeItem(a)},setItemSync:function(a,s){return window.localStorage.setItem(a,s)}};function l(a){return new Promise((function(s){return setTimeout(s,a)}))}function d(a){for(var s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",u="",h=0;h<a;h++)u+=s[Math.floor(Math.random()*s.length)];return u}var p=(function(){function a(s){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+d(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=s,a.waiters===void 0&&(a.waiters=[])}return a.prototype.acquireLock=function(s,u){return u===void 0&&(u=5e3),t(this,void 0,void 0,(function(){var h,m,w,g,y,b,v;return n(this,(function(f){switch(f.label){case 0:h=Date.now()+d(4),m=Date.now()+u,w=r+"-"+s,g=this.storageHandler===void 0?c:this.storageHandler,f.label=1;case 1:return Date.now()<m?[4,l(30)]:[3,8];case 2:return f.sent(),g.getItemSync(w)!==null?[3,5]:(y=this.id+"-"+s+"-"+h,[4,l(Math.floor(25*Math.random()))]);case 3:return f.sent(),g.setItemSync(w,JSON.stringify({id:this.id,iat:h,timeoutKey:y,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,l(30)];case 4:return f.sent(),(b=g.getItemSync(w))!==null&&(v=JSON.parse(b)).id===this.id&&v.iat===h?(this.acquiredIatSet.add(h),this.refreshLockWhileAcquired(w,h),[2,!0]):[3,7];case 5:return a.lockCorrector(this.storageHandler===void 0?c:this.storageHandler),[4,this.waitForSomethingToChange(m)];case 6:f.sent(),f.label=7;case 7:return h=Date.now()+d(4),[3,1];case 8:return[2,!1]}}))}))},a.prototype.refreshLockWhileAcquired=function(s,u){return t(this,void 0,void 0,(function(){var h=this;return n(this,(function(m){return setTimeout((function(){return t(h,void 0,void 0,(function(){var w,g,y;return n(this,(function(b){switch(b.label){case 0:return[4,C.default().lock(u)];case 1:return b.sent(),this.acquiredIatSet.has(u)?(w=this.storageHandler===void 0?c:this.storageHandler,(g=w.getItemSync(s))===null?(C.default().unlock(u),[2]):((y=JSON.parse(g)).timeRefreshed=Date.now(),w.setItemSync(s,JSON.stringify(y)),C.default().unlock(u),this.refreshLockWhileAcquired(s,u),[2])):(C.default().unlock(u),[2])}}))}))}),1e3),[2]}))}))},a.prototype.waitForSomethingToChange=function(s){return t(this,void 0,void 0,(function(){return n(this,(function(u){switch(u.label){case 0:return[4,new Promise((function(h){var m=!1,w=Date.now(),g=!1;function y(){if(g||(window.removeEventListener("storage",y),a.removeFromWaiting(y),clearTimeout(b),g=!0),!m){m=!0;var v=50-(Date.now()-w);v>0?setTimeout(h,v):h(null)}}window.addEventListener("storage",y),a.addToWaiting(y);var b=setTimeout(y,Math.max(0,s-Date.now()))}))];case 1:return u.sent(),[2]}}))}))},a.addToWaiting=function(s){this.removeFromWaiting(s),a.waiters!==void 0&&a.waiters.push(s)},a.removeFromWaiting=function(s){a.waiters!==void 0&&(a.waiters=a.waiters.filter((function(u){return u!==s})))},a.notifyWaiters=function(){a.waiters!==void 0&&a.waiters.slice().forEach((function(s){return s()}))},a.prototype.releaseLock=function(s){return t(this,void 0,void 0,(function(){return n(this,(function(u){switch(u.label){case 0:return[4,this.releaseLock__private__(s)];case 1:return[2,u.sent()]}}))}))},a.prototype.releaseLock__private__=function(s){return t(this,void 0,void 0,(function(){var u,h,m,w;return n(this,(function(g){switch(g.label){case 0:return u=this.storageHandler===void 0?c:this.storageHandler,h=r+"-"+s,(m=u.getItemSync(h))===null?[2]:(w=JSON.parse(m)).id!==this.id?[3,2]:[4,C.default().lock(w.iat)];case 1:g.sent(),this.acquiredIatSet.delete(w.iat),u.removeItemSync(h),C.default().unlock(w.iat),a.notifyWaiters(),g.label=2;case 2:return[2]}}))}))},a.lockCorrector=function(s){for(var u=Date.now()-5e3,h=s,m=[],w=0;;){var g=h.keySync(w);if(g===null)break;m.push(g),w++}for(var y=!1,b=0;b<m.length;b++){var v=m[b];if(v.includes(r)){var f=h.getItemSync(v);if(f!==null){var I=JSON.parse(f);(I.timeRefreshed===void 0&&I.timeAcquired<u||I.timeRefreshed!==void 0&&I.timeRefreshed<u)&&(h.removeItemSync(v),y=!0)}}}y&&a.notifyWaiters()},a.waiters=void 0,a})();e.default=p}))),Oe={timeoutInSeconds:60},pe={name:"auth0-spa-js",version:"2.3.0"},fe=()=>Date.now(),k=class o extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,o.prototype)}static fromPayload({error:e,error_description:t}){return new o(e,t)}},V=class o extends k{constructor(e,t,n,i=null){super(e,t),this.state=n,this.appState=i,Object.setPrototypeOf(this,o.prototype)}},F=class o extends k{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,o.prototype)}},A=class o extends F{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,o.prototype)}},J=class o extends k{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,o.prototype)}},G=class o extends k{constructor(e,t,n){super(e,t),this.mfa_token=n,Object.setPrototypeOf(this,o.prototype)}},D=class o extends k{constructor(e,t){super("missing_refresh_token",`Missing Refresh Token (audience: '${ae(e,["default"])}', scope: '${ae(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,o.prototype)}};function ae(o,e=[]){return o&&!e.includes(o)?o:""}var U=()=>window.crypto,N=()=>{let o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="";return Array.from(U().getRandomValues(new Uint8Array(43))).forEach((t=>e+=o[t%o.length])),e},se=o=>btoa(o),Y=o=>{var{clientId:e}=o,t=S(o,["clientId"]);return new URLSearchParams((n=>Object.keys(n).filter((i=>n[i]!==void 0)).reduce(((i,r)=>Object.assign(Object.assign({},i),{[r]:n[r]})),{}))(Object.assign({client_id:e},t))).toString()},ce=o=>(e=>decodeURIComponent(atob(e).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join("")))(o.replace(/_/g,"/").replace(/-/g,"+")),Le=async(o,e)=>{let t=await fetch(o,e);return{ok:t.ok,json:await t.json()}},je=async(o,e,t)=>{let n=new AbortController,i;return e.signal=n.signal,Promise.race([Le(o,e),new Promise(((r,c)=>{i=setTimeout((()=>{n.abort(),c(new Error("Timeout when executing 'fetch'"))}),t)}))]).finally((()=>{clearTimeout(i)}))},xe=async(o,e,t,n,i,r,c)=>{return l={auth:{audience:e,scope:t},timeout:i,fetchUrl:o,fetchOptions:n,useFormData:c},d=r,new Promise((function(p,a){let s=new MessageChannel;s.port1.onmessage=function(u){u.data.error?a(new Error(u.data.error)):p(u.data),s.port1.close()},d.postMessage(l,[s.port2])}));var l,d},Pe=async(o,e,t,n,i,r,c=1e4)=>i?xe(o,e,t,n,c,i,r):je(o,n,c);async function ze(o,e){var{baseUrl:t,timeout:n,audience:i,scope:r,auth0Client:c,useFormData:l}=o,d=S(o,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);let p=d.grant_type==="urn:ietf:params:oauth:grant-type:token-exchange",a=Object.assign(Object.assign(Object.assign({},d),p&&i&&{audience:i}),p&&r&&{scope:r}),s=l?Y(a):JSON.stringify(a);return await(async function(u,h,m,w,g,y,b){let v,f=null;for(let x=0;x<3;x++)try{v=await Pe(u,m,w,g,y,b,h),f=null;break}catch(Se){f=Se}if(f)throw f;let I=v.json,{error:E,error_description:K}=I,_=S(I,["error","error_description"]),{ok:R}=v;if(!R){let x=K||`HTTP error. Unable to fetch ${u}`;throw E==="mfa_required"?new G(E,x,_.mfa_token):E==="missing_refresh_token"?new D(m,w):new k(E||"request_error",x)}return _})(`${t}/oauth/token`,n,i||"default",r,{method:"POST",body:s,headers:{"Content-Type":l?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(c||pe))}},e,l)}var P=(...o)=>{return(e=o.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(e))).join(" ");var e},T=class o{constructor(e,t="@@auth0spajs@@",n){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,n,i,r]=e.split("::");return new o({clientId:n,scope:r,audience:i},t)}static fromCacheEntry(e){let{scope:t,audience:n,client_id:i}=e;return new o({scope:t,audience:n,clientId:i})}},$=class{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{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith("@@auth0spajs@@")))}},Z=class{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)}})()}},q=class{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||fe}async setIdToken(e,t,n){var i;let r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await((i=this.keyManifest)===null||i===void 0?void 0:i.add(r))}async getIdToken(e){let t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){let n=await this.get(e);return!n||!n.id_token||!n.decodedToken?void 0:{id_token:n.id_token,decodedToken:n.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e,t=0){var n;let i=await this.cache.get(e.toKey());if(!i){let l=await this.getCacheKeys();if(!l)return;let d=this.matchExistingCacheKey(e,l);d&&(i=await this.cache.get(d))}if(!i)return;let r=await this.nowProvider(),c=Math.floor(r/1e3);return i.expiresAt-t<c?i.body.refresh_token?(i.body={refresh_token:i.body.refresh_token},await this.cache.set(e.toKey(),i),i.body):(await this.cache.remove(e.toKey()),void await((n=this.keyManifest)===null||n===void 0?void 0:n.remove(e.toKey()))):i.body}async set(e){var t;let n=new T({clientId:e.client_id,scope:e.scope,audience:e.audience}),i=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),i),await((t=this.keyManifest)===null||t===void 0?void 0:t.add(n.toKey()))}async clear(e){var t;let n=await this.getCacheKeys();n&&(await n.filter((i=>!e||i.includes(e))).reduce((async(i,r)=>{await i,await this.cache.remove(r)}),Promise.resolve()),await((t=this.keyManifest)===null||t===void 0?void 0:t.clear()))}async wrapCacheEntry(e){let t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?(e=await this.keyManifest.get())===null||e===void 0?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new T({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter((n=>{var i;let r=T.fromKey(n),c=new Set(r.scope&&r.scope.split(" ")),l=((i=e.scope)===null||i===void 0?void 0:i.split(" "))||[],d=r.scope&&l.reduce(((p,a)=>p&&c.has(a)),!0);return r.prefix==="@@auth0spajs@@"&&r.clientId===e.clientId&&r.audience===e.audience&&d}))[0]}},B=class{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${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})}},z=o=>typeof o=="number",Fe=["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"],Re=o=>{if(!o.id_token)throw new Error("ID token is required but missing");let e=(r=>{let c=r.split("."),[l,d,p]=c;if(c.length!==3||!l||!d||!p)throw new Error("ID token could not be decoded");let a=JSON.parse(ce(d)),s={__raw:r},u={};return Object.keys(a).forEach((h=>{s[h]=a[h],Fe.includes(h)||(u[h]=a[h])})),{encoded:{header:l,payload:d,signature:p},header:JSON.parse(ce(l)),claims:s,user:u}})(o.id_token);if(!e.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(e.claims.iss!==o.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${o.iss}", found "${e.claims.iss}"`);if(!e.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if(e.header.alg!=="RS256")throw new Error(`Signature algorithm of "${e.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!e.claims.aud||typeof e.claims.aud!="string"&&!Array.isArray(e.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(e.claims.aud)){if(!e.claims.aud.includes(o.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${o.aud}" but was not one of "${e.claims.aud.join(", ")}"`);if(e.claims.aud.length>1){if(!e.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(e.claims.azp!==o.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${o.aud}", found "${e.claims.azp}"`)}}else if(e.claims.aud!==o.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${o.aud}" but found "${e.claims.aud}"`);if(o.nonce){if(!e.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(e.claims.nonce!==o.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${o.nonce}", found "${e.claims.nonce}"`)}if(o.max_age&&!z(e.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(e.claims.exp==null||!z(e.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!z(e.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");let t=o.leeway||60,n=new Date(o.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(e.claims.exp+t),n>i)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${n}) is after expiration time (${i})`);if(e.claims.nbf!=null&&z(e.claims.nbf)){let r=new Date(0);if(r.setUTCSeconds(e.claims.nbf-t),n<r)throw new Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${n}) is before ${r}`)}if(e.claims.auth_time!=null&&z(e.claims.auth_time)){let r=new Date(0);if(r.setUTCSeconds(parseInt(e.claims.auth_time)+o.max_age+t),n>r)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${n}) is after last auth at ${r}`)}if(o.organization){let r=o.organization.trim();if(r.startsWith("org_")){let c=r;if(!e.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(c!==e.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${c}", found "${e.claims.org_id}"`)}else{let c=r.toLowerCase();if(!e.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(c!==e.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${c}", found "${e.claims.org_name}"`)}}return e},L=ne((function(o,e){var t=O&&O.__assign||function(){return t=Object.assign||function(d){for(var p,a=1,s=arguments.length;a<s;a++)for(var u in p=arguments[a])Object.prototype.hasOwnProperty.call(p,u)&&(d[u]=p[u]);return d},t.apply(this,arguments)};function n(d,p){if(!p)return"";var a="; "+d;return p===!0?a:a+"="+p}function i(d,p,a){return encodeURIComponent(d).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+(function(s){if(typeof s.expires=="number"){var u=new Date;u.setMilliseconds(u.getMilliseconds()+864e5*s.expires),s.expires=u}return n("Expires",s.expires?s.expires.toUTCString():"")+n("Domain",s.domain)+n("Path",s.path)+n("Secure",s.secure)+n("SameSite",s.sameSite)})(a)}function r(d){for(var p={},a=d?d.split("; "):[],s=/(%[\dA-F]{2})+/gi,u=0;u<a.length;u++){var h=a[u].split("="),m=h.slice(1).join("=");m.charAt(0)==='"'&&(m=m.slice(1,-1));try{p[h[0].replace(s,decodeURIComponent)]=m.replace(s,decodeURIComponent)}catch{}}return p}function c(){return r(document.cookie)}function l(d,p,a){document.cookie=i(d,p,t({path:"/"},a))}e.__esModule=!0,e.encode=i,e.parse=r,e.getAll=c,e.get=function(d){return c()[d]},e.set=l,e.remove=function(d,p){l(d,"",t(t({},p),{expires:-1}))}}));te(L),L.encode,L.parse,L.getAll;var Ue=L.get,ge=L.set,we=L.remove,j={get(o){let e=Ue(o);if(e!==void 0)return JSON.parse(e)},save(o,e,t){let n={};window.location.protocol==="https:"&&(n={secure:!0,sameSite:"none"}),t?.daysUntilExpire&&(n.expires=t.daysUntilExpire),t?.cookieDomain&&(n.domain=t.cookieDomain),ge(o,JSON.stringify(e),n)},remove(o,e){let t={};e?.cookieDomain&&(t.domain=e.cookieDomain),we(o,t)}},De={get(o){return j.get(o)||j.get(`_legacy_${o}`)},save(o,e,t){let n={};window.location.protocol==="https:"&&(n={secure:!0}),t?.daysUntilExpire&&(n.expires=t.daysUntilExpire),t?.cookieDomain&&(n.domain=t.cookieDomain),ge(`_legacy_${o}`,JSON.stringify(e),n),j.save(o,e,t)},remove(o,e){let t={};e?.cookieDomain&&(t.domain=e.cookieDomain),we(o,t),j.remove(o,e),j.remove(`_legacy_${o}`,e)}},Ze={get(o){if(typeof sessionStorage>"u")return;let e=sessionStorage.getItem(o);return e!=null?JSON.parse(e):void 0},save(o,e){sessionStorage.setItem(o,JSON.stringify(e))},remove(o){sessionStorage.removeItem(o)}};function Ke(o,e,t){var n=e===void 0?null:e,i=(function(d,p){var a=atob(d);if(p){for(var s=new Uint8Array(a.length),u=0,h=a.length;u<h;++u)s[u]=a.charCodeAt(u);return String.fromCharCode.apply(null,new Uint16Array(s.buffer))}return a})(o,t!==void 0&&t),r=i.indexOf(` | ||
| `,10)+1,c=i.substring(r)+(n?"//# sourceMappingURL="+n:""),l=new Blob([c],{type:"application/javascript"});return URL.createObjectURL(l)}var le,ue,de,H,We=(le="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=",ue=null,de=!1,function(o){return H=H||Ke(le,ue,de),new Worker(H,o)}),M={},Q=class{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;let n=new Set(((t=await this.cache.get(this.manifestKey))===null||t===void 0?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`@@auth0spajs@@::${e}`}},Ne={memory:()=>new Z().enclosedCache,localstorage:()=>new $},he=o=>Ne[o],me=o=>{let{openUrl:e,onRedirect:t}=o,n=S(o,["openUrl","onRedirect"]);return Object.assign(Object.assign({},n),{openUrl:e===!1||e?e:t})},X=new Ce,ee=class{constructor(e){let t,n;if(this.userCache=new Z().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await X.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!U())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(U().subtle===void 0)throw new Error(` | ||
| 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. | ||
| `)})(),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)o=e.cache;else{if(t=e.cacheLocation||"memory",!de(t))throw new Error(`Invalid cache location "${t}"`);o=de(t)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?j:De,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(c=>`auth0.${c}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;let i=e.useCookiesForTransactions?this.cookieStorage:Ze;var r;this.scope=P("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new B(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||pe,this.cacheManager=new q(o,o.allKeys?void 0:new Q(o,this.options.clientId),this.nowProvider),this.domainUrl=(r=this.options.domain,/^https?:\/\//.test(r)?r:`https://${r}`),this.tokenIssuer=((c,l)=>c?c.startsWith("https://")?c:`https://${c}/`:`${l}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&t==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new We)}_url(e){let t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||me)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${Y(e)}`)}async _verifyIdToken(e,t,o){let i=await this.nowProvider();return Re({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:o,leeway:this.options.leeway,max_age:(r=this.options.authorizationParams.max_age,typeof r!="string"?r:parseInt(r,10)||void 0),now:i});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,o){let i=ae(N()),r=ae(N()),c=N(),l=(a=>{let s=new Uint8Array(a);return(u=>{let h={"+":"-","/":"_","=":""};return u.replace(/[+/=]/g,(m=>h[m]))})(window.btoa(String.fromCharCode(...Array.from(s))))})(await(async a=>await U().subtle.digest({name:"SHA-256"},new TextEncoder().encode(a)))(c)),d=((a,s,u,h,m,w,g,y)=>Object.assign(Object.assign(Object.assign({client_id:a.clientId},a.authorizationParams),u),{scope:P(s,u.scope),response_type:"code",response_mode:y||"query",state:h,nonce:m,redirect_uri:g||a.authorizationParams.redirect_uri,code_challenge:w,code_challenge_method:"S256"}))(this.options,this.scope,e,i,r,l,e.redirect_uri||this.options.authorizationParams.redirect_uri||o,t?.response_mode),p=this._authorizeUrl(d);return{nonce:r,code_verifier:c,scope:d.scope,audience:d.audience||"default",redirect_uri:d.redirect_uri,state:i,url:p}}async loginWithPopup(e,t){var o;if(e=e||{},!(t=t||{}).popup&&(t.popup=(l=>{let d=window.screenX+(window.innerWidth-400)/2,p=window.screenY+(window.innerHeight-600)/2;return window.open(l,"auth0:authorize:popup",`left=${d},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!t.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");let i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=i.url;let r=await(l=>new Promise(((d,p)=>{let a,s=setInterval((()=>{l.popup&&l.popup.closed&&(clearInterval(s),clearTimeout(u),window.removeEventListener("message",a,!1),p(new J(l.popup)))}),1e3),u=setTimeout((()=>{clearInterval(s),p(new A(l.popup)),window.removeEventListener("message",a,!1)}),1e3*(l.timeoutInSeconds||60));a=function(h){if(h.data&&h.data.type==="authorization_response"){if(clearTimeout(u),clearInterval(s),window.removeEventListener("message",a,!1),l.popup.close(),h.data.response.error)return p(k.fromPayload(h.data.response));d(h.data.response)}},window.addEventListener("message",a)})))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==r.state)throw new k("state_mismatch","Invalid state");let c=((o=e.authorizationParams)===null||o===void 0?void 0:o.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:r.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:c})}async getUser(){var e;let t=await this._getIdTokenFromCache();return(e=t?.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;let t=await this._getIdTokenFromCache();return(e=t?.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var t;let o=he(e),{openUrl:i,fragment:r,appState:c}=o,l=S(o,["openUrl","fragment","appState"]),d=((t=l.authorizationParams)===null||t===void 0?void 0:t.organization)||this.options.authorizationParams.organization,p=await this._prepareAuthorizeUrl(l.authorizationParams||{}),{url:a}=p,s=S(p,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},s),{appState:c}),d&&{organization:d}));let u=r?`${a}#${r}`:a;i?await i(u):window.location.assign(u)}async handleRedirectCallback(e=window.location.href){let t=e.split("?").slice(1);if(t.length===0)throw new Error("There are no query params available for parsing.");let{state:o,code:i,error:r,error_description:c}=(s=>{s.indexOf("#")>-1&&(s=s.substring(0,s.indexOf("#")));let u=new URLSearchParams(s);return{state:u.get("state"),code:u.get("code")||void 0,error:u.get("error")||void 0,error_description:u.get("error_description")||void 0}})(t.join("")),l=this.transactionManager.get();if(!l)throw new k("missing_transaction","Invalid state");if(this.transactionManager.remove(),r)throw new V(r,c||r,o,l.appState);if(!l.code_verifier||l.state&&l.state!==o)throw new k("state_mismatch","Invalid state");let d=l.organization,p=l.nonce,a=l.redirect_uri;return await this._requestToken(Object.assign({audience:l.audience,scope:l.scope,code_verifier:l.code_verifier,grant_type:"authorization_code",code:i},a?{redirect_uri:a}:{}),{nonceIn:p,organization:d}),{appState:l.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var t;let o=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:P(this.scope,(t=e.authorizationParams)===null||t===void 0?void 0:t.scope)})}),i=await((r,c)=>{let l=M[c];return l||(l=r().finally((()=>{delete M[c],l=null})),M[c]=l),l})((()=>this._getTokenSilently(o)),`${this.options.clientId}::${o.authorizationParams.audience}::${o.authorizationParams.scope}`);return e.detailedResponse?i:i?.access_token}async _getTokenSilently(e){let{cacheMode:t}=e,o=S(e,["cacheMode"]);if(t!=="off"){let i=await this._getEntryFromCache({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",clientId:this.options.clientId});if(i)return i}if(t!=="cache-only"){if(!await(async(i,r=3)=>{for(let c=0;c<r;c++)if(await i())return!0;return!1})((()=>X.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new F;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),t!=="off"){let p=await this._getEntryFromCache({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",clientId:this.options.clientId});if(p)return p}let i=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(o):await this._getTokenFromIFrame(o),{id_token:r,access_token:c,oauthTokenScope:l,expires_in:d}=i;return Object.assign(Object.assign({id_token:r,access_token:c},l?{scope:l}:null),{expires_in:d})}finally{await X.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var o;let i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:P(this.scope,(o=e.authorizationParams)===null||o===void 0?void 0:o.scope)})});return t=Object.assign(Object.assign({},Oe),t),await this.loginWithPopup(i,t),(await this.cacheManager.get(new T({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;let t=e.logoutParams||{},{federated:o}=t,i=S(t,["federated"]),r=o?"&federated":"";return this._url(`/v2/logout?${Y(Object.assign({clientId:e.clientId},i))}`)+r}async logout(e={}){let t=he(e),{openUrl:o}=t,i=S(t,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");let r=this._buildLogoutUrl(i);o?await o(r):o!==!1&&window.location.assign(r)}async _getTokenFromIFrame(e){let t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),o=this.cookieStorage.get(this.orgHintCookieName);o&&!t.organization&&(t.organization=o);let{url:i,state:r,nonce:c,code_verifier:l,redirect_uri:d,scope:p,audience:a}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new k("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");let s=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u;try{u=new URL(this.domainUrl).origin}catch{u=this.domainUrl}let h=await((w,g,y=60)=>new Promise(((b,v)=>{let f=window.document.createElement("iframe");f.setAttribute("width","0"),f.setAttribute("height","0"),f.style.display="none";let I=()=>{window.document.body.contains(f)&&(window.document.body.removeChild(f),window.removeEventListener("message",E,!1))},E,K=setTimeout((()=>{v(new F),I()}),1e3*y);E=function(_){if(_.origin!=g||!_.data||_.data.type!=="authorization_response")return;let R=_.source;R&&R.close(),_.data.response.error?v(k.fromPayload(_.data.response)):b(_.data.response),clearTimeout(K),window.removeEventListener("message",E,!1),setTimeout(I,2e3)},window.addEventListener("message",E,!1),window.document.body.appendChild(f),f.setAttribute("src",w)})))(i,u,s);if(r!==h.state)throw new k("state_mismatch","Invalid state");let m=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:l,code:h.code,grant_type:"authorization_code",redirect_uri:d,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:c,organization:t.organization});return Object.assign(Object.assign({},m),{scope:p,oauthTokenScope:m.scope,audience:a})}catch(s){throw s.error==="login_required"&&this.logout({openUrl:!1}),s}}async _getTokenUsingRefreshToken(e){let t=await this.cacheManager.get(new T({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new D(e.authorizationParams.audience||"default",e.authorizationParams.scope)}let o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{let r=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:o}),i&&{timeout:i}));return Object.assign(Object.assign({},r),{scope:e.authorizationParams.scope,oauthTokenScope:r.scope,audience:e.authorizationParams.audience||"default"})}catch(r){if((r.message.indexOf("Missing Refresh Token")>-1||r.message&&r.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw r}}async _saveEntryInCache(e){let{id_token:t,decodedToken:o}=e,i=S(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:o}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(i)}async _getIdTokenFromCache(){let e=this.options.authorizationParams.audience||"default",t=await this.cacheManager.getIdToken(new T({clientId:this.options.clientId,audience:e,scope:this.scope})),o=this.userCache.get("@@user@@");return t&&t.id_token===o?.id_token?o:(this.userCache.set("@@user@@",t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:o}){let i=await this.cacheManager.get(new T({scope:e,audience:t,clientId:o}),60);if(i&&i.access_token){let{access_token:r,oauthTokenScope:c,expires_in:l}=i,d=await this._getIdTokenFromCache();return d&&Object.assign(Object.assign({id_token:d.id_token,access_token:r},c?{scope:c}:null),{expires_in:l})}}async _requestToken(e,t){let{nonceIn:o,organization:i}=t||{},r=await ze(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),c=await this._verifyIdToken(r.id_token,o,i);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},r),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),r.scope?{oauthTokenScope:r.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},r),{decodedToken:c})}async exchangeToken(e){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:P(e.scope,this.scope),audience:e.audience||this.options.authorizationParams.audience})}};async function we(n){let e=new ee(n);return await e.checkSession(),e}var He=n=>{let e=n.closest(".event-planner_hero_input-wrapper");return{wrapper:e,errorEl:e?.querySelector(".event-planner_error"),softErrorEl:e?.querySelector(".event-planner_soft-error"),errorNumberEl:e?.querySelector('[data-el="error_number"]')}};function Me(n,e){if(!e)return!0;try{return new RegExp(`^${e}$`).test(n)}catch{return!0}}function Xe(n,e){return e!==null&&n>0&&n<e}function ne(n,e={}){let t=e.getUIElements||He,{wrapper:o,errorEl:i,softErrorEl:r,errorNumberEl:c}=t(n);if(!o)return!0;o.classList.remove("is-error"),i&&(i.textContent=""),r&&(r.style.display="none");let l=n.value,d=n.getAttribute("pattern"),p=n.getAttribute("min"),a=p!==null?Number(p):null,s=Number(l),u=n.checkValidity()&&Me(l,d);return Xe(s,a)&&r&&c&&(r.style.display="flex",c.textContent=s===1?"1 room":`${s} rooms`,u=!1),!u&&i&&(o.classList.add("is-error"),i.textContent=n.getAttribute("title")||"Invalid input"),u}async function ye(n,e){try{let t=await fetch(`https://${n}/signups/validate_email`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,formUrl:window.location.href,mqlReason:"Sign Up Form",leadSource:"MKT - HE Website"})});return t.status===200?"":(await t.json())?.errors?.[0]||"Something went wrong, please try again."}catch(t){return console.error("Email validation error:",t),"Something went wrong, please try again."}}function ve(n,e){if(n.dataset.liveValidationAttached)return;n.dataset.liveValidationAttached="true";let t=()=>ne(n,e);n.addEventListener("change",t),n.addEventListener("input",t),n.addEventListener("blur",t)}var ie=class{constructor(e,t){W(this,"config");W(this,"inputs");this.config=e,this.inputs=t}async validateFormData(){let e=[],t=!1,o=i=>{let r=i.closest(".form_field-wrapper");return{wrapper:r,errorEl:r?.querySelector(".form_input-error"),softErrorEl:null,errorNumberEl:null}};if(this.inputs)for(let i of this.inputs){let r=i,c=ne(r,{getUIElements:o});if(r.name==="email"&&c){let l=await ye(this.config.apiDomain,r.value);if(l==="")continue;let{wrapper:d,errorEl:p}=o(r);d&&d.classList.add("is-error"),p&&(c=!1,t=!0,p.textContent=l,e.push(l))}if(!c){ve(r,{getUIElements:o}),t=!0;let l=r.name||r.id||"field";e.push(l+" is invalid")}}return t?e:null}async submitForm(e,t={}){let{onSubmitStart:o,onSubmitEnd:i,onValidationError:r,onResponseError:c,onResponseExistingUser:l,onResponseSuccess:d,onResponseUnhandled:p,onServerError:a}=t;try{o?.();let s=await this.validateFormData();if(s&&s.length>0){r?.(s);return}let h=await(await fetch(`https://${this.config.apiDomain}/signups`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json();switch(h.status){case"failure":c?.(h.redirect_url);return;case"existing":l?.(h.redirect_url);return;case"pending":d?.();try{amplitude.track("Signup Form Submitted",{variant:"treatment"}),amplitude.flush()}catch(m){console.error("Amplitude tracking failed:",m)}await this.handlePendingSignup(e.email,h);return;default:p?.("https://engine.com/thank-you");return}}catch(s){a?.(s)}finally{i?.()}}async handlePendingSignup(e,{redirect_url:t,checkEmail:o=!1}){if(o){window.location.href=t||this.config.domain;return}let i=`https://${this.config.domain}/loading?email=${encodeURIComponent(e)}`;await(await we({domain:this.config.auth0Domain,clientId:this.config.auth0ClientId,cacheLocation:"localstorage",useRefreshTokens:!0})).loginWithRedirect({authorizationParams:{client_id:this.config.auth0ClientId,connection:"email",screen_hint:"signup",scope:"openid profile email",login_hint:e,redirect_uri:i}})}};function be(n,e){return new ie(n,e)}var ke={domain:new URL(window.location.href).hostname,apiDomain:"w-api.engine-stg.com",membersDomain:"members.engine-stg.com",auth0Domain:"login.engine-stg.com",auth0ClientId:"0Ac8KtrRduLvdeb1KYlooPK1utFGxL3k"},Ie={domain:new URL(window.location.href).hostname,apiDomain:"w-api.engine.com",membersDomain:"members.engine.com",auth0Domain:"login.engine.com",auth0ClientId:"tp2sX99aXrxoq5SPxI2HmRfuiSiuZmMB"};function _e(n){let e=`; ${document.cookie}`.split("; ");for(let t of e){let[o,i]=t.split("=");if(o===n)return i}return null}function Ve(n){let e=!1,t=n.querySelector('[data-el="email"]'),o=n.querySelector('[data-el="name_fields"]'),i=n.querySelector('input[type="submit"]');function r(){if(!t||!o)return;let d=()=>{e||(e=!0,o.classList.add("let-them-in-form-expanded"))};t.addEventListener("focusin",d),t.addEventListener("click",d),t.addEventListener("keydown",d)}function c(){let d=new FormData(n),p=Object.fromEntries(_e("utm_params")?.replace(/.+/,a=>decodeURIComponent(a)).split("&").map(a=>a.split("="))??[]);return{email:d.get("email")||"",firstName:d.get("first_name")||"",lastName:d.get("last_name")||"",formUrl:window.location.href,mqlReason:d.get("mql_reason")||"",leadSource:d.get("lead_source")||"",...p}}function l(){return{onSubmitStart:function(){i&&(i.setAttribute("disabled","true"),i.value="Please wait...")},onSubmitEnd:function(){i&&(i.removeAttribute("disabled"),i.value="Get started")},onValidationError:function(d){console.log("Validation errors:",d)},onResponseUnhandled:function(d){window.location.href=d},onResponseExistingUser:function(d){window.location.href=d},onServerError:function(d){console.error("Call to server failed:",d)},onResponseError:function(d){window.location.href=d},onResponseSuccess:function(){console.log("Redirecting to Auth0 for signup completion")}}}return r(),{extractFormData:c,getDefaultCallbacks:l}}function Ae(n,e){switch(e){case 0:return n.getDefaultCallbacks();default:return{onSubmitStart:function(){console.log("Form",e,"submit started")},onSubmitEnd:function(){console.log("Form",e,"submit ended")},onValidationError:function(t){console.log("Form",e,"validation errors:",t)},onResponseUnhandled:function(t){console.log("Form",e,"unhandled response:",t)},onResponseError:function(t){console.log("Form",e,"response returned error. We should redirect to:",t)},onResponseExistingUser:function(t){console.log("Form",e,"response returned existing user. We should redirect to:",t)},onServerError:function(t){console.log("Form",e,"call to server failed:",t)},onResponseSuccess:function(){console.log("Form",e,"response returned pending status, which means we move to Auth0 for signup completion")}}}}function Je(){return window.location.hostname.includes("engine.com")?Ie:ke}function Ge(n,e){n.setAttribute("novalidate","true");let t=n.querySelectorAll('input:not([type="submit"]):not([name="end_date"]):not([name="date-range"]), textarea, select'),o=Ve(n),i=be(Je(),t),r=Ae(o,e);n.addEventListener("submit",function(c){c.preventDefault();let l=o.extractFormData();i.submitForm(l,r)}),console.log("LTI form initialized:",n.getAttribute("data-form-type")||"default")}document.addEventListener("DOMContentLoaded",function(){let n=document.querySelectorAll('[data-el="let_them_in_form"]'),e=Array.from(n).filter(function(t){return t.tagName==="FORM"});e.length!==0&&e.forEach(function(t,o){Ge(t,o)})});})(); | ||
| `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||"memory",!he(t))throw new Error(`Invalid cache location "${t}"`);n=he(t)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?j:De,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(c=>`auth0.${c}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;let i=e.useCookiesForTransactions?this.cookieStorage:Ze;var r;this.scope=P("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new B(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||fe,this.cacheManager=new q(n,n.allKeys?void 0:new Q(n,this.options.clientId),this.nowProvider),this.domainUrl=(r=this.options.domain,/^https?:\/\//.test(r)?r:`https://${r}`),this.tokenIssuer=((c,l)=>c?c.startsWith("https://")?c:`https://${c}/`:`${l}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&t==="memory"&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new We)}_url(e){let t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||pe)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${Y(e)}`)}async _verifyIdToken(e,t,n){let i=await this.nowProvider();return Re({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(r=this.options.authorizationParams.max_age,typeof r!="string"?r:parseInt(r,10)||void 0),now:i});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,n){let i=se(N()),r=se(N()),c=N(),l=(a=>{let s=new Uint8Array(a);return(u=>{let h={"+":"-","/":"_","=":""};return u.replace(/[+/=]/g,(m=>h[m]))})(window.btoa(String.fromCharCode(...Array.from(s))))})(await(async a=>await U().subtle.digest({name:"SHA-256"},new TextEncoder().encode(a)))(c)),d=((a,s,u,h,m,w,g,y)=>Object.assign(Object.assign(Object.assign({client_id:a.clientId},a.authorizationParams),u),{scope:P(s,u.scope),response_type:"code",response_mode:y||"query",state:h,nonce:m,redirect_uri:g||a.authorizationParams.redirect_uri,code_challenge:w,code_challenge_method:"S256"}))(this.options,this.scope,e,i,r,l,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,t?.response_mode),p=this._authorizeUrl(d);return{nonce:r,code_verifier:c,scope:d.scope,audience:d.audience||"default",redirect_uri:d.redirect_uri,state:i,url:p}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(l=>{let d=window.screenX+(window.innerWidth-400)/2,p=window.screenY+(window.innerHeight-600)/2;return window.open(l,"auth0:authorize:popup",`left=${d},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!t.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");let i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=i.url;let r=await(l=>new Promise(((d,p)=>{let a,s=setInterval((()=>{l.popup&&l.popup.closed&&(clearInterval(s),clearTimeout(u),window.removeEventListener("message",a,!1),p(new J(l.popup)))}),1e3),u=setTimeout((()=>{clearInterval(s),p(new A(l.popup)),window.removeEventListener("message",a,!1)}),1e3*(l.timeoutInSeconds||60));a=function(h){if(h.data&&h.data.type==="authorization_response"){if(clearTimeout(u),clearInterval(s),window.removeEventListener("message",a,!1),l.popup.close(),h.data.response.error)return p(k.fromPayload(h.data.response));d(h.data.response)}},window.addEventListener("message",a)})))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==r.state)throw new k("state_mismatch","Invalid state");let c=((n=e.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:r.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:c})}async getUser(){var e;let t=await this._getIdTokenFromCache();return(e=t?.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;let t=await this._getIdTokenFromCache();return(e=t?.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var t;let n=me(e),{openUrl:i,fragment:r,appState:c}=n,l=S(n,["openUrl","fragment","appState"]),d=((t=l.authorizationParams)===null||t===void 0?void 0:t.organization)||this.options.authorizationParams.organization,p=await this._prepareAuthorizeUrl(l.authorizationParams||{}),{url:a}=p,s=S(p,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},s),{appState:c}),d&&{organization:d}));let u=r?`${a}#${r}`:a;i?await i(u):window.location.assign(u)}async handleRedirectCallback(e=window.location.href){let t=e.split("?").slice(1);if(t.length===0)throw new Error("There are no query params available for parsing.");let{state:n,code:i,error:r,error_description:c}=(s=>{s.indexOf("#")>-1&&(s=s.substring(0,s.indexOf("#")));let u=new URLSearchParams(s);return{state:u.get("state"),code:u.get("code")||void 0,error:u.get("error")||void 0,error_description:u.get("error_description")||void 0}})(t.join("")),l=this.transactionManager.get();if(!l)throw new k("missing_transaction","Invalid state");if(this.transactionManager.remove(),r)throw new V(r,c||r,n,l.appState);if(!l.code_verifier||l.state&&l.state!==n)throw new k("state_mismatch","Invalid state");let d=l.organization,p=l.nonce,a=l.redirect_uri;return await this._requestToken(Object.assign({audience:l.audience,scope:l.scope,code_verifier:l.code_verifier,grant_type:"authorization_code",code:i},a?{redirect_uri:a}:{}),{nonceIn:p,organization:d}),{appState:l.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var t;let n=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:P(this.scope,(t=e.authorizationParams)===null||t===void 0?void 0:t.scope)})}),i=await((r,c)=>{let l=M[c];return l||(l=r().finally((()=>{delete M[c],l=null})),M[c]=l),l})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?i:i?.access_token}async _getTokenSilently(e){let{cacheMode:t}=e,n=S(e,["cacheMode"]);if(t!=="off"){let i=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(i)return i}if(t!=="cache-only"){if(!await(async(i,r=3)=>{for(let c=0;c<r;c++)if(await i())return!0;return!1})((()=>X.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new F;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),t!=="off"){let p=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",clientId:this.options.clientId});if(p)return p}let i=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,access_token:c,oauthTokenScope:l,expires_in:d}=i;return Object.assign(Object.assign({id_token:r,access_token:c},l?{scope:l}:null),{expires_in:d})}finally{await X.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var n;let i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:P(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope)})});return t=Object.assign(Object.assign({},Oe),t),await this.loginWithPopup(i,t),(await this.cacheManager.get(new T({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;let t=e.logoutParams||{},{federated:n}=t,i=S(t,["federated"]),r=n?"&federated":"";return this._url(`/v2/logout?${Y(Object.assign({clientId:e.clientId},i))}`)+r}async logout(e={}){let t=me(e),{openUrl:n}=t,i=S(t,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");let r=this._buildLogoutUrl(i);n?await n(r):n!==!1&&window.location.assign(r)}async _getTokenFromIFrame(e){let t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);let{url:i,state:r,nonce:c,code_verifier:l,redirect_uri:d,scope:p,audience:a}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new k("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");let s=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u;try{u=new URL(this.domainUrl).origin}catch{u=this.domainUrl}let h=await((w,g,y=60)=>new Promise(((b,v)=>{let f=window.document.createElement("iframe");f.setAttribute("width","0"),f.setAttribute("height","0"),f.style.display="none";let I=()=>{window.document.body.contains(f)&&(window.document.body.removeChild(f),window.removeEventListener("message",E,!1))},E,K=setTimeout((()=>{v(new F),I()}),1e3*y);E=function(_){if(_.origin!=g||!_.data||_.data.type!=="authorization_response")return;let R=_.source;R&&R.close(),_.data.response.error?v(k.fromPayload(_.data.response)):b(_.data.response),clearTimeout(K),window.removeEventListener("message",E,!1),setTimeout(I,2e3)},window.addEventListener("message",E,!1),window.document.body.appendChild(f),f.setAttribute("src",w)})))(i,u,s);if(r!==h.state)throw new k("state_mismatch","Invalid state");let m=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:l,code:h.code,grant_type:"authorization_code",redirect_uri:d,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:c,organization:t.organization});return Object.assign(Object.assign({},m),{scope:p,oauthTokenScope:m.scope,audience:a})}catch(s){throw s.error==="login_required"&&this.logout({openUrl:!1}),s}}async _getTokenUsingRefreshToken(e){let t=await this.cacheManager.get(new T({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new D(e.authorizationParams.audience||"default",e.authorizationParams.scope)}let n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{let r=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),i&&{timeout:i}));return Object.assign(Object.assign({},r),{scope:e.authorizationParams.scope,oauthTokenScope:r.scope,audience:e.authorizationParams.audience||"default"})}catch(r){if((r.message.indexOf("Missing Refresh Token")>-1||r.message&&r.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw r}}async _saveEntryInCache(e){let{id_token:t,decodedToken:n}=e,i=S(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(i)}async _getIdTokenFromCache(){let e=this.options.authorizationParams.audience||"default",t=await this.cacheManager.getIdToken(new T({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get("@@user@@");return t&&t.id_token===n?.id_token?n:(this.userCache.set("@@user@@",t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:n}){let i=await this.cacheManager.get(new T({scope:e,audience:t,clientId:n}),60);if(i&&i.access_token){let{access_token:r,oauthTokenScope:c,expires_in:l}=i,d=await this._getIdTokenFromCache();return d&&Object.assign(Object.assign({id_token:d.id_token,access_token:r},c?{scope:c}:null),{expires_in:l})}}async _requestToken(e,t){let{nonceIn:n,organization:i}=t||{},r=await ze(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),c=await this._verifyIdToken(r.id_token,n,i);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},r),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),r.scope?{oauthTokenScope:r.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},r),{decodedToken:c})}async exchangeToken(e){return this._requestToken({grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:P(e.scope,this.scope),audience:e.audience||this.options.authorizationParams.audience})}};async function ye(o){let e=new ee(o);return await e.checkSession(),e}var He=o=>{let e=o.closest(".event-planner_hero_input-wrapper");return{wrapper:e,errorEl:e?.querySelector(".event-planner_error"),softErrorEl:e?.querySelector(".event-planner_soft-error"),errorNumberEl:e?.querySelector('[data-el="error_number"]')}};function Me(o,e){if(!e)return!0;try{return new RegExp(`^${e}$`).test(o)}catch{return!0}}function Xe(o,e){return e!==null&&o>0&&o<e}function oe(o,e={}){let t=e.getUIElements||He,{wrapper:n,errorEl:i,softErrorEl:r,errorNumberEl:c}=t(o);if(!n)return!0;n.classList.remove("is-error"),i&&(i.textContent=""),r&&(r.style.display="none");let l=o.value,d=o.getAttribute("pattern"),p=o.getAttribute("min"),a=p!==null?Number(p):null,s=Number(l),u=o.checkValidity()&&Me(l,d);return Xe(s,a)&&r&&c&&(r.style.display="flex",c.textContent=s===1?"1 room":`${s} rooms`,u=!1),!u&&i&&(n.classList.add("is-error"),i.textContent=o.getAttribute("title")||"Invalid input"),u}async function ve(o,e){try{let t=await fetch(`https://${o}/signups/validate_email`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,formUrl:window.location.href,mqlReason:"Sign Up Form",leadSource:"MKT - HE Website"})});return t.status===200?"":(await t.json())?.errors?.[0]||"Something went wrong, please try again."}catch(t){return console.error("Email validation error:",t),"Something went wrong, please try again."}}function be(o,e){if(o.dataset.liveValidationAttached)return;o.dataset.liveValidationAttached="true";let t=()=>oe(o,e);o.addEventListener("change",t),o.addEventListener("input",t),o.addEventListener("blur",t)}var ie=class{constructor(e,t){W(this,"config");W(this,"inputs");this.config=e,this.inputs=t}async validateFormData(){let e=[],t=!1,n=i=>{let r=i.closest(".form_field-wrapper");return{wrapper:r,errorEl:r?.querySelector(".form_input-error"),softErrorEl:null,errorNumberEl:null}};if(this.inputs)for(let i of this.inputs){let r=i,c=oe(r,{getUIElements:n});if(r.name==="email"&&c){let l=await ve(this.config.apiDomain,r.value);if(l==="")continue;let{wrapper:d,errorEl:p}=n(r);d&&d.classList.add("is-error"),p&&(c=!1,t=!0,p.textContent=l,e.push(l))}if(!c){be(r,{getUIElements:n}),t=!0;let l=r.name||r.id||"field";e.push(l+" is invalid")}}return t?e:null}async submitForm(e,t={}){let{onSubmitStart:n,onSubmitEnd:i,onValidationError:r,onResponseError:c,onResponseExistingUser:l,onResponseSuccess:d,onResponseUnhandled:p,onServerError:a}=t;try{n?.();let s=await this.validateFormData();if(s&&s.length>0){r?.(s);return}let h=await(await fetch(`https://${this.config.apiDomain}/signups`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json();switch(h.status){case"failure":c?.(h.redirect_url);return;case"existing":l?.(h.redirect_url);return;case"pending":d?.();try{amplitude.track("Signup Form Submitted",{variant:"treatment"}),amplitude.flush()}catch(m){console.error("Amplitude tracking failed:",m)}await this.handlePendingSignup(e.email,h);return;default:p?.("https://engine.com/thank-you");return}}catch(s){a?.(s)}finally{i?.()}}async handlePendingSignup(e,{redirect_url:t,checkEmail:n=!1}){if(n){window.location.href=t||this.config.domain;return}let i=`https://${this.config.domain}/loading?email=${encodeURIComponent(e)}`;await(await ye({domain:this.config.auth0Domain,clientId:this.config.auth0ClientId,cacheLocation:"localstorage",useRefreshTokens:!0})).loginWithRedirect({authorizationParams:{client_id:this.config.auth0ClientId,connection:"email",screen_hint:"signup",scope:"openid profile email",login_hint:e,redirect_uri:i}})}};function ke(o,e){return new ie(o,e)}var Ie={domain:new URL(window.location.href).hostname,apiDomain:"w-api.engine-stg.com",membersDomain:"members.engine-stg.com",auth0Domain:"login.engine-stg.com",auth0ClientId:"0Ac8KtrRduLvdeb1KYlooPK1utFGxL3k"},_e={domain:new URL(window.location.href).hostname,apiDomain:"w-api.engine.com",membersDomain:"members.engine.com",auth0Domain:"login.engine.com",auth0ClientId:"tp2sX99aXrxoq5SPxI2HmRfuiSiuZmMB"};function re(o){let e=`; ${document.cookie}`.split("; ");for(let t of e){let[n,i]=t.split("=");if(n===o)return i}return null}function Ve(o){let e=!1,t=o.querySelector('[data-el="email"]'),n=o.querySelector('[data-el="name_fields"]'),i=o.querySelector('input[type="submit"]');function r(){if(!t||!n)return;let d=()=>{e||(e=!0,n.classList.add("let-them-in-form-expanded"))};t.addEventListener("focusin",d),t.addEventListener("click",d),t.addEventListener("keydown",d)}function c(){let d=new FormData(o),p=Object.fromEntries(re("utm_params")?.replace(/.+/,s=>decodeURIComponent(s)).split("&").map(s=>s.split("="))??[]),a=re("firstPageSeen");return{email:d.get("email")||"",firstName:d.get("first_name")||"",lastName:d.get("last_name")||"",formUrl:window.location.href,mqlReason:d.get("mql_reason")||"",leadSource:d.get("lead_source")||"",firstPageSeen:a,...p}}function l(){return{onSubmitStart:function(){i&&(i.setAttribute("disabled","true"),i.value="Please wait...")},onSubmitEnd:function(){i&&(i.removeAttribute("disabled"),i.value="Get started")},onValidationError:function(d){console.log("Validation errors:",d)},onResponseUnhandled:function(d){window.location.href=d},onResponseExistingUser:function(d){window.location.href=d},onServerError:function(d){console.error("Call to server failed:",d)},onResponseError:function(d){window.location.href=d},onResponseSuccess:function(){console.log("Redirecting to Auth0 for signup completion")}}}return r(),{extractFormData:c,getDefaultCallbacks:l}}function Ae(o,e){switch(e){case 0:return o.getDefaultCallbacks();default:return{onSubmitStart:function(){console.log("Form",e,"submit started")},onSubmitEnd:function(){console.log("Form",e,"submit ended")},onValidationError:function(t){console.log("Form",e,"validation errors:",t)},onResponseUnhandled:function(t){console.log("Form",e,"unhandled response:",t)},onResponseError:function(t){console.log("Form",e,"response returned error. We should redirect to:",t)},onResponseExistingUser:function(t){console.log("Form",e,"response returned existing user. We should redirect to:",t)},onServerError:function(t){console.log("Form",e,"call to server failed:",t)},onResponseSuccess:function(){console.log("Form",e,"response returned pending status, which means we move to Auth0 for signup completion")}}}}function Je(){return window.location.hostname.includes("engine.com")?_e:Ie}function Ge(o,e){o.setAttribute("novalidate","true");let t=o.querySelectorAll('input:not([type="submit"]):not([name="end_date"]):not([name="date-range"]), textarea, select'),n=Ve(o),i=ke(Je(),t),r=Ae(n,e);o.addEventListener("submit",function(c){c.preventDefault();let l=n.extractFormData();i.submitForm(l,r)}),console.log("LTI form initialized:",o.getAttribute("data-form-type")||"default")}document.addEventListener("DOMContentLoaded",function(){let o=document.querySelectorAll('[data-el="let_them_in_form"]'),e=Array.from(o).filter(function(t){return t.tagName==="FORM"});e.length!==0&&e.forEach(function(t,n){Ge(t,n)})});})(); |
+1
-1
| { | ||
| "name": "@engine-web/website", | ||
| "version": "0.6.0", | ||
| "version": "0.6.1", | ||
| "description": "Developer starter template for the Engine Website.", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
5730977
00
-100%