Socket
Socket
Sign inDemoInstall

@auth0/auth0-spa-js

Package Overview
Dependencies
5
Maintainers
36
Versions
89
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.1.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## [v1.1.0](https://github.com/auth0/auth0-spa-js/tree/v1.1.0) (2019-07-15)
**Changed**
- Allow redirect_uri override in loginWithRedirect - https://github.com/auth0/auth0-spa-js/pull/66
- Make options argument for popup and redirect optional - https://github.com/auth0/auth0-spa-js/pull/61
- Mark redirect_uri optional in RedirectLoginOptions - https://github.com/auth0/auth0-spa-js/pull/53
## [v1.0.2](https://github.com/auth0/auth0-spa-js/tree/v1.0.2) (2019-07-02)

@@ -2,0 +10,0 @@

12

dist/auth0-spa-js.development.js

@@ -1162,3 +1162,3 @@ (function (global, factory) {

var version = '1.0.2';
var version = '1.1.0';

@@ -1186,3 +1186,3 @@ /**

return Object.assign({}, withoutDomain, authorizeOptions, { scope: getUniqueScopes(this.DEFAULT_SCOPE, this.options.scope, authorizeOptions.scope), response_type: 'code', response_mode: 'query', state,
nonce, redirect_uri: this.options.redirect_uri || redirect_uri, code_challenge, code_challenge_method: 'S256' });
nonce, redirect_uri: redirect_uri || this.options.redirect_uri, code_challenge, code_challenge_method: 'S256' });
}

@@ -1217,3 +1217,3 @@ _authorizeUrl(authorizeOptions) {

*/
loginWithPopup(options) {
loginWithPopup(options = {}) {
return __awaiter(this, void 0, void 0, function* () {

@@ -1227,3 +1227,3 @@ const popup = yield openPopup();

const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, window.location.origin);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, this.options.redirect_uri || window.location.origin);
const url = this._authorizeUrl(Object.assign({}, params, { response_mode: 'web_message' }));

@@ -1297,3 +1297,3 @@ const codeResult = yield runPopup(popup, url);

*/
loginWithRedirect(options) {
loginWithRedirect(options = {}) {
return __awaiter(this, void 0, void 0, function* () {

@@ -1392,3 +1392,3 @@ const { redirect_uri, appState } = options, authorizeOptions = __rest(options, ["redirect_uri", "appState"]);

};
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, window.location.origin);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, this.options.redirect_uri || window.location.origin);
const url = this._authorizeUrl(Object.assign({}, params, { prompt: 'none', response_mode: 'web_message' }));

@@ -1395,0 +1395,0 @@ const codeResult = yield runIframe(url, this.domainUrl);

@@ -1,2 +0,2 @@

function e(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function t(e,t,r,o){return new(r||(r=Promise))(function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){function t(e){if("utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+e+"') is invalid.")}function r(e,t){if(t=void 0===t?{fatal:!1}:t,"utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+e+"') is invalid.");if(t.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(e.TextEncoder&&e.TextDecoder)return!1;Object.defineProperty(t.prototype,"encoding",{value:"utf-8"}),t.prototype.encode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");t=0;for(var r=e.length,o=0,n=Math.max(32,r+(r>>1)+7),i=new Uint8Array(n>>3<<3);t<r;){var a=e.charCodeAt(t++);if(55296<=a&&56319>=a){if(t<r){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,a=((1023&a)<<10)+(1023&s)+65536)}if(55296<=a&&56319>=a)continue}if(o+4>i.length&&(n+=8,n=(n*=1+t/e.length*2)>>3<<3,(s=new Uint8Array(n)).set(i),i=s),0==(4294967168&a))i[o++]=a;else{if(0==(4294965248&a))i[o++]=a>>6&31|192;else if(0==(4294901760&a))i[o++]=a>>12&15|224,i[o++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;i[o++]=a>>18&7|240,i[o++]=a>>12&63|128,i[o++]=a>>6&63|128}i[o++]=63&a|128}}return i.slice(0,o)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1}),r.prototype.decode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");t=0;for(var r=(e=new Uint8Array(e)).length,o=[];t<r;){var n=e[t++];if(0===n)break;if(0==(128&n))o.push(n);else if(192==(224&n)){var i=63&e[t++];o.push((31&n)<<6|i)}else if(224==(240&n)){i=63&e[t++];var a=63&e[t++];o.push((31&n)<<12|i<<6|a)}else if(240==(248&n)){65535<(n=(7&n)<<18|(i=63&e[t++])<<12|(a=63&e[t++])<<6|63&e[t++])&&(n-=65536,o.push(n>>>10&1023|55296),n=56320|1023&n),o.push(n)}}return String.fromCharCode.apply(null,o)},e.TextEncoder=t,e.TextDecoder=r}("undefined"!=typeof window?window:r);var o=Object.prototype.hasOwnProperty,n=Array.isArray,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},s={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var i=t[o],a=i.obj[i.prop],s=Object.keys(a),c=0;c<s.length;++c){var l=s[c],d=a[l];"object"==typeof d&&null!==d&&-1===r.indexOf(d)&&(t.push({obj:a,prop:l}),r.push(d))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(n(r)){for(var o=[],i=0;i<r.length;++i)void 0!==r[i]&&o.push(r[i]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r){if(0===e.length)return e;var o="string"==typeof e?e:String(e);if("iso-8859-1"===r)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var n="",a=0;a<o.length;++a){var s=o.charCodeAt(a);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?n+=o.charAt(a):s<128?n+=i[s]:s<2048?n+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?n+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(a+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(a)),n+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return n},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(n(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return n(t)&&!n(r)&&(s=a(t,i)),n(t)&&n(r)?(r.forEach(function(r,n){if(o.call(t,n)){var a=t[n];a&&"object"==typeof a&&r&&"object"==typeof r?t[n]=e(a,r,i):t.push(r)}else t[n]=r}),t):Object.keys(r).reduce(function(t,n){var a=r[n];return o.call(t,n)?t[n]=e(t[n],a,i):t[n]=a,t},s)}},c=String.prototype.replace,l=/%20/g,d={default:"RFC3986",formatters:{RFC1738:function(e){return c.call(e,l,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"},u=Object.prototype.hasOwnProperty,p={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},f=Array.isArray,h=Array.prototype.push,y=function(e,t){h.apply(e,f(t)?t:[t])},m=Date.prototype.toISOString,g={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s.encode,encodeValuesOnly:!1,formatter:d.formatters[d.default],indices:!1,serializeDate:function(e){return m.call(e)},skipNulls:!1,strictNullHandling:!1},v=function e(t,r,o,n,i,a,c,l,d,u,p,h,m){var v=t;if("function"==typeof c?v=c(r,v):v instanceof Date?v=u(v):"comma"===o&&f(v)&&(v=v.join(",")),null===v){if(n)return a&&!h?a(r,g.encoder,m):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||s.isBuffer(v))return a?[p(h?r:a(r,g.encoder,m))+"="+p(a(v,g.encoder,m))]:[p(r)+"="+p(String(v))];var w,b=[];if(void 0===v)return b;if(f(c))w=c;else{var _=Object.keys(v);w=l?_.sort(l):_}for(var O=0;O<w.length;++O){var j=w[O];i&&null===v[j]||(f(v)?y(b,e(v[j],"function"==typeof o?o(r,j):r,o,n,i,a,c,l,d,u,p,h,m)):y(b,e(v[j],r+(d?"."+j:"["+j+"]"),o,n,i,a,c,l,d,u,p,h,m)))}return b},w=Object.prototype.hasOwnProperty,b={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:s.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},O=function(e,t,r){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/g,i=/(\[[^[\]]*])/.exec(o),a=i?o.slice(0,i.index):o,s=[];if(a){if(!r.plainObjects&&w.call(Object.prototype,a)&&!r.allowPrototypes)return;s.push(a)}for(var c=0;null!==(i=n.exec(o))&&c<r.depth;){if(c+=1,!r.plainObjects&&w.call(Object.prototype,i[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(i[1])}return i&&s.push("["+o.slice(i.index)+"]"),function(e,t,r){for(var o=t,n=e.length-1;n>=0;--n){var i,a=e[n];if("[]"===a&&r.parseArrays)i=[].concat(o);else{i=r.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[])[c]=o:i[s]=o:i={0:o}}o=i}return o}(s,t,r)}},j=function(e,t){var r=function(e){if(!e)return b;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?b.charset:e.charset;return{allowDots:void 0===e.allowDots?b.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:b.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:b.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:b.comma,decoder:"function"==typeof e.decoder?e.decoder:b.decoder,delimiter:"string"==typeof e.delimiter||s.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:"number"==typeof e.depth?e.depth:b.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:b.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:b.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:b.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.split(t.delimiter,i),c=-1,l=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?l="utf-8":"utf8=%26%2310003%3B"===a[r]&&(l="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var d,u,p=a[r],f=p.indexOf("]="),h=-1===f?p.indexOf("="):f+1;-1===h?(d=t.decoder(p,b.decoder,l),u=t.strictNullHandling?null:""):(d=t.decoder(p.slice(0,h),b.decoder,l),u=t.decoder(p.slice(h+1),b.decoder,l)),u&&t.interpretNumericEntities&&"iso-8859-1"===l&&(u=_(u)),u&&t.comma&&u.indexOf(",")>-1&&(u=u.split(",")),w.call(o,d)?o[d]=s.combine(o[d],u):o[d]=u}return o}(e,r):e,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var c=i[a],l=O(c,o[c],r);n=s.merge(n,l,r)}return s.compact(n)},E=function(e,t){var r,o=e,n=function(e){if(!e)return g;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||g.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=d.default;if(void 0!==e.format){if(!u.call(d.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=d.formatters[r],n=g.filter;return("function"==typeof e.filter||f(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:g.addQueryPrefix,allowDots:void 0===e.allowDots?g.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:g.charsetSentinel,delimiter:void 0===e.delimiter?g.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:g.encode,encoder:"function"==typeof e.encoder?e.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:g.encodeValuesOnly,filter:n,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:g.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:g.strictNullHandling}}(t);"function"==typeof n.filter?o=(0,n.filter)("",o):f(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)return"";i=t&&t.arrayFormat in p?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=p[i];r||(r=Object.keys(o)),n.sort&&r.sort(n.sort);for(var c=0;c<r.length;++c){var l=r[c];n.skipNulls&&null===o[l]||y(a,v(o[l],l,s,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.formatter,n.encodeValuesOnly,n.charset))}var h=a.join(n.delimiter),m=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),h.length>0?m+h:""};const x={error:"timeout",error_description:"Timeout"},S=(...e)=>{const t=e.filter(Boolean).join();return Array.from(new Set(t.replace(/\s/g,",").split(","))).join(" ").trim()},C=e=>{var t=j(e);return Object.assign({},t,{expires_in:parseInt(t.expires_in)})},T=(e,t)=>new Promise((r,o)=>{var n=window.document.createElement("iframe");n.setAttribute("width","0"),n.setAttribute("height","0"),n.style.display="none";const i=setTimeout(()=>{o(x),window.document.body.removeChild(n)},6e4),a=function(e){e.origin==t&&e.data&&"authorization_response"===e.data.type&&(e.source.close(),e.data.response.error?o(e.data.response):r(e.data.response),clearTimeout(i),window.removeEventListener("message",a,!1),window.document.body.removeChild(n))};window.addEventListener("message",a,!1),window.document.body.appendChild(n),n.setAttribute("src",e)}),U=()=>{const e=window.open("","auth0:authorize:popup","left=100,top=100,width=400,height=600,resizable,scrollbars=yes,status=1");if(!e)throw new Error("Could not open popup");return e},P=(e,t)=>(e.location.href=t,new Promise((t,r)=>{const o=setTimeout(()=>{r(x)},6e4);window.addEventListener("message",n=>{if(n.data&&"authorization_response"===n.data.type){if(clearTimeout(o),e.close(),n.data.response.error)return r(n.data.response);t(n.data.response)}})})),k=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return crypto.getRandomValues(new Uint8Array(43)).forEach(r=>t+=e[r%e.length]),t},A=e=>btoa(e),D=e=>E(e),N=e=>window.crypto.subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e)),I=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),F=e=>(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[\+\/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(new Uint8Array(e))))),L=r=>t(void 0,void 0,void 0,function*(){var{baseUrl:t}=r,o=e(r,["baseUrl"]);return yield fetch(`${t}/oauth/token`,{method:"POST",body:JSON.stringify(Object.assign({grant_type:"authorization_code",redirect_uri:window.location.origin},o)),headers:{"Content-type":"application/json"}}).then(e=>e.json())}),R=e=>`${e.audience}::${e.scope}`,z=(e,t)=>{const r=(new Date(1e3*t).getTime()-(new Date).getTime())/1e3;return 1e3*Math.min(e,r)};class B{constructor(){this.cache={}}save(e){const t=R(e);this.cache[t]=e;const r=z(e.expires_in,e.decodedToken.claims.exp);setTimeout(()=>{delete this.cache[t]},r)}get(e){return this.cache[R(e)]}}var H,$,M=(function(e,t){var o=r&&r.__assign||Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function n(e,t){if(!t)return"";var r="; "+e;return!0===t?r:r+"="+t}function i(e,t,r){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return n("Expires",e.expires?e.expires.toUTCString():"")+n("Domain",e.domain)+n("Path",e.path)+n("Secure",e.secure)+n("SameSite",e.sameSite)}(r)}function a(e){for(var t={},r=e?e.split("; "):[],o=/(%[0-9A-Z]{2})+/g,n=0;n<r.length;n++){var i=r[n].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}function s(){return a(document.cookie)}function c(e,t,r){document.cookie=i(e,t,o({path:"/"},r))}t.__esModule=!0,t.encode=i,t.parse=a,t.getAll=s,t.get=function(e){return s()[e]},t.set=c,t.remove=function(e,t){c(e,"",o({},t,{expires:-1}))}}(H={exports:{}},H.exports),H.exports);($=M)&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")&&$.default;M.encode,M.parse;var Q=M.getAll,V=M.get,J=M.set,W=M.remove;const q=()=>Object.keys(Q()||{}),Z=e=>{const t=V(e);if(void 0!==t)return JSON.parse(t)},G=(e,t,r)=>{J(e,JSON.stringify(t),{expires:r.daysUntilExpire})},K=e=>{W(e)},X="a0.spajs.txs.",Y=e=>`${X}${e}`;class ee{constructor(){this.transactions={},q().filter(e=>e.startsWith(X)).forEach(e=>{const t=e.replace(X,"");this.transactions[t]=Z(e)})}create(e,t){this.transactions[e]=t,G(Y(e),t,{daysUntilExpire:1})}get(e){return this.transactions[e]}remove(e){delete this.transactions[e],K(Y(e))}}const te=["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=e=>{const t=(e=>{const[t,r,o]=e.split("."),n=JSON.parse(I(r)),i={},a={};return Object.keys(n).forEach(e=>{i[e]=n[e],te.includes(e)||(a[e]=n[e])}),{encoded:{header:t,payload:r,signature:o},header:JSON.parse(I(t)),claims:i,user:a}})(e.id_token);if(t.claims.iss!==e.iss)throw new Error("Invalid issuer");if(t.claims.aud!==e.aud)throw new Error("Invalid audience");if("RS256"!==t.header.alg)throw new Error("Invalid algorithm");if(t.claims.nonce!==e.nonce)throw new Error("Invalid nonce");const r=new Date,o=new Date(0),n=new Date(0),i=new Date(0),a=e.leeway||60;if(o.setUTCSeconds(t.claims.exp+a),n.setUTCSeconds(t.claims.iat-a),i.setUTCSeconds(t.claims.nbf-a),r>o)throw new Error("id_token expired");if(r<n)throw new Error("id_token was issued in the future (invalid iat)");if(void 0!==t.claims.nbf&&r<i)throw new Error("token is not yet valid (invalid notBefore)");return t};class oe extends Error{constructor(e,t,r){super(t),this.error=e,this.error_description=t,this.state=r}}var ne="1.0.2";class ie{constructor(e){this.options=e,this.DEFAULT_SCOPE="openid profile email",this.cache=new B,this.transactionManager=new ee,this.domainUrl=`https://${this.options.domain}`}_url(e){const t=encodeURIComponent(btoa(JSON.stringify({name:"auth0-spa-js",version:ne})));return`${this.domainUrl}${e}&auth0Client=${t}`}_getParams(t,r,o,n,i){const a=e(this.options,["domain"]);return Object.assign({},a,t,{scope:S(this.DEFAULT_SCOPE,this.options.scope,t.scope),response_type:"code",response_mode:"query",state:r,nonce:o,redirect_uri:this.options.redirect_uri||i,code_challenge:n,code_challenge_method:"S256"})}_authorizeUrl(e){return this._url(`/authorize?${D(e)}`)}_verifyIdToken(e,t){return re({iss:`${this.domainUrl}/`,aud:this.options.client_id,id_token:e,nonce:t,leeway:this.options.leeway})}loginWithPopup(r){return t(this,void 0,void 0,function*(){const t=yield U(),o=e(r,[]),n=A(k()),i=k(),a=k(),s=yield N(a),c=F(s),l=this._getParams(o,n,i,c,window.location.origin),d=this._authorizeUrl(Object.assign({},l,{response_mode:"web_message"})),u=yield P(t,d);if(n!==u.state)throw new Error("Invalid state");const p=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:a,code:u.code}),f=this._verifyIdToken(p.id_token,i),h=Object.assign({},p,{decodedToken:f,scope:l.scope,audience:l.audience||"default"});this.cache.save(h),G("auth0.is.authenticated",!0,{daysUntilExpire:1})})}getUser(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.user})}getIdTokenClaims(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.claims})}loginWithRedirect(r){return t(this,void 0,void 0,function*(){const{redirect_uri:t,appState:o}=r,n=e(r,["redirect_uri","appState"]),i=A(k()),a=k(),s=k(),c=yield N(s),l=F(c),d=this._getParams(n,i,a,l,t),u=this._authorizeUrl(d);this.transactionManager.create(i,{nonce:a,code_verifier:s,appState:o,scope:d.scope,audience:d.audience||"default"}),window.location.assign(u)})}handleRedirectCallback(){return t(this,void 0,void 0,function*(){if(!window.location.search)throw new Error("There are no query params available at `window.location.search`.");const{state:e,code:t,error:r,error_description:o}=C(window.location.search.substr(1));if(r)throw new oe(r,o,e);const n=this.transactionManager.get(e);if(!n)throw new Error("Invalid state");this.transactionManager.remove(e);const i=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:n.code_verifier,code:t}),a=this._verifyIdToken(i.id_token,n.nonce),s=Object.assign({},i,{decodedToken:a,audience:n.audience,scope:n.scope});return this.cache.save(s),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),{appState:n.appState}})}getTokenSilently(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE,ignoreCache:!1}){return t(this,void 0,void 0,function*(){if(e.scope=S(this.DEFAULT_SCOPE,e.scope),!e.ignoreCache){const t=this.cache.get({scope:e.scope,audience:e.audience||"default"});if(t)return t.access_token}const t=A(k()),r=k(),o=k(),n=yield N(o),i=F(n),a={audience:e.audience,scope:e.scope},s=this._getParams(a,t,r,i,window.location.origin),c=this._authorizeUrl(Object.assign({},s,{prompt:"none",response_mode:"web_message"})),l=yield T(c,this.domainUrl);if(t!==l.state)throw new Error("Invalid state");const d=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:o,code:l.code}),u=this._verifyIdToken(d.id_token,r),p=Object.assign({},d,{decodedToken:u,scope:s.scope,audience:s.audience||"default"});return this.cache.save(p),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),d.access_token})}getTokenWithPopup(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){return e.scope=S(this.DEFAULT_SCOPE,this.options.scope,e.scope),yield this.loginWithPopup(e),this.cache.get({scope:e.scope,audience:e.audience||"default"}).access_token})}isAuthenticated(){return t(this,void 0,void 0,function*(){return!!(yield this.getUser())})}logout(e={}){null!==e.client_id?e.client_id=e.client_id||this.options.client_id:delete e.client_id,K("auth0.is.authenticated");const t=this._url(`/v2/logout?${D(e)}`);window.location.assign(t)}}export default function(e){return t(this,void 0,void 0,function*(){const t=new ie(e);if(!Z("auth0.is.authenticated"))return t;try{yield t.getTokenSilently({audience:e.audience,scope:e.scope,ignoreCache:!0})}catch(e){}return t})}
function e(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(r[o[i]]=e[o[i]])}return r}function t(e,t,r,o){return new(r||(r=Promise))(function(i,n){function a(e){try{c(o.next(e))}catch(e){n(e)}}function s(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){function t(e){if("utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+e+"') is invalid.")}function r(e,t){if(t=void 0===t?{fatal:!1}:t,"utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+e+"') is invalid.");if(t.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(e.TextEncoder&&e.TextDecoder)return!1;Object.defineProperty(t.prototype,"encoding",{value:"utf-8"}),t.prototype.encode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");t=0;for(var r=e.length,o=0,i=Math.max(32,r+(r>>1)+7),n=new Uint8Array(i>>3<<3);t<r;){var a=e.charCodeAt(t++);if(55296<=a&&56319>=a){if(t<r){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,a=((1023&a)<<10)+(1023&s)+65536)}if(55296<=a&&56319>=a)continue}if(o+4>n.length&&(i+=8,i=(i*=1+t/e.length*2)>>3<<3,(s=new Uint8Array(i)).set(n),n=s),0==(4294967168&a))n[o++]=a;else{if(0==(4294965248&a))n[o++]=a>>6&31|192;else if(0==(4294901760&a))n[o++]=a>>12&15|224,n[o++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;n[o++]=a>>18&7|240,n[o++]=a>>12&63|128,n[o++]=a>>6&63|128}n[o++]=63&a|128}}return n.slice(0,o)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1}),r.prototype.decode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");t=0;for(var r=(e=new Uint8Array(e)).length,o=[];t<r;){var i=e[t++];if(0===i)break;if(0==(128&i))o.push(i);else if(192==(224&i)){var n=63&e[t++];o.push((31&i)<<6|n)}else if(224==(240&i)){n=63&e[t++];var a=63&e[t++];o.push((31&i)<<12|n<<6|a)}else if(240==(248&i)){65535<(i=(7&i)<<18|(n=63&e[t++])<<12|(a=63&e[t++])<<6|63&e[t++])&&(i-=65536,o.push(i>>>10&1023|55296),i=56320|1023&i),o.push(i)}}return String.fromCharCode.apply(null,o)},e.TextEncoder=t,e.TextDecoder=r}("undefined"!=typeof window?window:r);var o=Object.prototype.hasOwnProperty,i=Array.isArray,n=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},s={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var n=t[o],a=n.obj[n.prop],s=Object.keys(a),c=0;c<s.length;++c){var l=s[c],d=a[l];"object"==typeof d&&null!==d&&-1===r.indexOf(d)&&(t.push({obj:a,prop:l}),r.push(d))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(i(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r){if(0===e.length)return e;var o="string"==typeof e?e:String(e);if("iso-8859-1"===r)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",a=0;a<o.length;++a){var s=o.charCodeAt(a);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?i+=o.charAt(a):s<128?i+=n[s]:s<2048?i+=n[192|s>>6]+n[128|63&s]:s<55296||s>=57344?i+=n[224|s>>12]+n[128|s>>6&63]+n[128|63&s]:(a+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(a)),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|63&s])}return i},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(i(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return i(t)&&!i(r)&&(s=a(t,n)),i(t)&&i(r)?(r.forEach(function(r,i){if(o.call(t,i)){var a=t[i];a&&"object"==typeof a&&r&&"object"==typeof r?t[i]=e(a,r,n):t.push(r)}else t[i]=r}),t):Object.keys(r).reduce(function(t,i){var a=r[i];return o.call(t,i)?t[i]=e(t[i],a,n):t[i]=a,t},s)}},c=String.prototype.replace,l=/%20/g,d={default:"RFC3986",formatters:{RFC1738:function(e){return c.call(e,l,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"},u=Object.prototype.hasOwnProperty,p={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},f=Array.isArray,h=Array.prototype.push,y=function(e,t){h.apply(e,f(t)?t:[t])},m=Date.prototype.toISOString,g={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s.encode,encodeValuesOnly:!1,formatter:d.formatters[d.default],indices:!1,serializeDate:function(e){return m.call(e)},skipNulls:!1,strictNullHandling:!1},v=function e(t,r,o,i,n,a,c,l,d,u,p,h,m){var v=t;if("function"==typeof c?v=c(r,v):v instanceof Date?v=u(v):"comma"===o&&f(v)&&(v=v.join(",")),null===v){if(i)return a&&!h?a(r,g.encoder,m):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||s.isBuffer(v))return a?[p(h?r:a(r,g.encoder,m))+"="+p(a(v,g.encoder,m))]:[p(r)+"="+p(String(v))];var w,b=[];if(void 0===v)return b;if(f(c))w=c;else{var _=Object.keys(v);w=l?_.sort(l):_}for(var O=0;O<w.length;++O){var j=w[O];n&&null===v[j]||(f(v)?y(b,e(v[j],"function"==typeof o?o(r,j):r,o,i,n,a,c,l,d,u,p,h,m)):y(b,e(v[j],r+(d?"."+j:"["+j+"]"),o,i,n,a,c,l,d,u,p,h,m)))}return b},w=Object.prototype.hasOwnProperty,b={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:s.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},O=function(e,t,r){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,n=/(\[[^[\]]*])/.exec(o),a=n?o.slice(0,n.index):o,s=[];if(a){if(!r.plainObjects&&w.call(Object.prototype,a)&&!r.allowPrototypes)return;s.push(a)}for(var c=0;null!==(n=i.exec(o))&&c<r.depth;){if(c+=1,!r.plainObjects&&w.call(Object.prototype,n[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(n[1])}return n&&s.push("["+o.slice(n.index)+"]"),function(e,t,r){for(var o=t,i=e.length-1;i>=0;--i){var n,a=e[i];if("[]"===a&&r.parseArrays)n=[].concat(o);else{n=r.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(n=[])[c]=o:n[s]=o:n={0:o}}o=n}return o}(s,t,r)}},j=function(e,t){var r=function(e){if(!e)return b;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?b.charset:e.charset;return{allowDots:void 0===e.allowDots?b.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:b.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:b.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:b.comma,decoder:"function"==typeof e.decoder?e.decoder:b.decoder,delimiter:"string"==typeof e.delimiter||s.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:"number"==typeof e.depth?e.depth:b.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:b.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:b.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:b.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=t.parameterLimit===1/0?void 0:t.parameterLimit,a=i.split(t.delimiter,n),c=-1,l=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?l="utf-8":"utf8=%26%2310003%3B"===a[r]&&(l="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var d,u,p=a[r],f=p.indexOf("]="),h=-1===f?p.indexOf("="):f+1;-1===h?(d=t.decoder(p,b.decoder,l),u=t.strictNullHandling?null:""):(d=t.decoder(p.slice(0,h),b.decoder,l),u=t.decoder(p.slice(h+1),b.decoder,l)),u&&t.interpretNumericEntities&&"iso-8859-1"===l&&(u=_(u)),u&&t.comma&&u.indexOf(",")>-1&&(u=u.split(",")),w.call(o,d)?o[d]=s.combine(o[d],u):o[d]=u}return o}(e,r):e,i=r.plainObjects?Object.create(null):{},n=Object.keys(o),a=0;a<n.length;++a){var c=n[a],l=O(c,o[c],r);i=s.merge(i,l,r)}return s.compact(i)},E=function(e,t){var r,o=e,i=function(e){if(!e)return g;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||g.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=d.default;if(void 0!==e.format){if(!u.call(d.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=d.formatters[r],i=g.filter;return("function"==typeof e.filter||f(e.filter))&&(i=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:g.addQueryPrefix,allowDots:void 0===e.allowDots?g.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:g.charsetSentinel,delimiter:void 0===e.delimiter?g.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:g.encode,encoder:"function"==typeof e.encoder?e.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:g.encodeValuesOnly,filter:i,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:g.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:g.strictNullHandling}}(t);"function"==typeof i.filter?o=(0,i.filter)("",o):f(i.filter)&&(r=i.filter);var n,a=[];if("object"!=typeof o||null===o)return"";n=t&&t.arrayFormat in p?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=p[n];r||(r=Object.keys(o)),i.sort&&r.sort(i.sort);for(var c=0;c<r.length;++c){var l=r[c];i.skipNulls&&null===o[l]||y(a,v(o[l],l,s,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.formatter,i.encodeValuesOnly,i.charset))}var h=a.join(i.delimiter),m=!0===i.addQueryPrefix?"?":"";return i.charsetSentinel&&("iso-8859-1"===i.charset?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),h.length>0?m+h:""};const x={error:"timeout",error_description:"Timeout"},S=(...e)=>{const t=e.filter(Boolean).join();return Array.from(new Set(t.replace(/\s/g,",").split(","))).join(" ").trim()},C=e=>{var t=j(e);return Object.assign({},t,{expires_in:parseInt(t.expires_in)})},T=(e,t)=>new Promise((r,o)=>{var i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const n=setTimeout(()=>{o(x),window.document.body.removeChild(i)},6e4),a=function(e){e.origin==t&&e.data&&"authorization_response"===e.data.type&&(e.source.close(),e.data.response.error?o(e.data.response):r(e.data.response),clearTimeout(n),window.removeEventListener("message",a,!1),window.document.body.removeChild(i))};window.addEventListener("message",a,!1),window.document.body.appendChild(i),i.setAttribute("src",e)}),U=()=>{const e=window.open("","auth0:authorize:popup","left=100,top=100,width=400,height=600,resizable,scrollbars=yes,status=1");if(!e)throw new Error("Could not open popup");return e},P=(e,t)=>(e.location.href=t,new Promise((t,r)=>{const o=setTimeout(()=>{r(x)},6e4);window.addEventListener("message",i=>{if(i.data&&"authorization_response"===i.data.type){if(clearTimeout(o),e.close(),i.data.response.error)return r(i.data.response);t(i.data.response)}})})),k=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return crypto.getRandomValues(new Uint8Array(43)).forEach(r=>t+=e[r%e.length]),t},A=e=>btoa(e),D=e=>E(e),N=e=>window.crypto.subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e)),I=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),F=e=>(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[\+\/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(new Uint8Array(e))))),L=r=>t(void 0,void 0,void 0,function*(){var{baseUrl:t}=r,o=e(r,["baseUrl"]);return yield fetch(`${t}/oauth/token`,{method:"POST",body:JSON.stringify(Object.assign({grant_type:"authorization_code",redirect_uri:window.location.origin},o)),headers:{"Content-type":"application/json"}}).then(e=>e.json())}),R=e=>`${e.audience}::${e.scope}`,z=(e,t)=>{const r=(new Date(1e3*t).getTime()-(new Date).getTime())/1e3;return 1e3*Math.min(e,r)};class B{constructor(){this.cache={}}save(e){const t=R(e);this.cache[t]=e;const r=z(e.expires_in,e.decodedToken.claims.exp);setTimeout(()=>{delete this.cache[t]},r)}get(e){return this.cache[R(e)]}}var H,$,M=(function(e,t){var o=r&&r.__assign||Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};function i(e,t){if(!t)return"";var r="; "+e;return!0===t?r:r+"="+t}function n(e,t,r){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return i("Expires",e.expires?e.expires.toUTCString():"")+i("Domain",e.domain)+i("Path",e.path)+i("Secure",e.secure)+i("SameSite",e.sameSite)}(r)}function a(e){for(var t={},r=e?e.split("; "):[],o=/(%[0-9A-Z]{2})+/g,i=0;i<r.length;i++){var n=r[i].split("="),a=n.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[n[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}function s(){return a(document.cookie)}function c(e,t,r){document.cookie=n(e,t,o({path:"/"},r))}t.__esModule=!0,t.encode=n,t.parse=a,t.getAll=s,t.get=function(e){return s()[e]},t.set=c,t.remove=function(e,t){c(e,"",o({},t,{expires:-1}))}}(H={exports:{}},H.exports),H.exports);($=M)&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")&&$.default;M.encode,M.parse;var Q=M.getAll,V=M.get,J=M.set,W=M.remove;const q=()=>Object.keys(Q()||{}),Z=e=>{const t=V(e);if(void 0!==t)return JSON.parse(t)},G=(e,t,r)=>{J(e,JSON.stringify(t),{expires:r.daysUntilExpire})},K=e=>{W(e)},X="a0.spajs.txs.",Y=e=>`${X}${e}`;class ee{constructor(){this.transactions={},q().filter(e=>e.startsWith(X)).forEach(e=>{const t=e.replace(X,"");this.transactions[t]=Z(e)})}create(e,t){this.transactions[e]=t,G(Y(e),t,{daysUntilExpire:1})}get(e){return this.transactions[e]}remove(e){delete this.transactions[e],K(Y(e))}}const te=["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=e=>{const t=(e=>{const[t,r,o]=e.split("."),i=JSON.parse(I(r)),n={},a={};return Object.keys(i).forEach(e=>{n[e]=i[e],te.includes(e)||(a[e]=i[e])}),{encoded:{header:t,payload:r,signature:o},header:JSON.parse(I(t)),claims:n,user:a}})(e.id_token);if(t.claims.iss!==e.iss)throw new Error("Invalid issuer");if(t.claims.aud!==e.aud)throw new Error("Invalid audience");if("RS256"!==t.header.alg)throw new Error("Invalid algorithm");if(t.claims.nonce!==e.nonce)throw new Error("Invalid nonce");const r=new Date,o=new Date(0),i=new Date(0),n=new Date(0),a=e.leeway||60;if(o.setUTCSeconds(t.claims.exp+a),i.setUTCSeconds(t.claims.iat-a),n.setUTCSeconds(t.claims.nbf-a),r>o)throw new Error("id_token expired");if(r<i)throw new Error("id_token was issued in the future (invalid iat)");if(void 0!==t.claims.nbf&&r<n)throw new Error("token is not yet valid (invalid notBefore)");return t};class oe extends Error{constructor(e,t,r){super(t),this.error=e,this.error_description=t,this.state=r}}var ie="1.1.0";class ne{constructor(e){this.options=e,this.DEFAULT_SCOPE="openid profile email",this.cache=new B,this.transactionManager=new ee,this.domainUrl=`https://${this.options.domain}`}_url(e){const t=encodeURIComponent(btoa(JSON.stringify({name:"auth0-spa-js",version:ie})));return`${this.domainUrl}${e}&auth0Client=${t}`}_getParams(t,r,o,i,n){const a=e(this.options,["domain"]);return Object.assign({},a,t,{scope:S(this.DEFAULT_SCOPE,this.options.scope,t.scope),response_type:"code",response_mode:"query",state:r,nonce:o,redirect_uri:n||this.options.redirect_uri,code_challenge:i,code_challenge_method:"S256"})}_authorizeUrl(e){return this._url(`/authorize?${D(e)}`)}_verifyIdToken(e,t){return re({iss:`${this.domainUrl}/`,aud:this.options.client_id,id_token:e,nonce:t,leeway:this.options.leeway})}loginWithPopup(r={}){return t(this,void 0,void 0,function*(){const t=yield U(),o=e(r,[]),i=A(k()),n=k(),a=k(),s=yield N(a),c=F(s),l=this._getParams(o,i,n,c,this.options.redirect_uri||window.location.origin),d=this._authorizeUrl(Object.assign({},l,{response_mode:"web_message"})),u=yield P(t,d);if(i!==u.state)throw new Error("Invalid state");const p=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:a,code:u.code}),f=this._verifyIdToken(p.id_token,n),h=Object.assign({},p,{decodedToken:f,scope:l.scope,audience:l.audience||"default"});this.cache.save(h),G("auth0.is.authenticated",!0,{daysUntilExpire:1})})}getUser(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.user})}getIdTokenClaims(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.claims})}loginWithRedirect(r={}){return t(this,void 0,void 0,function*(){const{redirect_uri:t,appState:o}=r,i=e(r,["redirect_uri","appState"]),n=A(k()),a=k(),s=k(),c=yield N(s),l=F(c),d=this._getParams(i,n,a,l,t),u=this._authorizeUrl(d);this.transactionManager.create(n,{nonce:a,code_verifier:s,appState:o,scope:d.scope,audience:d.audience||"default"}),window.location.assign(u)})}handleRedirectCallback(){return t(this,void 0,void 0,function*(){if(!window.location.search)throw new Error("There are no query params available at `window.location.search`.");const{state:e,code:t,error:r,error_description:o}=C(window.location.search.substr(1));if(r)throw new oe(r,o,e);const i=this.transactionManager.get(e);if(!i)throw new Error("Invalid state");this.transactionManager.remove(e);const n=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:i.code_verifier,code:t}),a=this._verifyIdToken(n.id_token,i.nonce),s=Object.assign({},n,{decodedToken:a,audience:i.audience,scope:i.scope});return this.cache.save(s),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),{appState:i.appState}})}getTokenSilently(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE,ignoreCache:!1}){return t(this,void 0,void 0,function*(){if(e.scope=S(this.DEFAULT_SCOPE,e.scope),!e.ignoreCache){const t=this.cache.get({scope:e.scope,audience:e.audience||"default"});if(t)return t.access_token}const t=A(k()),r=k(),o=k(),i=yield N(o),n=F(i),a={audience:e.audience,scope:e.scope},s=this._getParams(a,t,r,n,this.options.redirect_uri||window.location.origin),c=this._authorizeUrl(Object.assign({},s,{prompt:"none",response_mode:"web_message"})),l=yield T(c,this.domainUrl);if(t!==l.state)throw new Error("Invalid state");const d=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:o,code:l.code}),u=this._verifyIdToken(d.id_token,r),p=Object.assign({},d,{decodedToken:u,scope:s.scope,audience:s.audience||"default"});return this.cache.save(p),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),d.access_token})}getTokenWithPopup(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){return e.scope=S(this.DEFAULT_SCOPE,this.options.scope,e.scope),yield this.loginWithPopup(e),this.cache.get({scope:e.scope,audience:e.audience||"default"}).access_token})}isAuthenticated(){return t(this,void 0,void 0,function*(){return!!(yield this.getUser())})}logout(e={}){null!==e.client_id?e.client_id=e.client_id||this.options.client_id:delete e.client_id,K("auth0.is.authenticated");const t=this._url(`/v2/logout?${D(e)}`);window.location.assign(t)}}export default function(e){return t(this,void 0,void 0,function*(){const t=new ne(e);if(!Z("auth0.is.authenticated"))return t;try{yield t.getTokenSilently({audience:e.audience,scope:e.scope,ignoreCache:!0})}catch(e){}return t})}
//# sourceMappingURL=auth0-spa-js.production.esm.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).createAuth0Client=t()}(this,function(){"use strict";function e(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function t(e,t,r,o){return new(r||(r=Promise))(function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){function t(e){if("utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+e+"') is invalid.")}function r(e,t){if(t=void 0===t?{fatal:!1}:t,"utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+e+"') is invalid.");if(t.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(e.TextEncoder&&e.TextDecoder)return!1;Object.defineProperty(t.prototype,"encoding",{value:"utf-8"}),t.prototype.encode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");t=0;for(var r=e.length,o=0,n=Math.max(32,r+(r>>1)+7),i=new Uint8Array(n>>3<<3);t<r;){var a=e.charCodeAt(t++);if(55296<=a&&56319>=a){if(t<r){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,a=((1023&a)<<10)+(1023&s)+65536)}if(55296<=a&&56319>=a)continue}if(o+4>i.length&&(n+=8,n=(n*=1+t/e.length*2)>>3<<3,(s=new Uint8Array(n)).set(i),i=s),0==(4294967168&a))i[o++]=a;else{if(0==(4294965248&a))i[o++]=a>>6&31|192;else if(0==(4294901760&a))i[o++]=a>>12&15|224,i[o++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;i[o++]=a>>18&7|240,i[o++]=a>>12&63|128,i[o++]=a>>6&63|128}i[o++]=63&a|128}}return i.slice(0,o)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1}),r.prototype.decode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");t=0;for(var r=(e=new Uint8Array(e)).length,o=[];t<r;){var n=e[t++];if(0===n)break;if(0==(128&n))o.push(n);else if(192==(224&n)){var i=63&e[t++];o.push((31&n)<<6|i)}else if(224==(240&n)){i=63&e[t++];var a=63&e[t++];o.push((31&n)<<12|i<<6|a)}else if(240==(248&n)){65535<(n=(7&n)<<18|(i=63&e[t++])<<12|(a=63&e[t++])<<6|63&e[t++])&&(n-=65536,o.push(n>>>10&1023|55296),n=56320|1023&n),o.push(n)}}return String.fromCharCode.apply(null,o)},e.TextEncoder=t,e.TextDecoder=r}("undefined"!=typeof window?window:r);var o=Object.prototype.hasOwnProperty,n=Array.isArray,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},s={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var i=t[o],a=i.obj[i.prop],s=Object.keys(a),c=0;c<s.length;++c){var l=s[c],d=a[l];"object"==typeof d&&null!==d&&-1===r.indexOf(d)&&(t.push({obj:a,prop:l}),r.push(d))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(n(r)){for(var o=[],i=0;i<r.length;++i)void 0!==r[i]&&o.push(r[i]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r){if(0===e.length)return e;var o="string"==typeof e?e:String(e);if("iso-8859-1"===r)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var n="",a=0;a<o.length;++a){var s=o.charCodeAt(a);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?n+=o.charAt(a):s<128?n+=i[s]:s<2048?n+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?n+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(a+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(a)),n+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return n},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(n(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return n(t)&&!n(r)&&(s=a(t,i)),n(t)&&n(r)?(r.forEach(function(r,n){if(o.call(t,n)){var a=t[n];a&&"object"==typeof a&&r&&"object"==typeof r?t[n]=e(a,r,i):t.push(r)}else t[n]=r}),t):Object.keys(r).reduce(function(t,n){var a=r[n];return o.call(t,n)?t[n]=e(t[n],a,i):t[n]=a,t},s)}},c=String.prototype.replace,l=/%20/g,d={default:"RFC3986",formatters:{RFC1738:function(e){return c.call(e,l,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"},u=Object.prototype.hasOwnProperty,p={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},f=Array.isArray,h=Array.prototype.push,y=function(e,t){h.apply(e,f(t)?t:[t])},m=Date.prototype.toISOString,g={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s.encode,encodeValuesOnly:!1,formatter:d.formatters[d.default],indices:!1,serializeDate:function(e){return m.call(e)},skipNulls:!1,strictNullHandling:!1},v=function e(t,r,o,n,i,a,c,l,d,u,p,h,m){var v=t;if("function"==typeof c?v=c(r,v):v instanceof Date?v=u(v):"comma"===o&&f(v)&&(v=v.join(",")),null===v){if(n)return a&&!h?a(r,g.encoder,m):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||s.isBuffer(v))return a?[p(h?r:a(r,g.encoder,m))+"="+p(a(v,g.encoder,m))]:[p(r)+"="+p(String(v))];var w,b=[];if(void 0===v)return b;if(f(c))w=c;else{var _=Object.keys(v);w=l?_.sort(l):_}for(var O=0;O<w.length;++O){var j=w[O];i&&null===v[j]||(f(v)?y(b,e(v[j],"function"==typeof o?o(r,j):r,o,n,i,a,c,l,d,u,p,h,m)):y(b,e(v[j],r+(d?"."+j:"["+j+"]"),o,n,i,a,c,l,d,u,p,h,m)))}return b},w=Object.prototype.hasOwnProperty,b={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:s.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},O=function(e,t,r){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/g,i=/(\[[^[\]]*])/.exec(o),a=i?o.slice(0,i.index):o,s=[];if(a){if(!r.plainObjects&&w.call(Object.prototype,a)&&!r.allowPrototypes)return;s.push(a)}for(var c=0;null!==(i=n.exec(o))&&c<r.depth;){if(c+=1,!r.plainObjects&&w.call(Object.prototype,i[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(i[1])}return i&&s.push("["+o.slice(i.index)+"]"),function(e,t,r){for(var o=t,n=e.length-1;n>=0;--n){var i,a=e[n];if("[]"===a&&r.parseArrays)i=[].concat(o);else{i=r.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[])[c]=o:i[s]=o:i={0:o}}o=i}return o}(s,t,r)}},j=function(e,t){var r=function(e){if(!e)return b;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?b.charset:e.charset;return{allowDots:void 0===e.allowDots?b.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:b.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:b.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:b.comma,decoder:"function"==typeof e.decoder?e.decoder:b.decoder,delimiter:"string"==typeof e.delimiter||s.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:"number"==typeof e.depth?e.depth:b.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:b.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:b.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:b.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.split(t.delimiter,i),c=-1,l=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?l="utf-8":"utf8=%26%2310003%3B"===a[r]&&(l="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var d,u,p=a[r],f=p.indexOf("]="),h=-1===f?p.indexOf("="):f+1;-1===h?(d=t.decoder(p,b.decoder,l),u=t.strictNullHandling?null:""):(d=t.decoder(p.slice(0,h),b.decoder,l),u=t.decoder(p.slice(h+1),b.decoder,l)),u&&t.interpretNumericEntities&&"iso-8859-1"===l&&(u=_(u)),u&&t.comma&&u.indexOf(",")>-1&&(u=u.split(",")),w.call(o,d)?o[d]=s.combine(o[d],u):o[d]=u}return o}(e,r):e,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var c=i[a],l=O(c,o[c],r);n=s.merge(n,l,r)}return s.compact(n)},E=function(e,t){var r,o=e,n=function(e){if(!e)return g;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||g.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=d.default;if(void 0!==e.format){if(!u.call(d.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=d.formatters[r],n=g.filter;return("function"==typeof e.filter||f(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:g.addQueryPrefix,allowDots:void 0===e.allowDots?g.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:g.charsetSentinel,delimiter:void 0===e.delimiter?g.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:g.encode,encoder:"function"==typeof e.encoder?e.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:g.encodeValuesOnly,filter:n,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:g.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:g.strictNullHandling}}(t);"function"==typeof n.filter?o=(0,n.filter)("",o):f(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)return"";i=t&&t.arrayFormat in p?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=p[i];r||(r=Object.keys(o)),n.sort&&r.sort(n.sort);for(var c=0;c<r.length;++c){var l=r[c];n.skipNulls&&null===o[l]||y(a,v(o[l],l,s,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.formatter,n.encodeValuesOnly,n.charset))}var h=a.join(n.delimiter),m=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),h.length>0?m+h:""};const x={error:"timeout",error_description:"Timeout"},S=(...e)=>{const t=e.filter(Boolean).join();return Array.from(new Set(t.replace(/\s/g,",").split(","))).join(" ").trim()},C=e=>{var t=j(e);return Object.assign({},t,{expires_in:parseInt(t.expires_in)})},T=(e,t)=>new Promise((r,o)=>{var n=window.document.createElement("iframe");n.setAttribute("width","0"),n.setAttribute("height","0"),n.style.display="none";const i=setTimeout(()=>{o(x),window.document.body.removeChild(n)},6e4),a=function(e){e.origin==t&&e.data&&"authorization_response"===e.data.type&&(e.source.close(),e.data.response.error?o(e.data.response):r(e.data.response),clearTimeout(i),window.removeEventListener("message",a,!1),window.document.body.removeChild(n))};window.addEventListener("message",a,!1),window.document.body.appendChild(n),n.setAttribute("src",e)}),U=()=>{const e=window.open("","auth0:authorize:popup","left=100,top=100,width=400,height=600,resizable,scrollbars=yes,status=1");if(!e)throw new Error("Could not open popup");return e},P=(e,t)=>(e.location.href=t,new Promise((t,r)=>{const o=setTimeout(()=>{r(x)},6e4);window.addEventListener("message",n=>{if(n.data&&"authorization_response"===n.data.type){if(clearTimeout(o),e.close(),n.data.response.error)return r(n.data.response);t(n.data.response)}})})),k=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return crypto.getRandomValues(new Uint8Array(43)).forEach(r=>t+=e[r%e.length]),t},A=e=>btoa(e),D=e=>E(e),N=e=>window.crypto.subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e)),I=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),F=e=>(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[\+\/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(new Uint8Array(e))))),L=r=>t(void 0,void 0,void 0,function*(){var{baseUrl:t}=r,o=e(r,["baseUrl"]);return yield fetch(`${t}/oauth/token`,{method:"POST",body:JSON.stringify(Object.assign({grant_type:"authorization_code",redirect_uri:window.location.origin},o)),headers:{"Content-type":"application/json"}}).then(e=>e.json())}),R=e=>`${e.audience}::${e.scope}`,z=(e,t)=>{const r=(new Date(1e3*t).getTime()-(new Date).getTime())/1e3;return 1e3*Math.min(e,r)};class B{constructor(){this.cache={}}save(e){const t=R(e);this.cache[t]=e;const r=z(e.expires_in,e.decodedToken.claims.exp);setTimeout(()=>{delete this.cache[t]},r)}get(e){return this.cache[R(e)]}}var H,$,M=(function(e,t){var o=r&&r.__assign||Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function n(e,t){if(!t)return"";var r="; "+e;return!0===t?r:r+"="+t}function i(e,t,r){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return n("Expires",e.expires?e.expires.toUTCString():"")+n("Domain",e.domain)+n("Path",e.path)+n("Secure",e.secure)+n("SameSite",e.sameSite)}(r)}function a(e){for(var t={},r=e?e.split("; "):[],o=/(%[0-9A-Z]{2})+/g,n=0;n<r.length;n++){var i=r[n].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}function s(){return a(document.cookie)}function c(e,t,r){document.cookie=i(e,t,o({path:"/"},r))}t.__esModule=!0,t.encode=i,t.parse=a,t.getAll=s,t.get=function(e){return s()[e]},t.set=c,t.remove=function(e,t){c(e,"",o({},t,{expires:-1}))}}(H={exports:{}},H.exports),H.exports);($=M)&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")&&$.default;M.encode,M.parse;var Q=M.getAll,V=M.get,J=M.set,W=M.remove;const q=()=>Object.keys(Q()||{}),Z=e=>{const t=V(e);if(void 0!==t)return JSON.parse(t)},G=(e,t,r)=>{J(e,JSON.stringify(t),{expires:r.daysUntilExpire})},K=e=>{W(e)},X="a0.spajs.txs.",Y=e=>`${X}${e}`;class ee{constructor(){this.transactions={},q().filter(e=>e.startsWith(X)).forEach(e=>{const t=e.replace(X,"");this.transactions[t]=Z(e)})}create(e,t){this.transactions[e]=t,G(Y(e),t,{daysUntilExpire:1})}get(e){return this.transactions[e]}remove(e){delete this.transactions[e],K(Y(e))}}const te=["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=e=>{const t=(e=>{const[t,r,o]=e.split("."),n=JSON.parse(I(r)),i={},a={};return Object.keys(n).forEach(e=>{i[e]=n[e],te.includes(e)||(a[e]=n[e])}),{encoded:{header:t,payload:r,signature:o},header:JSON.parse(I(t)),claims:i,user:a}})(e.id_token);if(t.claims.iss!==e.iss)throw new Error("Invalid issuer");if(t.claims.aud!==e.aud)throw new Error("Invalid audience");if("RS256"!==t.header.alg)throw new Error("Invalid algorithm");if(t.claims.nonce!==e.nonce)throw new Error("Invalid nonce");const r=new Date,o=new Date(0),n=new Date(0),i=new Date(0),a=e.leeway||60;if(o.setUTCSeconds(t.claims.exp+a),n.setUTCSeconds(t.claims.iat-a),i.setUTCSeconds(t.claims.nbf-a),r>o)throw new Error("id_token expired");if(r<n)throw new Error("id_token was issued in the future (invalid iat)");if(void 0!==t.claims.nbf&&r<i)throw new Error("token is not yet valid (invalid notBefore)");return t};class oe extends Error{constructor(e,t,r){super(t),this.error=e,this.error_description=t,this.state=r}}var ne="1.0.2";class ie{constructor(e){this.options=e,this.DEFAULT_SCOPE="openid profile email",this.cache=new B,this.transactionManager=new ee,this.domainUrl=`https://${this.options.domain}`}_url(e){const t=encodeURIComponent(btoa(JSON.stringify({name:"auth0-spa-js",version:ne})));return`${this.domainUrl}${e}&auth0Client=${t}`}_getParams(t,r,o,n,i){const a=e(this.options,["domain"]);return Object.assign({},a,t,{scope:S(this.DEFAULT_SCOPE,this.options.scope,t.scope),response_type:"code",response_mode:"query",state:r,nonce:o,redirect_uri:this.options.redirect_uri||i,code_challenge:n,code_challenge_method:"S256"})}_authorizeUrl(e){return this._url(`/authorize?${D(e)}`)}_verifyIdToken(e,t){return re({iss:`${this.domainUrl}/`,aud:this.options.client_id,id_token:e,nonce:t,leeway:this.options.leeway})}loginWithPopup(r){return t(this,void 0,void 0,function*(){const t=yield U(),o=e(r,[]),n=A(k()),i=k(),a=k(),s=yield N(a),c=F(s),l=this._getParams(o,n,i,c,window.location.origin),d=this._authorizeUrl(Object.assign({},l,{response_mode:"web_message"})),u=yield P(t,d);if(n!==u.state)throw new Error("Invalid state");const p=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:a,code:u.code}),f=this._verifyIdToken(p.id_token,i),h=Object.assign({},p,{decodedToken:f,scope:l.scope,audience:l.audience||"default"});this.cache.save(h),G("auth0.is.authenticated",!0,{daysUntilExpire:1})})}getUser(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.user})}getIdTokenClaims(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.claims})}loginWithRedirect(r){return t(this,void 0,void 0,function*(){const{redirect_uri:t,appState:o}=r,n=e(r,["redirect_uri","appState"]),i=A(k()),a=k(),s=k(),c=yield N(s),l=F(c),d=this._getParams(n,i,a,l,t),u=this._authorizeUrl(d);this.transactionManager.create(i,{nonce:a,code_verifier:s,appState:o,scope:d.scope,audience:d.audience||"default"}),window.location.assign(u)})}handleRedirectCallback(){return t(this,void 0,void 0,function*(){if(!window.location.search)throw new Error("There are no query params available at `window.location.search`.");const{state:e,code:t,error:r,error_description:o}=C(window.location.search.substr(1));if(r)throw new oe(r,o,e);const n=this.transactionManager.get(e);if(!n)throw new Error("Invalid state");this.transactionManager.remove(e);const i=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:n.code_verifier,code:t}),a=this._verifyIdToken(i.id_token,n.nonce),s=Object.assign({},i,{decodedToken:a,audience:n.audience,scope:n.scope});return this.cache.save(s),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),{appState:n.appState}})}getTokenSilently(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE,ignoreCache:!1}){return t(this,void 0,void 0,function*(){if(e.scope=S(this.DEFAULT_SCOPE,e.scope),!e.ignoreCache){const t=this.cache.get({scope:e.scope,audience:e.audience||"default"});if(t)return t.access_token}const t=A(k()),r=k(),o=k(),n=yield N(o),i=F(n),a={audience:e.audience,scope:e.scope},s=this._getParams(a,t,r,i,window.location.origin),c=this._authorizeUrl(Object.assign({},s,{prompt:"none",response_mode:"web_message"})),l=yield T(c,this.domainUrl);if(t!==l.state)throw new Error("Invalid state");const d=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:o,code:l.code}),u=this._verifyIdToken(d.id_token,r),p=Object.assign({},d,{decodedToken:u,scope:s.scope,audience:s.audience||"default"});return this.cache.save(p),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),d.access_token})}getTokenWithPopup(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){return e.scope=S(this.DEFAULT_SCOPE,this.options.scope,e.scope),yield this.loginWithPopup(e),this.cache.get({scope:e.scope,audience:e.audience||"default"}).access_token})}isAuthenticated(){return t(this,void 0,void 0,function*(){return!!(yield this.getUser())})}logout(e={}){null!==e.client_id?e.client_id=e.client_id||this.options.client_id:delete e.client_id,K("auth0.is.authenticated");const t=this._url(`/v2/logout?${D(e)}`);window.location.assign(t)}}return function(e){return t(this,void 0,void 0,function*(){const t=new ie(e);if(!Z("auth0.is.authenticated"))return t;try{yield t.getTokenSilently({audience:e.audience,scope:e.scope,ignoreCache:!0})}catch(e){}return t})}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).createAuth0Client=t()}(this,function(){"use strict";function e(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function t(e,t,r,o){return new(r||(r=Promise))(function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(a,s)}c((o=o.apply(e,t||[])).next())})}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){function t(e){if("utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+e+"') is invalid.")}function r(e,t){if(t=void 0===t?{fatal:!1}:t,"utf-8"!==(e=void 0===e?"utf-8":e))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+e+"') is invalid.");if(t.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(e.TextEncoder&&e.TextDecoder)return!1;Object.defineProperty(t.prototype,"encoding",{value:"utf-8"}),t.prototype.encode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");t=0;for(var r=e.length,o=0,n=Math.max(32,r+(r>>1)+7),i=new Uint8Array(n>>3<<3);t<r;){var a=e.charCodeAt(t++);if(55296<=a&&56319>=a){if(t<r){var s=e.charCodeAt(t);56320==(64512&s)&&(++t,a=((1023&a)<<10)+(1023&s)+65536)}if(55296<=a&&56319>=a)continue}if(o+4>i.length&&(n+=8,n=(n*=1+t/e.length*2)>>3<<3,(s=new Uint8Array(n)).set(i),i=s),0==(4294967168&a))i[o++]=a;else{if(0==(4294965248&a))i[o++]=a>>6&31|192;else if(0==(4294901760&a))i[o++]=a>>12&15|224,i[o++]=a>>6&63|128;else{if(0!=(4292870144&a))continue;i[o++]=a>>18&7|240,i[o++]=a>>12&63|128,i[o++]=a>>6&63|128}i[o++]=63&a|128}}return i.slice(0,o)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1}),r.prototype.decode=function(e,t){if((t=void 0===t?{stream:!1}:t).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");t=0;for(var r=(e=new Uint8Array(e)).length,o=[];t<r;){var n=e[t++];if(0===n)break;if(0==(128&n))o.push(n);else if(192==(224&n)){var i=63&e[t++];o.push((31&n)<<6|i)}else if(224==(240&n)){i=63&e[t++];var a=63&e[t++];o.push((31&n)<<12|i<<6|a)}else if(240==(248&n)){65535<(n=(7&n)<<18|(i=63&e[t++])<<12|(a=63&e[t++])<<6|63&e[t++])&&(n-=65536,o.push(n>>>10&1023|55296),n=56320|1023&n),o.push(n)}}return String.fromCharCode.apply(null,o)},e.TextEncoder=t,e.TextDecoder=r}("undefined"!=typeof window?window:r);var o=Object.prototype.hasOwnProperty,n=Array.isArray,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r},s={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var i=t[o],a=i.obj[i.prop],s=Object.keys(a),c=0;c<s.length;++c){var l=s[c],d=a[l];"object"==typeof d&&null!==d&&-1===r.indexOf(d)&&(t.push({obj:a,prop:l}),r.push(d))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(n(r)){for(var o=[],i=0;i<r.length;++i)void 0!==r[i]&&o.push(r[i]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,r){if(0===e.length)return e;var o="string"==typeof e?e:String(e);if("iso-8859-1"===r)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var n="",a=0;a<o.length;++a){var s=o.charCodeAt(a);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?n+=o.charAt(a):s<128?n+=i[s]:s<2048?n+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?n+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(a+=1,s=65536+((1023&s)<<10|1023&o.charCodeAt(a)),n+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return n},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(n(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(i&&(i.plainObjects||i.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return n(t)&&!n(r)&&(s=a(t,i)),n(t)&&n(r)?(r.forEach(function(r,n){if(o.call(t,n)){var a=t[n];a&&"object"==typeof a&&r&&"object"==typeof r?t[n]=e(a,r,i):t.push(r)}else t[n]=r}),t):Object.keys(r).reduce(function(t,n){var a=r[n];return o.call(t,n)?t[n]=e(t[n],a,i):t[n]=a,t},s)}},c=String.prototype.replace,l=/%20/g,d={default:"RFC3986",formatters:{RFC1738:function(e){return c.call(e,l,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"},u=Object.prototype.hasOwnProperty,p={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},f=Array.isArray,h=Array.prototype.push,y=function(e,t){h.apply(e,f(t)?t:[t])},m=Date.prototype.toISOString,g={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:s.encode,encodeValuesOnly:!1,formatter:d.formatters[d.default],indices:!1,serializeDate:function(e){return m.call(e)},skipNulls:!1,strictNullHandling:!1},v=function e(t,r,o,n,i,a,c,l,d,u,p,h,m){var v=t;if("function"==typeof c?v=c(r,v):v instanceof Date?v=u(v):"comma"===o&&f(v)&&(v=v.join(",")),null===v){if(n)return a&&!h?a(r,g.encoder,m):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||s.isBuffer(v))return a?[p(h?r:a(r,g.encoder,m))+"="+p(a(v,g.encoder,m))]:[p(r)+"="+p(String(v))];var w,b=[];if(void 0===v)return b;if(f(c))w=c;else{var _=Object.keys(v);w=l?_.sort(l):_}for(var O=0;O<w.length;++O){var j=w[O];i&&null===v[j]||(f(v)?y(b,e(v[j],"function"==typeof o?o(r,j):r,o,n,i,a,c,l,d,u,p,h,m)):y(b,e(v[j],r+(d?"."+j:"["+j+"]"),o,n,i,a,c,l,d,u,p,h,m)))}return b},w=Object.prototype.hasOwnProperty,b={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:s.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},O=function(e,t,r){if(e){var o=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,n=/(\[[^[\]]*])/g,i=/(\[[^[\]]*])/.exec(o),a=i?o.slice(0,i.index):o,s=[];if(a){if(!r.plainObjects&&w.call(Object.prototype,a)&&!r.allowPrototypes)return;s.push(a)}for(var c=0;null!==(i=n.exec(o))&&c<r.depth;){if(c+=1,!r.plainObjects&&w.call(Object.prototype,i[1].slice(1,-1))&&!r.allowPrototypes)return;s.push(i[1])}return i&&s.push("["+o.slice(i.index)+"]"),function(e,t,r){for(var o=t,n=e.length-1;n>=0;--n){var i,a=e[n];if("[]"===a&&r.parseArrays)i=[].concat(o);else{i=r.plainObjects?Object.create(null):{};var s="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(s,10);r.parseArrays||""!==s?!isNaN(c)&&a!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[])[c]=o:i[s]=o:i={0:o}}o=i}return o}(s,t,r)}},j=function(e,t){var r=function(e){if(!e)return b;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?b.charset:e.charset;return{allowDots:void 0===e.allowDots?b.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:b.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:b.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:b.comma,decoder:"function"==typeof e.decoder?e.decoder:b.decoder,delimiter:"string"==typeof e.delimiter||s.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:"number"==typeof e.depth?e.depth:b.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:b.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:b.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:b.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){var r,o={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=n.split(t.delimiter,i),c=-1,l=t.charset;if(t.charsetSentinel)for(r=0;r<a.length;++r)0===a[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[r]?l="utf-8":"utf8=%26%2310003%3B"===a[r]&&(l="iso-8859-1"),c=r,r=a.length);for(r=0;r<a.length;++r)if(r!==c){var d,u,p=a[r],f=p.indexOf("]="),h=-1===f?p.indexOf("="):f+1;-1===h?(d=t.decoder(p,b.decoder,l),u=t.strictNullHandling?null:""):(d=t.decoder(p.slice(0,h),b.decoder,l),u=t.decoder(p.slice(h+1),b.decoder,l)),u&&t.interpretNumericEntities&&"iso-8859-1"===l&&(u=_(u)),u&&t.comma&&u.indexOf(",")>-1&&(u=u.split(",")),w.call(o,d)?o[d]=s.combine(o[d],u):o[d]=u}return o}(e,r):e,n=r.plainObjects?Object.create(null):{},i=Object.keys(o),a=0;a<i.length;++a){var c=i[a],l=O(c,o[c],r);n=s.merge(n,l,r)}return s.compact(n)},E=function(e,t){var r,o=e,n=function(e){if(!e)return g;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||g.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=d.default;if(void 0!==e.format){if(!u.call(d.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var o=d.formatters[r],n=g.filter;return("function"==typeof e.filter||f(e.filter))&&(n=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:g.addQueryPrefix,allowDots:void 0===e.allowDots?g.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:g.charsetSentinel,delimiter:void 0===e.delimiter?g.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:g.encode,encoder:"function"==typeof e.encoder?e.encoder:g.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:g.encodeValuesOnly,filter:n,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:g.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:g.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:g.strictNullHandling}}(t);"function"==typeof n.filter?o=(0,n.filter)("",o):f(n.filter)&&(r=n.filter);var i,a=[];if("object"!=typeof o||null===o)return"";i=t&&t.arrayFormat in p?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=p[i];r||(r=Object.keys(o)),n.sort&&r.sort(n.sort);for(var c=0;c<r.length;++c){var l=r[c];n.skipNulls&&null===o[l]||y(a,v(o[l],l,s,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.formatter,n.encodeValuesOnly,n.charset))}var h=a.join(n.delimiter),m=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),h.length>0?m+h:""};const x={error:"timeout",error_description:"Timeout"},S=(...e)=>{const t=e.filter(Boolean).join();return Array.from(new Set(t.replace(/\s/g,",").split(","))).join(" ").trim()},C=e=>{var t=j(e);return Object.assign({},t,{expires_in:parseInt(t.expires_in)})},T=(e,t)=>new Promise((r,o)=>{var n=window.document.createElement("iframe");n.setAttribute("width","0"),n.setAttribute("height","0"),n.style.display="none";const i=setTimeout(()=>{o(x),window.document.body.removeChild(n)},6e4),a=function(e){e.origin==t&&e.data&&"authorization_response"===e.data.type&&(e.source.close(),e.data.response.error?o(e.data.response):r(e.data.response),clearTimeout(i),window.removeEventListener("message",a,!1),window.document.body.removeChild(n))};window.addEventListener("message",a,!1),window.document.body.appendChild(n),n.setAttribute("src",e)}),U=()=>{const e=window.open("","auth0:authorize:popup","left=100,top=100,width=400,height=600,resizable,scrollbars=yes,status=1");if(!e)throw new Error("Could not open popup");return e},P=(e,t)=>(e.location.href=t,new Promise((t,r)=>{const o=setTimeout(()=>{r(x)},6e4);window.addEventListener("message",n=>{if(n.data&&"authorization_response"===n.data.type){if(clearTimeout(o),e.close(),n.data.response.error)return r(n.data.response);t(n.data.response)}})})),k=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return crypto.getRandomValues(new Uint8Array(43)).forEach(r=>t+=e[r%e.length]),t},A=e=>btoa(e),D=e=>E(e),N=e=>window.crypto.subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e)),I=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),F=e=>(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[\+\/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(new Uint8Array(e))))),L=r=>t(void 0,void 0,void 0,function*(){var{baseUrl:t}=r,o=e(r,["baseUrl"]);return yield fetch(`${t}/oauth/token`,{method:"POST",body:JSON.stringify(Object.assign({grant_type:"authorization_code",redirect_uri:window.location.origin},o)),headers:{"Content-type":"application/json"}}).then(e=>e.json())}),R=e=>`${e.audience}::${e.scope}`,z=(e,t)=>{const r=(new Date(1e3*t).getTime()-(new Date).getTime())/1e3;return 1e3*Math.min(e,r)};class B{constructor(){this.cache={}}save(e){const t=R(e);this.cache[t]=e;const r=z(e.expires_in,e.decodedToken.claims.exp);setTimeout(()=>{delete this.cache[t]},r)}get(e){return this.cache[R(e)]}}var H,$,M=(function(e,t){var o=r&&r.__assign||Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function n(e,t){if(!t)return"";var r="; "+e;return!0===t?r:r+"="+t}function i(e,t,r){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return n("Expires",e.expires?e.expires.toUTCString():"")+n("Domain",e.domain)+n("Path",e.path)+n("Secure",e.secure)+n("SameSite",e.sameSite)}(r)}function a(e){for(var t={},r=e?e.split("; "):[],o=/(%[0-9A-Z]{2})+/g,n=0;n<r.length;n++){var i=r[n].split("="),a=i.slice(1).join("=");'"'===a.charAt(0)&&(a=a.slice(1,-1));try{t[i[0].replace(o,decodeURIComponent)]=a.replace(o,decodeURIComponent)}catch(e){}}return t}function s(){return a(document.cookie)}function c(e,t,r){document.cookie=i(e,t,o({path:"/"},r))}t.__esModule=!0,t.encode=i,t.parse=a,t.getAll=s,t.get=function(e){return s()[e]},t.set=c,t.remove=function(e,t){c(e,"",o({},t,{expires:-1}))}}(H={exports:{}},H.exports),H.exports);($=M)&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")&&$.default;M.encode,M.parse;var Q=M.getAll,V=M.get,J=M.set,W=M.remove;const q=()=>Object.keys(Q()||{}),Z=e=>{const t=V(e);if(void 0!==t)return JSON.parse(t)},G=(e,t,r)=>{J(e,JSON.stringify(t),{expires:r.daysUntilExpire})},K=e=>{W(e)},X="a0.spajs.txs.",Y=e=>`${X}${e}`;class ee{constructor(){this.transactions={},q().filter(e=>e.startsWith(X)).forEach(e=>{const t=e.replace(X,"");this.transactions[t]=Z(e)})}create(e,t){this.transactions[e]=t,G(Y(e),t,{daysUntilExpire:1})}get(e){return this.transactions[e]}remove(e){delete this.transactions[e],K(Y(e))}}const te=["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=e=>{const t=(e=>{const[t,r,o]=e.split("."),n=JSON.parse(I(r)),i={},a={};return Object.keys(n).forEach(e=>{i[e]=n[e],te.includes(e)||(a[e]=n[e])}),{encoded:{header:t,payload:r,signature:o},header:JSON.parse(I(t)),claims:i,user:a}})(e.id_token);if(t.claims.iss!==e.iss)throw new Error("Invalid issuer");if(t.claims.aud!==e.aud)throw new Error("Invalid audience");if("RS256"!==t.header.alg)throw new Error("Invalid algorithm");if(t.claims.nonce!==e.nonce)throw new Error("Invalid nonce");const r=new Date,o=new Date(0),n=new Date(0),i=new Date(0),a=e.leeway||60;if(o.setUTCSeconds(t.claims.exp+a),n.setUTCSeconds(t.claims.iat-a),i.setUTCSeconds(t.claims.nbf-a),r>o)throw new Error("id_token expired");if(r<n)throw new Error("id_token was issued in the future (invalid iat)");if(void 0!==t.claims.nbf&&r<i)throw new Error("token is not yet valid (invalid notBefore)");return t};class oe extends Error{constructor(e,t,r){super(t),this.error=e,this.error_description=t,this.state=r}}var ne="1.1.0";class ie{constructor(e){this.options=e,this.DEFAULT_SCOPE="openid profile email",this.cache=new B,this.transactionManager=new ee,this.domainUrl=`https://${this.options.domain}`}_url(e){const t=encodeURIComponent(btoa(JSON.stringify({name:"auth0-spa-js",version:ne})));return`${this.domainUrl}${e}&auth0Client=${t}`}_getParams(t,r,o,n,i){const a=e(this.options,["domain"]);return Object.assign({},a,t,{scope:S(this.DEFAULT_SCOPE,this.options.scope,t.scope),response_type:"code",response_mode:"query",state:r,nonce:o,redirect_uri:i||this.options.redirect_uri,code_challenge:n,code_challenge_method:"S256"})}_authorizeUrl(e){return this._url(`/authorize?${D(e)}`)}_verifyIdToken(e,t){return re({iss:`${this.domainUrl}/`,aud:this.options.client_id,id_token:e,nonce:t,leeway:this.options.leeway})}loginWithPopup(r={}){return t(this,void 0,void 0,function*(){const t=yield U(),o=e(r,[]),n=A(k()),i=k(),a=k(),s=yield N(a),c=F(s),l=this._getParams(o,n,i,c,this.options.redirect_uri||window.location.origin),d=this._authorizeUrl(Object.assign({},l,{response_mode:"web_message"})),u=yield P(t,d);if(n!==u.state)throw new Error("Invalid state");const p=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:a,code:u.code}),f=this._verifyIdToken(p.id_token,i),h=Object.assign({},p,{decodedToken:f,scope:l.scope,audience:l.audience||"default"});this.cache.save(h),G("auth0.is.authenticated",!0,{daysUntilExpire:1})})}getUser(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.user})}getIdTokenClaims(e={audience:this.options.audience||"default",scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){e.scope=S(this.DEFAULT_SCOPE,e.scope);const t=this.cache.get(e);return t&&t.decodedToken.claims})}loginWithRedirect(r={}){return t(this,void 0,void 0,function*(){const{redirect_uri:t,appState:o}=r,n=e(r,["redirect_uri","appState"]),i=A(k()),a=k(),s=k(),c=yield N(s),l=F(c),d=this._getParams(n,i,a,l,t),u=this._authorizeUrl(d);this.transactionManager.create(i,{nonce:a,code_verifier:s,appState:o,scope:d.scope,audience:d.audience||"default"}),window.location.assign(u)})}handleRedirectCallback(){return t(this,void 0,void 0,function*(){if(!window.location.search)throw new Error("There are no query params available at `window.location.search`.");const{state:e,code:t,error:r,error_description:o}=C(window.location.search.substr(1));if(r)throw new oe(r,o,e);const n=this.transactionManager.get(e);if(!n)throw new Error("Invalid state");this.transactionManager.remove(e);const i=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:n.code_verifier,code:t}),a=this._verifyIdToken(i.id_token,n.nonce),s=Object.assign({},i,{decodedToken:a,audience:n.audience,scope:n.scope});return this.cache.save(s),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),{appState:n.appState}})}getTokenSilently(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE,ignoreCache:!1}){return t(this,void 0,void 0,function*(){if(e.scope=S(this.DEFAULT_SCOPE,e.scope),!e.ignoreCache){const t=this.cache.get({scope:e.scope,audience:e.audience||"default"});if(t)return t.access_token}const t=A(k()),r=k(),o=k(),n=yield N(o),i=F(n),a={audience:e.audience,scope:e.scope},s=this._getParams(a,t,r,i,this.options.redirect_uri||window.location.origin),c=this._authorizeUrl(Object.assign({},s,{prompt:"none",response_mode:"web_message"})),l=yield T(c,this.domainUrl);if(t!==l.state)throw new Error("Invalid state");const d=yield L({baseUrl:this.domainUrl,audience:this.options.audience,client_id:this.options.client_id,code_verifier:o,code:l.code}),u=this._verifyIdToken(d.id_token,r),p=Object.assign({},d,{decodedToken:u,scope:s.scope,audience:s.audience||"default"});return this.cache.save(p),G("auth0.is.authenticated",!0,{daysUntilExpire:1}),d.access_token})}getTokenWithPopup(e={audience:this.options.audience,scope:this.options.scope||this.DEFAULT_SCOPE}){return t(this,void 0,void 0,function*(){return e.scope=S(this.DEFAULT_SCOPE,this.options.scope,e.scope),yield this.loginWithPopup(e),this.cache.get({scope:e.scope,audience:e.audience||"default"}).access_token})}isAuthenticated(){return t(this,void 0,void 0,function*(){return!!(yield this.getUser())})}logout(e={}){null!==e.client_id?e.client_id=e.client_id||this.options.client_id:delete e.client_id,K("auth0.is.authenticated");const t=this._url(`/v2/logout?${D(e)}`);window.location.assign(t)}}return function(e){return t(this,void 0,void 0,function*(){const t=new ie(e);if(!Z("auth0.is.authenticated"))return t;try{yield t.getTokenSilently({audience:e.audience,scope:e.scope,ignoreCache:!0})}catch(e){}return t})}});
//# sourceMappingURL=auth0-spa-js.production.js.map

