authress-login
Version:
Universal login sdk for Authress authentication as a service. Provides managed authentication for user identity, authentication, and token verification.
2 lines • 49.4 kB
JavaScript
/*! Authress Login SDK 2.1.213 | Author - Authress Developers | License information can be found at https://github.com/Authress/login-sdk.js */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.authress=t():e.authress=t()}(this,(()=>(()=>{var e,t,n={669:(e,t,n)=>{e.exports=n(609)},448:(e,t,n)=>{"use strict";var r=n(867),o=n(26),i=n(372),s=n(327),a=n(97),c=n(109),u=n(985),d=n(61);e.exports=function(e){return new Promise((function(t,n){var l=e.data,p=e.headers,h=e.responseType;r.isFormData(l)&&delete p["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";p.Authorization="Basic "+btoa(m+":"+g)}var w=a(e.baseURL,e.url);function y(){if(f){var r="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,i={data:h&&"text"!==h&&"json"!==h?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:r,config:e,request:f};o(t,n,i),f=null}}if(f.open(e.method.toUpperCase(),s(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,"onloadend"in f?f.onloadend=y:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(y)},f.onabort=function(){f&&(n(d("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){n(d("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},r.isStandardBrowserEnv()){var v=(e.withCredentials||u(w))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;v&&(p[e.xsrfHeaderName]=v)}"setRequestHeader"in f&&r.forEach(p,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:f.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),h&&"json"!==h&&(f.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),n(e),f=null)})),l||(l=null),f.send(l)}))}},609:(e,t,n)=>{"use strict";var r=n(867),o=n(849),i=n(321),s=n(185);function a(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var c=a(n(655));c.Axios=i,c.create=function(e){return a(s(c.defaults,e))},c.Cancel=n(263),c.CancelToken=n(972),c.isCancel=n(502),c.all=function(e){return Promise.all(e)},c.spread=n(713),c.isAxiosError=n(268),e.exports=c,e.exports.default=c},263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:(e,t,n)=>{"use strict";var r=n(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,n)=>{"use strict";var r=n(867),o=n(327),i=n(782),s=n(572),a=n(185),c=n(875),u=c.validators;function d(e){this.defaults=e,this.interceptors={request:new i,response:new i}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var d=[s,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(i),o=Promise.resolve(e);d.length;)o=o.then(d.shift(),d.shift());return o}for(var l=e;n.length;){var p=n.shift(),h=n.shift();try{l=p(l)}catch(e){h(e);break}}try{o=s(l)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},d.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=d},782:(e,t,n)=>{"use strict";var r=n(867);function o(){this.handlers=[]}o.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:(e,t,n)=>{"use strict";var r=n(793),o=n(303);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},61:(e,t,n)=>{"use strict";var r=n(481);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},572:(e,t,n)=>{"use strict";var r=n(867),o=n(527),i=n(502),s=n(655);function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return a(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||s.adapter)(e).then((function(t){return a(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:(e,t,n)=>{"use strict";var r=n(867);e.exports=function(e,t){t=t||{};var n={},o=["url","method","data"],i=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function c(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=c(void 0,e[o])):n[o]=c(e[o],t[o])}r.forEach(o,(function(e){r.isUndefined(t[e])||(n[e]=c(void 0,t[e]))})),r.forEach(i,u),r.forEach(s,(function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=c(void 0,e[o])):n[o]=c(void 0,t[o])})),r.forEach(a,(function(r){r in t?n[r]=c(e[r],t[r]):r in e&&(n[r]=c(void 0,e[r]))}));var d=o.concat(i).concat(s).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return r.forEach(l,u),n}},26:(e,t,n)=>{"use strict";var r=n(61);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},527:(e,t,n)=>{"use strict";var r=n(867),o=n(655);e.exports=function(e,t,n){var i=this||o;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},655:(e,t,n)=>{"use strict";var r=n(867),o=n(16),i=n(481),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=n(448)),c),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(t||JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,s=!n&&"json"===this.responseType;if(s||o&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(s)})),e.exports=u},849:e=>{"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},327:(e,t,n)=>{"use strict";var r=n(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var s=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),s.push(o(t)+"="+o(e))})))})),i=s.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:(e,t,n)=>{"use strict";var r=n(867);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:(e,t,n)=>{"use strict";var r=n(867);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},16:(e,t,n)=>{"use strict";var r=n(867);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},109:(e,t,n)=>{"use strict";var r=n(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;s[t]="set-cookie"===t?(s[t]?s[t]:[]).concat([n]):s[t]?s[t]+", "+n:n}})),s):s}},713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:(e,t,n)=>{"use strict";var r=n(593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var i={},s=r.version.split(".");function a(e,t){for(var n=t?t.split("."):s,r=e.split("."),o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]<r[o])return!1}return!1}o.transitional=function(e,t,n){var o=t&&a(t);function s(e,t){return"[Axios v"+r.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,a){if(!1===e)throw new Error(s(r," has been removed in "+t));return o&&!i[r]&&(i[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,a)}},e.exports={isOlderVersion:a,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],s=t[i];if(s){var a=e[i],c=void 0===a||s(a,i,e);if(!0!==c)throw new TypeError("option "+i+" must be "+c)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:o}},867:(e,t,n)=>{"use strict";var r=n(849),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!s(e)&&null!==e.constructor&&!s(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:c,isUndefined:s,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:d,merge:function e(){var t={};function n(n,r){c(t[r])&&c(n)?t[r]=e(t[r],n):c(n)?t[r]=e({},n):i(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)d(arguments[r],n);return t},extend:function(e,t,n){return d(t,(function(t,o){e[o]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},219:e=>{function t(e){return String.fromCharCode(parseInt(e.slice(1),16))}function n(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}e.exports.decode=function(e){return function(e){return decodeURIComponent(Array.from(atob(e),n).join(""))}(e.replace(/-/g,"+").replace(/_/g,"/"))},e.exports.encode=function(e){return e&&"object"==typeof e?btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,""):function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,t))}(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}},99:(e,t,n)=>{const r=n(219),o=n(215),i="ExtensionRequestNonce";let s=null;e.exports=class{constructor(e,t){if(this.extensionId=t,!e)throw Error('Missing required property "authressCustomDomain" in ExtensionClient constructor. The Custom Authress Domain Host is required.');if(!t)throw Error('Missing required property "extensionId" in ExtensionClient constructor. The extension is required for selecting the correct login method.');this.authressCustomDomain=`https://${e.replace(/^(https?:\/+)/,"")}`,this.accessToken=null,window.onload=async()=>{await this.requestToken({silent:!0})}}async getUserIdentity(){const e=await this.accessToken&&o.decode(this.accessToken);return e?1e3*e.exp<Date.now()?(this.accessToken=null,null):e:null}async getTokenResponse(){return await this.getUserIdentity()?{accessToken:this.accessToken}:null}requestToken(e={code:null,silent:!1}){if(s)return s=s.catch((()=>{})).then((()=>this.requestTokenContinuation(e)));const t=this.requestTokenContinuation(e);return t.catch((()=>{})),s=t}async requestTokenContinuation(e={code:null,silent:!1}){const t=e&&e.code||new URLSearchParams(window.location.search).get("code");if(!t){if(!e||!e.silent){const e=Error("OAuth Authorization code is required");throw e.code="InvalidAuthorizationCode",e}return this.getTokenResponse()}const n=new URL(this.authressCustomDomain);n.pathname="/api/authentication/oauth/tokens";const{codeVerifier:r,redirectUrl:o}=JSON.parse(localStorage.getItem(i)||"{}"),s=await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code_verifier:r,code:t,grant_type:"authorization_code",client_id:this.extensionId,redirect_uri:o})}),a=await s.json();this.accessToken=a.access_token;const c=new URL(window.location);return c.searchParams.delete("code"),c.searchParams.delete("iss"),c.searchParams.delete("nonce"),c.searchParams.delete("expires_in"),c.searchParams.delete("access_token"),c.searchParams.delete("id_token"),history.replaceState({},void 0,c.toString()),this.getTokenResponse()}async login(e){const t=await this.getTokenResponse();if(t)return t;const n=await this.requestToken({silent:!0});if(n)return n;const o=new URL(this.authressCustomDomain),s=r.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),a=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(s)),c=r.encode(a),u=e||window.location.href;return localStorage.setItem(i,JSON.stringify({codeVerifier:s,redirectUrl:u})),o.searchParams.set("client_id",this.extensionId),o.searchParams.set("code_challenge",c),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("redirect_uri",u),window.location.assign(o.toString()),await new Promise((e=>setTimeout(e,5e3))),null}}},965:(e,t,n)=>{const r=n(669),o={"Content-Type":"application/json"};async function i(e){let t=null;for(let n=0;n<5;n++)try{return await e()}catch(e){if(t=e,"EPIPE"===e.code||"ECONNABORTED"===e.code||"ETIMEDOUT"===e.code||"ECONNRESET"===e.code||e.status>=500){await new Promise((e=>setTimeout(e,10*2**n)));continue}throw e}throw t}e.exports=class{constructor(e,t){if(!e)throw Error("Custom Authress Domain Host is required");const n=t||{debug(){},warn(){},critical(){}},o=`${new URL(`https://${e.replace(/^(https?:\/+)/,"")}`).origin}/api`,i=r.create({baseURL:o});i.interceptors.request.use((e=>(n.debug({title:"HttpClient Request",online:navigator.onLine,requestId:e.requestId,method:e.method,url:e.url}),e)),(e=>{let t,r,o=!1,i=e;e&&(i=e.message,e.response?(i={data:e.response.data,status:e.response.status,headers:e.response.headers},o=404===e.response.status):e.message&&(i={message:e.message,code:e.code,stack:e.stack}),e.config?(t=e.config.url,r=e.config.requestId):r=e.request&&e.request.config&&e.request.config.requestId);const s={title:"HttpClient Request Error",url:t,online:navigator.onLine,requestId:r,exception:i};throw o?n.debug(s):n.warn(s),i})),i.interceptors.response.use((e=>e),(e=>{if(e.re)throw e;const t=e&&e.response&&{url:e.config&&e.config.url,data:e.response.data,status:e.response.status,headers:e.response.headers}||e.message&&{message:e.message,code:e.code,stack:e.stack}||e;t.re=!0;const r=e&&(e.config&&e.config.requestId||e.request&&e.request.config&&e.request.config.requestId);let o="HttpClient Response Error",i="warn";throw e?e.response&&404===e.response.status?i="debug":e.response&&401===e.response.status&&(o="HttpClient Response Error due to invalid token"):o="HttpClient Response Error - Unknown error occurred",n[i]({title:o,online:navigator.onLine,requestId:r,exception:t,url:e&&e.config&&e.config.url}),t})),this.client=i}get(e,t,n,r="json"){return i((()=>this.client.get(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n),responseType:r})))}delete(e,t,n,r="json"){return i((()=>this.client.delete(e.toString(),{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,n),responseType:r})))}post(e,t,n,r){return i((()=>this.client.post(e.toString(),n,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r)})))}put(e,t,n,r){return i((()=>this.client.put(e.toString(),n,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r)})))}patch(e,t,n,r){return i((()=>this.client.patch(e.toString(),n,{withCredentials:"localhost"!==window.location.hostname&&!!t,headers:Object.assign({},o,r)})))}}},125:(e,t,n)=>{const r=n(489),o=n(802),i=n(965),s=n(215),a=n(429);let c,u=new Promise((e=>c=e)),d=null;const l="AuthenticationRequestNonce";const p=n(99);e.exports={LoginClient:class{constructor(e,t){this.settings=Object.assign({},e),this.logger=t||console;const n=this.settings.authressLoginHostUrl||this.settings.authenticationServiceUrl||"";if(!n)throw Error('Missing required property "authressLoginHostUrl" in LoginClient constructor. Custom Authress Domain Host is required.');this.hostUrl=`https://${n.replace(/^(https?:\/+)/,"")}`,this.httpClient=new i(this.hostUrl),this.lastSessionCheck=0,this.enableCredentials=this.getMatchingDomainInfo(this.hostUrl,"undefined"!=typeof window?window:void 0),e.skipBackgroundCredentialsCheck||(window.onload=async()=>{await this.userSessionExists(!0)})}isLocalHost(){return"undefined"!=typeof window&&window.location&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)}getMatchingDomainInfo(e,t){const n=new URL(e);if(this.isLocalHost())return!1;if(void 0===t)return!1;if("https:"!==t.location.protocol)return!1;const r=n.host.toLowerCase().split(".").reverse(),i=t.location.host.toLowerCase().split(".").reverse();let s=[];for(let e of r){const t=o(i,s.length+1).join(".");if(s.concat(e).join(".")!==t)break;s.push(e)}return s.length===r.length&&s.length===i.length||s.length>1}getUserIdentity(){const e=r.parse(document.cookie),t=e&&e.user;if(t&&s.decode(t)){const e=new Date(1e3*s.decode(t).exp)||new Date(Date.now()+864e5);a.set(t,e)}const n=a.get(),o=n&&s.decode(n);return o?(o.userId=o.sub,o):null}async getConnectionCredentials(){await this.waitForUserSession();try{const e=await this.ensureToken();return(await this.httpClient.get("/session/credentials",this.enableCredentials,{Authorization:e&&`Bearer ${e}`})).data}catch(e){return null}}async waitForUserSession(){try{return await u,!0}catch(e){return!1}}userSessionExists(e){return d?Date.now()-this.lastSessionCheck<50?d:(this.lastSessionCheck=Date.now(),d=d.catch((()=>{})).then((()=>this.userSessionContinuation(e)))):(this.lastSessionCheck=Date.now(),d=this.userSessionContinuation(e))}async userSessionContinuation(e){const t=new URLSearchParams(window.location.search),n=new URL(window.location);let o={};try{o=JSON.parse(localStorage.getItem(l)||"{}"),localStorage.removeItem(l),Object.hasOwnProperty.call(o,"enableCredentials")&&(this.enableCredentials=o.enableCredentials)}catch(e){this.logger&&this.logger.debug("LocalStorage failed in Browser",e)}if(t.get("state")&&"oauthLogin"===t.get("flow"))return!1;if(o.nonce&&t.get("code")&&(n.searchParams.delete("nonce"),n.searchParams.delete("iss"),n.searchParams.delete("code"),history.replaceState({},void 0,n.toString()),o.nonce===t.get("nonce"))){const e="cookie"===t.get("code")?r.parse(document.cookie)["auth-code"]:t.get("code"),n={grant_type:"authorization_code",redirect_uri:o.redirectUrl,client_id:this.settings.applicationId,code:e,code_verifier:o.codeVerifier},i=await this.httpClient.post(`/authentication/${o.nonce}/tokens`,this.enableCredentials,n),u=s.decode(i.data.id_token),d=i.data.expires_in&&new Date(Date.now()+1e3*i.data.expires_in)||new Date(1e3*u.exp);return document.cookie=r.serialize("authorization",i.data.access_token||"",{expires:d,path:"/",sameSite:"strict"}),a.set(i.data.id_token,d),c(),!0}if(this.isLocalHost()&&t.get("nonce")&&t.get("access_token")&&(n.searchParams.delete("iss"),n.searchParams.delete("nonce"),n.searchParams.delete("expires_in"),n.searchParams.delete("access_token"),n.searchParams.delete("id_token"),history.replaceState({},void 0,n.toString()),!o.nonce||o.nonce===t.get("nonce"))){const e=s.decode(t.get("id_token")),n=Number(t.get("expires_in"))&&new Date(Date.now()+1e3*Number(t.get("expires_in")))||new Date(1e3*e.exp);return document.cookie=r.serialize("authorization",t.get("access_token")||"",{expires:n,path:"/",sameSite:"strict"}),a.set(t.get("id_token"),n),c(),!0}if(this.getUserIdentity())return c(),!0;if(!this.isLocalHost()&&!e){try{const e=await this.httpClient.patch("/session",this.enableCredentials,{});if(e.data.access_token){const t=s.decode(e.data.id_token),n=e.data.expires_in&&new Date(Date.now()+1e3*e.data.expires_in)||new Date(1e3*t.exp);document.cookie=r.serialize("authorization",e.data.access_token||"",{expires:n,path:"/",sameSite:"strict"}),a.set(e.data.id_token,n)}}catch(e){this.logger&&this.logger.log({title:"Failed attempting to check if the user has an existing authentication session",error:e})}if(this.getUserIdentity())return c(),!0}return!1}async updateExtensionAuthenticationRequest({state:e,connectionId:t,tenantLookupIdentifier:n,connectionProperties:r}){if(!t&&!n){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}const o=new URLSearchParams(window.location.search),i=e||o.get("state");if(!i){const e=Error("The `state` parameters must be specified to update this authentication request");throw e.code="InvalidAuthenticationRequest",e}try{const e=await this.httpClient.patch(`/authentication/${i}`,!0,{connectionId:t,tenantLookupIdentifier:n,connectionProperties:r});window.location.assign(e.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}await new Promise((e=>setTimeout(e,5e3)))}async unlinkIdentity(e){if(!e){const e=Error("connectionId must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into to unlink an account.");throw e.code="NotLoggedIn",e}let t;try{t=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const n=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${t}`};try{await this.httpClient.delete(`/identities/${encodeURIComponent(e)}`,this.enableCredentials,n)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}}async linkIdentity({connectionId:e,tenantLookupIdentifier:t,redirectUrl:n,connectionProperties:r}){if(!e&&!t){const e=Error("connectionId or tenantLookupIdentifier must be specified");throw e.code="InvalidConnection",e}if(!this.getUserIdentity()){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}let o;try{o=await this.ensureToken({timeoutInMillis:100})}catch(e){if("TokenTimeout"===e.code){const e=Error("User must be logged into an existing account before linking a second account.");throw e.code="NotLoggedIn",e}}const{codeChallenge:i}=await s.getAuthCodes();try{const s=n&&new URL(n).toString()||window.location.href,a=this.enableCredentials&&!this.isLocalHost()?{}:{Authorization:`Bearer ${o}`},c=await this.httpClient.post("/authentication",this.enableCredentials,{linkIdentity:!0,redirectUrl:s,codeChallengeMethod:"S256",codeChallenge:i,connectionId:e,tenantLookupIdentifier:t,connectionProperties:r,applicationId:this.settings.applicationId},a);window.location.assign(c.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}await new Promise((e=>setTimeout(e,5e3)))}async authenticate(e={}){const{connectionId:t,tenantLookupIdentifier:n,redirectUrl:r,force:o,responseLocation:i,flowType:c,connectionProperties:u,openType:d,multiAccount:p,clearUserDataBeforeLogin:h}=e||{};if(i&&"cookie"!==i&&"query"!==i&&"none"!==i){const e=Error("Authentication response location is not valid");throw e.code="InvalidResponseLocation",e}if(!o&&!p&&await this.userSessionExists())return!0;const{codeVerifier:f,codeChallenge:m}=await s.getAuthCodes();try{const e=r&&new URL(r).toString()||window.location.href;!1!==h&&a.clear();const o=await this.httpClient.post("/authentication",!1,{redirectUrl:e,codeChallengeMethod:"S256",codeChallenge:m,connectionId:t,tenantLookupIdentifier:n,connectionProperties:u,applicationId:this.settings.applicationId,responseLocation:i,flowType:c,multiAccount:p});localStorage.setItem(l,JSON.stringify({nonce:o.data.authenticationRequestId,codeVerifier:f,lastConnectionId:t,tenantLookupIdentifier:n,redirectUrl:e,enableCredentials:o.data.enableCredentials,multiAccount:p})),"tab"===d?window.open(o.data.authenticationUrl,"_blank"):window.location.assign(o.data.authenticationUrl)}catch(e){if(e.status>=400&&e.status<500){const t=Error(e.data.title||e.data.errorCode);throw t.code=e.data.errorCode,t}throw e}return await new Promise((e=>setTimeout(e,5e3))),!1}async ensureToken(e){await this.userSessionExists();const t=Object.assign({timeoutInMillis:5e3},e||{}),n=this.waitForUserSession(),o=new Promise(((e,n)=>setTimeout(n,t.timeoutInMillis||0)));try{await Promise.race([n,o])}catch(e){const t=Error("No token retrieved after timeout");throw t.code="TokenTimeout",t}const i=r.parse(document.cookie);return"undefined"!==i.authorization&&i.authorization}async logout(e){if(a.clear(),u=new Promise((e=>c=e)),this.enableCredentials)try{return await this.httpClient.delete("/session",this.enableCredentials),void(e&&e!==window.location.href&&window.location.assign(e))}catch(e){}const t=new URL("/logout",this.hostUrl);t.searchParams.set("redirect_uri",e||window.location.href),t.searchParams.set("client_id",this.settings.applicationId),window.location.assign(t.toString())}},ExtensionClient:p}},215:(e,t,n)=>{const r=n(219);e.exports=new class{decode(e){try{return e&&JSON.parse(r.decode(e.split(".")[1]))}catch(e){return null}}decodeFull(e){try{return e&&{header:JSON.parse(r.decode(e.split(".")[0])),payload:JSON.parse(r.decode(e.split(".")[1]))}}catch(e){return null}}async getAuthCodes(){const e=r.encode((window.crypto||window.msCrypto).getRandomValues(new Uint32Array(16)).toString()),t=await(window.crypto||window.msCrypto).subtle.digest("SHA-256",(new TextEncoder).encode(e));return{codeVerifier:e,codeChallenge:r.encode(t)}}}},429:(e,t,n)=>{const r=n(489),o="AuthenticationCredentialsStorage";e.exports=new class{set(e,t){try{const n=r.parse(document.cookie);localStorage.setItem(o,JSON.stringify({idToken:e,expiry:t&&t.getTime(),jsCookies:!!n.authorization})),this.clearCookies("user")}catch(e){console.debug("LocalStorage failed in Browser",e)}}get(){try{const{idToken:e,expiry:t,jsCookies:n}=JSON.parse(localStorage.getItem(o)||"{}");if(!e||t<Date.now())return null;const i=r.parse(document.cookie);return n&&!i.authorization?null:e}catch(e){return console.debug("LocalStorage failed in Browser",e),null}}delete(){try{localStorage.removeItem(o)}catch(e){console.debug("LocalStorage failed in Browser",e)}}clear(){this.clearCookies(),this.delete()}clearCookies(e){const t=document.cookie.split("; ");for(const n of t){if(!["user","authorization","auth-code"].includes(n.split("=")[0])||e&&n.split("=")[0]!==e)continue;const t=window.location.hostname.split(".");for(;t.length>1;){const e=`${encodeURIComponent(n.split(";")[0].split("=")[0])}=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=${t.join(".")}; SameSite=Strict; path=`,r=location.pathname.split("/");for(document.cookie=`${e}/`;r.length>0;)document.cookie=e+r.join("/"),r.pop();t.shift()}}}}},489:(e,t)=>{"use strict";t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");var n={},r=(t||{}).decode||o,i=0;for(;i<e.length;){var a=e.indexOf("=",i);if(-1===a)break;var c=e.indexOf(";",i);if(-1===c)c=e.length;else if(c<a){i=e.lastIndexOf(";",a-1)+1;continue}var u=e.slice(i,a).trim();if(void 0===n[u]){var d=e.slice(a+1,c).trim();34===d.charCodeAt(0)&&(d=d.slice(1,-1)),n[u]=s(d,r)}i=c+1}return n},t.serialize=function(e,t,o){var s=o||{},a=s.encode||i;if("function"!=typeof a)throw new TypeError("option encode is invalid");if(!r.test(e))throw new TypeError("argument name is invalid");var c=a(t);if(c&&!r.test(c))throw new TypeError("argument val is invalid");var u=e+"="+c;if(null!=s.maxAge){var d=s.maxAge-0;if(isNaN(d)||!isFinite(d))throw new TypeError("option maxAge is invalid");u+="; Max-Age="+Math.floor(d)}if(s.domain){if(!r.test(s.domain))throw new TypeError("option domain is invalid");u+="; Domain="+s.domain}if(s.path){if(!r.test(s.path))throw new TypeError("option path is invalid");u+="; Path="+s.path}if(s.expires){var l=s.expires;if(!function(e){return"[object Date]"===n.call(e)||e instanceof Date}(l)||isNaN(l.valueOf()))throw new TypeError("option expires is invalid");u+="; Expires="+l.toUTCString()}s.httpOnly&&(u+="; HttpOnly");s.secure&&(u+="; Secure");if(s.priority){switch("string"==typeof s.priority?s.priority.toLowerCase():s.priority){case"low":u+="; Priority=Low";break;case"medium":u+="; Priority=Medium";break;case"high":u+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(s.sameSite){switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:u+="; SameSite=Strict";break;case"lax":u+="; SameSite=Lax";break;case"strict":u+="; SameSite=Strict";break;case"none":u+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return u};var n=Object.prototype.toString,r=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function o(e){return-1!==e.indexOf("%")?decodeURIComponent(e):e}function i(e){return encodeURIComponent(e)}function s(e,t){try{return t(e)}catch(t){return e}}},802:e=>{var t=1/0,n=17976931348623157e292,r=NaN,o="[object Symbol]",i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,d=Object.prototype.toString;function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e,p,h){return e&&e.length?function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}(e,0,(p=h||void 0===p?1:(f=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==o}(e))return r;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=a.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):s.test(e)?r:+e}(e))===t||e===-t?(e<0?-1:1)*n:e==e?e:0:0===e?e:0}(p),m=f%1,f==f?m?f-m:f:0))<0?0:p):[];var f,m}},593:e=>{"use strict";e.exports=JSON.parse('{"_from":"axios@^0.21","_id":"axios@0.21.4","_inBundle":false,"_integrity":"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==","_location":"/axios","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"axios@^0.21","name":"axios","escapedName":"axios","rawSpec":"^0.21","saveSpec":null,"fetchSpec":"^0.21"},"_requiredBy":["/","/@authress/login"],"_resolved":"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz","_shasum":"c67b90dc0568e5c1cf2b0b858c43ba28e2eda575","_spec":"axios@^0.21","_where":"/home/runner/work/authress-login.js/authress-login.js","author":{"name":"Matt Zabriskie"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"bugs":{"url":"https://github.com/axios/axios/issues"},"bundleDependencies":false,"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}],"dependencies":{"follow-redirects":"^1.14.0"},"deprecated":false,"description":"Promise based HTTP client for the browser and node.js","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"homepage":"https://axios-http.com","jsdelivr":"dist/axios.min.js","keywords":["xhr","http","ajax","promise","node"],"license":"MIT","main":"index.js","name":"axios","repository":{"type":"git","url":"git+https://github.com/axios/axios.git"},"scripts":{"build":"NODE_ENV=production grunt build","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","examples":"node ./examples/server.js","fix":"eslint --fix lib/**/*.js","postversion":"git push && git push --tags","preversion":"npm test","start":"node ./sandbox/server.js","test":"grunt test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"},"typings":"./index.d.ts","unpkg":"dist/axios.min.js","version":"0.21.4"}')}},r={};function o(e){var t=r[e];if(void 0!==t){if(void 0!==t.error)throw t.error;return t.exports}var i=r[e]={exports:{}};try{var s={id:e,module:i,factory:n[e],require:o};o.i.forEach((function(e){e(s)})),i=s.module,s.factory.call(i.exports,i,i.exports,s.require)}catch(e){throw i.error=e,e}return i.exports}return o.m=n,o.c=r,o.i=[],o.hu=e=>e+"."+o.h()+".hot-update.js",o.hmrF=()=>"main."+o.h()+".hot-update.json",o.h=()=>"2d892587351be3b403dd",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e={},t="authress:",o.l=(n,r,i,s)=>{if(e[n])e[n].push(r);else{var a,c;if(void 0!==i)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==n||l.getAttribute("data-webpack")==t+i){a=l;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",t+i),a.src=n),e[n]=[r];var p=(t,r)=>{a.onerror=a.onload=null,clearTimeout(h);var o=e[n];if(delete e[n],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(r))),t)return t(r)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),c&&document.head.appendChild(a)}},(()=>{var e,t,n,r={},i=o.c,s=[],a=[],c="idle",u=0,d=[];function l(e){c=e;for(var t=[],n=0;n<a.length;n++)t[n]=a[n].call(null,e);return Promise.all(t)}function p(){0==--u&&l("ready").then((function(){if(0===u){var e=d;d=[];for(var t=0;t<e.length;t++)e[t]()}}))}function h(e){if("idle"!==c)throw new Error("check() is only allowed in idle status");return l("check").then(o.hmrM).then((function(n){return n?l("prepare").then((function(){var r=[];return t=[],Promise.all(Object.keys(o.hmrC).reduce((function(e,i){return o.hmrC[i](n.c,n.r,n.m,e,t,r),e}),[])).then((function(){return t=function(){return e?m(e):l("ready").then((function(){return r}))},0===u?t():new Promise((function(e){d.push((function(){e(t())}))}));var t}))})):l(g()?"ready":"idle").then((function(){return null}))}))}function f(e){return"ready"!==c?Promise.resolve().then((function(){throw new Error("apply() is only allowed in ready status (state: "+c+")")})):m(e)}function m(e){e=e||{},g();var r=t.map((function(t){return t(e)}));t=void 0;var o=r.map((function(e){return e.error})).filter(Boolean);if(o.length>0)return l("abort").then((function(){throw o[0]}));var i=l("dispose");r.forEach((function(e){e.dispose&&e.dispose()}));var s,a=l("apply"),c=function(e){s||(s=e)},u=[];return r.forEach((function(e){if(e.apply){var t=e.apply(c);if(t)for(var n=0;n<t.length;n++)u.push(t[n])}})),Promise.all([i,a]).then((function(){return s?l("fail").then((function(){throw s})):n?m(e).then((function(e){return u.forEach((function(t){e.indexOf(t)<0&&e.push(t)})),e})):l("idle").then((function(){return u}))}))}function g(){if(n)return t||(t=[]),Object.keys(o.hmrI).forEach((function(e){n.forEach((function(n){o.hmrI[e](n,t)}))})),n=void 0,!0}o.hmrD=r,o.i.push((function(d){var m,g,w,y,v=d.module,b=function(t,n){var r=i[n];if(!r)return t;var o=function(o){if(r.hot.active){if(i[o]){var a=i[o].parents;-1===a.indexOf(n)&&a.push(n)}else s=[n],e=o;-1===r.children.indexOf(o)&&r.children.push(o)}else console.warn("[HMR] unexpected require("+o+") from disposed module "+n),s=[];return t(o)},a=function(e){return{configurable:!0,enumerable:!0,get:function(){return t[e]},set:function(n){t[e]=n}}};for(var d in t)Object.prototype.hasOwnProperty.call(t,d)&&"e"!==d&&Object.defineProperty(o,d,a(d));return o.e=function(e){return function(e){switch(c){case"ready":l("prepare");case"prepare":return u++,e.then(p,p),e;default:return e}}(t.e(e))},o}(d.require,d.id);v.hot=(m=d.id,g=v,y={_acceptedDependencies:{},_acceptedErrorHandlers:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:w=e!==m,_requireSelf:function(){s=g.parents.slice(),e=w?void 0:m,o(m)},active:!0,accept:function(e,t,n){if(void 0===e)y._selfAccepted=!0;else if("function"==typeof e)y._selfAccepted=e;else if("object"==typeof e&&null!==e)for(var r=0;r<e.length;r++)y._acceptedDependencies[e[r]]=t||function(){},y._acceptedErrorHandlers[e[r]]=n;else y._acceptedDependencies[e]=t||function(){},y._acceptedErrorHandlers[e]=n},decline:function(e){if(void 0===e)y._selfDeclined=!0;else if("object"==typeof e&&null!==e)for(var t=0;t<e.length;t++)y._declinedDependencies[e[t]]=!0;else y._declinedDependencies[e]=!0},dispose:function(e){y._disposeHandlers.push(e)},addDisposeHandler:function(e){y._disposeHandlers.push(e)},removeDisposeHandler:function(e){var t=y._disposeHandlers.indexOf(e);t>=0&&y._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,c){case"idle":t=[],Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)})),l("ready");break;case"ready":Object.keys(o.hmrI).forEach((function(e){o.hmrI[e](m,t)}));break;case"prepare":case"check":case"dispose":case"apply":(n=n||[]).push(m)}},check:h,apply:f,status:function(e){if(!e)return c;a.push(e)},addStatusHandler:function(e){a.push(e)},removeStatusHandler:function(e){var t=a.indexOf(e);t>=0&&a.splice(t,1)},data:r[m]},e=void 0,y),v.parents=s,v.children=[],s=[],d.require=b})),o.hmrC={},o.hmrI={}})(),o.p="",(()=>{var e,t,n,r,i,s=o.hmrS_jsonp=o.hmrS_jsonp||{179:0},a={};function c(t,n){return e=n,new Promise(((e,n)=>{a[t]=e;var r=o.p+o.hu(t),i=new Error;o.l(r,(e=>{if(a[t]){a[t]=void 0;var r=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading hot update chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n(i)}}))}))}function u(e){function a(e){for(var t=[e],n={},r=t.map((function(e){return{chain:[e],id:e}}));r.length>0;){var i=r.pop(),s=i.id,a=i.chain,u=o.c[s];if(u&&(!u.hot._selfAccepted||u.hot._selfInvalidated)){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:s};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:s};for(var d=0;d<u.parents.length;d++){var l=u.parents[d],p=o.c[l];if(p){if(p.hot._declinedDependencies[s])return{type:"declined",chain:a.concat([l]),moduleId:s,parentId:l};-1===t.indexOf(l)&&(p.hot._acceptedDependencies[s]?(n[l]||(n[l]=[]),c(n[l],[s])):(delete n[l],t.push(l),r.push({chain:a.concat([l]),id:l})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:n}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];-1===e.indexOf(r)&&e.push(r)}}o.f&&delete o.f.jsonpHmr,t=void 0;var u={},d=[],l={},p=function(e){console.warn("[HMR] unexpected require("+e.id+") to disposed module")};for(var h in n)if(o.o(n,h)){var f,m=n[h],g=!1,w=!1,y=!1,v="";switch((f=m?a(h):{type:"disposed",moduleId:h}).chain&&(v="\nUpdate propagation: "+f.chain.join(" -> ")),f.type){case"self-declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of self decline: "+f.moduleId+v));break;case"declined":e.onDeclined&&e.onDeclined(f),e.ignoreDeclined||(g=new Error("Aborted because of declined dependency: "+f.moduleId+" in "+f.parentId+v));break;case"unaccepted":e.onUnaccepted&&e.onUnaccepted(f),e.ignoreUnaccepted||(g=new Error("Aborted because "+h+" is not accepted"+v));break;case"accepted":e.onAccepted&&e.onAccepted(f),w=!0;break;case"disposed":e.onDisposed&&e.onDisposed(f),y=!0;break;default:throw new Error("Unexception type "+f.type)}if(g)return{error:g};if(w)for(h in l[h]=m,c(d,f.outdatedModules),f.outdatedDependencies)o.o(f.outdatedDependencies,h)&&(u[h]||(u[h]=[]),c(u[h],f.outdatedDependencies[h]));y&&(c(d,[f.moduleId]),l[h]=p)}n=void 0;for(var b,x=[],k=0;k<d.length;k++){var C=d[k],E=o.c[C];E&&(E.hot._selfAccepted||E.hot._main)&&l[C]!==p&&!E.hot._selfInvalidated&&x.push({module:C,require:E.hot._requireSelf,errorHandler:E.hot._selfAccepted})}return{dispose:function(){var e;r.forEach((function(e){delete s[e]})),r=void 0;for(var t,n=d.slice();n.length>0;){var i=n.pop(),a=o.c[i];if(a){var c={},l=a.hot._disposeHandlers;for(k=0;k<l.length;k++)l[k].call(null,c);for(o.hmrD[i]=c,a.hot.active=!1,delete o.c[i],delete u[i],k=0;k<a.children.length;k++){var p=o.c[a.children[k]];p&&((e=p.parents.indexOf(i))>=0&&p.parents.splice(e,1))}}}for(var h in u)if(o.o(u,h)&&(a=o.c[h]))for(b=u[h],k=0;k<b.length;k++)t=b[k],(e=a.children.indexOf(t))>=0&&a.children.splice(e,1)},apply:function(t){for(var n in l)o.o(l,n)&&(o.m[n]=l[n]);for(var r=0;r<i.length;r++)i[r](o);for(var s in u)if(o.o(u,s)){var a=o.c[s];if(a){b=u[s];for(var c=[],p=[],h=[],f=0;f<b.length;f++){var m=b[f],g=a.hot._acceptedDependencies[m],w=a.hot._acceptedErrorHandlers[m];if(g){if(-1!==c.indexOf(g))continue;c.push(g),p.push(w),h.push(m)}}for(var y=0;y<c.length;y++)try{c[y].call(null,b)}catch(n){if("function"==typeof p[y])try{p[y](n,{moduleId:s,dependencyId:h[y]})}catch(r){e.onErrored&&e.onErrored({type:"accept-error-handler-errored",moduleId:s,dependencyId:h[y],error:r,originalError:n}),e.ignoreErrored||(t(r),t(n))}else e.onErrored&&e.onErrored({type:"accept-errored",moduleId:s,dependencyId:h[y],error:n}),e.ignoreErrored||t(n)}}}for(var v=0;v<x.length;v++){var k=x[v],C=k.module;try{k.require(C)}catch(n){if("function"==typeof k.errorHandler)try{k.errorHandler(n,{moduleId:C,module:o.c[C]})}catch(r){e.onErrored&&e.onErrored({type:"self-accept-error-handler-errored",moduleId:C,error:r,originalError:n}),e.ignoreErrored||(t(r),t(n))}else e.onErrored&&e.onErrored({type:"self-accept-errored",moduleId:C,error:n}),e.ignoreErrored||t(n)}}return d}}}this.webpackHotUpdateauthress=(t,r,s)=>{for(var c in r)o.o(r,c)&&(n[c]=r[c],e&&e.push(c));s&&i.push(s),a[t]&&(a[t](),a[t]=void 0)},o.hmrI.jsonp=function(e,t){n||(n={},i=[],r=[],t.push(u)),o.o(n,e)||(n[e]=o.m[e])},o.hmrC.jsonp=function(e,a,d,l,p,h){p.push(u),t={},r=a,n=d.reduce((function(e,t){return e[t]=!1,e}),{}),i=[],e.forEach((function(e){o.o(s,e)&&void 0!==s[e]?(l.push(c(e,h)),t[e]=!0):t[e]=!1})),o.f&&(o.f.jsonpHmr=function(e,n){t&&o.o(t,e)&&!t[e]&&(n.push(c(e)),t[e]=!0)})},o.hmrM=()=>{if("undefined"==typeof fetch)throw new Error("No browser support: need fetch API");return fetch(o.p+o.hmrF()).then((e=>{if(404!==e.status){if(!e.ok)throw new Error("Failed to fetch update manifest "+e.statusText);return e.json()}}))}})(),o(125)})()));