@okta/okta-auth-js
Version:
The Okta Auth SDK
2 lines • 200 kB
JavaScript
/*! For license information please see myaccount.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OktaAuth=t():e.OktaAuth=t()}(self,(function(){return function(){var e={1506:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},4575:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},9100:function(e,t,n){var r=n(9489),o=n(7067);function i(t,n,a){return o()?(e.exports=i=Reflect.construct,e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=i=function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&r(i,n.prototype),i},e.exports.__esModule=!0,e.exports.default=e.exports),i.apply(null,arguments)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},3913:function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},9754:function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},2205:function(e,t,n){var r=n(9489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},430:function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},7067:function(e){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},8585:function(e,t,n){var r=n(8).default,o=n(1506);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},9489:function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},8:function(e){function t(n){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},5957:function(e,t,n){var r=n(9754),o=n(9489),i=n(430),a=n(9100);function s(t){var n="function"==typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!i(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return a(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,s(t)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports},7757:function(e,t,n){e.exports=n(5666)},9893:function(e,t,n){"use strict";n.d(t,{a:function(){return f}});var r=n(5671),o=n(4942),i=n(3193),a=n(415),s=n(1971),u=n(4279),c=n.n(u);function f(e){var t=function t(){(0,r.Z)(this,t),(0,o.Z)(this,"options",void 0),(0,o.Z)(this,"emitter",void 0),(0,o.Z)(this,"features",void 0);var n=new e(arguments.length&&(arguments.length<=0?void 0:arguments[0])||{});this.options=(0,i.YY)(n),this.emitter=new(c()),this.features=a};return(0,o.Z)(t,"features",a),(0,o.Z)(t,"constants",s),t.features=t.prototype.features=a,Object.assign(t,{constants:s}),t}},3306:function(e,t,n){"use strict";n.d(t,{a:function(){return r.a},X:function(){return o.X}});var r=n(9893),o=n(5093)},5093:function(e,t,n){"use strict";n.d(t,{X:function(){return i}});var r=n(5671),o=n(4942);function i(){return function e(t){(0,r.Z)(this,e),(0,o.Z)(this,"devMode",void 0),this.devMode=!!t.devMode}}},4858:function(e,t,n){"use strict";function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}n.d(t,{Z:function(){return f}});var o=function e(t,n){function o(e,o,i){if("undefined"!=typeof document){"number"==typeof(i=r({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var s in i)i[s]&&(a+="; "+s,!0!==i[s]&&(a+="="+i[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+a}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),a=i.slice(1).join("=");try{var s=decodeURIComponent(i[0]);if(r[s]=t.read(a,s),e===s)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){o(e,"",r({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,r({},this.attributes,t))},withConverter:function(t){return e(r({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),i=o,a=n(9123),s=n(146),u=n(415),c={browserHasLocalStorage:function(){try{var e=this.getLocalStorage();return this.testStorage(e)}catch(e){return!1}},browserHasSessionStorage:function(){try{var e=this.getSessionStorage();return this.testStorage(e)}catch(e){return!1}},testStorageType:function(e){var t=!1;switch(e){case"sessionStorage":t=this.browserHasSessionStorage();break;case"localStorage":t=this.browserHasLocalStorage();break;case"cookie":case"memory":t=!0;break;default:t=!1}return t},getStorageByType:function(e,t){var n;switch(e){case"sessionStorage":n=this.getSessionStorage();break;case"localStorage":n=this.getLocalStorage();break;case"cookie":n=this.getCookieStorage(t);break;case"memory":n=this.getInMemoryStorage();break;default:throw new a.Z("Unrecognized storage option: ".concat(e))}return n},findStorageType:function(e){var t,n;return t=(e=e.slice()).shift(),(n=e.length?e[0]:null)?this.testStorageType(t)?t:((0,s.ZK)("This browser doesn't support ".concat(t,". Switching to ").concat(n,".")),this.findStorageType(e)):t},getLocalStorage:function(){return(0,u.isIE11OrLess)()&&!window.onstorage&&(window.onstorage=function(){}),localStorage},getSessionStorage:function(){return sessionStorage},getCookieStorage:function(e){var t=this,n=e.secure,r=e.sameSite,o=e.sessionCookie;if(void 0===n||void 0===r)throw new a.Z('getCookieStorage: "secure" and "sameSite" options must be provided');var i={getItem:this.storage.get,setItem:function(e,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2200-01-01T00:00:00.000Z";a=o?null:a,t.storage.set(e,i,a,{secure:n,sameSite:r})},removeItem:function(e){t.storage.delete(e)}};return e.useSeparateCookies?{getItem:function(e){var t=i.getItem(),n={};return Object.keys(t).forEach((function(r){0===r.indexOf(e)&&(n[r.replace("".concat(e,"_"),"")]=JSON.parse(t[r]))})),JSON.stringify(n)},setItem:function(e,t){var n=JSON.parse(this.getItem(e));t=JSON.parse(t),Object.keys(t).forEach((function(r){var o=e+"_"+r,a=JSON.stringify(t[r]);i.setItem(o,a),delete n[r]})),Object.keys(n).forEach((function(t){i.removeItem(e+"_"+t)}))},removeItem:function(e){var t=JSON.parse(this.getItem(e));Object.keys(t).forEach((function(t){i.removeItem(e+"_"+t)}))}}:i},inMemoryStore:{},getInMemoryStorage:function(){var e=this;return{getItem:function(t){return e.inMemoryStore[t]},setItem:function(t,n){e.inMemoryStore[t]=n}}},testStorage:function(e){var t="okta-test-storage";try{return e.setItem(t,t),e.removeItem(t),!0}catch(e){return!1}},storage:{set:function(e,t,n,r){var o=r.sameSite,s=r.secure;if(void 0===s||void 0===o)throw new a.Z('storage.set: "secure" and "sameSite" options must be provided');var u={path:r.path||"/",secure:s,sameSite:o};return Date.parse(n)&&(u.expires=new Date(n)),i.set(e,t,u),this.get(e)},get:function(e){return arguments.length?i.get(e):i.get()},delete:function(e){return i.remove(e,{path:"/"})}}},f=c},1971:function(e,t,n){"use strict";n.r(t),n.d(t,{STATE_TOKEN_KEY_NAME:function(){return r},DEFAULT_POLLING_DELAY:function(){return o},DEFAULT_MAX_CLOCK_SKEW:function(){return i},DEFAULT_CACHE_DURATION:function(){return a},TOKEN_STORAGE_NAME:function(){return s},CACHE_STORAGE_NAME:function(){return u},PKCE_STORAGE_NAME:function(){return c},TRANSACTION_STORAGE_NAME:function(){return f},SHARED_TRANSACTION_STORAGE_NAME:function(){return l},ORIGINAL_URI_STORAGE_NAME:function(){return h},IDX_RESPONSE_STORAGE_NAME:function(){return p},ACCESS_TOKEN_STORAGE_KEY:function(){return d},ID_TOKEN_STORAGE_KEY:function(){return v},REFRESH_TOKEN_STORAGE_KEY:function(){return g},REFERRER_PATH_STORAGE_KEY:function(){return y},MIN_VERIFIER_LENGTH:function(){return m},MAX_VERIFIER_LENGTH:function(){return k},DEFAULT_CODE_CHALLENGE_METHOD:function(){return w},IDX_API_VERSION:function(){return T}});var r="oktaStateToken",o=500,i=300,a=86400,s="okta-token-storage",u="okta-cache-storage",c="okta-pkce-storage",f="okta-transaction-storage",l="okta-shared-transaction-storage",h="okta-original-uri-storage",p="okta-idx-response-storage",d="accessToken",v="idToken",g="refreshToken",y="referrerPath",m=43,k=128,w="S256",T="1.0.0"},1018:function(e,t,n){"use strict";n.d(t,{a:function(){return y},E:function(){return w}});var r=n(5861),o=n(5671),i=n(3144),a=n(4942),s=n(7757),u=n.n(s),c=n(3615),f=n.n(c),l=n(9123),h=n(7088),p=n(3548),d=n(146);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){(0,a.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=null,m={updateAuthStatePromise:null,canceledTimes:0},k="authStateChange",w=function(){function e(t){var n=this;if((0,o.Z)(this,e),(0,a.Z)(this,"_sdk",void 0),(0,a.Z)(this,"_pending",void 0),(0,a.Z)(this,"_authState",void 0),(0,a.Z)(this,"_prevAuthState",void 0),(0,a.Z)(this,"_logOptions",void 0),(0,a.Z)(this,"_transformQueue",void 0),!t.emitter)throw new l.Z("Emitter should be initialized before AuthStateManager");this._sdk=t,this._pending=g({},m),this._authState=y,this._logOptions={},this._prevAuthState=null,this._transformQueue=new p.b({quiet:!0}),t.tokenManager.on(h.O3,(function(e,t){n._setLogOptions({event:h.O3,key:e,token:t}),n.updateAuthState()})),t.tokenManager.on(h.FT,(function(e,t){n._setLogOptions({event:h.FT,key:e,token:t}),n.updateAuthState()}))}var t;return(0,i.Z)(e,[{key:"_setLogOptions",value:function(e){this._logOptions=e}},{key:"getAuthState",value:function(){return this._authState}},{key:"getPreviousAuthState",value:function(){return this._prevAuthState}},{key:"updateAuthState",value:(t=(0,r.Z)(u().mark((function e(){var t,n,r,o,i,a,s,c=this;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._sdk.options,n=t.transformAuthState,r=t.devMode,o=function(e){var t=c._logOptions,n=t.event,r=t.key,o=t.token;(0,d.dr)().group("OKTA-AUTH-JS:updateAuthState: Event:".concat(n," Status:").concat(e)),(0,d.dr)().log(r,o),(0,d.dr)().log("Current authState",c._authState),(0,d.dr)().groupEnd(),c._logOptions={}},i=function(e){var t,n;n=e,(t=c._authState)&&t.isAuthenticated===n.isAuthenticated&&JSON.stringify(t.idToken)===JSON.stringify(n.idToken)&&JSON.stringify(t.accessToken)===JSON.stringify(n.accessToken)&&t.error===n.error?r&&o("unchanged"):(c._prevAuthState=c._authState,c._authState=e,c._sdk.emitter.emit(k,g({},e)),r&&o("emitted"))},a=function e(t){return c._pending.updateAuthStatePromise.then((function(){var n=c._pending.updateAuthStatePromise;return n&&n!==t?e(n):c.getAuthState()}))},!this._pending.updateAuthStatePromise){e.next=11;break}if(!(this._pending.canceledTimes>=10)){e.next=10;break}return r&&o("terminated"),e.abrupt("return",a(this._pending.updateAuthStatePromise));case 10:this._pending.updateAuthStatePromise.cancel();case 11:return s=new(f())((function(e,t,a){a.shouldReject=!1,a((function(){c._pending.updateAuthStatePromise=null,c._pending.canceledTimes=c._pending.canceledTimes+1,r&&o("canceled")}));var u=function(t){s.isCanceled?e():(i(t),e(),c._pending=g({},m))};c._sdk.isAuthenticated().then((function(){if(s.isCanceled)e();else{var t=c._sdk.tokenManager.getTokensSync(),r=t.accessToken,o=t.idToken,i=t.refreshToken,a={accessToken:r,idToken:o,refreshToken:i,isAuthenticated:!(!r||!o)};(n?c._transformQueue.push(n,null,c._sdk,a):Promise.resolve(a)).then((function(e){return u(e)})).catch((function(e){return u({accessToken:r,idToken:o,refreshToken:i,isAuthenticated:!1,error:e})}))}}))})),this._pending.updateAuthStatePromise=s,e.abrupt("return",a(s));case 14:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"subscribe",value:function(e){this._sdk.emitter.on(k,e)}},{key:"unsubscribe",value:function(e){this._sdk.emitter.off(k,e)}}]),e}()},1829:function(e,t,n){"use strict";n.d(t,{W:function(){return ye}});var r=n(885),o=n(907),i=n(181);var a=n(5861),s=n(5671),u=n(3144),c=n(4942),f=n(7757),l=n.n(f);Promise.resolve(!1);var h=Promise.resolve(!0),p=Promise.resolve();function d(e,t){return e||(e=0),new Promise((function(n){return setTimeout((function(){return n(t)}),e)}))}function v(){return Math.random().toString(36).substring(2)}var g=0,y=0;function m(){var e=(new Date).getTime();return e===g?1e3*e+ ++y:(g=e,y=0,1e3*e)}var k={create:function(e){var t={messagesCallback:null,bc:new BroadcastChannel(e),subFns:[]};return t.bc.onmessage=function(e){t.messagesCallback&&t.messagesCallback(e.data)},t},close:function(e){e.bc.close(),e.subFns=[]},onMessage:function(e,t){e.messagesCallback=t},postMessage:function(e,t){try{return e.bc.postMessage(t,!1),p}catch(e){return Promise.reject(e)}},canBeUsed:function(){if("undefined"==typeof window)return!1;if("function"==typeof BroadcastChannel){if(BroadcastChannel._pubkey)throw new Error("BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill");return!0}return!1},type:"native",averageResponseTime:function(){return 150},microSeconds:m},w=function(){function e(e){this.ttl=e,this.map=new Map,this._to=!1}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.add=function(e){var t=this;this.map.set(e,T()),this._to||(this._to=!0,setTimeout((function(){t._to=!1,function(e){for(var t=T()-e.ttl,n=e.map[Symbol.iterator]();;){var r=n.next().value;if(!r)return;var o=r[0];if(!(r[1]<t))return;e.map.delete(o)}}(t)}),0))},e.prototype.clear=function(){this.map.clear()},e}();function T(){return(new Date).getTime()}function E(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=JSON.parse(JSON.stringify(e));return void 0===t.webWorkerSupport&&(t.webWorkerSupport=!0),t.idb||(t.idb={}),t.idb.ttl||(t.idb.ttl=45e3),t.idb.fallbackInterval||(t.idb.fallbackInterval=150),e.idb&&"function"==typeof e.idb.onclose&&(t.idb.onclose=e.idb.onclose),t.localstorage||(t.localstorage={}),t.localstorage.removeTimeout||(t.localstorage.removeTimeout=6e4),e.methods&&(t.methods=e.methods),t.node||(t.node={}),t.node.ttl||(t.node.ttl=12e4),t.node.maxParallelWrites||(t.node.maxParallelWrites=2048),void 0===t.node.useFastPath&&(t.node.useFastPath=!0),t}var b="messages",O={durability:"relaxed"};function _(){if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof window){if(void 0!==window.mozIndexedDB)return window.mozIndexedDB;if(void 0!==window.webkitIndexedDB)return window.webkitIndexedDB;if(void 0!==window.msIndexedDB)return window.msIndexedDB}return!1}function S(e){e.commit&&e.commit()}function A(e){e.closed||Z(e).then((function(){return d(e.options.idb.fallbackInterval)})).then((function(){return A(e)}))}function Z(e){return e.closed?p:e.messagesCallback?function(e,t){var n=e.transaction(b,"readonly",O),r=n.objectStore(b),o=[],i=IDBKeyRange.bound(t+1,1/0);if(r.getAll){var a=r.getAll(i);return new Promise((function(e,t){a.onerror=function(e){return t(e)},a.onsuccess=function(t){e(t.target.result)}}))}return new Promise((function(e,a){var s=function(){try{return i=IDBKeyRange.bound(t+1,1/0),r.openCursor(i)}catch(e){return r.openCursor()}}();s.onerror=function(e){return a(e)},s.onsuccess=function(r){var i=r.target.result;i?i.value.id<t+1?i.continue(t+1):(o.push(i.value),i.continue()):(S(n),e(o))}}))}(e.db,e.lastCursorId).then((function(t){var n=t.filter((function(e){return!!e})).map((function(t){return t.id>e.lastCursorId&&(e.lastCursorId=t.id),t})).filter((function(t){return function(e,t){return!(e.uuid===t.uuid||t.eMIs.has(e.id)||e.data.time<t.messagesCallbackTime)}(t,e)})).sort((function(e,t){return e.time-t.time}));return n.forEach((function(t){e.messagesCallback&&(e.eMIs.add(t.id),e.messagesCallback(t.data))})),p})):p}var x={create:function(e,t){return t=E(t),function(e){var t="pubkey.broadcast-channel-0-"+e,n=_().open(t);return n.onupgradeneeded=function(e){e.target.result.createObjectStore(b,{keyPath:"id",autoIncrement:!0})},new Promise((function(e,t){n.onerror=function(e){return t(e)},n.onsuccess=function(){e(n.result)}}))}(e).then((function(n){var r={closed:!1,lastCursorId:0,channelName:e,options:t,uuid:v(),eMIs:new w(2*t.idb.ttl),writeBlockPromise:p,messagesCallback:null,readQueuePromises:[],db:n};return n.onclose=function(){r.closed=!0,t.idb.onclose&&t.idb.onclose()},A(r),r}))},close:function(e){e.closed=!0,e.db.close()},onMessage:function(e,t,n){e.messagesCallbackTime=n,e.messagesCallback=t,Z(e)},postMessage:function(e,t){return e.writeBlockPromise=e.writeBlockPromise.then((function(){return function(e,t,n){var r={uuid:t,time:(new Date).getTime(),data:n},o=e.transaction([b],"readwrite",O);return new Promise((function(e,t){o.oncomplete=function(){return e()},o.onerror=function(e){return t(e)},o.objectStore(b).add(r),S(o)}))}(e.db,e.uuid,t)})).then((function(){var t,n;0===(0,10,Math.floor(11*Math.random()+0))&&(t=e.db,n=e.options.idb.ttl,function(e,t){var n=(new Date).getTime()-t,r=e.transaction(b,"readonly",O),o=r.objectStore(b),i=[];return new Promise((function(e){o.openCursor().onsuccess=function(t){var o=t.target.result;if(o){var a=o.value;if(!(a.time<n))return S(r),void e(i);i.push(a),o.continue()}else e(i)}}))}(t,n).then((function(e){return function(e,t){var n=e.transaction([b],"readwrite",O).objectStore(b);return Promise.all(t.map((function(e){var t=n.delete(e);return new Promise((function(e){t.onsuccess=function(){return e()}}))})))}(t,e.map((function(e){return e.id})))})))})),e.writeBlockPromise},canBeUsed:function(){return!!_()},type:"idb",averageResponseTime:function(e){return 2*e.idb.fallbackInterval},microSeconds:m};function R(){var e;if("undefined"==typeof window)return null;try{e=window.localStorage,e=window["ie8-eventlistener/storage"]||window.localStorage}catch(e){}return e}function P(e){return"pubkey.broadcastChannel-"+e}function C(){var e=R();if(!e)return!1;try{var t="__broadcastchannel_check";e.setItem(t,"works"),e.removeItem(t)}catch(e){return!1}return!0}var M={create:function(e,t){if(t=E(t),!C())throw new Error("BroadcastChannel: localstorage cannot be used");var n=v(),r=new w(t.localstorage.removeTimeout),o={channelName:e,uuid:n,eMIs:r};return o.listener=function(e,t){var i=P(e),a=function(e){var t;e.key===i&&(t=JSON.parse(e.newValue),o.messagesCallback&&t.uuid!==n&&t.token&&!r.has(t.token)&&(t.data.time&&t.data.time<o.messagesCallbackTime||(r.add(t.token),o.messagesCallback(t.data))))};return window.addEventListener("storage",a),a}(e),o},close:function(e){var t;t=e.listener,window.removeEventListener("storage",t)},onMessage:function(e,t,n){e.messagesCallbackTime=n,e.messagesCallback=t},postMessage:function(e,t){return new Promise((function(n){d().then((function(){var r=P(e.channelName),o={token:v(),time:(new Date).getTime(),data:t,uuid:e.uuid},i=JSON.stringify(o);R().setItem(r,i);var a=document.createEvent("Event");a.initEvent("storage",!0,!0),a.key=r,a.newValue=i,window.dispatchEvent(a),n()}))}))},canBeUsed:C,type:"localstorage",averageResponseTime:function(){var e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")?240:120},microSeconds:m},I=m,j=new Set,N={create:function(e){var t={name:e,messagesCallback:null};return j.add(t),t},close:function(e){j.delete(e)},onMessage:function(e,t){e.messagesCallback=t},postMessage:function(e,t){return new Promise((function(n){return setTimeout((function(){Array.from(j).filter((function(t){return t.name===e.name})).filter((function(t){return t!==e})).filter((function(e){return!!e.messagesCallback})).forEach((function(e){return e.messagesCallback(t)})),n()}),5)}))},canBeUsed:function(){return!0},type:"simulate",averageResponseTime:function(){return 5},microSeconds:I},L=[k,x,M],U=new Set,D=0,H=function(e,t){var n,r,o;this.id=D++,U.add(this),this.name=e,this.options=E(t),this.method=function(e){var t=[].concat(e.methods,L).filter(Boolean);if(e.type){if("simulate"===e.type)return N;var n=t.find((function(t){return t.type===e.type}));if(n)return n;throw new Error("method-type "+e.type+" not found")}e.webWorkerSupport||(t=t.filter((function(e){return"idb"!==e.type})));var r=t.find((function(e){return e.canBeUsed()}));if(r)return r;throw new Error("No useable method found in "+JSON.stringify(L.map((function(e){return e.type}))))}(this.options),this._iL=!1,this._onML=null,this._addEL={message:[],internal:[]},this._uMP=new Set,this._befC=[],this._prepP=null,(o=r=(n=this).method.create(n.name,n.options))&&"function"==typeof o.then?(n._prepP=r,r.then((function(e){n._state=e}))):n._state=r};function B(e,t,n){var r={time:e.method.microSeconds(),type:t,data:n};return(e._prepP?e._prepP:p).then((function(){var t=e.method.postMessage(e._state,r);return e._uMP.add(t),t.catch().then((function(){return e._uMP.delete(t)})),t}))}function K(e){return e._addEL.message.length>0||e._addEL.internal.length>0}function F(e,t,n){e._addEL[t].push(n),function(e){if(!e._iL&&K(e)){var t=function(t){e._addEL[t.type].forEach((function(e){var n=e.time-1e5;t.time>=n&&e.fn(t.data)}))},n=e.method.microSeconds();e._prepP?e._prepP.then((function(){e._iL=!0,e.method.onMessage(e._state,t,n)})):(e._iL=!0,e.method.onMessage(e._state,t,n))}}(e)}function G(e,t,n){e._addEL[t]=e._addEL[t].filter((function(e){return e!==n})),function(e){if(e._iL&&!K(e)){e._iL=!1;var t=e.method.microSeconds();e.method.onMessage(e._state,null,t)}}(e)}H._pubkey=!0,H.prototype={postMessage:function(e){if(this.closed)throw new Error("BroadcastChannel.postMessage(): Cannot post message after channel has closed "+JSON.stringify(e));return B(this,"message",e)},postInternal:function(e){return B(this,"internal",e)},set onmessage(e){var t={time:this.method.microSeconds(),fn:e};G(this,"message",this._onML),e&&"function"==typeof e?(this._onML=t,F(this,"message",t)):this._onML=null},addEventListener:function(e,t){F(this,e,{time:this.method.microSeconds(),fn:t})},removeEventListener:function(e,t){G(this,e,this._addEL[e].find((function(e){return e.fn===t})))},close:function(){var e=this;if(!this.closed){U.delete(this),this.closed=!0;var t=this._prepP?this._prepP:p;return this._onML=null,this._addEL.message=[],t.then((function(){return Promise.all(Array.from(e._uMP))})).then((function(){return Promise.all(e._befC.map((function(e){return e()})))})).then((function(){return e.method.close(e._state)}))}},get type(){return this.method.type},get isClosed(){return this.closed}};var Y=n(5643),W=n.n(Y),V={add:function(e){if("function"==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope);else{if("function"!=typeof window.addEventListener)return;window.addEventListener("beforeunload",(function(){e()}),!0),window.addEventListener("unload",(function(){e()}),!0)}}},q=n(199),z=n.n(q),X=W()?z():V,Q=new Set,J=!1;function $(){var e=[];return Q.forEach((function(t){e.push(t()),Q.delete(t)})),Promise.all(e)}var ee=function(e,t){var n=this;this.broadcastChannel=e,this._options=t,this.isLeader=!1,this.hasLeader=!1,this.isDead=!1,this.token=v(),this._aplQ=p,this._aplQC=0,this._unl=[],this._lstns=[],this._dpL=function(){},this._dpLC=!1;var r=function(e){"leader"===e.context&&("death"===e.action&&(n.hasLeader=!1),"tell"===e.action&&(n.hasLeader=!0))};this.broadcastChannel.addEventListener("internal",r),this._lstns.push(r)};function te(e,t){var n={context:"leader",action:t,token:e.token};return e.broadcastChannel.postInternal(n)}function ne(e,t){if(e._leaderElector)throw new Error("BroadcastChannel already has a leader-elector");t=function(e,t){return e||(e={}),(e=JSON.parse(JSON.stringify(e))).fallbackInterval||(e.fallbackInterval=3e3),e.responseTime||(e.responseTime=t.method.averageResponseTime(t.options)),e}(t,e);var n=new ee(e,t);return e._befC.push((function(){return n.die()})),e._leaderElector=n,n}ee.prototype={applyOnce:function(e){var t=this;if(this.isLeader)return d(0,!0);if(this.isDead)return d(0,!1);if(this._aplQC>1)return this._aplQ;var n=function(){if(t.isLeader)return h;var n,r=!1,o=new Promise((function(e){n=function(){r=!0,e()}})),i=[],a=function(e){"leader"===e.context&&e.token!=t.token&&(i.push(e),"apply"===e.action&&e.token>t.token&&n(),"tell"===e.action&&(n(),t.hasLeader=!0))};t.broadcastChannel.addEventListener("internal",a);var s=e?4*t._options.responseTime:t._options.responseTime;return te(t,"apply").then((function(){return Promise.race([d(s),o.then((function(){return Promise.reject(new Error)}))])})).then((function(){return te(t,"apply")})).then((function(){return Promise.race([d(s),o.then((function(){return Promise.reject(new Error)}))])})).catch((function(){})).then((function(){return t.broadcastChannel.removeEventListener("internal",a),!r&&function(e){e.isLeader=!0,e.hasLeader=!0;var t=function(e){if(J||(J=!0,X.add($)),"function"!=typeof e)throw new Error("Listener is no function");return Q.add(e),{remove:function(){return Q.delete(e)},run:function(){return Q.delete(e),e()}}}((function(){return e.die()}));e._unl.push(t);var n=function(t){"leader"===t.context&&"apply"===t.action&&te(e,"tell"),"leader"!==t.context||"tell"!==t.action||e._dpLC||(e._dpLC=!0,e._dpL(),te(e,"tell"))};return e.broadcastChannel.addEventListener("internal",n),e._lstns.push(n),te(e,"tell")}(t).then((function(){return!0}))}))};return this._aplQC=this._aplQC+1,this._aplQ=this._aplQ.then((function(){return n()})).then((function(){t._aplQC=t._aplQC-1})),this._aplQ.then((function(){return t.isLeader}))},awaitLeadership:function(){return this._aLP||(this._aLP=(e=this).isLeader?p:new Promise((function(t){var n=!1;function r(){n||(n=!0,e.broadcastChannel.removeEventListener("internal",o),t(!0))}e.applyOnce().then((function(){e.isLeader&&r()})),function t(){return d(e._options.fallbackInterval).then((function(){if(!e.isDead&&!n)return e.isLeader?void r():e.applyOnce(!0).then((function(){e.isLeader?r():t()}))}))}();var o=function(t){"leader"===t.context&&"death"===t.action&&(e.hasLeader=!1,e.applyOnce().then((function(){e.isLeader&&r()})))};e.broadcastChannel.addEventListener("internal",o),e._lstns.push(o)}))),this._aLP;var e},set onduplicate(e){this._dpL=e},die:function(){var e=this;return this._lstns.forEach((function(t){return e.broadcastChannel.removeEventListener("internal",t)})),this._lstns=[],this._unl.forEach((function(e){return e.remove()})),this._unl=[],this.isLeader&&(this.hasLeader=!1,this.isLeader=!1),this.isDead=!0,te(this,"death")}};var re=n(415),oe=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,s.Z)(this,e),(0,c.Z)(this,"options",void 0),(0,c.Z)(this,"channel",void 0),(0,c.Z)(this,"elector",void 0),(0,c.Z)(this,"started",!1),this.options=t,this.onLeaderDuplicate=this.onLeaderDuplicate.bind(this),this.onLeader=this.onLeader.bind(this)}var t,n,r;return(0,u.Z)(e,[{key:"onLeaderDuplicate",value:function(){}},{key:"onLeader",value:(r=(0,a.Z)(l().mark((function e(){var t,n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=(n=this.options).onLeader)||void 0===t?void 0:t.call(n);case 2:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"isLeader",value:function(){var e;return!(null===(e=this.elector)||void 0===e||!e.isLeader)}},{key:"hasLeader",value:function(){var e;return!(null===(e=this.elector)||void 0===e||!e.hasLeader)}},{key:"start",value:(n=(0,a.Z)(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.stop();case 2:this.canStart()&&(t=this.options.electionChannelName,this.channel=new H(t),this.elector=ne(this.channel),this.elector.onduplicate=this.onLeaderDuplicate,this.elector.awaitLeadership().then(this.onLeader),this.started=!0);case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:(t=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.started){e.next=11;break}if(!this.elector){e.next=5;break}return e.next=4,this.elector.die();case 4:this.elector=void 0;case 5:if(!this.channel){e.next=10;break}return this.channel.postInternal=function(){return Promise.resolve()},e.next=9,this.channel.close();case 9:this.channel=void 0;case 10:this.started=!1;case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"requiresLeadership",value:function(){return!1}},{key:"isStarted",value:function(){return this.started}},{key:"canStart",value:function(){return(0,re.isBrowser)()}}]),e}(),ie=n(9123),ae=n(7088),se=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.Z)(this,e),(0,c.Z)(this,"tokenManager",void 0),(0,c.Z)(this,"options",void 0),(0,c.Z)(this,"renewTimeQueue",void 0),(0,c.Z)(this,"started",!1),this.tokenManager=t,this.options=n,this.renewTimeQueue=[],this.onTokenExpiredHandler=this.onTokenExpiredHandler.bind(this)}var t,n;return(0,u.Z)(e,[{key:"shouldThrottleRenew",value:function(){var e=!1;if(this.renewTimeQueue.push(Date.now()),this.renewTimeQueue.length>=10){var t=this.renewTimeQueue.shift();e=this.renewTimeQueue[this.renewTimeQueue.length-1]-t<3e4}return e}},{key:"requiresLeadership",value:function(){return!!this.options.syncStorage&&(0,re.isBrowser)()}},{key:"onTokenExpiredHandler",value:function(e){if(this.options.autoRenew)if(this.shouldThrottleRenew()){var t=new ie.Z("Too many token renew requests");this.tokenManager.emitError(t)}else this.tokenManager.renew(e).catch((function(){}));else this.options.autoRemove&&this.tokenManager.remove(e)}},{key:"canStart",value:function(){return!!this.options.autoRenew||!!this.options.autoRemove}},{key:"start",value:(n=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.canStart()){e.next=5;break}return e.next=3,this.stop();case 3:this.tokenManager.on(ae.$Y,this.onTokenExpiredHandler),this.started=!0;case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:(t=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.started&&(this.tokenManager.off(ae.$Y,this.onTokenExpiredHandler),this.renewTimeQueue=[],this.started=!1);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"isStarted",value:function(){return this.started}}]),e}(),ue=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.Z)(this,e),(0,c.Z)(this,"tokenManager",void 0),(0,c.Z)(this,"options",void 0),(0,c.Z)(this,"channel",void 0),(0,c.Z)(this,"started",!1),(0,c.Z)(this,"enablePostMessage",!0),this.tokenManager=t,this.options=n,this.onTokenAddedHandler=this.onTokenAddedHandler.bind(this),this.onTokenRemovedHandler=this.onTokenRemovedHandler.bind(this),this.onTokenRenewedHandler=this.onTokenRenewedHandler.bind(this),this.onSetStorageHandler=this.onSetStorageHandler.bind(this),this.onSyncMessageHandler=this.onSyncMessageHandler.bind(this)}var t,n;return(0,u.Z)(e,[{key:"requiresLeadership",value:function(){return!1}},{key:"isStarted",value:function(){return this.started}},{key:"canStart",value:function(){return!!this.options.syncStorage&&(0,re.isBrowser)()}},{key:"start",value:(n=(0,a.Z)(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.canStart()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.stop();case 4:t=this.options.syncChannelName,e.prev=5,this.channel=new H(t),e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(5),new ie.Z("SyncStorageService is not supported in current browser.");case 12:this.tokenManager.on(ae.O3,this.onTokenAddedHandler),this.tokenManager.on(ae.FT,this.onTokenRemovedHandler),this.tokenManager.on(ae.E,this.onTokenRenewedHandler),this.tokenManager.on(ae.zr,this.onSetStorageHandler),this.channel.addEventListener("message",this.onSyncMessageHandler),this.started=!0;case 18:case"end":return e.stop()}}),e,this,[[5,9]])}))),function(){return n.apply(this,arguments)})},{key:"stop",value:(t=(0,a.Z)(l().mark((function e(){var t,n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.started){e.next=10;break}return this.tokenManager.off(ae.O3,this.onTokenAddedHandler),this.tokenManager.off(ae.FT,this.onTokenRemovedHandler),this.tokenManager.off(ae.E,this.onTokenRenewedHandler),this.tokenManager.off(ae.zr,this.onSetStorageHandler),null===(t=this.channel)||void 0===t||t.removeEventListener("message",this.onSyncMessageHandler),e.next=8,null===(n=this.channel)||void 0===n?void 0:n.close();case 8:this.channel=void 0,this.started=!1;case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"onTokenAddedHandler",value:function(e,t){var n;this.enablePostMessage&&(null===(n=this.channel)||void 0===n||n.postMessage({type:ae.O3,key:e,token:t}))}},{key:"onTokenRemovedHandler",value:function(e,t){var n;this.enablePostMessage&&(null===(n=this.channel)||void 0===n||n.postMessage({type:ae.FT,key:e,token:t}))}},{key:"onTokenRenewedHandler",value:function(e,t,n){var r;this.enablePostMessage&&(null===(r=this.channel)||void 0===r||r.postMessage({type:ae.E,key:e,token:t,oldToken:n}))}},{key:"onSetStorageHandler",value:function(e){var t;null===(t=this.channel)||void 0===t||t.postMessage({type:ae.zr,storage:e})}},{key:"onSyncMessageHandler",value:function(e){switch(this.enablePostMessage=!1,e.type){case ae.zr:this.tokenManager.getStorage().setStorage(e.storage);break;case ae.O3:this.tokenManager.emitAdded(e.key,e.token),this.tokenManager.setExpireEventTimeout(e.key,e.token);break;case ae.FT:this.tokenManager.clearExpireEventTimeout(e.key),this.tokenManager.emitRemoved(e.key,e.token);break;case ae.E:this.tokenManager.emitRenewed(e.key,e.token,e.oldToken)}this.enablePostMessage=!0}}]),e}(),ce=n(3193);function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(n),!0).forEach((function(t){(0,c.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var de="autoRenew",ve="syncStorage",ge="leaderElection",ye=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.Z)(this,e),(0,c.Z)(this,"sdk",void 0),(0,c.Z)(this,"options",void 0),(0,c.Z)(this,"services",void 0),(0,c.Z)(this,"started",void 0),this.sdk=t,this.onLeader=this.onLeader.bind(this);var o=t.tokenManager.getOptions(),i=o.autoRenew,a=o.autoRemove,u=o.syncStorage;r.electionChannelName=r.electionChannelName||r.broadcastChannelName,this.options=Object.assign({},e.defaultOptions,{autoRenew:i,autoRemove:a,syncStorage:u},{electionChannelName:"".concat(t.options.clientId,"-election"),syncChannelName:"".concat(t.options.clientId,"-sync")},(0,ce.YY)(r)),this.started=!1,this.services=new Map,e.knownServices.forEach((function(e){var t=n.createService(e);t&&n.services.set(e,t)}))}var t,n,f,h,p;return(0,u.Z)(e,[{key:"onLeader",value:(p=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.started){e.next=3;break}return e.next=3,this.startServices();case 3:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"isLeader",value:function(){var e;return null===(e=this.getService(ge))||void 0===e?void 0:e.isLeader()}},{key:"isLeaderRequired",value:function(){return(e=this.services.values(),function(e){if(Array.isArray(e))return(0,o.Z)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||(0,i.Z)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).some((function(e){return e.canStart()&&e.requiresLeadership()}));var e}},{key:"start",value:(h=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.started){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.startServices();case 4:this.started=!0;case 5:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"stop",value:(f=(0,a.Z)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.stopServices();case 2:this.started=!1;case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getService",value:function(e){return this.services.get(e)}},{key:"startServices",value:(n=(0,a.Z)(l().mark((function e(){var t,n,o,i,a;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=he(this.services.entries()),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=10;break}if(o=(0,r.Z)(n.value,2),i=o[0],a=o[1],!this.canStartService(i,a)){e.next=8;break}return e.next=8,a.start();case 8:e.next=3;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),t.e(e.t0);case 15:return e.prev=15,t.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[1,12,15,18]])}))),function(){return n.apply(this,arguments)})},{key:"stopServices",value:(t=(0,a.Z)(l().mark((function e(){var t,n,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=he(this.services.values()),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=9;break}return r=n.value,e.next=7,r.stop();case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),t.e(e.t0);case 14:return e.prev=14,t.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[1,11,14,17]])}))),function(){return t.apply(this,arguments)})},{key:"canStartService",value:function(e,t){var n=t.canStart()&&!t.isStarted();return e===ge?n&&(n=this.isLeaderRequired()):t.requiresLeadership()&&n&&(n=this.isLeader()),n}},{key:"createService",value:function(e){var t,n=this.sdk.tokenManager;switch(e){case ge:t=new oe(le(le({},this.options),{},{onLeader:this.onLeader}));break;case de:t=new se(n,le({},this.options));break;case ve:t=new ue(n,le({},this.options));break;default:throw new Error("Unknown service ".concat(e))}return t}}]),e}();(0,c.Z)(ye,"knownServices",[de,ve,ge]),(0,c.Z)(ye,"defaultOptions",{autoRenew:!0,autoRemove:!0,syncStorage:!0})},6599:function(e,t,n){"use strict";n.d(t,{W:function(){return r.W}});var r=n(1829)},1578:function(e,t,n){"use strict";n.d(t,{K:function(){return c}});var r=n(9893),o=n(265),i=n(3334),a=n(1885),s=n(8386),u=n(3980);function c(e,t,n){var c=(0,r.a)(t),f=(0,o.H)(c,e),l=(0,i.A)(f),h=(0,u.Z)(l),p=(0,a.J)(h,n);return(0,s.i)(p)}},3961:function(e,t,n){"use strict";n.r(t),n.d(t,{AuthStateManager:function(){return r.E},INITIAL_AUTH_STATE:function(){return r.a},createCoreOptionsConstructor:function(){return o.n},createOktaAuthCore:function(){return i.K},mixinCore:function(){return a.i},createCoreStorageManager:function(){return s.a},ServiceManager:function(){return l.W}});var r=n(1018),o=n(9133),i=n(1578),a=n(8386),s=n(2647),u=n(8553),c={};for(var f in u)["default","AuthStateManager","INITIAL_AUTH_STATE","createCoreOptionsConstructor","createOktaAuthCore","mixinCore","createCoreStorageManager"].indexOf(f)<0&&(c[f]=function(e){return u[e]}.bind(0,f));n.d(t,c);var l=n(6599)},8386:function(e,t,n){"use strict";n.d(t,{i:function(){return g}});var r=n(5861),o=n(5671),i=n(3144),a=n(7326),s=n(136),u=n(2963),c=n(1120),f=n(4942),l=n(7757),h=n.n(l),p=n(5372),d=n(1018),v=n(1829);function g(e){return function(e){(0,s.Z)(k,e);var t,n,l,g,y,m=(g=k,y=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=(0,c.Z)(g);if(y){var n=(0,c.Z)(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return(0,u.Z)(this,e)});function k(){var e;(0,o.Z)(this,k);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e=m.call.apply(m,[this].concat(n)),(0,f.Z)((0,a.Z)(e),"authStateManager",void 0),(0,f.Z)((0,a.Z)(e),"serviceManager",void 0),e.authStateManager=new d.E((0,a.Z)(e)),e.serviceManager=new v.W((0,a.Z)(e),e.options.services),e}return(0,i.Z)(k,[{key:"start",value:(l=(0,r.Z)(h().mark((function e(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.serviceManager.start();case 2:if(this.tokenManager.start(),this.token.isLoginRedirect()){e.next=6;break}return e.next=6,this.authStateManager.updateAuthState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"stop",value:(n=(0,r.Z)(h().mark((function e(){return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.tokenManager.stop(),e.next=3,this.serviceManager.stop();case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleLoginRedirect",value:(t=(0,r.Z)(h().mark((function e(t,n){var r,o,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.options.state,!t){e.next=6;break}this.tokenManager.setTokens(t),n=n||this.getOriginalUri(this.options.state),e.next=25;break;case 6:if(!this.isLoginRedirect()){e.next=24;break}return e.prev=7,e.next=10,(0,p.Tp)(this,{});case 10:return o=e.sent,r=o.state,n=n||this.getOriginalUri(r),e.next=15,this.storeTokensFromRedirect();case 15:e.next=22;break;case 17:return e.prev=17,e.t0=e.catch(7),e.next=21,this.authStateManager.updateAuthState();case 21:throw e.t0;case 22:e.next=25;break;case 24:return e.abrupt("return");case 25:return e.next=27,this.authStateManager.updateAuthState();case 27:if(this.removeOriginalUri(r),!(i=this.options.restoreOriginalUri)){e.next=34;break}return e.next=32,i(this,n);case 32:e.next=35;break;case 34:n&&window.location.replace(n);case 35:case"end":return e.stop()}}),e,this,[[7,17]])}))),function(e,n){return t.apply(this,arguments)})}]),k}(e)}},9133:function(e,t,n){"use strict";n.d(t,{n:function(){return f}});var r=n(5671),o=n(7326),i=n(136),a=n(2963),s=n(1120),u=n(4942),c=n(9453);function f(){return function(e){(0,i.Z)(f,e);var t,n,c=(t=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=(0,s.Z)(t);if(n){var o=(0,s.Z)(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return(0,a.Z)(this,e)});function f(e){var t;return(0,r.Z)(this,f),t=c.call(this,e),(0,u.Z)((0,o.Z)(t),"services",void 0),(0,u.Z)((0,o.Z)(t),"transformAuthState",void 0),t.services=e.services,t.transformAuthState=e.transformAuthState,t}return f}((0,c.m)())}},2647:function(e,t,n){"use strict";n.d(t,{a:function(){return o}});var r=n(2333);function o(){return(0,r.a)()}},5675:function(){},8553:function(e,t,n){"use strict";n.r(t);var r=n(5675),o={};for(var i in r)"default"!==i&&(o[i]=function(e){return r[e]}.bind(0,i));n.d(t,o)},7987:function(e,t,n){"use strict";n.d(t,{NL:function(){return i},aR:function(){return a},Df:function(){return s},Wy:function(){return u},k8:function(){return c},EL:function(){return f},dX:function(){return l},kQ:function(){return h}});var r=n(9123),o=n(7594);function i(e){return a((0,o.r3)(e))}function a(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function s(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function u(e){var t=s(e);switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new r.Z("Not a valid Base64Url")}var n=(0,o.ty)(t);try{return decodeURIComponent(escape(n))}catch(e){return n}}function c(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function f(e){return(0,o.ty)(s(e))}function l(e){return Uint8Array.from(f(e),(function(e){return e.charCodeAt(0)}))}function h(e){return(0,o.r3)(new Uint8Array(e).reduce((function(e,t){return e+String.fromCharCode(t)}),""))}},7594:function(e,t,n){"use strict";n.d(t,{ty:function(){return r},r3:function(){return o},KP:function(){return i}});var r=function(e){return atob(e)},o=function(e){return btoa(e)},i="undefined"==typeof crypto?null:crypto},9718:function(e,t,n){"use strict";n.r(t),n.d(t,{base64ToBase64Url:function(){return r.aR},base64UrlDecode:function(){return r.EL},base64UrlToBase64:function(){return r.Df},base64UrlToBuffer:function(){return r.dX},base64UrlToString:function(){return r.Wy},bufferToBase64Url:function(){return r.kQ},stringToBase64Url:function(){return r.NL},stringToBuffer:function(){return r.k8},getOidcHash:function(){return o.X},verifyToken:function(){return u.W},atob:function(){return c.ty},btoa:function(){return c.r3},webcrypto:function(){return c.KP}});var r=n(7987),o=n(5698),i=n(6332),a={};for(var s in i)["default","base64ToBase64Url","base64UrlDecode","base64UrlToBase64","base64UrlToBuffer","base64UrlToString","bufferToBase64Url","stringToBase64Url","stringToBuffer","getOidcHash"].indexOf(s)<0&&(a[s]=function(e){return i[e]}.bind(0,s));n.d(t,a);var u=n(3154),c=n(1)},5698:function(e,t,n){"use strict";n.d(t,{X:function(){return i}});var r=n(7987),o=n(7594);function i(e){var t=(new TextEncoder).encode(e);return o.KP.subtle.digest("SHA-256",t).then((function(e){var t=new Uint8Array(e).slice(0,16),n=String.fromCharCode.apply(null,t);return(0,r.NL)(n)}))}},6332:function(){},3154:function(e,t,n){"use strict";n.d(t,{W:function(){return a}});var r=n(3193),o=n(7987),i=n(7594);function a(e,t){t=(0,r.d9)(t);var n={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};return delete t.use,i.KP.subtle.importKey("jwk",t,n,!0,["verify"]).then((function(t){var r=e.split("."),a=(0,o.k8)(r[0]+"."+r[1]),s=(0,o.EL)(r[2]),u=(0,o.k8)(s);return i.KP.subtle.verify(n,t,u,a)}))}},1:function(e,t,n){"use strict";n.d(t,{ty:function(){return r.ty},r3:function(){return r.r3},KP:function(){return r.KP}});var r=n(7594)},3983:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(5671),o=n(7326),i=n(136),a=n(2963),s=n(1120),u=n(4942);var c=function(e){(0,i.Z)(f,e);var t,n,c=(t=f,n=function(){if("undefined"==typeof Reflect||!