@@ -299,3 +299,3 @@ 'use strict';

var version = '1.0.2';
var version = '1.1.0';

@@ -323,3 +323,3 @@ /**

return Object.assign({}, withoutDomain, authorizeOptions, { scope: getUniqueScopes(this.DEFAULT_SCOPE, this.options.scope, authorizeOptions.scope), response_type: 'code', response_mode: 'query', state,
nonce, redirect_uri: this.options.redirect_uri || redirect_uri, code_challenge, code_challenge_method: 'S256' });
nonce, redirect_uri: redirect_uri || this.options.redirect_uri, code_challenge, code_challenge_method: 'S256' });
}

@@ -354,3 +354,3 @@ _authorizeUrl(authorizeOptions) {

*/
loginWithPopup(options) {
loginWithPopup(options = {}) {
return __awaiter(this, void 0, void 0, function* () {

@@ -364,3 +364,3 @@ const popup = yield openPopup();

const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, window.location.origin);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, this.options.redirect_uri || window.location.origin);
const url = this._authorizeUrl(Object.assign({}, params, { response_mode: 'web_message' }));

@@ -434,3 +434,3 @@ const codeResult = yield runPopup(popup, url);

*/
loginWithRedirect(options) {
loginWithRedirect(options = {}) {
return __awaiter(this, void 0, void 0, function* () {

@@ -529,3 +529,3 @@ const { redirect_uri, appState } = options, authorizeOptions = __rest(options, ["redirect_uri", "appState"]);

};
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, window.location.origin);
const params = this._getParams(authorizeOptions, stateIn, nonceIn, code_challenge, this.options.redirect_uri || window.location.origin);
const url = this._authorizeUrl(Object.assign({}, params, { prompt: 'none', response_mode: 'web_message' }));

@@ -532,0 +532,0 @@ const codeResult = yield runIframe(url, this.domainUrl);

@@ -31,3 +31,3 @@ /**

*/
loginWithPopup(options: PopupLoginOptions): Promise<void>;
loginWithPopup(options?: PopupLoginOptions): Promise<void>;
/**

@@ -65,3 +65,3 @@ * ```js

*/
loginWithRedirect(options: RedirectLoginOptions): Promise<void>;
loginWithRedirect(options?: RedirectLoginOptions): Promise<void>;
/**

@@ -68,0 +68,0 @@ * After the browser redirects back to the callback page,

@@ -43,2 +43,3 @@ /**

* The default scope to be used on authentication requests.
* `openid profile email` is always added to all requests.
*/

@@ -102,3 +103,3 @@ scope?: string;

*/
redirect_uri: string;
redirect_uri?: string;
/**

@@ -105,0 +106,0 @@ * Used to store state before doing the redirect

@@ -1,2 +0,2 @@

declare const _default: "1.0.2";
declare const _default: "1.1.0";
export default _default;

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "1.0.2",
"version": "1.1.0",
"main": "dist/lib/auth0-spa-js.cjs.js",

@@ -9,0 +9,0 @@ "types": "dist/typings/index.d.ts",

@@ -17,2 +17,3 @@ # @auth0/auth0-spa-js

- [Support + Feedback](#support--feedback)
- [Frequently Asked Questions](#frequently-asked-questions)
- [Vulnerability Reporting](#vulnerability-reporting)

@@ -31,3 +32,3 @@ - [What is Auth0](#what-is-auth0)

```html
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.0.2/auth0-spa-js.production.js"></script>
<script src="https://cdn.auth0.com/js/auth0-spa-js/1.1.0/auth0-spa-js.production.js"></script>
```

@@ -155,3 +156,3 @@

- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- [This repo's contribution guide](CONTRIBUTING.md)
- [This repo's contribution guide](https://github.com/auth0/auth0-spa-js/blob/master/CONTRIBUTING.md)

@@ -164,2 +165,6 @@ ## Support + Feedback

## Frequently Asked Questions
For a rundown of common issues you might encounter when using the SDK, please check out [the FAQ](FAQ.md).
## Vulnerability Reporting

@@ -166,0 +171,0 @@

@@ -67,3 +67,3 @@ import {

nonce,
redirect_uri: this.options.redirect_uri || redirect_uri,
redirect_uri: redirect_uri || this.options.redirect_uri,
code_challenge,

@@ -102,3 +102,3 @@ code_challenge_method: 'S256'

*/
public async loginWithPopup(options: PopupLoginOptions) {
public async loginWithPopup(options: PopupLoginOptions = {}) {
const popup = await openPopup();

@@ -116,3 +116,3 @@ const { ...authorizeOptions } = options;

code_challenge,
window.location.origin
this.options.redirect_uri || window.location.origin
);

@@ -197,3 +197,3 @@ const url = this._authorizeUrl({

*/
public async loginWithRedirect(options: RedirectLoginOptions) {
public async loginWithRedirect(options: RedirectLoginOptions = {}) {
const { redirect_uri, appState, ...authorizeOptions } = options;

@@ -318,3 +318,3 @@ const stateIn = encodeState(createRandomString());

code_challenge,
window.location.origin
this.options.redirect_uri || window.location.origin
);

@@ -321,0 +321,0 @@ const url = this._authorizeUrl({

@@ -43,2 +43,3 @@ /**

* The default scope to be used on authentication requests.
* `openid profile email` is always added to all requests.
*/

@@ -105,3 +106,3 @@ scope?: string;

*/
redirect_uri: string;
redirect_uri?: string;
/**

@@ -108,0 +109,0 @@ * Used to store state before doing the redirect

@@ -1,1 +0,1 @@

export default '1.0.2';
export default '1.1.0';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc