forked from jmelberg/angular-sso-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOktaAuth.min.js
45 lines (45 loc) · 48.8 KB
/
OktaAuth.min.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
/*!
* Copyright (c) 2015-2016, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and limitations under the License.
*
*/
!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()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){var r=n(2);e.exports=n(5)(r)},function(e,t,n){function r(e,t,n){var r=o({url:t,method:e,headers:n.headers,data:JSON.stringify(n.data),withCredentials:!0}).then(function(){return r.request});return r}var o=n(3);e.exports=r},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__;/*!
* Reqwest! A general purpose XHR connection manager
* license MIT (c) Dustin Diaz 2015
* https://github.com/ded/reqwest
*/
!function(e,t,n){"undefined"!=typeof module&&module.exports?module.exports=n():(__WEBPACK_AMD_DEFINE_FACTORY__=n,__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof __WEBPACK_AMD_DEFINE_FACTORY__?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__,!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}("reqwest",this,function(){function succeed(e){var t=protocolRe.exec(e.url);return t=t&&t[1]||context.location.protocol,httpsRe.test(t)?twoHundo.test(e.request.status):!!e.request.response}function handleReadyState(e,t,n){return function(){return e._aborted?n(e.request):e._timedOut?n(e.request,"Request is aborted: timeout"):void(e.request&&4==e.request[readyState]&&(e.request.onreadystatechange=noop,succeed(e)?t(e.request):n(e.request)))}}function setHeaders(e,t){var n,r=t.headers||{};r.Accept=r.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"];var o="undefined"!=typeof FormData&&t.data instanceof FormData;t.crossOrigin||r[requestedWith]||(r[requestedWith]=defaultHeaders.requestedWith),r[contentType]||o||(r[contentType]=t.contentType||defaultHeaders.contentType);for(n in r)r.hasOwnProperty(n)&&"setRequestHeader"in e&&e.setRequestHeader(n,r[n])}function setCredentials(e,t){"undefined"!=typeof t.withCredentials&&"undefined"!=typeof e.withCredentials&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var o=uniqid++,i=e.jsonpCallback||"callback",s=e.jsonpCallbackName||reqwest.getcallbackPrefix(o),a=new RegExp("((^|\\?|&)"+i+")=([^&]+)"),u=r.match(a),c=doc.createElement("script"),p=0,f=navigator.userAgent.indexOf("MSIE 10.0")!==-1;return u?"?"===u[3]?r=r.replace(a,"$1="+s):s=u[3]:r=urlappend(r,i+"="+s),context[s]=generalCallback,c.type="text/javascript",c.src=r,c.async=!0,"undefined"==typeof c.onreadystatechange||f||(c.htmlFor=c.id="_reqwest_"+o),c.onload=c.onreadystatechange=function(){return!(c[readyState]&&"complete"!==c[readyState]&&"loaded"!==c[readyState]||p)&&(c.onload=c.onreadystatechange=null,c.onclick&&c.onclick(),t(lastValue),lastValue=void 0,head.removeChild(c),void(p=1))},head.appendChild(c),{abort:function(){c.onload=c.onreadystatechange=null,n({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(c),p=1}}}function getRequest(e,t){var n,r=this.o,o=(r.method||"GET").toUpperCase(),i="string"==typeof r?r:r.url,s=r.processData!==!1&&r.data&&"string"!=typeof r.data?reqwest.toQueryString(r.data):r.data||null,a=!1;return"jsonp"!=r.type&&"GET"!=o||!s||(i=urlappend(i,s),s=null),"jsonp"==r.type?handleJsonp(r,e,t,i):(n=r.xhr&&r.xhr(r)||xhr(r),n.open(o,i,r.async!==!1),setHeaders(n,r),setCredentials(n,r),context[xDomainRequest]&&n instanceof context[xDomainRequest]?(n.onload=e,n.onerror=t,n.onprogress=function(){},a=!0):n.onreadystatechange=handleReadyState(this,e,t),r.before&&r.before(n),a?setTimeout(function(){n.send(s)},200):n.send(s),n)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){if(null!==e)return e.match("json")?"json":e.match("javascript")?"js":e.match("text")?"html":e.match("xml")?"xml":void 0}function init(o,fn){function complete(e){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=context.JSON?context.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,o,i,s=e.name,a=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(s,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&s)switch(a){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),o=e.value,(!(n||r)||e.checked)&&t(s,normalize(n&&""===o?"on":o)));break;case"textarea":t(s,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(i=0;e.length&&i<e.length;i++)e.options[i].selected&&u(e.options[i])}}function eachFormElement(){var e,t,n=this,r=function(e,t){var r,o,i;for(r=0;r<t.length;r++)for(i=e[byTag](t[r]),o=0;o<i.length;o++)serial(i[o],n)};for(t=0;t<arguments.length;t++)e=arguments[t],/input|select|textarea/i.test(e.tagName)&&serial(e,n),r(e,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var e={};return eachFormElement.apply(function(t,n){t in e?(e[t]&&!isArray(e[t])&&(e[t]=[e[t]]),e[t].push(n)):e[t]=n},arguments),e}function buildParams(e,t,n,r){var o,i,s,a=/\[\]$/;if(isArray(t))for(i=0;t&&i<t.length;i++)s=t[i],n||a.test(e)?r(e,s):buildParams(e+"["+("object"==typeof s?i:"")+"]",s,n,r);else if(t&&"[object Object]"===t.toString())for(o in t)buildParams(e+"["+o+"]",t[o],n,r);else r(e,t)}var context=this;if("window"in context)var doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0];else{var XHR2;try{XHR2=__webpack_require__(4)}catch(ex){throw new Error("Peer dependency `xhr2` required! Please npm install xhr2")}}var httpsRe=/^http/,protocolRe=/(^\w+):\/\//,twoHundo=/^(20\d|1223)$/,readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",uniqid=0,callbackPrefix="reqwest_"+ +new Date,lastValue,xmlHttpRequest="XMLHttpRequest",xDomainRequest="XDomainRequest",noop=function(){},isArray="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=function(e){if(e.crossOrigin===!0){var t=context[xmlHttpRequest]?new XMLHttpRequest:null;if(t&&"withCredentials"in t)return t;if(context[xDomainRequest])return new XDomainRequest;throw new Error("Browser does not support cross-origin requests")}return context[xmlHttpRequest]?new XMLHttpRequest:XHR2?new XHR2:new ActiveXObject("Microsoft.XMLHTTP")},globalSetupOptions={dataFilter:function(e){return e}};return Reqwest.prototype={abort:function(){this._aborted=!0,this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(e,t){return e=e||function(){},t=t||function(){},this._fulfilled?this._responseArgs.resp=e(this._responseArgs.resp):this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(e),this._errorHandlers.push(t)),this},always:function(e){return this._fulfilled||this._erred?e(this._responseArgs.resp):this._completeHandlers.push(e),this},fail:function(e){return this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(e),this},"catch":function(e){return this.fail(e)}},reqwest.serializeArray=function(){var e=[];return eachFormElement.apply(function(t,n){e.push({name:t,value:n})},arguments),e},reqwest.serialize=function(){if(0===arguments.length)return"";var e,t,n=Array.prototype.slice.call(arguments,0);return e=n.pop(),e&&e.nodeType&&n.push(e)&&(e=null),e&&(e=e.type),t="map"==e?serializeHash:"array"==e?reqwest.serializeArray:serializeQueryString,t.apply(null,n)},reqwest.toQueryString=function(e,t){var n,r,o=t||!1,i=[],s=encodeURIComponent,a=function(e,t){t="function"==typeof t?t():null==t?"":t,i[i.length]=s(e)+"="+s(t)};if(isArray(e))for(r=0;e&&r<e.length;r++)a(e[r].name,e[r].value);else for(n in e)e.hasOwnProperty(n)&&buildParams(n,e[n],o,a);return i.join("&").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(){return callbackPrefix},reqwest.compat=function(e,t){return e&&(e.type&&(e.method=e.type)&&delete e.type,e.dataType&&(e.type=e.dataType),e.jsonpCallback&&(e.jsonpCallbackName=e.jsonpCallback)&&delete e.jsonpCallback,e.jsonp&&(e.jsonpCallback=e.jsonp)),new Reqwest(e,t)},reqwest.ajaxSetup=function(e){e=e||{};for(var t in e)globalSetupOptions[t]=e[t]},reqwest})},function(e,t){},function(e,t,n){function r(e){var t=this;if(!e)throw new c("No arguments passed to constructor. Required usage: new OktaAuth(args)");if(!e.url)throw new c('No url passed to constructor. Required usage: new OktaAuth({url: "https://sample.okta.com"})');this.options={url:e.url,clientId:e.clientId,redirectUri:e.redirectUri,ajaxRequest:e.ajaxRequest,transformErrorXHR:e.transformErrorXHR,headers:e.headers},"/"===this.options.url.slice(-1)&&(this.options.url=this.options.url.slice(0,-1)),t.session={close:o.bind(s.closeSession,t,t),exists:o.bind(s.sessionExists,t,t),get:o.bind(s.getSession,t,t),refresh:o.bind(s.refreshSession,t,t),setCookieAndRedirect:o.bind(s.setCookieAndRedirect,t,t)},t.tx={status:o.bind(i.transactionStatus,t,t),resume:o.bind(i.resumeTransaction,t,t),exists:o.bind(i.transactionExists,t,t)},t.tx.exists._getCookie=function(e){return a.getCookie(e)},t.idToken={authorize:o.bind(u.getToken,t,t),verify:o.bind(u.verifyIdToken,t,t),refresh:o.bind(u.refreshIdToken,t,t),decode:o.bind(u.decodeToken,t)},t.idToken.authorize._getLocationHref=function(){return window.location.href},t.token={getWithoutPrompt:o.bind(u.getWithoutPrompt,t,t),getWithPopup:o.bind(u.getWithPopup,t,t),getWithRedirect:o.bind(u.getWithRedirect,t,t),parseFromUrl:o.bind(u.parseFromUrl,t,t),decode:o.bind(u.decodeToken,t)},t.token.getWithRedirect._setLocation=function(e){window.location=e},t.token.parseFromUrl._getLocationHash=function(e){return window.location.hash}}n(6);var o=n(8),i=n(9),s=n(19),a=n(11),u=n(20),c=n(17),p=r.prototype;p.features={},p.features.isPopupPostMessageSupported=function(){var e=document.documentMode&&document.documentMode<10;return!(!window.postMessage||e)},p.features.isTokenVerifySupported=function(){return"undefined"!=typeof crypto&&crypto.subtle&&"undefined"!=typeof Uint8Array},p.signIn=function(e){return i.postToTransaction(this,"/api/v1/authn",e)},p.signOut=function(){return this.session.close()},p.forgotPassword=function(e){return i.postToTransaction(this,"/api/v1/authn/recovery/password",e)},p.unlockAccount=function(e){return i.postToTransaction(this,"/api/v1/authn/recovery/unlock",e)},p.verifyRecoveryToken=function(e){return i.postToTransaction(this,"/api/v1/authn/recovery/token",e)},e.exports=function(e){function t(n){return this instanceof t?(n&&!n.ajaxRequest&&(n.ajaxRequest=e),void o.bind(r,this)(n)):new t(n)}return t.prototype=r.prototype,t.prototype.constructor=t,t}},function(e,t,n){n(7),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var n;if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),o=r.length>>>0;if(0===o)return-1;var i=+t||0;if(Math.abs(i)===1/0&&(i=0),i>=o)return-1;for(n=Math.max(i>=0?i:o-Math.abs(i),0);n<o;){if(n in r&&r[n]===e)return n;n++}return-1}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)})},function(e,t,n){!function(){function e(e){this.message=e}var n=t,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",n.btoa||(n.btoa=function(t){for(var n,o,i=String(t),s=0,a=r,u="";i.charAt(0|s)||(a="=",s%1);u+=a.charAt(63&n>>8-s%1*8)){if(o=i.charCodeAt(s+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return u}),n.atob||(n.atob=function(t){var n=String(t).replace(/=+$/,"");if(n.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,s=0,a=0,u="";i=n.charAt(a++);~i&&(o=s%4?64*o+i:i,s++%4)?u+=String.fromCharCode(255&o>>(-2*s&6)):0)i=r.indexOf(i);return u})}()},function(e,t){function n(e){return e.replace(/\-/g,"+").replace(/_/g,"/")}function r(e){var t=n(e);switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Not a valid Base64Url"}var r=atob(t);try{return decodeURIComponent(escape(r))}catch(o){return r}}function o(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function i(e){return atob(n(e))}function s(e,t){var n=Array.prototype.slice.call(arguments,2);return function(){var r=Array.prototype.slice.call(arguments);return r=n.concat(r),e.apply(t,r)}}function a(e){return/^(?:[a-z]+:)?\/\//i.test(e)}function u(e){return"[object String]"===Object.prototype.toString.call(e)}function c(e){return"[object Object]"===Object.prototype.toString.call(e)}function p(e){return"[object Number]"===Object.prototype.toString.call(e)}function f(e){var t=e.match(/\d+/g),n=Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5]),r=new Date(n);return r.toUTCString()}function l(e){var t=[];if(null!==e)for(var n in e)e.hasOwnProperty(n)&&void 0!==e[n]&&null!==e[n]&&t.push(n+"="+encodeURIComponent(e[n]));return t.length?"?"+t.join("&"):""}function d(e){for(var t="abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n="",r=0,o=t.length;r<e;++r)n+=t[Math.floor(Math.random()*o)];return n}function h(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function y(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!==r&&void 0!==r&&(t[n]=r)}return t}function m(e){if(e){var t=JSON.stringify(e);if(t)return JSON.parse(t)}return e}function v(e){var t=Array.prototype.slice.call(arguments,1),n={};for(var r in e)e.hasOwnProperty(r)&&t.indexOf(r)==-1&&(n[r]=e[r]);return m(n)}function g(e,t){for(var n=e.length;n--;){var r=e[n],o=!0;for(var i in t)if(t.hasOwnProperty(i)&&r[i]!==t[i]){o=!1;break}if(o)return r}}function w(e,t,n){if(e&&e._links){var r=m(e._links[t]);return r&&r.name&&n?r.name===n?r:void 0:r}}e.exports={base64UrlToBase64:n,base64UrlToString:r,stringToBuffer:o,base64UrlDecode:i,bind:s,isAbsoluteUrl:a,isString:u,isObject:c,isNumber:p,isoToUTCString:f,toQueryParams:l,genRandomString:d,extend:h,removeNils:y,clone:m,omit:v,find:g,getLink:w}},function(e,t,n){function r(e,t){var n=y.clone(t)||{};return!n.stateToken&&e.stateToken&&(n.stateToken=e.stateToken),n}function o(e){return r(e)}function i(e,t){return t=r(e,t),h.post(e,e.options.url+"/api/v1/authn",t)}function s(e,t){if(!t||!t.stateToken){var n=e.tx.exists._getCookie(w.STATE_TOKEN_COOKIE_NAME);if(!n)return m.reject(new v("No transaction to resume"));t={stateToken:n}}return e.tx.status(t).then(function(t){return new d(e,t)})}function a(e){return!!e.tx.exists._getCookie(w.STATE_TOKEN_COOKIE_NAME)}function u(e,t,n){return h.post(e,t,n).then(function(t){return new d(e,t)})}function c(e,t,n){return function(r){function i(){var n=u.href;return a&&(n+="?rememberDevice=true"),h.post(e,n,o(t),!0,!0)}var s,a;y.isNumber(r)?s=r:y.isObject(r)&&(s=r.delay,a=r.rememberDevice),s||0===s||(s=w.DEFAULT_POLLING_DELAY);var u=y.getLink(t,"next","poll");n.isPolling=!0;var c=0,p=function(){return n.isPolling?i().then(function(t){if(c=0,t.factorResult&&"WAITING"===t.factorResult){if(!n.isPolling)throw new g;return m.delay(s).then(p)}return n.isPolling=!1,new d(e,t)}).fail(function(e){if(e.xhr&&(0===e.xhr.status||429===e.xhr.status)&&c<=4){var t=1e3*Math.pow(2,c);return c++,m.delay(t).then(p)}throw e}):m.reject(new g)};return p().fail(function(e){throw n.isPolling=!1,e})}}function p(e,t,n,o,i){if(Array.isArray(o))return function(r,s){if(!r)throw new v("Must provide a link name");var a=y.find(o,{name:r});if(!a)throw new v("No link found for that name");return p(e,t,n,a,i)(s)};if(o.hints&&o.hints.allow&&1===o.hints.allow.length){var s=o.hints.allow[0];switch(s){case"GET":return function(){return h.get(e,o.href)};case"POST":return function(s){i&&i.isPolling&&(i.isPolling=!1);var a=r(t,s);"MFA_ENROLL"===t.status&&y.extend(a,{factorType:n.factorType,provider:n.provider});var c=o.href;return void 0!==a.rememberDevice?(a.rememberDevice&&(c+="?rememberDevice=true"),a=y.omit(a,"rememberDevice")):a.profile&&void 0!==a.profile.updatePhone&&(a.profile.updatePhone&&(c+="?updatePhone=true"),a.profile=y.omit(a.profile,"updatePhone")),u(e,c,a)}}}}function f(e,t,n,r){var o={};for(var i in n._links)if(n._links.hasOwnProperty(i)){var s=n._links[i];if("next"===i&&(i=s.name),s.type)o[i]=s;else switch(i){case"poll":o.poll=c(e,t,r);break;default:var a=p(e,t,n,s,r);a&&(o[i]=a)}}return o}function l(e,t,n,r){if(n=n||t,n=y.clone(n),Array.isArray(n)){for(var o=[],i=0,s=n.length;i<s;i++)o.push(l(e,t,n[i],r));return o}var a=n._embedded||{};for(var u in a)a.hasOwnProperty(u)&&(y.isObject(a[u])||Array.isArray(a[u]))&&(a[u]=l(e,t,a[u],r));var c=f(e,t,n,r);return y.extend(a,c),n=y.omit(n,"_embedded","_links"),y.extend(n,a),n}function d(e,t){t&&(this.data=t,y.extend(this,l(e,t,t,{})),delete this.stateToken,"RECOVERY_CHALLENGE"!==t.status||t._links||(this.cancel=function(){return new m(new d(e))}))}var h=n(10),y=n(8),m=n(12),v=n(17),g=n(18),w=n(16);e.exports={transactionStatus:i,resumeTransaction:s,transactionExists:a,postToTransaction:u}},function(e,t,n){function r(e,t,n,r,o){var i={Accept:"application/json","Content-Type":"application/json","X-Okta-User-Agent-Extended":"okta-auth-js-"+p.SDK_VERSION};s.extend(i,e.options.headers||{});var f,l,d={headers:i,data:r||void 0};return new u(e.options.ajaxRequest(n,t,d)).then(function(e){return l=e.responseText,l&&s.isString(l)&&(l=JSON.parse(l)),o||l.stateToken||a.deleteCookie(p.STATE_TOKEN_COOKIE_NAME),l&&l.stateToken&&l.expiresAt&&a.setCookie(p.STATE_TOKEN_COOKIE_NAME,l.stateToken,l.expiresAt),l}).fail(function(t){var n=t.responseText||{};if(s.isString(n))try{n=JSON.parse(n)}catch(r){n={errorSummary:"Unknown error"}}throw t.status>=500&&(n.errorSummary="Unknown error"),e.options.transformErrorXHR&&(t=e.options.transformErrorXHR(s.clone(t))),f=new c(n,t),"E0000011"===f.errorCode&&a.deleteCookie(p.STATE_TOKEN_COOKIE_NAME),f})}function o(e,t,n){return t=s.isAbsoluteUrl(t)?t:e.options.url+t,r(e,t,"GET",void 0,!n)}function i(e,t,n,o){return t=s.isAbsoluteUrl(t)?t:e.options.url+t,r(e,t,"POST",n,o)}var s=n(8),a=n(11),u=n(12),c=n(15),p=n(16);e.exports={get:o,post:i,httpRequest:r}},function(e,t,n){function r(e,t,n){var o="";n&&(o=" expires="+s.isoToUTCString(n)+";");var i=e+"="+t+";"+o;return r._setDocumentCookie(i),i}function o(e){var t=new RegExp(e+"=([^;]*)"),n=o._getDocumentCookie().match(t);if(n){var r=n[1];return r}}function i(e){r(e,"","1970-01-01T00:00:00Z")}var s=n(8);r._setDocumentCookie=function(e){document.cookie=e},o._getDocumentCookie=function(){return document.cookie},e.exports={setCookie:r,getCookie:o,deleteCookie:i}},function(e,t,n){(function(t,n){/*!
*
* Copyright 2009-2012 Kris Kowal under the terms of the MIT
* license found at http://github.com/kriskowal/q/raw/master/LICENSE
*
* With parts by Tyler Close
* Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
* at http://www.opensource.org/licenses/mit-license.html
* Forked at ref_send.js version: 2009-05-11
*
* With parts by Mark Miller
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
!function(t){"use strict";if("function"==typeof bootstrap)bootstrap("promise",t);else{e.exports=t()}}(function(){"use strict";function e(e){return function(){return G.apply(e,arguments)}}function r(e){return e===Object(e)}function o(e){return"[object StopIteration]"===oe(e)||e instanceof z}function i(e,t){if(W&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&e.stack.indexOf(ie)===-1){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var o=n.join("\n"+ie+"\n");e.stack=s(o)}}function s(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];c(o)||a(o)||!o||n.push(o)}return n.join("\n")}function a(e){return e.indexOf("(module.js:")!==-1||e.indexOf("(node.js:")!==-1}function u(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function c(e){var t=u(e);if(!t)return!1;var n=t[0],r=t[1];return n===B&&r>=J&&r<=pe}function p(){if(W)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=u(n);if(!r)return;return B=r[0],r[1]}}function f(e,t,n){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t+" is deprecated, use "+n+" instead.",new Error("").stack),e.apply(e,arguments)}}function l(e){return e instanceof m?e:_(e)?j(e):O(e)}function d(){function e(e){t=e,i.source=e,$(n,function(t,n){l.nextTick(function(){e.promiseDispatch.apply(e,n)})},void 0),n=void 0,r=void 0}var t,n=[],r=[],o=te(d.prototype),i=te(m.prototype);if(i.promiseDispatch=function(e,o,i){var s=Y(arguments);n?(n.push(s),"when"===o&&i[1]&&r.push(i[1])):l.nextTick(function(){t.promiseDispatch.apply(t,s)})},i.valueOf=function(){if(n)return i;var e=g(t);return w(e)&&(t=e),e},i.inspect=function(){return t?t.inspect():{state:"pending"}},l.longStackSupport&&W)try{throw new Error}catch(s){i.stack=s.stack.substring(s.stack.indexOf("\n")+1)}return o.promise=i,o.resolve=function(n){t||e(l(n))},o.fulfill=function(n){t||e(O(n))},o.reject=function(n){t||e(R(n))},o.notify=function(e){t||$(r,function(t,n){l.nextTick(function(){n(e)})},void 0)},o}function h(e){if("function"!=typeof e)throw new TypeError("resolver must be a function.");var t=d();try{e(t.resolve,t.reject,t.notify)}catch(n){t.reject(n)}return t.promise}function y(e){return h(function(t,n){for(var r=0,o=e.length;r<o;r++)l(e[r]).then(t,n)})}function m(e,t,n){void 0===t&&(t=function(e){return R(new Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var r=te(m.prototype);if(r.promiseDispatch=function(n,o,i){var s;try{s=e[o]?e[o].apply(r,i):t.call(r,o,i)}catch(a){s=R(a)}n&&n(s)},r.inspect=n,n){var o=n();"rejected"===o.state&&(r.exception=o.reason),r.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?r:e.value}}return r}function v(e,t,n,r){return l(e).then(t,n,r)}function g(e){if(w(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function w(e){return e instanceof m}function _(e){return r(e)&&"function"==typeof e.then}function T(e){return w(e)&&"pending"===e.inspect().state}function k(e){return!w(e)||"fulfilled"===e.inspect().state}function x(e){return w(e)&&"rejected"===e.inspect().state}function b(){se.length=0,ae.length=0,ce||(ce=!0)}function A(e,n){ce&&("object"==typeof t&&"function"==typeof t.emit&&l.nextTick.runAfter(function(){Z(ae,e)!==-1&&(t.emit("unhandledRejection",n,e),ue.push(e))}),ae.push(e),n&&"undefined"!=typeof n.stack?se.push(n.stack):se.push("(no stack) "+n))}function E(e){if(ce){var n=Z(ae,e);n!==-1&&("object"==typeof t&&"function"==typeof t.emit&&l.nextTick.runAfter(function(){var r=Z(ue,e);r!==-1&&(t.emit("rejectionHandled",se[n],e),ue.splice(r,1))}),ae.splice(n,1),se.splice(n,1))}}function R(e){var t=m({when:function(t){return t&&E(this),t?t(e):this}},function(){return this},function(){return{state:"rejected",reason:e}});return A(t,e),t}function O(e){return m({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},"delete":function(t){delete e[t]},post:function(t,n){return null===t||void 0===t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return re(e)}},void 0,function(){return{state:"fulfilled",value:e}})}function j(e){var t=d();return l.nextTick(function(){try{e.then(t.resolve,t.reject,t.notify)}catch(n){t.reject(n)}}),t.promise}function C(e){return m({isDef:function(){}},function(t,n){return M(e,t,n)},function(){return l(e).inspect()})}function S(e,t,n){return l(e).spread(t,n)}function I(e){return function(){function t(e,t){var s;if("undefined"==typeof StopIteration){try{s=n[e](t)}catch(a){return R(a)}return s.done?l(s.value):v(s.value,r,i)}try{s=n[e](t)}catch(a){return o(a)?l(a.value):R(a)}return v(s,r,i)}var n=e.apply(this,arguments),r=t.bind(t,"next"),i=t.bind(t,"throw");return r()}}function P(e){l.done(l.async(e)())}function q(e){throw new z(e)}function N(e){return function(){return S([this,D(arguments)],function(t,n){return e.apply(t,n)})}}function M(e,t,n){return l(e).dispatch(t,n)}function D(e){return v(e,function(e){var t=0,n=d();return $(e,function(r,o,i){var s;w(o)&&"fulfilled"===(s=o.inspect()).state?e[i]=s.value:(++t,v(o,function(r){e[i]=r,0===--t&&n.resolve(e)},n.reject,function(e){n.notify({index:i,value:e})}))},void 0),0===t&&n.resolve(e),n.promise})}function U(e){if(0===e.length)return l.resolve();var t=l.defer(),n=0;return $(e,function(r,o,i){function s(e){t.resolve(e)}function a(){n--,0===n&&t.reject(new Error("Can't get fulfillment value from any promise, all promises were rejected."))}function u(e){t.notify({index:i,value:e})}var c=e[i];n++,v(c,s,a,u)},void 0),t.promise}function H(e){return v(e,function(e){return e=ee(e,l),v(D(ee(e,function(e){return v(e,V,V)})),function(){return e})})}function L(e){return l(e).allSettled()}function F(e,t){return l(e).then(void 0,void 0,t)}function K(e,t){return l(e).nodeify(t)}var W=!1;try{throw new Error}catch(X){W=!!X.stack}var B,z,J=p(),V=function(){},Q=function(){function e(){for(var e,t;o.next;)o=o.next,e=o.task,o.task=void 0,t=o.domain,t&&(o.domain=void 0,t.enter()),r(e,t);for(;c.length;)e=c.pop(),r(e);s=!1}function r(t,n){try{t()}catch(r){if(u)throw n&&n.exit(),setTimeout(e,0),n&&n.enter(),r;setTimeout(function(){throw r},0)}n&&n.exit()}var o={task:void 0,next:null},i=o,s=!1,a=void 0,u=!1,c=[];if(Q=function(e){i=i.next={task:e,domain:u&&t.domain,next:null},s||(s=!0,a())},"object"==typeof t&&"[object process]"===t.toString()&&t.nextTick)u=!0,a=function(){t.nextTick(e)};else if("function"==typeof n)a="undefined"!=typeof window?n.bind(window,e):function(){n(e)};else if("undefined"!=typeof MessageChannel){var p=new MessageChannel;p.port1.onmessage=function(){a=f,p.port1.onmessage=e,e()};var f=function(){p.port2.postMessage(0)};a=function(){setTimeout(e,0),f()}}else a=function(){setTimeout(e,0)};return Q.runAfter=function(e){c.push(e),s||(s=!0,a())},Q}(),G=Function.call,Y=e(Array.prototype.slice),$=e(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;n<r;n++)n in this&&(t=e(t,this[n],n));return t}),Z=e(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),ee=e(Array.prototype.map||function(e,t){var n=this,r=[];return $(n,function(o,i,s){r.push(e.call(t,i,s,n))},void 0),r}),te=Object.create||function(e){function t(){}return t.prototype=e,new t},ne=e(Object.prototype.hasOwnProperty),re=Object.keys||function(e){var t=[];for(var n in e)ne(e,n)&&t.push(n);return t},oe=e(Object.prototype.toString);z="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var ie="From previous event:";l.resolve=l,l.nextTick=Q,l.longStackSupport=!1,"object"==typeof t&&t&&t.env&&t.env.Q_DEBUG&&(l.longStackSupport=!0),l.defer=d,d.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(Y(arguments,1)):e.resolve(n)}},l.Promise=h,l.promise=h,h.race=y,h.all=D,h.reject=R,h.resolve=l,l.passByCopy=function(e){return e},m.prototype.passByCopy=function(){return this},l.join=function(e,t){return l(e).join(t)},m.prototype.join=function(e){return l([this,e]).spread(function(e,t){if(e===t)return e;throw new Error("Can't join: not the same: "+e+" "+t)})},l.race=y,m.prototype.race=function(){return this.then(l.race)},l.makePromise=m,m.prototype.toString=function(){return"[object Promise]"},m.prototype.then=function(e,t,n){function r(t){try{return"function"==typeof e?e(t):t}catch(n){return R(n)}}function o(e){if("function"==typeof t){i(e,a);try{return t(e)}catch(n){return R(n)}}return R(e)}function s(e){return"function"==typeof n?n(e):e}var a=this,u=d(),c=!1;return l.nextTick(function(){a.promiseDispatch(function(e){c||(c=!0,u.resolve(r(e)))},"when",[function(e){c||(c=!0,u.resolve(o(e)))}])}),a.promiseDispatch(void 0,"when",[void 0,function(e){var t,n=!1;try{t=s(e)}catch(r){if(n=!0,!l.onerror)throw r;l.onerror(r)}n||u.notify(t)}]),u.promise},l.tap=function(e,t){return l(e).tap(t)},m.prototype.tap=function(e){return e=l(e),this.then(function(t){return e.fcall(t).thenResolve(t)})},l.when=v,m.prototype.thenResolve=function(e){return this.then(function(){return e})},l.thenResolve=function(e,t){return l(e).thenResolve(t)},m.prototype.thenReject=function(e){return this.then(function(){throw e})},l.thenReject=function(e,t){return l(e).thenReject(t)},l.nearer=g,l.isPromise=w,l.isPromiseAlike=_,l.isPending=T,m.prototype.isPending=function(){return"pending"===this.inspect().state},l.isFulfilled=k,m.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},l.isRejected=x,m.prototype.isRejected=function(){return"rejected"===this.inspect().state};var se=[],ae=[],ue=[],ce=!0;l.resetUnhandledRejections=b,l.getUnhandledReasons=function(){return se.slice()},l.stopUnhandledRejectionTracking=function(){b(),ce=!1},b(),l.reject=R,l.fulfill=O,l.master=C,l.spread=S,m.prototype.spread=function(e,t){return this.all().then(function(t){return e.apply(void 0,t)},t)},l.async=I,l.spawn=P,l["return"]=q,l.promised=N,l.dispatch=M,m.prototype.dispatch=function(e,t){var n=this,r=d();return l.nextTick(function(){n.promiseDispatch(r.resolve,e,t)}),r.promise},l.get=function(e,t){return l(e).dispatch("get",[t])},m.prototype.get=function(e){return this.dispatch("get",[e])},l.set=function(e,t,n){return l(e).dispatch("set",[t,n])},m.prototype.set=function(e,t){return this.dispatch("set",[e,t])},l.del=l["delete"]=function(e,t){return l(e).dispatch("delete",[t])},m.prototype.del=m.prototype["delete"]=function(e){return this.dispatch("delete",[e])},l.mapply=l.post=function(e,t,n){return l(e).dispatch("post",[t,n])},m.prototype.mapply=m.prototype.post=function(e,t){return this.dispatch("post",[e,t])},l.send=l.mcall=l.invoke=function(e,t){return l(e).dispatch("post",[t,Y(arguments,2)])},m.prototype.send=m.prototype.mcall=m.prototype.invoke=function(e){return this.dispatch("post",[e,Y(arguments,1)])},l.fapply=function(e,t){return l(e).dispatch("apply",[void 0,t])},m.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},l["try"]=l.fcall=function(e){return l(e).dispatch("apply",[void 0,Y(arguments,1)])},m.prototype.fcall=function(){return this.dispatch("apply",[void 0,Y(arguments)])},l.fbind=function(e){var t=l(e),n=Y(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(Y(arguments))])}},m.prototype.fbind=function(){var e=this,t=Y(arguments);return function(){return e.dispatch("apply",[this,t.concat(Y(arguments))])}},l.keys=function(e){return l(e).dispatch("keys",[])},m.prototype.keys=function(){return this.dispatch("keys",[])},l.all=D,m.prototype.all=function(){return D(this)},l.any=U,m.prototype.any=function(){return U(this)},l.allResolved=f(H,"allResolved","allSettled"),m.prototype.allResolved=function(){return H(this)},l.allSettled=L,m.prototype.allSettled=function(){return this.then(function(e){return D(ee(e,function(e){function t(){return e.inspect()}return e=l(e),e.then(t,t)}))})},l.fail=l["catch"]=function(e,t){return l(e).then(void 0,t)},m.prototype.fail=m.prototype["catch"]=function(e){return this.then(void 0,e)},l.progress=F,m.prototype.progress=function(e){return this.then(void 0,void 0,e)},l.fin=l["finally"]=function(e,t){return l(e)["finally"](t)},m.prototype.fin=m.prototype["finally"]=function(e){return e=l(e),this.then(function(t){return e.fcall().then(function(){return t})},function(t){return e.fcall().then(function(){throw t})})},l.done=function(e,t,n,r){return l(e).done(t,n,r)},m.prototype.done=function(e,n,r){var o=function(e){l.nextTick(function(){if(i(e,s),!l.onerror)throw e;l.onerror(e)})},s=e||n||r?this.then(e,n,r):this;"object"==typeof t&&t&&t.domain&&(o=t.domain.bind(o)),s.then(void 0,o)},l.timeout=function(e,t,n){return l(e).timeout(t,n)},m.prototype.timeout=function(e,t){var n=d(),r=setTimeout(function(){t&&"string"!=typeof t||(t=new Error(t||"Timed out after "+e+" ms"),t.code="ETIMEDOUT"),n.reject(t)},e);return this.then(function(e){clearTimeout(r),n.resolve(e)},function(e){clearTimeout(r),n.reject(e)},n.notify),n.promise},l.delay=function(e,t){return void 0===t&&(t=e,e=void 0),l(e).delay(t)},m.prototype.delay=function(e){return this.then(function(t){var n=d();return setTimeout(function(){n.resolve(t)},e),n.promise})},l.nfapply=function(e,t){return l(e).nfapply(t)},m.prototype.nfapply=function(e){var t=d(),n=Y(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},l.nfcall=function(e){var t=Y(arguments,1);return l(e).nfapply(t)},m.prototype.nfcall=function(){var e=Y(arguments),t=d();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},l.nfbind=l.denodeify=function(e){var t=Y(arguments,1);return function(){var n=t.concat(Y(arguments)),r=d();return n.push(r.makeNodeResolver()),l(e).fapply(n).fail(r.reject),r.promise}},m.prototype.nfbind=m.prototype.denodeify=function(){var e=Y(arguments);return e.unshift(this),l.denodeify.apply(void 0,e)},l.nbind=function(e,t){var n=Y(arguments,2);return function(){function r(){return e.apply(t,arguments)}var o=n.concat(Y(arguments)),i=d();return o.push(i.makeNodeResolver()),l(r).fapply(o).fail(i.reject),i.promise}},m.prototype.nbind=function(){var e=Y(arguments,0);return e.unshift(this),l.nbind.apply(void 0,e)},l.nmapply=l.npost=function(e,t,n){return l(e).npost(t,n)},m.prototype.nmapply=m.prototype.npost=function(e,t){var n=Y(t||[]),r=d();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},l.nsend=l.nmcall=l.ninvoke=function(e,t){var n=Y(arguments,2),r=d();return n.push(r.makeNodeResolver()),l(e).dispatch("post",[t,n]).fail(r.reject),r.promise},m.prototype.nsend=m.prototype.nmcall=m.prototype.ninvoke=function(e){var t=Y(arguments,1),n=d();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},l.nodeify=K,m.prototype.nodeify=function(e){return e?void this.then(function(t){l.nextTick(function(){e(null,t)})},function(t){l.nextTick(function(){e(t)})}):this},l.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var pe=p();return l})}).call(t,n(13),n(14).setImmediate)},function(e,t){function n(){f&&c&&(f=!1,c.length?p=c.concat(p):l=-1,p.length&&r())}function r(){if(!f){var e=s.call(null,n);f=!0;for(var t=p.length;t;){for(c=p,p=[];++l<t;)c&&c[l].run();l=-1,t=p.length}c=null,f=!1,a.call(null,e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var s,a,u=e.exports={};!function(){try{s=setTimeout}catch(e){s=function(){throw new Error("setTimeout is not defined")}}try{a=clearTimeout}catch(e){a=function(){throw new Error("clearTimeout is not defined")}}}();var c,p=[],f=!1,l=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new o(e,t)),1!==p.length||f||s.call(null,r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,t,n){(function(e,r){function o(e,t){this._id=e,this._clearFn=t}var i=n(13).nextTick,s=Function.prototype.apply,a=Array.prototype.slice,u={},c=0;t.setTimeout=function(){return new o(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new o(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var n=c++,r=!(arguments.length<2)&&a.call(arguments,1);return u[n]=!0,i(function(){u[n]&&(r?e.apply(null,r):e.call(null),t.clearImmediate(n))}),n},t.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(t,n(14).setImmediate,n(14).clearImmediate)},function(e,t){function n(e,t){this.name="AuthApiError",this.message=e.errorSummary,this.errorSummary=e.errorSummary,this.errorCode=e.errorCode,this.errorLink=e.errorLink,this.errorId=e.errorId,this.errorCauses=e.errorCauses,t&&(this.xhr=t)}n.prototype=new Error,e.exports=n},function(e,t){e.exports={STATE_TOKEN_COOKIE_NAME:"oktaStateToken",DEFAULT_POLLING_DELAY:500,FRAME_ID:"okta-oauth-helper-frame",REDIRECT_OAUTH_PARAMS_COOKIE_NAME:"okta-oauth-redirect-params",SDK_VERSION:"1.3.0"}},function(e,t){function n(e,t){this.name="AuthSdkError",this.message=e,this.errorCode="INTERNAL",this.errorSummary=e,this.errorLink="INTERNAL",this.errorId="INTERNAL",this.errorCauses=[],t&&(this.xhr=t)}n.prototype=new Error,e.exports=n},function(e,t){function n(){this.name="AuthPollStopError",this.message="The poll was stopped by the sdk"}n.prototype=new Error,e.exports=n},function(e,t,n){function r(e){return e.session.get().then(function(e){return"ACTIVE"===e.status}).fail(function(){return!1})}function o(e){return c.get(e,"/api/v1/sessions/me").then(function(t){var n=u.omit(t,"_links");return n.refresh=function(){return c.post(e,u.getLink(t,"refresh").href)},n.user=function(){return c.get(e,u.getLink(t,"user").href)},n}).fail(function(){return{status:"INACTIVE"}})}function i(e){return c.httpRequest(e,e.options.url+"/api/v1/sessions/me","DELETE",void 0,!0)}function s(e){return c.post(e,"/api/v1/sessions/me/lifecycle/refresh")}function a(e,t,n){n=n||window.location.href,window.location=e.options.url+"/login/sessionCookieRedirect"+u.toQueryParams({checkAccountSetupComplete:!0,token:t,redirectUrl:n})}var u=n(8),c=n(10);e.exports={sessionExists:r,getSession:o,closeSession:i,refreshSession:s,setCookieAndRedirect:a}},function(e,t,n){function r(e){return b.get(e,e.options.url+"/.well-known/openid-configuration")}function o(e,t,n){if(!e||!t||!n)throw new O("The jwt, iss, and aud arguments are all required");var r=Math.floor((new Date).getTime()/1e3);if(e.iss!==t)throw new O("The issuer ["+e.iss+"] does not match ["+t+"]");if(e.aud!==n)throw new O("The audience ["+e.aud+"] does not match ["+n+"]");if(e.iat>e.exp)throw new O("The JWT expired before it was issued");if(r>e.exp)throw new O("The JWT expired and is no longer valid");if(e.iat>r)throw new O("The JWT was issued in the future")}function i(e){var t,n=e.split(".");try{t={header:JSON.parse(A.base64UrlToString(n[0])),payload:JSON.parse(A.base64UrlToString(n[1])),signature:n[2]}}catch(r){throw new O("Malformed token")}return t}function s(e,t,n){function o(e){var t;if(t=n.expirationTime||0===n.expirationTime?n.expirationTime:Math.floor(Date.now()/1e3),e&&e>t)return!0}function i(e){if(!n.audience)return!0;for(var t=Array.isArray(n.audience)?n.audience:[n.audience],r=Array.isArray(e)?e:[e],o=t.length;o--;){var i=t[o];if(r.indexOf(i)!==-1)return!0}}return n=n||{},e.features.isTokenVerifySupported()?r(e).then(function(t){return b.get(e,t.jwks_uri)}).then(function(e){var n=e.keys[0];return R.verifyToken(t,n)}).then(function(r){if(!r)return!1;var s=e.idToken.decode(t);return!o(s.payload.exp)&&(!!i(s.payload.aud)&&(!n.issuer||n.issuer===s.payload.iss))}):E.reject(new O("This browser doesn't support crypto.subtle"))}function a(e,t){return t=t||{},t.display=null,t.prompt="none",w(e,t)}function u(e,t){if("undefined"!=typeof t){var n=document.getElementById(t);return n?n:(n=document.createElement("iframe"),n.setAttribute("id",t),n.style.display="none",n.src=e,document.body.appendChild(n))}}function c(e,t){var n=t.popupTitle||"External Identity Provider User Authentication",r="toolbar=no, scrollbars=yes, resizable=yes, top=100, left=500, width=600, height=600";return window.open(e,n,r)}function p(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}function f(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent("on"+t,n)}function l(e,t){function n(t){t.data&&t.origin===e.options.url&&r.resolve(t.data)}var r=E.defer();return p(window,"message",n),r.promise.timeout(t||12e4,new O("OAuth flow timed out")).fin(function(){f(window,"message",n)})}function d(e){for(var t,n=/\+/g,r=/([^&=]+)=?([^&]*)/g,o=e.substring(1),i={};;){if(t=r.exec(o),!t)break;var s=t[1],a=t[2];"id_token"===s||"access_token"===s?i[s]=a:i[s]=decodeURIComponent(a.replace(n," "))}return i}function h(e,t,n){function r(){try{t&&t.location&&t.location.hash?o.resolve(d(t.location.hash)):t&&!t.closed&&setTimeout(r,500)}catch(e){setTimeout(r,500)}}var o=E.defer();return r(),o.promise.timeout(n||12e4,new O("OAuth flow timed out"))}function y(e,t,n){if(n.error||n.error_description)throw new j(n.error,n.error_description);if(n.state!==t.state)throw new O("OAuth flow response state doesn't match request state");var r=t.responseType,i=A.clone(t.scope),s={};if(n.id_token){var a=e.idToken.decode(n.id_token);if(a.payload.nonce!==t.nonce)throw new O("OAuth flow response nonce doesn't match request nonce");var u=t.clientId||e.options.clientId;o(a.payload,e.options.url,u);var c={idToken:n.id_token,claims:a.payload,expiresAt:a.payload.exp,scopes:i};if(!Array.isArray(r))return c;s.id_token=c}if(n.access_token){var p={accessToken:n.access_token,expiresAt:Number(n.expires_in)+Math.floor(Date.now()/1e3),tokenType:n.token_type,scopes:i};if(!Array.isArray(r))return p;s.token=p}if(!s.token&&!s.id_token)throw new O("Unable to parse OAuth flow response");for(var f=[],l=0,d=r.length;l<d;l++){var h=r[l];s[h]&&f.push(s[h])}return f}function m(e,t){t=A.clone(t)||{};var n={clientId:e.options.clientId,redirectUri:e.options.redirectUri||window.location.href,responseType:"id_token",responseMode:"okta_post_message",state:A.genRandomString(64),nonce:A.genRandomString(64),scope:["openid","email"]};return A.extend(n,t),n}function v(e){if(!e.clientId)throw new O("A clientId must be specified in the OktaAuth constructor to get a token");if(A.isString(e.responseType)&&e.responseType.indexOf(" ")!==-1)throw new O("Multiple OAuth responseTypes must be defined as an array");var t=A.removeNils({client_id:e.clientId,redirect_uri:e.redirectUri,response_type:e.responseType,response_mode:e.responseMode,state:e.state,nonce:e.nonce,prompt:e.prompt,display:e.display,sessionToken:e.sessionToken,idp:e.idp,max_age:e.maxAge});if(Array.isArray(t.response_type)&&(t.response_type=t.response_type.join(" ")),e.responseType.indexOf("id_token")!==-1&&e.scope.indexOf("openid")===-1)throw new O("openid scope must be specified in the scope argument when requesting an id_token");return t.scope=e.scope.join(" "),t}function g(e,t){var n=v(t);return e.options.url+"/oauth2/v1/authorize"+A.toQueryParams(n)}function w(e,t,n){function r(e){var t=/^(https?\:\/\/)?([^:\/?#]*(?:\:[0-9]+)?)/;return t.exec(e)[0]}function o(e){e.closed&&b.reject(new O("Unable to parse OAuth flow response"))}t||(t={}),n||(n={});var i=m(e,t),s={prompt:"none",responseMode:"okta_post_message",display:null},a={display:"popup"};t.sessionToken?A.extend(i,s):t.idp&&A.extend(i,a);var p,f=g(e,i);switch(p=i.sessionToken||null===i.display?"IFRAME":"popup"===i.display?"POPUP":"IMPLICIT"){case"IFRAME":var d=l(e,n.timeout),v=u(f,C.FRAME_ID);return d.then(function(t){return y(e,i,t)}).fin(function(){document.body.contains(v)&&v.parentElement.removeChild(v)});case"POPUP":var w;if("okta_post_message"===i.responseMode){if(!e.features.isPopupPostMessageSupported())return E.reject(new O("This browser doesn't have full postMessage support"));w=l(e,n.timeout)}var _={popupTitle:n.popupTitle},T=c(f,_);if("fragment"===i.responseMode){var k=r(e.idToken.authorize._getLocationHref()),x=r(i.redirectUri);if(k!==x)return E.reject(new O("Using fragment, the redirectUri origin ("+x+") must match the origin of this page ("+k+")"));w=h(e,T,n.timeout)}var b=E.defer(),R=setInterval(function(){o(T)},500);return w.then(function(e){b.resolve(e)}).fail(function(e){b.reject(e)}),b.promise.then(function(t){return y(e,i,t)}).fin(function(){T.closed||(clearInterval(R),T.close())});default:return E.reject(new O("The full page redirect flow is not supported"))}}function _(e,t,n){var r=A.clone(t)||{};return A.extend(r,{prompt:"none",responseMode:"okta_post_message",display:null}),w(e,r,n)}function T(e,t,n){var r=A.clone(t)||{};return A.extend(r,{display:"popup"}),w(e,r,n)}function k(e,t,n){t=A.clone(t)||{};var r=m(e,t);A.extend(r,{responseMode:"fragment"});var o=g(e,r);S.setCookie(C.REDIRECT_OAUTH_PARAMS_COOKIE_NAME,JSON.stringify({responseType:r.responseType,state:r.state,nonce:r.nonce,scope:r.scope})),e.token.getWithRedirect._setLocation(o)}function x(e,t){var n=e.token.parseFromUrl._getLocationHash();t&&(n=t.substring(t.indexOf("#")));var r=S.getCookie(C.REDIRECT_OAUTH_PARAMS_COOKIE_NAME);if(!n||!r)return E.reject(new O("Unable to parse a token from the url"));try{var o=JSON.parse(r);S.deleteCookie(C.REDIRECT_OAUTH_PARAMS_COOKIE_NAME)}catch(i){return E.reject(new O("Unable to parse the "+C.REDIRECT_OAUTH_PARAMS_COOKIE_NAME+" cookie: "+i.message))}return E.resolve(d(n)).then(function(t){return y(e,o,t)})}var b=n(10),A=n(8),E=n(12),R=n(21),O=n(17),j=n(22),C=n(16),S=n(11);e.exports={getToken:w,getWithoutPrompt:_,getWithPopup:T,getWithRedirect:k,parseFromUrl:x,refreshIdToken:a,decodeToken:i,verifyIdToken:s}},function(e,t,n){function r(e,t){var n="jwk",r={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},i=!0,s=["verify"];return crypto.subtle.importKey(n,t,r,i,s).then(function(t){var n=e.split("."),i=o.stringToBuffer(n[0]+"."+n[1]),s=o.base64UrlDecode(n[2]),a=o.stringToBuffer(s);return crypto.subtle.verify(r,t,a,i)})}var o=n(8);e.exports={verifyToken:r}},function(e,t){function n(e,t){this.name="OAuthError",this.message=t,this.errorCode=e,this.errorSummary=t}n.prototype=new Error,e.exports=n}])});
//# sourceMappingURL=OktaAuth.min.js.map