piral-oidc 1.8.2-beta.7801 → 1.8.2-beta.7851

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-oidc",
3
- "version": "1.8.2-beta.7801",
3
+ "version": "1.8.2-beta.7851",
4
4
  "description": "Plugin to integrate authentication using OpenID connect in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -55,7 +55,7 @@
55
55
  "oidc-client": "^1.10.1"
56
56
  },
57
57
  "devDependencies": {
58
- "piral-core": "1.8.2-beta.7801"
58
+ "piral-core": "1.8.2-beta.7851"
59
59
  },
60
- "gitHead": "7d9e8de27c860c0434863552782ff8a73ef447f9"
60
+ "gitHead": "fa0dcf704b6146a1ceb6daa2787540365030e943"
61
61
  }
package/piral-oidc.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var piralOidc=(()=>{var Ar=Object.create;var Be=Object.defineProperty;var kr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Cr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var Rr=(rt,p)=>()=>(p||rt((p={exports:{}}).exports,p),p.exports),Ir=(rt,p)=>{for(var j in p)Be(rt,j,{get:p[j],enumerable:!0})},cr=(rt,p,j,T)=>{if(p&&typeof p=="object"||typeof p=="function")for(let l of Pr(p))!Tr.call(rt,l)&&l!==j&&Be(rt,l,{get:()=>p[l],enumerable:!(T=kr(p,l))||T.enumerable});return rt};var Dr=(rt,p,j)=>(j=rt!=null?Ar(Cr(rt)):{},cr(p||!rt||!rt.__esModule?Be(j,"default",{value:rt,enumerable:!0}):j,rt)),Lr=rt=>cr(Be({},"__esModule",{value:!0}),rt);var hr=Rr((Te,ze)=>{(function(p,j){if(typeof Te=="object"&&typeof ze=="object")ze.exports=j();else if(typeof define=="function"&&define.amd)define([],j);else{var T=j();for(var l in T)(typeof Te=="object"?Te:p)[l]=T[l]}})(Te,function(){return function(rt){var p={};function j(T){if(p[T])return p[T].exports;var l=p[T]={i:T,l:!1,exports:{}};return rt[T].call(l.exports,l,l.exports,j),l.l=!0,l.exports}return j.m=rt,j.c=p,j.d=function(T,l,k){j.o(T,l)||Object.defineProperty(T,l,{enumerable:!0,get:k})},j.r=function(T){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})},j.t=function(T,l){if(1&l&&(T=j(T)),8&l||4&l&&typeof T=="object"&&T&&T.__esModule)return T;var k=Object.create(null);if(j.r(k),Object.defineProperty(k,"default",{enumerable:!0,value:T}),2&l&&typeof T!="string")for(var m in T)j.d(k,m,function(a){return T[a]}.bind(null,m));return k},j.n=function(T){var l=T&&T.__esModule?function(){return T.default}:function(){return T};return j.d(l,"a",l),l},j.o=function(T,l){return Object.prototype.hasOwnProperty.call(T,l)},j.p="",j(j.s=22)}([function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l={debug:function(){},info:function(){},warn:function(){},error:function(){}},k=void 0,m=void 0;(p.Log=function(){function a(){(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,a)}return a.reset=function(){m=3,k=l},a.debug=function(){if(m>=4){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.debug.apply(k,Array.from(d))}},a.info=function(){if(m>=3){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.info.apply(k,Array.from(d))}},a.warn=function(){if(m>=2){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.warn.apply(k,Array.from(d))}},a.error=function(){if(m>=1){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.error.apply(k,Array.from(d))}},T(a,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return m},set:function(o){if(!(0<=o&&o<=4))throw new Error("Invalid log level");m=o}},{key:"logger",get:function(){return k},set:function(o){if(!o.debug&&o.info&&(o.debug=o.info),!(o.debug&&o.info&&o.warn&&o.error))throw new Error("Invalid logger");k=o}}]),a}()).reset()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l={setInterval:function(a){function u(o,d){return a.apply(this,arguments)}return u.toString=function(){return a.toString()},u}(function(a,u){return setInterval(a,u)}),clearInterval:function(a){function u(o){return a.apply(this,arguments)}return u.toString=function(){return a.toString()},u}(function(a){return clearInterval(a)})},k=!1,m=null;p.Global=function(){function a(){(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,a)}return a._testing=function(){k=!0},a.setXMLHttpRequest=function(o){m=o},T(a,null,[{key:"location",get:function(){if(!k)return location}},{key:"localStorage",get:function(){if(!k&&typeof window<"u")return localStorage}},{key:"sessionStorage",get:function(){if(!k&&typeof window<"u")return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!k&&typeof window<"u")return m||XMLHttpRequest}},{key:"timer",get:function(){if(!k)return l}}]),a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.MetadataService=void 0;var T=function(){function u(o,d){for(var P=0;P<d.length;P++){var b=d[P];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}return function(o,d,P){return d&&u(o.prototype,d),P&&u(o,P),o}}(),l=j(0),k=j(7);function m(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}var a=".well-known/openid-configuration";p.MetadataService=function(){function u(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.JsonService;if(m(this,u),!o)throw l.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=o,this._jsonService=new d(["application/jwk-set+json"])}return u.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},u.prototype.getMetadata=function(){var d=this;return this._settings.metadata?(l.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(l.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then(function(P){l.Log.debug("MetadataService.getMetadata: json received");var b=d._settings.metadataSeed||{};return d._settings.metadata=Object.assign({},b,P),d._settings.metadata})):(l.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},u.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},u.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},u.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},u.prototype.getTokenEndpoint=function(){var d=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return this._getMetadataProperty("token_endpoint",d)},u.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},u.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},u.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},u.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},u.prototype._getMetadataProperty=function(d){var P=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return l.Log.debug("MetadataService.getMetadataProperty for: "+d),this.getMetadata().then(function(b){if(l.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),b[d]===void 0){if(P===!0)return void l.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+d);throw l.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+d),new Error("Metadata does not contain property "+d)}return b[d]})},u.prototype.getSigningKeys=function(){var d=this;return this._settings.signingKeys?(l.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then(function(P){return l.Log.debug("MetadataService.getSigningKeys: jwks_uri received",P),d._jsonService.getJson(P).then(function(b){if(l.Log.debug("MetadataService.getSigningKeys: key set received",b),!b.keys)throw l.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return d._settings.signingKeys=b.keys,d._settings.signingKeys})})},T(u,[{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(a)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=a))),this._metadataUrl}}]),u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UrlUtility=void 0;var T=j(0),l=j(1);p.UrlUtility=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k)}return k.addQueryParam=function(a,u,o){return a.indexOf("?")<0&&(a+="?"),a[a.length-1]!=="?"&&(a+="&"),a+=encodeURIComponent(u),a+="=",a+=encodeURIComponent(o)},k.parseUrlFragment=function(a){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#",o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.Global;typeof a!="string"&&(a=o.location.href);var d=a.lastIndexOf(u);d>=0&&(a=a.substr(d+1)),u==="?"&&(d=a.indexOf("#"))>=0&&(a=a.substr(0,d));for(var P,b={},H=/([^&=]+)=([^&]*)/g,C=0;P=H.exec(a);)if(b[decodeURIComponent(P[1])]=decodeURIComponent(P[2].replace(/\+/g," ")),C++>50)return T.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",a),{error:"Response exceeded expected number of parameters"};for(var A in b)return b;return{}},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.JoseUtil=void 0;var T=j(26),l=function(m){return m&&m.__esModule?m:{default:m}}(j(33));p.JoseUtil=(0,l.default)({jws:T.jws,KeyUtil:T.KeyUtil,X509:T.X509,crypto:T.crypto,hextob64u:T.hextob64u,b64tohex:T.b64tohex,AllowedSigningAlgs:T.AllowedSigningAlgs})},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.OidcClientSettings=void 0;var T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},l=function(){function A(F,O){for(var Y=0;Y<O.length;Y++){var M=O[Y];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(F,M.key,M)}}return function(F,O,Y){return O&&A(F.prototype,O),Y&&A(F,Y),F}}(),k=j(0),m=j(23),a=j(6),u=j(24),o=j(2);function d(A,F){if(!(A instanceof F))throw new TypeError("Cannot call a class as a function")}var P=".well-known/openid-configuration",b="id_token",H="openid",C="client_secret_post";p.OidcClientSettings=function(){function A(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},O=F.authority,Y=F.metadataUrl,M=F.metadata,K=F.signingKeys,I=F.metadataSeed,$=F.client_id,et=F.client_secret,ot=F.response_type,B=ot===void 0?b:ot,nt=F.scope,ft=nt===void 0?H:nt,dt=F.redirect_uri,jt=F.post_logout_redirect_uri,xt=F.client_authentication,Zt=xt===void 0?C:xt,Tt=F.prompt,pt=F.display,vt=F.max_age,At=F.ui_locales,Wt=F.acr_values,Vt=F.resource,zt=F.response_mode,$t=F.filterProtocolClaims,he=$t===void 0||$t,ee=F.loadUserInfo,Ut=ee===void 0||ee,Yt=F.staleStateAge,Kt=Yt===void 0?900:Yt,U=F.clockSkew,c=U===void 0?300:U,h=F.clockService,N=h===void 0?new m.ClockService:h,q=F.userInfoJwtIssuer,J=q===void 0?"OP":q,Z=F.mergeClaims,at=Z!==void 0&&Z,lt=F.stateStore,_t=lt===void 0?new a.WebStorageStateStore:lt,yt=F.ResponseValidatorCtor,Pt=yt===void 0?u.ResponseValidator:yt,Mt=F.MetadataServiceCtor,Gt=Mt===void 0?o.MetadataService:Mt,ie=F.extraQueryParams,ht=ie===void 0?{}:ie,kt=F.extraTokenParams,mt=kt===void 0?{}:kt;d(this,A),this._authority=O,this._metadataUrl=Y,this._metadata=M,this._metadataSeed=I,this._signingKeys=K,this._client_id=$,this._client_secret=et,this._response_type=B,this._scope=ft,this._redirect_uri=dt,this._post_logout_redirect_uri=jt,this._client_authentication=Zt,this._prompt=Tt,this._display=pt,this._max_age=vt,this._ui_locales=At,this._acr_values=Wt,this._resource=Vt,this._response_mode=zt,this._filterProtocolClaims=!!he,this._loadUserInfo=!!Ut,this._staleStateAge=Kt,this._clockSkew=c,this._clockService=N,this._userInfoJwtIssuer=J,this._mergeClaims=!!at,this._stateStore=_t,this._validator=new Pt(this),this._metadataService=new Gt(this),this._extraQueryParams=(ht===void 0?"undefined":T(ht))==="object"?ht:{},this._extraTokenParams=(mt===void 0?"undefined":T(mt))==="object"?mt:{}}return A.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},l(A,[{key:"client_id",get:function(){return this._client_id},set:function(O){if(this._client_id)throw k.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=O}},{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:"client_authentication",get:function(){return this._client_authentication}},{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:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(O){if(this._authority)throw k.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=O}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(P)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=P)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(O){this._metadata=O}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(O){this._metadataSeed=O}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(O){this._signingKeys=O}},{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:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{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(O){(O===void 0?"undefined":T(O))==="object"?this._extraQueryParams=O:this._extraQueryParams={}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(O){(O===void 0?"undefined":T(O))==="object"?this._extraTokenParams=O:this._extraTokenParams={}}}]),A}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.WebStorageStateStore=void 0;var T=j(0),l=j(1);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.WebStorageStateStore=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.prefix,o=u===void 0?"oidc.":u,d=a.store,P=d===void 0?l.Global.localStorage:d;k(this,m),this._store=P,this._prefix=o}return m.prototype.set=function(u,o){return T.Log.debug("WebStorageStateStore.set",u),u=this._prefix+u,this._store.setItem(u,o),Promise.resolve()},m.prototype.get=function(u){T.Log.debug("WebStorageStateStore.get",u),u=this._prefix+u;var o=this._store.getItem(u);return Promise.resolve(o)},m.prototype.remove=function(u){T.Log.debug("WebStorageStateStore.remove",u),u=this._prefix+u;var o=this._store.getItem(u);return this._store.removeItem(u),Promise.resolve(o)},m.prototype.getAllKeys=function(){T.Log.debug("WebStorageStateStore.getAllKeys");for(var u=[],o=0;o<this._store.length;o++){var d=this._store.key(o);d.indexOf(this._prefix)===0&&u.push(d.substr(this._prefix.length))}return Promise.resolve(u)},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.JsonService=void 0;var T=j(0),l=j(1);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.JsonService=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l.Global.XMLHttpRequest,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;k(this,m),a&&Array.isArray(a)?this._contentTypes=a.slice():this._contentTypes=[],this._contentTypes.push("application/json"),o&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=u,this._jwtHandler=o}return m.prototype.getJson=function(u,o){var d=this;if(!u)throw T.Log.error("JsonService.getJson: No url passed"),new Error("url");return T.Log.debug("JsonService.getJson, url: ",u),new Promise(function(P,b){var H=new d._XMLHttpRequest;H.open("GET",u);var C=d._contentTypes,A=d._jwtHandler;H.onload=function(){if(T.Log.debug("JsonService.getJson: HTTP response received, status",H.status),H.status===200){var F=H.getResponseHeader("Content-Type");if(F){var O=C.find(function(Y){if(F.startsWith(Y))return!0});if(O=="application/jwt")return void A(H).then(P,b);if(O)try{return void P(JSON.parse(H.responseText))}catch(Y){return T.Log.error("JsonService.getJson: Error parsing JSON response",Y.message),void b(Y)}}b(Error("Invalid response Content-Type: "+F+", from URL: "+u))}else b(Error(H.statusText+" ("+H.status+")"))},H.onerror=function(){T.Log.error("JsonService.getJson: network error"),b(Error("Network Error"))},o&&(T.Log.debug("JsonService.getJson: token passed, setting Authorization header"),H.setRequestHeader("Authorization","Bearer "+o)),H.send()})},m.prototype.postForm=function(u,o,d){var P=this;if(!u)throw T.Log.error("JsonService.postForm: No url passed"),new Error("url");return T.Log.debug("JsonService.postForm, url: ",u),new Promise(function(b,H){var C=new P._XMLHttpRequest;C.open("POST",u);var A=P._contentTypes;C.onload=function(){if(T.Log.debug("JsonService.postForm: HTTP response received, status",C.status),C.status!==200){if(C.status===400&&(K=C.getResponseHeader("Content-Type"))&&A.find(function(I){if(K.startsWith(I))return!0}))try{var M=JSON.parse(C.responseText);if(M&&M.error)return T.Log.error("JsonService.postForm: Error from server: ",M.error),void H(new Error(M.error))}catch(I){return T.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void H(I)}H(Error(C.statusText+" ("+C.status+")"))}else{var K;if((K=C.getResponseHeader("Content-Type"))&&A.find(function(I){if(K.startsWith(I))return!0}))try{return void b(JSON.parse(C.responseText))}catch(I){return T.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void H(I)}H(Error("Invalid response Content-Type: "+K+", from URL: "+u))}},C.onerror=function(){T.Log.error("JsonService.postForm: network error"),H(Error("Network Error"))};var F="";for(var O in o){var Y=o[O];Y&&(F.length>0&&(F+="&"),F+=encodeURIComponent(O),F+="=",F+=encodeURIComponent(Y))}C.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d!==void 0&&C.setRequestHeader("Authorization","Basic "+btoa(d)),C.send(F)})},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SigninRequest=void 0;var T=j(0),l=j(3),k=j(13);p.SigninRequest=function(){function m(a){var u=a.url,o=a.client_id,d=a.redirect_uri,P=a.response_type,b=a.scope,H=a.authority,C=a.data,A=a.prompt,F=a.display,O=a.max_age,Y=a.ui_locales,M=a.id_token_hint,K=a.login_hint,I=a.acr_values,$=a.resource,et=a.response_mode,ot=a.request,B=a.request_uri,nt=a.extraQueryParams,ft=a.request_type,dt=a.client_secret,jt=a.extraTokenParams,xt=a.skipUserInfo;if(function(Vt,zt){if(!(Vt instanceof zt))throw new TypeError("Cannot call a class as a function")}(this,m),!u)throw T.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!o)throw T.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!d)throw T.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!P)throw T.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!b)throw T.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!H)throw T.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var Zt=m.isOidc(P),Tt=m.isCode(P);et||(et=m.isCode(P)?"query":null),this.state=new k.SigninState({nonce:Zt,data:C,client_id:o,authority:H,redirect_uri:d,code_verifier:Tt,request_type:ft,response_mode:et,client_secret:dt,scope:b,extraTokenParams:jt,skipUserInfo:xt}),u=l.UrlUtility.addQueryParam(u,"client_id",o),u=l.UrlUtility.addQueryParam(u,"redirect_uri",d),u=l.UrlUtility.addQueryParam(u,"response_type",P),u=l.UrlUtility.addQueryParam(u,"scope",b),u=l.UrlUtility.addQueryParam(u,"state",this.state.id),Zt&&(u=l.UrlUtility.addQueryParam(u,"nonce",this.state.nonce)),Tt&&(u=l.UrlUtility.addQueryParam(u,"code_challenge",this.state.code_challenge),u=l.UrlUtility.addQueryParam(u,"code_challenge_method","S256"));var pt={prompt:A,display:F,max_age:O,ui_locales:Y,id_token_hint:M,login_hint:K,acr_values:I,resource:$,request:ot,request_uri:B,response_mode:et};for(var vt in pt)pt[vt]&&(u=l.UrlUtility.addQueryParam(u,vt,pt[vt]));for(var At in nt)u=l.UrlUtility.addQueryParam(u,At,nt[At]);this.url=u}return m.isOidc=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="id_token"})[0]},m.isOAuth=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="token"})[0]},m.isCode=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="code"})[0]},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.State=void 0;var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l=j(0),k=function(u){return u&&u.__esModule?u:{default:u}}(j(14));function m(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}p.State=function(){function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=u.id,d=u.data,P=u.created,b=u.request_type;m(this,a),this._id=o||(0,k.default)(),this._data=d,this._created=typeof P=="number"&&P>0?P:parseInt(Date.now()/1e3),this._request_type=b}return a.prototype.toStorageString=function(){return l.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},a.fromStorageString=function(o){return l.Log.debug("State.fromStorageString"),new a(JSON.parse(o))},a.clearStaleState=function(o,d){var P=Date.now()/1e3-d;return o.getAllKeys().then(function(b){l.Log.debug("State.clearStaleState: got keys",b);for(var H=[],C=function(Y){var M=b[Y];F=o.get(M).then(function(K){var I=!1;if(K)try{var $=a.fromStorageString(K);l.Log.debug("State.clearStaleState: got item from key: ",M,$.created),$.created<=P&&(I=!0)}catch(et){l.Log.error("State.clearStaleState: Error parsing state for key",M,et.message),I=!0}else l.Log.debug("State.clearStaleState: no item in storage for key: ",M),I=!0;if(I)return l.Log.debug("State.clearStaleState: removed item for key: ",M),o.remove(M)}),H.push(F)},A=0;A<b.length;A++){var F;C(A)}return l.Log.debug("State.clearStaleState: waiting on promise count:",H.length),Promise.all(H)})},T(a,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.OidcClient=void 0;var T=function(){function C(A,F){for(var O=0;O<F.length;O++){var Y=F[O];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(A,Y.key,Y)}}return function(A,F,O){return F&&C(A.prototype,F),O&&C(A,O),A}}(),l=j(0),k=j(5),m=j(12),a=j(8),u=j(34),o=j(35),d=j(36),P=j(13),b=j(9);function H(C,A){if(!(C instanceof A))throw new TypeError("Cannot call a class as a function")}p.OidcClient=function(){function C(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H(this,C),A instanceof k.OidcClientSettings?this._settings=A:this._settings=new k.OidcClientSettings(A)}return C.prototype.createSigninRequest=function(){var F=this,O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=O.response_type,M=O.scope,K=O.redirect_uri,I=O.data,$=O.state,et=O.prompt,ot=O.display,B=O.max_age,nt=O.ui_locales,ft=O.id_token_hint,dt=O.login_hint,jt=O.acr_values,xt=O.resource,Zt=O.request,Tt=O.request_uri,pt=O.response_mode,vt=O.extraQueryParams,At=O.extraTokenParams,Wt=O.request_type,Vt=O.skipUserInfo,zt=arguments[1];l.Log.debug("OidcClient.createSigninRequest");var $t=this._settings.client_id;Y=Y||this._settings.response_type,M=M||this._settings.scope,K=K||this._settings.redirect_uri,et=et||this._settings.prompt,ot=ot||this._settings.display,B=B||this._settings.max_age,nt=nt||this._settings.ui_locales,jt=jt||this._settings.acr_values,xt=xt||this._settings.resource,pt=pt||this._settings.response_mode,vt=vt||this._settings.extraQueryParams,At=At||this._settings.extraTokenParams;var he=this._settings.authority;return a.SigninRequest.isCode(Y)&&Y!=="code"?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then(function(ee){l.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",ee);var Ut=new a.SigninRequest({url:ee,client_id:$t,redirect_uri:K,response_type:Y,scope:M,data:I||$,authority:he,prompt:et,display:ot,max_age:B,ui_locales:nt,id_token_hint:ft,login_hint:dt,acr_values:jt,resource:xt,request:Zt,request_uri:Tt,extraQueryParams:vt,extraTokenParams:At,request_type:Wt,response_mode:pt,client_secret:F._settings.client_secret,skipUserInfo:Vt}),Yt=Ut.state;return(zt=zt||F._stateStore).set(Yt.id,Yt.toStorageString()).then(function(){return Ut})})},C.prototype.readSigninResponseState=function(F,O){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];l.Log.debug("OidcClient.readSigninResponseState");var M=this._settings.response_mode==="query"||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),K=M?"?":"#",I=new u.SigninResponse(F,K);if(!I.state)return l.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));O=O||this._stateStore;var $=Y?O.remove.bind(O):O.get.bind(O);return $(I.state).then(function(et){if(!et)throw l.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:P.SigninState.fromStorageString(et),response:I}})},C.prototype.processSigninResponse=function(F,O){var Y=this;return l.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(F,O,!0).then(function(M){var K=M.state,I=M.response;return l.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),Y._validator.validateSigninResponse(K,I)})},C.prototype.createSignoutRequest=function(){var F=this,O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=O.id_token_hint,M=O.data,K=O.state,I=O.post_logout_redirect_uri,$=O.extraQueryParams,et=O.request_type,ot=arguments[1];return l.Log.debug("OidcClient.createSignoutRequest"),I=I||this._settings.post_logout_redirect_uri,$=$||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then(function(B){if(!B)throw l.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");l.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",B);var nt=new o.SignoutRequest({url:B,id_token_hint:Y,post_logout_redirect_uri:I,data:M||K,extraQueryParams:$,request_type:et}),ft=nt.state;return ft&&(l.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(ot=ot||F._stateStore).set(ft.id,ft.toStorageString())),nt})},C.prototype.readSignoutResponseState=function(F,O){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];l.Log.debug("OidcClient.readSignoutResponseState");var M=new d.SignoutResponse(F);if(!M.state)return l.Log.debug("OidcClient.readSignoutResponseState: No state in response"),M.error?(l.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",M.error),Promise.reject(new m.ErrorResponse(M))):Promise.resolve({state:void 0,response:M});var K=M.state;O=O||this._stateStore;var I=Y?O.remove.bind(O):O.get.bind(O);return I(K).then(function($){if(!$)throw l.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:b.State.fromStorageString($),response:M}})},C.prototype.processSignoutResponse=function(F,O){var Y=this;return l.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(F,O,!0).then(function(M){var K=M.state,I=M.response;return K?(l.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),Y._validator.validateSignoutResponse(K,I)):(l.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),I)})},C.prototype.clearStaleState=function(F){return l.Log.debug("OidcClient.clearStaleState"),F=F||this._stateStore,b.State.clearStaleState(F,this.settings.staleStateAge)},T(C,[{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}}]),C}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TokenClient=void 0;var T=j(7),l=j(2),k=j(0);function m(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}p.TokenClient=function(){function a(u){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T.JsonService,d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService;if(m(this,a),!u)throw k.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=u,this._jsonService=new o,this._metadataService=new d(this._settings)}return a.prototype.exchangeCode=function(){var o=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(d=Object.assign({},d)).grant_type=d.grant_type||"authorization_code",d.client_id=d.client_id||this._settings.client_id,d.client_secret=d.client_secret||this._settings.client_secret,d.redirect_uri=d.redirect_uri||this._settings.redirect_uri;var P=void 0,b=d._client_authentication||this._settings._client_authentication;return delete d._client_authentication,d.code?d.redirect_uri?d.code_verifier?d.client_id?d.client_secret||b!="client_secret_basic"?(b=="client_secret_basic"&&(P=d.client_id+":"+d.client_secret,delete d.client_id,delete d.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(H){return k.Log.debug("TokenClient.exchangeCode: Received token endpoint"),o._jsonService.postForm(H,d,P).then(function(C){return k.Log.debug("TokenClient.exchangeCode: response received"),C})})):(k.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(k.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(k.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(k.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(k.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},a.prototype.exchangeRefreshToken=function(){var o=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(d=Object.assign({},d)).grant_type=d.grant_type||"refresh_token",d.client_id=d.client_id||this._settings.client_id,d.client_secret=d.client_secret||this._settings.client_secret;var P=void 0,b=d._client_authentication||this._settings._client_authentication;return delete d._client_authentication,d.refresh_token?d.client_id?(b=="client_secret_basic"&&(P=d.client_id+":"+d.client_secret,delete d.client_id,delete d.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(H){return k.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),o._jsonService.postForm(H,d,P).then(function(C){return k.Log.debug("TokenClient.exchangeRefreshToken: response received"),C})})):(k.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(k.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ErrorResponse=void 0;var T=j(0);function l(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}function k(m,a){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||typeof a!="object"&&typeof a!="function"?m:a}p.ErrorResponse=function(m){function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=u.error,d=u.error_description,P=u.error_uri,b=u.state,H=u.session_state;if(l(this,a),!o)throw T.Log.error("No error passed to ErrorResponse"),new Error("error");var C=k(this,m.call(this,d||o));return C.name="ErrorResponse",C.error=o,C.error_description=d,C.error_uri=P,C.state=b,C.session_state=H,C}return function(o,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);o.prototype=Object.create(d&&d.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(o,d):o.__proto__=d)}(a,m),a}(Error)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SigninState=void 0;var T=function(){function d(P,b){for(var H=0;H<b.length;H++){var C=b[H];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(P,C.key,C)}}return function(P,b,H){return b&&d(P.prototype,b),H&&d(P,H),P}}(),l=j(0),k=j(9),m=j(4),a=function(P){return P&&P.__esModule?P:{default:P}}(j(14));function u(d,P){if(!(d instanceof P))throw new TypeError("Cannot call a class as a function")}function o(d,P){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!P||typeof P!="object"&&typeof P!="function"?d:P}p.SigninState=function(d){function P(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H=b.nonce,C=b.authority,A=b.client_id,F=b.redirect_uri,O=b.code_verifier,Y=b.response_mode,M=b.client_secret,K=b.scope,I=b.extraTokenParams,$=b.skipUserInfo;u(this,P);var et=o(this,d.call(this,arguments[0]));if(H===!0?et._nonce=(0,a.default)():H&&(et._nonce=H),O===!0?et._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():O&&(et._code_verifier=O),et.code_verifier){var ot=m.JoseUtil.hashString(et.code_verifier,"SHA256");et._code_challenge=m.JoseUtil.hexToBase64Url(ot)}return et._redirect_uri=F,et._authority=C,et._client_id=A,et._response_mode=Y,et._client_secret=M,et._scope=K,et._extraTokenParams=I,et._skipUserInfo=$,et}return function(H,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);H.prototype=Object.create(C&&C.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(H,C):H.__proto__=C)}(P,d),P.prototype.toStorageString=function(){return l.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},P.fromStorageString=function(H){return l.Log.debug("SigninState.fromStorageString"),new P(JSON.parse(H))},T(P,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),P}(k.State)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=function(){return(T!="undefined"&&T!==null&&T.getRandomValues!==void 0?l:k)().replace(/-/g,"")};var T=typeof window<"u"?window.crypto||window.msCrypto:null;function l(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,function(m){return(m^T.getRandomValues(new Uint8Array(1))[0]&15>>m/4).toString(16)})}function k(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,function(m){return(m^16*Math.random()>>m/4).toString(16)})}rt.exports=p.default},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.User=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.User=function(){function k(m){var a=m.id_token,u=m.session_state,o=m.access_token,d=m.refresh_token,P=m.token_type,b=m.scope,H=m.profile,C=m.expires_at,A=m.state;(function(O,Y){if(!(O instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,k),this.id_token=a,this.session_state=u,this.access_token=o,this.refresh_token=d,this.token_type=P,this.scope=b,this.profile=H,this.expires_at=C,this.state=A}return k.prototype.toStorageString=function(){return l.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},k.fromStorageString=function(a){return l.Log.debug("User.fromStorageString"),new k(JSON.parse(a))},T(k,[{key:"expires_in",get:function(){if(this.expires_at){var a=parseInt(Date.now()/1e3);return this.expires_at-a}},set:function(a){var u=parseInt(a);if(typeof u=="number"&&u>0){var o=parseInt(Date.now()/1e3);this.expires_at=o+u}}},{key:"expired",get:function(){var a=this.expires_in;if(a!==void 0)return a<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.AccessTokenEvents=void 0;var T=j(0),l=j(46);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.AccessTokenEvents=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.accessTokenExpiringNotificationTime,o=u===void 0?60:u,d=a.accessTokenExpiringTimer,P=d===void 0?new l.Timer("Access token expiring"):d,b=a.accessTokenExpiredTimer,H=b===void 0?new l.Timer("Access token expired"):b;k(this,m),this._accessTokenExpiringNotificationTime=o,this._accessTokenExpiring=P,this._accessTokenExpired=H}return m.prototype.load=function(u){if(u.access_token&&u.expires_in!==void 0){var o=u.expires_in;if(T.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",o),o>0){var d=o-this._accessTokenExpiringNotificationTime;d<=0&&(d=1),T.Log.debug("AccessTokenEvents.load: registering expiring timer in:",d),this._accessTokenExpiring.init(d)}else T.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var P=o+1;T.Log.debug("AccessTokenEvents.load: registering expired timer in:",P),this._accessTokenExpired.init(P)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},m.prototype.unload=function(){T.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},m.prototype.addAccessTokenExpiring=function(u){this._accessTokenExpiring.addHandler(u)},m.prototype.removeAccessTokenExpiring=function(u){this._accessTokenExpiring.removeHandler(u)},m.prototype.addAccessTokenExpired=function(u){this._accessTokenExpired.addHandler(u)},m.prototype.removeAccessTokenExpired=function(u){this._accessTokenExpired.removeHandler(u)},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Event=void 0;var T=j(0);p.Event=function(){function l(k){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,l),this._name=k,this._callbacks=[]}return l.prototype.addHandler=function(m){this._callbacks.push(m)},l.prototype.removeHandler=function(m){var a=this._callbacks.findIndex(function(u){return u===m});a>=0&&this._callbacks.splice(a,1)},l.prototype.raise=function(){T.Log.debug("Event: Raising event: "+this._name);for(var m=0;m<this._callbacks.length;m++){var a;(a=this._callbacks)[m].apply(a,arguments)}},l}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SessionMonitor=void 0;var T=function(){function u(o,d){for(var P=0;P<d.length;P++){var b=d[P];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}return function(o,d,P){return d&&u(o.prototype,d),P&&u(o,P),o}}(),l=j(0),k=j(19),m=j(1);function a(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}p.SessionMonitor=function(){function u(o){var d=this,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.CheckSessionIFrame,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.Global.timer;if(a(this,u),!o)throw l.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=o,this._CheckSessionIFrameCtor=P,this._timer=b,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then(function(H){H?d._start(H):d._settings.monitorAnonymousSession&&d._userManager.querySessionStatus().then(function(C){var A={session_state:C.session_state};C.sub&&C.sid&&(A.profile={sub:C.sub,sid:C.sid}),d._start(A)}).catch(function(C){l.Log.error("SessionMonitor ctor: error from querySessionStatus:",C.message)})}).catch(function(H){l.Log.error("SessionMonitor ctor: error from getUser:",H.message)}))}return u.prototype._start=function(d){var P=this,b=d.session_state;b&&(d.profile?(this._sub=d.profile.sub,this._sid=d.profile.sid,l.Log.debug("SessionMonitor._start: session_state:",b,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,l.Log.debug("SessionMonitor._start: session_state:",b,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(b):this._metadataService.getCheckSessionIframe().then(function(H){if(H){l.Log.debug("SessionMonitor._start: Initializing check session iframe");var C=P._client_id,A=P._checkSessionInterval,F=P._stopCheckSessionOnError;P._checkSessionIFrame=new P._CheckSessionIFrameCtor(P._callback.bind(P),C,H,A,F),P._checkSessionIFrame.load().then(function(){P._checkSessionIFrame.start(b)})}else l.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")}).catch(function(H){l.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",H.message)}))},u.prototype._stop=function(){var d=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(l.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var P=this._timer.setInterval(function(){d._timer.clearInterval(P),d._userManager.querySessionStatus().then(function(b){var H={session_state:b.session_state};b.sub&&b.sid&&(H.profile={sub:b.sub,sid:b.sid}),d._start(H)}).catch(function(b){l.Log.error("SessionMonitor: error from querySessionStatus:",b.message)})},1e3)},u.prototype._callback=function(){var d=this;this._userManager.querySessionStatus().then(function(P){var b=!0;P?P.sub===d._sub?(b=!1,d._checkSessionIFrame.start(P.session_state),P.sid===d._sid?l.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",P.session_state):(l.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",P.session_state),d._userManager.events._raiseUserSessionChanged())):l.Log.debug("SessionMonitor._callback: Different subject signed into OP:",P.sub):l.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),b&&(d._sub?(l.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),d._userManager.events._raiseUserSignedOut()):(l.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),d._userManager.events._raiseUserSignedIn()))}).catch(function(P){d._sub&&(l.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",P.message),d._userManager.events._raiseUserSignedOut())})},T(u,[{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}}]),u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CheckSessionIFrame=void 0;var T=j(0);function l(k,m){if(!(k instanceof m))throw new TypeError("Cannot call a class as a function")}p.CheckSessionIFrame=function(){function k(m,a,u,o){var d=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];l(this,k),this._callback=m,this._client_id=a,this._url=u,this._interval=o||2e3,this._stopOnError=d;var P=u.indexOf("/",u.indexOf("//")+2);this._frame_origin=u.substr(0,P),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=u}return k.prototype.load=function(){var a=this;return new Promise(function(u){a._frame.onload=function(){u()},window.document.body.appendChild(a._frame),a._boundMessageEvent=a._message.bind(a),window.addEventListener("message",a._boundMessageEvent,!1)})},k.prototype._message=function(a){a.origin===this._frame_origin&&a.source===this._frame.contentWindow&&(a.data==="error"?(T.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):a.data==="changed"?(T.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):T.Log.debug("CheckSessionIFrame: "+a.data+" message from check session op iframe"))},k.prototype.start=function(a){var u=this;if(this._session_state!==a){T.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=a;var o=function(){u._frame.contentWindow.postMessage(u._client_id+" "+u._session_state,u._frame_origin)};o(),this._timer=window.setInterval(o,this._interval)}},k.prototype.stop=function(){this._session_state=null,this._timer&&(T.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TokenRevocationClient=void 0;var T=j(0),l=j(2),k=j(1);function m(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")}var a="access_token",u="refresh_token";p.TokenRevocationClient=function(){function o(d){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.Global.XMLHttpRequest,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService;if(m(this,o),!d)throw T.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=d,this._XMLHttpRequestCtor=P,this._metadataService=new b(this._settings)}return o.prototype.revoke=function(P,b){var H=this,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"access_token";if(!P)throw T.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(C!==a&&C!=u)throw T.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then(function(A){if(A){T.Log.debug("TokenRevocationClient.revoke: Revoking "+C);var F=H._settings.client_id,O=H._settings.client_secret;return H._revoke(A,F,O,P,C)}if(b)throw T.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")})},o.prototype._revoke=function(P,b,H,C,A){var F=this;return new Promise(function(O,Y){var M=new F._XMLHttpRequestCtor;M.open("POST",P),M.onload=function(){T.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",M.status),M.status===200?O():Y(Error(M.statusText+" ("+M.status+")"))},M.onerror=function(){T.Log.debug("TokenRevocationClient.revoke: Network Error."),Y("Network Error")};var K="client_id="+encodeURIComponent(b);H&&(K+="&client_secret="+encodeURIComponent(H)),K+="&token_type_hint="+encodeURIComponent(A),K+="&token="+encodeURIComponent(C),M.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),M.send(K)})},o}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CordovaPopupWindow=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.CordovaPopupWindow=function(){function k(m){var a=this;(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,k),this._promise=new Promise(function(u,o){a._resolve=u,a._reject=o}),this.features=m.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=m.popupWindowTarget||"_blank",this.redirect_uri=m.startUrl,l.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return k.prototype._isInAppBrowserInstalled=function(a){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some(function(u){return a.hasOwnProperty(u)})},k.prototype.navigate=function(a){if(a&&a.url){if(!window.cordova)return this._error("cordova is undefined");var u=window.cordova.require("cordova/plugin_list").metadata;if(this._isInAppBrowserInstalled(u)===!1)return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(a.url,this.target,this.features),this._popup?(l.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},k.prototype._loadStartCallback=function(a){a.url.indexOf(this.redirect_uri)===0&&this._success({url:a.url})},k.prototype._exitCallback=function(a){this._error(a)},k.prototype._success=function(a){this._cleanup(),l.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(a)},k.prototype._error=function(a){this._cleanup(),l.Log.error(a),this._reject(new Error(a))},k.prototype.close=function(){this._cleanup()},k.prototype._cleanup=function(){this._popup&&(l.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},T(k,[{key:"promise",get:function(){return this._promise}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=j(0),l=j(10),k=j(5),m=j(6),a=j(37),u=j(38),o=j(16),d=j(2),P=j(48),b=j(49),H=j(19),C=j(20),A=j(18),F=j(1),O=j(15),Y=j(50);p.default={Version:Y.Version,Log:T.Log,OidcClient:l.OidcClient,OidcClientSettings:k.OidcClientSettings,WebStorageStateStore:m.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:o.AccessTokenEvents,MetadataService:d.MetadataService,CordovaPopupNavigator:P.CordovaPopupNavigator,CordovaIFrameNavigator:b.CordovaIFrameNavigator,CheckSessionIFrame:H.CheckSessionIFrame,TokenRevocationClient:C.TokenRevocationClient,SessionMonitor:A.SessionMonitor,Global:F.Global,User:O.User},rt.exports=p.default},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ClockService=function(){function T(){(function(k,m){if(!(k instanceof m))throw new TypeError("Cannot call a class as a function")})(this,T)}return T.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},T}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ResponseValidator=void 0;var T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},l=j(0),k=j(2),m=j(25),a=j(11),u=j(12),o=j(4);function d(b,H){if(!(b instanceof H))throw new TypeError("Cannot call a class as a function")}var P=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];p.ResponseValidator=function(){function b(H){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.MetadataService,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.UserInfoService,F=arguments.length>3&&arguments[3]!==void 0?arguments[3]:o.JoseUtil,O=arguments.length>4&&arguments[4]!==void 0?arguments[4]:a.TokenClient;if(d(this,b),!H)throw l.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=H,this._metadataService=new C(this._settings),this._userInfoService=new A(this._settings),this._joseUtil=F,this._tokenClient=new O(this._settings)}return b.prototype.validateSigninResponse=function(C,A){var F=this;return l.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(C,A).then(function(O){return l.Log.debug("ResponseValidator.validateSigninResponse: state processed"),F._validateTokens(C,O).then(function(Y){return l.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),F._processClaims(C,Y).then(function(M){return l.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),M})})})},b.prototype.validateSignoutResponse=function(C,A){return C.id!==A.state?(l.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(l.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),A.state=C.data,A.error?(l.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",A.error),Promise.reject(new u.ErrorResponse(A))):Promise.resolve(A))},b.prototype._processSigninParams=function(C,A){if(C.id!==A.state)return l.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!C.client_id)return l.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!C.authority)return l.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!==C.authority)return l.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=C.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==C.client_id)return l.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=C.client_id;return l.Log.debug("ResponseValidator._processSigninParams: state validated"),A.state=C.data,A.error?(l.Log.warn("ResponseValidator._processSigninParams: Response was error",A.error),Promise.reject(new u.ErrorResponse(A))):C.nonce&&!A.id_token?(l.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!C.nonce&&A.id_token?(l.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):C.code_verifier&&!A.code?(l.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!C.code_verifier&&A.code?(l.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(A.scope||(A.scope=C.scope),Promise.resolve(A))},b.prototype._processClaims=function(C,A){var F=this;if(A.isOpenIdConnect){if(l.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),A.profile=this._filterProtocolClaims(A.profile),C.skipUserInfo!==!0&&this._settings.loadUserInfo&&A.access_token)return l.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(A.access_token).then(function(O){return l.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),O.sub!==A.profile.sub?(l.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(A.profile=F._mergeClaims(A.profile,O),l.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",A.profile),A)});l.Log.debug("ResponseValidator._processClaims: not loading user info")}else l.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(A)},b.prototype._mergeClaims=function(C,A){var F=Object.assign({},C);for(var O in A){var Y=A[O];Array.isArray(Y)||(Y=[Y]);for(var M=0;M<Y.length;M++){var K=Y[M];F[O]?Array.isArray(F[O])?F[O].indexOf(K)<0&&F[O].push(K):F[O]!==K&&((K===void 0?"undefined":T(K))==="object"&&this._settings.mergeClaims?F[O]=this._mergeClaims(F[O],K):F[O]=[F[O],K]):F[O]=K}}return F},b.prototype._filterProtocolClaims=function(C){l.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",C);var A=Object.assign({},C);return this._settings._filterProtocolClaims?(P.forEach(function(F){delete A[F]}),l.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",A)):l.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),A},b.prototype._validateTokens=function(C,A){return A.code?(l.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(C,A)):A.id_token?A.access_token?(l.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(C,A)):(l.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(C,A)):(l.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(A))},b.prototype._processCode=function(C,A){var F=this,O={client_id:C.client_id,client_secret:C.client_secret,code:A.code,redirect_uri:C.redirect_uri,code_verifier:C.code_verifier};return C.extraTokenParams&&T(C.extraTokenParams)==="object"&&Object.assign(O,C.extraTokenParams),this._tokenClient.exchangeCode(O).then(function(Y){for(var M in Y)A[M]=Y[M];return A.id_token?(l.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),F._validateIdTokenAttributes(C,A)):(l.Log.debug("ResponseValidator._processCode: token response successful, returning response"),A)})},b.prototype._validateIdTokenAttributes=function(C,A){var F=this;return this._metadataService.getIssuer().then(function(O){var Y=C.client_id,M=F._settings.clockSkew;return l.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",M),F._settings.getEpochTime().then(function(K){return F._joseUtil.validateJwtAttributes(A.id_token,O,Y,M,K).then(function(I){return C.nonce&&C.nonce!==I.nonce?(l.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):I.sub?(A.profile=I,A):(l.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})})},b.prototype._validateIdTokenAndAccessToken=function(C,A){var F=this;return this._validateIdToken(C,A).then(function(O){return F._validateAccessToken(O)})},b.prototype._getSigningKeyForJwt=function(C){var A=this;return this._metadataService.getSigningKeys().then(function(F){var O=C.header.kid;if(!F)return l.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));l.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var Y=void 0;if(O)Y=F.filter(function(M){return M.kid===O})[0];else{if((F=A._filterByAlg(F,C.header.alg)).length>1)return l.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"));Y=F[0]}return Promise.resolve(Y)})},b.prototype._getSigningKeyForJwtWithSingleRetry=function(C){var A=this;return this._getSigningKeyForJwt(C).then(function(F){return F?Promise.resolve(F):(A._metadataService.resetSigningKeys(),A._getSigningKeyForJwt(C))})},b.prototype._validateIdToken=function(C,A){var F=this;if(!C.nonce)return l.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var O=this._joseUtil.parseJwt(A.id_token);return O&&O.header&&O.payload?C.nonce!==O.payload.nonce?(l.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then(function(Y){return l.Log.debug("ResponseValidator._validateIdToken: Received issuer"),F._getSigningKeyForJwtWithSingleRetry(O).then(function(M){if(!M)return l.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 K=C.client_id,I=F._settings.clockSkew;return l.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",I),F._joseUtil.validateJwt(A.id_token,M,Y,K,I).then(function(){return l.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),O.payload.sub?(A.profile=O.payload,A):(l.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})}):(l.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",O),Promise.reject(new Error("Failed to parse id_token")))},b.prototype._filterByAlg=function(C,A){var F=null;if(A.startsWith("RS"))F="RSA";else if(A.startsWith("PS"))F="PS";else{if(!A.startsWith("ES"))return l.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",A),[];F="EC"}return l.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",F),C=C.filter(function(O){return O.kty===F}),l.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",F,C.length),C},b.prototype._validateAccessToken=function(C){if(!C.profile)return l.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!C.profile.at_hash)return l.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!C.id_token)return l.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var A=this._joseUtil.parseJwt(C.id_token);if(!A||!A.header)return l.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",A),Promise.reject(new Error("Failed to parse id_token"));var F=A.header.alg;if(!F||F.length!==5)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F),Promise.reject(new Error("Unsupported alg: "+F));var O=F.substr(2,3);if(!O)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,O),Promise.reject(new Error("Unsupported alg: "+F));if((O=parseInt(O))!==256&&O!==384&&O!==512)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,O),Promise.reject(new Error("Unsupported alg: "+F));var Y="sha"+O,M=this._joseUtil.hashString(C.access_token,Y);if(!M)return l.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",Y),Promise.reject(new Error("Failed to validate at_hash"));var K=M.substr(0,M.length/2),I=this._joseUtil.hexToBase64Url(K);return I!==C.profile.at_hash?(l.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",I,C.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(l.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(C))},b}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UserInfoService=void 0;var T=j(7),l=j(2),k=j(0),m=j(4);function a(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}p.UserInfoService=function(){function u(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T.JsonService,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService,b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:m.JoseUtil;if(a(this,u),!o)throw k.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=o,this._jsonService=new d(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new P(this._settings),this._joseUtil=b}return u.prototype.getClaims=function(d){var P=this;return d?this._metadataService.getUserInfoEndpoint().then(function(b){return k.Log.debug("UserInfoService.getClaims: received userinfo url",b),P._jsonService.getJson(b,d).then(function(H){return k.Log.debug("UserInfoService.getClaims: claims received",H),H})}):(k.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},u.prototype._getClaimsFromJwt=function(d){var P=this;try{var b=this._joseUtil.parseJwt(d.responseText);if(!b||!b.header||!b.payload)return k.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",b),Promise.reject(new Error("Failed to parse id_token"));var H=b.header.kid,C=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":C=this._metadataService.getIssuer();break;case"ANY":C=Promise.resolve(b.payload.iss);break;default:C=Promise.resolve(this._settings.userInfoJwtIssuer)}return C.then(function(A){return k.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+A),P._metadataService.getSigningKeys().then(function(F){if(!F)return k.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));k.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var O=void 0;if(H)O=F.filter(function(K){return K.kid===H})[0];else{if((F=P._filterByAlg(F,b.header.alg)).length>1)return k.Log.error("UserInfoService._getClaimsFromJwt: 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"));O=F[0]}if(!O)return k.Log.error("UserInfoService._getClaimsFromJwt: 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 Y=P._settings.client_id,M=P._settings.clockSkew;return k.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",M),P._joseUtil.validateJwt(d.responseText,O,A,Y,M,void 0,!0).then(function(){return k.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),b.payload})})})}catch(A){return k.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",A.message),void reject(A)}},u.prototype._filterByAlg=function(d,P){var b=null;if(P.startsWith("RS"))b="RSA";else if(P.startsWith("PS"))b="PS";else{if(!P.startsWith("ES"))return k.Log.debug("UserInfoService._filterByAlg: alg not supported: ",P),[];b="EC"}return k.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",b),d=d.filter(function(H){return H.kty===b}),k.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",b,d.length),d},u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.AllowedSigningAlgs=p.b64tohex=p.hextob64u=p.crypto=p.X509=p.KeyUtil=p.jws=void 0;var T=j(27);p.jws=T.jws,p.KeyUtil=T.KEYUTIL,p.X509=T.X509,p.crypto=T.crypto,p.hextob64u=T.hextob64u,p.b64tohex=T.b64tohex,p.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(rt,p,j){"use strict";(function(T){Object.defineProperty(p,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k={userAgent:!1},m={};if(a===void 0)var a={};a.lang={extend:function(t,r,n){if(!r||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var i=function(){};if(i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor==Object.prototype.constructor&&(r.prototype.constructor=r),n){var s;for(s in n)t.prototype[s]=n[s];var f=function(){},S=["toString","valueOf"];try{/MSIE/.test(k.userAgent)&&(f=function(_,w){for(s=0;s<S.length;s+=1){var x=S[s],D=w[x];typeof D=="function"&&D!=Object.prototype[x]&&(_[x]=D)}})}catch{}f(t.prototype,n)}}};var u,o,d,P,b,H,C,A,F,O,Y,M=M||(u=Math,d=(o={}).lib={},P=d.Base=function(){function e(){}return{extend:function(r){e.prototype=this;var n=new e;return r&&n.mixIn(r),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);r.hasOwnProperty("toString")&&(this.toString=r.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),b=d.WordArray=P.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r??4*t.length},toString:function(t){return(t||C).stringify(this)},concat:function(t){var r=this.words,n=t.words,i=this.sigBytes,s=t.sigBytes;if(this.clamp(),i%4)for(var f=0;f<s;f++){var S=n[f>>>2]>>>24-f%4*8&255;r[i+f>>>2]|=S<<24-(i+f)%4*8}else for(f=0;f<s;f+=4)r[i+f>>>2]=n[f>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=u.ceil(r/4)},clone:function(){var t=P.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*u.random()|0);return new b.init(r,t)}}),H=o.enc={},C=H.Hex={stringify:function(t){for(var r=t.words,n=t.sigBytes,i=[],s=0;s<n;s++){var f=r[s>>>2]>>>24-s%4*8&255;i.push((f>>>4).toString(16)),i.push((15&f).toString(16))}return i.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i+=2)n[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new b.init(n,r/2)}},A=H.Latin1={stringify:function(t){for(var r=t.words,n=t.sigBytes,i=[],s=0;s<n;s++){var f=r[s>>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(f))}return i.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new b.init(n,r)}},F=H.Utf8={stringify:function(t){try{return decodeURIComponent(escape(A.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return A.parse(unescape(encodeURIComponent(t)))}},O=d.BufferedBlockAlgorithm=P.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(t){typeof t=="string"&&(t=F.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,f=i/(4*s),S=(f=t?u.ceil(f):u.max((0|f)-this._minBufferSize,0))*s,y=u.min(4*S,i);if(S){for(var _=0;_<S;_+=s)this._doProcessBlock(n,_);var w=n.splice(0,S);r.sigBytes-=y}return new b.init(w,y)},clone:function(){var t=P.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),d.Hasher=O.extend({cfg:P.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){O.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(r,n){return new t.init(n).finalize(r)}},_createHmacHelper:function(t){return function(r,n){return new Y.HMAC.init(t,n).finalize(r)}}}),Y=o.algo={},o);(function(e){var t,r=(t=M).lib,n=r.Base,i=r.WordArray;(t=t.x64={}).Word=n.extend({init:function(f,S){this.high=f,this.low=S}}),t.WordArray=n.extend({init:function(f,S){f=this.words=f||[],this.sigBytes=S??8*f.length},toX32:function(){for(var f=this.words,S=f.length,y=[],_=0;_<S;_++){var w=f[_];y.push(w.high),y.push(w.low)}return i.create(y,this.sigBytes)},clone:function(){for(var f=n.clone.call(this),S=f.words=this.words.slice(0),y=S.length,_=0;_<y;_++)S[_]=S[_].clone();return f}})})(),function(){var e=M,t=e.lib.WordArray;e.enc.Base64={stringify:function(n){var i=n.words,s=n.sigBytes,f=this._map;n.clamp(),n=[];for(var S=0;S<s;S+=3)for(var y=(i[S>>>2]>>>24-S%4*8&255)<<16|(i[S+1>>>2]>>>24-(S+1)%4*8&255)<<8|i[S+2>>>2]>>>24-(S+2)%4*8&255,_=0;4>_&&S+.75*_<s;_++)n.push(f.charAt(y>>>6*(3-_)&63));if(i=f.charAt(64))for(;n.length%4;)n.push(i);return n.join("")},parse:function(n){var i=n.length,s=this._map;(f=s.charAt(64))&&(f=n.indexOf(f))!=-1&&(i=f);for(var f=[],S=0,y=0;y<i;y++)if(y%4){var _=s.indexOf(n.charAt(y-1))<<y%4*2,w=s.indexOf(n.charAt(y))>>>6-y%4*2;f[S>>>2]|=(_|w)<<24-S%4*8,S++}return t.create(f,S)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){for(var t=M,r=(i=t.lib).WordArray,n=i.Hasher,i=t.algo,s=[],f=[],S=function(G){return 4294967296*(G-(0|G))|0},y=2,_=0;64>_;){var w;t:{w=y;for(var x=e.sqrt(w),D=2;D<=x;D++)if(!(w%D)){w=!1;break t}w=!0}w&&(8>_&&(s[_]=S(e.pow(y,.5))),f[_]=S(e.pow(y,1/3)),_++),y++}var V=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(G,X){for(var g=this._hash.words,E=g[0],R=g[1],L=g[2],z=g[3],Q=g[4],ut=g[5],tt=g[6],gt=g[7],st=0;64>st;st++){if(16>st)V[st]=0|G[X+st];else{var ct=V[st-15],St=V[st-2];V[st]=((ct<<25|ct>>>7)^(ct<<14|ct>>>18)^ct>>>3)+V[st-7]+((St<<15|St>>>17)^(St<<13|St>>>19)^St>>>10)+V[st-16]}ct=gt+((Q<<26|Q>>>6)^(Q<<21|Q>>>11)^(Q<<7|Q>>>25))+(Q&ut^~Q&tt)+f[st]+V[st],St=((E<<30|E>>>2)^(E<<19|E>>>13)^(E<<10|E>>>22))+(E&R^E&L^R&L),gt=tt,tt=ut,ut=Q,Q=z+ct|0,z=L,L=R,R=E,E=ct+St|0}g[0]=g[0]+E|0,g[1]=g[1]+R|0,g[2]=g[2]+L|0,g[3]=g[3]+z|0,g[4]=g[4]+Q|0,g[5]=g[5]+ut|0,g[6]=g[6]+tt|0,g[7]=g[7]+gt|0},_doFinalize:function(){var G=this._data,X=G.words,g=8*this._nDataBytes,E=8*G.sigBytes;return X[E>>>5]|=128<<24-E%32,X[14+(E+64>>>9<<4)]=e.floor(g/4294967296),X[15+(E+64>>>9<<4)]=g,G.sigBytes=4*X.length,this._process(),this._hash},clone:function(){var G=n.clone.call(this);return G._hash=this._hash.clone(),G}}),t.SHA256=n._createHelper(i),t.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function e(){return n.create.apply(n,arguments)}for(var t=M,r=t.lib.Hasher,n=(s=t.x64).Word,i=s.WordArray,s=t.algo,f=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],S=[],y=0;80>y;y++)S[y]=e();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(w,x){for(var D=(R=this._hash.words)[0],V=R[1],W=R[2],G=R[3],X=R[4],g=R[5],E=R[6],R=R[7],L=D.high,z=D.low,Q=V.high,ut=V.low,tt=W.high,gt=W.low,st=G.high,ct=G.low,St=X.high,Ft=X.low,wt=g.high,Qt=g.low,Ht=E.high,qt=E.low,Ct=R.high,Lt=R.low,Bt=L,Jt=z,Ee=Q,me=ut,xe=tt,_e=gt,qe=st,Ae=ct,se=St,re=Ft,Ue=wt,ke=Qt,Oe=Ht,Pe=qt,Je=Ct,Ce=Lt,ae=0;80>ae;ae++){var pe=S[ae];if(16>ae)var fe=pe.high=0|w[x+2*ae],Et=pe.low=0|w[x+2*ae+1];else{fe=((Et=(fe=S[ae-15]).high)>>>1|(ge=fe.low)<<31)^(Et>>>8|ge<<24)^Et>>>7;var ge=(ge>>>1|Et<<31)^(ge>>>8|Et<<24)^(ge>>>7|Et<<25),Se=((Et=(Se=S[ae-2]).high)>>>19|(Nt=Se.low)<<13)^(Et<<3|Nt>>>29)^Et>>>6,Nt=(Nt>>>19|Et<<13)^(Nt<<3|Et>>>29)^(Nt>>>6|Et<<26),We=(Et=S[ae-7]).high,ve=(ye=S[ae-16]).high,ye=ye.low;fe=(fe=(fe=fe+We+((Et=ge+Et.low)>>>0<ge>>>0?1:0))+Se+((Et=Et+Nt)>>>0<Nt>>>0?1:0))+ve+((Et=Et+ye)>>>0<ye>>>0?1:0),pe.high=fe,pe.low=Et}We=se&Ue^~se&Oe,ye=re&ke^~re&Pe,pe=Bt&Ee^Bt&xe^Ee&xe;var Er=Jt&me^Jt&_e^me&_e,xr=(ge=(Bt>>>28|Jt<<4)^(Bt<<30|Jt>>>2)^(Bt<<25|Jt>>>7),Se=(Jt>>>28|Bt<<4)^(Jt<<30|Bt>>>2)^(Jt<<25|Bt>>>7),(Nt=f[ae]).high),ur=Nt.low;ve=Je+((se>>>14|re<<18)^(se>>>18|re<<14)^(se<<23|re>>>9))+((Nt=Ce+((re>>>14|se<<18)^(re>>>18|se<<14)^(re<<23|se>>>9)))>>>0<Ce>>>0?1:0),Je=Oe,Ce=Pe,Oe=Ue,Pe=ke,Ue=se,ke=re,se=qe+(ve=(ve=(ve=ve+We+((Nt=Nt+ye)>>>0<ye>>>0?1:0))+xr+((Nt=Nt+ur)>>>0<ur>>>0?1:0))+fe+((Nt=Nt+Et)>>>0<Et>>>0?1:0))+((re=Ae+Nt|0)>>>0<Ae>>>0?1:0)|0,qe=xe,Ae=_e,xe=Ee,_e=me,Ee=Bt,me=Jt,Bt=ve+(pe=ge+pe+((Et=Se+Er)>>>0<Se>>>0?1:0))+((Jt=Nt+Et|0)>>>0<Nt>>>0?1:0)|0}z=D.low=z+Jt,D.high=L+Bt+(z>>>0<Jt>>>0?1:0),ut=V.low=ut+me,V.high=Q+Ee+(ut>>>0<me>>>0?1:0),gt=W.low=gt+_e,W.high=tt+xe+(gt>>>0<_e>>>0?1:0),ct=G.low=ct+Ae,G.high=st+qe+(ct>>>0<Ae>>>0?1:0),Ft=X.low=Ft+re,X.high=St+se+(Ft>>>0<re>>>0?1:0),Qt=g.low=Qt+ke,g.high=wt+Ue+(Qt>>>0<ke>>>0?1:0),qt=E.low=qt+Pe,E.high=Ht+Oe+(qt>>>0<Pe>>>0?1:0),Lt=R.low=Lt+Ce,R.high=Ct+Je+(Lt>>>0<Ce>>>0?1:0)},_doFinalize:function(){var w=this._data,x=w.words,D=8*this._nDataBytes,V=8*w.sigBytes;return x[V>>>5]|=128<<24-V%32,x[30+(V+128>>>10<<5)]=Math.floor(D/4294967296),x[31+(V+128>>>10<<5)]=D,w.sigBytes=4*x.length,this._process(),this._hash.toX32()},clone:function(){var w=r.clone.call(this);return w._hash=this._hash.clone(),w},blockSize:32}),t.SHA512=r._createHelper(s),t.HmacSHA512=r._createHmacHelper(s)}(),function(){var e=M,t=(i=e.x64).Word,r=i.WordArray,n=(i=e.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var f=n._doFinalize.call(this);return f.sigBytes-=16,f}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)}();var K,I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function $(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=I.charAt(r>>6)+I.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=I.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=I.charAt(r>>2)+I.charAt((3&r)<<4)),"=";(3&n.length)>0;)n+="=";return n}function et(e){var t,r,n,i="",s=0;for(t=0;t<e.length&&e.charAt(t)!="=";++t)(n=I.indexOf(e.charAt(t)))<0||(s==0?(i+=xt(n>>2),r=3&n,s=1):s==1?(i+=xt(r<<2|n>>4),r=15&n,s=2):s==2?(i+=xt(r),i+=xt(n>>2),r=3&n,s=3):(i+=xt(r<<2|n>>4),i+=xt(15&n),s=0));return s==1&&(i+=xt(r<<2)),i}function ot(e){var t,r=et(e),n=new Array;for(t=0;2*t<r.length;++t)n[t]=parseInt(r.substring(2*t,2*t+2),16);return n}function B(e,t,r){e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function nt(){return new B(null)}k.appName=="Microsoft Internet Explorer"?(B.prototype.am=function(t,r,n,i,s,f){for(var S=32767&r,y=r>>15;--f>=0;){var _=32767&this[t],w=this[t++]>>15,x=y*_+w*S;s=((_=S*_+((32767&x)<<15)+n[i]+(1073741823&s))>>>30)+(x>>>15)+y*w+(s>>>30),n[i++]=1073741823&_}return s},K=30):k.appName!="Netscape"?(B.prototype.am=function(t,r,n,i,s,f){for(;--f>=0;){var S=r*this[t++]+n[i]+s;s=Math.floor(S/67108864),n[i++]=67108863&S}return s},K=26):(B.prototype.am=function(t,r,n,i,s,f){for(var S=16383&r,y=r>>14;--f>=0;){var _=16383&this[t],w=this[t++]>>14,x=y*_+w*S;s=((_=S*_+((16383&x)<<14)+n[i]+s)>>28)+(x>>14)+y*w,n[i++]=268435455&_}return s},K=28),B.prototype.DB=K,B.prototype.DM=(1<<K)-1,B.prototype.DV=1<<K,B.prototype.FV=Math.pow(2,52),B.prototype.F1=52-K,B.prototype.F2=2*K-52;var ft,dt,jt=new Array;for(ft=48,dt=0;dt<=9;++dt)jt[ft++]=dt;for(ft=97,dt=10;dt<36;++dt)jt[ft++]=dt;for(ft=65,dt=10;dt<36;++dt)jt[ft++]=dt;function xt(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Zt(e,t){var r=jt[e.charCodeAt(t)];return r??-1}function Tt(e){var t=nt();return t.fromInt(e),t}function pt(e){var t,r=1;return(t=e>>>16)!=0&&(e=t,r+=16),(t=e>>8)!=0&&(e=t,r+=8),(t=e>>4)!=0&&(e=t,r+=4),(t=e>>2)!=0&&(e=t,r+=2),(t=e>>1)!=0&&(e=t,r+=1),r}function vt(e){this.m=e}function At(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Wt(e,t){return e&t}function Vt(e,t){return e|t}function zt(e,t){return e^t}function $t(e,t){return e&~t}function he(e){if(e==0)return-1;var t=0;return!(65535&e)&&(e>>=16,t+=16),!(255&e)&&(e>>=8,t+=8),!(15&e)&&(e>>=4,t+=4),!(3&e)&&(e>>=2,t+=2),!(1&e)&&++t,t}function ee(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Ut(){}function Yt(e){return e}function Kt(e){this.r2=nt(),this.q3=nt(),B.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}vt.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},vt.prototype.revert=function(t){return t},vt.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},vt.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},vt.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},At.prototype.convert=function(t){var r=nt();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(B.ZERO)>0&&this.m.subTo(r,r),r},At.prototype.revert=function(t){var r=nt();return t.copyTo(r),this.reduce(r),r},At.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var n=32767&t[r],i=n*this.mpl+((n*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},At.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},At.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},B.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},B.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},B.prototype.fromString=function(t,r){var n;if(r==16)n=4;else if(r==8)n=3;else if(r==256)n=8;else if(r==2)n=1;else if(r==32)n=5;else{if(r!=4)return void this.fromRadix(t,r);n=2}this.t=0,this.s=0;for(var i=t.length,s=!1,f=0;--i>=0;){var S=n==8?255&t[i]:Zt(t,i);S<0?t.charAt(i)=="-"&&(s=!0):(s=!1,f==0?this[this.t++]=S:f+n>this.DB?(this[this.t-1]|=(S&(1<<this.DB-f)-1)<<f,this[this.t++]=S>>this.DB-f):this[this.t-1]|=S<<f,(f+=n)>=this.DB&&(f-=this.DB))}n==8&&128&t[0]&&(this.s=-1,f>0&&(this[this.t-1]|=(1<<this.DB-f)-1<<f)),this.clamp(),s&&B.ZERO.subTo(this,this)},B.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},B.prototype.dlShiftTo=function(t,r){var n;for(n=this.t-1;n>=0;--n)r[n+t]=this[n];for(n=t-1;n>=0;--n)r[n]=0;r.t=this.t+t,r.s=this.s},B.prototype.drShiftTo=function(t,r){for(var n=t;n<this.t;++n)r[n-t]=this[n];r.t=Math.max(this.t-t,0),r.s=this.s},B.prototype.lShiftTo=function(t,r){var n,i=t%this.DB,s=this.DB-i,f=(1<<s)-1,S=Math.floor(t/this.DB),y=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)r[n+S+1]=this[n]>>s|y,y=(this[n]&f)<<i;for(n=S-1;n>=0;--n)r[n]=0;r[S]=y,r.t=this.t+S+1,r.s=this.s,r.clamp()},B.prototype.rShiftTo=function(t,r){r.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)r.t=0;else{var i=t%this.DB,s=this.DB-i,f=(1<<i)-1;r[0]=this[n]>>i;for(var S=n+1;S<this.t;++S)r[S-n-1]|=(this[S]&f)<<s,r[S-n]=this[S]>>i;i>0&&(r[this.t-n-1]|=(this.s&f)<<s),r.t=this.t-n,r.clamp()}},B.prototype.subTo=function(t,r){for(var n=0,i=0,s=Math.min(t.t,this.t);n<s;)i+=this[n]-t[n],r[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;n<this.t;)i+=this[n],r[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i-=t[n],r[n++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[n++]=this.DV+i:i>0&&(r[n++]=i),r.t=n,r.clamp()},B.prototype.multiplyTo=function(t,r){var n=this.abs(),i=t.abs(),s=n.t;for(r.t=s+i.t;--s>=0;)r[s]=0;for(s=0;s<i.t;++s)r[s+n.t]=n.am(0,i[s],r,s,0,n.t);r.s=0,r.clamp(),this.s!=t.s&&B.ZERO.subTo(r,r)},B.prototype.squareTo=function(t){for(var r=this.abs(),n=t.t=2*r.t;--n>=0;)t[n]=0;for(n=0;n<r.t-1;++n){var i=r.am(n,r[n],t,2*n,0,1);(t[n+r.t]+=r.am(n+1,2*r[n],t,2*n+1,i,r.t-n-1))>=r.DV&&(t[n+r.t]-=r.DV,t[n+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(n,r[n],t,2*n,0,1)),t.s=0,t.clamp()},B.prototype.divRemTo=function(t,r,n){var i=t.abs();if(!(i.t<=0)){var s=this.abs();if(s.t<i.t)return r?.fromInt(0),void(n!=null&&this.copyTo(n));n==null&&(n=nt());var f=nt(),S=this.s,y=t.s,_=this.DB-pt(i[i.t-1]);_>0?(i.lShiftTo(_,f),s.lShiftTo(_,n)):(i.copyTo(f),s.copyTo(n));var w=f.t,x=f[w-1];if(x!=0){var D=x*(1<<this.F1)+(w>1?f[w-2]>>this.F2:0),V=this.FV/D,W=(1<<this.F1)/D,G=1<<this.F2,X=n.t,g=X-w,E=r??nt();for(f.dlShiftTo(g,E),n.compareTo(E)>=0&&(n[n.t++]=1,n.subTo(E,n)),B.ONE.dlShiftTo(w,E),E.subTo(f,f);f.t<w;)f[f.t++]=0;for(;--g>=0;){var R=n[--X]==x?this.DM:Math.floor(n[X]*V+(n[X-1]+G)*W);if((n[X]+=f.am(0,R,n,g,0,w))<R)for(f.dlShiftTo(g,E),n.subTo(E,n);n[X]<--R;)n.subTo(E,n)}r!=null&&(n.drShiftTo(w,r),S!=y&&B.ZERO.subTo(r,r)),n.t=w,n.clamp(),_>0&&n.rShiftTo(_,n),S<0&&B.ZERO.subTo(n,n)}}},B.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},B.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},B.prototype.exp=function(t,r){if(t>4294967295||t<1)return B.ONE;var n=nt(),i=nt(),s=r.convert(this),f=pt(t)-1;for(s.copyTo(n);--f>=0;)if(r.sqrTo(n,i),(t&1<<f)>0)r.mulTo(i,s,n);else{var S=n;n=i,i=S}return r.revert(n)},B.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(t==16)r=4;else if(t==8)r=3;else if(t==2)r=1;else if(t==32)r=5;else{if(t!=4)return this.toRadix(t);r=2}var n,i=(1<<r)-1,s=!1,f="",S=this.t,y=this.DB-S*this.DB%r;if(S-- >0)for(y<this.DB&&(n=this[S]>>y)>0&&(s=!0,f=xt(n));S>=0;)y<r?(n=(this[S]&(1<<y)-1)<<r-y,n|=this[--S]>>(y+=this.DB-r)):(n=this[S]>>(y-=r)&i,y<=0&&(y+=this.DB,--S)),n>0&&(s=!0),s&&(f+=xt(n));return s?f:"0"},B.prototype.negate=function(){var t=nt();return B.ZERO.subTo(this,t),t},B.prototype.abs=function(){return this.s<0?this.negate():this},B.prototype.compareTo=function(t){var r=this.s-t.s;if(r!=0)return r;var n=this.t;if((r=n-t.t)!=0)return this.s<0?-r:r;for(;--n>=0;)if((r=this[n]-t[n])!=0)return r;return 0},B.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+pt(this[this.t-1]^this.s&this.DM)},B.prototype.mod=function(t){var r=nt();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(B.ZERO)>0&&t.subTo(r,r),r},B.prototype.modPowInt=function(t,r){var n;return n=t<256||r.isEven()?new vt(r):new At(r),this.exp(t,n)},B.ZERO=Tt(0),B.ONE=Tt(1),Ut.prototype.convert=Yt,Ut.prototype.revert=Yt,Ut.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n)},Ut.prototype.sqrTo=function(t,r){t.squareTo(r)},Kt.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 r=nt();return t.copyTo(r),this.reduce(r),r},Kt.prototype.revert=function(t){return t},Kt.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)},Kt.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},Kt.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var U=[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],c=(1<<26)/U[U.length-1];function h(){this.i=0,this.j=0,this.S=new Array}B.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},B.prototype.toRadix=function(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var r=this.chunkSize(t),n=Math.pow(t,r),i=Tt(n),s=nt(),f=nt(),S="";for(this.divRemTo(i,s,f);s.signum()>0;)S=(n+f.intValue()).toString(t).substr(1)+S,s.divRemTo(i,s,f);return f.intValue().toString(t)+S},B.prototype.fromRadix=function(t,r){this.fromInt(0),r==null&&(r=10);for(var n=this.chunkSize(r),i=Math.pow(r,n),s=!1,f=0,S=0,y=0;y<t.length;++y){var _=Zt(t,y);_<0?t.charAt(y)=="-"&&this.signum()==0&&(s=!0):(S=r*S+_,++f>=n&&(this.dMultiply(i),this.dAddOffset(S,0),f=0,S=0))}f>0&&(this.dMultiply(Math.pow(r,f)),this.dAddOffset(S,0)),s&&B.ZERO.subTo(this,this)},B.prototype.fromNumber=function(t,r,n){if(typeof r=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(B.ONE.shiftLeft(t-1),Vt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(B.ONE.shiftLeft(t-1),this);else{var i=new Array,s=7&t;i.length=1+(t>>3),r.nextBytes(i),s>0?i[0]&=(1<<s)-1:i[0]=0,this.fromString(i,256)}},B.prototype.bitwiseTo=function(t,r,n){var i,s,f=Math.min(t.t,this.t);for(i=0;i<f;++i)n[i]=r(this[i],t[i]);if(t.t<this.t){for(s=t.s&this.DM,i=f;i<this.t;++i)n[i]=r(this[i],s);n.t=this.t}else{for(s=this.s&this.DM,i=f;i<t.t;++i)n[i]=r(s,t[i]);n.t=t.t}n.s=r(this.s,t.s),n.clamp()},B.prototype.changeBit=function(t,r){var n=B.ONE.shiftLeft(t);return this.bitwiseTo(n,r,n),n},B.prototype.addTo=function(t,r){for(var n=0,i=0,s=Math.min(t.t,this.t);n<s;)i+=this[n]+t[n],r[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;n<this.t;)i+=this[n],r[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i+=t[n],r[n++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[n++]=i:i<-1&&(r[n++]=this.DV+i),r.t=n,r.clamp()},B.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},B.prototype.dAddOffset=function(t,r){if(t!=0){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},B.prototype.multiplyLowerTo=function(t,r,n){var i,s=Math.min(this.t+t.t,r);for(n.s=0,n.t=s;s>0;)n[--s]=0;for(i=n.t-this.t;s<i;++s)n[s+this.t]=this.am(0,t[s],n,s,0,this.t);for(i=Math.min(t.t,r);s<i;++s)this.am(0,t[s],n,s,0,r-s);n.clamp()},B.prototype.multiplyUpperTo=function(t,r,n){--r;var i=n.t=this.t+t.t-r;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)n[this.t+i-r]=this.am(r-i,t[i],n,0,0,this.t+i-r);n.clamp(),n.drShiftTo(1,n)},B.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(r==0)n=this[0]%t;else for(var i=this.t-1;i>=0;--i)n=(r*n+this[i])%t;return n},B.prototype.millerRabin=function(t){var r=this.subtract(B.ONE),n=r.getLowestSetBit();if(n<=0)return!1;var i=r.shiftRight(n);(t=t+1>>1)>U.length&&(t=U.length);for(var s=nt(),f=0;f<t;++f){s.fromInt(U[Math.floor(Math.random()*U.length)]);var S=s.modPow(i,this);if(S.compareTo(B.ONE)!=0&&S.compareTo(r)!=0){for(var y=1;y++<n&&S.compareTo(r)!=0;)if((S=S.modPowInt(2,this)).compareTo(B.ONE)==0)return!1;if(S.compareTo(r)!=0)return!1}}return!0},B.prototype.clone=function(){var t=nt();return this.copyTo(t),t},B.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},B.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},B.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},B.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},B.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var n,i=this.DB-t*this.DB%8,s=0;if(t-- >0)for(i<this.DB&&(n=this[t]>>i)!=(this.s&this.DM)>>i&&(r[s++]=n|this.s<<this.DB-i);t>=0;)i<8?(n=(this[t]&(1<<i)-1)<<8-i,n|=this[--t]>>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&n&&(n|=-256),s==0&&(128&this.s)!=(128&n)&&++s,(s>0||n!=this.s)&&(r[s++]=n);return r},B.prototype.equals=function(t){return this.compareTo(t)==0},B.prototype.min=function(t){return this.compareTo(t)<0?this:t},B.prototype.max=function(t){return this.compareTo(t)>0?this:t},B.prototype.and=function(t){var r=nt();return this.bitwiseTo(t,Wt,r),r},B.prototype.or=function(t){var r=nt();return this.bitwiseTo(t,Vt,r),r},B.prototype.xor=function(t){var r=nt();return this.bitwiseTo(t,zt,r),r},B.prototype.andNot=function(t){var r=nt();return this.bitwiseTo(t,$t,r),r},B.prototype.not=function(){for(var t=nt(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},B.prototype.shiftLeft=function(t){var r=nt();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},B.prototype.shiftRight=function(t){var r=nt();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},B.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+he(this[t]);return this.s<0?this.t*this.DB:-1},B.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,n=0;n<this.t;++n)t+=ee(this[n]^r);return t},B.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?this.s!=0:(this[r]&1<<t%this.DB)!=0},B.prototype.setBit=function(t){return this.changeBit(t,Vt)},B.prototype.clearBit=function(t){return this.changeBit(t,$t)},B.prototype.flipBit=function(t){return this.changeBit(t,zt)},B.prototype.add=function(t){var r=nt();return this.addTo(t,r),r},B.prototype.subtract=function(t){var r=nt();return this.subTo(t,r),r},B.prototype.multiply=function(t){var r=nt();return this.multiplyTo(t,r),r},B.prototype.divide=function(t){var r=nt();return this.divRemTo(t,r,null),r},B.prototype.remainder=function(t){var r=nt();return this.divRemTo(t,null,r),r},B.prototype.divideAndRemainder=function(t){var r=nt(),n=nt();return this.divRemTo(t,r,n),new Array(r,n)},B.prototype.modPow=function(t,r){var n,i,s=t.bitLength(),f=Tt(1);if(s<=0)return f;n=s<18?1:s<48?3:s<144?4:s<768?5:6,i=s<8?new vt(r):r.isEven()?new Kt(r):new At(r);var S=new Array,y=3,_=n-1,w=(1<<n)-1;if(S[1]=i.convert(this),n>1){var x=nt();for(i.sqrTo(S[1],x);y<=w;)S[y]=nt(),i.mulTo(x,S[y-2],S[y]),y+=2}var D,V,W=t.t-1,G=!0,X=nt();for(s=pt(t[W])-1;W>=0;){for(s>=_?D=t[W]>>s-_&w:(D=(t[W]&(1<<s+1)-1)<<_-s,W>0&&(D|=t[W-1]>>this.DB+s-_)),y=n;!(1&D);)D>>=1,--y;if((s-=y)<0&&(s+=this.DB,--W),G)S[D].copyTo(f),G=!1;else{for(;y>1;)i.sqrTo(f,X),i.sqrTo(X,f),y-=2;y>0?i.sqrTo(f,X):(V=f,f=X,X=V),i.mulTo(X,S[D],f)}for(;W>=0&&!(t[W]&1<<s);)i.sqrTo(f,X),V=f,f=X,X=V,--s<0&&(s=this.DB-1,--W)}return i.revert(f)},B.prototype.modInverse=function(t){var r=t.isEven();if(this.isEven()&&r||t.signum()==0)return B.ZERO;for(var n=t.clone(),i=this.clone(),s=Tt(1),f=Tt(0),S=Tt(0),y=Tt(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),r?(s.isEven()&&f.isEven()||(s.addTo(this,s),f.subTo(t,f)),s.rShiftTo(1,s)):f.isEven()||f.subTo(t,f),f.rShiftTo(1,f);for(;i.isEven();)i.rShiftTo(1,i),r?(S.isEven()&&y.isEven()||(S.addTo(this,S),y.subTo(t,y)),S.rShiftTo(1,S)):y.isEven()||y.subTo(t,y),y.rShiftTo(1,y);n.compareTo(i)>=0?(n.subTo(i,n),r&&s.subTo(S,s),f.subTo(y,f)):(i.subTo(n,i),r&&S.subTo(s,S),y.subTo(f,y))}return i.compareTo(B.ONE)!=0?B.ZERO:y.compareTo(t)>=0?y.subtract(t):y.signum()<0?(y.addTo(t,y),y.signum()<0?y.add(t):y):y},B.prototype.pow=function(t){return this.exp(t,new Ut)},B.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var s=r.getLowestSetBit(),f=n.getLowestSetBit();if(f<0)return r;for(s<f&&(f=s),f>0&&(r.rShiftTo(f,r),n.rShiftTo(f,n));r.signum()>0;)(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n));return f>0&&n.lShiftTo(f,n),n},B.prototype.isProbablePrime=function(t){var r,n=this.abs();if(n.t==1&&n[0]<=U[U.length-1]){for(r=0;r<U.length;++r)if(n[0]==U[r])return!0;return!1}if(n.isEven())return!1;for(r=1;r<U.length;){for(var i=U[r],s=r+1;s<U.length&&i<c;)i*=U[s++];for(i=n.modInt(i);r<s;)if(i%U[r++]==0)return!1}return n.millerRabin(t)},B.prototype.square=function(){var t=nt();return this.squareTo(t),t},h.prototype.init=function(t){var r,n,i;for(r=0;r<256;++r)this.S[r]=r;for(n=0,r=0;r<256;++r)n=n+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[n],this.S[n]=i;this.i=0,this.j=0},h.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var N,q,J;function Z(){(function(t){q[J++]^=255&t,q[J++]^=t>>8&255,q[J++]^=t>>16&255,q[J++]^=t>>24&255,J>=256&&(J-=256)})(new Date().getTime())}if(q==null){var at;if(q=new Array,J=0,m!==void 0&&(m.crypto!==void 0||m.msCrypto!==void 0)){var lt=m.crypto||m.msCrypto;if(lt.getRandomValues){var _t=new Uint8Array(32);for(lt.getRandomValues(_t),at=0;at<32;++at)q[J++]=_t[at]}else if(k.appName=="Netscape"&&k.appVersion<"5"){var yt=m.crypto.random(32);for(at=0;at<yt.length;++at)q[J++]=255&yt.charCodeAt(at)}}for(;J<256;)at=Math.floor(65536*Math.random()),q[J++]=at>>>8,q[J++]=255&at;J=0,Z()}function Pt(){if(N==null){for(Z(),(N=function(){return new h}()).init(q),J=0;J<q.length;++J)q[J]=0;J=0}return N.next()}function Mt(){}function Gt(e,t){return new B(e,t)}function ie(e,t,r){for(var n="",i=0;n.length<t;)n+=r(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function ht(){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 kt(e,t){this.x=t,this.q=e}function mt(e,t,r,n){this.curve=e,this.x=t,this.y=r,this.z=n??B.ONE,this.zinv=null}function de(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new mt(this,null,null)}Mt.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=Pt()},ht.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},ht.prototype.setPublic=function(t,r){if(this.isPublic=!0,this.isPrivate=!1,typeof t!="string")this.n=t,this.e=r;else{if(!(t!=null&&r!=null&&t.length>0&&r.length>0))throw"Invalid RSA public key";this.n=Gt(t,16),this.e=parseInt(r,16)}},ht.prototype.encrypt=function(t){var r=function(f,S){if(S<f.length+11)throw"Message too long for RSA";for(var y=new Array,_=f.length-1;_>=0&&S>0;){var w=f.charCodeAt(_--);w<128?y[--S]=w:w>127&&w<2048?(y[--S]=63&w|128,y[--S]=w>>6|192):(y[--S]=63&w|128,y[--S]=w>>6&63|128,y[--S]=w>>12|224)}y[--S]=0;for(var x=new Mt,D=new Array;S>2;){for(D[0]=0;D[0]==0;)x.nextBytes(D);y[--S]=D[0]}return y[--S]=2,y[--S]=0,new B(y)}(t,this.n.bitLength()+7>>3);if(r==null)return null;var n=this.doPublic(r);if(n==null)return null;var i=n.toString(16);return 1&i.length?"0"+i:i},ht.prototype.encryptOAEP=function(t,r,n){var i=function(y,_,w,x){var D=v.crypto.MessageDigest,V=v.crypto.Util,W=null;if(w||(w="sha1"),typeof w=="string"&&(W=D.getCanonicalAlgName(w),x=D.getHashLength(W),w=function(tt){return te(V.hashHex(ue(tt),W))}),y.length+2*x+2>_)throw"Message too long for RSA";var G,X="";for(G=0;G<_-y.length-2*x-2;G+=1)X+="\0";var g=w("")+X+""+y,E=new Array(x);new Mt().nextBytes(E);var R=ie(E,g.length,w),L=[];for(G=0;G<g.length;G+=1)L[G]=g.charCodeAt(G)^R.charCodeAt(G);var z=ie(L,E.length,w),Q=[0];for(G=0;G<E.length;G+=1)Q[G+1]=E[G]^z.charCodeAt(G);return new B(Q.concat(L))}(t,this.n.bitLength()+7>>3,r,n);if(i==null)return null;var s=this.doPublic(i);if(s==null)return null;var f=s.toString(16);return 1&f.length?"0"+f:f},ht.prototype.type="RSA",kt.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},kt.prototype.toBigInteger=function(){return this.x},kt.prototype.negate=function(){return new kt(this.q,this.x.negate().mod(this.q))},kt.prototype.add=function(t){return new kt(this.q,this.x.add(t.toBigInteger()).mod(this.q))},kt.prototype.subtract=function(t){return new kt(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},kt.prototype.multiply=function(t){return new kt(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},kt.prototype.square=function(){return new kt(this.q,this.x.square().mod(this.q))},kt.prototype.divide=function(t){return new kt(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},mt.prototype.getX=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},mt.prototype.getY=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},mt.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(B.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B.ZERO))},mt.prototype.isInfinity=function(){return this.x==null&&this.y==null||this.z.equals(B.ZERO)&&!this.y.toBigInteger().equals(B.ZERO)},mt.prototype.negate=function(){return new mt(this.curve,this.x,this.y.negate(),this.z)},mt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),n=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(B.ZERO.equals(n))return B.ZERO.equals(r)?this.twice():this.curve.getInfinity();var i=new B("3"),s=this.x.toBigInteger(),f=this.y.toBigInteger(),S=(t.x.toBigInteger(),t.y.toBigInteger(),n.square()),y=S.multiply(n),_=s.multiply(S),w=r.square().multiply(this.z),x=w.subtract(_.shiftLeft(1)).multiply(t.z).subtract(y).multiply(n).mod(this.curve.q),D=_.multiply(i).multiply(r).subtract(f.multiply(y)).subtract(w.multiply(r)).multiply(t.z).add(r.multiply(y)).mod(this.curve.q),V=y.multiply(this.z).multiply(t.z).mod(this.curve.q);return new mt(this.curve,this.curve.fromBigInteger(x),this.curve.fromBigInteger(D),V)},mt.prototype.twice=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=new B("3"),r=this.x.toBigInteger(),n=this.y.toBigInteger(),i=n.multiply(this.z),s=i.multiply(n).mod(this.curve.q),f=this.curve.a.toBigInteger(),S=r.square().multiply(t);B.ZERO.equals(f)||(S=S.add(this.z.square().multiply(f)));var y=(S=S.mod(this.curve.q)).square().subtract(r.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(i).mod(this.curve.q),_=S.multiply(t).multiply(r).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(S.square().multiply(S)).mod(this.curve.q),w=i.square().multiply(i).shiftLeft(3).mod(this.curve.q);return new mt(this.curve,this.curve.fromBigInteger(y),this.curve.fromBigInteger(_),w)},mt.prototype.multiply=function(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var r,n=t,i=n.multiply(new B("3")),s=this.negate(),f=this,S=this.curve.q.subtract(t),y=S.multiply(new B("3")),_=new mt(this.curve,this.x,this.y),w=_.negate();for(r=i.bitLength()-2;r>0;--r){f=f.twice();var x=i.testBit(r);x!=n.testBit(r)&&(f=f.add(x?this:s))}for(r=y.bitLength()-2;r>0;--r){_=_.twice();var D=y.testBit(r);D!=S.testBit(r)&&(_=_.add(D?_:w))}return f},mt.prototype.multiplyTwo=function(t,r,n){var i;i=t.bitLength()>n.bitLength()?t.bitLength()-1:n.bitLength()-1;for(var s=this.curve.getInfinity(),f=this.add(r);i>=0;)s=s.twice(),t.testBit(i)?s=n.testBit(i)?s.add(f):s.add(this):n.testBit(i)&&(s=s.add(r)),--i;return s},de.prototype.getQ=function(){return this.q},de.prototype.getA=function(){return this.a},de.prototype.getB=function(){return this.b},de.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},de.prototype.getInfinity=function(){return this.infinity},de.prototype.fromBigInteger=function(t){return new kt(this.q,t)},de.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var r=(t.length-2)/2,n=t.substr(2,r),i=t.substr(r+2,r);return new mt(this,this.fromBigInteger(new B(n,16)),this.fromBigInteger(new B(i,16)));default:return null}},kt.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},mt.prototype.getEncoded=function(e){var t=function(f,S){var y=f.toByteArrayUnsigned();if(S<y.length)y=y.slice(y.length-S);else for(;S>y.length;)y.unshift(0);return y},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i},mt.decodeFrom=function(e,t){t[0];var r=t.length-1,n=t.slice(1,1+r/2),i=t.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new B(n),f=new B(i);return new mt(e,e.fromBigInteger(s),e.fromBigInteger(f))},mt.decodeFromHex=function(e,t){t.substr(0,2);var r=t.length-2,n=t.substr(2,r/2),i=t.substr(2+r/2,r/2),s=new B(n,16),f=new B(i,16);return new mt(e,e.fromBigInteger(s),e.fromBigInteger(f))},mt.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y).divide(t),n=r.square().subtract(this.x).subtract(e.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new mt(this.curve,n,i)},mt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(B.valueOf(2)),t=this.curve.fromBigInteger(B.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new mt(this.curve,n,i)},mt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t,r=e,n=r.multiply(new B("3")),i=this.negate(),s=this;for(t=n.bitLength()-2;t>0;--t){s=s.twice();var f=n.testBit(t);f!=r.testBit(t)&&(s=s.add2D(f?this:i))}return s},mt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=t.multiply(t).mod(i),f=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return s.equals(f)},mt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},mt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(B.ONE)<0||t.compareTo(e.subtract(B.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(B.ONE)<0||r.compareTo(e.subtract(B.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var Ye=function(){var e=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"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
1
+ var piralOidc=(()=>{var Ar=Object.create;var Be=Object.defineProperty;var kr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Cr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var Rr=(rt,p)=>()=>(p||rt((p={exports:{}}).exports,p),p.exports),Ir=(rt,p)=>{for(var j in p)Be(rt,j,{get:p[j],enumerable:!0})},cr=(rt,p,j,T)=>{if(p&&typeof p=="object"||typeof p=="function")for(let l of Pr(p))!Tr.call(rt,l)&&l!==j&&Be(rt,l,{get:()=>p[l],enumerable:!(T=kr(p,l))||T.enumerable});return rt};var Dr=(rt,p,j)=>(j=rt!=null?Ar(Cr(rt)):{},cr(p||!rt||!rt.__esModule?Be(j,"default",{value:rt,enumerable:!0}):j,rt)),Lr=rt=>cr(Be({},"__esModule",{value:!0}),rt);var hr=Rr((Te,ze)=>{(function(p,j){if(typeof Te=="object"&&typeof ze=="object")ze.exports=j();else if(typeof define=="function"&&define.amd)define([],j);else{var T=j();for(var l in T)(typeof Te=="object"?Te:p)[l]=T[l]}})(Te,function(){return function(rt){var p={};function j(T){if(p[T])return p[T].exports;var l=p[T]={i:T,l:!1,exports:{}};return rt[T].call(l.exports,l,l.exports,j),l.l=!0,l.exports}return j.m=rt,j.c=p,j.d=function(T,l,k){j.o(T,l)||Object.defineProperty(T,l,{enumerable:!0,get:k})},j.r=function(T){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})},j.t=function(T,l){if(1&l&&(T=j(T)),8&l||4&l&&typeof T=="object"&&T&&T.__esModule)return T;var k=Object.create(null);if(j.r(k),Object.defineProperty(k,"default",{enumerable:!0,value:T}),2&l&&typeof T!="string")for(var m in T)j.d(k,m,function(a){return T[a]}.bind(null,m));return k},j.n=function(T){var l=T&&T.__esModule?function(){return T.default}:function(){return T};return j.d(l,"a",l),l},j.o=function(T,l){return Object.prototype.hasOwnProperty.call(T,l)},j.p="",j(j.s=22)}([function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l={debug:function(){},info:function(){},warn:function(){},error:function(){}},k=void 0,m=void 0;(p.Log=function(){function a(){(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,a)}return a.reset=function(){m=3,k=l},a.debug=function(){if(m>=4){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.debug.apply(k,Array.from(d))}},a.info=function(){if(m>=3){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.info.apply(k,Array.from(d))}},a.warn=function(){if(m>=2){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.warn.apply(k,Array.from(d))}},a.error=function(){if(m>=1){for(var o=arguments.length,d=Array(o),P=0;P<o;P++)d[P]=arguments[P];k.error.apply(k,Array.from(d))}},T(a,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return m},set:function(o){if(!(0<=o&&o<=4))throw new Error("Invalid log level");m=o}},{key:"logger",get:function(){return k},set:function(o){if(!o.debug&&o.info&&(o.debug=o.info),!(o.debug&&o.info&&o.warn&&o.error))throw new Error("Invalid logger");k=o}}]),a}()).reset()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l={setInterval:function(a){function u(o,d){return a.apply(this,arguments)}return u.toString=function(){return a.toString()},u}(function(a,u){return setInterval(a,u)}),clearInterval:function(a){function u(o){return a.apply(this,arguments)}return u.toString=function(){return a.toString()},u}(function(a){return clearInterval(a)})},k=!1,m=null;p.Global=function(){function a(){(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,a)}return a._testing=function(){k=!0},a.setXMLHttpRequest=function(o){m=o},T(a,null,[{key:"location",get:function(){if(!k)return location}},{key:"localStorage",get:function(){if(!k&&typeof window<"u")return localStorage}},{key:"sessionStorage",get:function(){if(!k&&typeof window<"u")return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!k&&typeof window<"u")return m||XMLHttpRequest}},{key:"timer",get:function(){if(!k)return l}}]),a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.MetadataService=void 0;var T=function(){function u(o,d){for(var P=0;P<d.length;P++){var b=d[P];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}return function(o,d,P){return d&&u(o.prototype,d),P&&u(o,P),o}}(),l=j(0),k=j(7);function m(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}var a=".well-known/openid-configuration";p.MetadataService=function(){function u(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.JsonService;if(m(this,u),!o)throw l.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=o,this._jsonService=new d(["application/jwk-set+json"])}return u.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},u.prototype.getMetadata=function(){var d=this;return this._settings.metadata?(l.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(l.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then(function(P){l.Log.debug("MetadataService.getMetadata: json received");var b=d._settings.metadataSeed||{};return d._settings.metadata=Object.assign({},b,P),d._settings.metadata})):(l.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},u.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},u.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},u.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},u.prototype.getTokenEndpoint=function(){var d=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0];return this._getMetadataProperty("token_endpoint",d)},u.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},u.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},u.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},u.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},u.prototype._getMetadataProperty=function(d){var P=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return l.Log.debug("MetadataService.getMetadataProperty for: "+d),this.getMetadata().then(function(b){if(l.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),b[d]===void 0){if(P===!0)return void l.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+d);throw l.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+d),new Error("Metadata does not contain property "+d)}return b[d]})},u.prototype.getSigningKeys=function(){var d=this;return this._settings.signingKeys?(l.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then(function(P){return l.Log.debug("MetadataService.getSigningKeys: jwks_uri received",P),d._jsonService.getJson(P).then(function(b){if(l.Log.debug("MetadataService.getSigningKeys: key set received",b),!b.keys)throw l.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return d._settings.signingKeys=b.keys,d._settings.signingKeys})})},T(u,[{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(a)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=a))),this._metadataUrl}}]),u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UrlUtility=void 0;var T=j(0),l=j(1);p.UrlUtility=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k)}return k.addQueryParam=function(a,u,o){return a.indexOf("?")<0&&(a+="?"),a[a.length-1]!=="?"&&(a+="&"),a+=encodeURIComponent(u),a+="=",a+=encodeURIComponent(o)},k.parseUrlFragment=function(a){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#",o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.Global;typeof a!="string"&&(a=o.location.href);var d=a.lastIndexOf(u);d>=0&&(a=a.substr(d+1)),u==="?"&&(d=a.indexOf("#"))>=0&&(a=a.substr(0,d));for(var P,b={},H=/([^&=]+)=([^&]*)/g,C=0;P=H.exec(a);)if(b[decodeURIComponent(P[1])]=decodeURIComponent(P[2].replace(/\+/g," ")),C++>50)return T.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",a),{error:"Response exceeded expected number of parameters"};for(var A in b)return b;return{}},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.JoseUtil=void 0;var T=j(26),l=function(m){return m&&m.__esModule?m:{default:m}}(j(33));p.JoseUtil=(0,l.default)({jws:T.jws,KeyUtil:T.KeyUtil,X509:T.X509,crypto:T.crypto,hextob64u:T.hextob64u,b64tohex:T.b64tohex,AllowedSigningAlgs:T.AllowedSigningAlgs})},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.OidcClientSettings=void 0;var T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},l=function(){function A(F,O){for(var Y=0;Y<O.length;Y++){var M=O[Y];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(F,M.key,M)}}return function(F,O,Y){return O&&A(F.prototype,O),Y&&A(F,Y),F}}(),k=j(0),m=j(23),a=j(6),u=j(24),o=j(2);function d(A,F){if(!(A instanceof F))throw new TypeError("Cannot call a class as a function")}var P=".well-known/openid-configuration",b="id_token",H="openid",C="client_secret_post";p.OidcClientSettings=function(){function A(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},O=F.authority,Y=F.metadataUrl,M=F.metadata,K=F.signingKeys,I=F.metadataSeed,$=F.client_id,et=F.client_secret,ot=F.response_type,B=ot===void 0?b:ot,nt=F.scope,ft=nt===void 0?H:nt,dt=F.redirect_uri,jt=F.post_logout_redirect_uri,xt=F.client_authentication,Zt=xt===void 0?C:xt,Tt=F.prompt,pt=F.display,vt=F.max_age,At=F.ui_locales,Wt=F.acr_values,Vt=F.resource,zt=F.response_mode,$t=F.filterProtocolClaims,he=$t===void 0||$t,ee=F.loadUserInfo,Ut=ee===void 0||ee,Yt=F.staleStateAge,Kt=Yt===void 0?900:Yt,U=F.clockSkew,c=U===void 0?300:U,h=F.clockService,N=h===void 0?new m.ClockService:h,q=F.userInfoJwtIssuer,J=q===void 0?"OP":q,Z=F.mergeClaims,at=Z!==void 0&&Z,lt=F.stateStore,_t=lt===void 0?new a.WebStorageStateStore:lt,yt=F.ResponseValidatorCtor,Pt=yt===void 0?u.ResponseValidator:yt,Mt=F.MetadataServiceCtor,Gt=Mt===void 0?o.MetadataService:Mt,ie=F.extraQueryParams,ht=ie===void 0?{}:ie,kt=F.extraTokenParams,mt=kt===void 0?{}:kt;d(this,A),this._authority=O,this._metadataUrl=Y,this._metadata=M,this._metadataSeed=I,this._signingKeys=K,this._client_id=$,this._client_secret=et,this._response_type=B,this._scope=ft,this._redirect_uri=dt,this._post_logout_redirect_uri=jt,this._client_authentication=Zt,this._prompt=Tt,this._display=pt,this._max_age=vt,this._ui_locales=At,this._acr_values=Wt,this._resource=Vt,this._response_mode=zt,this._filterProtocolClaims=!!he,this._loadUserInfo=!!Ut,this._staleStateAge=Kt,this._clockSkew=c,this._clockService=N,this._userInfoJwtIssuer=J,this._mergeClaims=!!at,this._stateStore=_t,this._validator=new Pt(this),this._metadataService=new Gt(this),this._extraQueryParams=(ht===void 0?"undefined":T(ht))==="object"?ht:{},this._extraTokenParams=(mt===void 0?"undefined":T(mt))==="object"?mt:{}}return A.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},l(A,[{key:"client_id",get:function(){return this._client_id},set:function(O){if(this._client_id)throw k.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=O}},{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:"client_authentication",get:function(){return this._client_authentication}},{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:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(O){if(this._authority)throw k.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=O}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(P)<0&&(this._metadataUrl[this._metadataUrl.length-1]!=="/"&&(this._metadataUrl+="/"),this._metadataUrl+=P)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(O){this._metadata=O}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(O){this._metadataSeed=O}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(O){this._signingKeys=O}},{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:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{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(O){(O===void 0?"undefined":T(O))==="object"?this._extraQueryParams=O:this._extraQueryParams={}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(O){(O===void 0?"undefined":T(O))==="object"?this._extraTokenParams=O:this._extraTokenParams={}}}]),A}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.WebStorageStateStore=void 0;var T=j(0),l=j(1);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.WebStorageStateStore=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.prefix,o=u===void 0?"oidc.":u,d=a.store,P=d===void 0?l.Global.localStorage:d;k(this,m),this._store=P,this._prefix=o}return m.prototype.set=function(u,o){return T.Log.debug("WebStorageStateStore.set",u),u=this._prefix+u,this._store.setItem(u,o),Promise.resolve()},m.prototype.get=function(u){T.Log.debug("WebStorageStateStore.get",u),u=this._prefix+u;var o=this._store.getItem(u);return Promise.resolve(o)},m.prototype.remove=function(u){T.Log.debug("WebStorageStateStore.remove",u),u=this._prefix+u;var o=this._store.getItem(u);return this._store.removeItem(u),Promise.resolve(o)},m.prototype.getAllKeys=function(){T.Log.debug("WebStorageStateStore.getAllKeys");for(var u=[],o=0;o<this._store.length;o++){var d=this._store.key(o);d.indexOf(this._prefix)===0&&u.push(d.substr(this._prefix.length))}return Promise.resolve(u)},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.JsonService=void 0;var T=j(0),l=j(1);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.JsonService=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l.Global.XMLHttpRequest,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;k(this,m),a&&Array.isArray(a)?this._contentTypes=a.slice():this._contentTypes=[],this._contentTypes.push("application/json"),o&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=u,this._jwtHandler=o}return m.prototype.getJson=function(u,o){var d=this;if(!u)throw T.Log.error("JsonService.getJson: No url passed"),new Error("url");return T.Log.debug("JsonService.getJson, url: ",u),new Promise(function(P,b){var H=new d._XMLHttpRequest;H.open("GET",u);var C=d._contentTypes,A=d._jwtHandler;H.onload=function(){if(T.Log.debug("JsonService.getJson: HTTP response received, status",H.status),H.status===200){var F=H.getResponseHeader("Content-Type");if(F){var O=C.find(function(Y){if(F.startsWith(Y))return!0});if(O=="application/jwt")return void A(H).then(P,b);if(O)try{return void P(JSON.parse(H.responseText))}catch(Y){return T.Log.error("JsonService.getJson: Error parsing JSON response",Y.message),void b(Y)}}b(Error("Invalid response Content-Type: "+F+", from URL: "+u))}else b(Error(H.statusText+" ("+H.status+")"))},H.onerror=function(){T.Log.error("JsonService.getJson: network error"),b(Error("Network Error"))},o&&(T.Log.debug("JsonService.getJson: token passed, setting Authorization header"),H.setRequestHeader("Authorization","Bearer "+o)),H.send()})},m.prototype.postForm=function(u,o,d){var P=this;if(!u)throw T.Log.error("JsonService.postForm: No url passed"),new Error("url");return T.Log.debug("JsonService.postForm, url: ",u),new Promise(function(b,H){var C=new P._XMLHttpRequest;C.open("POST",u);var A=P._contentTypes;C.onload=function(){if(T.Log.debug("JsonService.postForm: HTTP response received, status",C.status),C.status!==200){if(C.status===400&&(K=C.getResponseHeader("Content-Type"))&&A.find(function(I){if(K.startsWith(I))return!0}))try{var M=JSON.parse(C.responseText);if(M&&M.error)return T.Log.error("JsonService.postForm: Error from server: ",M.error),void H(new Error(M.error))}catch(I){return T.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void H(I)}H(Error(C.statusText+" ("+C.status+")"))}else{var K;if((K=C.getResponseHeader("Content-Type"))&&A.find(function(I){if(K.startsWith(I))return!0}))try{return void b(JSON.parse(C.responseText))}catch(I){return T.Log.error("JsonService.postForm: Error parsing JSON response",I.message),void H(I)}H(Error("Invalid response Content-Type: "+K+", from URL: "+u))}},C.onerror=function(){T.Log.error("JsonService.postForm: network error"),H(Error("Network Error"))};var F="";for(var O in o){var Y=o[O];Y&&(F.length>0&&(F+="&"),F+=encodeURIComponent(O),F+="=",F+=encodeURIComponent(Y))}C.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d!==void 0&&C.setRequestHeader("Authorization","Basic "+btoa(d)),C.send(F)})},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SigninRequest=void 0;var T=j(0),l=j(3),k=j(13);p.SigninRequest=function(){function m(a){var u=a.url,o=a.client_id,d=a.redirect_uri,P=a.response_type,b=a.scope,H=a.authority,C=a.data,A=a.prompt,F=a.display,O=a.max_age,Y=a.ui_locales,M=a.id_token_hint,K=a.login_hint,I=a.acr_values,$=a.resource,et=a.response_mode,ot=a.request,B=a.request_uri,nt=a.extraQueryParams,ft=a.request_type,dt=a.client_secret,jt=a.extraTokenParams,xt=a.skipUserInfo;if(function(Vt,zt){if(!(Vt instanceof zt))throw new TypeError("Cannot call a class as a function")}(this,m),!u)throw T.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!o)throw T.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!d)throw T.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!P)throw T.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!b)throw T.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!H)throw T.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var Zt=m.isOidc(P),Tt=m.isCode(P);et||(et=m.isCode(P)?"query":null),this.state=new k.SigninState({nonce:Zt,data:C,client_id:o,authority:H,redirect_uri:d,code_verifier:Tt,request_type:ft,response_mode:et,client_secret:dt,scope:b,extraTokenParams:jt,skipUserInfo:xt}),u=l.UrlUtility.addQueryParam(u,"client_id",o),u=l.UrlUtility.addQueryParam(u,"redirect_uri",d),u=l.UrlUtility.addQueryParam(u,"response_type",P),u=l.UrlUtility.addQueryParam(u,"scope",b),u=l.UrlUtility.addQueryParam(u,"state",this.state.id),Zt&&(u=l.UrlUtility.addQueryParam(u,"nonce",this.state.nonce)),Tt&&(u=l.UrlUtility.addQueryParam(u,"code_challenge",this.state.code_challenge),u=l.UrlUtility.addQueryParam(u,"code_challenge_method","S256"));var pt={prompt:A,display:F,max_age:O,ui_locales:Y,id_token_hint:M,login_hint:K,acr_values:I,resource:$,request:ot,request_uri:B,response_mode:et};for(var vt in pt)pt[vt]&&(u=l.UrlUtility.addQueryParam(u,vt,pt[vt]));for(var At in nt)u=l.UrlUtility.addQueryParam(u,At,nt[At]);this.url=u}return m.isOidc=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="id_token"})[0]},m.isOAuth=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="token"})[0]},m.isCode=function(u){return!!u.split(/\s+/g).filter(function(o){return o==="code"})[0]},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.State=void 0;var T=function(){function a(u,o){for(var d=0;d<o.length;d++){var P=o[d];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(u,P.key,P)}}return function(u,o,d){return o&&a(u.prototype,o),d&&a(u,d),u}}(),l=j(0),k=function(u){return u&&u.__esModule?u:{default:u}}(j(14));function m(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}p.State=function(){function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=u.id,d=u.data,P=u.created,b=u.request_type;m(this,a),this._id=o||(0,k.default)(),this._data=d,this._created=typeof P=="number"&&P>0?P:parseInt(Date.now()/1e3),this._request_type=b}return a.prototype.toStorageString=function(){return l.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},a.fromStorageString=function(o){return l.Log.debug("State.fromStorageString"),new a(JSON.parse(o))},a.clearStaleState=function(o,d){var P=Date.now()/1e3-d;return o.getAllKeys().then(function(b){l.Log.debug("State.clearStaleState: got keys",b);for(var H=[],C=function(Y){var M=b[Y];F=o.get(M).then(function(K){var I=!1;if(K)try{var $=a.fromStorageString(K);l.Log.debug("State.clearStaleState: got item from key: ",M,$.created),$.created<=P&&(I=!0)}catch(et){l.Log.error("State.clearStaleState: Error parsing state for key",M,et.message),I=!0}else l.Log.debug("State.clearStaleState: no item in storage for key: ",M),I=!0;if(I)return l.Log.debug("State.clearStaleState: removed item for key: ",M),o.remove(M)}),H.push(F)},A=0;A<b.length;A++){var F;C(A)}return l.Log.debug("State.clearStaleState: waiting on promise count:",H.length),Promise.all(H)})},T(a,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.OidcClient=void 0;var T=function(){function C(A,F){for(var O=0;O<F.length;O++){var Y=F[O];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(A,Y.key,Y)}}return function(A,F,O){return F&&C(A.prototype,F),O&&C(A,O),A}}(),l=j(0),k=j(5),m=j(12),a=j(8),u=j(34),o=j(35),d=j(36),P=j(13),b=j(9);function H(C,A){if(!(C instanceof A))throw new TypeError("Cannot call a class as a function")}p.OidcClient=function(){function C(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H(this,C),A instanceof k.OidcClientSettings?this._settings=A:this._settings=new k.OidcClientSettings(A)}return C.prototype.createSigninRequest=function(){var F=this,O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=O.response_type,M=O.scope,K=O.redirect_uri,I=O.data,$=O.state,et=O.prompt,ot=O.display,B=O.max_age,nt=O.ui_locales,ft=O.id_token_hint,dt=O.login_hint,jt=O.acr_values,xt=O.resource,Zt=O.request,Tt=O.request_uri,pt=O.response_mode,vt=O.extraQueryParams,At=O.extraTokenParams,Wt=O.request_type,Vt=O.skipUserInfo,zt=arguments[1];l.Log.debug("OidcClient.createSigninRequest");var $t=this._settings.client_id;Y=Y||this._settings.response_type,M=M||this._settings.scope,K=K||this._settings.redirect_uri,et=et||this._settings.prompt,ot=ot||this._settings.display,B=B||this._settings.max_age,nt=nt||this._settings.ui_locales,jt=jt||this._settings.acr_values,xt=xt||this._settings.resource,pt=pt||this._settings.response_mode,vt=vt||this._settings.extraQueryParams,At=At||this._settings.extraTokenParams;var he=this._settings.authority;return a.SigninRequest.isCode(Y)&&Y!=="code"?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then(function(ee){l.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",ee);var Ut=new a.SigninRequest({url:ee,client_id:$t,redirect_uri:K,response_type:Y,scope:M,data:I||$,authority:he,prompt:et,display:ot,max_age:B,ui_locales:nt,id_token_hint:ft,login_hint:dt,acr_values:jt,resource:xt,request:Zt,request_uri:Tt,extraQueryParams:vt,extraTokenParams:At,request_type:Wt,response_mode:pt,client_secret:F._settings.client_secret,skipUserInfo:Vt}),Yt=Ut.state;return(zt=zt||F._stateStore).set(Yt.id,Yt.toStorageString()).then(function(){return Ut})})},C.prototype.readSigninResponseState=function(F,O){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];l.Log.debug("OidcClient.readSigninResponseState");var M=this._settings.response_mode==="query"||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),K=M?"?":"#",I=new u.SigninResponse(F,K);if(!I.state)return l.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));O=O||this._stateStore;var $=Y?O.remove.bind(O):O.get.bind(O);return $(I.state).then(function(et){if(!et)throw l.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:P.SigninState.fromStorageString(et),response:I}})},C.prototype.processSigninResponse=function(F,O){var Y=this;return l.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(F,O,!0).then(function(M){var K=M.state,I=M.response;return l.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),Y._validator.validateSigninResponse(K,I)})},C.prototype.createSignoutRequest=function(){var F=this,O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=O.id_token_hint,M=O.data,K=O.state,I=O.post_logout_redirect_uri,$=O.extraQueryParams,et=O.request_type,ot=arguments[1];return l.Log.debug("OidcClient.createSignoutRequest"),I=I||this._settings.post_logout_redirect_uri,$=$||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then(function(B){if(!B)throw l.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");l.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",B);var nt=new o.SignoutRequest({url:B,id_token_hint:Y,post_logout_redirect_uri:I,data:M||K,extraQueryParams:$,request_type:et}),ft=nt.state;return ft&&(l.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(ot=ot||F._stateStore).set(ft.id,ft.toStorageString())),nt})},C.prototype.readSignoutResponseState=function(F,O){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];l.Log.debug("OidcClient.readSignoutResponseState");var M=new d.SignoutResponse(F);if(!M.state)return l.Log.debug("OidcClient.readSignoutResponseState: No state in response"),M.error?(l.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",M.error),Promise.reject(new m.ErrorResponse(M))):Promise.resolve({state:void 0,response:M});var K=M.state;O=O||this._stateStore;var I=Y?O.remove.bind(O):O.get.bind(O);return I(K).then(function($){if(!$)throw l.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:b.State.fromStorageString($),response:M}})},C.prototype.processSignoutResponse=function(F,O){var Y=this;return l.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(F,O,!0).then(function(M){var K=M.state,I=M.response;return K?(l.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),Y._validator.validateSignoutResponse(K,I)):(l.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),I)})},C.prototype.clearStaleState=function(F){return l.Log.debug("OidcClient.clearStaleState"),F=F||this._stateStore,b.State.clearStaleState(F,this.settings.staleStateAge)},T(C,[{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}}]),C}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TokenClient=void 0;var T=j(7),l=j(2),k=j(0);function m(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")}p.TokenClient=function(){function a(u){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T.JsonService,d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService;if(m(this,a),!u)throw k.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=u,this._jsonService=new o,this._metadataService=new d(this._settings)}return a.prototype.exchangeCode=function(){var o=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(d=Object.assign({},d)).grant_type=d.grant_type||"authorization_code",d.client_id=d.client_id||this._settings.client_id,d.client_secret=d.client_secret||this._settings.client_secret,d.redirect_uri=d.redirect_uri||this._settings.redirect_uri;var P=void 0,b=d._client_authentication||this._settings._client_authentication;return delete d._client_authentication,d.code?d.redirect_uri?d.code_verifier?d.client_id?d.client_secret||b!="client_secret_basic"?(b=="client_secret_basic"&&(P=d.client_id+":"+d.client_secret,delete d.client_id,delete d.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(H){return k.Log.debug("TokenClient.exchangeCode: Received token endpoint"),o._jsonService.postForm(H,d,P).then(function(C){return k.Log.debug("TokenClient.exchangeCode: response received"),C})})):(k.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(k.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(k.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(k.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(k.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},a.prototype.exchangeRefreshToken=function(){var o=this,d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(d=Object.assign({},d)).grant_type=d.grant_type||"refresh_token",d.client_id=d.client_id||this._settings.client_id,d.client_secret=d.client_secret||this._settings.client_secret;var P=void 0,b=d._client_authentication||this._settings._client_authentication;return delete d._client_authentication,d.refresh_token?d.client_id?(b=="client_secret_basic"&&(P=d.client_id+":"+d.client_secret,delete d.client_id,delete d.client_secret),this._metadataService.getTokenEndpoint(!1).then(function(H){return k.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),o._jsonService.postForm(H,d,P).then(function(C){return k.Log.debug("TokenClient.exchangeRefreshToken: response received"),C})})):(k.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(k.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},a}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ErrorResponse=void 0;var T=j(0);function l(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}function k(m,a){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||typeof a!="object"&&typeof a!="function"?m:a}p.ErrorResponse=function(m){function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=u.error,d=u.error_description,P=u.error_uri,b=u.state,H=u.session_state;if(l(this,a),!o)throw T.Log.error("No error passed to ErrorResponse"),new Error("error");var C=k(this,m.call(this,d||o));return C.name="ErrorResponse",C.error=o,C.error_description=d,C.error_uri=P,C.state=b,C.session_state=H,C}return function(o,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);o.prototype=Object.create(d&&d.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(o,d):o.__proto__=d)}(a,m),a}(Error)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SigninState=void 0;var T=function(){function d(P,b){for(var H=0;H<b.length;H++){var C=b[H];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(P,C.key,C)}}return function(P,b,H){return b&&d(P.prototype,b),H&&d(P,H),P}}(),l=j(0),k=j(9),m=j(4),a=function(P){return P&&P.__esModule?P:{default:P}}(j(14));function u(d,P){if(!(d instanceof P))throw new TypeError("Cannot call a class as a function")}function o(d,P){if(!d)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!P||typeof P!="object"&&typeof P!="function"?d:P}p.SigninState=function(d){function P(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},H=b.nonce,C=b.authority,A=b.client_id,F=b.redirect_uri,O=b.code_verifier,Y=b.response_mode,M=b.client_secret,K=b.scope,I=b.extraTokenParams,$=b.skipUserInfo;u(this,P);var et=o(this,d.call(this,arguments[0]));if(H===!0?et._nonce=(0,a.default)():H&&(et._nonce=H),O===!0?et._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():O&&(et._code_verifier=O),et.code_verifier){var ot=m.JoseUtil.hashString(et.code_verifier,"SHA256");et._code_challenge=m.JoseUtil.hexToBase64Url(ot)}return et._redirect_uri=F,et._authority=C,et._client_id=A,et._response_mode=Y,et._client_secret=M,et._scope=K,et._extraTokenParams=I,et._skipUserInfo=$,et}return function(H,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);H.prototype=Object.create(C&&C.prototype,{constructor:{value:H,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(H,C):H.__proto__=C)}(P,d),P.prototype.toStorageString=function(){return l.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},P.fromStorageString=function(H){return l.Log.debug("SigninState.fromStorageString"),new P(JSON.parse(H))},T(P,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),P}(k.State)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=function(){return(T!="undefined"&&T!==null&&T.getRandomValues!==void 0?l:k)().replace(/-/g,"")};var T=typeof window<"u"?window.crypto||window.msCrypto:null;function l(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,function(m){return(m^T.getRandomValues(new Uint8Array(1))[0]&15>>m/4).toString(16)})}function k(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,function(m){return(m^16*Math.random()>>m/4).toString(16)})}rt.exports=p.default},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.User=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.User=function(){function k(m){var a=m.id_token,u=m.session_state,o=m.access_token,d=m.refresh_token,P=m.token_type,b=m.scope,H=m.profile,C=m.expires_at,A=m.state;(function(O,Y){if(!(O instanceof Y))throw new TypeError("Cannot call a class as a function")})(this,k),this.id_token=a,this.session_state=u,this.access_token=o,this.refresh_token=d,this.token_type=P,this.scope=b,this.profile=H,this.expires_at=C,this.state=A}return k.prototype.toStorageString=function(){return l.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},k.fromStorageString=function(a){return l.Log.debug("User.fromStorageString"),new k(JSON.parse(a))},T(k,[{key:"expires_in",get:function(){if(this.expires_at){var a=parseInt(Date.now()/1e3);return this.expires_at-a}},set:function(a){var u=parseInt(a);if(typeof u=="number"&&u>0){var o=parseInt(Date.now()/1e3);this.expires_at=o+u}}},{key:"expired",get:function(){var a=this.expires_in;if(a!==void 0)return a<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.AccessTokenEvents=void 0;var T=j(0),l=j(46);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.AccessTokenEvents=function(){function m(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=a.accessTokenExpiringNotificationTime,o=u===void 0?60:u,d=a.accessTokenExpiringTimer,P=d===void 0?new l.Timer("Access token expiring"):d,b=a.accessTokenExpiredTimer,H=b===void 0?new l.Timer("Access token expired"):b;k(this,m),this._accessTokenExpiringNotificationTime=o,this._accessTokenExpiring=P,this._accessTokenExpired=H}return m.prototype.load=function(u){if(u.access_token&&u.expires_in!==void 0){var o=u.expires_in;if(T.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",o),o>0){var d=o-this._accessTokenExpiringNotificationTime;d<=0&&(d=1),T.Log.debug("AccessTokenEvents.load: registering expiring timer in:",d),this._accessTokenExpiring.init(d)}else T.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var P=o+1;T.Log.debug("AccessTokenEvents.load: registering expired timer in:",P),this._accessTokenExpired.init(P)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},m.prototype.unload=function(){T.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},m.prototype.addAccessTokenExpiring=function(u){this._accessTokenExpiring.addHandler(u)},m.prototype.removeAccessTokenExpiring=function(u){this._accessTokenExpiring.removeHandler(u)},m.prototype.addAccessTokenExpired=function(u){this._accessTokenExpired.addHandler(u)},m.prototype.removeAccessTokenExpired=function(u){this._accessTokenExpired.removeHandler(u)},m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Event=void 0;var T=j(0);p.Event=function(){function l(k){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,l),this._name=k,this._callbacks=[]}return l.prototype.addHandler=function(m){this._callbacks.push(m)},l.prototype.removeHandler=function(m){var a=this._callbacks.findIndex(function(u){return u===m});a>=0&&this._callbacks.splice(a,1)},l.prototype.raise=function(){T.Log.debug("Event: Raising event: "+this._name);for(var m=0;m<this._callbacks.length;m++){var a;(a=this._callbacks)[m].apply(a,arguments)}},l}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SessionMonitor=void 0;var T=function(){function u(o,d){for(var P=0;P<d.length;P++){var b=d[P];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(o,b.key,b)}}return function(o,d,P){return d&&u(o.prototype,d),P&&u(o,P),o}}(),l=j(0),k=j(19),m=j(1);function a(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}p.SessionMonitor=function(){function u(o){var d=this,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.CheckSessionIFrame,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.Global.timer;if(a(this,u),!o)throw l.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=o,this._CheckSessionIFrameCtor=P,this._timer=b,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then(function(H){H?d._start(H):d._settings.monitorAnonymousSession&&d._userManager.querySessionStatus().then(function(C){var A={session_state:C.session_state};C.sub&&C.sid&&(A.profile={sub:C.sub,sid:C.sid}),d._start(A)}).catch(function(C){l.Log.error("SessionMonitor ctor: error from querySessionStatus:",C.message)})}).catch(function(H){l.Log.error("SessionMonitor ctor: error from getUser:",H.message)}))}return u.prototype._start=function(d){var P=this,b=d.session_state;b&&(d.profile?(this._sub=d.profile.sub,this._sid=d.profile.sid,l.Log.debug("SessionMonitor._start: session_state:",b,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,l.Log.debug("SessionMonitor._start: session_state:",b,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(b):this._metadataService.getCheckSessionIframe().then(function(H){if(H){l.Log.debug("SessionMonitor._start: Initializing check session iframe");var C=P._client_id,A=P._checkSessionInterval,F=P._stopCheckSessionOnError;P._checkSessionIFrame=new P._CheckSessionIFrameCtor(P._callback.bind(P),C,H,A,F),P._checkSessionIFrame.load().then(function(){P._checkSessionIFrame.start(b)})}else l.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")}).catch(function(H){l.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",H.message)}))},u.prototype._stop=function(){var d=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(l.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var P=this._timer.setInterval(function(){d._timer.clearInterval(P),d._userManager.querySessionStatus().then(function(b){var H={session_state:b.session_state};b.sub&&b.sid&&(H.profile={sub:b.sub,sid:b.sid}),d._start(H)}).catch(function(b){l.Log.error("SessionMonitor: error from querySessionStatus:",b.message)})},1e3)},u.prototype._callback=function(){var d=this;this._userManager.querySessionStatus().then(function(P){var b=!0;P?P.sub===d._sub?(b=!1,d._checkSessionIFrame.start(P.session_state),P.sid===d._sid?l.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",P.session_state):(l.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",P.session_state),d._userManager.events._raiseUserSessionChanged())):l.Log.debug("SessionMonitor._callback: Different subject signed into OP:",P.sub):l.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),b&&(d._sub?(l.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),d._userManager.events._raiseUserSignedOut()):(l.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),d._userManager.events._raiseUserSignedIn()))}).catch(function(P){d._sub&&(l.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",P.message),d._userManager.events._raiseUserSignedOut())})},T(u,[{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}}]),u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CheckSessionIFrame=void 0;var T=j(0);function l(k,m){if(!(k instanceof m))throw new TypeError("Cannot call a class as a function")}p.CheckSessionIFrame=function(){function k(m,a,u,o){var d=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];l(this,k),this._callback=m,this._client_id=a,this._url=u,this._interval=o||2e3,this._stopOnError=d;var P=u.indexOf("/",u.indexOf("//")+2);this._frame_origin=u.substr(0,P),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=u}return k.prototype.load=function(){var a=this;return new Promise(function(u){a._frame.onload=function(){u()},window.document.body.appendChild(a._frame),a._boundMessageEvent=a._message.bind(a),window.addEventListener("message",a._boundMessageEvent,!1)})},k.prototype._message=function(a){a.origin===this._frame_origin&&a.source===this._frame.contentWindow&&(a.data==="error"?(T.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):a.data==="changed"?(T.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):T.Log.debug("CheckSessionIFrame: "+a.data+" message from check session op iframe"))},k.prototype.start=function(a){var u=this;if(this._session_state!==a){T.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=a;var o=function(){u._frame.contentWindow.postMessage(u._client_id+" "+u._session_state,u._frame_origin)};o(),this._timer=window.setInterval(o,this._interval)}},k.prototype.stop=function(){this._session_state=null,this._timer&&(T.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.TokenRevocationClient=void 0;var T=j(0),l=j(2),k=j(1);function m(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")}var a="access_token",u="refresh_token";p.TokenRevocationClient=function(){function o(d){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.Global.XMLHttpRequest,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService;if(m(this,o),!d)throw T.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=d,this._XMLHttpRequestCtor=P,this._metadataService=new b(this._settings)}return o.prototype.revoke=function(P,b){var H=this,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"access_token";if(!P)throw T.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(C!==a&&C!=u)throw T.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then(function(A){if(A){T.Log.debug("TokenRevocationClient.revoke: Revoking "+C);var F=H._settings.client_id,O=H._settings.client_secret;return H._revoke(A,F,O,P,C)}if(b)throw T.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")})},o.prototype._revoke=function(P,b,H,C,A){var F=this;return new Promise(function(O,Y){var M=new F._XMLHttpRequestCtor;M.open("POST",P),M.onload=function(){T.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",M.status),M.status===200?O():Y(Error(M.statusText+" ("+M.status+")"))},M.onerror=function(){T.Log.debug("TokenRevocationClient.revoke: Network Error."),Y("Network Error")};var K="client_id="+encodeURIComponent(b);H&&(K+="&client_secret="+encodeURIComponent(H)),K+="&token_type_hint="+encodeURIComponent(A),K+="&token="+encodeURIComponent(C),M.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),M.send(K)})},o}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CordovaPopupWindow=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.CordovaPopupWindow=function(){function k(m){var a=this;(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,k),this._promise=new Promise(function(u,o){a._resolve=u,a._reject=o}),this.features=m.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=m.popupWindowTarget||"_blank",this.redirect_uri=m.startUrl,l.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return k.prototype._isInAppBrowserInstalled=function(a){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some(function(u){return a.hasOwnProperty(u)})},k.prototype.navigate=function(a){if(a&&a.url){if(!window.cordova)return this._error("cordova is undefined");var u=window.cordova.require("cordova/plugin_list").metadata;if(this._isInAppBrowserInstalled(u)===!1)return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(a.url,this.target,this.features),this._popup?(l.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},k.prototype._loadStartCallback=function(a){a.url.indexOf(this.redirect_uri)===0&&this._success({url:a.url})},k.prototype._exitCallback=function(a){this._error(a)},k.prototype._success=function(a){this._cleanup(),l.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(a)},k.prototype._error=function(a){this._cleanup(),l.Log.error(a),this._reject(new Error(a))},k.prototype.close=function(){this._cleanup()},k.prototype._cleanup=function(){this._popup&&(l.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},T(k,[{key:"promise",get:function(){return this._promise}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var T=j(0),l=j(10),k=j(5),m=j(6),a=j(37),u=j(38),o=j(16),d=j(2),P=j(48),b=j(49),H=j(19),C=j(20),A=j(18),F=j(1),O=j(15),Y=j(50);p.default={Version:Y.Version,Log:T.Log,OidcClient:l.OidcClient,OidcClientSettings:k.OidcClientSettings,WebStorageStateStore:m.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:o.AccessTokenEvents,MetadataService:d.MetadataService,CordovaPopupNavigator:P.CordovaPopupNavigator,CordovaIFrameNavigator:b.CordovaIFrameNavigator,CheckSessionIFrame:H.CheckSessionIFrame,TokenRevocationClient:C.TokenRevocationClient,SessionMonitor:A.SessionMonitor,Global:F.Global,User:O.User},rt.exports=p.default},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ClockService=function(){function T(){(function(k,m){if(!(k instanceof m))throw new TypeError("Cannot call a class as a function")})(this,T)}return T.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},T}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.ResponseValidator=void 0;var T=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},l=j(0),k=j(2),m=j(25),a=j(11),u=j(12),o=j(4);function d(b,H){if(!(b instanceof H))throw new TypeError("Cannot call a class as a function")}var P=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];p.ResponseValidator=function(){function b(H){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.MetadataService,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.UserInfoService,F=arguments.length>3&&arguments[3]!==void 0?arguments[3]:o.JoseUtil,O=arguments.length>4&&arguments[4]!==void 0?arguments[4]:a.TokenClient;if(d(this,b),!H)throw l.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=H,this._metadataService=new C(this._settings),this._userInfoService=new A(this._settings),this._joseUtil=F,this._tokenClient=new O(this._settings)}return b.prototype.validateSigninResponse=function(C,A){var F=this;return l.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(C,A).then(function(O){return l.Log.debug("ResponseValidator.validateSigninResponse: state processed"),F._validateTokens(C,O).then(function(Y){return l.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),F._processClaims(C,Y).then(function(M){return l.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),M})})})},b.prototype.validateSignoutResponse=function(C,A){return C.id!==A.state?(l.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(l.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),A.state=C.data,A.error?(l.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",A.error),Promise.reject(new u.ErrorResponse(A))):Promise.resolve(A))},b.prototype._processSigninParams=function(C,A){if(C.id!==A.state)return l.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!C.client_id)return l.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!C.authority)return l.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!==C.authority)return l.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=C.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==C.client_id)return l.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=C.client_id;return l.Log.debug("ResponseValidator._processSigninParams: state validated"),A.state=C.data,A.error?(l.Log.warn("ResponseValidator._processSigninParams: Response was error",A.error),Promise.reject(new u.ErrorResponse(A))):C.nonce&&!A.id_token?(l.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!C.nonce&&A.id_token?(l.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):C.code_verifier&&!A.code?(l.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!C.code_verifier&&A.code?(l.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(A.scope||(A.scope=C.scope),Promise.resolve(A))},b.prototype._processClaims=function(C,A){var F=this;if(A.isOpenIdConnect){if(l.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),A.profile=this._filterProtocolClaims(A.profile),C.skipUserInfo!==!0&&this._settings.loadUserInfo&&A.access_token)return l.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(A.access_token).then(function(O){return l.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),O.sub!==A.profile.sub?(l.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(A.profile=F._mergeClaims(A.profile,O),l.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",A.profile),A)});l.Log.debug("ResponseValidator._processClaims: not loading user info")}else l.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(A)},b.prototype._mergeClaims=function(C,A){var F=Object.assign({},C);for(var O in A){var Y=A[O];Array.isArray(Y)||(Y=[Y]);for(var M=0;M<Y.length;M++){var K=Y[M];F[O]?Array.isArray(F[O])?F[O].indexOf(K)<0&&F[O].push(K):F[O]!==K&&((K===void 0?"undefined":T(K))==="object"&&this._settings.mergeClaims?F[O]=this._mergeClaims(F[O],K):F[O]=[F[O],K]):F[O]=K}}return F},b.prototype._filterProtocolClaims=function(C){l.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",C);var A=Object.assign({},C);return this._settings._filterProtocolClaims?(P.forEach(function(F){delete A[F]}),l.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",A)):l.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),A},b.prototype._validateTokens=function(C,A){return A.code?(l.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(C,A)):A.id_token?A.access_token?(l.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(C,A)):(l.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(C,A)):(l.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(A))},b.prototype._processCode=function(C,A){var F=this,O={client_id:C.client_id,client_secret:C.client_secret,code:A.code,redirect_uri:C.redirect_uri,code_verifier:C.code_verifier};return C.extraTokenParams&&T(C.extraTokenParams)==="object"&&Object.assign(O,C.extraTokenParams),this._tokenClient.exchangeCode(O).then(function(Y){for(var M in Y)A[M]=Y[M];return A.id_token?(l.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),F._validateIdTokenAttributes(C,A)):(l.Log.debug("ResponseValidator._processCode: token response successful, returning response"),A)})},b.prototype._validateIdTokenAttributes=function(C,A){var F=this;return this._metadataService.getIssuer().then(function(O){var Y=C.client_id,M=F._settings.clockSkew;return l.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",M),F._settings.getEpochTime().then(function(K){return F._joseUtil.validateJwtAttributes(A.id_token,O,Y,M,K).then(function(I){return C.nonce&&C.nonce!==I.nonce?(l.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):I.sub?(A.profile=I,A):(l.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})})},b.prototype._validateIdTokenAndAccessToken=function(C,A){var F=this;return this._validateIdToken(C,A).then(function(O){return F._validateAccessToken(O)})},b.prototype._getSigningKeyForJwt=function(C){var A=this;return this._metadataService.getSigningKeys().then(function(F){var O=C.header.kid;if(!F)return l.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));l.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var Y=void 0;if(O)Y=F.filter(function(M){return M.kid===O})[0];else{if((F=A._filterByAlg(F,C.header.alg)).length>1)return l.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"));Y=F[0]}return Promise.resolve(Y)})},b.prototype._getSigningKeyForJwtWithSingleRetry=function(C){var A=this;return this._getSigningKeyForJwt(C).then(function(F){return F?Promise.resolve(F):(A._metadataService.resetSigningKeys(),A._getSigningKeyForJwt(C))})},b.prototype._validateIdToken=function(C,A){var F=this;if(!C.nonce)return l.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var O=this._joseUtil.parseJwt(A.id_token);return O&&O.header&&O.payload?C.nonce!==O.payload.nonce?(l.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then(function(Y){return l.Log.debug("ResponseValidator._validateIdToken: Received issuer"),F._getSigningKeyForJwtWithSingleRetry(O).then(function(M){if(!M)return l.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 K=C.client_id,I=F._settings.clockSkew;return l.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",I),F._joseUtil.validateJwt(A.id_token,M,Y,K,I).then(function(){return l.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),O.payload.sub?(A.profile=O.payload,A):(l.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))})})}):(l.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",O),Promise.reject(new Error("Failed to parse id_token")))},b.prototype._filterByAlg=function(C,A){var F=null;if(A.startsWith("RS"))F="RSA";else if(A.startsWith("PS"))F="PS";else{if(!A.startsWith("ES"))return l.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",A),[];F="EC"}return l.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",F),C=C.filter(function(O){return O.kty===F}),l.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",F,C.length),C},b.prototype._validateAccessToken=function(C){if(!C.profile)return l.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!C.profile.at_hash)return l.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!C.id_token)return l.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var A=this._joseUtil.parseJwt(C.id_token);if(!A||!A.header)return l.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",A),Promise.reject(new Error("Failed to parse id_token"));var F=A.header.alg;if(!F||F.length!==5)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F),Promise.reject(new Error("Unsupported alg: "+F));var O=F.substr(2,3);if(!O)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,O),Promise.reject(new Error("Unsupported alg: "+F));if((O=parseInt(O))!==256&&O!==384&&O!==512)return l.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",F,O),Promise.reject(new Error("Unsupported alg: "+F));var Y="sha"+O,M=this._joseUtil.hashString(C.access_token,Y);if(!M)return l.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",Y),Promise.reject(new Error("Failed to validate at_hash"));var K=M.substr(0,M.length/2),I=this._joseUtil.hexToBase64Url(K);return I!==C.profile.at_hash?(l.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",I,C.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(l.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(C))},b}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UserInfoService=void 0;var T=j(7),l=j(2),k=j(0),m=j(4);function a(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")}p.UserInfoService=function(){function u(o){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T.JsonService,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l.MetadataService,b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:m.JoseUtil;if(a(this,u),!o)throw k.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=o,this._jsonService=new d(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new P(this._settings),this._joseUtil=b}return u.prototype.getClaims=function(d){var P=this;return d?this._metadataService.getUserInfoEndpoint().then(function(b){return k.Log.debug("UserInfoService.getClaims: received userinfo url",b),P._jsonService.getJson(b,d).then(function(H){return k.Log.debug("UserInfoService.getClaims: claims received",H),H})}):(k.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},u.prototype._getClaimsFromJwt=function(d){var P=this;try{var b=this._joseUtil.parseJwt(d.responseText);if(!b||!b.header||!b.payload)return k.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",b),Promise.reject(new Error("Failed to parse id_token"));var H=b.header.kid,C=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":C=this._metadataService.getIssuer();break;case"ANY":C=Promise.resolve(b.payload.iss);break;default:C=Promise.resolve(this._settings.userInfoJwtIssuer)}return C.then(function(A){return k.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+A),P._metadataService.getSigningKeys().then(function(F){if(!F)return k.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));k.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var O=void 0;if(H)O=F.filter(function(K){return K.kid===H})[0];else{if((F=P._filterByAlg(F,b.header.alg)).length>1)return k.Log.error("UserInfoService._getClaimsFromJwt: 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"));O=F[0]}if(!O)return k.Log.error("UserInfoService._getClaimsFromJwt: 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 Y=P._settings.client_id,M=P._settings.clockSkew;return k.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",M),P._joseUtil.validateJwt(d.responseText,O,A,Y,M,void 0,!0).then(function(){return k.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),b.payload})})})}catch(A){return k.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",A.message),void reject(A)}},u.prototype._filterByAlg=function(d,P){var b=null;if(P.startsWith("RS"))b="RSA";else if(P.startsWith("PS"))b="PS";else{if(!P.startsWith("ES"))return k.Log.debug("UserInfoService._filterByAlg: alg not supported: ",P),[];b="EC"}return k.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",b),d=d.filter(function(H){return H.kty===b}),k.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",b,d.length),d},u}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.AllowedSigningAlgs=p.b64tohex=p.hextob64u=p.crypto=p.X509=p.KeyUtil=p.jws=void 0;var T=j(27);p.jws=T.jws,p.KeyUtil=T.KEYUTIL,p.X509=T.X509,p.crypto=T.crypto,p.hextob64u=T.hextob64u,p.b64tohex=T.b64tohex,p.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(rt,p,j){"use strict";(function(T){Object.defineProperty(p,"__esModule",{value:!0});var l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k={userAgent:!1},m={};if(a===void 0)var a={};a.lang={extend:function(t,r,n){if(!r||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var i=function(){};if(i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=r.prototype,r.prototype.constructor==Object.prototype.constructor&&(r.prototype.constructor=r),n){var s;for(s in n)t.prototype[s]=n[s];var f=function(){},S=["toString","valueOf"];try{/MSIE/.test(k.userAgent)&&(f=function(_,w){for(s=0;s<S.length;s+=1){var x=S[s],D=w[x];typeof D=="function"&&D!=Object.prototype[x]&&(_[x]=D)}})}catch{}f(t.prototype,n)}}};var u,o,d,P,b,H,C,A,F,O,Y,M=M||(u=Math,d=(o={}).lib={},P=d.Base=function(){function e(){}return{extend:function(r){e.prototype=this;var n=new e;return r&&n.mixIn(r),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);r.hasOwnProperty("toString")&&(this.toString=r.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),b=d.WordArray=P.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r??4*t.length},toString:function(t){return(t||C).stringify(this)},concat:function(t){var r=this.words,n=t.words,i=this.sigBytes,s=t.sigBytes;if(this.clamp(),i%4)for(var f=0;f<s;f++){var S=n[f>>>2]>>>24-f%4*8&255;r[i+f>>>2]|=S<<24-(i+f)%4*8}else for(f=0;f<s;f+=4)r[i+f>>>2]=n[f>>>2];return this.sigBytes+=s,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=u.ceil(r/4)},clone:function(){var t=P.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],n=0;n<t;n+=4)r.push(4294967296*u.random()|0);return new b.init(r,t)}}),H=o.enc={},C=H.Hex={stringify:function(t){for(var r=t.words,n=t.sigBytes,i=[],s=0;s<n;s++){var f=r[s>>>2]>>>24-s%4*8&255;i.push((f>>>4).toString(16)),i.push((15&f).toString(16))}return i.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i+=2)n[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new b.init(n,r/2)}},A=H.Latin1={stringify:function(t){for(var r=t.words,n=t.sigBytes,i=[],s=0;s<n;s++){var f=r[s>>>2]>>>24-s%4*8&255;i.push(String.fromCharCode(f))}return i.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new b.init(n,r)}},F=H.Utf8={stringify:function(t){try{return decodeURIComponent(escape(A.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return A.parse(unescape(encodeURIComponent(t)))}},O=d.BufferedBlockAlgorithm=P.extend({reset:function(){this._data=new b.init,this._nDataBytes=0},_append:function(t){typeof t=="string"&&(t=F.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var r=this._data,n=r.words,i=r.sigBytes,s=this.blockSize,f=i/(4*s),S=(f=t?u.ceil(f):u.max((0|f)-this._minBufferSize,0))*s,y=u.min(4*S,i);if(S){for(var _=0;_<S;_+=s)this._doProcessBlock(n,_);var w=n.splice(0,S);r.sigBytes-=y}return new b.init(w,y)},clone:function(){var t=P.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),d.Hasher=O.extend({cfg:P.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){O.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(r,n){return new t.init(n).finalize(r)}},_createHmacHelper:function(t){return function(r,n){return new Y.HMAC.init(t,n).finalize(r)}}}),Y=o.algo={},o);(function(e){var t,r=(t=M).lib,n=r.Base,i=r.WordArray;(t=t.x64={}).Word=n.extend({init:function(f,S){this.high=f,this.low=S}}),t.WordArray=n.extend({init:function(f,S){f=this.words=f||[],this.sigBytes=S??8*f.length},toX32:function(){for(var f=this.words,S=f.length,y=[],_=0;_<S;_++){var w=f[_];y.push(w.high),y.push(w.low)}return i.create(y,this.sigBytes)},clone:function(){for(var f=n.clone.call(this),S=f.words=this.words.slice(0),y=S.length,_=0;_<y;_++)S[_]=S[_].clone();return f}})})(),function(){var e=M,t=e.lib.WordArray;e.enc.Base64={stringify:function(n){var i=n.words,s=n.sigBytes,f=this._map;n.clamp(),n=[];for(var S=0;S<s;S+=3)for(var y=(i[S>>>2]>>>24-S%4*8&255)<<16|(i[S+1>>>2]>>>24-(S+1)%4*8&255)<<8|i[S+2>>>2]>>>24-(S+2)%4*8&255,_=0;4>_&&S+.75*_<s;_++)n.push(f.charAt(y>>>6*(3-_)&63));if(i=f.charAt(64))for(;n.length%4;)n.push(i);return n.join("")},parse:function(n){var i=n.length,s=this._map;(f=s.charAt(64))&&(f=n.indexOf(f))!=-1&&(i=f);for(var f=[],S=0,y=0;y<i;y++)if(y%4){var _=s.indexOf(n.charAt(y-1))<<y%4*2,w=s.indexOf(n.charAt(y))>>>6-y%4*2;f[S>>>2]|=(_|w)<<24-S%4*8,S++}return t.create(f,S)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){for(var t=M,r=(i=t.lib).WordArray,n=i.Hasher,i=t.algo,s=[],f=[],S=function(G){return 4294967296*(G-(0|G))|0},y=2,_=0;64>_;){var w;t:{w=y;for(var x=e.sqrt(w),D=2;D<=x;D++)if(!(w%D)){w=!1;break t}w=!0}w&&(8>_&&(s[_]=S(e.pow(y,.5))),f[_]=S(e.pow(y,1/3)),_++),y++}var V=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(G,X){for(var g=this._hash.words,E=g[0],R=g[1],L=g[2],z=g[3],Q=g[4],ut=g[5],tt=g[6],gt=g[7],st=0;64>st;st++){if(16>st)V[st]=0|G[X+st];else{var ct=V[st-15],St=V[st-2];V[st]=((ct<<25|ct>>>7)^(ct<<14|ct>>>18)^ct>>>3)+V[st-7]+((St<<15|St>>>17)^(St<<13|St>>>19)^St>>>10)+V[st-16]}ct=gt+((Q<<26|Q>>>6)^(Q<<21|Q>>>11)^(Q<<7|Q>>>25))+(Q&ut^~Q&tt)+f[st]+V[st],St=((E<<30|E>>>2)^(E<<19|E>>>13)^(E<<10|E>>>22))+(E&R^E&L^R&L),gt=tt,tt=ut,ut=Q,Q=z+ct|0,z=L,L=R,R=E,E=ct+St|0}g[0]=g[0]+E|0,g[1]=g[1]+R|0,g[2]=g[2]+L|0,g[3]=g[3]+z|0,g[4]=g[4]+Q|0,g[5]=g[5]+ut|0,g[6]=g[6]+tt|0,g[7]=g[7]+gt|0},_doFinalize:function(){var G=this._data,X=G.words,g=8*this._nDataBytes,E=8*G.sigBytes;return X[E>>>5]|=128<<24-E%32,X[14+(E+64>>>9<<4)]=e.floor(g/4294967296),X[15+(E+64>>>9<<4)]=g,G.sigBytes=4*X.length,this._process(),this._hash},clone:function(){var G=n.clone.call(this);return G._hash=this._hash.clone(),G}}),t.SHA256=n._createHelper(i),t.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function e(){return n.create.apply(n,arguments)}for(var t=M,r=t.lib.Hasher,n=(s=t.x64).Word,i=s.WordArray,s=t.algo,f=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],S=[],y=0;80>y;y++)S[y]=e();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(w,x){for(var D=(R=this._hash.words)[0],V=R[1],W=R[2],G=R[3],X=R[4],g=R[5],E=R[6],R=R[7],L=D.high,z=D.low,Q=V.high,ut=V.low,tt=W.high,gt=W.low,st=G.high,ct=G.low,St=X.high,Ft=X.low,wt=g.high,Qt=g.low,Ht=E.high,qt=E.low,Ct=R.high,Lt=R.low,Bt=L,Jt=z,Ee=Q,me=ut,xe=tt,_e=gt,qe=st,Ae=ct,se=St,re=Ft,Ue=wt,ke=Qt,Oe=Ht,Pe=qt,Je=Ct,Ce=Lt,ae=0;80>ae;ae++){var pe=S[ae];if(16>ae)var fe=pe.high=0|w[x+2*ae],Et=pe.low=0|w[x+2*ae+1];else{fe=((Et=(fe=S[ae-15]).high)>>>1|(ge=fe.low)<<31)^(Et>>>8|ge<<24)^Et>>>7;var ge=(ge>>>1|Et<<31)^(ge>>>8|Et<<24)^(ge>>>7|Et<<25),Se=((Et=(Se=S[ae-2]).high)>>>19|(Nt=Se.low)<<13)^(Et<<3|Nt>>>29)^Et>>>6,Nt=(Nt>>>19|Et<<13)^(Nt<<3|Et>>>29)^(Nt>>>6|Et<<26),We=(Et=S[ae-7]).high,ve=(ye=S[ae-16]).high,ye=ye.low;fe=(fe=(fe=fe+We+((Et=ge+Et.low)>>>0<ge>>>0?1:0))+Se+((Et=Et+Nt)>>>0<Nt>>>0?1:0))+ve+((Et=Et+ye)>>>0<ye>>>0?1:0),pe.high=fe,pe.low=Et}We=se&Ue^~se&Oe,ye=re&ke^~re&Pe,pe=Bt&Ee^Bt&xe^Ee&xe;var Er=Jt&me^Jt&_e^me&_e,xr=(ge=(Bt>>>28|Jt<<4)^(Bt<<30|Jt>>>2)^(Bt<<25|Jt>>>7),Se=(Jt>>>28|Bt<<4)^(Jt<<30|Bt>>>2)^(Jt<<25|Bt>>>7),(Nt=f[ae]).high),ur=Nt.low;ve=Je+((se>>>14|re<<18)^(se>>>18|re<<14)^(se<<23|re>>>9))+((Nt=Ce+((re>>>14|se<<18)^(re>>>18|se<<14)^(re<<23|se>>>9)))>>>0<Ce>>>0?1:0),Je=Oe,Ce=Pe,Oe=Ue,Pe=ke,Ue=se,ke=re,se=qe+(ve=(ve=(ve=ve+We+((Nt=Nt+ye)>>>0<ye>>>0?1:0))+xr+((Nt=Nt+ur)>>>0<ur>>>0?1:0))+fe+((Nt=Nt+Et)>>>0<Et>>>0?1:0))+((re=Ae+Nt|0)>>>0<Ae>>>0?1:0)|0,qe=xe,Ae=_e,xe=Ee,_e=me,Ee=Bt,me=Jt,Bt=ve+(pe=ge+pe+((Et=Se+Er)>>>0<Se>>>0?1:0))+((Jt=Nt+Et|0)>>>0<Nt>>>0?1:0)|0}z=D.low=z+Jt,D.high=L+Bt+(z>>>0<Jt>>>0?1:0),ut=V.low=ut+me,V.high=Q+Ee+(ut>>>0<me>>>0?1:0),gt=W.low=gt+_e,W.high=tt+xe+(gt>>>0<_e>>>0?1:0),ct=G.low=ct+Ae,G.high=st+qe+(ct>>>0<Ae>>>0?1:0),Ft=X.low=Ft+re,X.high=St+se+(Ft>>>0<re>>>0?1:0),Qt=g.low=Qt+ke,g.high=wt+Ue+(Qt>>>0<ke>>>0?1:0),qt=E.low=qt+Pe,E.high=Ht+Oe+(qt>>>0<Pe>>>0?1:0),Lt=R.low=Lt+Ce,R.high=Ct+Je+(Lt>>>0<Ce>>>0?1:0)},_doFinalize:function(){var w=this._data,x=w.words,D=8*this._nDataBytes,V=8*w.sigBytes;return x[V>>>5]|=128<<24-V%32,x[30+(V+128>>>10<<5)]=Math.floor(D/4294967296),x[31+(V+128>>>10<<5)]=D,w.sigBytes=4*x.length,this._process(),this._hash.toX32()},clone:function(){var w=r.clone.call(this);return w._hash=this._hash.clone(),w},blockSize:32}),t.SHA512=r._createHelper(s),t.HmacSHA512=r._createHmacHelper(s)}(),function(){var e=M,t=(i=e.x64).Word,r=i.WordArray,n=(i=e.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var f=n._doFinalize.call(this);return f.sigBytes-=16,f}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)}();var K,I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function $(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=I.charAt(r>>6)+I.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=I.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=I.charAt(r>>2)+I.charAt((3&r)<<4)),"=";(3&n.length)>0;)n+="=";return n}function et(e){var t,r,n,i="",s=0;for(t=0;t<e.length&&e.charAt(t)!="=";++t)(n=I.indexOf(e.charAt(t)))<0||(s==0?(i+=xt(n>>2),r=3&n,s=1):s==1?(i+=xt(r<<2|n>>4),r=15&n,s=2):s==2?(i+=xt(r),i+=xt(n>>2),r=3&n,s=3):(i+=xt(r<<2|n>>4),i+=xt(15&n),s=0));return s==1&&(i+=xt(r<<2)),i}function ot(e){var t,r=et(e),n=new Array;for(t=0;2*t<r.length;++t)n[t]=parseInt(r.substring(2*t,2*t+2),16);return n}function B(e,t,r){e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function nt(){return new B(null)}k.appName=="Microsoft Internet Explorer"?(B.prototype.am=function(t,r,n,i,s,f){for(var S=32767&r,y=r>>15;--f>=0;){var _=32767&this[t],w=this[t++]>>15,x=y*_+w*S;s=((_=S*_+((32767&x)<<15)+n[i]+(1073741823&s))>>>30)+(x>>>15)+y*w+(s>>>30),n[i++]=1073741823&_}return s},K=30):k.appName!="Netscape"?(B.prototype.am=function(t,r,n,i,s,f){for(;--f>=0;){var S=r*this[t++]+n[i]+s;s=Math.floor(S/67108864),n[i++]=67108863&S}return s},K=26):(B.prototype.am=function(t,r,n,i,s,f){for(var S=16383&r,y=r>>14;--f>=0;){var _=16383&this[t],w=this[t++]>>14,x=y*_+w*S;s=((_=S*_+((16383&x)<<14)+n[i]+s)>>28)+(x>>14)+y*w,n[i++]=268435455&_}return s},K=28),B.prototype.DB=K,B.prototype.DM=(1<<K)-1,B.prototype.DV=1<<K,B.prototype.FV=Math.pow(2,52),B.prototype.F1=52-K,B.prototype.F2=2*K-52;var ft,dt,jt=new Array;for(ft=48,dt=0;dt<=9;++dt)jt[ft++]=dt;for(ft=97,dt=10;dt<36;++dt)jt[ft++]=dt;for(ft=65,dt=10;dt<36;++dt)jt[ft++]=dt;function xt(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Zt(e,t){var r=jt[e.charCodeAt(t)];return r??-1}function Tt(e){var t=nt();return t.fromInt(e),t}function pt(e){var t,r=1;return(t=e>>>16)!=0&&(e=t,r+=16),(t=e>>8)!=0&&(e=t,r+=8),(t=e>>4)!=0&&(e=t,r+=4),(t=e>>2)!=0&&(e=t,r+=2),(t=e>>1)!=0&&(e=t,r+=1),r}function vt(e){this.m=e}function At(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Wt(e,t){return e&t}function Vt(e,t){return e|t}function zt(e,t){return e^t}function $t(e,t){return e&~t}function he(e){if(e==0)return-1;var t=0;return(65535&e)==0&&(e>>=16,t+=16),(255&e)==0&&(e>>=8,t+=8),(15&e)==0&&(e>>=4,t+=4),(3&e)==0&&(e>>=2,t+=2),(1&e)==0&&++t,t}function ee(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Ut(){}function Yt(e){return e}function Kt(e){this.r2=nt(),this.q3=nt(),B.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}vt.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},vt.prototype.revert=function(t){return t},vt.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},vt.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},vt.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},At.prototype.convert=function(t){var r=nt();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(B.ZERO)>0&&this.m.subTo(r,r),r},At.prototype.revert=function(t){var r=nt();return t.copyTo(r),this.reduce(r),r},At.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var n=32767&t[r],i=n*this.mpl+((n*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},At.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},At.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},B.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},B.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},B.prototype.fromString=function(t,r){var n;if(r==16)n=4;else if(r==8)n=3;else if(r==256)n=8;else if(r==2)n=1;else if(r==32)n=5;else{if(r!=4)return void this.fromRadix(t,r);n=2}this.t=0,this.s=0;for(var i=t.length,s=!1,f=0;--i>=0;){var S=n==8?255&t[i]:Zt(t,i);S<0?t.charAt(i)=="-"&&(s=!0):(s=!1,f==0?this[this.t++]=S:f+n>this.DB?(this[this.t-1]|=(S&(1<<this.DB-f)-1)<<f,this[this.t++]=S>>this.DB-f):this[this.t-1]|=S<<f,(f+=n)>=this.DB&&(f-=this.DB))}n==8&&(128&t[0])!=0&&(this.s=-1,f>0&&(this[this.t-1]|=(1<<this.DB-f)-1<<f)),this.clamp(),s&&B.ZERO.subTo(this,this)},B.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},B.prototype.dlShiftTo=function(t,r){var n;for(n=this.t-1;n>=0;--n)r[n+t]=this[n];for(n=t-1;n>=0;--n)r[n]=0;r.t=this.t+t,r.s=this.s},B.prototype.drShiftTo=function(t,r){for(var n=t;n<this.t;++n)r[n-t]=this[n];r.t=Math.max(this.t-t,0),r.s=this.s},B.prototype.lShiftTo=function(t,r){var n,i=t%this.DB,s=this.DB-i,f=(1<<s)-1,S=Math.floor(t/this.DB),y=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)r[n+S+1]=this[n]>>s|y,y=(this[n]&f)<<i;for(n=S-1;n>=0;--n)r[n]=0;r[S]=y,r.t=this.t+S+1,r.s=this.s,r.clamp()},B.prototype.rShiftTo=function(t,r){r.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)r.t=0;else{var i=t%this.DB,s=this.DB-i,f=(1<<i)-1;r[0]=this[n]>>i;for(var S=n+1;S<this.t;++S)r[S-n-1]|=(this[S]&f)<<s,r[S-n]=this[S]>>i;i>0&&(r[this.t-n-1]|=(this.s&f)<<s),r.t=this.t-n,r.clamp()}},B.prototype.subTo=function(t,r){for(var n=0,i=0,s=Math.min(t.t,this.t);n<s;)i+=this[n]-t[n],r[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;n<this.t;)i+=this[n],r[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i-=t[n],r[n++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[n++]=this.DV+i:i>0&&(r[n++]=i),r.t=n,r.clamp()},B.prototype.multiplyTo=function(t,r){var n=this.abs(),i=t.abs(),s=n.t;for(r.t=s+i.t;--s>=0;)r[s]=0;for(s=0;s<i.t;++s)r[s+n.t]=n.am(0,i[s],r,s,0,n.t);r.s=0,r.clamp(),this.s!=t.s&&B.ZERO.subTo(r,r)},B.prototype.squareTo=function(t){for(var r=this.abs(),n=t.t=2*r.t;--n>=0;)t[n]=0;for(n=0;n<r.t-1;++n){var i=r.am(n,r[n],t,2*n,0,1);(t[n+r.t]+=r.am(n+1,2*r[n],t,2*n+1,i,r.t-n-1))>=r.DV&&(t[n+r.t]-=r.DV,t[n+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(n,r[n],t,2*n,0,1)),t.s=0,t.clamp()},B.prototype.divRemTo=function(t,r,n){var i=t.abs();if(!(i.t<=0)){var s=this.abs();if(s.t<i.t)return r?.fromInt(0),void(n!=null&&this.copyTo(n));n==null&&(n=nt());var f=nt(),S=this.s,y=t.s,_=this.DB-pt(i[i.t-1]);_>0?(i.lShiftTo(_,f),s.lShiftTo(_,n)):(i.copyTo(f),s.copyTo(n));var w=f.t,x=f[w-1];if(x!=0){var D=x*(1<<this.F1)+(w>1?f[w-2]>>this.F2:0),V=this.FV/D,W=(1<<this.F1)/D,G=1<<this.F2,X=n.t,g=X-w,E=r??nt();for(f.dlShiftTo(g,E),n.compareTo(E)>=0&&(n[n.t++]=1,n.subTo(E,n)),B.ONE.dlShiftTo(w,E),E.subTo(f,f);f.t<w;)f[f.t++]=0;for(;--g>=0;){var R=n[--X]==x?this.DM:Math.floor(n[X]*V+(n[X-1]+G)*W);if((n[X]+=f.am(0,R,n,g,0,w))<R)for(f.dlShiftTo(g,E),n.subTo(E,n);n[X]<--R;)n.subTo(E,n)}r!=null&&(n.drShiftTo(w,r),S!=y&&B.ZERO.subTo(r,r)),n.t=w,n.clamp(),_>0&&n.rShiftTo(_,n),S<0&&B.ZERO.subTo(n,n)}}},B.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if((1&t)==0)return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},B.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},B.prototype.exp=function(t,r){if(t>4294967295||t<1)return B.ONE;var n=nt(),i=nt(),s=r.convert(this),f=pt(t)-1;for(s.copyTo(n);--f>=0;)if(r.sqrTo(n,i),(t&1<<f)>0)r.mulTo(i,s,n);else{var S=n;n=i,i=S}return r.revert(n)},B.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(t==16)r=4;else if(t==8)r=3;else if(t==2)r=1;else if(t==32)r=5;else{if(t!=4)return this.toRadix(t);r=2}var n,i=(1<<r)-1,s=!1,f="",S=this.t,y=this.DB-S*this.DB%r;if(S-- >0)for(y<this.DB&&(n=this[S]>>y)>0&&(s=!0,f=xt(n));S>=0;)y<r?(n=(this[S]&(1<<y)-1)<<r-y,n|=this[--S]>>(y+=this.DB-r)):(n=this[S]>>(y-=r)&i,y<=0&&(y+=this.DB,--S)),n>0&&(s=!0),s&&(f+=xt(n));return s?f:"0"},B.prototype.negate=function(){var t=nt();return B.ZERO.subTo(this,t),t},B.prototype.abs=function(){return this.s<0?this.negate():this},B.prototype.compareTo=function(t){var r=this.s-t.s;if(r!=0)return r;var n=this.t;if((r=n-t.t)!=0)return this.s<0?-r:r;for(;--n>=0;)if((r=this[n]-t[n])!=0)return r;return 0},B.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+pt(this[this.t-1]^this.s&this.DM)},B.prototype.mod=function(t){var r=nt();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(B.ZERO)>0&&t.subTo(r,r),r},B.prototype.modPowInt=function(t,r){var n;return n=t<256||r.isEven()?new vt(r):new At(r),this.exp(t,n)},B.ZERO=Tt(0),B.ONE=Tt(1),Ut.prototype.convert=Yt,Ut.prototype.revert=Yt,Ut.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n)},Ut.prototype.sqrTo=function(t,r){t.squareTo(r)},Kt.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 r=nt();return t.copyTo(r),this.reduce(r),r},Kt.prototype.revert=function(t){return t},Kt.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)},Kt.prototype.mulTo=function(t,r,n){t.multiplyTo(r,n),this.reduce(n)},Kt.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var U=[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],c=(1<<26)/U[U.length-1];function h(){this.i=0,this.j=0,this.S=new Array}B.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},B.prototype.toRadix=function(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var r=this.chunkSize(t),n=Math.pow(t,r),i=Tt(n),s=nt(),f=nt(),S="";for(this.divRemTo(i,s,f);s.signum()>0;)S=(n+f.intValue()).toString(t).substr(1)+S,s.divRemTo(i,s,f);return f.intValue().toString(t)+S},B.prototype.fromRadix=function(t,r){this.fromInt(0),r==null&&(r=10);for(var n=this.chunkSize(r),i=Math.pow(r,n),s=!1,f=0,S=0,y=0;y<t.length;++y){var _=Zt(t,y);_<0?t.charAt(y)=="-"&&this.signum()==0&&(s=!0):(S=r*S+_,++f>=n&&(this.dMultiply(i),this.dAddOffset(S,0),f=0,S=0))}f>0&&(this.dMultiply(Math.pow(r,f)),this.dAddOffset(S,0)),s&&B.ZERO.subTo(this,this)},B.prototype.fromNumber=function(t,r,n){if(typeof r=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(B.ONE.shiftLeft(t-1),Vt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(B.ONE.shiftLeft(t-1),this);else{var i=new Array,s=7&t;i.length=1+(t>>3),r.nextBytes(i),s>0?i[0]&=(1<<s)-1:i[0]=0,this.fromString(i,256)}},B.prototype.bitwiseTo=function(t,r,n){var i,s,f=Math.min(t.t,this.t);for(i=0;i<f;++i)n[i]=r(this[i],t[i]);if(t.t<this.t){for(s=t.s&this.DM,i=f;i<this.t;++i)n[i]=r(this[i],s);n.t=this.t}else{for(s=this.s&this.DM,i=f;i<t.t;++i)n[i]=r(s,t[i]);n.t=t.t}n.s=r(this.s,t.s),n.clamp()},B.prototype.changeBit=function(t,r){var n=B.ONE.shiftLeft(t);return this.bitwiseTo(n,r,n),n},B.prototype.addTo=function(t,r){for(var n=0,i=0,s=Math.min(t.t,this.t);n<s;)i+=this[n]+t[n],r[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;n<this.t;)i+=this[n],r[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i+=t[n],r[n++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[n++]=i:i<-1&&(r[n++]=this.DV+i),r.t=n,r.clamp()},B.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},B.prototype.dAddOffset=function(t,r){if(t!=0){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},B.prototype.multiplyLowerTo=function(t,r,n){var i,s=Math.min(this.t+t.t,r);for(n.s=0,n.t=s;s>0;)n[--s]=0;for(i=n.t-this.t;s<i;++s)n[s+this.t]=this.am(0,t[s],n,s,0,this.t);for(i=Math.min(t.t,r);s<i;++s)this.am(0,t[s],n,s,0,r-s);n.clamp()},B.prototype.multiplyUpperTo=function(t,r,n){--r;var i=n.t=this.t+t.t-r;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)n[this.t+i-r]=this.am(r-i,t[i],n,0,0,this.t+i-r);n.clamp(),n.drShiftTo(1,n)},B.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(r==0)n=this[0]%t;else for(var i=this.t-1;i>=0;--i)n=(r*n+this[i])%t;return n},B.prototype.millerRabin=function(t){var r=this.subtract(B.ONE),n=r.getLowestSetBit();if(n<=0)return!1;var i=r.shiftRight(n);(t=t+1>>1)>U.length&&(t=U.length);for(var s=nt(),f=0;f<t;++f){s.fromInt(U[Math.floor(Math.random()*U.length)]);var S=s.modPow(i,this);if(S.compareTo(B.ONE)!=0&&S.compareTo(r)!=0){for(var y=1;y++<n&&S.compareTo(r)!=0;)if((S=S.modPowInt(2,this)).compareTo(B.ONE)==0)return!1;if(S.compareTo(r)!=0)return!1}}return!0},B.prototype.clone=function(){var t=nt();return this.copyTo(t),t},B.prototype.intValue=function(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},B.prototype.byteValue=function(){return this.t==0?this.s:this[0]<<24>>24},B.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16},B.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1},B.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var n,i=this.DB-t*this.DB%8,s=0;if(t-- >0)for(i<this.DB&&(n=this[t]>>i)!=(this.s&this.DM)>>i&&(r[s++]=n|this.s<<this.DB-i);t>=0;)i<8?(n=(this[t]&(1<<i)-1)<<8-i,n|=this[--t]>>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),(128&n)!=0&&(n|=-256),s==0&&(128&this.s)!=(128&n)&&++s,(s>0||n!=this.s)&&(r[s++]=n);return r},B.prototype.equals=function(t){return this.compareTo(t)==0},B.prototype.min=function(t){return this.compareTo(t)<0?this:t},B.prototype.max=function(t){return this.compareTo(t)>0?this:t},B.prototype.and=function(t){var r=nt();return this.bitwiseTo(t,Wt,r),r},B.prototype.or=function(t){var r=nt();return this.bitwiseTo(t,Vt,r),r},B.prototype.xor=function(t){var r=nt();return this.bitwiseTo(t,zt,r),r},B.prototype.andNot=function(t){var r=nt();return this.bitwiseTo(t,$t,r),r},B.prototype.not=function(){for(var t=nt(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},B.prototype.shiftLeft=function(t){var r=nt();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},B.prototype.shiftRight=function(t){var r=nt();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},B.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+he(this[t]);return this.s<0?this.t*this.DB:-1},B.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,n=0;n<this.t;++n)t+=ee(this[n]^r);return t},B.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?this.s!=0:(this[r]&1<<t%this.DB)!=0},B.prototype.setBit=function(t){return this.changeBit(t,Vt)},B.prototype.clearBit=function(t){return this.changeBit(t,$t)},B.prototype.flipBit=function(t){return this.changeBit(t,zt)},B.prototype.add=function(t){var r=nt();return this.addTo(t,r),r},B.prototype.subtract=function(t){var r=nt();return this.subTo(t,r),r},B.prototype.multiply=function(t){var r=nt();return this.multiplyTo(t,r),r},B.prototype.divide=function(t){var r=nt();return this.divRemTo(t,r,null),r},B.prototype.remainder=function(t){var r=nt();return this.divRemTo(t,null,r),r},B.prototype.divideAndRemainder=function(t){var r=nt(),n=nt();return this.divRemTo(t,r,n),new Array(r,n)},B.prototype.modPow=function(t,r){var n,i,s=t.bitLength(),f=Tt(1);if(s<=0)return f;n=s<18?1:s<48?3:s<144?4:s<768?5:6,i=s<8?new vt(r):r.isEven()?new Kt(r):new At(r);var S=new Array,y=3,_=n-1,w=(1<<n)-1;if(S[1]=i.convert(this),n>1){var x=nt();for(i.sqrTo(S[1],x);y<=w;)S[y]=nt(),i.mulTo(x,S[y-2],S[y]),y+=2}var D,V,W=t.t-1,G=!0,X=nt();for(s=pt(t[W])-1;W>=0;){for(s>=_?D=t[W]>>s-_&w:(D=(t[W]&(1<<s+1)-1)<<_-s,W>0&&(D|=t[W-1]>>this.DB+s-_)),y=n;(1&D)==0;)D>>=1,--y;if((s-=y)<0&&(s+=this.DB,--W),G)S[D].copyTo(f),G=!1;else{for(;y>1;)i.sqrTo(f,X),i.sqrTo(X,f),y-=2;y>0?i.sqrTo(f,X):(V=f,f=X,X=V),i.mulTo(X,S[D],f)}for(;W>=0&&(t[W]&1<<s)==0;)i.sqrTo(f,X),V=f,f=X,X=V,--s<0&&(s=this.DB-1,--W)}return i.revert(f)},B.prototype.modInverse=function(t){var r=t.isEven();if(this.isEven()&&r||t.signum()==0)return B.ZERO;for(var n=t.clone(),i=this.clone(),s=Tt(1),f=Tt(0),S=Tt(0),y=Tt(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),r?(s.isEven()&&f.isEven()||(s.addTo(this,s),f.subTo(t,f)),s.rShiftTo(1,s)):f.isEven()||f.subTo(t,f),f.rShiftTo(1,f);for(;i.isEven();)i.rShiftTo(1,i),r?(S.isEven()&&y.isEven()||(S.addTo(this,S),y.subTo(t,y)),S.rShiftTo(1,S)):y.isEven()||y.subTo(t,y),y.rShiftTo(1,y);n.compareTo(i)>=0?(n.subTo(i,n),r&&s.subTo(S,s),f.subTo(y,f)):(i.subTo(n,i),r&&S.subTo(s,S),y.subTo(f,y))}return i.compareTo(B.ONE)!=0?B.ZERO:y.compareTo(t)>=0?y.subtract(t):y.signum()<0?(y.addTo(t,y),y.signum()<0?y.add(t):y):y},B.prototype.pow=function(t){return this.exp(t,new Ut)},B.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var s=r.getLowestSetBit(),f=n.getLowestSetBit();if(f<0)return r;for(s<f&&(f=s),f>0&&(r.rShiftTo(f,r),n.rShiftTo(f,n));r.signum()>0;)(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),(s=n.getLowestSetBit())>0&&n.rShiftTo(s,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n));return f>0&&n.lShiftTo(f,n),n},B.prototype.isProbablePrime=function(t){var r,n=this.abs();if(n.t==1&&n[0]<=U[U.length-1]){for(r=0;r<U.length;++r)if(n[0]==U[r])return!0;return!1}if(n.isEven())return!1;for(r=1;r<U.length;){for(var i=U[r],s=r+1;s<U.length&&i<c;)i*=U[s++];for(i=n.modInt(i);r<s;)if(i%U[r++]==0)return!1}return n.millerRabin(t)},B.prototype.square=function(){var t=nt();return this.squareTo(t),t},h.prototype.init=function(t){var r,n,i;for(r=0;r<256;++r)this.S[r]=r;for(n=0,r=0;r<256;++r)n=n+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[n],this.S[n]=i;this.i=0,this.j=0},h.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var N,q,J;function Z(){(function(t){q[J++]^=255&t,q[J++]^=t>>8&255,q[J++]^=t>>16&255,q[J++]^=t>>24&255,J>=256&&(J-=256)})(new Date().getTime())}if(q==null){var at;if(q=new Array,J=0,m!==void 0&&(m.crypto!==void 0||m.msCrypto!==void 0)){var lt=m.crypto||m.msCrypto;if(lt.getRandomValues){var _t=new Uint8Array(32);for(lt.getRandomValues(_t),at=0;at<32;++at)q[J++]=_t[at]}else if(k.appName=="Netscape"&&k.appVersion<"5"){var yt=m.crypto.random(32);for(at=0;at<yt.length;++at)q[J++]=255&yt.charCodeAt(at)}}for(;J<256;)at=Math.floor(65536*Math.random()),q[J++]=at>>>8,q[J++]=255&at;J=0,Z()}function Pt(){if(N==null){for(Z(),(N=function(){return new h}()).init(q),J=0;J<q.length;++J)q[J]=0;J=0}return N.next()}function Mt(){}function Gt(e,t){return new B(e,t)}function ie(e,t,r){for(var n="",i=0;n.length<t;)n+=r(String.fromCharCode.apply(String,e.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function ht(){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 kt(e,t){this.x=t,this.q=e}function mt(e,t,r,n){this.curve=e,this.x=t,this.y=r,this.z=n??B.ONE,this.zinv=null}function de(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new mt(this,null,null)}Mt.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=Pt()},ht.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},ht.prototype.setPublic=function(t,r){if(this.isPublic=!0,this.isPrivate=!1,typeof t!="string")this.n=t,this.e=r;else{if(!(t!=null&&r!=null&&t.length>0&&r.length>0))throw"Invalid RSA public key";this.n=Gt(t,16),this.e=parseInt(r,16)}},ht.prototype.encrypt=function(t){var r=function(f,S){if(S<f.length+11)throw"Message too long for RSA";for(var y=new Array,_=f.length-1;_>=0&&S>0;){var w=f.charCodeAt(_--);w<128?y[--S]=w:w>127&&w<2048?(y[--S]=63&w|128,y[--S]=w>>6|192):(y[--S]=63&w|128,y[--S]=w>>6&63|128,y[--S]=w>>12|224)}y[--S]=0;for(var x=new Mt,D=new Array;S>2;){for(D[0]=0;D[0]==0;)x.nextBytes(D);y[--S]=D[0]}return y[--S]=2,y[--S]=0,new B(y)}(t,this.n.bitLength()+7>>3);if(r==null)return null;var n=this.doPublic(r);if(n==null)return null;var i=n.toString(16);return(1&i.length)==0?i:"0"+i},ht.prototype.encryptOAEP=function(t,r,n){var i=function(y,_,w,x){var D=v.crypto.MessageDigest,V=v.crypto.Util,W=null;if(w||(w="sha1"),typeof w=="string"&&(W=D.getCanonicalAlgName(w),x=D.getHashLength(W),w=function(tt){return te(V.hashHex(ue(tt),W))}),y.length+2*x+2>_)throw"Message too long for RSA";var G,X="";for(G=0;G<_-y.length-2*x-2;G+=1)X+="\0";var g=w("")+X+""+y,E=new Array(x);new Mt().nextBytes(E);var R=ie(E,g.length,w),L=[];for(G=0;G<g.length;G+=1)L[G]=g.charCodeAt(G)^R.charCodeAt(G);var z=ie(L,E.length,w),Q=[0];for(G=0;G<E.length;G+=1)Q[G+1]=E[G]^z.charCodeAt(G);return new B(Q.concat(L))}(t,this.n.bitLength()+7>>3,r,n);if(i==null)return null;var s=this.doPublic(i);if(s==null)return null;var f=s.toString(16);return(1&f.length)==0?f:"0"+f},ht.prototype.type="RSA",kt.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},kt.prototype.toBigInteger=function(){return this.x},kt.prototype.negate=function(){return new kt(this.q,this.x.negate().mod(this.q))},kt.prototype.add=function(t){return new kt(this.q,this.x.add(t.toBigInteger()).mod(this.q))},kt.prototype.subtract=function(t){return new kt(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},kt.prototype.multiply=function(t){return new kt(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},kt.prototype.square=function(){return new kt(this.q,this.x.square().mod(this.q))},kt.prototype.divide=function(t){return new kt(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},mt.prototype.getX=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},mt.prototype.getY=function(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},mt.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(B.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B.ZERO))},mt.prototype.isInfinity=function(){return this.x==null&&this.y==null||this.z.equals(B.ZERO)&&!this.y.toBigInteger().equals(B.ZERO)},mt.prototype.negate=function(){return new mt(this.curve,this.x,this.y.negate(),this.z)},mt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),n=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(B.ZERO.equals(n))return B.ZERO.equals(r)?this.twice():this.curve.getInfinity();var i=new B("3"),s=this.x.toBigInteger(),f=this.y.toBigInteger(),S=(t.x.toBigInteger(),t.y.toBigInteger(),n.square()),y=S.multiply(n),_=s.multiply(S),w=r.square().multiply(this.z),x=w.subtract(_.shiftLeft(1)).multiply(t.z).subtract(y).multiply(n).mod(this.curve.q),D=_.multiply(i).multiply(r).subtract(f.multiply(y)).subtract(w.multiply(r)).multiply(t.z).add(r.multiply(y)).mod(this.curve.q),V=y.multiply(this.z).multiply(t.z).mod(this.curve.q);return new mt(this.curve,this.curve.fromBigInteger(x),this.curve.fromBigInteger(D),V)},mt.prototype.twice=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var t=new B("3"),r=this.x.toBigInteger(),n=this.y.toBigInteger(),i=n.multiply(this.z),s=i.multiply(n).mod(this.curve.q),f=this.curve.a.toBigInteger(),S=r.square().multiply(t);B.ZERO.equals(f)||(S=S.add(this.z.square().multiply(f)));var y=(S=S.mod(this.curve.q)).square().subtract(r.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(i).mod(this.curve.q),_=S.multiply(t).multiply(r).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(S.square().multiply(S)).mod(this.curve.q),w=i.square().multiply(i).shiftLeft(3).mod(this.curve.q);return new mt(this.curve,this.curve.fromBigInteger(y),this.curve.fromBigInteger(_),w)},mt.prototype.multiply=function(t){if(this.isInfinity())return this;if(t.signum()==0)return this.curve.getInfinity();var r,n=t,i=n.multiply(new B("3")),s=this.negate(),f=this,S=this.curve.q.subtract(t),y=S.multiply(new B("3")),_=new mt(this.curve,this.x,this.y),w=_.negate();for(r=i.bitLength()-2;r>0;--r){f=f.twice();var x=i.testBit(r);x!=n.testBit(r)&&(f=f.add(x?this:s))}for(r=y.bitLength()-2;r>0;--r){_=_.twice();var D=y.testBit(r);D!=S.testBit(r)&&(_=_.add(D?_:w))}return f},mt.prototype.multiplyTwo=function(t,r,n){var i;i=t.bitLength()>n.bitLength()?t.bitLength()-1:n.bitLength()-1;for(var s=this.curve.getInfinity(),f=this.add(r);i>=0;)s=s.twice(),t.testBit(i)?s=n.testBit(i)?s.add(f):s.add(this):n.testBit(i)&&(s=s.add(r)),--i;return s},de.prototype.getQ=function(){return this.q},de.prototype.getA=function(){return this.a},de.prototype.getB=function(){return this.b},de.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},de.prototype.getInfinity=function(){return this.infinity},de.prototype.fromBigInteger=function(t){return new kt(this.q,t)},de.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var r=(t.length-2)/2,n=t.substr(2,r),i=t.substr(r+2,r);return new mt(this,this.fromBigInteger(new B(n,16)),this.fromBigInteger(new B(i,16)));default:return null}},kt.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},mt.prototype.getEncoded=function(e){var t=function(f,S){var y=f.toByteArrayUnsigned();if(S<y.length)y=y.slice(y.length-S);else for(;S>y.length;)y.unshift(0);return y},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i},mt.decodeFrom=function(e,t){t[0];var r=t.length-1,n=t.slice(1,1+r/2),i=t.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new B(n),f=new B(i);return new mt(e,e.fromBigInteger(s),e.fromBigInteger(f))},mt.decodeFromHex=function(e,t){t.substr(0,2);var r=t.length-2,n=t.substr(2,r/2),i=t.substr(2+r/2,r/2),s=new B(n,16),f=new B(i,16);return new mt(e,e.fromBigInteger(s),e.fromBigInteger(f))},mt.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y).divide(t),n=r.square().subtract(this.x).subtract(e.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new mt(this.curve,n,i)},mt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(B.valueOf(2)),t=this.curve.fromBigInteger(B.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new mt(this.curve,n,i)},mt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t,r=e,n=r.multiply(new B("3")),i=this.negate(),s=this;for(t=n.bitLength()-2;t>0;--t){s=s.twice();var f=n.testBit(t);f!=r.testBit(t)&&(s=s.add2D(f?this:i))}return s},mt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=t.multiply(t).mod(i),f=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return s.equals(f)},mt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},mt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(B.ONE)<0||t.compareTo(e.subtract(B.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(B.ONE)<0||r.compareTo(e.subtract(B.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var Ye=function(){var e=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"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
2
2
  `,r:"\r",t:" "};function n(f,S,y){return S?r[S]:String.fromCharCode(parseInt(y,16))}var i=new String(""),s=Object.hasOwnProperty;return function(f,S){var y,_,w=f.match(e),x=w[0],D=!1;x==="{"?y={}:x==="["?y=[]:(y=[],D=!0);for(var V=[y],W=1-D,G=w.length;W<G;++W){var X;switch((x=w[W]).charCodeAt(0)){default:(X=V[0])[_||X.length]=+x,_=void 0;break;case 34:if((x=x.substring(1,x.length-1)).indexOf("\\")!==-1&&(x=x.replace(t,n)),X=V[0],!_){if(!(X instanceof Array)){_=x||i;break}_=X.length}X[_]=x,_=void 0;break;case 91:X=V[0],V.unshift(X[_||X.length]=[]),_=void 0;break;case 93:V.shift();break;case 102:(X=V[0])[_||X.length]=!1,_=void 0;break;case 110:(X=V[0])[_||X.length]=null,_=void 0;break;case 116:(X=V[0])[_||X.length]=!0,_=void 0;break;case 123:X=V[0],V.unshift(X[_||X.length]={}),_=void 0;break;case 125:V.shift()}}if(D){if(V.length!==1)throw new Error;y=y[0]}else if(V.length)throw new Error;return S&&(y=function g(E,R){var L=E[R];if(L&&(L===void 0?"undefined":l(L))==="object"){var z=null;for(var Q in L)if(s.call(L,Q)&&L!==E){var ut=g(L,Q);ut!==void 0?L[Q]=ut:(z||(z=[]),z.push(Q))}if(z)for(var tt=z.length;--tt>=0;)delete L[z[tt]]}return S.call(E,R,L)}({"":y},"")),y}}();v!==void 0&&v||(p.KJUR=v={}),v.asn1!==void 0&&v.asn1||(v.asn1={}),v.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if(t.substr(0,1)!="-")t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=t.substr(1).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";t=new B(n,16).xor(e).add(B.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return Xt(e,t)},this.newObject=function(e){var t=v.asn1,r=t.ASN1Object,n=t.DERBoolean,i=t.DERInteger,s=t.DERBitString,f=t.DEROctetString,S=t.DERNull,y=t.DERObjectIdentifier,_=t.DEREnumerated,w=t.DERUTF8String,x=t.DERNumericString,D=t.DERPrintableString,V=t.DERTeletexString,W=t.DERIA5String,G=t.DERUTCTime,X=t.DERGeneralizedTime,g=t.DERVisibleString,E=t.DERBMPString,R=t.DERSequence,L=t.DERSet,z=t.DERTaggedObject,Q=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var ut=Object.keys(e);if(ut.length!=1)throw new Error("key of param shall be only one.");var tt=ut[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+tt+":")==-1)throw new Error("undefined key: "+tt);if(tt=="bool")return new n(e[tt]);if(tt=="int")return new i(e[tt]);if(tt=="bitstr")return new s(e[tt]);if(tt=="octstr")return new f(e[tt]);if(tt=="null")return new S(e[tt]);if(tt=="oid")return new y(e[tt]);if(tt=="enum")return new _(e[tt]);if(tt=="utf8str")return new w(e[tt]);if(tt=="numstr")return new x(e[tt]);if(tt=="prnstr")return new D(e[tt]);if(tt=="telstr")return new V(e[tt]);if(tt=="ia5str")return new W(e[tt]);if(tt=="utctime")return new G(e[tt]);if(tt=="gentime")return new X(e[tt]);if(tt=="visstr")return new g(e[tt]);if(tt=="bmpstr")return new E(e[tt]);if(tt=="asn1")return new r(e[tt]);if(tt=="seq"){for(var gt=e[tt],st=[],ct=0;ct<gt.length;ct++){var St=Q(gt[ct]);st.push(St)}return new R({array:st})}if(tt=="set"){for(gt=e[tt],st=[],ct=0;ct<gt.length;ct++)St=Q(gt[ct]),st.push(St);return new L({array:st})}if(tt=="tag"){var Ft=e[tt];if(Object.prototype.toString.call(Ft)==="[object Array]"&&Ft.length==3){var wt=Q(Ft[2]);return new z({tag:Ft[0],explicit:Ft[1],obj:wt})}return new z(Ft)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},v.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",r=parseInt(e.substr(0,2),16),n=(t=Math.floor(r/40)+"."+r%40,""),i=2;i<e.length;i+=2){var s=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);n+=s.substr(1,7),s.substr(0,1)=="0"&&(t=t+"."+new B(n,2).toString(10),n="")}return t},v.asn1.ASN1Util.oidIntToHex=function(e){var t=function(y){var _=y.toString(16);return _.length==1&&(_="0"+_),_},r=function(y){var _="",w=new B(y,10).toString(2),x=7-w.length%7;x==7&&(x=0);for(var D="",V=0;V<x;V++)D+="0";for(w=D+w,V=0;V<w.length-1;V+=7){var W=w.substr(V,7);V!=w.length-7&&(W="1"+W),_+=t(parseInt(W,2))}return _};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),s=40*parseInt(i[0])+parseInt(i[1]);n+=t(s),i.splice(0,2);for(var f=0;f<i.length;f++)n+=r(i[f]);return n},v.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(this.hV===void 0||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var t=this.hV.length/2,r=t.toString(16);if(r.length%2==1&&(r="0"+r),t<128)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+r},this.getEncodedHex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)},v.asn1.DERAbstractString=function(e){v.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Me(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e=="string"?this.setString(e):e.str!==void 0?this.setString(e.str):e.hex!==void 0&&this.setStringHex(e.hex))},a.lang.extend(v.asn1.DERAbstractString,v.asn1.ASN1Object),v.asn1.DERAbstractTime=function(e){v.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var r=t.getTime()+6e4*t.getTimezoneOffset();return new Date(r)},this.formatDate=function(t,r,n){var i=this.zeroPadding,s=this.localDateToUTC(t),f=String(s.getFullYear());r=="utc"&&(f=f.substr(2,2));var S=f+i(String(s.getMonth()+1),2)+i(String(s.getDate()),2)+i(String(s.getHours()),2)+i(String(s.getMinutes()),2)+i(String(s.getSeconds()),2);if(n===!0){var y=s.getMilliseconds();if(y!=0){var _=i(String(y),3);S=S+"."+(_=_.replace(/[0]+$/,""))}}return S+"Z"},this.zeroPadding=function(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=le(t)},this.setByDateValue=function(t,r,n,i,s,f){var S=new Date(Date.UTC(t,r-1,n,i,s,f,0));this.setByDate(S)},this.getFreshValueHex=function(){return this.hV}},a.lang.extend(v.asn1.DERAbstractTime,v.asn1.ASN1Object),v.asn1.DERAbstractStructured=function(e){v.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,e!==void 0&&e.array!==void 0&&(this.asn1Array=e.array)},a.lang.extend(v.asn1.DERAbstractStructured,v.asn1.ASN1Object),v.asn1.DERBoolean=function(e){v.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=e==0?"010100":"0101ff"},a.lang.extend(v.asn1.DERBoolean,v.asn1.ASN1Object),v.asn1.DERInteger=function(e){v.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=v.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var r=new B(String(t),10);this.setByBigInteger(r)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.bigint!==void 0?this.setByBigInteger(e.bigint):e.int!==void 0?this.setByInteger(e.int):typeof e=="number"?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex))},a.lang.extend(v.asn1.DERInteger,v.asn1.ASN1Object),v.asn1.DERBitString=function(e){if(e!==void 0&&e.obj!==void 0){var t=v.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}v.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7<r)throw"unused bits shall be from 0 to 7: u = "+r;var i="0"+r;this.hTLV=null,this.isModified=!0,this.hV=i+n},this.setByBinaryString=function(r){var n=8-(r=r.replace(/0+$/,"")).length%8;n==8&&(n=0);for(var i=0;i<=n;i++)r+="0";var s="";for(i=0;i<r.length-1;i+=8){var f=r.substr(i,8),S=parseInt(f,2).toString(16);S.length==1&&(S="0"+S),s+=S}this.hTLV=null,this.isModified=!0,this.hV="0"+n+s},this.setByBooleanArray=function(r){for(var n="",i=0;i<r.length;i++)r[i]==1?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(r){for(var n=new Array(r),i=0;i<r;i++)n[i]=!1;return n},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(typeof e=="string"&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):e.hex!==void 0?this.setHexValueIncludingUnusedBits(e.hex):e.bin!==void 0?this.setByBinaryString(e.bin):e.array!==void 0&&this.setByBooleanArray(e.array))},a.lang.extend(v.asn1.DERBitString,v.asn1.ASN1Object),v.asn1.DEROctetString=function(e){if(e!==void 0&&e.obj!==void 0){var t=v.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}v.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},a.lang.extend(v.asn1.DEROctetString,v.asn1.DERAbstractString),v.asn1.DERNull=function(){v.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},a.lang.extend(v.asn1.DERNull,v.asn1.ASN1Object),v.asn1.DERObjectIdentifier=function(e){v.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var r=function(i){var s=function(D){var V=D.toString(16);return V.length==1&&(V="0"+V),V},f=function(D){var V="",W=parseInt(D,10).toString(2),G=7-W.length%7;G==7&&(G=0);for(var X="",g=0;g<G;g++)X+="0";for(W=X+W,g=0;g<W.length-1;g+=7){var E=W.substr(g,7);g!=W.length-7&&(E="1"+E),V+=s(parseInt(E,2))}return V};try{if(!i.match(/^[0-9.]+$/))return null;var S="",y=i.split("."),_=40*parseInt(y[0],10)+parseInt(y[1],10);S+=s(_),y.splice(0,2);for(var w=0;w<y.length;w++)S+=f(y[w]);return S}catch{return null}}(t);if(r==null)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var r=v.asn1.x509.OID.name2oid(t);if(r==="")throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(r)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){typeof t=="string"?this.setValueNameOrOid(t):t.oid!==void 0?this.setValueNameOrOid(t.oid):t.name!==void 0?this.setValueNameOrOid(t.name):t.hex!==void 0&&this.setValueHex(t.hex)},e!==void 0&&this.setByParam(e)},a.lang.extend(v.asn1.DERObjectIdentifier,v.asn1.ASN1Object),v.asn1.DEREnumerated=function(e){v.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=v.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var r=new B(String(t),10);this.setByBigInteger(r)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},e!==void 0&&(e.int!==void 0?this.setByInteger(e.int):typeof e=="number"?this.setByInteger(e):e.hex!==void 0&&this.setValueHex(e.hex))},a.lang.extend(v.asn1.DEREnumerated,v.asn1.ASN1Object),v.asn1.DERUTF8String=function(e){v.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},a.lang.extend(v.asn1.DERUTF8String,v.asn1.DERAbstractString),v.asn1.DERNumericString=function(e){v.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},a.lang.extend(v.asn1.DERNumericString,v.asn1.DERAbstractString),v.asn1.DERPrintableString=function(e){v.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},a.lang.extend(v.asn1.DERPrintableString,v.asn1.DERAbstractString),v.asn1.DERTeletexString=function(e){v.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},a.lang.extend(v.asn1.DERTeletexString,v.asn1.DERAbstractString),v.asn1.DERIA5String=function(e){v.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},a.lang.extend(v.asn1.DERIA5String,v.asn1.DERAbstractString),v.asn1.DERVisibleString=function(e){v.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},a.lang.extend(v.asn1.DERVisibleString,v.asn1.DERAbstractString),v.asn1.DERBMPString=function(e){v.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},a.lang.extend(v.asn1.DERBMPString,v.asn1.DERAbstractString),v.asn1.DERUTCTime=function(e){v.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=le(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=le(this.s)),this.hV},e!==void 0&&(e.str!==void 0?this.setString(e.str):typeof e=="string"&&e.match(/^[0-9]{12}Z$/)?this.setString(e):e.hex!==void 0?this.setStringHex(e.hex):e.date!==void 0&&this.setByDate(e.date))},a.lang.extend(v.asn1.DERUTCTime,v.asn1.DERAbstractTime),v.asn1.DERGeneralizedTime=function(e){v.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=le(this.s)},this.getFreshValueHex=function(){return this.date===void 0&&this.s===void 0&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=le(this.s)),this.hV},e!==void 0&&(e.str!==void 0?this.setString(e.str):typeof e=="string"&&e.match(/^[0-9]{14}Z$/)?this.setString(e):e.hex!==void 0?this.setStringHex(e.hex):e.date!==void 0&&this.setByDate(e.date),e.millis===!0&&(this.withMillis=!0))},a.lang.extend(v.asn1.DERGeneralizedTime,v.asn1.DERAbstractTime),v.asn1.DERSequence=function(e){v.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var t="",r=0;r<this.asn1Array.length;r++)t+=this.asn1Array[r].getEncodedHex();return this.hV=t,this.hV}},a.lang.extend(v.asn1.DERSequence,v.asn1.DERAbstractStructured),v.asn1.DERSet=function(e){v.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t.push(n.getEncodedHex())}return this.sortFlag==1&&t.sort(),this.hV=t.join(""),this.hV},e!==void 0&&e.sortflag!==void 0&&e.sortflag==0&&(this.sortFlag=!1)},a.lang.extend(v.asn1.DERSet,v.asn1.DERAbstractStructured),v.asn1.DERTaggedObject=function(e){v.asn1.DERTaggedObject.superclass.constructor.call(this);var t=v.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(r,n,i){this.hT=n,this.isExplicit=r,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,n),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(r){r.tag!=null&&(this.hT=r.tag),r.explicit!=null&&(this.isExplicit=r.explicit),r.tage!=null&&(this.hT=r.tage,this.isExplicit=!0),r.tagi!=null&&(this.hT=r.tagi,this.isExplicit=!1),r.obj!=null&&(r.obj instanceof t.ASN1Object?(this.asn1Object=r.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):l(r.obj)=="object"&&(this.asn1Object=t.ASN1Util.newObject(r.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},e!=null&&this.setByParam(e)},a.lang.extend(v.asn1.DERTaggedObject,v.asn1.ASN1Object);var v,we,oe,it=new function(){};function Ge(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Xe(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}function Re(e){for(var t="",r=0;r<e.length;r++){var n=e[r].toString(16);n.length==1&&(n="0"+n),t+=n}return t}function le(e){return Re(Ge(e))}function Ie(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function Fe(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function Dt(e){return e.length%2==1&&(e="0"+e),Ie($(e))}function bt(e){return et(Fe(e))}function Me(e){return De(Ne(e))}function Ot(e){return decodeURIComponent(Le(e))}function te(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function ue(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function Qe(e){return $(e)}function Ze(e){var t=Qe(e).replace(/(.{64})/g,`$1\r
3
3
  `);return t=t.replace(/\r\n$/,"")}function $e(e){return et(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Xt(e,t){return"-----BEGIN "+t+`-----\r
4
4
  `+Ze(e)+`\r
@@ -25,7 +25,7 @@ var piralOidc=(()=>{var Ar=Object.create;var Be=Object.defineProperty;var kr=Obj
25
25
  `;if(w=="30"){if(y.substr(r,4)=="3000")return n+`SEQUENCE {}
26
26
  `;V=n+`SEQUENCE
27
27
  `;var E=t;if(((z=S(y,r)).length==2||z.length==3)&&y.substr(z[0],2)=="06"&&y.substr(z[z.length-1],2)=="04"){X=i.oidname(s(y,z[0]));var R=JSON.parse(JSON.stringify(t));R.x509ExtName=X,E=R}for(var L=0;L<z.length;L++)V+=f(y,E,z[L],n+" ");return V}if(w=="31"){V=n+`SET
28
- `;var z=S(y,r);for(L=0;L<z.length;L++)V+=f(y,t,z[L],n+" ");return V}if(128&(w=parseInt(w,16))){var Q=31&w;if(32&w){for(V=n+"["+Q+`]
28
+ `;var z=S(y,r);for(L=0;L<z.length;L++)V+=f(y,t,z[L],n+" ");return V}if((128&(w=parseInt(w,16)))!=0){var Q=31&w;if((32&w)!=0){for(V=n+"["+Q+`]
29
29
  `,z=S(y,r),L=0;L<z.length;L++)V+=f(y,t,z[L],n+" ");return V}if(D=s(y,r),it.isASN1HEX(D)){var V=n+"["+Q+`]
