forked from ForgeRock/appAuthHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappAuthHelperFetchTokensBundle.js
46 lines (35 loc) · 62.2 KB
/
appAuthHelperFetchTokensBundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
License for promise-polyfill (MIT; see below):
Copyright (c) 2014 Taylor Hakes
Copyright (c) 2014 Forbes Lindesay
License for whatwg-fetch (MIT; see below):
Copyright (c) 2014-2016 GitHub, Inc.
License for url-polyfill (MIT; see below):
Copyright (c) 2017 Valentin Richard
License for webcrypto-shim (MIT; see below):
Copyright (c) 2015 Artem S Vybornov
MIT License:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
License for AppAuth-JS (Apache 2.0) :
Copyright (c) 2019 The OpenID Foundation
License for AppAuthHelper (Apache 2.0) :
Copyright (c) 2019 ForgeRock, Inc.
*/
"use strict";function _typeof(e){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}(function(){function s(l,e,r){function t(d,n){if(!e[d]){if(!l[d]){var i="function"==typeof require&&require;if(!n&&i)return i(d,!0);if(o)return o(d,!0);var u=new Error("Cannot find module '"+d+"'");throw u.code="MODULE_NOT_FOUND",u}var a=e[d]={exports:{}};l[d][0].call(a.exports,function(e){var r=l[d][1][e];return t(r||e)},a,a.exports,s,l,e,r)}return e[d].exports}for(var o="function"==typeof require&&require,n=0;n<r.length;n++)t(r[n]);return t}return s})()({1:[function(e,t){(function(){"use strict";var r=e("@openid/appauth");t.exports=function(e){return this.appAuthConfig=e,this.client={clientId:this.appAuthConfig.clientId,scopes:this.appAuthConfig.scopes,redirectUri:this.appAuthConfig.redirectUri,configuration:new r.AuthorizationServiceConfiguration(this.appAuthConfig.endpoints),notifier:new r.AuthorizationNotifier,authorizationHandler:new r.RedirectRequestHandler,tokenHandler:new r.BaseTokenRequestHandler(new r.FetchRequestor())},this.client.authorizationHandler.setAuthorizationNotifier(this.client.notifier),this.client.notifier.setAuthorizationListener(function(e,t,r){t&&(this.client.request=e,this.client.response=t,this.client.code=t.code),r&&(this.client.error=r)}.bind(this)),this},t.exports.prototype={getAvailableData:function getAvailableData(){return new Promise(function(e,t){this.client.authorizationHandler.completeAuthorizationRequestIfPossible().then(function(){var o,n=this;if(this.client.code){var a={};this.client.request&&this.client.request.internal&&(a.code_verifier=this.client.request.internal.code_verifier),o=new r.TokenRequest({client_id:this.client.clientId,redirect_uri:this.client.redirectUri,grant_type:r.GRANT_TYPE_AUTHORIZATION_CODE,code:this.client.code,refresh_token:void 0,extras:a}),this.client.tokenHandler.performTokenRequest(this.client.configuration,o).then(function(t){var r=this;delete this.client.code,delete this.client.request,delete this.client.response,this.fetchTokensFromIndexedDB().then(function(o){var n=localStorage.getItem("currentResourceServer");o||(o={}),t.idToken&&(o.idToken=t.idToken),"refreshToken"===r.appAuthConfig.renewStrategy&&t.refreshToken&&(o.refreshToken=t.refreshToken),null===n?o.accessToken=t.accessToken:(o[n]=t.accessToken,localStorage.removeItem("currentResourceServer")),r.updateTokensInIndexedDB(o).then(function(){return e({claims:r.appAuthConfig.oidc?r.getIdTokenClaims(o.idToken):{},idToken:o.idToken,resourceServer:n})})})}.bind(this))}else this.client.error?t(this.client.error.error):this.fetchTokensFromIndexedDB().then(function(r){r?e({idToken:r.idToken,claims:n.appAuthConfig.oidc?n.getIdTokenClaims(r.idToken):{}}):t("tokensUnavailable")})}.bind(this))}.bind(this))},authzRequest:function authzRequest(e,t,o){o=o||{};var n=new r.AuthorizationRequest({client_id:t.clientId,redirect_uri:t.redirectUri,scope:t.scopes,response_type:r.AuthorizationRequest.RESPONSE_TYPE_CODE,extras:Object.keys(o).concat(Object.keys(t.extras||{})).reduce(function(e,r){return e[r]=o[r]||t.extras[r],e},{})});e.authorizationHandler.performAuthorizationRequest(e.configuration,n)},silentAuthzRequest:function silentAuthzRequest(e){var t=this,o=Object.create(this.appAuthConfig),n=function(){return t.checkForActiveAuthzRequest().then(function(e){return e||this.authzRequest(this.client,o,{prompt:"none"}),"authCode"}.bind(t))};return e&&(localStorage.setItem("currentResourceServer",e),o.scopes=this.appAuthConfig.resourceServers[e]),"authCode"!==o.renewStrategy&&e?this.fetchTokensFromIndexedDB().then(function(a){return a.refreshToken?t.client.tokenHandler.performTokenRequest(t.client.configuration,new r.TokenRequest({client_id:t.client.clientId,redirect_uri:t.client.redirectUri,grant_type:r.GRANT_TYPE_REFRESH_TOKEN,refresh_token:a.refreshToken,extras:{scope:o.scopes}})).then(function(r){return r.refreshToken&&r.accessToken?(a.refreshToken=r.refreshToken,a[e]=r.accessToken,t.updateTokensInIndexedDB(a).then(function(){return"refreshToken"})):n.call(t)},function(){return n.call(t)}):n.call(t)}):n.call(this)},getAuthzURL:function getAuthzURL(){var e=this;return new Promise(function(t){e.client.authorizationHandler=new r.RedirectRequestHandler(void 0,void 0,{assign:t}),e.authzRequest(e.client,e.appAuthConfig)})},clearActiveAuthzRequests:function clearActiveAuthzRequests(){return this.checkForActiveAuthzRequest().then(function(e){if(e)return Promise.all([this.client.authorizationHandler.storageBackend.removeItem("appauth_current_authorization_request"),this.client.authorizationHandler.storageBackend.removeItem(e+"_appauth_authorization_request"),this.client.authorizationHandler.storageBackend.removeItem(e+"_appauth_authorization_service_configuration")])}.bind(this))},checkForActiveAuthzRequest:function checkForActiveAuthzRequest(){return this.client.authorizationHandler.storageBackend.getItem("appauth_current_authorization_request")},fetchTokensFromIndexedDB:function fetchTokensFromIndexedDB(){var e=this;return new Promise(function(t,r){var o,n=indexedDB.open("appAuth"),a=function(){return n.result.createObjectStore(this.appAuthConfig.clientId)}.bind(e);o=function onsuccess(){if(!n.result.objectStoreNames.contains(e.appAuthConfig.clientId)){var i=n.result.version;return i++,n.result.close(),n=indexedDB.open("appAuth",i),n.onupgradeneeded=a,void(n.onsuccess=o)}var s=n.result.transaction([e.appAuthConfig.clientId],"readonly").objectStore(e.appAuthConfig.clientId).get("tokens");s.onsuccess=function(){var e=s.result;n.result.close(),t(e)},s.onerror=r},n.onupgradeneeded=a,n.onsuccess=o,n.onerror=r})},updateTokensInIndexedDB:function updateTokensInIndexedDB(e){var t=this;return new Promise(function(r,o){var n,a=indexedDB.open("appAuth"),i=function(){return a.result.createObjectStore(this.appAuthConfig.clientId)}.bind(t);n=function(){var n=a.result.transaction([t.client.clientId],"readwrite").objectStore(t.client.clientId).put(e,"tokens");n.onsuccess=function(){a.result.close(),r()},n.onerror=o},a.onupgradeneeded=i,a.onsuccess=n,a.onerror=o})},getIdTokenClaims:function getIdTokenClaims(e){return JSON.parse(atob(e.split(".")[1].replace("-","+").replace("_","/")))},getResourceServerFromUrl:function getResourceServerFromUrl(e){return"object"===_typeof(this.appAuthConfig.resourceServers)&&Object.keys(this.appAuthConfig.resourceServers).length?Object.keys(this.appAuthConfig.resourceServers).filter(function(t){return 0===e.indexOf(t)})[0]:void 0},makeRSRequest:function makeRSRequest(e){var t=this;return Promise.all([this.getResourceServerFromUrl(e.url),this.fetchTokensFromIndexedDB()]).then(function(t){var r=t[0],o=t[1];return o[r]?(e.options.headers.Authorization="Bearer ".concat(o[r]),e):Promise.reject("invalid_token")}).then(function(e){return fetch(e.url,e.options)}).then(function(e){return"invalid_token"===t.getAuthHeaderDetails(e).error?Promise.reject("invalid_token"):e}).then(function(e){return t.serializeResponse(e)})},getAuthHeaderDetails:function getAuthHeaderDetails(e){var t=e.headers.get("www-authenticate");return!e.ok&&t&&t.match(/^Bearer\b/)?t.replace(/^Bearer\b/,"").match(/[^,=]+=".*?"/g).reduce(function(e,t){var r=t.split("=");return e[r[0].replace(/\s/g,"")]=r[1].replace(/"(.*)"/,"$1"),e},{}):{}},serializeResponse:function serializeResponse(e){var t=this;return e.text().then(function(r){return{body:r,init:{status:e.status,statusText:e.statusText,headers:t.serializeHeaders(e.headers)}}})},serializeHeaders:function serializeHeaders(e){if(e){for(var t={},r=e.keys(),o=null;(o=r.next())&&!o.done;)t[o.value.toLowerCase()]=e.get(o.value);return t}},logout:function logout(e){return this.fetchTokensFromIndexedDB().then(function(t){if(t){var o=[];return e.revoke_tokens&&t.accessToken&&o.push(new r.RevokeTokenRequest({client_id:this.appAuthConfig.clientId,token_type_hint:"access_token",token:t.accessToken})),e.revoke_tokens&&t.refreshToken&&o.push(new r.RevokeTokenRequest({client_id:this.appAuthConfig.clientId,token_type_hint:"refresh_token",token:t.refreshToken})),Promise.all(o.concat(Object.keys(this.appAuthConfig.resourceServers).filter(function(r){return e.revoke_tokens&&!!t[r]}).map(function(e){return new r.RevokeTokenRequest({client_id:this.appAuthConfig.clientId,token_type_hint:"access_token",token:t[e]})}.bind(this))).map(function(e){return this.client.tokenHandler.performRevokeTokenRequest(this.client.configuration,e)}.bind(this))).then(function(){return e.end_session&&this.appAuthConfig.oidc&&t.idToken&&this.client.configuration.endSessionEndpoint?fetch(this.client.configuration.endSessionEndpoint+"?id_token_hint="+t.idToken):void 0}.bind(this)).then(function(){return new Promise(function(e,t){var r=indexedDB.open("appAuth");r.onsuccess=function(){var t=r.result.transaction([this.appAuthConfig.clientId],"readwrite").objectStore(this.appAuthConfig.clientId).clear();r.result.close(),t.onsuccess=e}.bind(this),r.onerror=t}.bind(this))}.bind(this))}}.bind(this))}}})()},{"@openid/appauth":11}],2:[function(e){(function(){"use strict";window.location.hash=window.location.search.substring(1);var t,r=JSON.parse(localStorage.getItem("appAuthConfig")),o=e("./TokenManager");r&&window.location.hash.replace("#","").length&&(t=new o(r),t.getAvailableData().then(function(e){window.location.hash="",parent.postMessage({message:"appAuth-tokensAvailable",resourceServer:e.resourceServer,idTokenClaims:e.claims,idToken:e.idToken},TRUSTED_ORIGIN)},function(e){t.getAuthzURL().then(function(t){return parent.postMessage({message:"appAuth-interactionRequired",error:e,authorizationUrl:t},TRUSTED_ORIGIN)})}).finally(function(){parent.document.getElementById("AppAuthIframe")||setTimeout(function(){var e=document.createElement("a");e.href=r.appLocation||".",e.hash+="&loggedin=true",window.location.assign(e.href)},0)})),window.addEventListener("message",function(r){if(r.origin===TRUSTED_ORIGIN)switch(t=t||new o(r.data.config),r.data.message){case"appAuth-config":localStorage.setItem("appAuthConfig",JSON.stringify(r.data.config)),t.clearActiveAuthzRequests().then(function(){return r.ports[0].postMessage("configured")});break;case"appAuth-logout":t.logout(r.data.options).then(function(){parent.postMessage({message:"appAuth-logoutComplete"},TRUSTED_ORIGIN)});break;case"appAuth-getFreshAccessToken":t.silentAuthzRequest(r.data.resourceServer).then(function(e){"refreshToken"===e&&parent.postMessage({message:"appAuth-tokensAvailable",resourceServer:r.data.resourceServer},TRUSTED_ORIGIN)});break;case"appAuth-getAvailableData":t.getAvailableData().then(function(e){parent.postMessage({message:"appAuth-tokensAvailable",idTokenClaims:e.claims,idToken:e.idToken},TRUSTED_ORIGIN)},function(){t.silentAuthzRequest()});break;case"makeRSRequest":t.makeRSRequest(r.data.request).then(function(e){return r.ports[0].postMessage({response:e})},function(e){return r.ports[0].postMessage({error:e})});}})})()},{"./TokenManager":1}],3:[function(e){var t=String.prototype;window.Promise=window.Promise||("function"==typeof e("promise-polyfill")?e("promise-polyfill"):e("promise-polyfill").default),window.fetch=window.fetch||e("whatwg-fetch").fetch,e("url-polyfill"),e("webcrypto-shim"),t.includes=t.includes||function(e){return-1!==this.indexOf(e)},e("./appAuthHelperFetchTokens")},{"./appAuthHelperFetchTokens":2,"promise-polyfill":23,"url-polyfill":25,"webcrypto-shim":26,"whatwg-fetch":27}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("./crypto_utils"),n=e("./logger"),a=function(e){return e.generateRandom(10)},i=function(){function e(t,r,n){void 0===r&&(r=new o.DefaultCrypto),void 0===n&&(n=!0),this.crypto=r,this.usePkce=n,this.clientId=t.client_id,this.redirectUri=t.redirect_uri,this.scope=t.scope,this.responseType=t.response_type||e.RESPONSE_TYPE_CODE,this.state=t.state||a(r),this.extras=t.extras,this.internal=t.internal}return e.prototype.setupCodeVerifier=function(){var e=this;if(!this.usePkce)return Promise.resolve();var t=this.crypto.generateRandom(128),r=this.crypto.deriveChallenge(t).catch(function(e){n.log("Unable to generate PKCE challenge. Not using PKCE",e)});return r.then(function(r){r&&(e.internal=e.internal||{},e.internal.code_verifier=t,e.extras=e.extras||{},e.extras.code_challenge=r,e.extras.code_challenge_method="S256")})},e.prototype.toJson=function(){var e=this;return this.setupCodeVerifier().then(function(){return{response_type:e.responseType,client_id:e.clientId,redirect_uri:e.redirectUri,scope:e.scope,state:e.state,extras:e.extras,internal:e.internal}})},e.RESPONSE_TYPE_TOKEN="token",e.RESPONSE_TYPE_CODE="code",e}();r.AuthorizationRequest=i},{"./crypto_utils":8,"./logger":12}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("./logger"),n=function(){function e(){this.listener=null}return e.prototype.setAuthorizationListener=function(e){this.listener=e},e.prototype.onAuthorizationComplete=function(e,t,r){this.listener&&this.listener(e,t,r)},e}();r.AuthorizationNotifier=n,r.BUILT_IN_PARAMETERS=["redirect_uri","client_id","response_type","state","scope"];var a=function(){function e(e,t){this.utils=e,this.crypto=t,this.notifier=null}return e.prototype.buildRequestUrl=function(e,t){var o={redirect_uri:t.redirectUri,client_id:t.clientId,response_type:t.responseType,state:t.state,scope:t.scope};if(t.extras)for(var n in t.extras)t.extras.hasOwnProperty(n)&&0>r.BUILT_IN_PARAMETERS.indexOf(n)&&(o[n]=t.extras[n]);var a=this.utils.stringify(o),i=e.authorizationEndpoint;return i+"?"+a},e.prototype.completeAuthorizationRequestIfPossible=function(){var e=this;return o.log("Checking to see if there is an authorization response to be delivered."),this.notifier||o.log("Notifier is not present on AuthorizationRequest handler.\n No delivery of result will be possible"),this.completeAuthorizationRequest().then(function(t){t||o.log("No result is available yet."),t&&e.notifier&&e.notifier.onAuthorizationComplete(t.request,t.response,t.error)})},e.prototype.setAuthorizationNotifier=function(e){return this.notifier=e,this},e}();r.AuthorizationRequestHandler=a},{"./logger":12}],6:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e){this.code=e.code,this.state=e.state}return e.prototype.toJson=function(){return{code:this.code,state:this.state}},e}();r.AuthorizationResponse=o;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri,this.state=e.state}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri,state:this.state}},e}();r.AuthorizationError=n},{}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("./xhr"),n=function(){function e(e){this.authorizationEndpoint=e.authorization_endpoint,this.tokenEndpoint=e.token_endpoint,this.revocationEndpoint=e.revocation_endpoint,this.userInfoEndpoint=e.userinfo_endpoint,this.endSessionEndpoint=e.end_session_endpoint}return e.prototype.toJson=function(){return{authorization_endpoint:this.authorizationEndpoint,token_endpoint:this.tokenEndpoint,revocation_endpoint:this.revocationEndpoint,end_session_endpoint:this.endSessionEndpoint,userinfo_endpoint:this.userInfoEndpoint}},e.fetchFromIssuer=function(t,r){var n=r||new o.JQueryRequestor;return n.xhr({url:t+"/"+".well-known"+"/"+"openid-configuration",dataType:"json",method:"GET"}).then(function(t){return new e(t)})},e}();r.AuthorizationServiceConfiguration=n},{"./xhr":20}],8:[function(e,t,r){"use strict";function o(e){for(var t,r=[],o=0;o<e.byteLength;o+=1)t=e[o]%62,r.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[t]);return r.join("")}function n(e){var t=i.fromByteArray(new Uint8Array(e));return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function a(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}Object.defineProperty(r,"__esModule",{value:!0});var i=e("base64-js"),s=e("./errors"),p="undefined"!=typeof window&&!!window.crypto,l=p&&!!window.crypto.subtle;r.bufferToString=o,r.urlSafe=n,r.textEncodeLite=a;var d=function(){function e(){}return e.prototype.generateRandom=function(e){var t=new Uint8Array(e);if(p)window.crypto.getRandomValues(t);else for(var r=0;r<e;r+=1)t[r]=0|Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length;return o(t)},e.prototype.deriveChallenge=function(e){return 43>e.length||128<e.length?Promise.reject(new s.AppAuthError("Invalid code length.")):l?new Promise(function(t,r){crypto.subtle.digest("SHA-256",a(e)).then(function(e){return t(n(new Uint8Array(e)))},function(e){return r(e)})}):Promise.reject(new s.AppAuthError("window.crypto.subtle is unavailable."))},e}();r.DefaultCrypto=d},{"./errors":9,"base64-js":21}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(){return function(e,t){this.message=e,this.extras=t}}();r.AppAuthError=o},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.IS_LOG=!0,r.IS_PROFILE=!1},{}],11:[function(e,t,r){"use strict";function o(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0}),o(e("./authorization_request")),o(e("./authorization_request_handler")),o(e("./authorization_response")),o(e("./authorization_service_configuration")),o(e("./crypto_utils")),o(e("./errors")),o(e("./flags")),o(e("./logger")),o(e("./query_string_utils")),o(e("./redirect_based_handler")),o(e("./revoke_token_request")),o(e("./storage")),o(e("./token_request")),o(e("./token_request_handler")),o(e("./token_response")),o(e("./xhr"))},{"./authorization_request":4,"./authorization_request_handler":5,"./authorization_response":6,"./authorization_service_configuration":7,"./crypto_utils":8,"./errors":9,"./flags":10,"./logger":12,"./query_string_utils":13,"./redirect_based_handler":14,"./revoke_token_request":15,"./storage":16,"./token_request":17,"./token_request_handler":18,"./token_response":19,"./xhr":20}],12:[function(e,t,r){"use strict";function o(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(i.IS_LOG){var o=t?t.length:0;0<o?console.log.apply(console,a([e],t)):console.log(e)}}function n(e,t,r){var n=r.value,i=n.name;return i||(i="anonymous function"),r.value=s?function(e){console.profile(i);var t=window.performance.now(),r=n.call.apply(n,a([this||window],e)),o=window.performance.now()-t;return console.log(i+" took "+o+" ms"),console.profileEnd(),r}:function(e){o("Profile start "+i);var t=Date.now(),r=n.call.apply(n,a([this||window],e)),s=Date.now()-t;return o("Profile end "+i+" took "+s+" ms."),r},r}var a=this&&this.__spreadArrays||function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var n=Array(e),r=0,t=0;t<o;t++)for(var p=arguments[t],a=0,l=p.length;a<l;a++,r++)n[r]=p[a];return n};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./flags");r.log=o;var s="undefined"!=typeof window&&!!window.performance&&!!console.profile;r.profile=function(e,t,r){return i.IS_PROFILE?n(e,t,r):r}},{"./flags":10}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(){}return e.prototype.parse=function(e,t){return t?this.parseQueryString(e.hash):this.parseQueryString(e.search)},e.prototype.parseQueryString=function(e){var t={};e=e.trim().replace(/^(\?|#|&)/,"");for(var r=e.split("&"),o=0;o<r.length;o+=1){var n=r[o],a=n.split("=");if(2<=a.length){var s=decodeURIComponent(a.shift()),p=0<a.length?a.join("="):null;p&&(t[s]=decodeURIComponent(p))}}return t},e.prototype.stringify=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&e[r]&&t.push(encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t.join("&")},e}();r.BasicQueryStringUtils=o},{}],14:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function extendStatics(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=e("./authorization_request"),a=e("./authorization_request_handler"),i=e("./authorization_response"),s=e("./crypto_utils"),p=e("./logger"),l=e("./query_string_utils"),d=e("./storage"),u=function(e){return e+"_appauth_authorization_request"},c=function(e){return e+"_appauth_authorization_service_configuration"},h="appauth_current_authorization_request",y=function(e){function t(t,r,o,n){void 0===t&&(t=new d.LocalStorageBackend),void 0===r&&(r=new l.BasicQueryStringUtils),void 0===o&&(o=window.location),void 0===n&&(n=new s.DefaultCrypto);var a=e.call(this,r,n)||this;return a.storageBackend=t,a.locationLike=o,a}return o(t,e),t.prototype.performAuthorizationRequest=function(e,t){var r=this,o=this.crypto.generateRandom(10),n=Promise.all([this.storageBackend.setItem(h,o),t.toJson().then(function(e){return r.storageBackend.setItem(u(o),JSON.stringify(e))}),this.storageBackend.setItem(c(o),JSON.stringify(e.toJson()))]);n.then(function(){var o=r.buildRequestUrl(e,t);p.log("Making a request to ",t,o),r.locationLike.assign(o)})},t.prototype.completeAuthorizationRequest=function(){var e=this;return this.storageBackend.getItem(h).then(function(t){return t?e.storageBackend.getItem(u(t)).then(function(e){return JSON.parse(e)}).then(function(e){return new n.AuthorizationRequest(e)}).then(function(r){var o=""+e.locationLike.origin+e.locationLike.pathname,n=e.utils.parse(e.locationLike,!0),a=n.state,s=n.code,l=n.error;p.log("Potential authorization request ",o,n,a,s,l);var d=a===r.state,y=null,f=null;if(d){if(l){var g=n.error_uri,_=n.error_description;f=new i.AuthorizationError({error:l,error_description:_,error_uri:g,state:a})}else y=new i.AuthorizationResponse({code:s,state:a});return Promise.all([e.storageBackend.removeItem(h),e.storageBackend.removeItem(u(t)),e.storageBackend.removeItem(c(t))]).then(function(){return p.log("Delivering authorization response"),{request:r,response:y,error:f}})}return p.log("Mismatched request (state and request_uri) dont match."),Promise.resolve(null)}):null})},t}(a.AuthorizationRequestHandler);r.RedirectRequestHandler=y},{"./authorization_request":4,"./authorization_request_handler":5,"./authorization_response":6,"./crypto_utils":8,"./logger":12,"./query_string_utils":13,"./storage":16}],15:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e){this.token=e.token,this.tokenTypeHint=e.token_type_hint,this.clientId=e.client_id,this.clientSecret=e.client_secret}return e.prototype.toJson=function(){var e={token:this.token};return this.tokenTypeHint&&(e.token_type_hint=this.tokenTypeHint),this.clientId&&(e.client_id=this.clientId),this.clientSecret&&(e.client_secret=this.clientSecret),e},e.prototype.toStringMap=function(){var e=this.toJson();return e},e}();r.RevokeTokenRequest=o},{}],16:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function extendStatics(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(){}}();r.StorageBackend=n;var a=function(e){function t(t){var r=e.call(this)||this;return r.storage=t||window.localStorage,r}return o(t,e),t.prototype.getItem=function(e){var t=this;return new Promise(function(r){var o=t.storage.getItem(e);o?r(o):r(null)})},t.prototype.removeItem=function(e){var t=this;return new Promise(function(r){t.storage.removeItem(e),r()})},t.prototype.clear=function(){var e=this;return new Promise(function(t){e.storage.clear(),t()})},t.prototype.setItem=function(e,t){var r=this;return new Promise(function(o){r.storage.setItem(e,t),o()})},t}(n);r.LocalStorageBackend=a},{}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.GRANT_TYPE_AUTHORIZATION_CODE="authorization_code",r.GRANT_TYPE_REFRESH_TOKEN="refresh_token";var o=function(){function e(e){this.clientId=e.client_id,this.redirectUri=e.redirect_uri,this.grantType=e.grant_type,this.code=e.code,this.refreshToken=e.refresh_token,this.extras=e.extras}return e.prototype.toJson=function(){return{grant_type:this.grantType,code:this.code,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,client_id:this.clientId,extras:this.extras}},e.prototype.toStringMap=function(){var e={grant_type:this.grantType,client_id:this.clientId,redirect_uri:this.redirectUri};if(this.code&&(e.code=this.code),this.refreshToken&&(e.refresh_token=this.refreshToken),this.extras)for(var t in this.extras)this.extras.hasOwnProperty(t)&&!e.hasOwnProperty(t)&&(e[t]=this.extras[t]);return e},e}();r.TokenRequest=o},{}],18:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=e("./errors"),n=e("./query_string_utils"),a=e("./token_response"),i=e("./xhr"),s=function(){function e(e,t){void 0===e&&(e=new i.JQueryRequestor),void 0===t&&(t=new n.BasicQueryStringUtils),this.requestor=e,this.utils=t}return e.prototype.isTokenResponse=function(e){return void 0===e.error},e.prototype.performRevokeTokenRequest=function(e,t){var r=this.requestor.xhr({url:e.revocationEndpoint,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())});return r.then(function(){return!0})},e.prototype.performTokenRequest=function(e,t){var r=this,n=this.requestor.xhr({url:e.tokenEndpoint,method:"POST",dataType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:this.utils.stringify(t.toStringMap())});return n.then(function(e){return r.isTokenResponse(e)?new a.TokenResponse(e):Promise.reject(new o.AppAuthError(e.error,new a.TokenError(e)))})},e}();r.BaseTokenRequestHandler=s},{"./errors":9,"./query_string_utils":13,"./token_response":19,"./xhr":20}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.nowInSeconds=function(){return Math.round(new Date().getTime()/1e3)};var o=function(){function e(e){this.accessToken=e.access_token,this.tokenType=e.token_type||"bearer",this.expiresIn=e.expires_in,this.refreshToken=e.refresh_token,this.scope=e.scope,this.idToken=e.id_token,this.issuedAt=e.issued_at||r.nowInSeconds()}return e.prototype.toJson=function(){return{access_token:this.accessToken,id_token:this.idToken,refresh_token:this.refreshToken,scope:this.scope,token_type:this.tokenType,issued_at:this.issuedAt,expires_in:this.expiresIn}},e.prototype.isValid=function(e){if(void 0===e&&(e=-600),this.expiresIn){var t=r.nowInSeconds();return t<this.issuedAt+this.expiresIn+e}return!0},e}();r.TokenResponse=o;var n=function(){function e(e){this.error=e.error,this.errorDescription=e.error_description,this.errorUri=e.error_uri}return e.prototype.toJson=function(){return{error:this.error,error_description:this.errorDescription,error_uri:this.errorUri}},e}();r.TokenError=n},{}],20:[function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function extendStatics(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(r,"__esModule",{value:!0});var n=e("./errors"),a=function(){return function(){}}();r.Requestor=a;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){var t=$.ajax(e);return new Promise(function(e,r){t.then(function(t){e(t)},function(e,t,o){r(new n.AppAuthError(o))})})},t}(a);r.JQueryRequestor=i;var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.xhr=function(e){if(!e.url)return Promise.reject(new n.AppAuthError("A URL must be provided."));var t=new URL(e.url),r={};if(r.method=e.method,r.mode="cors",e.data)if(e.method&&"POST"===e.method.toUpperCase())r.body=e.data;else{var o=new URLSearchParams(e.data);o.forEach(function(e,r){t.searchParams.append(r,e)})}if(r.headers={},e.headers)for(var a in e.headers)e.headers.hasOwnProperty(a)&&(r.headers[a]=e.headers[a]);var i=e.dataType&&"json"===e.dataType.toLowerCase();return i&&(r.headers.Accept="application/json, text/javascript, */*; q=0.01"),fetch(t.toString(),r).then(function(e){if(200<=e.status&&300>e.status){var t=e.headers.get("content-type");return i||t&&-1!==t.indexOf("application/json")?e.json():e.text()}return Promise.reject(new n.AppAuthError(e.status.toString(),e.statusText))})},t}(a);r.FetchRequestor=s;var p=function(e){function t(t){var r=e.call(this)||this;return r.promise=t,r}return o(t,e),t.prototype.xhr=function(){return this.promise},t}(a);r.TestRequestor=p},{"./errors":9}],21:[function(e,t,r){'use strict';function o(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var o=r===t?0:4-r%4;return[r,o]}function n(e,t,r){return 3*(t+r)/4-r}function a(e){var t,r,a=o(e),s=a[0],p=a[1],l=new c(n(e,s,p)),d=0,h=0<p?s-4:s;for(r=0;r<h;r+=4)t=u[e.charCodeAt(r)]<<18|u[e.charCodeAt(r+1)]<<12|u[e.charCodeAt(r+2)]<<6|u[e.charCodeAt(r+3)],l[d++]=255&t>>16,l[d++]=255&t>>8,l[d++]=255&t;return 2===p&&(t=u[e.charCodeAt(r)]<<2|u[e.charCodeAt(r+1)]>>4,l[d++]=255&t),1===p&&(t=u[e.charCodeAt(r)]<<10|u[e.charCodeAt(r+1)]<<4|u[e.charCodeAt(r+2)]>>2,l[d++]=255&t>>8,l[d++]=255&t),l}function s(e){return d[63&e>>18]+d[63&e>>12]+d[63&e>>6]+d[63&e]}function p(e,t,r){for(var o,n=[],a=t;a<r;a+=3)o=(16711680&e[a]<<16)+(65280&e[a+1]<<8)+(255&e[a+2]),n.push(s(o));return n.join("")}function l(e){for(var t,r=e.length,o=r%3,n=[],a=16383,s=0,l=r-o;s<l;s+=a)n.push(p(e,s,s+a>l?l:s+a));return 1===o?(t=e[r-1],n.push(d[t>>2]+d[63&t<<4]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],n.push(d[t>>10]+d[63&t>>4]+d[63&t<<2]+"=")),n.join("")}r.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=a,r.fromByteArray=l;for(var d=[],u=[],c="undefined"==typeof Uint8Array?Array:Uint8Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,f=h.length;y<f;++y)d[y]=h[y],u[h.charCodeAt(y)]=y;u[45]=62,u[95]=63},{}],22:[function(e,t){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function n(t){if(d===setTimeout)return setTimeout(t,0);if((d===r||!d)&&setTimeout)return d=setTimeout,setTimeout(t,0);try{return d(t,0)}catch(r){try{return d.call(null,t,0)}catch(r){return d.call(this,t,0)}}}function a(t){if(u===clearTimeout)return clearTimeout(t);if((u===o||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(r){try{return u.call(null,t)}catch(r){return u.call(this,t)}}}function i(){f&&h&&(f=!1,h.length?y=h.concat(y):g=-1,y.length&&s())}function s(){if(!f){var e=n(i);f=!0;for(var t=y.length;t;){for(h=y,y=[];++g<t;)h&&h[g].run();g=-1,t=y.length}h=null,f=!1,a(e)}}function p(e,t){this.fun=e,this.array=t}function l(){}var d,u,c=t.exports={};(function(){try{d="function"==typeof setTimeout?setTimeout:r}catch(t){d=r}try{u="function"==typeof clearTimeout?clearTimeout:o}catch(t){u=o}})();var h,y=[],f=!1,g=-1;c.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new p(e,t)),1!==y.length||f||n(s)},p.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=l,c.addListener=l,c.once=l,c.off=l,c.removeListener=l,c.removeAllListeners=l,c.emit=l,c.prependListener=l,c.prependOnceListener=l,c.listeners=function(){return[]},c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],23:[function(e,t){(function(e){'use strict';function r(e){return!!(e&&"undefined"!=typeof e.length)}function o(){}function n(e,t){return function(){e.apply(t,arguments)}}function a(e){if(!(this instanceof a))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function s(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):void(e._handled=!0,a._immediateFn(function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null===r)return void(1===e._state?p:l)(t.promise,e._value);var o;try{o=r(e._value)}catch(r){return void l(t.promise,r)}p(t.promise,o)}))}function p(t,r){try{if(r===t)throw new TypeError("A promise cannot be resolved with itself.");if(r&&("object"===_typeof(r)||"function"==typeof r)){var o=r.then;if(r instanceof a)return t._state=3,t._value=r,void d(t);if("function"==typeof o)return void c(n(o,r),t)}t._state=1,t._value=r,d(t)}catch(r){l(t,r)}}function l(e,t){e._state=2,e._value=t,d(e)}function d(e){2===e._state&&0===e._deferreds.length&&a._immediateFn(function(){e._handled||a._unhandledRejectionFn(e._value)});for(var t=0,r=e._deferreds.length;t<r;t++)s(e,e._deferreds[t]);e._deferreds=null}function u(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function c(e,t){var r=!1;try{e(function(e){r||(r=!0,p(t,e))},function(e){r||(r=!0,l(t,e))})}catch(e){if(r)return;r=!0,l(t,e)}}var h=setTimeout;a.prototype["catch"]=function(e){return this.then(null,e)},a.prototype.then=function(e,t){var r=new this.constructor(o);return s(this,new u(e,t,r)),r},a.prototype["finally"]=function(e){var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){return t.reject(r)})})},a.all=function(e){return new a(function(t,o){function n(e,r){try{if(r&&("object"===_typeof(r)||"function"==typeof r)){var i=r.then;if("function"==typeof i)return void i.call(r,function(t){n(e,t)},o)}a[e]=r,0==--s&&t(a)}catch(e){o(e)}}if(!r(e))return o(new TypeError("Promise.all accepts an array"));var a=Array.prototype.slice.call(e);if(0===a.length)return t([]);for(var s=a.length,p=0;p<a.length;p++)n(p,a[p])})},a.resolve=function(e){return e&&"object"===_typeof(e)&&e.constructor===a?e:new a(function(t){t(e)})},a.reject=function(e){return new a(function(t,r){r(e)})},a.race=function(e){return new a(function(t,o){if(!r(e))return o(new TypeError("Promise.race accepts an array"));for(var n=0,s=e.length;n<s;n++)a.resolve(e[n]).then(t,o)})},a._immediateFn="function"==typeof e&&function(t){e(t)}||function(e){h(e,0)},a._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},t.exports=a}).call(this,e("timers").setImmediate)},{timers:24}],24:[function(e,t,r){(function(t,o){function n(e,t){this._id=e,this._clearFn=t}var a=e("process/browser.js").nextTick,i=Function.prototype.apply,s=Array.prototype.slice,p={},l=0;r.setTimeout=function(){return new n(i.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new n(i.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(e){e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},r.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},r._unrefActive=r.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r.setImmediate="function"==typeof t?t:function(e){var t=l++,o=!(2>arguments.length)&&s.call(arguments,1);return p[t]=!0,a(function(){p[t]&&(o?e.apply(null,o):e.call(null),r.clearImmediate(t))}),t},r.clearImmediate="function"==typeof o?o:function(e){delete p[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":22,timers:24}],25:[function(){(function(e){(function(e){var t=function checkIfIteratorIsSupported(){try{return!!Symbol.iterator}catch(e){return!1}}(),r=function(e){var r={next:function next(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(r[Symbol.iterator]=function(){return r}),r},o=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},n=function(e){return decodeURIComponent((e+"").replace(/\+/g," "))};(function checkIfURLSearchParamsSupported(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set&&"function"==typeof t.prototype.entries}catch(t){return!1}})()||function polyfillURLSearchParams(){var n=function(e){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var t=_typeof(e);if("undefined"===t);else if("string"===t)""!==e&&this._fromString(e);else if(e instanceof n){var r=this;e.forEach(function(e,t){r.append(t,e)})}else if(!(null!==e&&"object"===t))throw new TypeError("Unsupported input's type for URLSearchParams");else if("[object Array]"===Object.prototype.toString.call(e)){for(var o,a=0;a<e.length;a++)if(o=e[a],"[object Array]"===Object.prototype.toString.call(o)||2!==o.length)this.append(o[0],o[1]);else throw new TypeError("Expected [string, any] as entry at index "+a+" of URLSearchParams's input");}else for(var s in e)e.hasOwnProperty(s)&&this.append(s,e[s])},a=n.prototype;a.append=function(e,t){e in this._entries?this._entries[e].push(t+""):this._entries[e]=[t+""]},a.delete=function(e){delete this._entries[e]},a.get=function(e){return e in this._entries?this._entries[e][0]:null},a.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},a.has=function(e){return e in this._entries},a.set=function(e,t){this._entries[e]=[t+""]},a.forEach=function(e,t){var r;for(var o in this._entries)if(this._entries.hasOwnProperty(o)){r=this._entries[o];for(var n=0;n<r.length;n++)e.call(t,r[n],o,this)}},a.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),r(e)},a.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),r(e)},a.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),r(e)},t&&(a[Symbol.iterator]=a.entries),a.toString=function(){var e=[];return this.forEach(function(t,r){e.push(o(r)+"="+o(t))}),e.join("&")},e.URLSearchParams=n}();var a=e.URLSearchParams.prototype;"function"!=typeof a.sort&&(a.sort=function(){var e=this,t=[];this.forEach(function(r,o){t.push([o,r]),e._entries||e.delete(o)}),t.sort(function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0}),e._entries&&(e._entries={});for(var r=0;r<t.length;r++)this.append(t[r][0],t[r][1])}),"function"!=typeof a._fromString&&Object.defineProperty(a,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function value(e){if(this._entries)this._entries={};else{var t=[];this.forEach(function(e,r){t.push(r)});for(var r=0;r<t.length;r++)this.delete(t[r])}e=e.replace(/^\?/,"");for(var o,a=e.split("&"),r=0;r<a.length;r++)o=a[r].split("="),this.append(n(o[0]),1<o.length?n(o[1]):"")}})})("undefined"==typeof e?"undefined"==typeof window?"undefined"==typeof self?this:self:window:e),function(e){if(function checkIfURLIsSupported(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(t){return!1}}()||function polyfillURL(){var t=e.URL,r=function(t,r){"string"!=typeof t&&(t+="");var o,n=document;if(r&&(void 0===e.location||r!==e.location.href)){n=document.implementation.createHTMLDocument(""),o=n.createElement("base"),o.href=r,n.head.appendChild(o);try{if(0!==o.href.indexOf(r))throw new Error(o.href)}catch(e){throw new Error("URL unable to set base "+r+" due to "+e)}}var a=n.createElement("a");a.href=t,o&&(n.body.appendChild(a),a.href=a.href);var i=n.createElement("input");if(i.type="url",i.value=t,":"===a.protocol||!/:/.test(a.href)||!i.checkValidity()&&!r)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var s=new e.URLSearchParams(this.search),p=!0,l=!0,d=this;["append","delete","set"].forEach(function(e){var t=s[e];s[e]=function(){t.apply(s,arguments),p&&(l=!1,d.search=s.toString(),l=!0)}}),Object.defineProperty(this,"searchParams",{value:s,enumerable:!0});var u;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function value(){this.search!==u&&(u=this.search,l&&(p=!1,this.searchParams._fromString(this.search),p=!0))}})},o=r.prototype,n=function(e){Object.defineProperty(o,e,{get:function get(){return this._anchorElement[e]},set:function set(t){this._anchorElement[e]=t},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(e){n(e)}),Object.defineProperty(o,"search",{get:function get(){return this._anchorElement.search},set:function set(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(o,{toString:{get:function get(){var e=this;return function(){return e.href}}},href:{get:function get(){return this._anchorElement.href.replace(/\?$/,"")},set:function set(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function get(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function set(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function get(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function get(){return""},set:function set(){},enumerable:!0},username:{get:function get(){return""},set:function set(){},enumerable:!0}}),r.createObjectURL=function(){return t.createObjectURL.apply(t,arguments)},r.revokeObjectURL=function(){return t.revokeObjectURL.apply(t,arguments)},e.URL=r}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(r){setInterval(function(){e.location.origin=t()},100)}}}("undefined"==typeof e?"undefined"==typeof window?"undefined"==typeof self?this:self:window:e)}).call(this,"undefined"==typeof global?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:global)},{}],26:[function(e,t){var r=String.fromCharCode;(function(e,r){"function"==typeof define&&define.amd?define([],function(){return r(e)}):"object"===_typeof(t)&&t.exports?t.exports=r(e):r(e)})("undefined"==typeof self?this:self,function(e){'use strict';function t(e){return btoa(e).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function o(e){return e+="===",e=e.slice(0,-e.length%4),atob(e.replace(/-/g,"+").replace(/_/g,"/"))}function n(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function a(e){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),r.apply(String,e)}function i(e){var t={name:(e.name||e||"").toUpperCase().replace("V","v")};switch(t.name){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;case"AES-CBC":case"AES-GCM":case"AES-KW":e.length&&(t.length=e.length);break;case"HMAC":e.hash&&(t.hash=i(e.hash)),e.length&&(t.length=e.length);break;case"RSAES-PKCS1-v1_5":e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;case"RSASSA-PKCS1-v1_5":case"RSA-OAEP":e.hash&&(t.hash=i(e.hash)),e.publicExponent&&(t.publicExponent=new Uint8Array(e.publicExponent)),e.modulusLength&&(t.modulusLength=e.modulusLength);break;default:throw new SyntaxError("Bad algorithm name");}return t}function s(e){return{HMAC:{"SHA-1":"HS1","SHA-256":"HS256","SHA-384":"HS384","SHA-512":"HS512"},"RSASSA-PKCS1-v1_5":{"SHA-1":"RS1","SHA-256":"RS256","SHA-384":"RS384","SHA-512":"RS512"},"RSAES-PKCS1-v1_5":{"":"RSA1_5"},"RSA-OAEP":{"SHA-1":"RSA-OAEP","SHA-256":"RSA-OAEP-256"},"AES-KW":{128:"A128KW",192:"A192KW",256:"A256KW"},"AES-GCM":{128:"A128GCM",192:"A192GCM",256:"A256GCM"},"AES-CBC":{128:"A128CBC",192:"A192CBC",256:"A256CBC"}}[e.name][(e.hash||{}).name||e.length||""]}function p(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&(e=JSON.parse(decodeURIComponent(escape(a(e)))));var t={kty:e.kty,alg:e.alg,ext:e.ext||e.extractable};switch(t.kty){case"oct":t.k=e.k;case"RSA":["n","e","d","p","q","dp","dq","qi","oth"].forEach(function(r){r in e&&(t[r]=e[r])});break;default:throw new TypeError("Unsupported key type");}return t}function l(e){var t=p(e);return R&&(t.extractable=t.ext,delete t.ext),n(unescape(encodeURIComponent(JSON.stringify(t)))).buffer}function d(e){var r=c(e),o=!1;2<r.length&&(o=!0,r.shift());var n={ext:!0};switch(r[0][0]){case"1.2.840.113549.1.1.1":var s=["n","e","d","p","q","dp","dq","qi"],p=c(r[1]);o&&p.shift();for(var l=0;l<p.length;l++)p[l][0]||(p[l]=p[l].subarray(1)),n[s[l]]=t(a(p[l]));n.kty="RSA";break;default:throw new TypeError("Unsupported key type");}return n}function u(e){var t,r=[["",null]],a=!1;switch(e.kty){case"RSA":for(var s,p=["n","e","d","p","q","dp","dq","qi"],l=[],d=0;d<p.length&&!!(p[d]in e);d++)s=l[d]=n(o(e[p[d]])),128&s[0]&&(l[d]=new Uint8Array(s.length+1),l[d].set(s,1));2<l.length&&(a=!0,l.unshift(new Uint8Array([0]))),r[0][0]="1.2.840.113549.1.1.1",t=l;break;default:throw new TypeError("Unsupported key type");}return r.push(new Uint8Array(h(t)).buffer),a?r.unshift(new Uint8Array([0])):r[1]={tag:3,value:r[1]},new Uint8Array(h(r)).buffer}function c(e,t){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),t||(t={pos:0,end:e.length}),2>t.end-t.pos||t.end>e.length)throw new RangeError("Malformed DER");var r=e[t.pos++],o=e[t.pos++];if(128<=o){if(o&=127,t.end-t.pos<o)throw new RangeError("Malformed DER");for(var n=0;o--;)n<<=8,n|=e[t.pos++];o=n}if(t.end-t.pos<o)throw new RangeError("Malformed DER");var i;switch(r){case 2:i=e.subarray(t.pos,t.pos+=o);break;case 3:if(e[t.pos++])throw new Error("Unsupported bit string");o--;case 4:i=new Uint8Array(e.subarray(t.pos,t.pos+=o)).buffer;break;case 5:i=null;break;case 6:var s=btoa(a(e.subarray(t.pos,t.pos+=o)));if(!(s in C))throw new Error("Unsupported OBJECT ID "+s);i=C[s];break;case 48:i=[];for(var p=t.pos+o;t.pos<p;)i.push(c(e,t));break;default:throw new Error("Unsupported DER tag 0x"+r.toString(16));}return i}function h(e,t){t||(t=[]);var r=0,o=0,a=t.length+2;if(t.push(0,0),e instanceof Uint8Array){r=2,o=e.length;for(var s=0;s<o;s++)t.push(e[s])}else if(e instanceof ArrayBuffer){r=4,o=e.byteLength,e=new Uint8Array(e);for(var s=0;s<o;s++)t.push(e[s])}else if(null===e)r=5,o=0;else if("string"==typeof e&&e in I){var p=n(atob(I[e]));r=6,o=p.length;for(var s=0;s<o;s++)t.push(p[s])}else if(e instanceof Array){for(var s=0;s<e.length;s++)h(e[s],t);r=48,o=t.length-a}else if("object"===_typeof(e)&&3===e.tag&&e.value instanceof ArrayBuffer){e=new Uint8Array(e.value),r=3,o=e.byteLength,t.push(0);for(var s=0;s<o;s++)t.push(e[s]);o++}else throw new Error("Unsupported DER value "+e);if(128<=o){var l=o,o=4;for(t.splice(a,0,255&l>>24,255&l>>16,255&l>>8,255&l);1<o&&!(l>>24);)l<<=8,o--;4>o&&t.splice(a,4-o),o|=128}return t.splice(a-2,2,r,o),t}function y(e,t,r,o){Object.defineProperties(this,{_key:{value:e},type:{value:e.type,enumerable:!0},extractable:{value:void 0===r?e.extractable:r,enumerable:!0},algorithm:{value:void 0===t?e.algorithm:t,enumerable:!0},usages:{value:void 0===o?e.usages:o,enumerable:!0}})}function f(e){return"verify"===e||"encrypt"===e||"wrapKey"===e}function g(e){return"sign"===e||"decrypt"===e||"unwrapKey"===e}if("function"!=typeof Promise)throw"Promise support required";var _=e.crypto||e.msCrypto;if(_){var A=_.subtle||_.webkitSubtle;if(A){var v=e.Crypto||_.constructor||Object,T=e.SubtleCrypto||A.constructor||Object,S=e.CryptoKey||e.Key||Object,E=-1<e.navigator.userAgent.indexOf("Edge/"),R=!!e.msCrypto&&!E,x=!_.subtle&&!!_.webkitSubtle;if(R||x){var C={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},I={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};if(["generateKey","importKey","unwrapKey"].forEach(function(e){var t=A[e];A[e]=function(r,u,h){var c,m,v,T=[].slice.call(arguments);if("generateKey"===e?(c=i(r),m=u,v=h):"importKey"===e?(c=i(h),m=T[3],v=T[4],"jwk"===r&&(u=p(u),!u.alg&&(u.alg=s(c)),!u.key_ops&&(u.key_ops="oct"===u.kty?v.slice():"d"in u?v.filter(g):v.filter(f)),T[1]=l(u))):"unwrapKey"===e?(c=T[4],m=T[5],v=T[6],T[2]=h._key):void 0,"generateKey"===e&&"HMAC"===c.name&&c.hash)return c.length=c.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[c.hash.name],A.importKey("raw",_.getRandomValues(new Uint8Array(c.length+7>>3)),c,m,v);if(x&&"generateKey"===e&&"RSASSA-PKCS1-v1_5"===c.name&&(!c.modulusLength||2048<=c.modulusLength))return r=i(r),r.name="RSAES-PKCS1-v1_5",delete r.hash,A.generateKey(r,!0,["encrypt","decrypt"]).then(function(e){return Promise.all([A.exportKey("jwk",e.publicKey),A.exportKey("jwk",e.privateKey)])}).then(function(e){return e[0].alg=e[1].alg=s(c),e[0].key_ops=v.filter(f),e[1].key_ops=v.filter(g),Promise.all([A.importKey("jwk",e[0],c,!0,e[0].key_ops),A.importKey("jwk",e[1],c,m,e[1].key_ops)])}).then(function(e){return{publicKey:e[0],privateKey:e[1]}});if((x||R&&"SHA-1"===(c.hash||{}).name)&&"importKey"===e&&"jwk"===r&&"HMAC"===c.name&&"oct"===u.kty)return A.importKey("raw",n(o(u.k)),h,T[3],T[4]);if(x&&"importKey"===e&&("spki"===r||"pkcs8"===r))return A.importKey("jwk",d(u),h,T[3],T[4]);if(R&&"unwrapKey"===e)return A.decrypt(T[3],h,u).then(function(e){return A.importKey(r,e,T[4],T[5],T[6])});var S;try{S=t.apply(A,T)}catch(t){return Promise.reject(t)}return R&&(S=new Promise(function(e,t){S.onabort=S.onerror=function(r){t(r)},S.oncomplete=function(t){e(t.target.result)}})),S=S.then(function(e){return"HMAC"!==c.name||c.length||(c.length=8*e.algorithm.length),0==c.name.search("RSA")&&(!c.modulusLength&&(c.modulusLength=(e.publicKey||e).algorithm.modulusLength),!c.publicExponent&&(c.publicExponent=(e.publicKey||e).algorithm.publicExponent)),e=e.publicKey&&e.privateKey?{publicKey:new y(e.publicKey,c,m,v.filter(f)),privateKey:new y(e.privateKey,c,m,v.filter(g))}:new y(e,c,m,v),e}),S}}),["exportKey","wrapKey"].forEach(function(e){var r=A[e];A[e]=function(o,i,l){var d=[].slice.call(arguments);if("exportKey"===e?d[1]=i._key:"wrapKey"===e?(d[1]=i._key,d[2]=l._key):void 0,(x||R&&"SHA-1"===(i.algorithm.hash||{}).name)&&"exportKey"===e&&"jwk"===o&&"HMAC"===i.algorithm.name&&(d[0]="raw"),x&&"exportKey"===e&&("spki"===o||"pkcs8"===o)&&(d[0]="jwk"),R&&"wrapKey"===e)return A.exportKey(o,i).then(function(e){return"jwk"===o&&(e=n(unescape(encodeURIComponent(JSON.stringify(p(e)))))),A.encrypt(d[3],l,e)});var c;try{c=r.apply(A,d)}catch(t){return Promise.reject(t)}return R&&(c=new Promise(function(e,t){c.onabort=c.onerror=function(r){t(r)},c.oncomplete=function(t){e(t.target.result)}})),"exportKey"===e&&"jwk"===o&&(c=c.then(function(e){return(x||R&&"SHA-1"===(i.algorithm.hash||{}).name)&&"HMAC"===i.algorithm.name?{kty:"oct",alg:s(i.algorithm),key_ops:i.usages.slice(),ext:!0,k:t(a(e))}:(e=p(e),e.alg||(e.alg=s(i.algorithm)),e.key_ops||(e.key_ops="public"===i.type?i.usages.filter(f):"private"===i.type?i.usages.filter(g):i.usages.slice()),e)})),x&&"exportKey"===e&&("spki"===o||"pkcs8"===o)&&(c=c.then(function(e){return e=u(p(e)),e})),c}}),["encrypt","decrypt","sign","verify"].forEach(function(e){var t=A[e];A[e]=function(r,o,n,a){if(R&&(!n.byteLength||a&&!a.byteLength))throw new Error("Empy input is not allowed");var s=[].slice.call(arguments),p=i(r);if(R&&("sign"===e||"verify"===e)&&("RSASSA-PKCS1-v1_5"===r||"HMAC"===r)&&(s[0]={name:r}),R&&o.algorithm.hash&&(s[0].hash=s[0].hash||o.algorithm.hash),R&&"decrypt"===e&&"AES-GCM"===p.name){var l=r.tagLength>>3;s[2]=(n.buffer||n).slice(0,n.byteLength-l),r.tag=(n.buffer||n).slice(n.byteLength-l)}s[1]=o._key;var d;try{d=t.apply(A,s)}catch(t){return Promise.reject(t)}return R&&(d=new Promise(function(o,n){d.onabort=d.onerror=function(t){n(t)},d.oncomplete=function(n){var n=n.target.result;if("encrypt"===e&&n instanceof AesGcmEncryptResult){var a=n.ciphertext,i=n.tag;n=new Uint8Array(a.byteLength+i.byteLength),n.set(new Uint8Array(a),0),n.set(new Uint8Array(i),a.byteLength),n=n.buffer}o(n)}})),d}}),R){var P=A.digest;A.digest=function(e,t){if(!t.byteLength)throw new Error("Empy input is not allowed");var r;try{r=P.call(A,e,t)}catch(t){return Promise.reject(t)}return r=new Promise(function(e,t){r.onabort=r.onerror=function(r){t(r)},r.oncomplete=function(t){e(t.target.result)}}),r},e.crypto=Object.create(_,{getRandomValues:{value:function value(e){return _.getRandomValues(e)}},subtle:{value:A}}),e.CryptoKey=y}x&&(_.subtle=A,e.Crypto=v,e.SubtleCrypto=T,e.CryptoKey=y)}}}})},{}],27:[function(e,t,r){(function(e,o){"object"===_typeof(r)&&"undefined"!=typeof t?o(r):"function"==typeof define&&define.amd?define(["exports"],o):o(e.WHATWGFetch={})})(this,function(e){function t(e){return e&&DataView.prototype.isPrototypeOf(e)}function r(e){if("string"!=typeof e&&(e+=""),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function o(e){return"string"!=typeof e&&(e+=""),e}function n(e){var t={next:function next(){var t=e.shift();return{done:void 0===t,value:t}}};return b.iterable&&(t[Symbol.iterator]=function(){return t}),t}function a(e){this.map={},e instanceof a?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function i(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function s(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=s(t);return t.readAsArrayBuffer(e),r}function l(e){var t=new FileReader,r=s(t);return t.readAsText(e),r}function d(e){for(var t=new Uint8Array(e),r=Array(t.length),o=0;o<t.length;o++)r[o]=String.fromCharCode(t[o]);return r.join("")}function u(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:b.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:b.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:b.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():b.arrayBuffer&&b.blob&&t(e)?(this._bodyArrayBuffer=u(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):b.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||v(e))?this._bodyArrayBuffer=u(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):b.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},b.blob&&(this.blob=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");else return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return l(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(d(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");else return Promise.resolve(this._bodyText)},b.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function h(e){var t=e.toUpperCase();return-1<T.indexOf(t)?t:e}function y(e,t){t=t||{};var r=t.body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new a(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e+"";if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new a(t.headers)),this.method=h(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(r),("GET"===this.method||"HEAD"===this.method)&&("no-store"===t.cache||"no-cache"===t.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+new Date().getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(o),decodeURIComponent(n))}}),t}function g(e){var t=new a,r=e.replace(/\r?\n[\t ]+/g," ");return r.split(/\r?\n/).forEach(function(e){var r=e.split(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();t.append(o,n)}}),t}function _(e,t){t||(t={}),this.type="default",this.status=t.status===void 0?200:t.status,this.ok=200<=this.status&&300>this.status,this.statusText="statusText"in t?t.statusText:"",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}function m(t,r){return new Promise(function(o,n){function a(){s.abort()}var i=new y(t,r);if(i.signal&&i.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;s.onload=function(){var e={status:s.status,statusText:s.statusText,headers:g(s.getAllResponseHeaders()||"")};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var t="response"in s?s.response:s.responseText;setTimeout(function(){o(new _(t,e))},0)},s.onerror=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){n(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){n(new e.DOMException("Aborted","AbortError"))},0)},s.open(i.method,function(t){try{return""===t&&k.location.href?k.location.href:t}catch(r){return t}}(i.url),!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&(b.blob?s.responseType="blob":b.arrayBuffer&&i.headers.get("Content-Type")&&-1!==i.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),i.signal&&(i.signal.addEventListener("abort",a),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",a)}),s.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})}var k=function(e){return e}("undefined"==typeof self?this:self),b={searchParams:"URLSearchParams"in k,iterable:"Symbol"in k&&"iterator"in Symbol,blob:"FileReader"in k&&"Blob"in k&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in k,arrayBuffer:"ArrayBuffer"in k};if(b.arrayBuffer)var A=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=ArrayBuffer.isView||function(e){return e&&-1<A.indexOf(Object.prototype.toString.call(e))};a.prototype.append=function(e,t){e=r(e),t=o(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},a.prototype["delete"]=function(e){delete this.map[r(e)]},a.prototype.get=function(e){return e=r(e),this.has(e)?this.map[e]:null},a.prototype.has=function(e){return this.map.hasOwnProperty(r(e))},a.prototype.set=function(e,t){this.map[r(e)]=o(t)},a.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},a.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),n(e)},a.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),n(e)},a.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),n(e)},b.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},c.call(y.prototype),c.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];_.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},e.DOMException=k.DOMException,"function"!=typeof e.DOMException&&(e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException),m.polyfill=!0,k.fetch||(k.fetch=m,k.Headers=a,k.Request=y,k.Response=_),e.Headers=a,e.Request=y,e.Response=_,e.fetch=m,Object.defineProperty(e,"__esModule",{value:!0})})},{}]},{},[3]);