/*! For license information please see oidc-client.min.js.LICENSE.txt */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var i in r)("object"==typeof exports?exports:t)[i]=r[i]}}(window,(function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=45)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r=4){for(var t=arguments.length,e=Array(t),r=0;r=3){for(var t=arguments.length,e=Array(t),r=0;r=2){for(var t=arguments.length,e=Array(t),r=0;r=1){for(var t=arguments.length,e=Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:"#",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.Global;"string"!=typeof t&&(t=r.location.href);var o=t.lastIndexOf(e);o>=0&&(t=t.substr(o+1));for(var s,a={},u=/([^&=]+)=([^&]*)/g,c=0;s=u.exec(t);)if(a[decodeURIComponent(s[1])]=decodeURIComponent(s[2]),c++>50)return i.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var h in a)return a;return{}},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataService=void 0;var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw n.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=e,this._jsonService=new r(["application/jwk-set+json"])}return t.prototype.getMetadata=function(){var t=this;return this._settings.metadata?(n.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(n.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(e){return n.Log.debug("MetadataService.getMetadata: json received"),t._settings.metadata=e,e}))):(n.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function(){return this._getMetadataProperty("token_endpoint",!0)},t.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype._getMetadataProperty=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.Log.debug("MetadataService.getMetadataProperty for: "+t),this.getMetadata().then((function(r){if(n.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===r[t]){if(!0===e)return void n.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+t);throw n.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+t),new Error("Metadata does not contain property "+t)}return r[t]}))},t.prototype.getSigningKeys=function(){var t=this;return this._settings.signingKeys?(n.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(e){return n.Log.debug("MetadataService.getSigningKeys: jwks_uri received",e),t._jsonService.getJson(e).then((function(e){if(n.Log.debug("MetadataService.getSigningKeys: key set received",e),!e.keys)throw n.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return t._settings.signingKeys=e.keys,t._settings.signingKeys}))}))},i(t,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(".well-known/openid-configuration")<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=".well-known/openid-configuration"))),this._metadataUrl}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=e.id,i=e.data,n=e.created;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._id=r||(0,o.default)(),this._data=i,this._created="number"==typeof n&&n>0?n:parseInt(Date.now()/1e3)}return t.prototype.toStorageString=function(){return n.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created})},t.fromStorageString=function(e){return n.Log.debug("State.fromStorageString"),new t(JSON.parse(e))},t.clearStaleState=function(e,r){var i=Date.now()/1e3-r;return e.getAllKeys().then((function(r){n.Log.debug("State.clearStaleState: got keys",r);for(var o=[],s=function(s){var a=r[s];u=e.get(a).then((function(r){var o=!1;if(r)try{var s=t.fromStorageString(r);n.Log.debug("State.clearStaleState: got item from key: ",a,s.created),s.created<=i&&(o=!0)}catch(t){n.Log.error("State.clearStaleState: Error parsing state for key",a,t.message),o=!0}else n.Log.debug("State.clearStaleState: no item in storage for key: ",a),o=!0;if(o)return n.Log.debug("State.clearStaleState: removed item for key: ",a),e.remove(a)})),o.push(u)},a=0;a0&&void 0!==arguments[0]?arguments[0]:{},r=e.prefix,i=void 0===r?"oidc.":r,o=e.store,s=void 0===o?n.Global.localStorage:o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._store=s,this._prefix=i}return t.prototype.set=function(t,e){return i.Log.debug("WebStorageStateStore.set",t),t=this._prefix+t,this._store.setItem(t,e),Promise.resolve()},t.prototype.get=function(t){i.Log.debug("WebStorageStateStore.get",t),t=this._prefix+t;var e=this._store.getItem(t);return Promise.resolve(e)},t.prototype.remove=function(t){i.Log.debug("WebStorageStateStore.remove",t),t=this._prefix+t;var e=this._store.getItem(t);return this._store.removeItem(t),Promise.resolve(e)},t.prototype.getAllKeys=function(){i.Log.debug("WebStorageStateStore.getAllKeys");for(var t=[],e=0;e0&&void 0!==arguments[0]?arguments[0]:{},r=e.authority,n=e.metadataUrl,o=e.metadata,c=e.signingKeys,h=e.client_id,f=e.client_secret,l=e.response_type,p=void 0===l?"id_token":l,g=e.scope,d=void 0===g?"openid":g,v=e.redirect_uri,y=e.post_logout_redirect_uri,m=e.prompt,F=e.display,S=e.max_age,_=e.ui_locales,w=e.acr_values,b=e.resource,E=e.filterProtocolClaims,x=void 0===E||E,A=e.loadUserInfo,P=void 0===A||A,C=e.staleStateAge,k=void 0===C?900:C,R=e.clockSkew,T=void 0===R?300:R,I=e.stateStore,D=void 0===I?new s.WebStorageStateStore:I,B=e.ResponseValidatorCtor,L=void 0===B?a.ResponseValidator:B,N=e.MetadataServiceCtor,U=void 0===N?u.MetadataService:N,O=e.extraQueryParams,H=void 0===O?{}:O;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._authority=r,this._metadataUrl=n,this._metadata=o,this._signingKeys=c,this._client_id=h,this._client_secret=f,this._response_type=p,this._scope=d,this._redirect_uri=v,this._post_logout_redirect_uri=y,this._prompt=m,this._display=F,this._max_age=S,this._ui_locales=_,this._acr_values=w,this._resource=b,this._filterProtocolClaims=!!x,this._loadUserInfo=!!P,this._staleStateAge=k,this._clockSkew=T,this._stateStore=D,this._validator=new L(this),this._metadataService=new U(this),this._extraQueryParams="object"===(void 0===H?"undefined":i(H))?H:{}}return n(t,[{key:"client_id",get:function(){return this._client_id},set:function(t){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=t}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"authority",get:function(){return this._authority},set:function(t){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=t}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(".well-known/openid-configuration")<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=".well-known/openid-configuration")),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(t){this._metadata=t}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(t){this._signingKeys=t}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(t){"object"===(void 0===t?"undefined":i(t))?this._extraQueryParams=t:this._extraQueryParams={}}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupWindow=void 0;var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.MetadataService;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw i.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=e,this._XMLHttpRequestCtor=r,this._metadataService=new s(this._settings)}return t.prototype.revoke=function(t,e){var r=this;if(!t)throw i.Log.error("TokenRevocationClient.revoke: No accessToken provided"),new Error("No accessToken provided.");return this._metadataService.getRevocationEndpoint().then((function(n){if(n){i.Log.error("TokenRevocationClient.revoke: Revoking access token");var o=r._settings.client_id,s=r._settings.client_secret;return r._revoke(n,o,s,t)}if(e)throw i.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function(t,e,r,n){var o=this;return new Promise((function(s,a){var u=new o._XMLHttpRequestCtor;u.open("POST",t),u.onload=function(){i.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",u.status),200===u.status?s():a(Error(u.statusText+" ("+u.status+")"))};var c="client_id="+encodeURIComponent(e);r&&(c+="&client_secret="+encodeURIComponent(r)),c+="&token_type_hint="+encodeURIComponent("access_token"),c+="&token="+encodeURIComponent(n),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),u.send(c)}))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CheckSessionIFrame=void 0;var i=r(0);e.CheckSessionIFrame=function(){function t(e,r,i,n){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._callback=e,this._client_id=r,this._url=i,this._interval=n||2e3,this._stopOnError=o;var s=i.indexOf("/",i.indexOf("//")+2);this._frame_origin=i.substr(0,s),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.style.width=0,this._frame.style.height=0,this._frame.src=i}return t.prototype.load=function(){var t=this;return new Promise((function(e){t._frame.onload=function(){e()},window.document.body.appendChild(t._frame),t._boundMessageEvent=t._message.bind(t),window.addEventListener("message",t._boundMessageEvent,!1)}))},t.prototype._message=function(t){t.origin===this._frame_origin&&t.source===this._frame.contentWindow&&("error"===t.data?(i.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===t.data?(i.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):i.Log.debug("CheckSessionIFrame: "+t.data+" message from check session op iframe"))},t.prototype.start=function(t){var e=this;if(this._session_state!==t){i.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=t;var r=function(){e._frame.contentWindow.postMessage(e._client_id+" "+e._session_state,e._frame_origin)};r(),this._timer=window.setInterval(r,this._interval)}},t.prototype.stop=function(){this._session_state=null,this._timer&&(i.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SessionMonitor=void 0;var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw n.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=e,this._CheckSessionIFrameCtor=i,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),this._userManager.getUser().then((function(t){t&&r._start(t)})).catch((function(t){n.Log.error("SessionMonitor ctor: error from getUser:",t.message)}))}return t.prototype._start=function(t){var e=this,r=t.session_state;r&&(this._sub=t.profile.sub,this._sid=t.profile.sid,n.Log.debug("SessionMonitor._start: session_state:",r,", sub:",this._sub),this._checkSessionIFrame?this._checkSessionIFrame.start(r):this._metadataService.getCheckSessionIframe().then((function(t){if(t){n.Log.debug("SessionMonitor._start: Initializing check session iframe");var i=e._client_id,o=e._checkSessionInterval,s=e._stopCheckSessionOnError;e._checkSessionIFrame=new e._CheckSessionIFrameCtor(e._callback.bind(e),i,t,o,s),e._checkSessionIFrame.load().then((function(){e._checkSessionIFrame.start(r)}))}else n.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){n.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function(){this._sub=null,this._sid=null,this._checkSessionIFrame&&(n.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop())},t.prototype._callback=function(){var t=this;this._userManager.querySessionStatus().then((function(e){var r=!0;e?e.sub===t._sub?(r=!1,t._checkSessionIFrame.start(e.session_state),e.sid===t._sid?n.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",e.session_state):(n.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",e.session_state),t._userManager.events._raiseUserSessionChanged())):n.Log.debug("SessionMonitor._callback: Different subject signed into OP:",e.sub):n.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),r&&(n.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),t._userManager.events._raiseUserSignedOut())})).catch((function(e){n.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",e.message),t._userManager.events._raiseUserSignedOut()}))},i(t,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;var i=r(0);e.Event=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var e=this._callbacks.findIndex((function(e){return e===t}));e>=0&&this._callbacks.splice(e,1)},t.prototype.raise=function(){i.Log.debug("Event: Raising event: "+this._name);for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:{},r=e.accessTokenExpiringNotificationTime,i=void 0===r?60:r,o=e.accessTokenExpiringTimer,s=void 0===o?new n.Timer("Access token expiring"):o,a=e.accessTokenExpiredTimer,u=void 0===a?new n.Timer("Access token expired"):a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._accessTokenExpiringNotificationTime=i,this._accessTokenExpiring=s,this._accessTokenExpired=u}return t.prototype.load=function(t){if(t.access_token&&void 0!==t.expires_in){var e=t.expires_in;if(i.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",e),e>0){var r=e-this._accessTokenExpiringNotificationTime;r<=0&&(r=1),i.Log.debug("AccessTokenEvents.load: registering expiring timer in:",r),this._accessTokenExpiring.init(r)}else i.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var n=e+1;i.Log.debug("AccessTokenEvents.load: registering expired timer in:",n),this._accessTokenExpired.init(n)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function(){i.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.User=void 0;var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},i=r.nonce,n=r.authority,o=r.client_id;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var a=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,arguments[0]));return!0===i?a._nonce=(0,s.default)():i&&(a._nonce=i),a._authority=n,a._client_id=o,a}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function(){return n.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,nonce:this.nonce,authority:this.authority,client_id:this.client_id})},e.fromStorageString=function(t){return n.Log.debug("SigninState.fromStorageString"),new e(JSON.parse(t))},i(e,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}}]),e}(o.State)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorResponse=void 0;var i=r(0);e.ErrorResponse=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.error,o=r.error_description,s=r.error_uri,a=r.state;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),!n)throw i.Log.error("No error passed to ErrorResponse"),new Error("error");var u=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,o||n));return u.name="ErrorResponse",u.error=n,u.error_description=o,u.error_uri=s,u.state=a,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JsonService=void 0;var i=r(0),n=r(1);e.JsonService=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.Global.XMLHttpRequest;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e&&Array.isArray(e)?this._contentTypes=e.slice():this._contentTypes=[],this._contentTypes.push("application/json"),this._XMLHttpRequest=r}return t.prototype.getJson=function(t,e){var r=this;if(!t)throw i.Log.error("JsonService.getJson: No url passed"),new Error("url");return i.Log.debug("JsonService.getJson, url: ",t),new Promise((function(n,o){var s=new r._XMLHttpRequest;s.open("GET",t);var a=r._contentTypes;s.onload=function(){if(i.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var e=s.getResponseHeader("Content-Type");if(e&&a.find((function(t){if(e.startsWith(t))return!0})))try{return void n(JSON.parse(s.responseText))}catch(t){return i.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}o(Error("Invalid response Content-Type: "+e+", from URL: "+t))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){i.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},e&&(i.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+e)),s.send()}))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClient=void 0;var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e instanceof o.OidcClientSettings?this._settings=e:this._settings=new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.response_type,i=e.scope,o=e.redirect_uri,s=e.data,u=e.state,c=e.prompt,h=e.display,f=e.max_age,l=e.ui_locales,p=e.id_token_hint,g=e.login_hint,d=e.acr_values,v=e.resource,y=e.request,m=e.request_uri,F=e.extraQueryParams,S=arguments[1];n.Log.debug("OidcClient.createSigninRequest");var _=this._settings.client_id;r=r||this._settings.response_type,i=i||this._settings.scope,o=o||this._settings.redirect_uri,c=c||this._settings.prompt,h=h||this._settings.display,f=f||this._settings.max_age,l=l||this._settings.ui_locales,d=d||this._settings.acr_values,v=v||this._settings.resource,F=F||this._settings.extraQueryParams;var w=this._settings.authority;return this._metadataService.getAuthorizationEndpoint().then((function(e){n.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",e);var b=new a.SigninRequest({url:e,client_id:_,redirect_uri:o,response_type:r,scope:i,data:s||u,authority:w,prompt:c,display:h,max_age:f,ui_locales:l,id_token_hint:p,login_hint:g,acr_values:d,resource:v,request:y,request_uri:m,extraQueryParams:F}),E=b.state;return(S=S||t._stateStore).set(E.id,E.toStorageString()).then((function(){return b}))}))},t.prototype.processSigninResponse=function(t,e){var r=this;n.Log.debug("OidcClient.processSigninResponse");var i=new u.SigninResponse(t);return i.state?(e=e||this._stateStore).remove(i.state).then((function(t){if(!t)throw n.Log.error("OidcClient.processSigninResponse: No matching state found in storage"),new Error("No matching state found in storage");var e=f.SigninState.fromStorageString(t);return n.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),r._validator.validateSigninResponse(e,i)})):(n.Log.error("OidcClient.processSigninResponse: No state in response"),Promise.reject(new Error("No state in response")))},t.prototype.createSignoutRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.id_token_hint,i=e.data,o=e.state,s=e.post_logout_redirect_uri,a=arguments[1];return n.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,this._metadataService.getEndSessionEndpoint().then((function(e){if(!e)throw n.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");n.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",e);var u=new c.SignoutRequest({url:e,id_token_hint:r,post_logout_redirect_uri:s,data:i||o}),h=u.state;return h&&(n.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(a=a||t._stateStore).set(h.id,h.toStorageString())),u}))},t.prototype.processSignoutResponse=function(t,e){var r=this;n.Log.debug("OidcClient.processSignoutResponse");var i=new h.SignoutResponse(t);if(!i.state)return n.Log.debug("OidcClient.processSignoutResponse: No state in response"),i.error?(n.Log.warn("OidcClient.processSignoutResponse: Response was error: ",i.error),Promise.reject(new s.ErrorResponse(i))):Promise.resolve(i);var o=i.state;return(e=e||this._stateStore).remove(o).then((function(t){if(!t)throw n.Log.error("OidcClient.processSignoutResponse: No matching state found in storage"),new Error("No matching state found in storage");var e=l.State.fromStorageString(t);return n.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),r._validator.validateSignoutResponse(e,i)}))},t.prototype.clearStaleState=function(t){return n.Log.debug("OidcClient.clearStaleState"),t=t||this._stateStore,l.State.clearStaleState(t,this.settings.staleStateAge)},i(t,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaIFrameNavigator=void 0;var i=r(7);e.CordovaIFrameNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){t.popupWindowFeatures="hidden=yes";var e=new i.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupNavigator=void 0;var i=r(7);e.CordovaPopupNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new i.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SilentRenewService=void 0;var i=r(0);e.SilentRenewService=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._userManager=e}return t.prototype.start=function(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then((function(t){})).catch((function(t){i.Log.error("SilentRenewService.start: Error from getUser:",t.message)})))},t.prototype.stop=function(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},t.prototype._tokenExpiring=function(){var t=this;this._userManager.signinSilent().then((function(t){i.Log.debug("SilentRenewService._tokenExpiring: Silent token renewal successful")}),(function(e){i.Log.error("SilentRenewService._tokenExpiring: Error from signinSilent:",e.message),t._userManager.events._raiseSilentRenewError(e)}))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Timer=void 0;var i=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,r));return s._timer=i,s._nowFunc=n||function(){return Date.now()/1e3},s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function(t){t<=0&&(t=1),t=parseInt(t);var e=this.now+t;if(this.expiration===e&&this._timerHandle)n.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),n.Log.debug("Timer.init timer "+this._name+" for duration:",t),this._expiration=e;var r=5;t1&&void 0!==arguments[1])||arguments[1];i.Log.debug("UserManagerEvents.load"),t.prototype.load.call(this,e),r&&this._userLoaded.raise(e)},e.prototype.unload=function(){i.Log.debug("UserManagerEvents.unload"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function(t){this._userLoaded.addHandler(t)},e.prototype.removeUserLoaded=function(t){this._userLoaded.removeHandler(t)},e.prototype.addUserUnloaded=function(t){this._userUnloaded.addHandler(t)},e.prototype.removeUserUnloaded=function(t){this._userUnloaded.removeHandler(t)},e.prototype.addSilentRenewError=function(t){this._silentRenewError.addHandler(t)},e.prototype.removeSilentRenewError=function(t){this._silentRenewError.removeHandler(t)},e.prototype._raiseSilentRenewError=function(t){i.Log.debug("UserManagerEvents._raiseSilentRenewError",t.message),this._silentRenewError.raise(t)},e.prototype.addUserSignedOut=function(t){this._userSignedOut.addHandler(t)},e.prototype.removeUserSignedOut=function(t){this._userSignedOut.removeHandler(t)},e.prototype._raiseUserSignedOut=function(t){i.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise(t)},e.prototype.addUserSessionChanged=function(t){this._userSessionChanged.addHandler(t)},e.prototype.removeUserSessionChanged=function(t){this._userSessionChanged.removeHandler(t)},e.prototype._raiseUserSessionChanged=function(t){i.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise(t)},e}(n.AccessTokenEvents)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IFrameWindow=void 0;var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},i=r.popup_redirect_uri,n=r.popup_post_logout_redirect_uri,h=r.popupWindowFeatures,f=r.popupWindowTarget,l=r.silent_redirect_uri,p=r.silentRequestTimeout,g=r.automaticSilentRenew,d=void 0!==g&&g,v=r.includeIdTokenInSilentRenew,y=void 0===v||v,m=r.monitorSession,F=void 0===m||m,S=r.checkSessionInterval,_=void 0===S?2e3:S,w=r.stopCheckSessionOnError,b=void 0===w||w,E=r.revokeAccessTokenOnSignout,x=void 0!==E&&E,A=r.accessTokenExpiringNotificationTime,P=void 0===A?60:A,C=r.redirectNavigator,k=void 0===C?new o.RedirectNavigator:C,R=r.popupNavigator,T=void 0===R?new s.PopupNavigator:R,I=r.iframeNavigator,D=void 0===I?new a.IFrameNavigator:I,B=r.userStore,L=void 0===B?new u.WebStorageStateStore({store:c.Global.sessionStorage}):B;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var N=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,arguments[0]));return N._popup_redirect_uri=i,N._popup_post_logout_redirect_uri=n,N._popupWindowFeatures=h,N._popupWindowTarget=f,N._silent_redirect_uri=l,N._silentRequestTimeout=p,N._automaticSilentRenew=!!d,N._includeIdTokenInSilentRenew=y,N._accessTokenExpiringNotificationTime=P,N._monitorSession=F,N._checkSessionInterval=_,N._stopCheckSessionOnError=b,N._revokeAccessTokenOnSignout=x,N._redirectNavigator=k,N._popupNavigator=T,N._iframeNavigator=D,N._userStore=L,N}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"popup_redirect_uri",get:function(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function(){return!(!this.silent_redirect_uri||!this._automaticSilentRenew)}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"revokeAccessTokenOnSignout",get:function(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function(){return this._redirectNavigator}},{key:"popupNavigator",get:function(){return this._popupNavigator}},{key:"iframeNavigator",get:function(){return this._iframeNavigator}},{key:"userStore",get:function(){return this._userStore}}]),e}(n.OidcClientSettings)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UserManager=void 0;var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.TokenRevocationClient;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,r));return l._events=new u.UserManagerEvents(r),l._silentRenewService=new i(l),l.settings.automaticSilentRenew&&(n.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),l.startSilentRenew()),l.settings.monitorSession&&(n.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),l._sessionMonitor=new o(l)),l._tokenRevocationClient=new a(l._settings),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function(){var t=this;return this._loadUser().then((function(e){return e?(n.Log.info("UserManager.getUser: user loaded"),t._events.load(e,!1),e):(n.Log.info("UserManager.getUser: user not found in storage"),null)}))},e.prototype.removeUser=function(){var t=this;return this.storeUser(null).then((function(){n.Log.info("UserManager.removeUser: user removed from storage"),t._events.unload()}))},e.prototype.signinRedirect=function(t){return this._signinStart(t,this._redirectNavigator).then((function(){n.Log.info("UserManager.signinRedirect: successful")}))},e.prototype.signinRedirectCallback=function(t){return this._signinEnd(t||this._redirectNavigator.url).then((function(t){return t&&(t.profile&&t.profile.sub?n.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",t.profile.sub):n.Log.info("UserManager.signinRedirectCallback: no sub")),t}))},e.prototype.signinPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return e?(t.redirect_uri=e,t.display="popup",this._signin(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?n.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",t.profile.sub):n.Log.info("UserManager.signinPopup: no sub")),t}))):(n.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},e.prototype.signinPopupCallback=function(t){return this._signinCallback(t,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?n.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",t.profile.sub):n.Log.info("UserManager.signinPopupCallback: no sub")),t})).catch((function(t){n.Log.error("UserManager.signinPopupCallback error: "+t&&t.message)}))},e.prototype.signinSilent=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri;return r?(e.redirect_uri=r,e.prompt="none",(e.id_token_hint||!this.settings.includeIdTokenInSilentRenew?Promise.resolve():this._loadUser().then((function(t){e.id_token_hint=t&&t.id_token}))).then((function(){return t._signin(e,t._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||t.settings.silentRequestTimeout})})).then((function(t){return t&&(t.profile&&t.profile.sub?n.Log.info("UserManager.signinSilent: successful, signed in sub: ",t.profile.sub):n.Log.info("UserManager.signinSilent: no sub")),t}))):(n.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype.signinSilentCallback=function(t){return this._signinCallback(t,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?n.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",t.profile.sub):n.Log.info("UserManager.signinSilentCallback: no sub")),t}))},e.prototype.querySessionStatus=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri;return r?(e.redirect_uri=r,e.prompt="none",e.response_type="id_token",e.scope="openid",this._signinStart(e,this._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(e){return t.processSigninResponse(e.url).then((function(t){if(n.Log.debug("UserManager.querySessionStatus: got signin response"),t.session_state&&t.profile.sub&&t.profile.sid)return n.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};n.Log.info("querySessionStatus successful, user not authenticated")}))}))):(n.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype._signin=function(t,e){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(t,e,i).then((function(t){return r._signinEnd(t.url)}))},e.prototype._signinStart=function(t,e){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.prepare(i).then((function(e){return n.Log.debug("UserManager._signinStart: got navigator window handle"),r.createSigninRequest(t).then((function(t){return n.Log.debug("UserManager._signinStart: got signin request"),i.url=t.url,i.id=t.state.id,e.navigate(i)})).catch((function(t){throw e.close&&(n.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),e.close()),t}))}))},e.prototype._signinEnd=function(t){var e=this;return this.processSigninResponse(t).then((function(t){n.Log.debug("UserManager._signinEnd: got signin response");var r=new a.User(t);return e.storeUser(r).then((function(){return n.Log.debug("UserManager._signinEnd: user stored"),e._events.load(r),r}))}))},e.prototype._signinCallback=function(t,e){return n.Log.debug("UserManager._signinCallback"),e.callback(t)},e.prototype.signoutRedirect=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e&&(t.post_logout_redirect_uri=e),this._signoutStart(t,this._redirectNavigator).then((function(){n.Log.info("UserManager.signoutRedirect: successful")}))},e.prototype.signoutRedirectCallback=function(t){return this._signoutEnd(t||this._redirectNavigator.url).then((function(t){return n.Log.info("UserManager.signoutRedirectCallback: successful"),t}))},e.prototype.signoutPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return t.post_logout_redirect_uri=e,t.display="popup",t.post_logout_redirect_uri&&(t.state=t.state||{}),this._signout(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){n.Log.info("UserManager.signinPopup: successful")}))},e.prototype.signoutPopupCallback=function(t,e){return void 0===e&&"boolean"==typeof t&&(t=null,e=!0),this._popupNavigator.callback(t,e,"?").then((function(){n.Log.info("UserManager.signoutPopupCallback: successful")}))},e.prototype._signout=function(t,e){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(t,e,i).then((function(t){return r._signoutEnd(t.url)}))},e.prototype._signoutStart=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return arguments[1].prepare(r).then((function(i){return n.Log.debug("UserManager._signoutStart: got navigator window handle"),e._loadUser().then((function(o){return n.Log.debug("UserManager._signoutStart: loaded current user from storage"),(e._settings.revokeAccessTokenOnSignout?e._revokeInternal(o):Promise.resolve()).then((function(){var s=t.id_token_hint||o&&o.id_token;return s&&(n.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),t.id_token_hint=s),e.removeUser().then((function(){return n.Log.debug("UserManager._signoutStart: user removed, creating signout request"),e.createSignoutRequest(t).then((function(t){return n.Log.debug("UserManager._signoutStart: got signout request"),r.url=t.url,t.state&&(r.id=t.state.id),i.navigate(r)}))}))}))})).catch((function(t){throw i.close&&(n.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),i.close()),t}))}))},e.prototype._signoutEnd=function(t){return this.processSignoutResponse(t).then((function(t){return n.Log.debug("UserManager._signoutEnd: got signout response"),t}))},e.prototype.revokeAccessToken=function(){var t=this;return this._loadUser().then((function(e){return t._revokeInternal(e,!0).then((function(r){if(r)return n.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),e.access_token=null,e.expires_at=null,e.token_type=null,t.storeUser(e).then((function(){n.Log.debug("UserManager.revokeAccessToken: user stored"),t._events.load(e)}))}))})).then((function(){n.Log.info("UserManager.revokeAccessToken: access token revoked successfully")}))},e.prototype._revokeInternal=function(t,e){var r=t&&t.access_token;return!r||r.indexOf(".")>=0?(n.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no user, token, or JWT format"),Promise.resolve(!1)):this._tokenRevocationClient.revoke(r,e).then((function(){return!0}))},e.prototype.startSilentRenew=function(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},e.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(n.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(t)):(n.Log.debug("UserManager._loadUser: no user storageString"),null)}))},e.prototype.storeUser=function(t){if(t){n.Log.debug("UserManager.storeUser: storing user");var e=t.toStorageString();return this._userStore.set(this._userStoreKey,e)}return n.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},i(e,[{key:"_redirectNavigator",get:function(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function(){return this.settings.iframeNavigator}},{key:"_userStore",get:function(){return this.settings.userStore}},{key:"events",get:function(){return this._events}},{key:"_userStoreKey",get:function(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryWebStorage=void 0;var i=function(){function t(t,e){for(var r=0;r0){var o=parseInt(Date.now()/1e3);this.expires_at=o+i}}return i(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SigninRequest=void 0;var i=r(0),n=r(2),o=r(15);e.SigninRequest=function(){function t(e){var r=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,h=e.authority,f=e.data,l=e.prompt,p=e.display,g=e.max_age,d=e.ui_locales,v=e.id_token_hint,y=e.login_hint,m=e.acr_values,F=e.resource,S=e.request,_=e.request_uri,w=e.extraQueryParams;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw i.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw i.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!a)throw i.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!u)throw i.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!c)throw i.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!h)throw i.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var b=t.isOidc(u);this.state=new o.SigninState({nonce:b,data:f,client_id:s,authority:h}),r=n.UrlUtility.addQueryParam(r,"client_id",s),r=n.UrlUtility.addQueryParam(r,"redirect_uri",a),r=n.UrlUtility.addQueryParam(r,"response_type",u),r=n.UrlUtility.addQueryParam(r,"scope",c),r=n.UrlUtility.addQueryParam(r,"state",this.state.id),b&&(r=n.UrlUtility.addQueryParam(r,"nonce",this.state.nonce));var E={prompt:l,display:p,max_age:g,ui_locales:d,id_token_hint:v,login_hint:y,acr_values:m,resource:F,request:S,request_uri:_};for(var x in E)E[x]&&(r=n.UrlUtility.addQueryParam(r,x,E[x]));for(var A in w)r=n.UrlUtility.addQueryParam(r,A,w[A]);this.url=r}return t.isOidc=function(t){return!!t.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function(t){return!!t.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t}()},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,i,n){var o,s,a=8*n-i-1,u=(1<>1,h=-7,f=r?n-1:0,l=r?-1:1,p=t[e+f];for(f+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=c}return(p?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,r,i,n,o){var s,a,u,c=8*o-n-1,h=(1<>1,l=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,g=i?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*u-1)*Math.pow(2,n),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,n),s=0));n>=8;t[r+p]=255&a,p+=g,a/=256,n-=8);for(s=s<0;t[r+p]=255&s,p+=g,s/=256,c-=8);t[r+p-g]|=128*d}},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){for(var e,r=u(t),i=r[0],s=r[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,i,s)),c=0,h=s>0?i-4:i,f=0;f>16&255,a[c++]=e>>8&255,a[c++]=255&e;return 2===s&&(e=n[t.charCodeAt(f)]<<2|n[t.charCodeAt(f+1)]>>4,a[c++]=255&e),1===s&&(e=n[t.charCodeAt(f)]<<10|n[t.charCodeAt(f+1)]<<4|n[t.charCodeAt(f+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e),a},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,o=[],s=0,a=r-n;sa?a:s+16383));return 1===n?(e=t[r-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"=")),o.join("")};for(var i=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)i[a]=s[a],n[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t){return i[t>>18&63]+i[t>>12&63]+i[t>>6&63]+i[63&t]}function h(t,e,r){for(var i,n=[],o=e;o=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(i)return M(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function v(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var o,s=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var h=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var f=!0,l=0;ln&&(i=n):i=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s>8,n=r%256,o.push(n),o.push(i);return o}(e,t.length-r),t,r,i)}function E(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:c>223?3:c>191?2:1;if(n+f<=r)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[n+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=f}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);for(var r="",i=0;ithis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(i,n),h=t.slice(e,r),f=0;fn)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return F(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return _(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function P(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function I(t,e,r,i,n,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function D(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function B(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function L(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(t,e,r,i,o){return o||L(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function U(t,e,r,i,o){return o||L(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||T(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){t=+t,e|=0,r|=0,i||I(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+n]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);I(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);I(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function j(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(O,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(39))},function(t,e,r){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i={userAgent:!1},n={};if(void 0===o)var o={};o.lang={extend:function(t,e,r){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),r){var o;for(o in r)t.prototype[o]=r[o];var s=function(){},a=["toString","valueOf"];try{/MSIE/.test(i.userAgent)&&(s=function(t,e){for(o=0;o>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],i=0;i>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new o.init(r,e/2)}},u=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new o.init(r,e)}},c=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},h=i.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,i=r.words,n=r.sigBytes,s=this.blockSize,a=n/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,c=t.min(4*u,n);if(u){for(var h=0;h>>2]>>>24-n%4*8&255)<<16|(e[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|e[n+2>>>2]>>>24-(n+2)%4*8&255,s=0;4>s&&n+.75*s>>6*(3-s)&63));if(e=i.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,i=this._map;(n=i.charAt(64))&&-1!=(n=t.indexOf(n))&&(r=n);for(var n=[],o=0,s=0;s>>6-s%4*2;n[o>>>2]|=(a|u)<<24-o%4*8,o++}return e.create(n,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){for(var e=s,r=(n=e.lib).WordArray,i=n.Hasher,n=e.algo,o=[],a=[],u=function(t){return 4294967296*(t-(0|t))|0},c=2,h=0;64>h;){var f;t:{f=c;for(var l=t.sqrt(f),p=2;p<=l;p++)if(!(f%p)){f=!1;break t}f=!0}f&&(8>h&&(o[h]=u(t.pow(c,.5))),a[h]=u(t.pow(c,1/3)),h++),c++}var g=[];n=n.SHA256=i.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],u=r[4],c=r[5],h=r[6],f=r[7],l=0;64>l;l++){if(16>l)g[l]=0|t[e+l];else{var p=g[l-15],d=g[l-2];g[l]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+g[l-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+g[l-16]}p=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&h)+a[l]+g[l],d=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&n^i&o^n&o),f=h,h=c,c=u,u=s+p|0,s=o,o=n,n=i,i=p+d|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+u|0,r[5]=r[5]+c|0,r[6]=r[6]+h|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=t.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA256=i._createHelper(n),e.HmacSHA256=i._createHmacHelper(n)}(Math),function(){function t(){return i.create.apply(i,arguments)}for(var e=s,r=e.lib.Hasher,i=(o=e.x64).Word,n=o.WordArray,o=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],u=[],c=0;80>c;c++)u[c]=t();o=o.SHA512=r.extend({_doReset:function(){this._hash=new n.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=(f=this._hash.words)[0],i=f[1],n=f[2],o=f[3],s=f[4],c=f[5],h=f[6],f=f[7],l=r.high,p=r.low,g=i.high,d=i.low,v=n.high,y=n.low,m=o.high,F=o.low,S=s.high,_=s.low,w=c.high,b=c.low,E=h.high,x=h.low,A=f.high,P=f.low,C=l,k=p,R=g,T=d,I=v,D=y,B=m,L=F,N=S,U=_,O=w,H=b,M=E,j=x,K=A,q=P,V=0;80>V;V++){var W=u[V];if(16>V)var J=W.high=0|t[e+2*V],Y=W.low=0|t[e+2*V+1];else{J=((Y=(J=u[V-15]).high)>>>1|(z=J.low)<<31)^(Y>>>8|z<<24)^Y>>>7;var z=(z>>>1|Y<<31)^(z>>>8|Y<<24)^(z>>>7|Y<<25),G=((Y=(G=u[V-2]).high)>>>19|(X=G.low)<<13)^(Y<<3|X>>>29)^Y>>>6,X=(X>>>19|Y<<13)^(X<<3|Y>>>29)^(X>>>6|Y<<26),Z=(Y=u[V-7]).high,Q=($=u[V-16]).high,$=$.low;J=(J=(J=J+Z+((Y=z+Y.low)>>>0>>0?1:0))+G+((Y+=X)>>>0>>0?1:0))+Q+((Y+=$)>>>0<$>>>0?1:0),W.high=J,W.low=Y}Z=N&O^~N&M,$=U&H^~U&j,W=C&R^C&I^R&I;var tt=k&T^k&D^T&D,et=(z=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),G=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),(X=a[V]).high),rt=X.low;Q=(Q=(Q=(Q=K+((N>>>14|U<<18)^(N>>>18|U<<14)^(N<<23|U>>>9))+((X=q+((U>>>14|N<<18)^(U>>>18|N<<14)^(U<<23|N>>>9)))>>>0>>0?1:0))+Z+((X+=$)>>>0<$>>>0?1:0))+et+((X+=rt)>>>0>>0?1:0))+J+((X+=Y)>>>0>>0?1:0),K=M,q=j,M=O,j=H,O=N,H=U,N=B+Q+((U=L+X|0)>>>0>>0?1:0)|0,B=I,L=D,I=R,D=T,R=C,T=k,C=Q+(W=z+W+((Y=G+tt)>>>0>>0?1:0))+((k=X+Y|0)>>>0>>0?1:0)|0}p=r.low=p+k,r.high=l+C+(p>>>0>>0?1:0),d=i.low=d+T,i.high=g+R+(d>>>0>>0?1:0),y=n.low=y+D,n.high=v+I+(y>>>0>>0?1:0),F=o.low=F+L,o.high=m+B+(F>>>0>>0?1:0),_=s.low=_+U,s.high=S+N+(_>>>0>>0?1:0),b=c.low=b+H,c.high=w+O+(b>>>0>>0?1:0),x=h.low=x+j,h.high=E+M+(x>>>0>>0?1:0),P=f.low=P+q,f.high=A+K+(P>>>0>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(i+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(o),e.HmacSHA512=r._createHmacHelper(o)}(),function(){var t=s,e=(n=t.x64).Word,r=n.WordArray,i=(n=t.algo).SHA512,n=n.SHA384=i.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=i._createHelper(n),t.HmacSHA384=i._createHmacHelper(n)}();var a,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="=";function h(t){var e,r,i="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),i+=u.charAt(r>>6)+u.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),i+=u.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),i+=u.charAt(r>>2)+u.charAt((3&r)<<4)),c)for(;(3&i.length)>0;)i+=c;return i}function f(t){var e,r,i,n="",o=0;for(e=0;e>2),r=3&i,o=1):1==o?(n+=F(r<<2|i>>4),r=15&i,o=2):2==o?(n+=F(r),n+=F(i>>2),r=3&i,o=3):(n+=F(r<<2|i>>4),n+=F(15&i),o=0));return 1==o&&(n+=F(r<<2)),n}function l(t){var e,r=f(t),i=new Array;for(e=0;2*e>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;n=((u=s*u+((32767&h)<<15)+r[i]+(1073741823&n))>>>30)+(h>>>15)+a*c+(n>>>30),r[i++]=1073741823&u}return n},a=30):"Netscape"!=i.appName?(p.prototype.am=function(t,e,r,i,n,o){for(;--o>=0;){var s=e*this[t++]+r[i]+n;n=Math.floor(s/67108864),r[i++]=67108863&s}return n},a=26):(p.prototype.am=function(t,e,r,i,n,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;n=((u=s*u+((16383&h)<<14)+r[i]+n)>>28)+(h>>14)+a*c,r[i++]=268435455&u}return n},a=28),p.prototype.DB=a,p.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function b(t){this.m=t}function E(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function R(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function T(){}function I(t){return t}function D(t){this.r2=g(),this.q3=g(),p.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}b.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},b.prototype.revert=function(t){return t},b.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},b.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},b.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},E.prototype.convert=function(t){var e=g();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(p.ZERO)>0&&this.m.subTo(e,e),e},E.prototype.revert=function(t){var e=g();return t.copyTo(e),this.reduce(e),e},E.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},E.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},E.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},p.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},p.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},p.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=8==r?255&t[i]:S(t,i);s<0?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},p.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},p.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e[r+s+1]=this[r]>>n|a,a=(this[r]&o)<=0;--r)e[r]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},p.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<>i;for(var s=r+1;s>i;i>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()},p.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},p.prototype.divRemTo=function(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var f=h*(1<1?o[c-2]>>this.F2:0),l=this.FV/f,d=(1<=0&&(r[r.t++]=1,r.subTo(F,r)),p.ONE.dlShiftTo(c,F),F.subTo(o,o);o.t=0;){var S=r[--y]==h?this.DM:Math.floor(r[y]*l+(r[y-1]+v)*d);if((r[y]+=o.am(0,S,r,m,0,c))0&&r.rShiftTo(u,r),s<0&&p.ZERO.subTo(r,r)}}},p.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},p.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},p.prototype.exp=function(t,e){if(t>4294967295||t<1)return p.ONE;var r=g(),i=g(),n=e.convert(this),o=w(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var s=r;r=i,i=s}return e.revert(r)},p.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<0)for(a>a)>0&&(n=!0,o=F(r));s>=0;)a>(a+=this.DB-e)):(r=this[s]>>(a-=e)&i,a<=0&&(a+=this.DB,--s)),r>0&&(n=!0),n&&(o+=F(r));return n?o:"0"},p.prototype.negate=function(){var t=g();return p.ZERO.subTo(this,t),t},p.prototype.abs=function(){return this.s<0?this.negate():this},p.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},p.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+w(this[this.t-1]^this.s&this.DM)},p.prototype.mod=function(t){var e=g();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(p.ZERO)>0&&t.subTo(e,e),e},p.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new b(e):new E(e),this.exp(t,r)},p.ZERO=_(0),p.ONE=_(1),T.prototype.convert=I,T.prototype.revert=I,T.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},T.prototype.sqrTo=function(t,e){t.squareTo(e)},D.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=g();return t.copyTo(e),this.reduce(e),e},D.prototype.revert=function(t){return t},D.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},D.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},D.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],L=(1<<26)/B[B.length-1];function N(){this.i=0,this.j=0,this.S=new Array}p.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},p.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=_(r),n=g(),o=g(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(t)+s},p.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,a=0;a=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&p.ZERO.subTo(this,this)},p.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(p.ONE.shiftLeft(t-1),A,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(p.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=1+(t>>3),e.nextBytes(i),n>0?i[0]&=(1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()},p.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},p.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},p.prototype.multiplyLowerTo=function(t,e,r){var i,n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(i=r.t-this.t;n=0;)r[i]=0;for(i=Math.max(e-this.t,0);i0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r},p.prototype.millerRabin=function(t){var e=this.subtract(p.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);(t=t+1>>1)>B.length&&(t=B.length);for(var n=g(),o=0;o>24},p.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},p.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},p.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<=0;)i<8?(r=(this[t]&(1<>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e},p.prototype.equals=function(t){return 0==this.compareTo(t)},p.prototype.min=function(t){return this.compareTo(t)<0?this:t},p.prototype.max=function(t){return this.compareTo(t)>0?this:t},p.prototype.and=function(t){var e=g();return this.bitwiseTo(t,x,e),e},p.prototype.or=function(t){var e=g();return this.bitwiseTo(t,A,e),e},p.prototype.xor=function(t){var e=g();return this.bitwiseTo(t,P,e),e},p.prototype.andNot=function(t){var e=g();return this.bitwiseTo(t,C,e),e},p.prototype.not=function(){for(var t=g(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var h=g();for(i.sqrTo(s[1],h);a<=c;)s[a]=g(),i.mulTo(h,s[a-2],s[a]),a+=2}var f,l,p=t.t-1,d=!0,v=g();for(n=w(t[p])-1;p>=0;){for(n>=u?f=t[p]>>n-u&c:(f=(t[p]&(1<0&&(f|=t[p-1]>>this.DB+n-u)),a=r;0==(1&f);)f>>=1,--a;if((n-=a)<0&&(n+=this.DB,--p),d)s[f].copyTo(o),d=!1;else{for(;a>1;)i.sqrTo(o,v),i.sqrTo(v,o),a-=2;a>0?i.sqrTo(o,v):(l=o,o=v,v=l),i.mulTo(v,s[f],o)}for(;p>=0&&0==(t[p]&1<=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(a,o)):(i.subTo(r,i),e&&s.subTo(n,s),a.subTo(o,a))}return 0!=i.compareTo(p.ONE)?p.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},p.prototype.pow=function(t){return this.exp(t,new T)},p.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},p.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=B[B.length-1]){for(e=0;e>8&255,O[H++]^=t>>16&255,O[H++]^=t>>24&255,H>=M&&(H-=M)}((new Date).getTime())}if(null==O){var K;if(O=new Array,H=0,void 0!==n&&(void 0!==n.crypto||void 0!==n.msCrypto)){var q=n.crypto||n.msCrypto;if(q.getRandomValues){var V=new Uint8Array(32);for(q.getRandomValues(V),K=0;K<32;++K)O[H++]=V[K]}else if("Netscape"==i.appName&&i.appVersion<"5"){var W=n.crypto.random(32);for(K=0;K>>8,O[H++]=255&K;H=0,j()}function J(){if(null==U){for(j(),(U=new N).init(O),H=0;H>24,(16711680&n)>>16,(65280&n)>>8,255&n]))),n+=1;return i}function X(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Z(t,e){this.x=e,this.q=t}function Q(t,e,r,i){this.curve=t,this.x=e,this.y=r,this.z=null==i?p.ONE:i,this.zinv=null}function $(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new Q(this,null,null)}Y.prototype.nextBytes=function(t){var e;for(e=0;e0&&e.length>0))throw"Invalid RSA public key";this.n=z(t,16),this.e=parseInt(e,16)}},X.prototype.encrypt=function(t){var e=function(t,e){if(e=0&&e>0;){var n=t.charCodeAt(i--);n<128?r[--e]=n:n>127&&n<2048?(r[--e]=63&n|128,r[--e]=n>>6|192):(r[--e]=63&n|128,r[--e]=n>>6&63|128,r[--e]=n>>12|224)}r[--e]=0;for(var o=new Y,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new p(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var i=r.toString(16);return 0==(1&i.length)?i:"0"+i},X.prototype.encryptOAEP=function(t,e,r){var i=function(t,e,r,i){var n=tt.crypto.MessageDigest,o=tt.crypto.Util,s=null;if(r||(r="sha1"),"string"==typeof r&&(s=n.getCanonicalAlgName(r),i=n.getHashLength(s),r=function(t){return dt(o.hashHex(vt(t),s))}),t.length+2*i+2>e)throw"Message too long for RSA";var a,u="";for(a=0;a>3,e,r);if(null==i)return null;var n=this.doPublic(i);if(null==n)return null;var o=n.toString(16);return 0==(1&o.length)?o:"0"+o},X.prototype.type="RSA",Z.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},Z.prototype.toBigInteger=function(){return this.x},Z.prototype.negate=function(){return new Z(this.q,this.x.negate().mod(this.q))},Z.prototype.add=function(t){return new Z(this.q,this.x.add(t.toBigInteger()).mod(this.q))},Z.prototype.subtract=function(t){return new Z(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},Z.prototype.multiply=function(t){return new Z(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},Z.prototype.square=function(){return new Z(this.q,this.x.square().mod(this.q))},Z.prototype.divide=function(t){return new Z(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},Q.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Q.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Q.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(p.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(p.ZERO))},Q.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(p.ZERO)&&!this.y.toBigInteger().equals(p.ZERO)},Q.prototype.negate=function(){return new Q(this.curve,this.x,this.y.negate(),this.z)},Q.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(p.ZERO.equals(r))return p.ZERO.equals(e)?this.twice():this.curve.getInfinity();var i=new p("3"),n=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),a=s.multiply(r),u=n.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),f=u.multiply(i).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),l=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Q(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(f),l)},Q.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new p("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),i=r.multiply(this.z),n=i.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);p.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(n)).shiftLeft(1).multiply(i).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(n.shiftLeft(1)).shiftLeft(2).multiply(n).subtract(s.square().multiply(s)).mod(this.curve.q),c=i.square().multiply(i).shiftLeft(3).mod(this.curve.q);return new Q(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},Q.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,i=r.multiply(new p("3")),n=this.negate(),o=this;for(e=i.bitLength()-2;e>0;--e){o=o.twice();var s=i.testBit(e);s!=r.testBit(e)&&(o=o.add(s?this:n))}return o},Q.prototype.multiplyTwo=function(t,e,r){var i;i=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var n=this.curve.getInfinity(),o=this.add(e);i>=0;)n=n.twice(),t.testBit(i)?n=r.testBit(i)?n.add(o):n.add(this):r.testBit(i)&&(n=n.add(e)),--i;return n},$.prototype.getQ=function(){return this.q},$.prototype.getA=function(){return this.a},$.prototype.getB=function(){return this.b},$.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},$.prototype.getInfinity=function(){return this.infinity},$.prototype.fromBigInteger=function(t){return new Z(this.q,t)},$.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:default:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),i=t.substr(e+2,e);return new Q(this,this.fromBigInteger(new p(r,16)),this.fromBigInteger(new p(i,16)))}};var tt,et,rt,it=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),i={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(t,e,r){return e?i[e]:String.fromCharCode(parseInt(r,16))}var o=new String(""),s=Object.hasOwnProperty;return function(i,a){var u,c,h=i.match(t),f=h[0],l=!1;"{"===f?u={}:"["===f?u=[]:(u=[],l=!0);for(var p=[u],g=1-l,d=h.length;g=0;)delete n[o[h]]}return a.call(e,i,n)}({"":u},"")),u}}(),nt=new function(){};function ot(t){for(var e=new Array,r=0;rn.length&&(n=i[r]);return(t=t.replace(n,"::")).slice(1,-1)}function Ct(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Pt(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function kt(t){for(var e=encodeURIComponent(t),r="",i=0;i"7"?"00"+t:t}nt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0=2*o)break;if(a>=200)break;i.push(u),s=u,a++}return i},nt.getNthChildIdx=function(t,e,r){return nt.getChildIdx(t,e)[r]},nt.getIdxbyList=function(t,e,r,i){var n,o,s=nt;if(0==r.length){if(void 0!==i&&t.substr(e,2)!==i)throw"checking tag doesn't match: "+t.substr(e,2)+"!="+i;return e}return n=r.shift(),o=s.getChildIdx(t,e),s.getIdxbyList(t,o[n],r,i)},nt.getTLVbyList=function(t,e,r,i){var n=nt,o=n.getIdxbyList(t,e,r);if(void 0===o)throw"can't find nthList object";if(void 0!==i&&t.substr(o,2)!=i)throw"checking tag doesn't match: "+t.substr(o,2)+"!="+i;return n.getTLV(t,o)},nt.getVbyList=function(t,e,r,i,n){var o,s,a=nt;if(void 0===(o=a.getIdxbyList(t,e,r,i)))throw"can't find nthList object";return s=a.getV(t,o),!0===n&&(s=s.substr(2)),s},nt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],i=t.substr(0,2),n=parseInt(i,16);r[0]=new String(Math.floor(n/40)),r[1]=new String(n%40);for(var o=t.substr(2),s=[],a=0;a0&&(h=h+"."+u.join(".")),h},nt.dump=function(t,e,r,i){var n=nt,o=n.getV,s=n.dump,a=n.getChildIdx,u=t;t instanceof tt.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===i&&(i="");var h=e.ommit_long_octet;if("01"==u.substr(r,2))return"00"==(f=o(u,r))?i+"BOOLEAN FALSE\n":i+"BOOLEAN TRUE\n";if("02"==u.substr(r,2))return i+"INTEGER "+c(f=o(u,r),h)+"\n";if("03"==u.substr(r,2))return i+"BITSTRING "+c(f=o(u,r),h)+"\n";if("04"==u.substr(r,2)){var f=o(u,r);return n.isASN1HEX(f)?(w=i+"OCTETSTRING, encapsulates\n")+s(f,e,0,i+" "):i+"OCTETSTRING "+c(f,h)+"\n"}if("05"==u.substr(r,2))return i+"NULL\n";if("06"==u.substr(r,2)){var l=o(u,r),p=tt.asn1.ASN1Util.oidHexToInt(l),g=tt.asn1.x509.OID.oid2name(p),d=p.replace(/\./g," ");return""!=g?i+"ObjectIdentifier "+g+" ("+d+")\n":i+"ObjectIdentifier ("+d+")\n"}if("0c"==u.substr(r,2))return i+"UTF8String '"+gt(o(u,r))+"'\n";if("13"==u.substr(r,2))return i+"PrintableString '"+gt(o(u,r))+"'\n";if("14"==u.substr(r,2))return i+"TeletexString '"+gt(o(u,r))+"'\n";if("16"==u.substr(r,2))return i+"IA5String '"+gt(o(u,r))+"'\n";if("17"==u.substr(r,2))return i+"UTCTime "+gt(o(u,r))+"\n";if("18"==u.substr(r,2))return i+"GeneralizedTime "+gt(o(u,r))+"\n";if("30"==u.substr(r,2)){if("3000"==u.substr(r,4))return i+"SEQUENCE {}\n";w=i+"SEQUENCE\n";var v=e;if((2==(F=a(u,r)).length||3==F.length)&&"06"==u.substr(F[0],2)&&"04"==u.substr(F[F.length-1],2)){g=n.oidname(o(u,F[0]));var y=JSON.parse(JSON.stringify(e));y.x509ExtName=g,v=y}for(var m=0;mn)throw"key is too short for SigAlg: keylen="+r+","+e;for(var o="0001",s="00"+i,a="",u=n-4-s.length,c=0;c=0)return!1;if(r.compareTo(p.ONE)<0||r.compareTo(n)>=0)return!1;var s=r.modInverse(n),a=t.multiply(s).mod(n),u=e.multiply(s).mod(n);return o.multiply(a).add(i.multiply(u)).getX().toBigInteger().mod(n).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),i=e.toByteArraySigned(),n=[];return n.push(2),n.push(r.length),(n=n.concat(r)).push(2),n.push(i.length),(n=n.concat(i)).unshift(n.length),n.unshift(48),n},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:p.fromByteArrayUnsigned(r),s:p.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:p.fromByteArrayUnsigned(t.slice(1,33)).mod(r),s:p.fromByteArrayUnsigned(t.slice(33,65)).mod(r),i:e}},this.readPKCS5PrvKeyHex=function(t){var e,r,i,n=nt,o=tt.crypto.ECDSA.getName,s=n.getVbyList;if(!1===n.isASN1HEX(t))throw"not ASN.1 hex string";try{e=s(t,0,[2,0],"06"),r=s(t,0,[1],"04");try{i=s(t,0,[3,0],"03").substr(2)}catch(t){}}catch(t){throw"malformed PKCS#1/5 plain ECC private key"}if(this.curveName=o(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){var e,r,i,n=nt,o=tt.crypto.ECDSA.getName,s=n.getVbyList;if(!1===n.isASN1HEX(t))throw"not ASN.1 hex string";try{s(t,0,[1,0],"06"),e=s(t,0,[1,1],"06"),r=s(t,0,[2,0,1],"04");try{i=s(t,0,[2,0,2,0],"03").substr(2)}catch(t){}}catch(t){throw"malformed PKCS#8 plain ECC private key"}if(this.curveName=o(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){var e,r,i=nt,n=tt.crypto.ECDSA.getName,o=i.getVbyList;if(!1===i.isASN1HEX(t))throw"not ASN.1 hex string";try{o(t,0,[0,0],"06"),e=o(t,0,[0,1],"06"),r=o(t,0,[1],"03").substr(2)}catch(t){throw"malformed PKCS#8 ECC public key"}if(this.curveName=n(e),null===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(t,e){5!==e&&(e=6);var r,i,n=nt,o=tt.crypto.ECDSA.getName,s=n.getVbyList;if(!1===n.isASN1HEX(t))throw"not ASN.1 hex string";try{r=s(t,0,[0,e,0,1],"06"),i=s(t,0,[0,e,1],"03").substr(2)}catch(t){throw"malformed X.509 certificate ECC public key"}if(this.curveName=o(r),null===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},tt.crypto.ECDSA.parseSigHex=function(t){var e=tt.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new p(e.r,16),s:new p(e.s,16)}},tt.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=nt,r=e.getChildIdx,i=e.getV;if("30"!=t.substr(0,2))throw"signature is not a ASN.1 sequence";var n=r(t,0);if(2!=n.length)throw"number of signature ASN.1 sequence elements seem wrong";var o=n[0],s=n[1];if("02"!=t.substr(o,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=t.substr(s,2))throw"2nd item of sequene of signature is not ASN.1 integer";return{r:i(t,o),s:i(t,s)}},tt.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=tt.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,i=e.s;if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==i.substr(0,2)&&i.length%32==2&&(i=i.substr(2)),r.length%32==30&&(r="00"+r),i.length%32==30&&(i="00"+i),r.length%32!=0)throw"unknown ECDSA sig r length error";if(i.length%32!=0)throw"unknown ECDSA sig s length error";return r+i},tt.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return tt.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},tt.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new p(t,16),i=new p(e,16);return tt.crypto.ECDSA.biRSSigToASN1Sig(r,i)},tt.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=tt.asn1,i=new r.DERInteger({bigint:t}),n=new r.DERInteger({bigint:e});return new r.DERSequence({array:[i,n]}).getEncodedHex()},tt.crypto.ECDSA.getName=function(t){return"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040022"===t?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":null},void 0!==tt&&tt||(tt={}),void 0!==tt.crypto&&tt.crypto||(tt.crypto={}),tt.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new p(t,16)}this.getByName=function(r){var i=r;if(void 0!==e[i]&&(i=e[r]),void 0!==t[i])return t[i];throw"unregistered EC curve name: "+i},this.regist=function(i,n,o,s,a,u,c,h,f,l,p,g){t[i]={};var d=r(o),v=r(s),y=r(a),m=r(u),F=r(c),S=new $(d,v,y),_=S.decodePointHex("04"+h+f);t[i].name=i,t[i].keylen=n,t[i].curve=S,t[i].G=_,t[i].n=m,t[i].h=F,t[i].oid=p,t[i].info=g;for(var w=0;w=2*u)break}var l={};return l.keyhex=c.substr(0,2*n[t].keylen),l.ivhex=c.substr(2*n[t].keylen,2*n[t].ivlen),l},u=function(t,e,r,i){var o=s.enc.Base64.parse(t),a=s.enc.Hex.stringify(o);return(0,n[e].proc)(a,r,i)};return{version:"1.0.0",parsePKCS5PEM:function(t){return o(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return a(t,e,r)},decryptKeyB64:function(t,e,r,i){return u(t,e,r,i)},getDecryptedKeyHex:function(t,e){var r=o(t),i=(r.type,r.cipher),n=r.ivsalt,s=r.data,c=a(i,e,n).keyhex;return u(s,i,c,n)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,i,o){var u="";if(void 0!==i&&null!=i||(i="AES-256-CBC"),void 0===n[i])throw"KEYUTIL unsupported algorithm: "+i;void 0!==o&&null!=o||(o=function(t){var e=s.lib.WordArray.random(t);return s.enc.Hex.stringify(e)}(n[i].ivlen).toUpperCase());var c=function(t,e,r,i){return(0,n[e].eproc)(t,r,i)}(e,i,a(i,r,o).keyhex,o);return u="-----BEGIN "+t+" PRIVATE KEY-----\r\n",u+="Proc-Type: 4,ENCRYPTED\r\n",u+="DEK-Info: "+i+","+o+"\r\n",u+="\r\n",(u+=c.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=nt,r=e.getChildIdx,i=e.getV,n={},o=r(t,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;n.ciphertext=i(t,o[1]);var s=r(t,o[0]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+s.length;if("2a864886f70d01050d"!=i(t,s[0]))throw"this only supports pkcs5PBES2";var a=r(t,s[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+a.length;var u=r(t,a[1]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length;if("2a864886f70d0307"!=i(t,u[0]))throw"this only supports TripleDES";n.encryptionSchemeAlg="TripleDES",n.encryptionSchemeIV=i(t,u[1]);var c=r(t,a[0]);if(2!=c.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length;if("2a864886f70d01050c"!=i(t,c[0]))throw"this only supports pkcs5PBKDF2";var h=r(t,c[1]);if(h.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length;n.pbkdf2Salt=i(t,h[0]);var f=i(t,h[1]);try{n.pbkdf2Iter=parseInt(f,16)}catch(t){throw"malformed format pbkdf2Iter: "+f}return n},getPBKDF2KeyHexFromParam:function(t,e){var r=s.enc.Hex.parse(t.pbkdf2Salt),i=t.pbkdf2Iter,n=s.PBKDF2(e,r,{keySize:6,iterations:i});return s.enc.Hex.stringify(n)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=_t(t,"ENCRYPTED PRIVATE KEY"),i=this.parseHexOfEncryptedPKCS8(r),n=Tt.getPBKDF2KeyHexFromParam(i,e),o={};o.ciphertext=s.enc.Hex.parse(i.ciphertext);var a=s.enc.Hex.parse(n),u=s.enc.Hex.parse(i.encryptionSchemeIV),c=s.TripleDES.decrypt(o,a,{iv:u});return s.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=nt,r=e.getChildIdx,i=e.getV,n={algparam:null};if("30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var o=r(t,0);if(3!=o.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(o[1],2))throw"malformed PKCS8 private key(code:003)";var s=r(t,o[1]);if(2!=s.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(s[0],2))throw"malformed PKCS8 private key(code:005)";if(n.algoid=i(t,s[0]),"06"==t.substr(s[1],2)&&(n.algparam=i(t,s[1])),"04"!=t.substr(o[2],2))throw"malformed PKCS8 private key(code:006)";return n.keyidx=e.getVidx(t,o[2]),n},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=_t(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new X;else if("2a8648ce380401"==r.algoid)e=new tt.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw"unsupported private key algorithm";e=new tt.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=nt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new X;else if("2a8648ce380401"===r)e=new tt.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw"unsupported PKCS#8 public key hex";e=new tt.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=nt,r=e.getChildIdx,i=e.getV,n={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var o=r(t,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(o[0],2))throw"malformed RSA key(code:003)";if(n.n=i(t,o[0]),"02"!=t.substr(o[1],2))throw"malformed RSA key(code:004)";return n.e=i(t,o[1]),n},parsePublicPKCS8Hex:function(t){var e=nt,r=e.getChildIdx,i=e.getV,n={algparam:null},o=r(t,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var s=o[0];if("30"!=t.substr(s,2))throw"malformed PKCS8 public key(code:001)";var a=r(t,s);if(2!=a.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(a[0],2))throw"malformed PKCS8 public key(code:003)";if(n.algoid=i(t,a[0]),"06"==t.substr(a[1],2)?n.algparam=i(t,a[1]):"30"==t.substr(a[1],2)&&(n.algparam={},n.algparam.p=e.getVbyList(t,a[1],[0],"02"),n.algparam.q=e.getVbyList(t,a[1],[1],"02"),n.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return n.key=i(t,o[1]).substr(2),n}}}();Tt.getKey=function(t,e,r){var i,n=(m=nt).getChildIdx,o=(m.getV,m.getVbyList),s=tt.crypto,a=s.ECDSA,u=s.DSA,c=X,h=_t,f=Tt;if(void 0!==c&&t instanceof c)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==u&&t instanceof u)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(k=new c).setPublic(t.n,t.e),k;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(k=new c).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),k;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(k=new c).setPrivate(t.n,t.e,t.d),k;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(k=new u).setPublic(t.p,t.q,t.g,t.y),k;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(k=new u).setPrivate(t.p,t.q,t.g,t.y,t.x),k;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(k=new c).setPublic(lt(t.n),lt(t.e)),k;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(k=new c).setPrivateEx(lt(t.n),lt(t.e),lt(t.d),lt(t.p),lt(t.q),lt(t.dp),lt(t.dq),lt(t.qi)),k;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(k=new c).setPrivate(lt(t.n),lt(t.e),lt(t.d)),k;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(C=new a({curve:t.crv})).ecparams.keylen/4,g="04"+("0000000000"+lt(t.x)).slice(-l)+("0000000000"+lt(t.y)).slice(-l);return C.setPublicKeyHex(g),C}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(C=new a({curve:t.crv})).ecparams.keylen/4,g="04"+("0000000000"+lt(t.x)).slice(-l)+("0000000000"+lt(t.y)).slice(-l);var d=("0000000000"+lt(t.d)).slice(-l);return C.setPublicKeyHex(g),C.setPrivateKeyHex(d),C}if("pkcs5prv"===r){var v,y=t,m=nt;if(9===(v=n(y,0)).length)(k=new c).readPKCS5PrvKeyHex(y);else if(6===v.length)(k=new u).readPKCS5PrvKeyHex(y);else{if(!(v.length>2&&"04"===y.substr(v[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(k=new a).readPKCS5PrvKeyHex(y)}return k}if("pkcs8prv"===r)return f.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return f._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Nt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Nt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var F=_t(t,"PUBLIC KEY");return f._getKeyFromPublicPKCS8Hex(F)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var S=h(t,"RSA PRIVATE KEY");return f.getKey(S,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var _=o(i=h(t,"DSA PRIVATE KEY"),0,[1],"02"),w=o(i,0,[2],"02"),b=o(i,0,[3],"02"),E=o(i,0,[4],"02"),x=o(i,0,[5],"02");return(k=new u).setPrivate(new p(_,16),new p(w,16),new p(b,16),new p(E,16),new p(x,16)),k}if(-1!=t.indexOf("-END PRIVATE KEY-"))return f.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var A=f.getDecryptedKeyHex(t,e),P=new X;return P.readPKCS5PrvKeyHex(A),P}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var C,k=o(i=f.getDecryptedKeyHex(t,e),0,[1],"04"),R=o(i,0,[2,0],"06"),T=o(i,0,[3,0],"03").substr(2);if(void 0===tt.crypto.OID.oidhex2name[R])throw"undefined OID(hex) in KJUR.crypto.OID: "+R;return(C=new a({curve:tt.crypto.OID.oidhex2name[R]})).setPublicKeyHex(T),C.setPrivateKeyHex(k),C.isPublic=!1,C}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return _=o(i=f.getDecryptedKeyHex(t,e),0,[1],"02"),w=o(i,0,[2],"02"),b=o(i,0,[3],"02"),E=o(i,0,[4],"02"),x=o(i,0,[5],"02"),(k=new u).setPrivate(new p(_,16),new p(w,16),new p(b,16),new p(E,16),new p(x,16)),k;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return f.getKeyFromEncryptedPKCS8PEM(t,e);throw"not supported argument"},Tt.generateKeypair=function(t,e){if("RSA"==t){var r=e;(s=new X).generate(r,"10001"),s.isPrivate=!0,s.isPublic=!0;var i=new X,n=s.n.toString(16),o=s.e.toString(16);return i.setPublic(n,o),i.isPrivate=!1,i.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=i,a}if("EC"==t){var s,a,u=e,c=new tt.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new tt.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(i=new tt.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),i.isPrivate=!1,i.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=i,a}throw"unknown algorithm: "+t},Tt.getPEM=function(t,e,r,i,n,o){var a=tt,u=a.asn1,c=u.DERObjectIdentifier,h=u.DERInteger,f=u.ASN1Util.newObject,l=u.x509.SubjectPublicKeyInfo,p=a.crypto,g=p.DSA,d=p.ECDSA,v=X;function y(t){return f({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return f({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function F(t){return f({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==v&&t instanceof v||void 0!==g&&t instanceof g||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return St(b=new l(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==v&&t instanceof v&&(void 0===r||null==r)&&1==t.isPrivate)return St(b=y(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var S=new c({name:t.curveName}).getEncodedHex(),_=m(t).getEncodedHex(),w="";return(w+=St(S,"EC PARAMETERS"))+St(_,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return St(b=F(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==v&&t instanceof v&&void 0!==r&&null!=r&&1==t.isPrivate){var b=y(t).getEncodedHex();return void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",b,r,i,o)}if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate)return b=m(t).getEncodedHex(),void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",b,r,i,o);if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate)return b=F(t).getEncodedHex(),void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",b,r,i,o);var E=function(t,e){var r=x(t,e);return new f({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:r.pbkdf2Salt}},{int:r.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:r.encryptionSchemeIV}}]}]}]},{octstr:{hex:r.ciphertext}}]}).getEncodedHex()},x=function(t,e){var r=s.lib.WordArray.random(8),i=s.lib.WordArray.random(8),n=s.PBKDF2(e,r,{keySize:6,iterations:100}),o=s.enc.Hex.parse(t),a=s.TripleDES.encrypt(o,n,{iv:i})+"",u={};return u.ciphertext=a,u.pbkdf2Salt=s.enc.Hex.stringify(r),u.pbkdf2Iter=100,u.encryptionSchemeAlg="DES-EDE3-CBC",u.encryptionSchemeIV=s.enc.Hex.stringify(i),u};if("PKCS8PRV"==e&&null!=v&&t instanceof v&&1==t.isPrivate){var A=y(t).getEncodedHex();return b=f({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:A}}]}).getEncodedHex(),void 0===r||null==r?St(b,"PRIVATE KEY"):St(_=E(b,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate)return A=new f({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),b=f({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:A}}]}).getEncodedHex(),void 0===r||null==r?St(b,"PRIVATE KEY"):St(_=E(b,r),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate)return A=new h({bigint:t.x}).getEncodedHex(),b=f({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:A}}]}).getEncodedHex(),void 0===r||null==r?St(b,"PRIVATE KEY"):St(_=E(b,r),"ENCRYPTED PRIVATE KEY");throw"unsupported object nor format"},Tt.getKeyFromCSRPEM=function(t){var e=_t(t,"CERTIFICATE REQUEST");return Tt.getKeyFromCSRHex(e)},Tt.getKeyFromCSRHex=function(t){var e=Tt.parseCSRHex(t);return Tt.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Tt.parseCSRHex=function(t){var e=nt,r=e.getChildIdx,i=e.getTLV,n={},o=t;if("30"!=o.substr(0,2))throw"malformed CSR(code:001)";var s=r(o,0);if(s.length<1)throw"malformed CSR(code:002)";if("30"!=o.substr(s[0],2))throw"malformed CSR(code:003)";var a=r(o,s[0]);if(a.length<3)throw"malformed CSR(code:004)";return n.p8pubkeyhex=i(o,a[2]),n},Tt.getJWKFromKey=function(t){var e={};if(t instanceof X&&t.isPrivate)return e.kty="RSA",e.n=ft(t.n.toString(16)),e.e=ft(t.e.toString(16)),e.d=ft(t.d.toString(16)),e.p=ft(t.p.toString(16)),e.q=ft(t.q.toString(16)),e.dp=ft(t.dmp1.toString(16)),e.dq=ft(t.dmq1.toString(16)),e.qi=ft(t.coeff.toString(16)),e;if(t instanceof X&&t.isPublic)return e.kty="RSA",e.n=ft(t.n.toString(16)),e.e=ft(t.e.toString(16)),e;if(t instanceof tt.crypto.ECDSA&&t.isPrivate){if("P-256"!==(i=t.getShortNISTPCurveName())&&"P-384"!==i)throw"unsupported curve name for JWT: "+i;var r=t.getPublicKeyXYHex();return e.kty="EC",e.crv=i,e.x=ft(r.x),e.y=ft(r.y),e.d=ft(t.prvKeyHex),e}if(t instanceof tt.crypto.ECDSA&&t.isPublic){var i;if("P-256"!==(i=t.getShortNISTPCurveName())&&"P-384"!==i)throw"unsupported curve name for JWT: "+i;return r=t.getPublicKeyXYHex(),e.kty="EC",e.crv=i,e.x=ft(r.x),e.y=ft(r.y),e}throw"not supported key object"},X.getPosArrayOfChildrenFromHex=function(t){return nt.getChildIdx(t,0)},X.getHexValueArrayOfChildrenFromHex=function(t){var e,r=nt.getV,i=r(t,(e=X.getPosArrayOfChildrenFromHex(t))[0]),n=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),f=r(t,e[8]);return(e=new Array).push(i,n,o,s,a,u,c,h,f),e},X.prototype.readPrivateKeyFromPEMString=function(t){var e=_t(t),r=X.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},X.prototype.readPKCS5PrvKeyHex=function(t){var e=X.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},X.prototype.readPKCS8PrvKeyHex=function(t){var e,r,i,n,o,s,a,u,c=nt,h=c.getVbyList;if(!1===c.isASN1HEX(t))throw"not ASN.1 hex string";try{e=h(t,0,[2,0,1],"02"),r=h(t,0,[2,0,2],"02"),i=h(t,0,[2,0,3],"02"),n=h(t,0,[2,0,4],"02"),o=h(t,0,[2,0,5],"02"),s=h(t,0,[2,0,6],"02"),a=h(t,0,[2,0,7],"02"),u=h(t,0,[2,0,8],"02")}catch(t){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(e,r,i,n,o,s,a,u)},X.prototype.readPKCS5PubKeyHex=function(t){var e=nt,r=e.getV;if(!1===e.isASN1HEX(t))throw"keyHex is not ASN.1 hex string";var i=e.getChildIdx(t,0);if(2!==i.length||"02"!==t.substr(i[0],2)||"02"!==t.substr(i[1],2))throw"wrong hex for PKCS#5 public key";var n=r(t,i[0]),o=r(t,i[1]);this.setPublic(n,o)},X.prototype.readPKCS8PubKeyHex=function(t){var e=nt;if(!1===e.isASN1HEX(t))throw"not ASN.1 hex string";if("06092a864886f70d010101"!==e.getTLVbyList(t,0,[0,0]))throw"not PKCS8 RSA public key";var r=e.getTLVbyList(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},X.prototype.readCertPubKeyHex=function(t,e){var r,i;(r=new Nt).readCertHex(t),i=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(i)};var It=new RegExp("");function Dt(t,e){for(var r="",i=e/4-t.length,n=0;n>24,(16711680&n)>>16,(65280&n)>>8,255&n])))),n+=1;return i}function Lt(t){for(var e in tt.crypto.Util.DIGESTINFOHEAD){var r=tt.crypto.Util.DIGESTINFOHEAD[e],i=r.length;if(t.substring(0,i)==r)return[e,t.substring(i)]}return[]}function Nt(){var t=nt,e=t.getChildIdx,r=t.getV,i=t.getTLV,n=t.getVbyList,o=t.getTLVbyList,s=t.getIdxbyList,a=t.getVidx,u=t.oidname,c=Nt,h=_t;this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){return null===this.hex||0!==this.version?this.version:"a003020102"!==o(this.hex,0,[0,0])?(this.version=1,this.foffset=-1,1):(this.version=3,3)},this.getSerialNumberHex=function(){return n(this.hex,0,[0,1+this.foffset],"02")},this.getSignatureAlgorithmField=function(){return u(n(this.hex,0,[0,2+this.foffset,0],"06"))},this.getIssuerHex=function(){return o(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return c.hex2dn(this.getIssuerHex())},this.getSubjectHex=function(){return o(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return c.hex2dn(this.getSubjectHex())},this.getNotBefore=function(){var t=n(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getNotAfter=function(){var t=n(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return s(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return s(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return Tt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){return u(n(this.hex,0,[1,0],"06"))},this.getSignatureValueHex=function(){return n(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmName(),r=this.getSignatureValueHex(),i=o(this.hex,0,[0],"30"),n=new tt.crypto.Signature({alg:e});return n.init(t),n.updateHex(i),n.verify(r)},this.parseExt=function(){if(3!==this.version)return-1;var r=s(this.hex,0,[0,7,0],"30"),i=e(this.hex,r);this.aExtInfo=new Array;for(var o=0;o0&&(c=new Array(r),(new Y).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=dt(u(vt("\0\0\0\0\0\0\0\0"+n+c))),f=[];for(i=0;i>8*a-s&255;for(d[0]&=~v,i=0;ithis.n.bitLength())return 0;var i=Lt(this.doPublic(r).toString(16).replace(/^1f+00/,""));if(0==i.length)return!1;var n=i[0];return i[1]==function(t){return tt.crypto.Util.hashString(t,n)}(t)},X.prototype.verifyWithMessageHash=function(t,e){var r=z(e=(e=e.replace(It,"")).replace(/[ \n]+/g,""),16);if(r.bitLength()>this.n.bitLength())return 0;var i=Lt(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=i.length&&(i[0],i[1]==t)},X.prototype.verifyPSS=function(t,e,r,i){var n=function(t){return tt.crypto.Util.hashHex(t,r)}(vt(t));return void 0===i&&(i=-1),this.verifyWithMessageHashPSS(n,e,r,i)},X.prototype.verifyWithMessageHashPSS=function(t,e,r,i){var n=new p(e,16);if(n.bitLength()>this.n.bitLength())return!1;var o,s=function(t){return tt.crypto.Util.hashHex(t,r)},a=dt(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===i||void 0===i)i=u;else if(-2===i)i=h-u-2;else if(i<-2)throw"invalid salt length";if(h>8*h-c&255;if(0!=(l.charCodeAt(0)&d))throw"bits beyond keysize not zero";var v=Bt(g,l.length,s),y=[];for(o=0;o0&&-1==(":"+i.join(":")+":").indexOf(":"+y+":"))throw"algorithm '"+y+"' not accepted in the list";if("none"!=y&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Tt.getKey(e)),!("RS"!=p&&"PS"!=p||e instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==p&&!(e instanceof c))throw"key shall be a ECDSA obj for ES* algs";var m=null;if(void 0===s.jwsalg2sigalg[v.alg])throw"unsupported alg name: "+y;if("none"==(m=s.jwsalg2sigalg[y]))throw"not supported";if("Hmac"==m.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var F=new h({alg:m,pass:e});return F.updateString(g),d==F.doFinal()}if(-1!=m.indexOf("withECDSA")){var S,_=null;try{_=c.concatSigToASN1Sig(d)}catch(t){return!1}return(S=new f({alg:m})).init(e),S.updateString(g),S.verify(_)}return(S=new f({alg:m})).init(e),S.updateString(g),S.verify(d)},tt.jws.JWS.parse=function(t){var e,r,i,n=t.split("."),o={};if(2!=n.length&&3!=n.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=n[0],r=n[1],3==n.length&&(i=n[2]),o.headerObj=tt.jws.JWS.readSafeJSONString(rt(e)),o.payloadObj=tt.jws.JWS.readSafeJSONString(rt(r)),o.headerPP=JSON.stringify(o.headerObj,null," "),null==o.payloadObj?o.payloadPP=rt(r):o.payloadPP=JSON.stringify(o.payloadObj,null," "),void 0!==i&&(o.sigHex=lt(i)),o},tt.jws.JWS.verifyJWT=function(t,e,i){var n=tt.jws,o=n.JWS,s=o.readSafeJSONString,a=o.inArray,u=o.includedArray,c=t.split("."),h=c[0],f=c[1],l=(lt(c[2]),s(rt(h))),p=s(rt(f));if(void 0===l.alg)return!1;if(void 0===i.alg)throw"acceptField.alg shall be specified";if(!a(l.alg,i.alg))return!1;if(void 0!==p.iss&&"object"===r(i.iss)&&!a(p.iss,i.iss))return!1;if(void 0!==p.sub&&"object"===r(i.sub)&&!a(p.sub,i.sub))return!1;if(void 0!==p.aud&&"object"===r(i.aud))if("string"==typeof p.aud){if(!a(p.aud,i.aud))return!1}else if("object"==r(p.aud)&&!u(p.aud,i.aud))return!1;var g=n.IntDate.getNow();return void 0!==i.verifyAt&&"number"==typeof i.verifyAt&&(g=i.verifyAt),void 0!==i.gracePeriod&&"number"==typeof i.gracePeriod||(i.gracePeriod=0),!(void 0!==p.exp&&"number"==typeof p.exp&&p.exp+i.gracePeriode.length&&(r=e.length);for(var i=0;i=0))return n.Log.error("JoseUtil._validateJwt: Invalid audience in token",h.aud),Promise.reject(new Error("Invalid audience in token: "+h.aud));var f=c+u,l=c-u;if(!h.iat)return n.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(f1&&void 0!==arguments[1]?arguments[1]:i.JsonService,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.MetadataService;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new r,this._metadataService=new s(this._settings)}return t.prototype.getClaims=function(t){var e=this;return t?this._metadataService.getUserInfoEndpoint().then((function(r){return o.Log.debug("UserInfoService.getClaims: received userinfo url",r),e._jsonService.getJson(r,t).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ResponseValidator=void 0;var i=r(0),n=r(3),o=r(43),s=r(16),a=r(42),u=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];e.ResponseValidator=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.MetadataService,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:a.JoseUtil;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw i.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=e,this._metadataService=new r(this._settings),this._userInfoService=new s(this._settings),this._joseUtil=u}return t.prototype.validateSigninResponse=function(t,e){var r=this;return i.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(t,e).then((function(e){return i.Log.debug("ResponseValidator.validateSigninResponse: state processed"),r._validateTokens(t,e).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),r._processClaims(t).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function(t,e){return t.id!==e.state?(i.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(i.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),e.state=t.data,e.error?(i.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",e.error),Promise.reject(new s.ErrorResponse(e))):Promise.resolve(e))},t.prototype._processSigninParams=function(t,e){if(t.id!==e.state)return i.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!t.client_id)return i.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!t.authority)return i.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==t.authority)return i.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=t.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==t.client_id)return i.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=t.client_id;return i.Log.debug("ResponseValidator._processSigninParams: state validated"),e.state=t.data,e.error?(i.Log.warn("ResponseValidator._processSigninParams: Response was error",e.error),Promise.reject(new s.ErrorResponse(e))):t.nonce&&!e.id_token?(i.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!t.nonce&&e.id_token?(i.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):Promise.resolve(e)},t.prototype._processClaims=function(t){var e=this;if(t.isOpenIdConnect){if(i.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),t.profile=this._filterProtocolClaims(t.profile),this._settings.loadUserInfo&&t.access_token)return i.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(t.access_token).then((function(r){return i.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),r.sub!==t.profile.sub?(i.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in access_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in access_token"))):(t.profile=e._mergeClaims(t.profile,r),i.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",t.profile),t)}));i.Log.debug("ResponseValidator._processClaims: not loading user info")}else i.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(t)},t.prototype._mergeClaims=function(t,e){var r=Object.assign({},t);for(var i in e){var n=e[i];Array.isArray(n)||(n=[n]);for(var o=0;o1)return i.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));u=a[0]}if(!u)return i.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var c=t.client_id,h=r._settings.clockSkew;return i.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",h),r._joseUtil.validateJwt(e.id_token,u,s,c,h).then((function(){return i.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),n.payload.sub?(e.profile=n.payload,e):(i.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},t.prototype._filterByAlg=function(t,e){var r=null;if(e.startsWith("RS"))r="RSA";else if(e.startsWith("PS"))r="PS";else{if(!e.startsWith("ES"))return i.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",e),[];r="EC"}return i.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",r),t=t.filter((function(t){return t.kty===r})),i.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",r,t.length),t},t.prototype._validateAccessToken=function(t){if(!t.profile)return i.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!t.profile.at_hash)return i.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!t.id_token)return i.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var e=this._joseUtil.parseJwt(t.id_token);if(!e||!e.header)return i.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",e),Promise.reject(new Error("Failed to parse id_token"));var r=e.header.alg;if(!r||5!==r.length)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r),Promise.reject(new Error("Unsupported alg: "+r));var n=r.substr(2,3);if(!n)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r,n),Promise.reject(new Error("Unsupported alg: "+r));if(256!==(n=parseInt(n))&&384!==n&&512!==n)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r,n),Promise.reject(new Error("Unsupported alg: "+r));var o="sha"+n,s=this._joseUtil.hashString(t.access_token,o);if(!s)return i.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var a=s.substr(0,s.length/2),u=this._joseUtil.hexToBase64Url(a);return u!==t.profile.at_hash?(i.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",u,t.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(i.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(t))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(0),n=r(18),o=r(6),s=r(5),a=r(31),u=r(30),c=r(12),h=r(3),f=r(20),l=r(19),p=r(9),g=r(8),d=r(10),v=r(1),y=r(13);e.default={Log:i.Log,OidcClient:n.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:c.AccessTokenEvents,MetadataService:h.MetadataService,CordovaPopupNavigator:f.CordovaPopupNavigator,CordovaIFrameNavigator:l.CordovaIFrameNavigator,CheckSessionIFrame:p.CheckSessionIFrame,TokenRevocationClient:g.TokenRevocationClient,SessionMonitor:d.SessionMonitor,Global:v.Global,User:y.User},t.exports=e.default}])}));