30
30
  `;return V+=f(D,t,0,n+" ")}return(D.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&Q==2)&&(D=Ot(D)),V=n+"["+Q+"] "+D+`
31
31
  `}return n+"UNKNOWN("+w+") "+s(y,r)+`
@@ -72,7 +72,7 @@ var piralOidc=(()=>{var Ar=Object.create;var Be=Object.defineProperty;var kr=Obj
72
72
  `:st==="subjectAltName"?g+=" "+L(this.getExtSubjectAltName())+`
73
73
  `:st==="cRLDistributionPoints"?g+=Q(this.getExtCRLDistributionPoints()):st==="authorityInfoAccess"?g+=ut(this.getExtAuthorityInfoAccess()):st==="certificatePolicies"&&(g+=z(this.getExtCertificatePolicies()))}}return g+="signature algorithm: "+this.getSignatureAlgorithmName()+`
74
74
  `,g+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
75
- `},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):v.lang.String.isHex(e)&&this.readCertHex(e))}ht.prototype.sign=function(e,t){var r=function(i){return v.crypto.Util.hashString(i,t)}(e);return this.signWithMessageHash(r,t)},ht.prototype.signWithMessageHash=function(e,t){var r=Gt(v.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return or(this.doPrivate(r).toString(16),this.n.bitLength())},ht.prototype.signPSS=function(e,t,r){var n=function(s){return v.crypto.Util.hashHex(s,t)}(ue(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(n,t,r)},ht.prototype.signWithMessageHashPSS=function(e,t,r){var n,i=te(e),s=i.length,f=this.n.bitLength()-1,S=Math.ceil(f/8),y=function(g){return v.crypto.Util.hashHex(g,t)};if(r===-1||r===void 0)r=s;else if(r===-2)r=S-s-2;else if(r<-2)throw new Error("invalid salt length");if(S<s+r+2)throw new Error("data too long");var _="";r>0&&(_=new Array(r),new Mt().nextBytes(_),_=String.fromCharCode.apply(String,_));var w=te(y(ue("\0\0\0\0\0\0\0\0"+i+_))),x=[];for(n=0;n<S-r-s-2;n+=1)x[n]=0;var D=String.fromCharCode.apply(String,x)+""+_,V=sr(w,D.length,y),W=[];for(n=0;n<D.length;n+=1)W[n]=D.charCodeAt(n)^V.charCodeAt(n);var G=65280>>8*S-f&255;for(W[0]&=~G,n=0;n<s;n++)W.push(w.charCodeAt(n));return W.push(188),or(this.doPrivate(new B(W)).toString(16),this.n.bitLength())},ht.prototype.verify=function(e,t){var r=Gt(t=(t=t.replace(gr,"")).replace(/[ \n]+/g,""),16);if(r.bitLength()>this.n.bitLength())return 0;var n=ar(this.doPublic(r).toString(16).replace(/^1f+00/,""));if(n.length==0)return!1;var i=n[0];return n[1]==function(f){return v.crypto.Util.hashString(f,i)}(e)},ht.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Gt(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=ar(this.doPublic(r).toString(16).replace(/^1f+00/,""));return n.length==0?!1:(n[0],n[1]==e)},ht.prototype.verifyPSS=function(e,t,r,n){var i=function(f){return v.crypto.Util.hashHex(f,r)}(ue(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(i,t,r,n)},ht.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new B(t,16),f=function(R){return v.crypto.Util.hashHex(R,r)},S=te(e),y=S.length,_=this.n.bitLength()-1,w=Math.ceil(_/8);if(n===-1||n===void 0)n=y;else if(n===-2)n=w-y-2;else if(n<-2)throw new Error("invalid salt length");if(w<y+n+2)throw new Error("data too long");var x=this.doPublic(s).toByteArray();for(i=0;i<x.length;i+=1)x[i]&=255;for(;x.length<w;)x.unshift(0);if(x[w-1]!==188)throw new Error("encoded message does not end in 0xbc");var D=(x=String.fromCharCode.apply(String,x)).substr(0,w-y-1),V=x.substr(D.length,y),W=65280>>8*w-_&255;if(D.charCodeAt(0)&W)throw new Error("bits beyond keysize not zero");var G=sr(V,D.length,f),X=[];for(i=0;i<D.length;i+=1)X[i]=D.charCodeAt(i)^G.charCodeAt(i);X[0]&=~W;var g=w-y-n-2;for(i=0;i<g;i+=1)if(X[i]!==0)throw new Error("leftmost octets not zero");if(X[g]!==1)throw new Error("0x01 marker not found");return V===te(f(ue("\0\0\0\0\0\0\0\0"+S+String.fromCharCode.apply(String,X.slice(-n)))))},ht.SALT_LEN_HLEN=-1,ht.SALT_LEN_MAX=-2,ht.SALT_LEN_RECOVER=-2,It.hex2dn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed DN");for(var r=new Array,n=it.getChildIdx(e,t),i=0;i<n.length;i++)r.push(It.hex2rdn(e,n[i]));return"/"+(r=r.map(function(s){return s.replace("/","\\/")})).join("/")},It.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=it.getChildIdx(e,t),i=0;i<n.length;i++)r.push(It.hex2attrTypeValue(e,n[i]));return(r=r.map(function(s){return s.replace("+","\\+")})).join("+")},It.hex2attrTypeValue=function(e,t){var r=it,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=r.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var s=n(e,i[0]),f=v.asn1.ASN1Util.oidHexToInt(s);return v.asn1.x509.OID.oid2atype(f)+"="+te(n(e,i[1]))},It.getPublicKeyFromCertHex=function(e){var t=new It;return t.readCertHex(e),t.getPublicKey()},It.getPublicKeyFromCertPEM=function(e){var t=new It;return t.readCertPEM(e),t.getPublicKey()},It.getPublicKeyInfoPropOfCertPEM=function(e){var t,r,n=it.getVbyList,i={};return i.algparam=null,(t=new It).readCertPEM(e),r=t.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),i.algoid==="2a8648ce3d0201"&&(i.algparam=n(r,0,[0,1],"06")),i},It.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],v!==void 0&&v||(p.KJUR=v={}),v.jws!==void 0&&v.jws||(v.jws={}),v.jws.JWS=function(){var e=v.jws.JWS.isSafeJSONString;this.parseJWS=function(t,r){if(this.parsedJWS===void 0||!r&&this.parsedJWS.sigvalH===void 0){var n=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(n==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],f=n[3],S=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=f,this.parsedJWS.si=S,!r){var y=bt(f),_=Gt(y,16);this.parsedJWS.sigvalH=y,this.parsedJWS.sigvalBI=_}var w=oe(i),x=oe(s);if(this.parsedJWS.headS=w,this.parsedJWS.payloadS=x,!e(w,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+w}}},v.jws.JWS.sign=function(e,t,r,n,i){var s,f,S,y=v,_=y.jws.JWS,w=_.readSafeJSONString,x=_.isSafeJSONString,D=y.crypto,V=(D.ECDSA,D.Mac),W=D.Signature,G=JSON;if(typeof t!="string"&&(t===void 0?"undefined":l(t))!="object")throw"spHeader must be JSON string or object: "+t;if((t===void 0?"undefined":l(t))=="object"&&(f=t,s=G.stringify(f)),typeof t=="string"){if(!x(s=t))throw"JWS Head is not safe JSON string: "+s;f=w(s)}if(S=r,(r===void 0?"undefined":l(r))=="object"&&(S=G.stringify(r)),e!=""&&e!=null||f.alg===void 0||(e=f.alg),e!=""&&e!=null&&f.alg===void 0&&(f.alg=e,s=G.stringify(f)),e!==f.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+f.alg;var X=null;if(_.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;X=_.jwsalg2sigalg[e];var g=we(s)+"."+we(S),E="";if(X.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var R=new V({alg:X,prov:"cryptojs",pass:n});R.updateString(g),E=R.doFinal()}else if(X.indexOf("withECDSA")!=-1){(z=new W({alg:X})).init(n,i),z.updateString(g);var L=z.sign();E=v.crypto.ECDSA.asn1SigToConcatSig(L)}else{var z;X!="none"&&((z=new W({alg:X})).init(n,i),z.updateString(g),E=z.sign())}return g+"."+Dt(E)},v.jws.JWS.verify=function(e,t,r){var n,i=v,s=i.jws.JWS,f=s.readSafeJSONString,S=i.crypto,y=S.ECDSA,_=S.Mac,w=S.Signature;l(ht)!==void 0&&(n=ht);var x=e.split(".");if(x.length!==3)return!1;var D=x[0]+"."+x[1],V=bt(x[2]),W=f(oe(x[0])),G=null,X=null;if(W.alg===void 0)throw"algorithm not specified in header";if(X=(G=W.alg).substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0&&(":"+r.join(":")+":").indexOf(":"+G+":")==-1)throw"algorithm '"+G+"' not accepted in the list";if(G!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=Rt.getKey(t)),!(X!="RS"&&X!="PS"||t instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if(X=="ES"&&!(t instanceof y))throw"key shall be a ECDSA obj for ES* algs";var g=null;if(s.jwsalg2sigalg[W.alg]===void 0)throw"unsupported alg name: "+G;if((g=s.jwsalg2sigalg[G])=="none")throw"not supported";if(g.substr(0,4)=="Hmac"){if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var E=new _({alg:g,pass:t});return E.updateString(D),V==E.doFinal()}if(g.indexOf("withECDSA")!=-1){var R,L=null;try{L=y.concatSigToASN1Sig(V)}catch{return!1}return(R=new w({alg:g})).init(t),R.updateString(D),R.verify(L)}return(R=new w({alg:g})).init(t),R.updateString(D),R.verify(V)},v.jws.JWS.parse=function(e){var t,r,n,i=e.split("."),s={};if(i.length!=2&&i.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],r=i[1],i.length==3&&(n=i[2]),s.headerObj=v.jws.JWS.readSafeJSONString(oe(t)),s.payloadObj=v.jws.JWS.readSafeJSONString(oe(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),s.payloadObj==null?s.payloadPP=oe(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),n!==void 0&&(s.sigHex=bt(n)),s},v.jws.JWS.verifyJWT=function(e,t,r){var n=v.jws,i=n.JWS,s=i.readSafeJSONString,f=i.inArray,S=i.includedArray,y=e.split("."),_=y[0],w=y[1],x=(bt(y[2]),s(oe(_))),D=s(oe(w));if(x.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!f(x.alg,r.alg)||D.iss!==void 0&&l(r.iss)==="object"&&!f(D.iss,r.iss)||D.sub!==void 0&&l(r.sub)==="object"&&!f(D.sub,r.sub))return!1;if(D.aud!==void 0&&l(r.aud)==="object"){if(typeof D.aud=="string"){if(!f(D.aud,r.aud))return!1}else if(l(D.aud)=="object"&&!S(D.aud,r.aud))return!1}var V=n.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(V=r.verifyAt),r.gracePeriod!==void 0&&typeof r.gracePeriod=="number"||(r.gracePeriod=0),!(D.exp!==void 0&&typeof D.exp=="number"&&D.exp+r.gracePeriod<V)&&!(D.nbf!==void 0&&typeof D.nbf=="number"&&V<D.nbf-r.gracePeriod)&&!(D.iat!==void 0&&typeof D.iat=="number"&&V<D.iat-r.gracePeriod)&&(D.jti===void 0||r.jti===void 0||D.jti===r.jti)&&!!i.verify(e,t,r.alg)},v.jws.JWS.includedArray=function(e,t){var r=v.jws.JWS.inArray;if(e===null||(e===void 0?"undefined":l(e))!=="object"||typeof e.length!="number")return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t))return!1;return!0},v.jws.JWS.inArray=function(e,t){if(t===null||(t===void 0?"undefined":l(t))!=="object"||typeof t.length!="number")return!1;for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},v.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},v.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return((n=Ye(e))===void 0?"undefined":l(n))!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}},v.jws.JWS.readSafeJSONString=function(e){var t=null;try{return((t=Ye(e))===void 0?"undefined":l(t))!="object"||t.constructor===Array?null:t}catch{return null}},v.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(t==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},v.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw"unsupported algorithm for JWK Thumprint";var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if(e.kty==="EC"){if(typeof e.crv!="string"||typeof e.x!="string"||typeof e.y!="string")throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if(e.kty==="oct"){if(typeof e.k!="string")throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var r=ue(t);return Dt(v.crypto.Util.hashHex(r,"sha256"))},v.jws.IntDate={},v.jws.IntDate.get=function(e){var t=v.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+3600;if(e=="now + 1day")return r()+86400;if(e=="now + 1month")return r()+2592e3;if(e=="now + 1year")return r()+31536e3;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},v.jws.IntDate.getZulu=function(e){return tr(e)},v.jws.IntDate.getNow=function(){return~~(new Date/1e3)},v.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},v.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},p.SecureRandom=Mt,p.rng_seed_time=Z,p.BigInteger=B,p.RSAKey=ht;var dr=v.crypto.EDSA;p.EDSA=dr;var pr=v.crypto.DSA;p.DSA=pr;var vr=v.crypto.Signature;p.Signature=vr;var yr=v.crypto.MessageDigest;p.MessageDigest=yr;var mr=v.crypto.Mac;p.Mac=mr;var _r=v.crypto.Cipher;p.Cipher=_r,p.KEYUTIL=Rt,p.ASN1HEX=it,p.X509=It,p.CryptoJS=M,p.b64tohex=et,p.b64toBA=ot,p.stoBA=Ge,p.BAtos=Xe,p.BAtohex=Re,p.stohex=le,p.stob64=function(t){return $(le(t))},p.stob64u=function(t){return Ie($(le(t)))},p.b64utos=function(t){return Xe(ot(Fe(t)))},p.b64tob64u=Ie,p.b64utob64=Fe,p.hex2b64=$,p.hextob64u=Dt,p.b64utohex=bt,p.utf8tob64u=we,p.b64utoutf8=oe,p.utf8tob64=function(t){return $(De(Ne(t)))},p.b64toutf8=function(t){return decodeURIComponent(Le(et(t)))},p.utf8tohex=Me,p.hextoutf8=Ot,p.hextorstr=te,p.rstrtohex=ue,p.hextob64=Qe,p.hextob64nl=Ze,p.b64nltohex=$e,p.hextopem=Xt,p.pemtohex=ce,p.hextoArrayBuffer=function(t){if(t.length%2!=0)throw"input is not even length";if(t.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var r=new ArrayBuffer(t.length/2),n=new DataView(r),i=0;i<t.length/2;i++)n.setUint8(i,parseInt(t.substr(2*i,2),16));return r},p.ArrayBuffertohex=function(t){for(var r="",n=new DataView(t),i=0;i<t.byteLength;i++)r+=("00"+n.getUint8(i).toString(16)).slice(-2);return r},p.zulutomsec=He,p.zulutosec=tr,p.zulutodate=function(t){return new Date(He(t))},p.datetozulu=function(t,r,n){var i,s=t.getUTCFullYear();if(r){if(s<1950||2049<s)throw"not proper year for UTCTime: "+s;i=(""+s).slice(-2)}else i=("000"+s).slice(-4);if(i+=("0"+(t.getUTCMonth()+1)).slice(-2),i+=("0"+t.getUTCDate()).slice(-2),i+=("0"+t.getUTCHours()).slice(-2),i+=("0"+t.getUTCMinutes()).slice(-2),i+=("0"+t.getUTCSeconds()).slice(-2),n){var f=t.getUTCMilliseconds();f!==0&&(i+="."+(f=(f=("00"+f).slice(-3)).replace(/0+$/g,"")))}return i+="Z"},p.uricmptohex=De,p.hextouricmp=Le,p.ipv6tohex=er,p.hextoipv6=rr,p.hextoip=Ve,p.iptohex=function(t){var r="malformed IP address";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&t.indexOf(":")!==-1)return er(t);throw r}var n=t.split(".");if(n.length!==4)throw r;var i="";try{for(var s=0;s<4;s++)i+=("0"+parseInt(n[s]).toString(16)).slice(-2);return i}catch{throw r}},p.encodeURIComponentAll=Ne,p.newline_toUnix=function(t){return t=t.replace(/\r\n/gm,`
75
+ `},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):v.lang.String.isHex(e)&&this.readCertHex(e))}ht.prototype.sign=function(e,t){var r=function(i){return v.crypto.Util.hashString(i,t)}(e);return this.signWithMessageHash(r,t)},ht.prototype.signWithMessageHash=function(e,t){var r=Gt(v.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return or(this.doPrivate(r).toString(16),this.n.bitLength())},ht.prototype.signPSS=function(e,t,r){var n=function(s){return v.crypto.Util.hashHex(s,t)}(ue(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(n,t,r)},ht.prototype.signWithMessageHashPSS=function(e,t,r){var n,i=te(e),s=i.length,f=this.n.bitLength()-1,S=Math.ceil(f/8),y=function(g){return v.crypto.Util.hashHex(g,t)};if(r===-1||r===void 0)r=s;else if(r===-2)r=S-s-2;else if(r<-2)throw new Error("invalid salt length");if(S<s+r+2)throw new Error("data too long");var _="";r>0&&(_=new Array(r),new Mt().nextBytes(_),_=String.fromCharCode.apply(String,_));var w=te(y(ue("\0\0\0\0\0\0\0\0"+i+_))),x=[];for(n=0;n<S-r-s-2;n+=1)x[n]=0;var D=String.fromCharCode.apply(String,x)+""+_,V=sr(w,D.length,y),W=[];for(n=0;n<D.length;n+=1)W[n]=D.charCodeAt(n)^V.charCodeAt(n);var G=65280>>8*S-f&255;for(W[0]&=~G,n=0;n<s;n++)W.push(w.charCodeAt(n));return W.push(188),or(this.doPrivate(new B(W)).toString(16),this.n.bitLength())},ht.prototype.verify=function(e,t){var r=Gt(t=(t=t.replace(gr,"")).replace(/[ \n]+/g,""),16);if(r.bitLength()>this.n.bitLength())return 0;var n=ar(this.doPublic(r).toString(16).replace(/^1f+00/,""));if(n.length==0)return!1;var i=n[0];return n[1]==function(f){return v.crypto.Util.hashString(f,i)}(e)},ht.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Gt(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=ar(this.doPublic(r).toString(16).replace(/^1f+00/,""));return n.length==0?!1:(n[0],n[1]==e)},ht.prototype.verifyPSS=function(e,t,r,n){var i=function(f){return v.crypto.Util.hashHex(f,r)}(ue(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(i,t,r,n)},ht.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new B(t,16),f=function(R){return v.crypto.Util.hashHex(R,r)},S=te(e),y=S.length,_=this.n.bitLength()-1,w=Math.ceil(_/8);if(n===-1||n===void 0)n=y;else if(n===-2)n=w-y-2;else if(n<-2)throw new Error("invalid salt length");if(w<y+n+2)throw new Error("data too long");var x=this.doPublic(s).toByteArray();for(i=0;i<x.length;i+=1)x[i]&=255;for(;x.length<w;)x.unshift(0);if(x[w-1]!==188)throw new Error("encoded message does not end in 0xbc");var D=(x=String.fromCharCode.apply(String,x)).substr(0,w-y-1),V=x.substr(D.length,y),W=65280>>8*w-_&255;if((D.charCodeAt(0)&W)!=0)throw new Error("bits beyond keysize not zero");var G=sr(V,D.length,f),X=[];for(i=0;i<D.length;i+=1)X[i]=D.charCodeAt(i)^G.charCodeAt(i);X[0]&=~W;var g=w-y-n-2;for(i=0;i<g;i+=1)if(X[i]!==0)throw new Error("leftmost octets not zero");if(X[g]!==1)throw new Error("0x01 marker not found");return V===te(f(ue("\0\0\0\0\0\0\0\0"+S+String.fromCharCode.apply(String,X.slice(-n)))))},ht.SALT_LEN_HLEN=-1,ht.SALT_LEN_MAX=-2,ht.SALT_LEN_RECOVER=-2,It.hex2dn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed DN");for(var r=new Array,n=it.getChildIdx(e,t),i=0;i<n.length;i++)r.push(It.hex2rdn(e,n[i]));return"/"+(r=r.map(function(s){return s.replace("/","\\/")})).join("/")},It.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=it.getChildIdx(e,t),i=0;i<n.length;i++)r.push(It.hex2attrTypeValue(e,n[i]));return(r=r.map(function(s){return s.replace("+","\\+")})).join("+")},It.hex2attrTypeValue=function(e,t){var r=it,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=r.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var s=n(e,i[0]),f=v.asn1.ASN1Util.oidHexToInt(s);return v.asn1.x509.OID.oid2atype(f)+"="+te(n(e,i[1]))},It.getPublicKeyFromCertHex=function(e){var t=new It;return t.readCertHex(e),t.getPublicKey()},It.getPublicKeyFromCertPEM=function(e){var t=new It;return t.readCertPEM(e),t.getPublicKey()},It.getPublicKeyInfoPropOfCertPEM=function(e){var t,r,n=it.getVbyList,i={};return i.algparam=null,(t=new It).readCertPEM(e),r=t.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),i.algoid==="2a8648ce3d0201"&&(i.algparam=n(r,0,[0,1],"06")),i},It.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],v!==void 0&&v||(p.KJUR=v={}),v.jws!==void 0&&v.jws||(v.jws={}),v.jws.JWS=function(){var e=v.jws.JWS.isSafeJSONString;this.parseJWS=function(t,r){if(this.parsedJWS===void 0||!r&&this.parsedJWS.sigvalH===void 0){var n=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(n==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],f=n[3],S=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=f,this.parsedJWS.si=S,!r){var y=bt(f),_=Gt(y,16);this.parsedJWS.sigvalH=y,this.parsedJWS.sigvalBI=_}var w=oe(i),x=oe(s);if(this.parsedJWS.headS=w,this.parsedJWS.payloadS=x,!e(w,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+w}}},v.jws.JWS.sign=function(e,t,r,n,i){var s,f,S,y=v,_=y.jws.JWS,w=_.readSafeJSONString,x=_.isSafeJSONString,D=y.crypto,V=(D.ECDSA,D.Mac),W=D.Signature,G=JSON;if(typeof t!="string"&&(t===void 0?"undefined":l(t))!="object")throw"spHeader must be JSON string or object: "+t;if((t===void 0?"undefined":l(t))=="object"&&(f=t,s=G.stringify(f)),typeof t=="string"){if(!x(s=t))throw"JWS Head is not safe JSON string: "+s;f=w(s)}if(S=r,(r===void 0?"undefined":l(r))=="object"&&(S=G.stringify(r)),e!=""&&e!=null||f.alg===void 0||(e=f.alg),e!=""&&e!=null&&f.alg===void 0&&(f.alg=e,s=G.stringify(f)),e!==f.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+f.alg;var X=null;if(_.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;X=_.jwsalg2sigalg[e];var g=we(s)+"."+we(S),E="";if(X.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var R=new V({alg:X,prov:"cryptojs",pass:n});R.updateString(g),E=R.doFinal()}else if(X.indexOf("withECDSA")!=-1){(z=new W({alg:X})).init(n,i),z.updateString(g);var L=z.sign();E=v.crypto.ECDSA.asn1SigToConcatSig(L)}else{var z;X!="none"&&((z=new W({alg:X})).init(n,i),z.updateString(g),E=z.sign())}return g+"."+Dt(E)},v.jws.JWS.verify=function(e,t,r){var n,i=v,s=i.jws.JWS,f=s.readSafeJSONString,S=i.crypto,y=S.ECDSA,_=S.Mac,w=S.Signature;l(ht)!==void 0&&(n=ht);var x=e.split(".");if(x.length!==3)return!1;var D=x[0]+"."+x[1],V=bt(x[2]),W=f(oe(x[0])),G=null,X=null;if(W.alg===void 0)throw"algorithm not specified in header";if(X=(G=W.alg).substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0&&(":"+r.join(":")+":").indexOf(":"+G+":")==-1)throw"algorithm '"+G+"' not accepted in the list";if(G!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=Rt.getKey(t)),!(X!="RS"&&X!="PS"||t instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if(X=="ES"&&!(t instanceof y))throw"key shall be a ECDSA obj for ES* algs";var g=null;if(s.jwsalg2sigalg[W.alg]===void 0)throw"unsupported alg name: "+G;if((g=s.jwsalg2sigalg[G])=="none")throw"not supported";if(g.substr(0,4)=="Hmac"){if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var E=new _({alg:g,pass:t});return E.updateString(D),V==E.doFinal()}if(g.indexOf("withECDSA")!=-1){var R,L=null;try{L=y.concatSigToASN1Sig(V)}catch{return!1}return(R=new w({alg:g})).init(t),R.updateString(D),R.verify(L)}return(R=new w({alg:g})).init(t),R.updateString(D),R.verify(V)},v.jws.JWS.parse=function(e){var t,r,n,i=e.split("."),s={};if(i.length!=2&&i.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],r=i[1],i.length==3&&(n=i[2]),s.headerObj=v.jws.JWS.readSafeJSONString(oe(t)),s.payloadObj=v.jws.JWS.readSafeJSONString(oe(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),s.payloadObj==null?s.payloadPP=oe(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),n!==void 0&&(s.sigHex=bt(n)),s},v.jws.JWS.verifyJWT=function(e,t,r){var n=v.jws,i=n.JWS,s=i.readSafeJSONString,f=i.inArray,S=i.includedArray,y=e.split("."),_=y[0],w=y[1],x=(bt(y[2]),s(oe(_))),D=s(oe(w));if(x.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!f(x.alg,r.alg)||D.iss!==void 0&&l(r.iss)==="object"&&!f(D.iss,r.iss)||D.sub!==void 0&&l(r.sub)==="object"&&!f(D.sub,r.sub))return!1;if(D.aud!==void 0&&l(r.aud)==="object"){if(typeof D.aud=="string"){if(!f(D.aud,r.aud))return!1}else if(l(D.aud)=="object"&&!S(D.aud,r.aud))return!1}var V=n.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(V=r.verifyAt),r.gracePeriod!==void 0&&typeof r.gracePeriod=="number"||(r.gracePeriod=0),!(D.exp!==void 0&&typeof D.exp=="number"&&D.exp+r.gracePeriod<V)&&!(D.nbf!==void 0&&typeof D.nbf=="number"&&V<D.nbf-r.gracePeriod)&&!(D.iat!==void 0&&typeof D.iat=="number"&&V<D.iat-r.gracePeriod)&&(D.jti===void 0||r.jti===void 0||D.jti===r.jti)&&!!i.verify(e,t,r.alg)},v.jws.JWS.includedArray=function(e,t){var r=v.jws.JWS.inArray;if(e===null||(e===void 0?"undefined":l(e))!=="object"||typeof e.length!="number")return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t))return!1;return!0},v.jws.JWS.inArray=function(e,t){if(t===null||(t===void 0?"undefined":l(t))!=="object"||typeof t.length!="number")return!1;for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1},v.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},v.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return((n=Ye(e))===void 0?"undefined":l(n))!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}},v.jws.JWS.readSafeJSONString=function(e){var t=null;try{return((t=Ye(e))===void 0?"undefined":l(t))!="object"||t.constructor===Array?null:t}catch{return null}},v.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(t==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},v.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw"unsupported algorithm for JWK Thumprint";var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if(e.kty==="EC"){if(typeof e.crv!="string"||typeof e.x!="string"||typeof e.y!="string")throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if(e.kty==="oct"){if(typeof e.k!="string")throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var r=ue(t);return Dt(v.crypto.Util.hashHex(r,"sha256"))},v.jws.IntDate={},v.jws.IntDate.get=function(e){var t=v.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+3600;if(e=="now + 1day")return r()+86400;if(e=="now + 1month")return r()+2592e3;if(e=="now + 1year")return r()+31536e3;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},v.jws.IntDate.getZulu=function(e){return tr(e)},v.jws.IntDate.getNow=function(){return~~(new Date/1e3)},v.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},v.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},p.SecureRandom=Mt,p.rng_seed_time=Z,p.BigInteger=B,p.RSAKey=ht;var dr=v.crypto.EDSA;p.EDSA=dr;var pr=v.crypto.DSA;p.DSA=pr;var vr=v.crypto.Signature;p.Signature=vr;var yr=v.crypto.MessageDigest;p.MessageDigest=yr;var mr=v.crypto.Mac;p.Mac=mr;var _r=v.crypto.Cipher;p.Cipher=_r,p.KEYUTIL=Rt,p.ASN1HEX=it,p.X509=It,p.CryptoJS=M,p.b64tohex=et,p.b64toBA=ot,p.stoBA=Ge,p.BAtos=Xe,p.BAtohex=Re,p.stohex=le,p.stob64=function(t){return $(le(t))},p.stob64u=function(t){return Ie($(le(t)))},p.b64utos=function(t){return Xe(ot(Fe(t)))},p.b64tob64u=Ie,p.b64utob64=Fe,p.hex2b64=$,p.hextob64u=Dt,p.b64utohex=bt,p.utf8tob64u=we,p.b64utoutf8=oe,p.utf8tob64=function(t){return $(De(Ne(t)))},p.b64toutf8=function(t){return decodeURIComponent(Le(et(t)))},p.utf8tohex=Me,p.hextoutf8=Ot,p.hextorstr=te,p.rstrtohex=ue,p.hextob64=Qe,p.hextob64nl=Ze,p.b64nltohex=$e,p.hextopem=Xt,p.pemtohex=ce,p.hextoArrayBuffer=function(t){if(t.length%2!=0)throw"input is not even length";if(t.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var r=new ArrayBuffer(t.length/2),n=new DataView(r),i=0;i<t.length/2;i++)n.setUint8(i,parseInt(t.substr(2*i,2),16));return r},p.ArrayBuffertohex=function(t){for(var r="",n=new DataView(t),i=0;i<t.byteLength;i++)r+=("00"+n.getUint8(i).toString(16)).slice(-2);return r},p.zulutomsec=He,p.zulutosec=tr,p.zulutodate=function(t){return new Date(He(t))},p.datetozulu=function(t,r,n){var i,s=t.getUTCFullYear();if(r){if(s<1950||2049<s)throw"not proper year for UTCTime: "+s;i=(""+s).slice(-2)}else i=("000"+s).slice(-4);if(i+=("0"+(t.getUTCMonth()+1)).slice(-2),i+=("0"+t.getUTCDate()).slice(-2),i+=("0"+t.getUTCHours()).slice(-2),i+=("0"+t.getUTCMinutes()).slice(-2),i+=("0"+t.getUTCSeconds()).slice(-2),n){var f=t.getUTCMilliseconds();f!==0&&(i+="."+(f=(f=("00"+f).slice(-3)).replace(/0+$/g,"")))}return i+="Z"},p.uricmptohex=De,p.hextouricmp=Le,p.ipv6tohex=er,p.hextoipv6=rr,p.hextoip=Ve,p.iptohex=function(t){var r="malformed IP address";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&t.indexOf(":")!==-1)return er(t);throw r}var n=t.split(".");if(n.length!==4)throw r;var i="";try{for(var s=0;s<4;s++)i+=("0"+parseInt(n[s]).toString(16)).slice(-2);return i}catch{throw r}},p.encodeURIComponentAll=Ne,p.newline_toUnix=function(t){return t=t.replace(/\r\n/gm,`
76
76
  `)},p.newline_toDos=function(t){return t=(t=t.replace(/\r\n/gm,`
77
77
  `)).replace(/\n/gm,`\r
78
78
  `)},p.hextoposhex=Ke,p.intarystrtohex=function(t){t=(t=(t=t.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return t.split(/,/).map(function(r,n,i){var s=parseInt(r);if(s<0||255<s)throw"integer not in range 0-255";return("00"+s.toString(16)).slice(-2)}).join("")}catch(r){throw"malformed integer array string: "+r}},p.strdiffidx=function(t,r){var n=t.length;t.length>r.length&&(n=r.length);for(var i=0;i<n;i++)if(t.charCodeAt(i)!=r.charCodeAt(i))return i;return t.length!=r.length?n:-1},p.KJUR=v;var Sr=v.crypto;p.crypto=Sr;var br=v.asn1;p.asn1=br;var wr=v.jws;p.jws=wr;var Fr=v.lang;p.lang=Fr}).call(this,j(28).Buffer)},function(rt,p,j){"use strict";(function(T){var l=j(30),k=j(31),m=j(32);function a(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(U,c){if(a()<c)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(U=new Uint8Array(c)).__proto__=o.prototype:(U===null&&(U=new o(c)),U.length=c),U}function o(U,c,h){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(U,c,h);if(typeof U=="number"){if(typeof c=="string")throw new Error("If encoding is specified then the first argument must be a string");return b(this,U)}return d(this,U,c,h)}function d(U,c,h,N){if(typeof c=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&c instanceof ArrayBuffer?function(J,Z,at,lt){if(Z.byteLength,at<0||Z.byteLength<at)throw new RangeError("'offset' is out of bounds");if(Z.byteLength<at+(lt||0))throw new RangeError("'length' is out of bounds");return Z=at===void 0&&lt===void 0?new Uint8Array(Z):lt===void 0?new Uint8Array(Z,at):new Uint8Array(Z,at,lt),o.TYPED_ARRAY_SUPPORT?(J=Z).__proto__=o.prototype:J=H(J,Z),J}(U,c,h,N):typeof c=="string"?function(J,Z,at){if(typeof at=="string"&&at!==""||(at="utf8"),!o.isEncoding(at))throw new TypeError('"encoding" must be a valid string encoding');var lt=0|A(Z,at),_t=(J=u(J,lt)).write(Z,at);return _t!==lt&&(J=J.slice(0,_t)),J}(U,c,h):function(J,Z){if(o.isBuffer(Z)){var at=0|C(Z.length);return(J=u(J,at)).length===0||Z.copy(J,0,0,at),J}if(Z){if(typeof ArrayBuffer<"u"&&Z.buffer instanceof ArrayBuffer||"length"in Z)return typeof Z.length!="number"||function(_t){return _t!=_t}(Z.length)?u(J,0):H(J,Z);if(Z.type==="Buffer"&&m(Z.data))return H(J,Z.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(U,c)}function P(U){if(typeof U!="number")throw new TypeError('"size" argument must be a number');if(U<0)throw new RangeError('"size" argument must not be negative')}function b(U,c){if(P(c),U=u(U,c<0?0:0|C(c)),!o.TYPED_ARRAY_SUPPORT)for(var h=0;h<c;++h)U[h]=0;return U}function H(U,c){var h=c.length<0?0:0|C(c.length);U=u(U,h);for(var N=0;N<h;N+=1)U[N]=255&c[N];return U}function C(U){if(U>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|U}function A(U,c){if(o.isBuffer(U))return U.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(U)||U instanceof ArrayBuffer))return U.byteLength;typeof U!="string"&&(U=""+U);var h=U.length;if(h===0)return 0;for(var N=!1;;)switch(c){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":case void 0:return Ut(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*h;case"hex":return h>>>1;case"base64":return Yt(U).length;default:if(N)return Ut(U).length;c=(""+c).toLowerCase(),N=!0}}function F(U,c,h){var N=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0)<=(c>>>=0))return"";for(U||(U="utf8");;)switch(U){case"hex":return Zt(this,c,h);case"utf8":case"utf-8":return ft(this,c,h);case"ascii":return jt(this,c,h);case"latin1":case"binary":return xt(this,c,h);case"base64":return nt(this,c,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tt(this,c,h);default:if(N)throw new TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),N=!0}}function O(U,c,h){var N=U[c];U[c]=U[h],U[h]=N}function Y(U,c,h,N,q){if(U.length===0)return-1;if(typeof h=="string"?(N=h,h=0):h>2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,isNaN(h)&&(h=q?0:U.length-1),h<0&&(h=U.length+h),h>=U.length){if(q)return-1;h=U.length-1}else if(h<0){if(!q)return-1;h=0}if(typeof c=="string"&&(c=o.from(c,N)),o.isBuffer(c))return c.length===0?-1:M(U,c,h,N,q);if(typeof c=="number")return c&=255,o.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?q?Uint8Array.prototype.indexOf.call(U,c,h):Uint8Array.prototype.lastIndexOf.call(U,c,h):M(U,[c],h,N,q);throw new TypeError("val must be string, number or Buffer")}function M(U,c,h,N,q){var J,Z=1,at=U.length,lt=c.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(U.length<2||c.length<2)return-1;Z=2,at/=2,lt/=2,h/=2}function _t(Gt,ie){return Z===1?Gt[ie]:Gt.readUInt16BE(ie*Z)}if(q){var yt=-1;for(J=h;J<at;J++)if(_t(U,J)===_t(c,yt===-1?0:J-yt)){if(yt===-1&&(yt=J),J-yt+1===lt)return yt*Z}else yt!==-1&&(J-=J-yt),yt=-1}else for(h+lt>at&&(h=at-lt),J=h;J>=0;J--){for(var Pt=!0,Mt=0;Mt<lt;Mt++)if(_t(U,J+Mt)!==_t(c,Mt)){Pt=!1;break}if(Pt)return J}return-1}function K(U,c,h,N){h=Number(h)||0;var q=U.length-h;N?(N=Number(N))>q&&(N=q):N=q;var J=c.length;if(J%2!=0)throw new TypeError("Invalid hex string");N>J/2&&(N=J/2);for(var Z=0;Z<N;++Z){var at=parseInt(c.substr(2*Z,2),16);if(isNaN(at))return Z;U[h+Z]=at}return Z}function I(U,c,h,N){return Kt(Ut(c,U.length-h),U,h,N)}function $(U,c,h,N){return Kt(function(J){for(var Z=[],at=0;at<J.length;++at)Z.push(255&J.charCodeAt(at));return Z}(c),U,h,N)}function et(U,c,h,N){return $(U,c,h,N)}function ot(U,c,h,N){return Kt(Yt(c),U,h,N)}function B(U,c,h,N){return Kt(function(J,Z){for(var at,lt,_t,yt=[],Pt=0;Pt<J.length&&!((Z-=2)<0);++Pt)lt=(at=J.charCodeAt(Pt))>>8,_t=at%256,yt.push(_t),yt.push(lt);return yt}(c,U.length-h),U,h,N)}function nt(U,c,h){return c===0&&h===U.length?l.fromByteArray(U):l.fromByteArray(U.slice(c,h))}function ft(U,c,h){h=Math.min(U.length,h);for(var N=[],q=c;q<h;){var J,Z,at,lt,_t=U[q],yt=null,Pt=_t>239?4:_t>223?3:_t>191?2:1;if(q+Pt<=h)switch(Pt){case 1:_t<128&&(yt=_t);break;case 2:(192&(J=U[q+1]))==128&&(lt=(31&_t)<<6|63&J)>127&&(yt=lt);break;case 3:J=U[q+1],Z=U[q+2],(192&J)==128&&(192&Z)==128&&(lt=(15&_t)<<12|(63&J)<<6|63&Z)>2047&&(lt<55296||lt>57343)&&(yt=lt);break;case 4:J=U[q+1],Z=U[q+2],at=U[q+3],(192&J)==128&&(192&Z)==128&&(192&at)==128&&(lt=(15&_t)<<18|(63&J)<<12|(63&Z)<<6|63&at)>65535&&lt<1114112&&(yt=lt)}yt===null?(yt=65533,Pt=1):yt>65535&&(yt-=65536,N.push(yt>>>10&1023|55296),yt=56320|1023&yt),N.push(yt),q+=Pt}return function(Gt){var ie=Gt.length;if(ie<=dt)return String.fromCharCode.apply(String,Gt);for(var ht="",kt=0;kt<ie;)ht+=String.fromCharCode.apply(String,Gt.slice(kt,kt+=dt));return ht}(N)}p.Buffer=o,p.SlowBuffer=function(c){return+c!=c&&(c=0),o.alloc(+c)},p.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=T.TYPED_ARRAY_SUPPORT!==void 0?T.TYPED_ARRAY_SUPPORT:function(){try{var c=new Uint8Array(1);return c.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},c.foo()===42&&typeof c.subarray=="function"&&c.subarray(1,1).byteLength===0}catch{return!1}}(),p.kMaxLength=a(),o.poolSize=8192,o._augment=function(U){return U.__proto__=o.prototype,U},o.from=function(U,c,h){return d(null,U,c,h)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(U,c,h){return function(q,J,Z,at){return P(J),J<=0?u(q,J):Z!==void 0?typeof at=="string"?u(q,J).fill(Z,at):u(q,J).fill(Z):u(q,J)}(null,U,c,h)},o.allocUnsafe=function(U){return b(null,U)},o.allocUnsafeSlow=function(U){return b(null,U)},o.isBuffer=function(c){return!(c==null||!c._isBuffer)},o.compare=function(c,h){if(!o.isBuffer(c)||!o.isBuffer(h))throw new TypeError("Arguments must be Buffers");if(c===h)return 0;for(var N=c.length,q=h.length,J=0,Z=Math.min(N,q);J<Z;++J)if(c[J]!==h[J]){N=c[J],q=h[J];break}return N<q?-1:q<N?1:0},o.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(c,h){if(!m(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return o.alloc(0);var N;if(h===void 0)for(h=0,N=0;N<c.length;++N)h+=c[N].length;var q=o.allocUnsafe(h),J=0;for(N=0;N<c.length;++N){var Z=c[N];if(!o.isBuffer(Z))throw new TypeError('"list" argument must be an Array of Buffers');Z.copy(q,J),J+=Z.length}return q},o.byteLength=A,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var c=this.length;if(c%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var h=0;h<c;h+=2)O(this,h,h+1);return this},o.prototype.swap32=function(){var c=this.length;if(c%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var h=0;h<c;h+=4)O(this,h,h+3),O(this,h+1,h+2);return this},o.prototype.swap64=function(){var c=this.length;if(c%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var h=0;h<c;h+=8)O(this,h,h+7),O(this,h+1,h+6),O(this,h+2,h+5),O(this,h+3,h+4);return this},o.prototype.toString=function(){var c=0|this.length;return c===0?"":arguments.length===0?ft(this,0,c):F.apply(this,arguments)},o.prototype.equals=function(c){if(!o.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c||o.compare(this,c)===0},o.prototype.inspect=function(){var c="",h=p.INSPECT_MAX_BYTES;return this.length>0&&(c=this.toString("hex",0,h).match(/.{2}/g).join(" "),this.length>h&&(c+=" ... ")),"<Buffer "+c+">"},o.prototype.compare=function(c,h,N,q,J){if(!o.isBuffer(c))throw new TypeError("Argument must be a Buffer");if(h===void 0&&(h=0),N===void 0&&(N=c?c.length:0),q===void 0&&(q=0),J===void 0&&(J=this.length),h<0||N>c.length||q<0||J>this.length)throw new RangeError("out of range index");if(q>=J&&h>=N)return 0;if(q>=J)return-1;if(h>=N)return 1;if(this===c)return 0;for(var Z=(J>>>=0)-(q>>>=0),at=(N>>>=0)-(h>>>=0),lt=Math.min(Z,at),_t=this.slice(q,J),yt=c.slice(h,N),Pt=0;Pt<lt;++Pt)if(_t[Pt]!==yt[Pt]){Z=_t[Pt],at=yt[Pt];break}return Z<at?-1:at<Z?1:0},o.prototype.includes=function(c,h,N){return this.indexOf(c,h,N)!==-1},o.prototype.indexOf=function(c,h,N){return Y(this,c,h,N,!0)},o.prototype.lastIndexOf=function(c,h,N){return Y(this,c,h,N,!1)},o.prototype.write=function(c,h,N,q){if(h===void 0)q="utf8",N=this.length,h=0;else if(N===void 0&&typeof h=="string")q=h,N=this.length,h=0;else{if(!isFinite(h))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");h|=0,isFinite(N)?(N|=0,q===void 0&&(q="utf8")):(q=N,N=void 0)}var J=this.length-h;if((N===void 0||N>J)&&(N=J),c.length>0&&(N<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");q||(q="utf8");for(var Z=!1;;)switch(q){case"hex":return K(this,c,h,N);case"utf8":case"utf-8":return I(this,c,h,N);case"ascii":return $(this,c,h,N);case"latin1":case"binary":return et(this,c,h,N);case"base64":return ot(this,c,h,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,c,h,N);default:if(Z)throw new TypeError("Unknown encoding: "+q);q=(""+q).toLowerCase(),Z=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var dt=4096;function jt(U,c,h){var N="";h=Math.min(U.length,h);for(var q=c;q<h;++q)N+=String.fromCharCode(127&U[q]);return N}function xt(U,c,h){var N="";h=Math.min(U.length,h);for(var q=c;q<h;++q)N+=String.fromCharCode(U[q]);return N}function Zt(U,c,h){var N=U.length;(!c||c<0)&&(c=0),(!h||h<0||h>N)&&(h=N);for(var q="",J=c;J<h;++J)q+=ee(U[J]);return q}function Tt(U,c,h){for(var N=U.slice(c,h),q="",J=0;J<N.length;J+=2)q+=String.fromCharCode(N[J]+256*N[J+1]);return q}function pt(U,c,h){if(U%1!=0||U<0)throw new RangeError("offset is not uint");if(U+c>h)throw new RangeError("Trying to access beyond buffer length")}function vt(U,c,h,N,q,J){if(!o.isBuffer(U))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>q||c<J)throw new RangeError('"value" argument is out of bounds');if(h+N>U.length)throw new RangeError("Index out of range")}function At(U,c,h,N){c<0&&(c=65535+c+1);for(var q=0,J=Math.min(U.length-h,2);q<J;++q)U[h+q]=(c&255<<8*(N?q:1-q))>>>8*(N?q:1-q)}function Wt(U,c,h,N){c<0&&(c=4294967295+c+1);for(var q=0,J=Math.min(U.length-h,4);q<J;++q)U[h+q]=c>>>8*(N?q:3-q)&255}function Vt(U,c,h,N,q,J){if(h+N>U.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function zt(U,c,h,N,q){return q||Vt(U,0,h,4),k.write(U,c,h,N,23,4),h+4}function $t(U,c,h,N,q){return q||Vt(U,0,h,8),k.write(U,c,h,N,52,8),h+8}o.prototype.slice=function(c,h){var N,q=this.length;if((c=~~c)<0?(c+=q)<0&&(c=0):c>q&&(c=q),(h=h===void 0?q:~~h)<0?(h+=q)<0&&(h=0):h>q&&(h=q),h<c&&(h=c),o.TYPED_ARRAY_SUPPORT)(N=this.subarray(c,h)).__proto__=o.prototype;else{var J=h-c;N=new o(J,void 0);for(var Z=0;Z<J;++Z)N[Z]=this[Z+c]}return N},o.prototype.readUIntLE=function(c,h,N){c|=0,h|=0,N||pt(c,h,this.length);for(var q=this[c],J=1,Z=0;++Z<h&&(J*=256);)q+=this[c+Z]*J;return q},o.prototype.readUIntBE=function(c,h,N){c|=0,h|=0,N||pt(c,h,this.length);for(var q=this[c+--h],J=1;h>0&&(J*=256);)q+=this[c+--h]*J;return q},o.prototype.readUInt8=function(c,h){return h||pt(c,1,this.length),this[c]},o.prototype.readUInt16LE=function(c,h){return h||pt(c,2,this.length),this[c]|this[c+1]<<8},o.prototype.readUInt16BE=function(c,h){return h||pt(c,2,this.length),this[c]<<8|this[c+1]},o.prototype.readUInt32LE=function(c,h){return h||pt(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+16777216*this[c+3]},o.prototype.readUInt32BE=function(c,h){return h||pt(c,4,this.length),16777216*this[c]+(this[c+1]<<16|this[c+2]<<8|this[c+3])},o.prototype.readIntLE=function(c,h,N){c|=0,h|=0,N||pt(c,h,this.length);for(var q=this[c],J=1,Z=0;++Z<h&&(J*=256);)q+=this[c+Z]*J;return q>=(J*=128)&&(q-=Math.pow(2,8*h)),q},o.prototype.readIntBE=function(c,h,N){c|=0,h|=0,N||pt(c,h,this.length);for(var q=h,J=1,Z=this[c+--q];q>0&&(J*=256);)Z+=this[c+--q]*J;return Z>=(J*=128)&&(Z-=Math.pow(2,8*h)),Z},o.prototype.readInt8=function(c,h){return h||pt(c,1,this.length),128&this[c]?-1*(255-this[c]+1):this[c]},o.prototype.readInt16LE=function(c,h){h||pt(c,2,this.length);var N=this[c]|this[c+1]<<8;return 32768&N?4294901760|N:N},o.prototype.readInt16BE=function(c,h){h||pt(c,2,this.length);var N=this[c+1]|this[c]<<8;return 32768&N?4294901760|N:N},o.prototype.readInt32LE=function(c,h){return h||pt(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},o.prototype.readInt32BE=function(c,h){return h||pt(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},o.prototype.readFloatLE=function(c,h){return h||pt(c,4,this.length),k.read(this,c,!0,23,4)},o.prototype.readFloatBE=function(c,h){return h||pt(c,4,this.length),k.read(this,c,!1,23,4)},o.prototype.readDoubleLE=function(c,h){return h||pt(c,8,this.length),k.read(this,c,!0,52,8)},o.prototype.readDoubleBE=function(c,h){return h||pt(c,8,this.length),k.read(this,c,!1,52,8)},o.prototype.writeUIntLE=function(c,h,N,q){c=+c,h|=0,N|=0,q||vt(this,c,h,N,Math.pow(2,8*N)-1,0);var J=1,Z=0;for(this[h]=255&c;++Z<N&&(J*=256);)this[h+Z]=c/J&255;return h+N},o.prototype.writeUIntBE=function(c,h,N,q){c=+c,h|=0,N|=0,q||vt(this,c,h,N,Math.pow(2,8*N)-1,0);var J=N-1,Z=1;for(this[h+J]=255&c;--J>=0&&(Z*=256);)this[h+J]=c/Z&255;return h+N},o.prototype.writeUInt8=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,1,255,0),o.TYPED_ARRAY_SUPPORT||(c=Math.floor(c)),this[h]=255&c,h+1},o.prototype.writeUInt16LE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[h]=255&c,this[h+1]=c>>>8):At(this,c,h,!0),h+2},o.prototype.writeUInt16BE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[h]=c>>>8,this[h+1]=255&c):At(this,c,h,!1),h+2},o.prototype.writeUInt32LE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[h+3]=c>>>24,this[h+2]=c>>>16,this[h+1]=c>>>8,this[h]=255&c):Wt(this,c,h,!0),h+4},o.prototype.writeUInt32BE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[h]=c>>>24,this[h+1]=c>>>16,this[h+2]=c>>>8,this[h+3]=255&c):Wt(this,c,h,!1),h+4},o.prototype.writeIntLE=function(c,h,N,q){if(c=+c,h|=0,!q){var J=Math.pow(2,8*N-1);vt(this,c,h,N,J-1,-J)}var Z=0,at=1,lt=0;for(this[h]=255&c;++Z<N&&(at*=256);)c<0&&lt===0&&this[h+Z-1]!==0&&(lt=1),this[h+Z]=(c/at>>0)-lt&255;return h+N},o.prototype.writeIntBE=function(c,h,N,q){if(c=+c,h|=0,!q){var J=Math.pow(2,8*N-1);vt(this,c,h,N,J-1,-J)}var Z=N-1,at=1,lt=0;for(this[h+Z]=255&c;--Z>=0&&(at*=256);)c<0&&lt===0&&this[h+Z+1]!==0&&(lt=1),this[h+Z]=(c/at>>0)-lt&255;return h+N},o.prototype.writeInt8=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,1,127,-128),o.TYPED_ARRAY_SUPPORT||(c=Math.floor(c)),c<0&&(c=255+c+1),this[h]=255&c,h+1},o.prototype.writeInt16LE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[h]=255&c,this[h+1]=c>>>8):At(this,c,h,!0),h+2},o.prototype.writeInt16BE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[h]=c>>>8,this[h+1]=255&c):At(this,c,h,!1),h+2},o.prototype.writeInt32LE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[h]=255&c,this[h+1]=c>>>8,this[h+2]=c>>>16,this[h+3]=c>>>24):Wt(this,c,h,!0),h+4},o.prototype.writeInt32BE=function(c,h,N){return c=+c,h|=0,N||vt(this,c,h,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),o.TYPED_ARRAY_SUPPORT?(this[h]=c>>>24,this[h+1]=c>>>16,this[h+2]=c>>>8,this[h+3]=255&c):Wt(this,c,h,!1),h+4},o.prototype.writeFloatLE=function(c,h,N){return zt(this,c,h,!0,N)},o.prototype.writeFloatBE=function(c,h,N){return zt(this,c,h,!1,N)},o.prototype.writeDoubleLE=function(c,h,N){return $t(this,c,h,!0,N)},o.prototype.writeDoubleBE=function(c,h,N){return $t(this,c,h,!1,N)},o.prototype.copy=function(c,h,N,q){if(N||(N=0),q||q===0||(q=this.length),h>=c.length&&(h=c.length),h||(h=0),q>0&&q<N&&(q=N),q===N||c.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(N<0||N>=this.length)throw new RangeError("sourceStart out of bounds");if(q<0)throw new RangeError("sourceEnd out of bounds");q>this.length&&(q=this.length),c.length-h<q-N&&(q=c.length-h+N);var J,Z=q-N;if(this===c&&N<h&&h<q)for(J=Z-1;J>=0;--J)c[J+h]=this[J+N];else if(Z<1e3||!o.TYPED_ARRAY_SUPPORT)for(J=0;J<Z;++J)c[J+h]=this[J+N];else Uint8Array.prototype.set.call(c,this.subarray(N,N+Z),h);return Z},o.prototype.fill=function(c,h,N,q){if(typeof c=="string"){if(typeof h=="string"?(q=h,h=0,N=this.length):typeof N=="string"&&(q=N,N=this.length),c.length===1){var J=c.charCodeAt(0);J<256&&(c=J)}if(q!==void 0&&typeof q!="string")throw new TypeError("encoding must be a string");if(typeof q=="string"&&!o.isEncoding(q))throw new TypeError("Unknown encoding: "+q)}else typeof c=="number"&&(c&=255);if(h<0||this.length<h||this.length<N)throw new RangeError("Out of range index");if(N<=h)return this;var Z;if(h>>>=0,N=N===void 0?this.length:N>>>0,c||(c=0),typeof c=="number")for(Z=h;Z<N;++Z)this[Z]=c;else{var at=o.isBuffer(c)?c:Ut(new o(c,q).toString()),lt=at.length;for(Z=0;Z<N-h;++Z)this[Z+h]=at[Z%lt]}return this};var he=/[^+\/0-9A-Za-z-_]/g;function ee(U){return U<16?"0"+U.toString(16):U.toString(16)}function Ut(U,c){var h;c=c||1/0;for(var N=U.length,q=null,J=[],Z=0;Z<N;++Z){if((h=U.charCodeAt(Z))>55295&&h<57344){if(!q){if(h>56319){(c-=3)>-1&&J.push(239,191,189);continue}if(Z+1===N){(c-=3)>-1&&J.push(239,191,189);continue}q=h;continue}if(h<56320){(c-=3)>-1&&J.push(239,191,189),q=h;continue}h=65536+(q-55296<<10|h-56320)}else q&&(c-=3)>-1&&J.push(239,191,189);if(q=null,h<128){if((c-=1)<0)break;J.push(h)}else if(h<2048){if((c-=2)<0)break;J.push(h>>6|192,63&h|128)}else if(h<65536){if((c-=3)<0)break;J.push(h>>12|224,h>>6&63|128,63&h|128)}else{if(!(h<1114112))throw new Error("Invalid code point");if((c-=4)<0)break;J.push(h>>18|240,h>>12&63|128,h>>6&63|128,63&h|128)}}return J}function Yt(U){return l.toByteArray(function(h){if((h=function(q){return q.trim?q.trim():q.replace(/^\s+|\s+$/g,"")}(h).replace(he,"")).length<2)return"";for(;h.length%4!=0;)h+="=";return h}(U))}function Kt(U,c,h,N){for(var q=0;q<N&&!(q+h>=c.length||q>=U.length);++q)c[q+h]=U[q];return q}}).call(this,j(29))},function(rt,p){var j;j=function(){return this}();try{j=j||new Function("return this")()}catch{typeof window=="object"&&(j=window)}rt.exports=j},function(rt,p,j){"use strict";p.byteLength=function(b){var H=o(b),C=H[0],A=H[1];return 3*(C+A)/4-A},p.toByteArray=function(b){var H,C,A=o(b),F=A[0],O=A[1],Y=new k(function($,et,ot){return 3*(et+ot)/4-ot}(0,F,O)),M=0,K=O>0?F-4:F;for(C=0;C<K;C+=4)H=l[b.charCodeAt(C)]<<18|l[b.charCodeAt(C+1)]<<12|l[b.charCodeAt(C+2)]<<6|l[b.charCodeAt(C+3)],Y[M++]=H>>16&255,Y[M++]=H>>8&255,Y[M++]=255&H;return O===2&&(H=l[b.charCodeAt(C)]<<2|l[b.charCodeAt(C+1)]>>4,Y[M++]=255&H),O===1&&(H=l[b.charCodeAt(C)]<<10|l[b.charCodeAt(C+1)]<<4|l[b.charCodeAt(C+2)]>>2,Y[M++]=H>>8&255,Y[M++]=255&H),Y},p.fromByteArray=function(b){for(var H,C=b.length,A=C%3,F=[],O=16383,Y=0,M=C-A;Y<M;Y+=O)F.push(d(b,Y,Y+O>M?M:Y+O));return A===1?(H=b[C-1],F.push(T[H>>2]+T[H<<4&63]+"==")):A===2&&(H=(b[C-2]<<8)+b[C-1],F.push(T[H>>10]+T[H>>4&63]+T[H<<2&63]+"=")),F.join("")};for(var T=[],l=[],k=typeof Uint8Array<"u"?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=m.length;a<u;++a)T[a]=m[a],l[m.charCodeAt(a)]=a;function o(P){var b=P.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var H=P.indexOf("=");return H===-1&&(H=b),[H,H===b?0:4-H%4]}function d(P,b,H){for(var C,A,F=[],O=b;O<H;O+=3)C=(P[O]<<16&16711680)+(P[O+1]<<8&65280)+(255&P[O+2]),F.push(T[(A=C)>>18&63]+T[A>>12&63]+T[A>>6&63]+T[63&A]);return F.join("")}l[45]=62,l[95]=63},function(rt,p){p.read=function(j,T,l,k,m){var a,u,o=8*m-k-1,d=(1<<o)-1,P=d>>1,b=-7,H=l?m-1:0,C=l?-1:1,A=j[T+H];for(H+=C,a=A&(1<<-b)-1,A>>=-b,b+=o;b>0;a=256*a+j[T+H],H+=C,b-=8);for(u=a&(1<<-b)-1,a>>=-b,b+=k;b>0;u=256*u+j[T+H],H+=C,b-=8);if(a===0)a=1-P;else{if(a===d)return u?NaN:1/0*(A?-1:1);u+=Math.pow(2,k),a-=P}return(A?-1:1)*u*Math.pow(2,a-k)},p.write=function(j,T,l,k,m,a){var u,o,d,P=8*a-m-1,b=(1<<P)-1,H=b>>1,C=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=k?0:a-1,F=k?1:-1,O=T<0||T===0&&1/T<0?1:0;for(T=Math.abs(T),isNaN(T)||T===1/0?(o=isNaN(T)?1:0,u=b):(u=Math.floor(Math.log(T)/Math.LN2),T*(d=Math.pow(2,-u))<1&&(u--,d*=2),(T+=u+H>=1?C/d:C*Math.pow(2,1-H))*d>=2&&(u++,d/=2),u+H>=b?(o=0,u=b):u+H>=1?(o=(T*d-1)*Math.pow(2,m),u+=H):(o=T*Math.pow(2,H-1)*Math.pow(2,m),u=0));m>=8;j[l+A]=255&o,A+=F,o/=256,m-=8);for(u=u<<m|o,P+=m;P>0;j[l+A]=255&u,A+=F,u/=256,P-=8);j[l+A-F]|=128*O}},function(rt,p){var j={}.toString;rt.exports=Array.isArray||function(T){return j.call(T)=="[object Array]"}},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.default=function(k){var m=k.jws,a=k.KeyUtil,u=k.X509,o=k.crypto,d=k.hextob64u,P=k.b64tohex,b=k.AllowedSigningAlgs;return function(){function H(){(function(A,F){if(!(A instanceof F))throw new TypeError("Cannot call a class as a function")})(this,H)}return H.parseJwt=function(A){T.Log.debug("JoseUtil.parseJwt");try{var F=m.JWS.parse(A);return{header:F.headerObj,payload:F.payloadObj}}catch(O){T.Log.error(O)}},H.validateJwt=function(A,F,O,Y,M,K,I){T.Log.debug("JoseUtil.validateJwt");try{if(F.kty==="RSA")if(F.e&&F.n)F=a.getKey(F);else{if(!F.x5c||!F.x5c.length)return T.Log.error("JoseUtil.validateJwt: RSA key missing key material",F),Promise.reject(new Error("RSA key missing key material"));var $=P(F.x5c[0]);F=u.getPublicKeyFromCertHex($)}else{if(F.kty!=="EC")return T.Log.error("JoseUtil.validateJwt: Unsupported key type",F&&F.kty),Promise.reject(new Error(F.kty));if(!(F.crv&&F.x&&F.y))return T.Log.error("JoseUtil.validateJwt: EC key missing key material",F),Promise.reject(new Error("EC key missing key material"));F=a.getKey(F)}return H._validateJwt(A,F,O,Y,M,K,I)}catch(et){return T.Log.error(et&&et.message||et),Promise.reject("JWT validation failed")}},H.validateJwtAttributes=function(A,F,O,Y,M,K){Y||(Y=0),M||(M=parseInt(Date.now()/1e3));var I=H.parseJwt(A).payload;if(!I.iss)return T.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(I.iss!==F)return T.Log.error("JoseUtil._validateJwt: Invalid issuer in token",I.iss),Promise.reject(new Error("Invalid issuer in token: "+I.iss));if(!I.aud)return T.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(I.aud===O||Array.isArray(I.aud)&&I.aud.indexOf(O)>=0))return T.Log.error("JoseUtil._validateJwt: Invalid audience in token",I.aud),Promise.reject(new Error("Invalid audience in token: "+I.aud));if(I.azp&&I.azp!==O)return T.Log.error("JoseUtil._validateJwt: Invalid azp in token",I.azp),Promise.reject(new Error("Invalid azp in token: "+I.azp));if(!K){var $=M+Y,et=M-Y;if(!I.iat)return T.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if($<I.iat)return T.Log.error("JoseUtil._validateJwt: iat is in the future",I.iat),Promise.reject(new Error("iat is in the future: "+I.iat));if(I.nbf&&$<I.nbf)return T.Log.error("JoseUtil._validateJwt: nbf is in the future",I.nbf),Promise.reject(new Error("nbf is in the future: "+I.nbf));if(!I.exp)return T.Log.error("JoseUtil._validateJwt: exp was not provided"),Promise.reject(new Error("exp was not provided"));if(I.exp<et)return T.Log.error("JoseUtil._validateJwt: exp is in the past",I.exp),Promise.reject(new Error("exp is in the past:"+I.exp))}return Promise.resolve(I)},H._validateJwt=function(A,F,O,Y,M,K,I){return H.validateJwtAttributes(A,O,Y,M,K,I).then(function($){try{return m.JWS.verify(A,F,b)?$:(T.Log.error("JoseUtil._validateJwt: signature validation failed"),Promise.reject(new Error("signature validation failed")))}catch(et){return T.Log.error(et&&et.message||et),Promise.reject(new Error("signature validation failed"))}})},H.hashString=function(A,F){try{return o.Util.hashString(A,F)}catch(O){T.Log.error(O)}},H.hexToBase64Url=function(A){try{return d(A)}catch(F){T.Log.error(F)}},H}()};var T=j(0);rt.exports=p.default},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SigninResponse=void 0;var T=function(){function m(a,u){for(var o=0;o<u.length;o++){var d=u[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(a,u,o){return u&&m(a.prototype,u),o&&m(a,o),a}}(),l=j(3);function k(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")}p.SigninResponse=function(){function m(a){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"#";k(this,m);var o=l.UrlUtility.parseUrlFragment(a,u);this.error=o.error,this.error_description=o.error_description,this.error_uri=o.error_uri,this.code=o.code,this.state=o.state,this.id_token=o.id_token,this.session_state=o.session_state,this.access_token=o.access_token,this.token_type=o.token_type,this.scope=o.scope,this.profile=void 0,this.expires_in=o.expires_in}return T(m,[{key:"expires_in",get:function(){if(this.expires_at){var u=parseInt(Date.now()/1e3);return this.expires_at-u}},set:function(u){var o=parseInt(u);if(typeof o=="number"&&o>0){var d=parseInt(Date.now()/1e3);this.expires_at=d+o}}},{key:"expired",get:function(){var u=this.expires_in;if(u!==void 0)return u<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SignoutRequest=void 0;var T=j(0),l=j(3),k=j(9);p.SignoutRequest=function m(a){var u=a.url,o=a.id_token_hint,d=a.post_logout_redirect_uri,P=a.data,b=a.extraQueryParams,H=a.request_type;if(function(F,O){if(!(F instanceof O))throw new TypeError("Cannot call a class as a function")}(this,m),!u)throw T.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var C in o&&(u=l.UrlUtility.addQueryParam(u,"id_token_hint",o)),d&&(u=l.UrlUtility.addQueryParam(u,"post_logout_redirect_uri",d),P&&(this.state=new k.State({data:P,request_type:H}),u=l.UrlUtility.addQueryParam(u,"state",this.state.id))),b)u=l.UrlUtility.addQueryParam(u,C,b[C]);this.url=u}},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SignoutResponse=void 0;var T=j(3);p.SignoutResponse=function l(k){(function(u,o){if(!(u instanceof o))throw new TypeError("Cannot call a class as a function")})(this,l);var m=T.UrlUtility.parseUrlFragment(k,"?");this.error=m.error,this.error_description=m.error_description,this.error_uri=m.error_uri,this.state=m.state}},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.InMemoryWebStorage=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.InMemoryWebStorage=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k),this._data={}}return k.prototype.getItem=function(a){return l.Log.debug("InMemoryWebStorage.getItem",a),this._data[a]},k.prototype.setItem=function(a,u){l.Log.debug("InMemoryWebStorage.setItem",a),this._data[a]=u},k.prototype.removeItem=function(a){l.Log.debug("InMemoryWebStorage.removeItem",a),delete this._data[a]},k.prototype.key=function(a){return Object.getOwnPropertyNames(this._data)[a]},T(k,[{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UserManager=void 0;var T=function(){function O(Y,M){for(var K=0;K<M.length;K++){var I=M[K];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(Y,I.key,I)}}return function(Y,M,K){return M&&O(Y.prototype,M),K&&O(Y,K),Y}}(),l=j(0),k=j(10),m=j(39),a=j(15),u=j(45),o=j(47),d=j(18),P=j(8),b=j(20),H=j(11),C=j(4);function A(O,Y){if(!(O instanceof Y))throw new TypeError("Cannot call a class as a function")}function F(O,Y){if(!O)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!Y||typeof Y!="object"&&typeof Y!="function"?O:Y}p.UserManager=function(O){function Y(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o.SilentRenewService,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d.SessionMonitor,$=arguments.length>3&&arguments[3]!==void 0?arguments[3]:b.TokenRevocationClient,et=arguments.length>4&&arguments[4]!==void 0?arguments[4]:H.TokenClient,ot=arguments.length>5&&arguments[5]!==void 0?arguments[5]:C.JoseUtil;A(this,Y),M instanceof m.UserManagerSettings||(M=new m.UserManagerSettings(M));var B=F(this,O.call(this,M));return B._events=new u.UserManagerEvents(M),B._silentRenewService=new K(B),B.settings.automaticSilentRenew&&(l.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),B.startSilentRenew()),B.settings.monitorSession&&(l.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),B._sessionMonitor=new I(B)),B._tokenRevocationClient=new $(B._settings),B._tokenClient=new et(B._settings),B._joseUtil=ot,B}return function(K,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);K.prototype=Object.create(I&&I.prototype,{constructor:{value:K,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(K,I):K.__proto__=I)}(Y,O),Y.prototype.getUser=function(){var K=this;return this._loadUser().then(function(I){return I?(l.Log.info("UserManager.getUser: user loaded"),K._events.load(I,!1),I):(l.Log.info("UserManager.getUser: user not found in storage"),null)})},Y.prototype.removeUser=function(){var K=this;return this.storeUser(null).then(function(){l.Log.info("UserManager.removeUser: user removed from storage"),K._events.unload()})},Y.prototype.signinRedirect=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(K=Object.assign({},K)).request_type="si:r";var I={useReplaceToNavigate:K.useReplaceToNavigate};return this._signinStart(K,this._redirectNavigator,I).then(function(){l.Log.info("UserManager.signinRedirect: successful")})},Y.prototype.signinRedirectCallback=function(K){return this._signinEnd(K||this._redirectNavigator.url).then(function(I){return I.profile&&I.profile.sub?l.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",I.profile.sub):l.Log.info("UserManager.signinRedirectCallback: no sub"),I})},Y.prototype.signinPopup=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(K=Object.assign({},K)).request_type="si:p";var I=K.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return I?(K.redirect_uri=I,K.display="popup",this._signin(K,this._popupNavigator,{startUrl:I,popupWindowFeatures:K.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:K.popupWindowTarget||this.settings.popupWindowTarget}).then(function($){return $&&($.profile&&$.profile.sub?l.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",$.profile.sub):l.Log.info("UserManager.signinPopup: no sub")),$})):(l.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},Y.prototype.signinPopupCallback=function(K){return this._signinCallback(K,this._popupNavigator).then(function(I){return I&&(I.profile&&I.profile.sub?l.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",I.profile.sub):l.Log.info("UserManager.signinPopupCallback: no sub")),I}).catch(function(I){l.Log.error(I.message)})},Y.prototype.signinSilent=function(){var K=this,I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return I=Object.assign({},I),this._loadUser().then(function($){return $&&$.refresh_token?(I.refresh_token=$.refresh_token,K._useRefreshToken(I)):(I.request_type="si:s",I.id_token_hint=I.id_token_hint||K.settings.includeIdTokenInSilentRenew&&$&&$.id_token,$&&K._settings.validateSubOnSilentRenew&&(l.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",$.profile.sub),I.current_sub=$.profile.sub),K._signinSilentIframe(I))})},Y.prototype._useRefreshToken=function(){var K=this,I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(I).then(function($){return $?$.access_token?K._loadUser().then(function(et){if(et){var ot=Promise.resolve();return $.id_token&&(ot=K._validateIdTokenFromTokenRefreshToken(et.profile,$.id_token)),ot.then(function(){return l.Log.debug("UserManager._useRefreshToken: refresh token response success"),et.id_token=$.id_token||et.id_token,et.access_token=$.access_token,et.refresh_token=$.refresh_token||et.refresh_token,et.expires_in=$.expires_in,K.storeUser(et).then(function(){return K._events.load(et),et})})}return null}):(l.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(l.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))})},Y.prototype._validateIdTokenFromTokenRefreshToken=function(K,I){var $=this;return this._metadataService.getIssuer().then(function(et){return $.settings.getEpochTime().then(function(ot){return $._joseUtil.validateJwtAttributes(I,et,$._settings.client_id,$._settings.clockSkew,ot).then(function(B){return B?B.sub!==K.sub?(l.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):B.auth_time&&B.auth_time!==K.auth_time?(l.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):B.azp&&B.azp!==K.azp?(l.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!B.azp&&K.azp?(l.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(l.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))})})})},Y.prototype._signinSilentIframe=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=K.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return I?(K.redirect_uri=I,K.prompt=K.prompt||"none",this._signin(K,this._iframeNavigator,{startUrl:I,silentRequestTimeout:K.silentRequestTimeout||this.settings.silentRequestTimeout}).then(function($){return $&&($.profile&&$.profile.sub?l.Log.info("UserManager.signinSilent: successful, signed in sub: ",$.profile.sub):l.Log.info("UserManager.signinSilent: no sub")),$})):(l.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},Y.prototype.signinSilentCallback=function(K){return this._signinCallback(K,this._iframeNavigator).then(function(I){return I&&(I.profile&&I.profile.sub?l.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",I.profile.sub):l.Log.info("UserManager.signinSilentCallback: no sub")),I})},Y.prototype.signinCallback=function(K){var I=this;return this.readSigninResponseState(K).then(function($){var et=$.state;return $.response,et.request_type==="si:r"?I.signinRedirectCallback(K):et.request_type==="si:p"?I.signinPopupCallback(K):et.request_type==="si:s"?I.signinSilentCallback(K):Promise.reject(new Error("invalid response_type in state"))})},Y.prototype.signoutCallback=function(K,I){var $=this;return this.readSignoutResponseState(K).then(function(et){var ot=et.state,B=et.response;return ot?ot.request_type==="so:r"?$.signoutRedirectCallback(K):ot.request_type==="so:p"?$.signoutPopupCallback(K,I):Promise.reject(new Error("invalid response_type in state")):B})},Y.prototype.querySessionStatus=function(){var K=this,I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(I=Object.assign({},I)).request_type="si:s";var $=I.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return $?(I.redirect_uri=$,I.prompt="none",I.response_type=I.response_type||this.settings.query_status_response_type,I.scope=I.scope||"openid",I.skipUserInfo=!0,this._signinStart(I,this._iframeNavigator,{startUrl:$,silentRequestTimeout:I.silentRequestTimeout||this.settings.silentRequestTimeout}).then(function(et){return K.processSigninResponse(et.url).then(function(ot){if(l.Log.debug("UserManager.querySessionStatus: got signin response"),ot.session_state&&ot.profile.sub)return l.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",ot.profile.sub),{session_state:ot.session_state,sub:ot.profile.sub,sid:ot.profile.sid};l.Log.info("querySessionStatus successful, user not authenticated")}).catch(function(ot){if(ot.session_state&&K.settings.monitorAnonymousSession&&(ot.message=="login_required"||ot.message=="consent_required"||ot.message=="interaction_required"||ot.message=="account_selection_required"))return l.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:ot.session_state};throw ot})})):(l.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},Y.prototype._signin=function(K,I){var $=this,et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._signinStart(K,I,et).then(function(ot){return $._signinEnd(ot.url,K)})},Y.prototype._signinStart=function(K,I){var $=this,et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return I.prepare(et).then(function(ot){return l.Log.debug("UserManager._signinStart: got navigator window handle"),$.createSigninRequest(K).then(function(B){return l.Log.debug("UserManager._signinStart: got signin request"),et.url=B.url,et.id=B.state.id,ot.navigate(et)}).catch(function(B){throw ot.close&&(l.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),ot.close()),B})})},Y.prototype._signinEnd=function(K){var I=this,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.processSigninResponse(K).then(function(et){l.Log.debug("UserManager._signinEnd: got signin response");var ot=new a.User(et);if($.current_sub){if($.current_sub!==ot.profile.sub)return l.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",ot.profile.sub),Promise.reject(new Error("login_required"));l.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return I.storeUser(ot).then(function(){return l.Log.debug("UserManager._signinEnd: user stored"),I._events.load(ot),ot})})},Y.prototype._signinCallback=function(K,I){l.Log.debug("UserManager._signinCallback");var $=this._settings.response_mode==="query"||!this._settings.response_mode&&P.SigninRequest.isCode(this._settings.response_type)?"?":"#";return I.callback(K,void 0,$)},Y.prototype.signoutRedirect=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(K=Object.assign({},K)).request_type="so:r";var I=K.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;I&&(K.post_logout_redirect_uri=I);var $={useReplaceToNavigate:K.useReplaceToNavigate};return this._signoutStart(K,this._redirectNavigator,$).then(function(){l.Log.info("UserManager.signoutRedirect: successful")})},Y.prototype.signoutRedirectCallback=function(K){return this._signoutEnd(K||this._redirectNavigator.url).then(function(I){return l.Log.info("UserManager.signoutRedirectCallback: successful"),I})},Y.prototype.signoutPopup=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(K=Object.assign({},K)).request_type="so:p";var I=K.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return K.post_logout_redirect_uri=I,K.display="popup",K.post_logout_redirect_uri&&(K.state=K.state||{}),this._signout(K,this._popupNavigator,{startUrl:I,popupWindowFeatures:K.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:K.popupWindowTarget||this.settings.popupWindowTarget}).then(function(){l.Log.info("UserManager.signoutPopup: successful")})},Y.prototype.signoutPopupCallback=function(K,I){return I===void 0&&typeof K=="boolean"&&(I=K,K=null),this._popupNavigator.callback(K,I,"?").then(function(){l.Log.info("UserManager.signoutPopupCallback: successful")})},Y.prototype._signout=function(K,I){var $=this,et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._signoutStart(K,I,et).then(function(ot){return $._signoutEnd(ot.url)})},Y.prototype._signoutStart=function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=this,$=arguments[1],et=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $.prepare(et).then(function(ot){return l.Log.debug("UserManager._signoutStart: got navigator window handle"),I._loadUser().then(function(B){return l.Log.debug("UserManager._signoutStart: loaded current user from storage"),(I._settings.revokeAccessTokenOnSignout?I._revokeInternal(B):Promise.resolve()).then(function(){var nt=K.id_token_hint||B&&B.id_token;return nt&&(l.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),K.id_token_hint=nt),I.removeUser().then(function(){return l.Log.debug("UserManager._signoutStart: user removed, creating signout request"),I.createSignoutRequest(K).then(function(ft){return l.Log.debug("UserManager._signoutStart: got signout request"),et.url=ft.url,ft.state&&(et.id=ft.state.id),ot.navigate(et)})})})}).catch(function(B){throw ot.close&&(l.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),ot.close()),B})})},Y.prototype._signoutEnd=function(K){return this.processSignoutResponse(K).then(function(I){return l.Log.debug("UserManager._signoutEnd: got signout response"),I})},Y.prototype.revokeAccessToken=function(){var K=this;return this._loadUser().then(function(I){return K._revokeInternal(I,!0).then(function($){if($)return l.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),I.access_token=null,I.refresh_token=null,I.expires_at=null,I.token_type=null,K.storeUser(I).then(function(){l.Log.debug("UserManager.revokeAccessToken: user stored"),K._events.load(I)})})}).then(function(){l.Log.info("UserManager.revokeAccessToken: access token revoked successfully")})},Y.prototype._revokeInternal=function(K,I){var $=this;if(K){var et=K.access_token,ot=K.refresh_token;return this._revokeAccessTokenInternal(et,I).then(function(B){return $._revokeRefreshTokenInternal(ot,I).then(function(nt){return B||nt||l.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),B||nt})})}return Promise.resolve(!1)},Y.prototype._revokeAccessTokenInternal=function(K,I){return!K||K.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(K,I).then(function(){return!0})},Y.prototype._revokeRefreshTokenInternal=function(K,I){return K?this._tokenRevocationClient.revoke(K,I,"refresh_token").then(function(){return!0}):Promise.resolve(!1)},Y.prototype.startSilentRenew=function(){this._silentRenewService.start()},Y.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},Y.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then(function(K){return K?(l.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(K)):(l.Log.debug("UserManager._loadUser: no user storageString"),null)})},Y.prototype.storeUser=function(K){if(K){l.Log.debug("UserManager.storeUser: storing user");var I=K.toStorageString();return this._userStore.set(this._userStoreKey,I)}return l.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},T(Y,[{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}}]),Y}(k.OidcClient)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UserManagerSettings=void 0;var T=function(){function H(C,A){for(var F=0;F<A.length;F++){var O=A[F];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(C,O.key,O)}}return function(C,A,F){return A&&H(C.prototype,A),F&&H(C,F),C}}(),l=(j(0),j(5)),k=j(40),m=j(41),a=j(43),u=j(6),o=j(1),d=j(8);function P(H,C){if(!(H instanceof C))throw new TypeError("Cannot call a class as a function")}function b(H,C){if(!H)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!C||typeof C!="object"&&typeof C!="function"?H:C}p.UserManagerSettings=function(H){function C(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=A.popup_redirect_uri,O=A.popup_post_logout_redirect_uri,Y=A.popupWindowFeatures,M=A.popupWindowTarget,K=A.silent_redirect_uri,I=A.silentRequestTimeout,$=A.automaticSilentRenew,et=$!==void 0&&$,ot=A.validateSubOnSilentRenew,B=ot!==void 0&&ot,nt=A.includeIdTokenInSilentRenew,ft=nt===void 0||nt,dt=A.monitorSession,jt=dt===void 0||dt,xt=A.monitorAnonymousSession,Zt=xt!==void 0&&xt,Tt=A.checkSessionInterval,pt=Tt===void 0?2e3:Tt,vt=A.stopCheckSessionOnError,At=vt===void 0||vt,Wt=A.query_status_response_type,Vt=A.revokeAccessTokenOnSignout,zt=Vt!==void 0&&Vt,$t=A.accessTokenExpiringNotificationTime,he=$t===void 0?60:$t,ee=A.redirectNavigator,Ut=ee===void 0?new k.RedirectNavigator:ee,Yt=A.popupNavigator,Kt=Yt===void 0?new m.PopupNavigator:Yt,U=A.iframeNavigator,c=U===void 0?new a.IFrameNavigator:U,h=A.userStore,N=h===void 0?new u.WebStorageStateStore({store:o.Global.sessionStorage}):h;P(this,C);var q=b(this,H.call(this,arguments[0]));return q._popup_redirect_uri=F,q._popup_post_logout_redirect_uri=O,q._popupWindowFeatures=Y,q._popupWindowTarget=M,q._silent_redirect_uri=K,q._silentRequestTimeout=I,q._automaticSilentRenew=et,q._validateSubOnSilentRenew=B,q._includeIdTokenInSilentRenew=ft,q._accessTokenExpiringNotificationTime=he,q._monitorSession=jt,q._monitorAnonymousSession=Zt,q._checkSessionInterval=pt,q._stopCheckSessionOnError=At,Wt?q._query_status_response_type=Wt:arguments[0]&&arguments[0].response_type?q._query_status_response_type=d.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":q._query_status_response_type="id_token",q._revokeAccessTokenOnSignout=zt,q._redirectNavigator=Ut,q._popupNavigator=Kt,q._iframeNavigator=c,q._userStore=N,q}return function(F,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);F.prototype=Object.create(O&&O.prototype,{constructor:{value:F,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(F,O):F.__proto__=O)}(C,H),T(C,[{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._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function(){return this._query_status_response_type}},{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}}]),C}(l.OidcClientSettings)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.RedirectNavigator=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.RedirectNavigator=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k)}return k.prototype.prepare=function(){return Promise.resolve(this)},k.prototype.navigate=function(a){return a&&a.url?(a.useReplaceToNavigate?window.location.replace(a.url):window.location=a.url,Promise.resolve()):(l.Log.error("RedirectNavigator.navigate: No url provided"),Promise.reject(new Error("No url provided")))},T(k,[{key:"url",get:function(){return window.location.href}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.PopupNavigator=void 0;var T=j(0),l=j(42);p.PopupNavigator=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k)}return k.prototype.prepare=function(a){var u=new l.PopupWindow(a);return Promise.resolve(u)},k.prototype.callback=function(a,u,o){T.Log.debug("PopupNavigator.callback");try{return l.PopupWindow.notifyOpener(a,u,o),Promise.resolve()}catch(d){return Promise.reject(d)}},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.PopupWindow=void 0;var T=function(){function m(a,u){for(var o=0;o<u.length;o++){var d=u[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(a,u,o){return u&&m(a.prototype,u),o&&m(a,o),a}}(),l=j(0),k=j(3);p.PopupWindow=function(){function m(a){var u=this;(function(b,H){if(!(b instanceof H))throw new TypeError("Cannot call a class as a function")})(this,m),this._promise=new Promise(function(P,b){u._resolve=P,u._reject=b});var o=a.popupWindowTarget||"_blank",d=a.popupWindowFeatures||"location=no,toolbar=no,width=500,height=500,left=100,top=100;";this._popup=window.open("",o,d),this._popup&&(l.Log.debug("PopupWindow.ctor: popup successfully created"),this._checkForPopupClosedTimer=window.setInterval(this._checkForPopupClosed.bind(this),500))}return m.prototype.navigate=function(u){return this._popup?u&&u.url?(l.Log.debug("PopupWindow.navigate: Setting URL in popup"),this._id=u.id,this._id&&(window["popupCallback_"+u.id]=this._callback.bind(this)),this._popup.focus(),this._popup.window.location=u.url):(this._error("PopupWindow.navigate: no url provided"),this._error("No url provided")):this._error("PopupWindow.navigate: Error opening popup window"),this.promise},m.prototype._success=function(u){l.Log.debug("PopupWindow.callback: Successful response from popup window"),this._cleanup(),this._resolve(u)},m.prototype._error=function(u){l.Log.error("PopupWindow.error: ",u),this._cleanup(),this._reject(new Error(u))},m.prototype.close=function(){this._cleanup(!1)},m.prototype._cleanup=function(u){l.Log.debug("PopupWindow.cleanup"),window.clearInterval(this._checkForPopupClosedTimer),this._checkForPopupClosedTimer=null,delete window["popupCallback_"+this._id],this._popup&&!u&&this._popup.close(),this._popup=null},m.prototype._checkForPopupClosed=function(){this._popup&&!this._popup.closed||this._error("Popup window closed")},m.prototype._callback=function(u,o){this._cleanup(o),u?(l.Log.debug("PopupWindow.callback success"),this._success({url:u})):(l.Log.debug("PopupWindow.callback: Invalid response from popup"),this._error("Invalid response from popup"))},m.notifyOpener=function(u,o,d){if(window.opener){if(u=u||window.location.href){var P=k.UrlUtility.parseUrlFragment(u,d);if(P.state){var b="popupCallback_"+P.state,H=window.opener[b];H?(l.Log.debug("PopupWindow.notifyOpener: passing url message to opener"),H(u,o)):l.Log.warn("PopupWindow.notifyOpener: no matching callback found on opener")}else l.Log.warn("PopupWindow.notifyOpener: no state found in response url")}}else l.Log.warn("PopupWindow.notifyOpener: no window.opener. Can't complete notification.")},T(m,[{key:"promise",get:function(){return this._promise}}]),m}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.IFrameNavigator=void 0;var T=j(0),l=j(44);p.IFrameNavigator=function(){function k(){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,k)}return k.prototype.prepare=function(a){var u=new l.IFrameWindow(a);return Promise.resolve(u)},k.prototype.callback=function(a){T.Log.debug("IFrameNavigator.callback");try{return l.IFrameWindow.notifyParent(a),Promise.resolve()}catch(u){return Promise.reject(u)}},k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.IFrameWindow=void 0;var T=function(){function k(m,a){for(var u=0;u<a.length;u++){var o=a[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(m,o.key,o)}}return function(m,a,u){return a&&k(m.prototype,a),u&&k(m,u),m}}(),l=j(0);p.IFrameWindow=function(){function k(m){var a=this;(function(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")})(this,k),this._promise=new Promise(function(u,o){a._resolve=u,a._reject=o}),this._boundMessageEvent=this._message.bind(this),window.addEventListener("message",this._boundMessageEvent,!1),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.width=0,this._frame.height=0,window.document.body.appendChild(this._frame)}return k.prototype.navigate=function(a){if(a&&a.url){var u=a.silentRequestTimeout||1e4;l.Log.debug("IFrameWindow.navigate: Using timeout of:",u),this._timer=window.setTimeout(this._timeout.bind(this),u),this._frame.src=a.url}else this._error("No url provided");return this.promise},k.prototype._success=function(a){this._cleanup(),l.Log.debug("IFrameWindow: Successful response from frame window"),this._resolve(a)},k.prototype._error=function(a){this._cleanup(),l.Log.error(a),this._reject(new Error(a))},k.prototype.close=function(){this._cleanup()},k.prototype._cleanup=function(){this._frame&&(l.Log.debug("IFrameWindow: cleanup"),window.removeEventListener("message",this._boundMessageEvent,!1),window.clearTimeout(this._timer),window.document.body.removeChild(this._frame),this._timer=null,this._frame=null,this._boundMessageEvent=null)},k.prototype._timeout=function(){l.Log.debug("IFrameWindow.timeout"),this._error("Frame window timed out")},k.prototype._message=function(a){if(l.Log.debug("IFrameWindow.message"),this._timer&&a.origin===this._origin&&a.source===this._frame.contentWindow&&typeof a.data=="string"&&(a.data.startsWith("http://")||a.data.startsWith("https://"))){var u=a.data;u?this._success({url:u}):this._error("Invalid response from frame")}},k.notifyParent=function(a){l.Log.debug("IFrameWindow.notifyParent"),(a=a||window.location.href)&&(l.Log.debug("IFrameWindow.notifyParent: posting url message to parent"),window.parent.postMessage(a,location.protocol+"//"+location.host))},T(k,[{key:"promise",get:function(){return this._promise}},{key:"_origin",get:function(){return location.protocol+"//"+location.host}}]),k}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.UserManagerEvents=void 0;var T=j(0),l=j(16),k=j(17);p.UserManagerEvents=function(m){function a(u){(function(P,b){if(!(P instanceof b))throw new TypeError("Cannot call a class as a function")})(this,a);var o=function(P,b){if(!P)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||typeof b!="object"&&typeof b!="function"?P:b}(this,m.call(this,u));return o._userLoaded=new k.Event("User loaded"),o._userUnloaded=new k.Event("User unloaded"),o._silentRenewError=new k.Event("Silent renew error"),o._userSignedIn=new k.Event("User signed in"),o._userSignedOut=new k.Event("User signed out"),o._userSessionChanged=new k.Event("User session changed"),o}return function(o,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof d);o.prototype=Object.create(d&&d.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),d&&(Object.setPrototypeOf?Object.setPrototypeOf(o,d):o.__proto__=d)}(a,m),a.prototype.load=function(o){var d=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];T.Log.debug("UserManagerEvents.load"),m.prototype.load.call(this,o),d&&this._userLoaded.raise(o)},a.prototype.unload=function(){T.Log.debug("UserManagerEvents.unload"),m.prototype.unload.call(this),this._userUnloaded.raise()},a.prototype.addUserLoaded=function(o){this._userLoaded.addHandler(o)},a.prototype.removeUserLoaded=function(o){this._userLoaded.removeHandler(o)},a.prototype.addUserUnloaded=function(o){this._userUnloaded.addHandler(o)},a.prototype.removeUserUnloaded=function(o){this._userUnloaded.removeHandler(o)},a.prototype.addSilentRenewError=function(o){this._silentRenewError.addHandler(o)},a.prototype.removeSilentRenewError=function(o){this._silentRenewError.removeHandler(o)},a.prototype._raiseSilentRenewError=function(o){T.Log.debug("UserManagerEvents._raiseSilentRenewError",o.message),this._silentRenewError.raise(o)},a.prototype.addUserSignedIn=function(o){this._userSignedIn.addHandler(o)},a.prototype.removeUserSignedIn=function(o){this._userSignedIn.removeHandler(o)},a.prototype._raiseUserSignedIn=function(){T.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},a.prototype.addUserSignedOut=function(o){this._userSignedOut.addHandler(o)},a.prototype.removeUserSignedOut=function(o){this._userSignedOut.removeHandler(o)},a.prototype._raiseUserSignedOut=function(){T.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},a.prototype.addUserSessionChanged=function(o){this._userSessionChanged.addHandler(o)},a.prototype.removeUserSessionChanged=function(o){this._userSessionChanged.removeHandler(o)},a.prototype._raiseUserSessionChanged=function(){T.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},a}(l.AccessTokenEvents)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Timer=void 0;var T=function(){function o(d,P){for(var b=0;b<P.length;b++){var H=P[b];H.enumerable=H.enumerable||!1,H.configurable=!0,"value"in H&&(H.writable=!0),Object.defineProperty(d,H.key,H)}}return function(d,P,b){return P&&o(d.prototype,P),b&&o(d,b),d}}(),l=j(0),k=j(1),m=j(17);function a(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")}function u(o,d){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||typeof d!="object"&&typeof d!="function"?o:d}p.Timer=function(o){function d(P){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.Global.timer,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;a(this,d);var C=u(this,o.call(this,P));return C._timer=b,C._nowFunc=H||function(){return Date.now()/1e3},C}return function(b,H){if(typeof H!="function"&&H!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof H);b.prototype=Object.create(H&&H.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),H&&(Object.setPrototypeOf?Object.setPrototypeOf(b,H):b.__proto__=H)}(d,o),d.prototype.init=function(b){b<=0&&(b=1),b=parseInt(b);var H=this.now+b;if(this.expiration===H&&this._timerHandle)l.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),l.Log.debug("Timer.init timer "+this._name+" for duration:",b),this._expiration=H;var C=5;b<C&&(C=b),this._timerHandle=this._timer.setInterval(this._callback.bind(this),1e3*C)}},d.prototype.cancel=function(){this._timerHandle&&(l.Log.debug("Timer.cancel: ",this._name),this._timer.clearInterval(this._timerHandle),this._timerHandle=null)},d.prototype._callback=function(){var b=this._expiration-this.now;l.Log.debug("Timer.callback; "+this._name+" timer expires in:",b),this._expiration<=this.now&&(this.cancel(),o.prototype.raise.call(this))},T(d,[{key:"now",get:function(){return parseInt(this._nowFunc())}},{key:"expiration",get:function(){return this._expiration}}]),d}(m.Event)},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.SilentRenewService=void 0;var T=j(0);p.SilentRenewService=function(){function l(k){(function(a,u){if(!(a instanceof u))throw new TypeError("Cannot call a class as a function")})(this,l),this._userManager=k}return l.prototype.start=function(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then(function(m){}).catch(function(m){T.Log.error("SilentRenewService.start: Error from getUser:",m.message)}))},l.prototype.stop=function(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},l.prototype._tokenExpiring=function(){var m=this;this._userManager.signinSilent().then(function(a){T.Log.debug("SilentRenewService._tokenExpiring: Silent token renewal successful")},function(a){T.Log.error("SilentRenewService._tokenExpiring: Error from signinSilent:",a.message),m._userManager.events._raiseSilentRenewError(a)})},l}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CordovaPopupNavigator=void 0;var T=j(21);p.CordovaPopupNavigator=function(){function l(){(function(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")})(this,l)}return l.prototype.prepare=function(m){var a=new T.CordovaPopupWindow(m);return Promise.resolve(a)},l}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.CordovaIFrameNavigator=void 0;var T=j(21);p.CordovaIFrameNavigator=function(){function l(){(function(m,a){if(!(m instanceof a))throw new TypeError("Cannot call a class as a function")})(this,l)}return l.prototype.prepare=function(m){m.popupWindowFeatures="hidden=yes";var a=new T.CordovaPopupWindow(m);return Promise.resolve(a)},l}()},function(rt,p,j){"use strict";Object.defineProperty(p,"__esModule",{value:!0}),p.Version="1.11.5"}])})});var Hr={};Ir(Hr,{LogLevel:()=>lr,OidcErrorType:()=>fr,createOidcApi:()=>Nr,setupOidcClient:()=>Mr});function Nr(rt){return p=>(p.on("before-fetch",rt.extendHeaders),{getAccessToken(){return rt.token()},getProfile(){return rt.account()}})}var be=Dr(hr());var lr=(k=>(k.none="none",k.error="error",k.warn="warn",k.info="info",k.debug="debug",k))(lr||{}),fr=(k=>(k.unknown="unknown",k.notAuthorized="notAuthorized",k.silentRenewFailed="silentRenewFailed",k.invalidToken="invalidToken",k.oidcCallback="oidcCallback",k))(fr||{});var Ur={notAuthorized:"Not logged in. Please call `login()` to retrieve a token.",silentRenewFailed:"Silent renew failed to retrieve access token.",invalidToken:"Invalid token during authentication"},Or=(rt,p)=>Ur[rt]||(p?p.toString():"an unexpected error has occurred without a message"),ne=class rt extends Error{constructor(p,j){let T=Or(p,j);super(T),Error.captureStackTrace&&Error.captureStackTrace(this,rt),this.name="OidcError",this.type=p,this.innerError=j}};var Br={none:0,error:1,warn:2,info:3,debug:4};function je(rt){return window.location.pathname===new URL(rt).pathname}function jr(rt){return Br[rt]}function Mr(rt){let{clientId:p,clientSecret:j,identityProviderUri:T,redirectUri:l=`${location.origin}/auth`,signInRedirectParams:k,postLogoutRedirectUri:m=location.origin,responseType:a,responseMode:u,scopes:o,restrict:d=!1,parentName:P,appUri:b,logLevel:H,userStore:C,extraQueryParams:A,uiLocales:F,metadata:O,metadataUrl:Y,monitorSession:M}=rt,K=()=>P?P===window.parent?.name:window===window.top,I=new be.UserManager({authority:T,redirect_uri:l,silent_redirect_uri:l,popup_redirect_uri:l,post_logout_redirect_uri:m,client_id:p,client_secret:j,response_type:a,scope:o?.join(" "),userStore:C,extraQueryParams:A,ui_locales:F,response_mode:u,metadata:O,metadataUrl:Y,monitorSession:M});H!==void 0&&(be.Log.logger=console,be.Log.level=jr(H)),je(I.settings.post_logout_redirect_uri)&&(K()?I.signoutRedirectCallback():I.signoutPopupCallback());let $=()=>new Promise((B,nt)=>{I.getUser().then(ft=>{if(!ft)nt(new ne("notAuthorized"));else if(ft.access_token&&ft.expires_in>60)B(ft.access_token);else return I.signinSilent().then(dt=>dt?dt.access_token?B(dt.access_token):nt(new ne("invalidToken")):nt(new ne("silentRenewFailed")))}).catch(ft=>nt(new ne("unknown",ft)))});return{_:I,login(){return I.signinRedirect(k)},logout(){return I.signoutRedirect()},revoke(){return I.revokeAccessToken()},handleAuthentication:()=>new Promise(async(B,nt)=>{let ft;if((je(I.settings.silent_redirect_uri)||je(I.settings.popup_redirect_uri))&&!K()){try{ft=await I.signinSilentCallback()}catch(dt){return nt(new ne("oidcCallback",dt))}return B({shouldRender:!1,state:ft?.state})}if(je(I.settings.redirect_uri)&&K()){try{ft=await I.signinCallback()}catch(dt){return nt(new ne("oidcCallback",dt))}return b?(be.Log.debug(`Redirecting to ${b} due to appUri being configured.`),window.location.href=b,B({shouldRender:!1,state:ft?.state})):B({shouldRender:!0,state:ft?.state})}return $().then(dt=>dt?B({shouldRender:!0}):nt(new ne("invalidToken"))).catch(async dt=>dt.type==="notAuthorized"?(await I.signinRedirect(k),B({shouldRender:!1})):nt(dt))}),extendHeaders(B){d||B.setHeaders($().then(nt=>nt&&{Authorization:`Bearer ${nt}`},()=>{}))},token:$,account:()=>new Promise((B,nt)=>{I.getUser().then(ft=>!ft||ft.expires_in<=0?nt(new ne("notAuthorized")):B(ft.profile),ft=>nt(new ne("unknown",ft)))})}}return Lr(Hr);})();