import{a as br,b as j,c as y,d as oe}from"./chunk-BZHAVE2Z.js";import{$ as h,Ab as ct,Ba as er,C as ye,Cb as pe,D as be,Da as tr,Ea as ot,G as zt,Gb as or,Hb as ar,I as x,Ia as Fe,Ib as cr,J as P,Kc as fr,L as Te,La as rr,N as Bt,Na as He,O as Gt,Pc as C,Q as re,Qb as Ue,Qc as gr,R as We,Ra as _e,Rc as F,Sa as he,Sc as mr,Tc as vr,Ua as ir,V as H,Vc as A,Xa as nr,Y as L,Yb as Le,Yc as Sr,Z as et,Zb as lr,Zc as wr,_b as ur,_c as Ce,a as E,aa as de,ab as sr,b as Se,ba as ie,ca as f,cd as yr,da as a,ea as Jt,fa as Yt,ga as tt,h as Q,ha as rt,hb as $e,hd as Ae,ia as Qt,jb as Ne,jc as dr,k as De,ka as it,kc as se,l as Oe,la as q,m as te,ma as nt,n as Nt,na as Zt,nb as Ie,oa as st,ob as $,p as we,pb as V,pc as hr,q as g,qa as ne,qb as N,r as S,s as Lt,t as qt,u as Vt,ua as ke,uc as pr,v as Kt,w as R,y as ue,ya as Xt,yb as at}from"./chunk-YRDWIHVT.js";var ri=new ie("cdk-dir-doc",{providedIn:"root",factory:()=>a(q)}),ii=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;function kr(i){let l=i?.toLowerCase()||"";return l==="auto"&&typeof navigator<"u"&&navigator?.language?ii.test(navigator.language)?"rtl":"ltr":l==="rtl"?"rtl":"ltr"}var ni=(()=>{class i{get value(){return this.valueSignal()}valueSignal=ne("ltr");change=new Zt;constructor(){let e=a(ri,{optional:!0});if(e){let t=e.body?e.body.dir:null,r=e.documentElement?e.documentElement.dir:null;this.valueSignal.set(kr(t||r||"ltr"))}}ngOnDestroy(){this.change.complete()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Ir=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=he({type:i});static \u0275inj=de({})}return i})();var qe=new WeakMap,oi=(()=>{class i{_appRef;_injector=a(it);_environmentInjector=a(Yt);load(e){let t=this._appRef=this._appRef||this._injector.get(sr),r=qe.get(t);r||(r={loaders:new Set,refs:[]},qe.set(t,r),t.onDestroy(()=>{qe.get(t)?.refs.forEach(n=>n.destroy()),qe.delete(t)})),r.loaders.has(e)||(r.loaders.add(e),r.refs.push(pr(e,{environmentInjector:this._environmentInjector})))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})();var Xn=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275cmp=_e({type:i,selectors:[["ng-component"]],exportAs:["cdkVisuallyHidden"],decls:0,vars:0,template:function(t,r){},styles:[`.cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0} `],encapsulation:2,changeDetection:0})}return i})(),Ve;function ai(){if(Ve===void 0&&(Ve=null,typeof window<"u")){let i=window;i.trustedTypes!==void 0&&(Ve=i.trustedTypes.createPolicy("angular#components",{createHTML:l=>l}))}return Ve}function ci(i){return ai()?.createHTML(i)||i}function es(i,l,e){let t=e.sanitize(er.HTML,l);i.innerHTML=ci(t||"")}var cs=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=he({type:i});static \u0275inj=de({imports:[Ir]})}return i})();var Cr={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6};var Ar={parse:function(l,e){return li(l,Cr,e)},stringify:function(l,e){return ui(l,Cr,e)}};function li(i,l,e){var t;if(e===void 0&&(e={}),!l.codes){l.codes={};for(var r=0;r=8&&(o-=8,s[u++]=255&c>>o)}if(o>=l.bits||255&c<<8-o)throw new SyntaxError("Unexpected end of data");return s}function ui(i,l,e){e===void 0&&(e={});for(var t=e,r=t.pad,n=r===void 0?!0:r,s=(1<l.bits;)c-=l.bits,o+=l.chars[s&u>>c];if(c&&(o+=l.chars[s&u<n.set({kind:1,value:c}),error:c=>{n.set({kind:2,error:c}),s?.()},complete:()=>{s?.()}});if(l?.requireSync&&n().kind===0)throw new et(601,!1);return s=t?.onDestroy(o.unsubscribe.bind(o)),se(()=>{let c=n();switch(c.kind){case 1:return c.value;case 2:throw c.error;case 0:throw new et(601,!1)}},{equal:l?.equal})}function di(i=Object.is){return(l,e)=>l.kind===1&&e.kind===1&&i(l.value,e.value)}var Ke=class{},dt=class{constructor(l){this.passedConfigs=l}loadConfigs(){return Array.isArray(this.passedConfigs)?g(this.passedConfigs):g([this.passedConfigs])}};function hi(i){if(!i?.config)throw new Error("No config provided!");return new dt(i.config)}var Er=new ie("PASSED_CONFIG"),Fr=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),pi=(()=>{class i{logError(e,...t){console.error(e,...t)}logWarning(e,...t){console.warn(e,...t)}logDebug(e,...t){console.debug(e,...t)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),xe=(function(i){return i[i.None=0]="None",i[i.Debug=1]="Debug",i[i.Warn=2]="Warn",i[i.Error=3]="Error",i})(xe||{}),k=(()=>{class i{constructor(){this.abstractLoggerService=a(Fr)}logError(e,t,...r){if(this.loggingIsTurnedOff(e))return;let{configId:n}=e,s=this.isObject(t)?JSON.stringify(t):t;r&&r.length?this.abstractLoggerService.logError(`[ERROR] ${n} - ${s}`,...r):this.abstractLoggerService.logError(`[ERROR] ${n} - ${s}`)}logWarning(e,t,...r){if(!this.logLevelIsSet(e)||this.loggingIsTurnedOff(e)||!this.currentLogLevelIsEqualOrSmallerThan(e,xe.Warn))return;let{configId:n}=e,s=this.isObject(t)?JSON.stringify(t):t;r&&r.length?this.abstractLoggerService.logWarning(`[WARN] ${n} - ${s}`,...r):this.abstractLoggerService.logWarning(`[WARN] ${n} - ${s}`)}logDebug(e,t,...r){if(!e||!this.logLevelIsSet(e)||this.loggingIsTurnedOff(e)||!this.currentLogLevelIsEqualOrSmallerThan(e,xe.Debug))return;let{configId:n}=e,s=this.isObject(t)?JSON.stringify(t):t;r&&r.length?this.abstractLoggerService.logDebug(`[DEBUG] ${n} - ${s}`,...r):this.abstractLoggerService.logDebug(`[DEBUG] ${n} - ${s}`)}currentLogLevelIsEqualOrSmallerThan(e,t){let{logLevel:r}=e||{};return r?r<=t:!1}logLevelIsSet(e){let{logLevel:t}=e||{};return t===null?!1:t!==void 0}loggingIsTurnedOff(e){let{logLevel:t}=e||{};return t===xe.None}isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),B=(function(i){return i[i.ConfigLoaded=0]="ConfigLoaded",i[i.CheckingAuth=1]="CheckingAuth",i[i.CheckingAuthFinished=2]="CheckingAuthFinished",i[i.CheckingAuthFinishedWithError=3]="CheckingAuthFinishedWithError",i[i.ConfigLoadingFailed=4]="ConfigLoadingFailed",i[i.CheckSessionReceived=5]="CheckSessionReceived",i[i.UserDataChanged=6]="UserDataChanged",i[i.NewAuthenticationResult=7]="NewAuthenticationResult",i[i.TokenExpired=8]="TokenExpired",i[i.IdTokenExpired=9]="IdTokenExpired",i[i.SilentRenewStarted=10]="SilentRenewStarted",i[i.SilentRenewFailed=11]="SilentRenewFailed",i})(B||{}),fe=(()=>{class i{constructor(){this.notify=new Nt(1)}fireEvent(e,t){this.notify.next({type:e,value:t})}registerForEvents(){return this.notify.asObservable()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Hr=(()=>{class i{static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),fi=(()=>{class i{constructor(){this.loggerService=a(k),this.abstractSecurityStorage=a(Hr)}read(e,t){let{configId:r}=t;if(!r)return this.loggerService.logDebug(t,`Wanted to read '${e}' but configId was '${r}'`),null;if(!this.hasStorage())return this.loggerService.logDebug(t,`Wanted to read '${e}' but Storage was undefined`),null;let n=this.abstractSecurityStorage.read(r);return n?JSON.parse(n):null}write(e,t){let{configId:r}=t;return r?this.hasStorage()?(e=e||null,this.abstractSecurityStorage.write(r,JSON.stringify(e)),!0):(this.loggerService.logDebug(t,"Wanted to write but Storage was falsy"),!1):(this.loggerService.logDebug(t,`Wanted to write but configId was '${r}'`),!1)}remove(e,t){let{configId:r}=t;return r?this.hasStorage()?(this.abstractSecurityStorage.remove(r),!0):(this.loggerService.logDebug(t,`Wanted to remove '${e}' but Storage was falsy`),!1):(this.loggerService.logDebug(t,`Wanted to remove '${e}' but configId was '${r}'`),!1)}clear(e){let{configId:t}=e;return t?this.hasStorage()?(this.abstractSecurityStorage.remove(t),!0):(this.loggerService.logDebug(e,"Wanted to clear storage but Storage was falsy"),!1):(this.loggerService.logDebug(e,`Wanted to clear storage but configId was '${t}'`),!1)}hasStorage(){return typeof Storage<"u"}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),M=(()=>{class i{constructor(){this.browserStorageService=a(fi)}read(e,t){return(this.browserStorageService.read(e,t)||{})[e]}write(e,t,r){let n=this.browserStorageService.read(e,r)||{};return n[e]=t,this.browserStorageService.write(n,r)}remove(e,t){let r=this.browserStorageService.read(e,t)||{};delete r[e],this.browserStorageService.write(r,t)}clear(e){this.browserStorageService.clear(e)}resetStorageFlowData(e){this.remove("session_state",e),this.remove("storageSilentRenewRunning",e),this.remove("storageCodeFlowInProgress",e),this.remove("codeVerifier",e),this.remove("userData",e),this.remove("storageCustomParamsAuthRequest",e),this.remove("access_token_expires_at",e),this.remove("storageCustomParamsRefresh",e),this.remove("storageCustomParamsEndSession",e),this.remove("reusable_refresh_token",e)}resetAuthStateInStorage(e){this.remove("authzData",e),this.remove("reusable_refresh_token",e),this.remove("authnResult",e)}getAccessToken(e){return this.read("authzData",e)}getIdToken(e){return this.read("authnResult",e)?.id_token}getRefreshToken(e){let t=this.read("authnResult",e)?.refresh_token;return!t&&e.allowUnsafeReuseRefreshToken?this.read("reusable_refresh_token",e):t}getAuthenticationResult(e){return this.read("authnResult",e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),_r=(()=>{class i{extractJwk(e,t,r=!0){if(e.length===0)throw gi;let n=e.filter(s=>t?.kid?s.kid===t.kid:!0).filter(s=>t?.use?s.use===t.use:!0).filter(s=>t?.kty?s.kty===t.kty:!0);if(n.length===0&&r)throw mi;if(n.length>1&&t==null)throw vi;return n}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function pt(i){return _r.name+": "+i}var gi={name:pt("InvalidArgumentError"),message:"Array of keys was empty. Unable to extract"},mi={name:pt("NoMatchingKeysError"),message:"No key found matching the spec"},vi={name:pt("SeveralMatchingKeysError"),message:"More than one key found. Please use spec to filter"},Rr=3,Be=(()=>{class i{constructor(){this.loggerService=a(k),this.document=a(q)}getTokenExpirationDate(e){if(!Object.prototype.hasOwnProperty.call(e,"exp"))return new Date(new Date().toUTCString());let t=new Date(0);return t.setUTCSeconds(e.exp),t}getSigningInputFromToken(e,t,r){if(!this.tokenIsValid(e,r))return"";let n=this.getHeaderFromToken(e,t,r),s=this.getPayloadFromToken(e,t,r);return[n,s].join(".")}getHeaderFromToken(e,t,r){return this.tokenIsValid(e,r)?this.getPartOfToken(e,0,t):{}}getPayloadFromToken(e,t,r){return r?this.tokenIsValid(e,r)?this.getPartOfToken(e,1,t):{}:{}}getSignatureFromToken(e,t,r){return this.tokenIsValid(e,r)?this.getPartOfToken(e,2,t):{}}getPartOfToken(e,t,r){let n=this.extractPartOfToken(e,t);if(r)return n;let s=this.urlBase64Decode(n);return JSON.parse(s)}urlBase64Decode(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("Illegal base64url string!")}let r=typeof this.document.defaultView<"u"?this.document.defaultView?.atob(t):Buffer.from(t,"base64").toString("binary");if(!r)return"";try{return decodeURIComponent(r.split("").map(n=>"%"+("00"+n.charCodeAt(0).toString(16)).slice(-2)).join(""))}catch(n){return r}}tokenIsValid(e,t){return e?e.includes(".")?e.split(".").length!==Rr?(this.loggerService.logError(t,`token '${e}' is not valid --> token has to have exactly ${Rr-1} dots`),!1):!0:(this.loggerService.logError(t,`token '${e}' is not valid --> no dots included`),!1):(this.loggerService.logError(t,`token '${e}' is not valid --> token falsy`),!1)}extractPartOfToken(e,t){return e.split(".")[t]}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ft=(()=>{class i{constructor(){this.document=a(q)}getCrypto(){return this.document.defaultView?.crypto||this.document.defaultView?.msCrypto}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Si=(()=>{class i{constructor(){this.cryptoService=a(ft)}importVerificationKey(e,t){return this.cryptoService.getCrypto().subtle.importKey("jwk",e,t,!1,["verify"])}verifyKey(e,t,r,n){return this.cryptoService.getCrypto().subtle.verify(e,t,r,new TextEncoder().encode(n))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ur=(()=>{class i{constructor(){this.cryptoService=a(ft)}generateCodeChallenge(e){return this.calcHash(e).pipe(R(t=>this.base64UrlEncode(t)))}generateAtHash(e,t){return this.calcHash(e,t).pipe(R(r=>{let n=r.substr(0,r.length/2);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}))}calcHash(e,t="SHA-256"){let r=new TextEncoder().encode(e);return we(this.cryptoService.getCrypto().subtle.digest(t,r)).pipe(R(n=>{let s=n,o=Array.from(new Uint8Array(s));return this.toHashString(o)}))}toHashString(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}base64UrlEncode(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function wi(i){switch(i.charAt(0)){case"R":return{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"};case"E":return i.includes("256")?{name:"ECDSA",hash:"SHA-256"}:i.includes("384")?{name:"ECDSA",hash:"SHA-384"}:null;default:return null}}function yi(i){switch(i.charAt(0)){case"R":return"RSA";case"E":return"EC";default:throw new Error("Cannot infer kty from alg: "+i)}}function bi(i){switch(i.charAt(0)){case"R":return i.includes("256")?{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"}:i.includes("384")?{name:"RSASSA-PKCS1-v1_5",hash:"SHA-384"}:i.includes("512")?{name:"RSASSA-PKCS1-v1_5",hash:"SHA-512"}:null;case"E":return i.includes("256")?{name:"ECDSA",namedCurve:"P-256"}:i.includes("384")?{name:"ECDSA",namedCurve:"P-384"}:null;default:return null}}var Ge=(()=>{class i{constructor(){this.keyAlgorithms=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","PS256","PS384","PS512"],this.tokenHelperService=a(Be),this.loggerService=a(k),this.jwkExtractor=a(_r),this.jwkWindowCryptoService=a(Si),this.jwtWindowCryptoService=a(Ur)}static{this.refreshTokenNoncePlaceholder="--RefreshToken--"}hasIdTokenExpired(e,t,r){let n=this.tokenHelperService.getPayloadFromToken(e,!1,t);return!this.validateIdTokenExpNotExpired(n,t,r)}validateIdTokenExpNotExpired(e,t,r){let n=this.tokenHelperService.getTokenExpirationDate(e);if(r=r||0,!n)return!1;let s=n.valueOf(),o=this.calculateNowWithOffset(r),c=s>o;return this.loggerService.logDebug(t,`Has idToken expired: ${!c} --> expires in ${this.millisToMinutesAndSeconds(s-o)} , ${new Date(s).toLocaleTimeString()} > ${new Date(o).toLocaleTimeString()}`),c}validateAccessTokenNotExpired(e,t,r){if(!e)return!0;r=r||0;let n=e.valueOf(),s=this.calculateNowWithOffset(r),o=n>s;return this.loggerService.logDebug(t,`Has accessToken expired: ${!o} --> expires in ${this.millisToMinutesAndSeconds(n-s)} , ${new Date(n).toLocaleTimeString()} > ${new Date(s).toLocaleTimeString()}`),o}validateRequiredIdToken(e,t){let r=!0;return Object.prototype.hasOwnProperty.call(e,"iss")||(r=!1,this.loggerService.logWarning(t,"iss is missing, this is required in the id_token")),Object.prototype.hasOwnProperty.call(e,"sub")||(r=!1,this.loggerService.logWarning(t,"sub is missing, this is required in the id_token")),Object.prototype.hasOwnProperty.call(e,"aud")||(r=!1,this.loggerService.logWarning(t,"aud is missing, this is required in the id_token")),Object.prototype.hasOwnProperty.call(e,"exp")||(r=!1,this.loggerService.logWarning(t,"exp is missing, this is required in the id_token")),Object.prototype.hasOwnProperty.call(e,"iat")||(r=!1,this.loggerService.logWarning(t,"iat is missing, this is required in the id_token")),r}validateIdTokenIatMaxOffset(e,t,r,n){if(r)return!0;if(!Object.prototype.hasOwnProperty.call(e,"iat"))return!1;let s=new Date(0);s.setUTCSeconds(e.iat),t=t||0;let c=new Date(new Date().toUTCString()).valueOf()-s.valueOf(),u=t*1e3;return this.loggerService.logDebug(n,`validate id token iat max offset ${c} < ${u}`),c>0?c1&&!e.azp):!1}validateIdTokenAzpValid(e,t){return e?.azp?e.azp===t:!0}validateStateFromHashCallback(e,t,r){return e!==t?(this.loggerService.logDebug(r,"ValidateStateFromHashCallback failed, state: "+e+" local_state:"+t),!1):!0}validateSignatureIdToken(e,t,r){if(!e)return g(!0);if(!t||!t.keys)return g(!1);let n=this.tokenHelperService.getHeaderFromToken(e,!1,r);if(Object.keys(n).length===0&&n.constructor===Object)return this.loggerService.logWarning(r,"id token has no header data"),g(!1);let s=n.kid,o=n.alg,c=t.keys,u,d;if(!this.keyAlgorithms.includes(o))return this.loggerService.logWarning(r,"alg not supported",o),g(!1);let m=yi(o),b="sig";try{u=s?this.jwkExtractor.extractJwk(c,{kid:s,kty:m,use:b},!1):this.jwkExtractor.extractJwk(c,{kty:m,use:b},!1),u.length===0&&(u=s?this.jwkExtractor.extractJwk(c,{kid:s,kty:m}):this.jwkExtractor.extractJwk(c,{kty:m})),d=u[0]}catch(O){return this.loggerService.logError(r,O),g(!1)}let w=bi(o),p=this.tokenHelperService.getSigningInputFromToken(e,!0,r),W=this.tokenHelperService.getSignatureFromToken(e,!0,r);return we(this.jwkWindowCryptoService.importVerificationKey(d,w)).pipe(ue(O=>{let z=Ar.parse(W,{loose:!0}),le=wi(o);return we(this.jwkWindowCryptoService.verifyKey(le,O,z,p))}),L(O=>{O||this.loggerService.logWarning(r,"incorrect Signature, validation failed for id_token")}))}validateIdTokenAtHash(e,t,r,n){this.loggerService.logDebug(n,"at_hash from the server:"+t);let s="SHA-256";return r.includes("384")?s="SHA-384":r.includes("512")&&(s="SHA-512"),this.jwtWindowCryptoService.generateAtHash(""+e,s).pipe(ue(o=>(this.loggerService.logDebug(n,"at_hash client validation not decoded:"+o),o===t?g(!0):this.jwtWindowCryptoService.generateAtHash(""+decodeURIComponent(e),s).pipe(R(c=>(this.loggerService.logDebug(n,"-gen access--"+o),c===t))))))}millisToMinutesAndSeconds(e){let t=Math.floor(e/6e4),r=(e%6e4/1e3).toFixed(0);return t+":"+(+r<10?"0":"")+r}calculateNowWithOffset(e){return new Date(new Date().toUTCString()).valueOf()+e*1e3}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ki={isAuthenticated:!1,allConfigsAuthenticated:[]},Z=(()=>{class i{constructor(){this.storagePersistenceService=a(M),this.loggerService=a(k),this.publicEventsService=a(fe),this.tokenValidationService=a(Ge),this.authenticatedInternal$=new te(ki)}get authenticated$(){return this.authenticatedInternal$.asObservable().pipe(Bt())}setAuthenticatedAndFireEvent(e){let t=this.composeAuthenticatedResult(e);this.authenticatedInternal$.next(t)}setUnauthenticatedAndFireEvent(e,t){this.storagePersistenceService.resetAuthStateInStorage(e);let r=this.composeUnAuthenticatedResult(t);this.authenticatedInternal$.next(r)}updateAndPublishAuthState(e){this.publicEventsService.fireEvent(B.NewAuthenticationResult,e)}setAuthorizationData(e,t,r,n){this.loggerService.logDebug(r,`storing the accessToken '${e}'`),this.storagePersistenceService.write("authzData",e,r),this.persistAccessTokenExpirationTime(t,r),this.setAuthenticatedAndFireEvent(n)}getAccessToken(e){if(!e||!this.isAuthenticated(e))return"";let t=this.storagePersistenceService.getAccessToken(e);return this.decodeURIComponentSafely(t)}getIdToken(e){if(!e||!this.isAuthenticated(e))return"";let t=this.storagePersistenceService.getIdToken(e);return this.decodeURIComponentSafely(t)}getRefreshToken(e){if(!e||!this.isAuthenticated(e))return"";let t=this.storagePersistenceService.getRefreshToken(e);return this.decodeURIComponentSafely(t)}getAuthenticationResult(e){return!e||!this.isAuthenticated(e)?null:this.storagePersistenceService.getAuthenticationResult(e)}areAuthStorageTokensValid(e){return!e||!this.isAuthenticated(e)?!1:this.hasIdTokenExpiredAndRenewCheckIsEnabled(e)?(this.loggerService.logDebug(e,"persisted idToken is expired"),!1):this.hasAccessTokenExpiredIfExpiryExists(e)?(this.loggerService.logDebug(e,"persisted accessToken is expired"),!1):(this.loggerService.logDebug(e,"persisted idToken and accessToken are valid"),!0)}hasIdTokenExpiredAndRenewCheckIsEnabled(e){let{renewTimeBeforeTokenExpiresInSeconds:t,triggerRefreshWhenIdTokenExpired:r,disableIdTokenValidation:n}=e;if(!r||n)return!1;let s=this.storagePersistenceService.getIdToken(e),o=this.tokenValidationService.hasIdTokenExpired(s,e,t);return o&&this.publicEventsService.fireEvent(B.IdTokenExpired,o),o}hasAccessTokenExpiredIfExpiryExists(e){let{renewTimeBeforeTokenExpiresInSeconds:t}=e,r=this.storagePersistenceService.read("access_token_expires_at",e),s=!this.tokenValidationService.validateAccessTokenNotExpired(r,e,t);return s&&this.publicEventsService.fireEvent(B.TokenExpired,s),s}isAuthenticated(e){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module")),!1;let t=!!this.storagePersistenceService.getAccessToken(e),r=!!this.storagePersistenceService.getIdToken(e);return t&&r}decodeURIComponentSafely(e){return e?decodeURIComponent(e):""}persistAccessTokenExpirationTime(e,t){if(e?.expires_in){let r=new Date(new Date().toUTCString()).valueOf()+e.expires_in*1e3;this.storagePersistenceService.write("access_token_expires_at",r,t)}}composeAuthenticatedResult(e){if(e.length===1){let{configId:t}=e[0];return{isAuthenticated:!0,allConfigsAuthenticated:[{configId:t??"",isAuthenticated:!0}]}}return this.checkAllConfigsIfTheyAreAuthenticated(e)}composeUnAuthenticatedResult(e){if(e.length===1){let{configId:t}=e[0];return{isAuthenticated:!1,allConfigsAuthenticated:[{configId:t??"",isAuthenticated:!1}]}}return this.checkAllConfigsIfTheyAreAuthenticated(e)}checkAllConfigsIfTheyAreAuthenticated(e){let t=e.map(n=>({configId:n.configId??"",isAuthenticated:this.isAuthenticated(n)})),r=t.every(n=>n.isAuthenticated);return{allConfigsAuthenticated:t,isAuthenticated:r}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ut="redirect",Ii=(()=>{class i{constructor(){this.storageService=a(M),this.router=a(Ae)}checkSavedRedirectRouteAndNavigate(e){if(!e)return;let t=this.getStoredRedirectRoute(e);t!=null&&(this.deleteStoredRedirectRoute(e),this.router.navigateByUrl(t))}saveRedirectRoute(e,t){e&&this.storageService.write(ut,t,e)}getStoredRedirectRoute(e){return this.storageService.read(ut,e)}deleteStoredRedirectRoute(e){this.storageService.remove(ut,e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ae=(()=>{class i{isCurrentFlowCodeFlow(e){return this.currentFlowIs("code",e)}isCurrentFlowAnyImplicitFlow(e){return this.isCurrentFlowImplicitFlowWithAccessToken(e)||this.isCurrentFlowImplicitFlowWithoutAccessToken(e)}isCurrentFlowCodeFlowWithRefreshTokens(e){if(!e)return!1;let{useRefreshToken:t}=e;return this.isCurrentFlowCodeFlow(e)&&!!t}isCurrentFlowImplicitFlowWithAccessToken(e){return this.currentFlowIs("id_token token",e)}currentFlowIs(e,t){let{responseType:r}=t;return Array.isArray(e)?e.some(n=>r===n):r===e}isCurrentFlowImplicitFlowWithoutAccessToken(e){return this.currentFlowIs("id_token",e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ci=(()=>{class i{constructor(){this.loggerService=a(k),this.cryptoService=a(ft)}createRandom(e,t){if(e<=0)return"";e>0&&e<7&&(this.loggerService.logWarning(t,`RandomService called with ${e} but 7 chars is the minimum, returning 10 chars`),e=10);let r=e-6,n=new Uint8Array(Math.floor(r/2)),s=this.cryptoService.getCrypto();return s&&s.getRandomValues(n),Array.from(n,this.toHex).join("")+this.randomString(7)}toHex(e){return("0"+e.toString(16)).substr(-2)}randomString(e){let t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint32Array(e),s=this.cryptoService.getCrypto();if(s){s.getRandomValues(n);for(let o=0;o{class i{constructor(){this.loggerService=a(k),this.storagePersistenceService=a(M),this.randomService=a(Ci)}createNonce(e){let t=this.randomService.createRandom(40,e);return this.loggerService.logDebug(e,"Nonce created. nonce:"+t),this.setNonce(t,e),t}setNonce(e,t){this.storagePersistenceService.write("authNonce",e,t)}getAuthStateControl(e){return e?this.storagePersistenceService.read("authStateControl",e):""}setAuthStateControl(e,t){return t?this.storagePersistenceService.write("authStateControl",e,t):!1}getExistingOrCreateAuthStateControl(e){let t=this.storagePersistenceService.read("authStateControl",e);return t||(t=this.randomService.createRandom(40,e),this.storagePersistenceService.write("authStateControl",t,e)),t}setSessionState(e,t){this.storagePersistenceService.write("session_state",e,t)}resetStorageFlowData(e){this.storagePersistenceService.resetStorageFlowData(e)}getCodeVerifier(e){return this.storagePersistenceService.read("codeVerifier",e)}createCodeVerifier(e){let t=this.randomService.createRandom(67,e);return this.storagePersistenceService.write("codeVerifier",t,e),t}isCodeFlowInProgress(e){return!!this.storagePersistenceService.read("storageCodeFlowInProgress",e)}setCodeFlowInProgress(e){this.storagePersistenceService.write("storageCodeFlowInProgress",!0,e)}resetCodeFlowInProgress(e){this.storagePersistenceService.write("storageCodeFlowInProgress",!1,e)}isSilentRenewRunning(e){let{configId:t,silentRenewTimeoutInSeconds:r}=e,n=this.getSilentRenewRunningStorageEntry(e);if(!n||n.state==="not-running")return!1;let s=(r??0)*1e3,o=Date.parse(n.dateOfLaunchedProcessUtc),c=Date.parse(new Date().toISOString());return Math.abs(c-o)>s?(this.loggerService.logDebug(e,"silent renew process is probably stuck, state will be reset.",t),this.resetSilentRenewRunning(e),!1):n.state==="running"}setSilentRenewRunning(e){let t={state:"running",dateOfLaunchedProcessUtc:new Date().toISOString()};this.storagePersistenceService.write("storageSilentRenewRunning",JSON.stringify(t),e)}resetSilentRenewRunning(e){e&&this.storagePersistenceService.write("storageSilentRenewRunning","",e)}getSilentRenewRunningStorageEntry(e){let t=this.storagePersistenceService.read("storageSilentRenewRunning",e);return t?JSON.parse(t):{dateOfLaunchedProcessUtc:"",state:"not-running"}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ht=class{encodeKey(l){return encodeURIComponent(l)}encodeValue(l){return encodeURIComponent(l)}decodeKey(l){return decodeURIComponent(l)}decodeValue(l){return decodeURIComponent(l)}},Ai=["code","state","token","id_token"],Ei="auth0.com",X=(()=>{class i{constructor(){this.loggerService=a(k),this.flowsDataService=a(G),this.flowHelper=a(ae),this.storagePersistenceService=a(M),this.jwtWindowCryptoService=a(Ur)}getUrlParameter(e,t){if(!e||!t)return"";t=t.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");let n=new RegExp("[\\?&#]"+t+"=([^&#]*)").exec(e);return n===null?"":decodeURIComponent(n[1])}getUrlWithoutQueryParameters(e){let t=new URL(e.toString()),r=[];for(let n of t.searchParams.keys())r.push(n);return r.forEach(n=>{t.searchParams.delete(n)}),t}queryParametersExist(e,t){let r=!0;return e.forEach((n,s)=>{t.has(s)||(r=!1)}),r}isCallbackFromSts(e,t){if(t&&t.checkRedirectUrlWhenCheckingIfIsCallback){let r=new URL(e),n=this.getRedirectUrl(t);if(!n)return this.loggerService.logError(t,"UrlService.isCallbackFromSts: could not get redirectUrl from config, was: ",n),!1;let s=new URL(n),o=this.getUrlWithoutQueryParameters(s).toString(),c=this.getUrlWithoutQueryParameters(r).toString(),u=this.queryParametersExist(s.searchParams,r.searchParams);if(o!==c||!u)return this.loggerService.logDebug(t,"UrlService.isCallbackFromSts: configured redirectUrl does not match with the current url"),!1}return Ai.some(r=>!!this.getUrlParameter(e,r))}getRefreshSessionSilentRenewUrl(e,t){return this.flowHelper.isCurrentFlowCodeFlow(e)?this.createUrlCodeFlowWithSilentRenew(e,t):g(this.createUrlImplicitFlowWithSilentRenew(e,t))}getAuthorizeParUrl(e,t){let r=this.storagePersistenceService.read("authWellKnownEndPoints",t);if(!r)return this.loggerService.logError(t,"authWellKnownEndpoints is undefined"),null;let n=r.authorizationEndpoint;if(!n)return this.loggerService.logError(t,`Can not create an authorize URL when authorizationEndpoint is '${n}'`),null;let{clientId:s}=t;if(!s)return this.loggerService.logError(t,"getAuthorizeParUrl could not add clientId because it was: ",s),null;let o=n.split("?"),c=o[0],u=o[1],d=this.createHttpParams(u);return d=d.set("request_uri",e),d=d.append("client_id",s),`${c}?${d}`}getAuthorizeUrl(e,t){return e?this.flowHelper.isCurrentFlowCodeFlow(e)?this.createUrlCodeFlowAuthorize(e,t):g(this.createUrlImplicitFlowAuthorize(e,t)||""):g(null)}getEndSessionEndpoint(e){let r=this.storagePersistenceService.read("authWellKnownEndPoints",e)?.endSessionEndpoint;if(!r)return{url:"",existingParams:""};let n=r.split("?"),s=n[0],o=n[1]??"";return{url:s,existingParams:o}}getEndSessionUrl(e,t){if(!e)return null;let r=this.storagePersistenceService.getIdToken(e),{customParamsEndSessionRequest:n}=e,s=E(E({},n),t);return this.createEndSessionUrl(r,e,s)}createRevocationEndpointBodyAccessToken(e,t){let r=this.getClientId(t);if(!r)return null;let n=this.createHttpParams();return n=n.set("client_id",r),n=n.set("token",e),n=n.set("token_type_hint","access_token"),n.toString()}createRevocationEndpointBodyRefreshToken(e,t){let r=this.getClientId(t);if(!r)return null;let n=this.createHttpParams();return n=n.set("client_id",r),n=n.set("token",e),n=n.set("token_type_hint","refresh_token"),n.toString()}getRevocationEndpointUrl(e){let r=this.storagePersistenceService.read("authWellKnownEndPoints",e)?.revocationEndpoint;return r?r.split("?")[0]:null}createBodyForCodeFlowCodeRequest(e,t,r){let n=this.getClientId(t);if(!n)return null;let s=this.createHttpParams();if(s=s.set("grant_type","authorization_code"),s=s.set("client_id",n),!t.disablePkce){let u=this.flowsDataService.getCodeVerifier(t);if(!u)return this.loggerService.logError(t,"CodeVerifier is not set ",u),null;s=s.set("code_verifier",u)}s=s.set("code",e),r&&(s=this.appendCustomParams(E({},r),s));let o=this.getSilentRenewUrl(t);if(this.flowsDataService.isSilentRenewRunning(t)&&o)return s=s.set("redirect_uri",o),s.toString();let c=this.getRedirectUrl(t);return c?(s=s.set("redirect_uri",c),s.toString()):null}createBodyForCodeFlowRefreshTokensRequest(e,t,r){let n=this.getClientId(t);if(!n)return null;let s=this.createHttpParams();return s=s.set("grant_type","refresh_token"),s=s.set("client_id",n),s=s.set("refresh_token",e),r&&(s=this.appendCustomParams(E({},r),s)),s.toString()}createBodyForParCodeFlowRequest(e,t){let r=this.getRedirectUrl(e,t);if(!r)return g(null);let n=this.flowsDataService.getExistingOrCreateAuthStateControl(e),s=this.flowsDataService.createNonce(e);this.loggerService.logDebug(e,"Authorize created. adding myautostate: "+n);let o=this.flowsDataService.createCodeVerifier(e);return this.jwtWindowCryptoService.generateCodeChallenge(o).pipe(R(c=>{let{clientId:u,responseType:d,scope:m,hdParam:b,customParamsAuthRequest:w}=e,p=this.createHttpParams("");return p=p.set("client_id",u??""),p=p.append("redirect_uri",r),p=p.append("response_type",d??""),p=p.append("scope",m??""),p=p.append("nonce",s),p=p.append("state",n),p=p.append("code_challenge",c),p=p.append("code_challenge_method","S256"),b&&(p=p.append("hd",b)),w&&(p=this.appendCustomParams(E({},w),p)),t?.customParams&&(p=this.appendCustomParams(E({},t.customParams),p)),p.toString()}))}getPostLogoutRedirectUrl(e){let{postLogoutRedirectUri:t}=e;return t||(this.loggerService.logError(e,"could not get postLogoutRedirectUri, was: ",t),null)}createEndSessionUrl(e,t,r){if(this.isAuth0Endpoint(t))return this.composeAuth0Endpoint(t);let{url:n,existingParams:s}=this.getEndSessionEndpoint(t);if(!n)return null;let o=this.createHttpParams(s);e&&(o=o.set("id_token_hint",e));let c=this.getPostLogoutRedirectUrl(t);return c&&(o=o.append("post_logout_redirect_uri",c)),r&&(o=this.appendCustomParams(E({},r),o)),`${n}?${o}`}createAuthorizeUrl(e,t,r,n,s,o,c){let d=this.storagePersistenceService.read("authWellKnownEndPoints",s)?.authorizationEndpoint;if(!d)return this.loggerService.logError(s,`Can not create an authorize URL when authorizationEndpoint is '${d}'`),"";let{clientId:m,responseType:b,scope:w,hdParam:p,customParamsAuthRequest:W}=s;if(!m)return this.loggerService.logError(s,"createAuthorizeUrl could not add clientId because it was: ",m),"";if(!b)return this.loggerService.logError(s,"createAuthorizeUrl could not add responseType because it was: ",b),"";if(!w)return this.loggerService.logError(s,"createAuthorizeUrl could not add scope because it was: ",w),"";let O=d.split("?"),z=O[0],le=O[1],T=this.createHttpParams(le);T=T.set("client_id",m),T=T.append("redirect_uri",t),T=T.append("response_type",b),T=T.append("scope",w),T=T.append("nonce",r),T=T.append("state",n),this.flowHelper.isCurrentFlowCodeFlow(s)&&!s.disablePkce&&(T=T.append("code_challenge",e),T=T.append("code_challenge_method","S256"));let $t=E(E({},W),c);return Object.keys($t).length>0&&(T=this.appendCustomParams(E({},$t),T)),o&&(T=this.overWriteParam(T,"prompt",o)),p&&(T=T.append("hd",p)),`${z}?${T}`}createUrlImplicitFlowWithSilentRenew(e,t){let r=this.flowsDataService.getExistingOrCreateAuthStateControl(e),n=this.flowsDataService.createNonce(e),s=this.getSilentRenewUrl(e);return s?(this.loggerService.logDebug(e,"RefreshSession created. adding myautostate: ",r),this.storagePersistenceService.read("authWellKnownEndPoints",e)?this.createAuthorizeUrl("",s,n,r,e,"none",t):(this.loggerService.logError(e,"authWellKnownEndpoints is undefined"),null)):null}createUrlCodeFlowWithSilentRenew(e,t){let r=this.flowsDataService.getExistingOrCreateAuthStateControl(e),n=this.flowsDataService.createNonce(e);this.loggerService.logDebug(e,"RefreshSession created. adding myautostate: "+r);let s=this.flowsDataService.createCodeVerifier(e);return this.jwtWindowCryptoService.generateCodeChallenge(s).pipe(R(o=>{let c=this.getSilentRenewUrl(e);return c?this.storagePersistenceService.read("authWellKnownEndPoints",e)?this.createAuthorizeUrl(o,c,n,r,e,"none",t):(this.loggerService.logWarning(e,"authWellKnownEndpoints is undefined"),""):""}))}createUrlImplicitFlowAuthorize(e,t){let r=this.flowsDataService.getExistingOrCreateAuthStateControl(e),n=this.flowsDataService.createNonce(e);this.loggerService.logDebug(e,"Authorize created. adding myautostate: "+r);let s=this.getRedirectUrl(e,t);if(!s)return null;if(this.storagePersistenceService.read("authWellKnownEndPoints",e)){let{customParams:c}=t||{};return this.createAuthorizeUrl("",s,n,r,e,"",c)}return this.loggerService.logError(e,"authWellKnownEndpoints is undefined"),null}createUrlCodeFlowAuthorize(e,t){let r=this.flowsDataService.getExistingOrCreateAuthStateControl(e),n=this.flowsDataService.createNonce(e);this.loggerService.logDebug(e,"Authorize created. adding myautostate: "+r);let s=this.getRedirectUrl(e,t);return s?this.getCodeChallenge(e).pipe(R(o=>{if(this.storagePersistenceService.read("authWellKnownEndPoints",e)){let{customParams:u}=t||{};return this.createAuthorizeUrl(o,s,n,r,e,"",u)}return this.loggerService.logError(e,"authWellKnownEndpoints is undefined"),""})):g(null)}getCodeChallenge(e){if(e.disablePkce)return g("");let t=this.flowsDataService.createCodeVerifier(e);return this.jwtWindowCryptoService.generateCodeChallenge(t)}getRedirectUrl(e,t){let{redirectUrl:r}=e;return t?.redirectUrl&&(r=t.redirectUrl),r||(this.loggerService.logError(e,"could not get redirectUrl, was: ",r),null)}getSilentRenewUrl(e){let{silentRenewUrl:t}=e;return t||(this.loggerService.logError(e,"could not get silentRenewUrl, was: ",t),null)}getClientId(e){let{clientId:t}=e;return t||(this.loggerService.logError(e,"could not get clientId, was: ",t),null)}appendCustomParams(e,t){for(let[r,n]of Object.entries(E({},e)))t=t.append(r,n.toString());return t}overWriteParam(e,t,r){return e.set(t,r)}createHttpParams(e){return e=e??"",new F({fromString:e,encoder:new ht})}isAuth0Endpoint(e){let{authority:t,useCustomAuth0Domain:r}=e;return t?t.endsWith(Ei)||!!r:!1}composeAuth0Endpoint(e){let{authority:t,clientId:r}=e,n=this.getPostLogoutRedirectUrl(e);return`${t}/v2/logout?client_id=${r}&returnTo=${n}`}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ri=(()=>{class i{constructor(){this.http=a(A)}get(e,t){return this.http.get(e,t)}post(e,t,r){return this.http.post(e,t,r)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Pi="ngsw-bypass",ge=(()=>{class i{constructor(){this.httpClient=a(Ri)}get(e,t,r){let n=this.prepareHeaders(r),s=this.prepareParams(t);return this.httpClient.get(e,{headers:n,params:s})}post(e,t,r,n){let s=n||this.prepareHeaders(),o=this.prepareParams(r);return this.httpClient.post(e??"",t,{headers:s,params:o})}prepareHeaders(e){let t=new C;return t=t.set("Accept","application/json"),e&&(t=t.set("Authorization","Bearer "+decodeURIComponent(e))),t}prepareParams(e){let t=new F,{ngswBypass:r}=e;return r&&(t=t.set(Pi,"")),t}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),xr=i=>!!i&&i instanceof vr&&(i.error instanceof ProgressEvent&&i.error.type==="error"||i.status===0&&!!i.error),Di=(()=>{class i{constructor(){this.urlService=a(X),this.loggerService=a(k),this.tokenValidationService=a(Ge),this.flowsDataService=a(G),this.storagePersistenceService=a(M),this.dataService=a(ge)}codeFlowCallback(e,t){let r=this.urlService.getUrlParameter(e,"code"),n=this.urlService.getUrlParameter(e,"state"),s=this.urlService.getUrlParameter(e,"session_state");return n?r?(this.loggerService.logDebug(t,"running validation for callback",e),g({code:r,refreshToken:"",state:n,sessionState:s,authResult:null,isRenewProcess:!1,jwtKeys:null,validationResult:null,existingIdToken:null})):(this.loggerService.logDebug(t,"no code in url"),S(()=>new Error("no code in url"))):(this.loggerService.logDebug(t,"no state in url"),S(()=>new Error("no state in url")))}codeFlowCodeRequest(e,t){let r=this.flowsDataService.getAuthStateControl(t);if(!this.tokenValidationService.validateStateFromHashCallback(e.state,r,t))return S(()=>new Error("codeFlowCodeRequest incorrect state"));let o=this.storagePersistenceService.read("authWellKnownEndPoints",t)?.tokenEndpoint;if(!o)return S(()=>new Error("Token Endpoint not defined"));let c=new C;c=c.set("Content-Type","application/x-www-form-urlencoded");let u=this.urlService.createBodyForCodeFlowCodeRequest(e.code,t,t?.customParamsCodeRequest);return this.dataService.post(o,u,t,c).pipe(H(d=>{if(d){let m=Se(E({},d),{state:e.state,session_state:e.sessionState});e.authResult=m}return g(e)}),We(d=>this.handleRefreshRetry(d,t)),x(d=>{let{authority:m}=t,b=`OidcService code request ${m}`;return this.loggerService.logError(t,b,d),S(()=>new Error(b))}))}handleRefreshRetry(e,t){return e.pipe(ue(r=>{if(xr(r)){let{authority:n,refreshTokenRetryInSeconds:s}=t,o=`OidcService code request ${n} - no internet connection`;return this.loggerService.logWarning(t,o,r),be((s??0)*1e3)}return S(()=>r)}))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),_=(function(i){return i.NotSet="NotSet",i.StatesDoNotMatch="StatesDoNotMatch",i.SignatureFailed="SignatureFailed",i.IncorrectNonce="IncorrectNonce",i.RequiredPropertyMissing="RequiredPropertyMissing",i.MaxOffsetExpired="MaxOffsetExpired",i.IssDoesNotMatchIssuer="IssDoesNotMatchIssuer",i.NoAuthWellKnownEndPoints="NoAuthWellKnownEndPoints",i.IncorrectAud="IncorrectAud",i.IncorrectIdTokenClaimsAfterRefresh="IncorrectIdTokenClaimsAfterRefresh",i.IncorrectAzp="IncorrectAzp",i.TokenExpired="TokenExpired",i.IncorrectAtHash="IncorrectAtHash",i.Ok="Ok",i.LoginRequired="LoginRequired",i.SecureTokenServerError="SecureTokenServerError",i})(_||{}),Ti={userData:null,allUserData:[]},Ee=(()=>{class i{constructor(){this.userDataInternal$=new te(Ti),this.loggerService=a(k),this.tokenHelperService=a(Be),this.flowHelper=a(ae),this.oidcDataService=a(ge),this.storagePersistenceService=a(M),this.eventService=a(fe)}get userData$(){return this.userDataInternal$.asObservable()}getAndPersistUserDataInStore(e,t,r=!1,n,s){n=n||this.storagePersistenceService.getIdToken(e),s=s||this.tokenHelperService.getPayloadFromToken(n,!1,e);let o=this.getUserDataFromStore(e),c=!!o,u=this.flowHelper.isCurrentFlowImplicitFlowWithAccessToken(e),d=this.flowHelper.isCurrentFlowCodeFlow(e),m=this.storagePersistenceService.getAccessToken(e);if(!(u||d))return this.loggerService.logDebug(e,`authCallback idToken flow with accessToken ${m}`),this.setUserDataToStore(s,e,t),g(s);let{renewUserInfoAfterTokenRenew:b}=e;return!r||b||!c?this.getUserDataOidcFlowAndSave(s.sub,e,t).pipe(H(w=>(this.loggerService.logDebug(e,"Received user data: ",w),w?(this.loggerService.logDebug(e,"accessToken: ",m),g(w)):S(()=>new Error("Received no user data, request failed"))))):g(o)}getUserDataFromStore(e){return e?this.storagePersistenceService.read("userData",e)||null:S(()=>new Error("Please provide a configuration before setting up the module"))}publishUserDataIfExists(e,t){let r=this.getUserDataFromStore(e);r&&this.fireUserDataEvent(e,t,r)}setUserDataToStore(e,t,r){this.storagePersistenceService.write("userData",e,t),this.fireUserDataEvent(t,r,e)}resetUserDataInStore(e,t){this.storagePersistenceService.remove("userData",e),this.fireUserDataEvent(e,t,null)}getUserDataOidcFlowAndSave(e,t,r){return this.getIdentityUserData(t).pipe(R(n=>this.validateUserDataSubIdToken(t,e,n?.sub)?(this.setUserDataToStore(n,t,r),n):(this.loggerService.logWarning(t,"User data sub does not match sub in id_token, resetting"),this.resetUserDataInStore(t,r),null)))}getIdentityUserData(e){let t=this.storagePersistenceService.getAccessToken(e),r=this.storagePersistenceService.read("authWellKnownEndPoints",e);if(!r)return this.loggerService.logWarning(e,"init check session: authWellKnownEndpoints is undefined"),S(()=>new Error("authWellKnownEndpoints is undefined"));let n=r.userInfoEndpoint;return n?this.oidcDataService.get(n,e,t).pipe(re(2)):(this.loggerService.logError(e,"init check session: authWellKnownEndpoints.userinfo_endpoint is undefined; set auto_userinfo = false in config"),S(()=>new Error("authWellKnownEndpoints.userinfo_endpoint is undefined")))}validateUserDataSubIdToken(e,t,r){return!t||!r?!1:t.toString()!==r.toString()?(this.loggerService.logDebug(e,"validateUserDataSubIdToken failed",t,r),!1):!0}fireUserDataEvent(e,t,r){let n=this.composeSingleOrMultipleUserDataObject(e,t,r);this.userDataInternal$.next(n);let{configId:s}=e;this.eventService.fireEvent(B.UserDataChanged,{configId:s,userData:r})}composeSingleOrMultipleUserDataObject(e,t,r){if(!(t.length>1)){let{configId:o}=e;return this.composeSingleUserDataResult(o??"",r)}return{userData:null,allUserData:t.map(o=>{let c=e.configId??"",u=o.configId??"";if(this.currentConfigIsToUpdate(c,o))return{configId:u,userData:r};let d=this.storagePersistenceService.read("userData",o)||null;return{configId:u,userData:d}})}}composeSingleUserDataResult(e,t){return{userData:t,allUserData:[{configId:e,userData:t}]}}currentConfigIsToUpdate(e,t){return t.configId===e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ce=(()=>{class i{constructor(){this.loggerService=a(k),this.userService=a(Ee),this.flowsDataService=a(G),this.authStateService=a(Z)}resetAuthorizationData(e,t){e&&(this.userService.resetUserDataInStore(e,t),this.flowsDataService.resetStorageFlowData(e),this.authStateService.setUnauthenticatedAndFireEvent(e,t),this.loggerService.logDebug(e,"Local Login information cleaned up and event fired"))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Fi=(()=>{class i{constructor(){this.loggerService=a(k),this.storagePersistenceService=a(M),this.dataService=a(ge)}getSigningKeys(e){let r=this.storagePersistenceService.read("authWellKnownEndPoints",e)?.jwksUri;if(!r){let n=`getSigningKeys: authWellKnownEndpoints.jwksUri is: '${r}'`;return this.loggerService.logWarning(e,n),S(()=>new Error(n))}return this.loggerService.logDebug(e,"Getting signinkeys from ",r),this.dataService.get(r,e).pipe(re(2),x(n=>this.handleErrorGetSigningKeys(n,e)))}handleErrorGetSigningKeys(e,t){let r="";if(e instanceof mr){let n=e.body||{},s=JSON.stringify(n),{status:o,statusText:c}=e;r=`${o||""} - ${c||""} ${s||""}`}else{let{message:n}=e;r=n||`${e}`}return this.loggerService.logError(t,r),S(()=>new Error(r))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Pr="jwtKeys",Hi=(()=>{class i{constructor(){this.loggerService=a(k),this.authStateService=a(Z),this.flowsDataService=a(G),this.signInKeyDataService=a(Fi),this.storagePersistenceService=a(M),this.resetAuthDataService=a(ce),this.document=a(q)}callbackHistoryAndResetJwtKeys(e,t,r){let n=E({},e.authResult);if(!this.responseHasIdToken(e)){let s=this.storagePersistenceService.getIdToken(t);n=Se(E({},n),{id_token:s})}if(this.storagePersistenceService.write("authnResult",n,t),t.allowUnsafeReuseRefreshToken&&e.authResult?.refresh_token&&this.storagePersistenceService.write("reusable_refresh_token",e.authResult.refresh_token,t),this.historyCleanUpTurnedOn(t)&&!e.isRenewProcess?this.resetBrowserHistory():this.loggerService.logDebug(t,"history clean up inactive"),e.authResult?.error){let s=`AuthCallback AuthResult came with error: ${e.authResult.error}`;return this.loggerService.logDebug(t,s),this.resetAuthDataService.resetAuthorizationData(t,r),this.flowsDataService.setNonce("",t),this.handleResultErrorFromCallback(e.authResult,e.isRenewProcess,t.configId),S(()=>new Error(s))}return this.loggerService.logDebug(t,`AuthResult '${JSON.stringify(e.authResult,null,2)}'. AuthCallback created, begin token validation`),this.signInKeyDataService.getSigningKeys(t).pipe(L(s=>this.storeSigningKeys(s,t)),x(s=>{let o=this.readSigningKeys(t);return o?(this.loggerService.logWarning(t,"Failed to retrieve signing keys, fallback to stored keys"),g(o)):S(()=>new Error(s))}),H(s=>{if(s)return e.jwtKeys=s,g(e);let o="Failed to retrieve signing key";return this.loggerService.logWarning(t,o),S(()=>new Error(o))}),x(s=>{let o=`Failed to retrieve signing key with error: ${s}`;return this.loggerService.logWarning(t,o),S(()=>new Error(o))}))}responseHasIdToken(e){return!!e?.authResult?.id_token}handleResultErrorFromCallback(e,t,r){let n=_.SecureTokenServerError;e&&typeof e=="object"&&"error"in e&&e.error==="login_required"&&(n=_.LoginRequired),this.authStateService.updateAndPublishAuthState({isAuthenticated:!1,validationResult:n,isRenewProcess:t,configId:r})}historyCleanUpTurnedOn(e){let{historyCleanupOff:t}=e;return!t}resetBrowserHistory(){this.document.defaultView?.history.replaceState({},this.document.title,this.document.defaultView.location.origin+this.document.defaultView.location.pathname)}storeSigningKeys(e,t){this.storagePersistenceService.write(Pr,e,t)}readSigningKeys(e){return this.storagePersistenceService.read(Pr,e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),_i=(()=>{class i{constructor(){this.loggerService=a(k),this.resetAuthDataService=a(ce),this.flowsDataService=a(G),this.document=a(q)}implicitFlowCallback(e,t,r){let n=this.flowsDataService.isSilentRenewRunning(e);this.loggerService.logDebug(e,"BEGIN callback, no auth data"),n||this.resetAuthDataService.resetAuthorizationData(e,t),r=r||this.document.location.hash.substring(1);let o={code:"",refreshToken:"",state:"",sessionState:null,authResult:r.split("&").reduce((c,u)=>{let d=u.split("=");return c[d.shift()]=d.join("="),c},{}),isRenewProcess:n,jwtKeys:null,validationResult:null,existingIdToken:null};return g(o)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ui=(()=>{class i{constructor(){this.loggerService=a(k),this.authStateService=a(Z),this.flowsDataService=a(G)}refreshSessionWithRefreshTokens(e){let t=this.flowsDataService.getExistingOrCreateAuthStateControl(e);this.loggerService.logDebug(e,"RefreshSession created. Adding myautostate: "+t);let r=this.authStateService.getRefreshToken(e),n=this.authStateService.getIdToken(e);if(r){let s={code:"",refreshToken:r,state:t,sessionState:null,authResult:null,isRenewProcess:!0,jwtKeys:null,validationResult:null,existingIdToken:n};return this.loggerService.logDebug(e,"found refresh code, obtaining new credentials with refresh code"),this.flowsDataService.setNonce(Ge.refreshTokenNoncePlaceholder,e),g(s)}else{let s="no refresh token found, please login";return this.loggerService.logError(e,s),S(()=>new Error(s))}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),xi=(()=>{class i{constructor(){this.urlService=a(X),this.loggerService=a(k),this.dataService=a(ge),this.storagePersistenceService=a(M)}refreshTokensRequestTokens(e,t,r){let n=new C;n=n.set("Content-Type","application/x-www-form-urlencoded");let o=this.storagePersistenceService.read("authWellKnownEndPoints",t)?.tokenEndpoint;if(!o)return S(()=>new Error("Token Endpoint not defined"));let c=this.urlService.createBodyForCodeFlowRefreshTokensRequest(e.refreshToken,t,r);return this.dataService.post(o,c,t,n).pipe(H(u=>(this.loggerService.logDebug(t,`token refresh response: ${u}`),u&&(u.state=e.state),e.authResult=u,g(e))),We(u=>this.handleRefreshRetry(u,t)),x(u=>{let{authority:d}=t,m=`OidcService code request ${d}`;return this.loggerService.logError(t,m,u),S(()=>new Error(m))}))}handleRefreshRetry(e,t){return e.pipe(ue(r=>{if(xr(r)){let{authority:n,refreshTokenRetryInSeconds:s}=t,o=`OidcService code request ${n} - no internet connection`;return this.loggerService.logWarning(t,o,r),be((s??0)*1e3)}return S(()=>r)}))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Mi=(()=>{class i{isStringEqualOrNonOrderedArrayEqual(e,t){return this.isNullOrUndefined(e)||this.isNullOrUndefined(t)||this.oneValueIsStringAndTheOtherIsArray(e,t)?!1:this.bothValuesAreStrings(e,t)?e===t:this.arraysHaveEqualContent(e,t)}areEqual(e,t){if(!e||!t)return!1;if(this.bothValuesAreArrays(e,t))return this.arraysStrictEqual(e,t);if(this.bothValuesAreStrings(e,t))return e===t;if(this.bothValuesAreObjects(e,t))return JSON.stringify(e).toLowerCase()===JSON.stringify(t).toLowerCase();if(this.oneValueIsStringAndTheOtherIsArray(e,t)){if(Array.isArray(e)&&this.valueIsString(t))return e[0]===t;if(Array.isArray(t)&&this.valueIsString(e))return t[0]===e}return e===t}oneValueIsStringAndTheOtherIsArray(e,t){return Array.isArray(e)&&this.valueIsString(t)||Array.isArray(t)&&this.valueIsString(e)}bothValuesAreObjects(e,t){return this.valueIsObject(e)&&this.valueIsObject(t)}bothValuesAreStrings(e,t){return this.valueIsString(e)&&this.valueIsString(t)}bothValuesAreArrays(e,t){return Array.isArray(e)&&Array.isArray(t)}valueIsString(e){return typeof e=="string"||e instanceof String}valueIsObject(e){return typeof e=="object"}arraysStrictEqual(e,t){if(e.length!==t.length)return!1;for(let r=e.length;r--;)if(e[r]!==t[r])return!1;return!0}arraysHaveEqualContent(e,t){return e.length!==t.length?!1:e.some(r=>t.includes(r))}isNullOrUndefined(e){return e==null}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ze=class{constructor(l="",e="",t=!1,r={at_hash:""},n=_.NotSet){this.accessToken=l,this.idToken=e,this.authResponseIsValid=t,this.decodedIdToken=r,this.state=n}},ji=(()=>{class i{constructor(){this.storagePersistenceService=a(M),this.tokenValidationService=a(Ge),this.tokenHelperService=a(Be),this.loggerService=a(k),this.equalityService=a(Mi),this.flowHelper=a(ae)}getValidatedStateResult(e,t){let r=!!e.authResult?.error;return!!!e||r?g(new ze("","",!1,{})):this.validateState(e,t)}validateState(e,t){let r=new ze,n=this.storagePersistenceService.read("authStateControl",t);if(!this.tokenValidationService.validateStateFromHashCallback(e.authResult?.state,n,t))return this.loggerService.logWarning(t,"authCallback incorrect state"),r.state=_.StatesDoNotMatch,this.handleUnsuccessfulValidation(t),g(r);let s=this.flowHelper.isCurrentFlowImplicitFlowWithAccessToken(t),o=this.flowHelper.isCurrentFlowCodeFlow(t);if((s||o)&&(r.accessToken=e.authResult?.access_token??""),t.disableIdTokenValidation)return r.state=_.Ok,r.authResponseIsValid=!0,g(r);let u=e.isRenewProcess&&!!e.refreshToken,d=!!e.authResult?.id_token;if(u&&!d)return r.state=_.Ok,r.authResponseIsValid=!0,g(r);if(d){let{clientId:m,issValidationOff:b,maxIdTokenIatOffsetAllowedInSeconds:w,disableIatOffsetValidation:p,ignoreNonceAfterRefresh:W,renewTimeBeforeTokenExpiresInSeconds:O}=t;return r.idToken=e.authResult?.id_token??"",r.decodedIdToken=this.tokenHelperService.getPayloadFromToken(r.idToken,!1,t),this.tokenValidationService.validateSignatureIdToken(r.idToken,e.jwtKeys,t).pipe(ue(z=>{if(!z)return this.loggerService.logDebug(t,"authCallback Signature validation failed id_token"),r.state=_.SignatureFailed,this.handleUnsuccessfulValidation(t),g(r);let le=this.storagePersistenceService.read("authNonce",t);if(!this.tokenValidationService.validateIdTokenNonce(r.decodedIdToken,le,!!W,t))return this.loggerService.logWarning(t,"authCallback incorrect nonce, did you call the checkAuth() method multiple times?"),r.state=_.IncorrectNonce,this.handleUnsuccessfulValidation(t),g(r);if(!this.tokenValidationService.validateRequiredIdToken(r.decodedIdToken,t))return this.loggerService.logDebug(t,"authCallback Validation, one of the REQUIRED properties missing from id_token"),r.state=_.RequiredPropertyMissing,this.handleUnsuccessfulValidation(t),g(r);if(!u&&!this.tokenValidationService.validateIdTokenIatMaxOffset(r.decodedIdToken,w??120,!!p,t))return this.loggerService.logWarning(t,"authCallback Validation, iat rejected id_token was issued too far away from the current time"),r.state=_.MaxOffsetExpired,this.handleUnsuccessfulValidation(t),g(r);let T=this.storagePersistenceService.read("authWellKnownEndPoints",t);if(T){if(b)this.loggerService.logDebug(t,"iss validation is turned off, this is not recommended!");else if(!b&&!this.tokenValidationService.validateIdTokenIss(r.decodedIdToken,T.issuer,t))return this.loggerService.logWarning(t,"authCallback incorrect iss does not match authWellKnownEndpoints issuer"),r.state=_.IssDoesNotMatchIssuer,this.handleUnsuccessfulValidation(t),g(r)}else return this.loggerService.logWarning(t,"authWellKnownEndpoints is undefined"),r.state=_.NoAuthWellKnownEndPoints,this.handleUnsuccessfulValidation(t),g(r);return this.tokenValidationService.validateIdTokenAud(r.decodedIdToken,m,t)?this.tokenValidationService.validateIdTokenAzpExistsIfMoreThanOneAud(r.decodedIdToken)?this.tokenValidationService.validateIdTokenAzpValid(r.decodedIdToken,m)?this.isIdTokenAfterRefreshTokenRequestValid(e,r.decodedIdToken,t)?!u&&!this.tokenValidationService.validateIdTokenExpNotExpired(r.decodedIdToken,t,O)?(this.loggerService.logWarning(t,"authCallback id token expired"),r.state=_.TokenExpired,this.handleUnsuccessfulValidation(t),g(r)):this.validateDefault(s,o,r,t,e):(this.loggerService.logWarning(t,"authCallback pre, post id_token claims do not match in refresh"),r.state=_.IncorrectIdTokenClaimsAfterRefresh,this.handleUnsuccessfulValidation(t),g(r)):(this.loggerService.logWarning(t,"authCallback incorrect azp"),r.state=_.IncorrectAzp,this.handleUnsuccessfulValidation(t),g(r)):(this.loggerService.logWarning(t,"authCallback missing azp"),r.state=_.IncorrectAzp,this.handleUnsuccessfulValidation(t),g(r)):(this.loggerService.logWarning(t,"authCallback incorrect aud"),r.state=_.IncorrectAud,this.handleUnsuccessfulValidation(t),g(r))}))}else this.loggerService.logDebug(t,"No id_token found, skipping id_token validation");return this.validateDefault(s,o,r,t,e)}validateDefault(e,t,r,n,s){if(!e&&!t)return r.authResponseIsValid=!0,r.state=_.Ok,this.handleSuccessfulValidation(n),this.handleUnsuccessfulValidation(n),g(r);if(s.authResult?.id_token){let o=this.tokenHelperService.getHeaderFromToken(r.idToken,!1,n);if(t&&!r.decodedIdToken.at_hash)this.loggerService.logDebug(n,"Code Flow active, and no at_hash in the id_token, skipping check!");else return this.tokenValidationService.validateIdTokenAtHash(r.accessToken,r.decodedIdToken.at_hash,o.alg,n).pipe(R(c=>!c||!r.accessToken?(this.loggerService.logWarning(n,"authCallback incorrect at_hash"),r.state=_.IncorrectAtHash,this.handleUnsuccessfulValidation(n),r):(r.authResponseIsValid=!0,r.state=_.Ok,this.handleSuccessfulValidation(n),r)))}return r.authResponseIsValid=!0,r.state=_.Ok,this.handleSuccessfulValidation(n),g(r)}isIdTokenAfterRefreshTokenRequestValid(e,t,r){let{useRefreshToken:n,disableRefreshIdTokenAuthTimeValidation:s}=r;if(!n||!e.existingIdToken)return!0;let o=this.tokenHelperService.getPayloadFromToken(e.existingIdToken,!1,r);return o.iss!==t.iss?(this.loggerService.logDebug(r,`iss do not match: ${o.iss} ${t.iss}`),!1):o.azp!==t.azp?(this.loggerService.logDebug(r,`azp do not match: ${o.azp} ${t.azp}`),!1):o.sub!==t.sub?(this.loggerService.logDebug(r,`sub do not match: ${o.sub} ${t.sub}`),!1):this.equalityService.isStringEqualOrNonOrderedArrayEqual(o?.aud,t?.aud)?s?!0:o.auth_time!==t.auth_time?(this.loggerService.logDebug(r,`auth_time do not match: ${o.auth_time} ${t.auth_time}`),!1):!0:(this.loggerService.logDebug(r,`aud in new id_token is not valid: '${o?.aud}' '${t.aud}'`),!1)}handleSuccessfulValidation(e){let{autoCleanStateAfterAuthentication:t}=e;this.storagePersistenceService.write("authNonce",null,e),t&&this.storagePersistenceService.write("authStateControl","",e),this.loggerService.logDebug(e,"authCallback token(s) validated, continue")}handleUnsuccessfulValidation(e){let{autoCleanStateAfterAuthentication:t}=e;this.storagePersistenceService.write("authNonce",null,e),t&&this.storagePersistenceService.write("authStateControl","",e),this.loggerService.logDebug(e,"authCallback token(s) invalid")}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Oi=(()=>{class i{constructor(){this.loggerService=a(k),this.stateValidationService=a(ji),this.authStateService=a(Z),this.resetAuthDataService=a(ce),this.document=a(q)}callbackStateValidation(e,t,r){return this.stateValidationService.getValidatedStateResult(e,t).pipe(R(n=>{if(e.validationResult=n,n.authResponseIsValid)return this.authStateService.setAuthorizationData(n.accessToken,e.authResult,t,r),e;{let s=`authorizedCallback, token(s) validation failed, resetting. Hash: ${this.document.location.hash}`;throw this.loggerService.logWarning(t,s),this.resetAuthDataService.resetAuthorizationData(t,r),this.publishUnauthorizedState(e.validationResult,e.isRenewProcess,t.configId),new Error(s)}}))}publishUnauthorizedState(e,t,r){this.authStateService.updateAndPublishAuthState({isAuthenticated:!1,validationResult:e.state,isRenewProcess:t,configId:r})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Wi=(()=>{class i{constructor(){this.loggerService=a(k),this.authStateService=a(Z),this.flowsDataService=a(G),this.userService=a(Ee),this.resetAuthDataService=a(ce)}callbackUser(e,t,r){let{isRenewProcess:n,validationResult:s,authResult:o,refreshToken:c}=e,{autoUserInfo:u,renewUserInfoAfterTokenRenew:d}=t;return u?this.userService.getAndPersistUserDataInStore(t,r,n,s?.idToken,s?.decodedIdToken).pipe(H(m=>{if(m)return c||this.flowsDataService.setSessionState(o?.session_state,t),this.publishAuthState(s,n,t.configId),g(e);{this.resetAuthDataService.resetAuthorizationData(t,r),this.publishUnauthenticatedState(s,n,t.configId);let b=`Called for userData but they were ${m}`;return this.loggerService.logWarning(t,b),S(()=>new Error(b))}}),x(m=>{let b=`Failed to retrieve user info with error: ${m}`;return this.loggerService.logWarning(t,b),S(()=>new Error(b))})):((!n||d)&&s?.decodedIdToken&&this.userService.setUserDataToStore(s.decodedIdToken,t,r),!n&&!c&&this.flowsDataService.setSessionState(o?.session_state,t),this.publishAuthState(s,n,t.configId),g(e))}publishAuthState(e,t,r){e&&this.authStateService.updateAndPublishAuthState({isAuthenticated:!0,validationResult:e.state,isRenewProcess:t,configId:r})}publishUnauthenticatedState(e,t,r){e&&this.authStateService.updateAndPublishAuthState({isAuthenticated:!1,validationResult:e.state,isRenewProcess:t,configId:r})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Je=(()=>{class i{constructor(){this.codeFlowCallbackHandlerService=a(Di),this.implicitFlowCallbackHandlerService=a(_i),this.historyJwtKeysCallbackHandlerService=a(Hi),this.userHandlerService=a(Wi),this.stateValidationCallbackHandlerService=a(Oi),this.refreshSessionCallbackHandlerService=a(Ui),this.refreshTokenCallbackHandlerService=a(xi)}processCodeFlowCallback(e,t,r){return this.codeFlowCallbackHandlerService.codeFlowCallback(e,t).pipe(P(n=>this.codeFlowCallbackHandlerService.codeFlowCodeRequest(n,t)),P(n=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(n,t,r)),P(n=>this.stateValidationCallbackHandlerService.callbackStateValidation(n,t,r)),P(n=>this.userHandlerService.callbackUser(n,t,r)))}processSilentRenewCodeFlowCallback(e,t,r){return this.codeFlowCallbackHandlerService.codeFlowCodeRequest(e,t).pipe(P(n=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(n,t,r)),P(n=>this.stateValidationCallbackHandlerService.callbackStateValidation(n,t,r)),P(n=>this.userHandlerService.callbackUser(n,t,r)))}processImplicitFlowCallback(e,t,r){return this.implicitFlowCallbackHandlerService.implicitFlowCallback(e,t,r).pipe(P(n=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(n,e,t)),P(n=>this.stateValidationCallbackHandlerService.callbackStateValidation(n,e,t)),P(n=>this.userHandlerService.callbackUser(n,e,t)))}processRefreshToken(e,t,r){return this.refreshSessionCallbackHandlerService.refreshSessionWithRefreshTokens(e).pipe(P(n=>this.refreshTokenCallbackHandlerService.refreshTokensRequestTokens(n,e,r)),P(n=>this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(n,e,t)),P(n=>this.stateValidationCallbackHandlerService.callbackStateValidation(n,e,t)),P(n=>this.userHandlerService.callbackUser(n,e,t)))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Me=(()=>{class i{constructor(){this.runTokenValidationRunning=null,this.zone=a(st),this.document=a(q)}isTokenValidationRunning(){return!!this.runTokenValidationRunning}stopPeriodicTokenCheck(){this.runTokenValidationRunning&&(this.runTokenValidationRunning.unsubscribe(),this.runTokenValidationRunning=null)}startPeriodicTokenCheck(e){let t=e*1e3;return new De(r=>{let n;return this.zone.runOutsideAngular(()=>{n=this.document?.defaultView?.setInterval(()=>this.zone.run(()=>r.next()),t)}),()=>{clearInterval(n)}})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),$i=(()=>{class i{constructor(){this.flowsService=a(Je),this.router=a(Ae),this.flowsDataService=a(G),this.intervalService=a(Me)}authenticatedCallbackWithCode(e,t,r){let n=this.flowsDataService.isSilentRenewRunning(t),{triggerAuthorizationResultEvent:s}=t,o=t.postLoginRoute||"/",c=t.unauthorizedRoute||"/";return this.flowsService.processCodeFlowCallback(e,t,r).pipe(L(u=>{this.flowsDataService.resetCodeFlowInProgress(t),!s&&!u.isRenewProcess&&this.router.navigateByUrl(o)}),x(u=>(this.flowsDataService.resetSilentRenewRunning(t),this.flowsDataService.resetCodeFlowInProgress(t),this.intervalService.stopPeriodicTokenCheck(),!s&&!n&&this.router.navigateByUrl(c),S(()=>new Error(u)))))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Mr=(()=>{class i{constructor(){this.flowsService=a(Je),this.router=a(Ae),this.flowsDataService=a(G),this.intervalService=a(Me)}authenticatedImplicitFlowCallback(e,t,r){let n=this.flowsDataService.isSilentRenewRunning(e),s=!!e.triggerAuthorizationResultEvent,o=e.postLoginRoute??"",c=e.unauthorizedRoute??"";return this.flowsService.processImplicitFlowCallback(e,t,r).pipe(L(u=>{!s&&!u.isRenewProcess&&this.router.navigateByUrl(o)}),x(u=>(this.flowsDataService.resetSilentRenewRunning(e),this.intervalService.stopPeriodicTokenCheck(),!s&&!n&&this.router.navigateByUrl(c),S(()=>new Error(u)))))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),jr=(()=>{class i{constructor(){this.urlService=a(X),this.flowHelper=a(ae),this.implicitFlowCallbackService=a(Mr),this.codeFlowCallbackService=a($i),this.stsCallbackInternal$=new Oe}get stsCallback$(){return this.stsCallbackInternal$.asObservable()}isCallback(e,t){return e?this.urlService.isCallbackFromSts(e,t):!1}handleCallbackAndFireEvents(e,t,r){let n=new De;if(this.flowHelper.isCurrentFlowCodeFlow(t))n=this.codeFlowCallbackService.authenticatedCallbackWithCode(e,t,r);else if(this.flowHelper.isCurrentFlowAnyImplicitFlow(t))if(e?.includes("#")){let s=e.substring(e.indexOf("#")+1);n=this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(t,r,s)}else n=this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(t,r);return n.pipe(L(()=>this.stsCallbackInternal$.next()))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ni=(()=>{class i{constructor(){this.platformId=a(Xt)}isBrowser(){return fr(this.platformId)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Dr="/.well-known/openid-configuration",Li=(()=>{class i{constructor(){this.loggerService=a(k),this.http=a(ge)}getWellKnownEndPointsForConfig(e){let{authWellknownEndpointUrl:t,authWellknownEndpoints:r={}}=e;if(!t){let n="no authWellknownEndpoint given!";return this.loggerService.logError(e,n),S(()=>new Error(n))}return this.getWellKnownDocument(t,e).pipe(R(n=>({issuer:n.issuer,jwksUri:n.jwks_uri,authorizationEndpoint:n.authorization_endpoint,tokenEndpoint:n.token_endpoint,userInfoEndpoint:n.userinfo_endpoint,endSessionEndpoint:n.end_session_endpoint,checkSessionIframe:n.check_session_iframe,revocationEndpoint:n.revocation_endpoint,introspectionEndpoint:n.introspection_endpoint,parEndpoint:n.pushed_authorization_request_endpoint})),R(n=>E(E({},n),r)),L(n=>{let s=n.issuer||"",o=e.authWellknownUrlSuffix||Dr,c=t.replace(o,"");if(!e.strictIssuerValidationOnWellKnownRetrievalOff&&s!==c&&s!==`${c}/`){let u=`Issuer mismatch. Well known issuer ${n.issuer} does not match configured well known url ${t}`;throw this.loggerService.logError(e,u),new Error(u)}}))}getWellKnownDocument(e,t){let r=e,n=t.authWellknownUrlSuffix||Dr;return e.includes(n)||(r=`${e}${n}`),this.http.get(r,t).pipe(re(2))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Re=(()=>{class i{constructor(){this.dataService=a(Li),this.publicEventsService=a(fe),this.storagePersistenceService=a(M)}storeWellKnownEndpoints(e,t){this.storagePersistenceService.write("authWellKnownEndPoints",t,e)}queryAndStoreAuthWellKnownEndPoints(e){return e?this.dataService.getWellKnownEndPointsForConfig(e).pipe(L(t=>this.storeWellKnownEndpoints(e,t)),x(t=>(this.publicEventsService.fireEvent(B.ConfigLoadingFailed,null),S(()=>new Error(t))))):S(()=>new Error("Please provide a configuration before setting up the module"))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),qi={authority:"https://please_set",authWellknownEndpointUrl:"",authWellknownEndpoints:void 0,redirectUrl:"https://please_set",checkRedirectUrlWhenCheckingIfIsCallback:!0,clientId:"please_set",responseType:"code",scope:"openid email profile",hdParam:"",postLogoutRedirectUri:"https://please_set",startCheckSession:!1,silentRenew:!1,silentRenewUrl:"https://please_set",silentRenewTimeoutInSeconds:20,renewTimeBeforeTokenExpiresInSeconds:0,useRefreshToken:!1,usePushedAuthorisationRequests:!1,ignoreNonceAfterRefresh:!1,postLoginRoute:"/",forbiddenRoute:"/forbidden",unauthorizedRoute:"/unauthorized",autoUserInfo:!0,autoCleanStateAfterAuthentication:!0,triggerAuthorizationResultEvent:!1,logLevel:xe.Warn,issValidationOff:!1,strictIssuerValidationOnWellKnownRetrievalOff:!1,historyCleanupOff:!1,maxIdTokenIatOffsetAllowedInSeconds:120,disableIatOffsetValidation:!1,customParamsAuthRequest:{},customParamsRefreshTokenRequest:{},customParamsEndSessionRequest:{},customParamsCodeRequest:{},disableRefreshIdTokenAuthTimeValidation:!1,triggerRefreshWhenIdTokenExpired:!0,tokenRefreshInSeconds:4,refreshTokenRetryInSeconds:3,ngswBypass:!1},Pe={result:!0,messages:[],level:"none"},Vi=i=>i.authority?Pe:{result:!1,messages:["The authority URL MUST be provided in the configuration! "],level:"error"},Ki=i=>i.clientId?Pe:{result:!1,messages:["The clientId is required and missing from your config!"],level:"error"},zi=i=>{if(!i)return"";let{authority:l,clientId:e,scope:t}=i;return`${l}${e}${t}`},Bi=i=>new Set(i).size!==i.length,Gi=i=>{let l=i.map(r=>zi(r));return l.some(r=>r==="")?{result:!1,messages:["Please make sure you add an object with a 'config' property: ....({ config }) instead of ...(config)"],level:"error"}:Bi(l)?{result:!1,messages:["You added multiple configs with the same authority, clientId and scope"],level:"warning"}:Pe},Ji=i=>i.redirectUrl?Pe:{result:!1,messages:["The redirectUrl is required and missing from your config"],level:"error"},Yi=i=>{let l=i.silentRenew,e=i.useRefreshToken,t=i.silentRenewUrl;return l&&!e&&!t?{result:!1,messages:["Please provide a silent renew URL if using renew and not refresh tokens"],level:"error"}:Pe},Qi=i=>{let l=i.useRefreshToken,e=i.silentRenew,r=(i.scope||"").split(" ").includes("offline_access");return l&&e&&!r?{result:!1,messages:["When using silent renew and refresh tokens please set the `offline_access` scope"],level:"warning"}:Pe},Zi=[Vi,Qi,Ji,Ki,Yi],Xi=[Gi],en=(()=>{class i{constructor(){this.loggerService=a(k)}validateConfigs(e){return this.validateConfigsInternal(e??[],Xi)}validateConfig(e){return this.validateConfigInternal(e,Zi)}validateConfigsInternal(e,t){if(e.length===0)return!1;let r=t.map(s=>s(e)),n=0;return e.forEach(s=>{let o=this.processValidationResultsAndGetErrorCount(r,s);n+=o}),n===0}validateConfigInternal(e,t){let r=t.map(s=>s(e));return this.processValidationResultsAndGetErrorCount(r,e)===0}processValidationResultsAndGetErrorCount(e,t){let r=e.filter(o=>o.messages.length>0),n=this.getAllMessagesOfType("error",r),s=this.getAllMessagesOfType("warning",r);return n.forEach(o=>this.loggerService.logError(t,o)),s.forEach(o=>this.loggerService.logWarning(t,o)),n.length}getAllMessagesOfType(e,t){return t.filter(n=>n.level===e).map(n=>n.messages).reduce((n,s)=>n.concat(s),[])}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Or=(()=>{class i{constructor(){this.configsInternal={},this.loggerService=a(k),this.publicEventsService=a(fe),this.storagePersistenceService=a(M),this.platformProvider=a(Ni),this.authWellKnownService=a(Re),this.loader=a(Ke),this.configValidationService=a(en)}hasManyConfigs(){return Object.keys(this.configsInternal).length>1}getAllConfigurations(){return Object.values(this.configsInternal)}getOpenIDConfiguration(e){return this.configsAlreadySaved()?g(this.getConfig(e)):this.getOpenIDConfigurations(e).pipe(R(t=>t.currentConfig))}getOpenIDConfigurations(e){return this.loadConfigs().pipe(P(t=>this.prepareAndSaveConfigs(t)),R(t=>({allConfigs:t,currentConfig:this.getConfig(e)})))}hasAtLeastOneConfig(){return Object.keys(this.configsInternal).length>0}saveConfig(e){let{configId:t}=e;this.configsInternal[t]=e}loadConfigs(){return this.loader.loadConfigs()}configsAlreadySaved(){return this.hasAtLeastOneConfig()}getConfig(e){if(e){let r=this.configsInternal[e];return!r&&hr()&&console.warn(`[angular-auth-oidc-client] No configuration found for config id '${e}'.`),r||null}let[,t]=Object.entries(this.configsInternal)[0]||[[null,null]];return t||null}prepareAndSaveConfigs(e){if(!this.configValidationService.validateConfigs(e))return g([]);this.createUniqueIds(e);let t=e.map(r=>this.handleConfig(r));return ye(t).pipe(R(r=>r.filter(n=>!!n)),R(r=>r))}createUniqueIds(e){e.forEach((t,r)=>{t.configId||(t.configId=`${r}-${t.clientId}`)})}handleConfig(e){if(!this.configValidationService.validateConfig(e))return this.loggerService.logError(e,"Validation of config rejected with errors. Config is NOT set."),g(null);e.authWellknownEndpointUrl||(e.authWellknownEndpointUrl=e.authority);let t=this.prepareConfig(e);this.saveConfig(t);let r=this.enhanceConfigWithWellKnownEndpoint(t);return this.publicEventsService.fireEvent(B.ConfigLoaded,r),g(t)}enhanceConfigWithWellKnownEndpoint(e){let t=this.storagePersistenceService.read("authWellKnownEndPoints",e);if(t)return e.authWellknownEndpoints=t,e;let r=e.authWellknownEndpoints;return r&&(this.authWellKnownService.storeWellKnownEndpoints(e,r),e.authWellknownEndpoints=r),e}prepareConfig(e){let t=E(E({},qi),e);return this.setSpecialCases(t),t}setSpecialCases(e){this.platformProvider.isBrowser()||(e.startCheckSession=!1,e.silentRenew=!1,e.useRefreshToken=!1,e.usePushedAuthorisationRequests=!1)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Wr=(()=>{class i{constructor(){this.document=a(q),this.loggerService=a(k)}getExistingIFrame(e){let t=this.getIFrameFromParentWindow(e);if(this.isIFrameElement(t))return t;let r=this.getIFrameFromWindow(e);return this.isIFrameElement(r)?r:null}addIFrameToWindowBody(e,t){let r=this.document.createElement("iframe");return r.id=e,r.title=e,this.loggerService.logDebug(t,r),r.style.display="none",this.document.body.appendChild(r),r}getIFrameFromParentWindow(e){try{let t=this.document.defaultView?.parent.document.getElementById(e);return this.isIFrameElement(t)?t:null}catch(t){return null}}getIFrameFromWindow(e){let t=this.document.getElementById(e);return this.isIFrameElement(t)?t:null}isIFrameElement(e){return!!e&&e instanceof HTMLIFrameElement}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),tn="myiFrameForSilentRenew",$r=i=>`${tn}_${i}`,gt=(()=>{class i{constructor(){this.refreshSessionWithIFrameCompletedInternal$=new Oe,this.loggerService=a(k),this.iFrameService=a(Wr),this.flowsService=a(Je),this.resetAuthDataService=a(ce),this.flowsDataService=a(G),this.authStateService=a(Z),this.flowHelper=a(ae),this.implicitFlowCallbackService=a(Mr),this.intervalService=a(Me)}get refreshSessionWithIFrameCompleted$(){return this.refreshSessionWithIFrameCompletedInternal$.asObservable()}getOrCreateIframe(e){let t=$r(e.configId),r=this.iFrameService.getExistingIFrame(t);return r?(this.loggerService.logDebug(e,`Using existing iframe: ${t}`),r):(this.loggerService.logDebug(e,`Creating new iframe: ${t}`),this.iFrameService.addIFrameToWindowBody(t,e))}isSilentRenewConfigured(e){let{useRefreshToken:t,silentRenew:r}=e;return!t&&!!r}codeFlowCallbackSilentRenewIframe(e,t,r){let n=new F({fromString:e[1]}),s=n.get("error");if(s)return this.authStateService.updateAndPublishAuthState({isAuthenticated:!1,validationResult:_.LoginRequired,isRenewProcess:!0,configId:t.configId}),this.resetAuthDataService.resetAuthorizationData(t,r),this.flowsDataService.setNonce("",t),this.intervalService.stopPeriodicTokenCheck(),S(()=>new Error(s));let o=n.get("code")??"",c=n.get("state")??"",u=n.get("session_state"),d={code:o,refreshToken:"",state:c,sessionState:u,authResult:null,isRenewProcess:!0,jwtKeys:null,validationResult:null,existingIdToken:null};return this.flowsService.processSilentRenewCodeFlowCallback(d,t,r).pipe(x(m=>(this.intervalService.stopPeriodicTokenCheck(),this.resetAuthDataService.resetAuthorizationData(t,r),S(()=>new Error(m)))))}silentRenewEventHandler(e,t,r){if(this.loggerService.logDebug(t,"silentRenewEventHandler"),!e.detail)return;let n;if(this.flowHelper.isCurrentFlowCodeFlow(t)){let o=e.detail.toString().split("?");n=this.codeFlowCallbackSilentRenewIframe(o,t,r)}else n=this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(t,r,e.detail);n.subscribe({next:({authResult:o})=>{this.refreshSessionWithIFrameCompletedInternal$.next({authResult:o,configId:t.configId,success:!0}),this.flowsDataService.resetSilentRenewRunning(t)},error:o=>{this.loggerService.logError(t,"Error: "+o),this.refreshSessionWithIFrameCompletedInternal$.next({configId:t.configId,success:!1}),this.flowsDataService.resetSilentRenewRunning(t)}})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Nr=(()=>{class i{constructor(){this.renderer=a(rr).createRenderer(null,null),this.loggerService=a(k),this.urlService=a(X),this.silentRenewService=a(gt),this.document=a(q)}refreshSessionWithIframe(e,t,r){return this.loggerService.logDebug(e,"BEGIN refresh session Authorize Iframe renew"),this.urlService.getRefreshSessionSilentRenewUrl(e,r).pipe(H(n=>this.sendAuthorizeRequestUsingSilentRenew(n,e,t)))}sendAuthorizeRequestUsingSilentRenew(e,t,r){let n=this.silentRenewService.getOrCreateIframe(t);return this.initSilentRenewRequest(t,r),this.loggerService.logDebug(t,`sendAuthorizeRequestUsingSilentRenew for URL: ${e}`),new De(s=>{let o=()=>{n.removeEventListener("load",o),this.loggerService.logDebug(t,"removed event listener from IFrame"),s.next(!0),s.complete()};n.addEventListener("load",o),n.contentWindow?.location.replace(e??"")})}initSilentRenewRequest(e,t){let r=Math.random();this.loggerService.logDebug(e,`Creating new silent renew handlers for config: ${e.configId}, instance: ${r}`);let n=this.renderer.listen("window","oidc-silent-renew-init",o=>{let c=o.detail;c.configId===e.configId&&c.instanceId!==r&&(this.loggerService.logDebug(e,`Destroying old handlers for config: ${e.configId} (old instance: ${r}, new instance: ${c.instanceId})`),n(),s())}),s=this.renderer.listen("window","oidc-silent-renew-message",o=>{if(this.shouldProcessRenewMessage(o,e)){let c=this.convertToLegacyEvent(o);this.silentRenewService.silentRenewEventHandler(c,e,t)}});this.document.defaultView?.dispatchEvent(new CustomEvent("oidc-silent-renew-init",{detail:{instanceId:r,configId:e.configId}}))}shouldProcessRenewMessage(e,t){if(!e?.detail)return this.loggerService.logDebug(t,`Silent renew event has no valid payload: ${e?.detail}`),!1;if(e.detail.srcFrameId){let r=$r(t.configId)===e.detail.srcFrameId;return this.loggerService.logDebug(t,`Silent renew event from frame: ${e.detail.srcFrameId}, current configId: ${t.configId}, processing: ${r}`),r}return this.loggerService.logDebug(t,"Silent renew event without srcFrameId - processing for backward compatibility"),!0}convertToLegacyEvent(e){return e?.detail?.url?new CustomEvent(e.type,{detail:e.detail.url}):e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Lr=(()=>{class i{constructor(){this.loggerService=a(k),this.resetAuthDataService=a(ce),this.flowsService=a(Je),this.intervalService=a(Me)}refreshSessionWithRefreshTokens(e,t,r){this.loggerService.logDebug(e,"BEGIN refresh session Authorize");let n=!1;return this.flowsService.processRefreshToken(e,t,r).pipe(x(s=>(this.resetAuthDataService.resetAuthorizationData(e,t),n=!0,S(()=>new Error(s)))),Gt(()=>n&&this.intervalService.stopPeriodicTokenCheck()))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),rn=(()=>{class i{constructor(){this.resetAuthDataService=a(ce),this.flowHelper=a(ae),this.flowsDataService=a(G),this.loggerService=a(k),this.userService=a(Ee),this.authStateService=a(Z),this.refreshSessionIframeService=a(Nr),this.refreshSessionRefreshTokenService=a(Lr),this.intervalService=a(Me),this.storagePersistenceService=a(M),this.publicEventsService=a(fe),this.configurationService=a(Or)}startTokenValidationPeriodically(e,t){let r=this.getConfigsWithSilentRenewEnabled(e);if(r.length<=0||this.intervalService.isTokenValidationRunning())return;let n=this.getSmallestRefreshTimeFromConfigs(r),s=this.intervalService.startPeriodicTokenCheck(n).pipe(H(()=>{let o={};return r.forEach(c=>{let u=c.configId;o[u]=this.getRefreshEvent(c,e)}),ye(o)}));this.intervalService.runTokenValidationRunning=s.pipe(x(o=>S(()=>new Error(o)))).subscribe({next:o=>{for(let[c,u]of Object.entries(o))this.configurationService.getOpenIDConfiguration(c).subscribe(d=>{this.loggerService.logDebug(d,"silent renew, periodic check finished!"),this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(d)&&this.flowsDataService.resetSilentRenewRunning(d)})},error:o=>{this.loggerService.logError(t,"silent renew failed!",o)}})}getRefreshEvent(e,t){if(!this.shouldStartPeriodicallyCheckForConfig(e))return g(null);let n=this.createRefreshEventForConfig(e,t);return this.publicEventsService.fireEvent(B.SilentRenewStarted),n.pipe(x(s=>(this.loggerService.logError(e,"silent renew failed!",s),this.publicEventsService.fireEvent(B.SilentRenewFailed,s),this.flowsDataService.resetSilentRenewRunning(e),S(()=>new Error(s)))))}getSmallestRefreshTimeFromConfigs(e){return e.reduce((r,n)=>(r.tokenRefreshInSeconds??0)<(n.tokenRefreshInSeconds??0)?r:n).tokenRefreshInSeconds??0}getConfigsWithSilentRenewEnabled(e){return e.filter(t=>t.silentRenew)}createRefreshEventForConfig(e,t){return this.loggerService.logDebug(e,"starting silent renew..."),this.configurationService.getOpenIDConfiguration(e.configId).pipe(H(r=>{if(!r?.silentRenew)return this.resetAuthDataService.resetAuthorizationData(r,t),g(null);if(this.flowsDataService.setSilentRenewRunning(r),this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(r)){let s=this.storagePersistenceService.read("storageCustomParamsRefresh",r)||{},{customParamsRefreshTokenRequest:o}=r,c=E(E({},o),s);return this.refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(r,t,c)}let n=this.storagePersistenceService.read("storageCustomParamsAuthRequest",r);return this.refreshSessionIframeService.refreshSessionWithIframe(r,t,n)}))}shouldStartPeriodicallyCheckForConfig(e){let t=this.authStateService.getIdToken(e),r=this.flowsDataService.isSilentRenewRunning(e),n=this.flowsDataService.isCodeFlowInProgress(e),s=this.userService.getUserDataFromStore(e);if(this.loggerService.logDebug(e,`Checking: silentRenewRunning: ${r}, isCodeFlowInProgress: ${n} - has idToken: ${!!t} - has userData: ${!!s}`),!(!!s&&!r&&!!t&&!n))return!1;let c=this.authStateService.hasIdTokenExpiredAndRenewCheckIsEnabled(e),u=this.authStateService.hasAccessTokenExpiredIfExpiryExists(e);return c||u}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),nn=3,qr=(()=>{class i{constructor(){this.flowHelper=a(ae),this.flowsDataService=a(G),this.loggerService=a(k),this.silentRenewService=a(gt),this.authStateService=a(Z),this.authWellKnownService=a(Re),this.refreshSessionIframeService=a(Nr),this.storagePersistenceService=a(M),this.refreshSessionRefreshTokenService=a(Lr),this.userService=a(Ee)}userForceRefreshSession(e,t,r){return e?(this.persistCustomParams(r,e),this.forceRefreshSession(e,t,r).pipe(L(()=>this.flowsDataService.resetSilentRenewRunning(e)))):S(()=>new Error("Please provide a configuration before setting up the module"))}forceRefreshSession(e,t,r){let{customParamsRefreshTokenRequest:n,configId:s}=e,o=E(E({},n),r);if(this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(e))return this.startRefreshSession(e,t,o).pipe(R(()=>{let d=this.authStateService.areAuthStorageTokensValid(e);return d?{idToken:this.authStateService.getIdToken(e),accessToken:this.authStateService.getAccessToken(e),userData:this.userService.getUserDataFromStore(e),isAuthenticated:d,configId:s}:{isAuthenticated:!1,errorMessage:"",userData:null,idToken:"",accessToken:"",configId:s}}));let{silentRenewTimeoutInSeconds:c}=e,u=(c??0)*1e3;return ye([this.startRefreshSession(e,t,r),this.silentRenewService.refreshSessionWithIFrameCompleted$.pipe(zt(d=>d?.configId===e.configId),Te(1))]).pipe(Kt(u),We(d=>d.pipe(ue((m,b)=>{let p=b+1;return!(m instanceof Vt)||p>nn?S(()=>new Error(m)):(this.loggerService.logDebug(e,`forceRefreshSession timeout. Attempt #${p}`),this.flowsDataService.resetSilentRenewRunning(e),be(p*1e3))}))),R(([d,m])=>{let b=this.authStateService.areAuthStorageTokensValid(e);if(b){let w=m.success?m.authResult:null;return{idToken:w?.id_token??"",accessToken:w?.access_token??"",userData:this.userService.getUserDataFromStore(e),isAuthenticated:b,configId:s}}return{isAuthenticated:!1,errorMessage:"",userData:null,idToken:"",accessToken:"",configId:s}}))}persistCustomParams(e,t){let{useRefreshToken:r}=t;e&&(r?this.storagePersistenceService.write("storageCustomParamsRefresh",e,t):this.storagePersistenceService.write("storageCustomParamsAuthRequest",e,t))}startRefreshSession(e,t,r){let n=this.flowsDataService.isSilentRenewRunning(e);return this.loggerService.logDebug(e,`Checking: silentRenewRunning: ${n}`),!n?this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(e).pipe(H(()=>(this.flowsDataService.setSilentRenewRunning(e),this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(e)?this.refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(e,t,r):this.refreshSessionIframeService.refreshSessionWithIframe(e,t,r)))):g(null)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Tr="myiFrameForCheckSession",mt=(()=>{class i{constructor(){this.checkSessionReceived=!1,this.scheduledHeartBeatRunning=null,this.lastIFrameRefresh=0,this.outstandingMessages=0,this.loggerService=a(k),this.storagePersistenceService=a(M),this.iFrameService=a(Wr),this.eventService=a(fe),this.zone=a(st),this.document=a(q),this.heartBeatInterval=3e3,this.iframeRefreshInterval=6e4,this.checkSessionChangedInternal$=new te(!1)}get checkSessionChanged$(){return this.checkSessionChangedInternal$.asObservable()}ngOnDestroy(){this.stop();let e=this.document.defaultView;e&&this.iframeMessageEventListener&&e.removeEventListener("message",this.iframeMessageEventListener,!1)}isCheckSessionConfigured(e){let{startCheckSession:t}=e;return!!t}start(e){if(this.scheduledHeartBeatRunning)return;let{clientId:t}=e;this.pollServerSession(t,e)}stop(){this.scheduledHeartBeatRunning&&(this.clearScheduledHeartBeat(),this.checkSessionReceived=!1)}serverStateChanged(e){let{startCheckSession:t}=e;return!!t&&this.checkSessionReceived}getExistingIframe(){return this.iFrameService.getExistingIFrame(Tr)}init(e){if(this.lastIFrameRefresh+this.iframeRefreshInterval>Date.now())return g();let t=this.storagePersistenceService.read("authWellKnownEndPoints",e);if(!t)return this.loggerService.logWarning(e,"CheckSession - init check session: authWellKnownEndpoints is undefined. Returning."),g();let r=this.getOrCreateIframe(e);this.bindMessageEventToIframe(e);let n=t.checkSessionIframe,s=r.contentWindow;return n?(s?s.location.replace(n):this.loggerService.logWarning(e,"CheckSession - init check session: IFrame contentWindow does not exist"),new De(o=>{r.onload=()=>{this.lastIFrameRefresh=Date.now(),o.next(),o.complete()}})):(this.loggerService.logWarning(e,"CheckSession - init check session: checkSessionIframe is not configured to run"),g())}pollServerSession(e,t){this.outstandingMessages=0;let r=()=>{this.init(t).pipe(Te(1)).subscribe(()=>{let n=this.getExistingIframe();if(n&&e){this.loggerService.logDebug(t,`CheckSession - clientId : '${e}' - existingIframe: '${n}'`);let s=this.storagePersistenceService.read("session_state",t),o=this.storagePersistenceService.read("authWellKnownEndPoints",t),c=n.contentWindow;if(s&&o?.checkSessionIframe&&c){let u=new URL(o.checkSessionIframe)?.origin;this.outstandingMessages++,c.postMessage(e+" "+s,u)}else this.loggerService.logDebug(t,`CheckSession - session_state is '${s}' - AuthWellKnownEndPoints is '${JSON.stringify(o,null,2)}'`),this.checkSessionChangedInternal$.next(!0)}else this.loggerService.logWarning(t,`CheckSession - OidcSecurityCheckSession pollServerSession checkSession IFrame does not exist: clientId : '${e}' - existingIframe: '${n}'`);this.outstandingMessages>3&&this.loggerService.logError(t,`CheckSession - OidcSecurityCheckSession not receiving check session response messages. Outstanding messages: '${this.outstandingMessages}'. Server unreachable?`),this.zone.runOutsideAngular(()=>{this.scheduledHeartBeatRunning=this.document?.defaultView?.setTimeout(()=>this.zone.run(r),this.heartBeatInterval)??null})})};r()}clearScheduledHeartBeat(){this.scheduledHeartBeatRunning!==null&&(clearTimeout(this.scheduledHeartBeatRunning),this.scheduledHeartBeatRunning=null)}messageHandler(e,t){let r=this.getExistingIframe(),s=!!this.storagePersistenceService.read("authWellKnownEndPoints",e)?.checkSessionIframe?.startsWith(t.origin);this.outstandingMessages=0,r&&s&&t.source===r.contentWindow&&(t.data==="error"?this.loggerService.logWarning(e,"CheckSession - error from check session messageHandler"):t.data==="changed"?(this.loggerService.logDebug(e,`CheckSession - ${t} from check session messageHandler`),this.checkSessionReceived=!0,this.eventService.fireEvent(B.CheckSessionReceived,t.data),this.checkSessionChangedInternal$.next(!0)):(this.eventService.fireEvent(B.CheckSessionReceived,t.data),this.loggerService.logDebug(e,`CheckSession - ${t.data} from check session messageHandler`)))}bindMessageEventToIframe(e){let t=this.document.defaultView;this.iframeMessageEventListener&&t&&t.removeEventListener("message",this.iframeMessageEventListener,!1),this.iframeMessageEventListener=this.messageHandler.bind(this,e),t&&t.addEventListener("message",this.iframeMessageEventListener,!1)}getOrCreateIframe(e){return this.getExistingIframe()||this.iFrameService.addIFrameToWindowBody(Tr,e)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Ye=(()=>{class i{constructor(){this.popUp=null,this.handle=-1,this.loggerService=a(k),this.storagePersistenceService=a(M),this.document=a(q),this.STORAGE_IDENTIFIER="popupauth",this.resultInternal$=new Oe}get result$(){return this.resultInternal$.asObservable()}get windowInternal(){return this.document.defaultView}isCurrentlyInPopup(e){if(this.canAccessSessionStorage()){let t=this.storagePersistenceService.read(this.STORAGE_IDENTIFIER,e),r=this.windowInternal;return r?!!r.opener&&r.opener!==r&&!!t:!1}return!1}openPopUp(e,t,r){let n=this.getOptions(t);this.storagePersistenceService.write(this.STORAGE_IDENTIFIER,"true",r);let s=this.windowInternal;if(!s)return;if(!e){this.loggerService.logError(r,"Could not open popup, url is empty");return}if(this.popUp=s.open(e,"_blank",n),!this.popUp){this.storagePersistenceService.remove(this.STORAGE_IDENTIFIER,r),this.loggerService.logError(r,"Could not open popup");return}this.loggerService.logDebug(r,"Opened popup with url "+e);let o=c=>{if(!c?.data||typeof c.data!="string"){if(r.disableCleaningPopupOnInvalidMessage)return;this.cleanUp(o,r);return}this.loggerService.logDebug(r,"Received message from popup with url "+c.data),this.resultInternal$.next({userClosed:!1,receivedUrl:c.data}),this.cleanUp(o,r)};s.addEventListener("message",o,!1),this.handle=s.setInterval(()=>{this.popUp?.closed&&(this.resultInternal$.next({userClosed:!0,receivedUrl:""}),this.cleanUp(o,r))},200)}sendMessageToMainWindow(e,t){let r=this.windowInternal;if(r&&r.opener){let n=r.location.href;this.sendMessage(e,n,t)}}cleanUp(e,t){let r=this.windowInternal;r&&(r.removeEventListener("message",e,!1),r.clearInterval(this.handle),this.popUp&&(this.storagePersistenceService.remove(this.STORAGE_IDENTIFIER,t),this.popUp.close(),this.popUp=null))}sendMessage(e,t,r){let n=this.windowInternal;if(n){if(!e){this.loggerService.logDebug(r,`Can not send message to parent, no url: '${e}'`);return}n.opener.postMessage(e,t)}}getOptions(e){let t={width:500,height:500,left:50,top:50},r=E(E({},t),e||{}),n=this.windowInternal;if(!n)return"";let s=r.width||t.width,o=r.height||t.height,c=n.screenLeft+(n.outerWidth-s)/2,u=n.screenTop+(n.outerHeight-o)/2;return r.left=c,r.top=u,Object.entries(r).map(([d,m])=>`${encodeURIComponent(d)}=${encodeURIComponent(m)}`).join(",")}canAccessSessionStorage(){return typeof navigator<"u"&&navigator.cookieEnabled&&typeof Storage<"u"}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),sn=(()=>{class i{constructor(){this.document=a(q)}getStateParamFromCurrentUrl(e){let t=e||this.getCurrentUrl();if(!t)return null;let r=new URL(t);return new URLSearchParams(r.search).get("state")}getCurrentUrl(){return this.document?.defaultView?.location.toString()??null}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),vt=(()=>{class i{constructor(){this.checkSessionService=a(mt),this.currentUrlService=a(sn),this.silentRenewService=a(gt),this.userService=a(Ee),this.loggerService=a(k),this.authStateService=a(Z),this.callbackService=a(jr),this.refreshSessionService=a(qr),this.periodicallyTokenCheckService=a(rn),this.popupService=a(Ye),this.autoLoginService=a(Ii),this.storagePersistenceService=a(M),this.publicEventsService=a(fe)}checkAuth(e,t,r){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module"));this.publicEventsService.fireEvent(B.CheckingAuth);let n=this.currentUrlService.getStateParamFromCurrentUrl(r);return this.getConfig(e,r)?this.checkAuthWithConfig(e,t,r):S(()=>new Error(`could not find matching config for state ${n}`))}checkAuthMultiple(e,t){let r=this.currentUrlService.getStateParamFromCurrentUrl(t);if(r){let o=this.getConfigurationWithUrlState(e,r);return o?this.composeMultipleLoginResults(e,o,t):S(()=>new Error(`could not find matching config for state ${r}`))}let n=e,s=n.map(o=>this.checkAuthWithConfig(o,n,t));return ye(s)}checkAuthIncludingServer(e,t){return e?this.checkAuthWithConfig(e,t).pipe(H(r=>{let{isAuthenticated:n}=r;return n?g(r):this.refreshSessionService.forceRefreshSession(e,t).pipe(L(s=>{s?.isAuthenticated&&this.startCheckSessionAndValidation(e,t)}))})):S(()=>new Error("Please provide a configuration before setting up the module"))}getConfig(e,t){let r=this.currentUrlService.getStateParamFromCurrentUrl(t);return r?this.getConfigurationWithUrlState([e],r):e}checkAuthWithConfig(e,t,r){if(!e){let d="Please provide at least one configuration before setting up the module";return this.loggerService.logError(e,d),g({isAuthenticated:!1,errorMessage:d,userData:null,idToken:"",accessToken:"",configId:""})}let n=r||this.currentUrlService.getCurrentUrl();if(!n){let d="No URL found!";return this.loggerService.logError(e,d),g({isAuthenticated:!1,errorMessage:d,userData:null,idToken:"",accessToken:"",configId:""})}let{configId:s,authority:o}=e;if(this.loggerService.logDebug(e,`Working with config '${s}' using '${o}'`),this.popupService.isCurrentlyInPopup(e))return this.popupService.sendMessageToMainWindow(n,e),g({isAuthenticated:!1,errorMessage:"",userData:null,idToken:"",accessToken:"",configId:""});let c=this.callbackService.isCallback(n,e);return this.loggerService.logDebug(e,`currentUrl to check auth with: '${n}'`),(c?this.callbackService.handleCallbackAndFireEvents(n,e,t):g({})).pipe(R(()=>{let d=this.authStateService.areAuthStorageTokensValid(e);return this.loggerService.logDebug(e,`checkAuth completed. Firing events now. isAuthenticated: ${d}`),d&&(this.startCheckSessionAndValidation(e,t),c||(this.authStateService.setAuthenticatedAndFireEvent(t),this.userService.publishUserDataIfExists(e,t))),this.publicEventsService.fireEvent(B.CheckingAuthFinished),{isAuthenticated:d,userData:this.userService.getUserDataFromStore(e),accessToken:this.authStateService.getAccessToken(e),idToken:this.authStateService.getIdToken(e),configId:s}}),L(({isAuthenticated:d})=>{d&&this.autoLoginService.checkSavedRedirectRouteAndNavigate(e)}),x(({message:d})=>(this.loggerService.logError(e,d),this.publicEventsService.fireEvent(B.CheckingAuthFinishedWithError,d),g({isAuthenticated:!1,errorMessage:d,userData:null,idToken:"",accessToken:"",configId:s}))))}startCheckSessionAndValidation(e,t){this.checkSessionService.isCheckSessionConfigured(e)&&this.checkSessionService.start(e),this.periodicallyTokenCheckService.startTokenValidationPeriodically(t,e),this.silentRenewService.isSilentRenewConfigured(e)&&this.silentRenewService.getOrCreateIframe(e)}getConfigurationWithUrlState(e,t){if(!t)return null;for(let r of e)if(this.storagePersistenceService.read("authStateControl",r)===t)return r;return null}composeMultipleLoginResults(e,t,r){let n=e.filter(c=>c.configId!==t.configId),s=this.checkAuthWithConfig(t,e,r),o=n.map(c=>{let{redirectUrl:u}=c;return this.checkAuthWithConfig(c,e,u)});return ye([s,...o])}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),St=(()=>{class i{constructor(){this.document=a(q)}redirectTo(e){this.document.location.href=e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),wt=(()=>{class i{constructor(){this.loggerService=a(k),this.flowHelper=a(ae)}hasConfigValidResponseType(e){return this.flowHelper.isCurrentFlowAnyImplicitFlow(e)||this.flowHelper.isCurrentFlowCodeFlow(e)?!0:(this.loggerService.logWarning(e,"module configured incorrectly, invalid response_type. Check the responseType in the config"),!1)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),on=(()=>{class i{constructor(){this.loggerService=a(k),this.urlService=a(X),this.dataService=a(ge),this.storagePersistenceService=a(M)}postParRequest(e,t){let r=new C;r=r.set("Content-Type","application/x-www-form-urlencoded");let n=this.storagePersistenceService.read("authWellKnownEndPoints",e);if(!n)return S(()=>new Error("Could not read PAR endpoint because authWellKnownEndPoints are not given"));let s=n.parEndpoint;return s?this.urlService.createBodyForParCodeFlowRequest(e,t).pipe(H(o=>this.dataService.post(s,o,e,r).pipe(re(2),R(c=>(this.loggerService.logDebug(e,"par response: ",c),{expiresIn:c.expires_in,requestUri:c.request_uri})),x(c=>{let u="There was an error on ParService postParRequest";return this.loggerService.logError(e,u,c),S(()=>new Error(u))})))):S(()=>new Error("Could not read PAR endpoint from authWellKnownEndpoints"))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),an=(()=>{class i{constructor(){this.loggerService=a(k),this.responseTypeValidationService=a(wt),this.urlService=a(X),this.redirectService=a(St),this.authWellKnownService=a(Re),this.popupService=a(Ye),this.checkAuthService=a(vt),this.parService=a(on)}loginPar(e,t){if(!this.responseTypeValidationService.hasConfigValidResponseType(e)){this.loggerService.logError(e,"Invalid response type!");return}this.loggerService.logDebug(e,"BEGIN Authorize OIDC Flow, no auth data"),this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(e).pipe(H(()=>this.parService.postParRequest(e,t))).subscribe(r=>{this.loggerService.logDebug(e,"par response: ",r);let n=this.urlService.getAuthorizeParUrl(r.requestUri,e);if(this.loggerService.logDebug(e,"par request url: ",n),!n){this.loggerService.logError(e,`Could not create URL with param ${r.requestUri}: '${n}'`);return}t?.urlHandler?t.urlHandler(n):this.redirectService.redirectTo(n)})}loginWithPopUpPar(e,t,r,n){let{configId:s}=e;if(!this.responseTypeValidationService.hasConfigValidResponseType(e)){let o="Invalid response type!";return this.loggerService.logError(e,o),S(()=>new Error(o))}return this.loggerService.logDebug(e,"BEGIN Authorize OIDC Flow with popup, no auth data"),this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(e).pipe(H(()=>this.parService.postParRequest(e,r)),H(o=>{this.loggerService.logDebug(e,`par response: ${o}`);let c=this.urlService.getAuthorizeParUrl(o.requestUri,e);if(this.loggerService.logDebug(e,"par request url: ",c),!c){let u=`Could not create URL with param ${o.requestUri}: 'url'`;return this.loggerService.logError(e,u),S(()=>new Error(u))}return this.popupService.openPopUp(c,n,e),this.popupService.result$.pipe(Te(1),H(u=>{let{userClosed:d,receivedUrl:m}=u;return d?g({isAuthenticated:!1,errorMessage:"User closed popup",userData:null,idToken:"",accessToken:"",configId:s}):this.checkAuthService.checkAuth(e,t,m)}))}))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),cn=(()=>{class i{constructor(){this.loggerService=a(k),this.responseTypeValidationService=a(wt),this.urlService=a(X),this.authWellKnownService=a(Re),this.popupService=a(Ye),this.checkAuthService=a(vt)}loginWithPopUpStandard(e,t,r,n){let{configId:s}=e;if(!this.responseTypeValidationService.hasConfigValidResponseType(e)){let o="Invalid response type!";return this.loggerService.logError(e,o),S(()=>new Error(o))}return this.loggerService.logDebug(e,"BEGIN Authorize OIDC Flow with popup, no auth data"),this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(e).pipe(H(()=>this.urlService.getAuthorizeUrl(e,r)),L(o=>this.popupService.openPopUp(o,n,e)),H(()=>this.popupService.result$.pipe(Te(1),H(o=>{let{userClosed:c,receivedUrl:u}=o;return c?g({isAuthenticated:!1,errorMessage:"User closed popup",userData:null,idToken:"",accessToken:"",configId:s}):this.checkAuthService.checkAuth(e,t,u)}))))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),ln=(()=>{class i{constructor(){this.loggerService=a(k),this.responseTypeValidationService=a(wt),this.urlService=a(X),this.redirectService=a(St),this.authWellKnownService=a(Re),this.flowsDataService=a(G)}loginStandard(e,t){if(!this.responseTypeValidationService.hasConfigValidResponseType(e)){this.loggerService.logError(e,"Invalid response type!");return}this.loggerService.logDebug(e,"BEGIN Authorize OIDC Flow, no auth data"),this.flowsDataService.setCodeFlowInProgress(e),this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(e).subscribe(()=>{let{urlHandler:r}=t||{};this.flowsDataService.resetSilentRenewRunning(e),this.urlService.getAuthorizeUrl(e,t).subscribe(n=>{if(!n){this.loggerService.logError(e,"Could not create URL",n);return}r?r(n):this.redirectService.redirectTo(n)})})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),un=(()=>{class i{constructor(){this.parLoginService=a(an),this.popUpLoginService=a(cn),this.standardLoginService=a(ln),this.storagePersistenceService=a(M),this.popupService=a(Ye)}login(e,t){if(!e)throw new Error("Please provide a configuration before setting up the module");let{usePushedAuthorisationRequests:r}=e;return t?.customParams&&this.storagePersistenceService.write("storageCustomParamsAuthRequest",t.customParams,e),r?this.parLoginService.loginPar(e,t):this.standardLoginService.loginStandard(e,t)}loginWithPopUp(e,t,r,n){if(!e)throw new Error("Please provide a configuration before setting up the module");if(this.popupService.isCurrentlyInPopup(e))return g({errorMessage:"There is already a popup open."});let{usePushedAuthorisationRequests:o}=e;return r?.customParams&&this.storagePersistenceService.write("storageCustomParamsAuthRequest",r.customParams,e),o?this.parLoginService.loginWithPopUpPar(e,t,r,n):this.popUpLoginService.loginWithPopUpStandard(e,t,r,n)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function dn(i){let l=E({},i);for(let e in i)(i[e]===void 0||i[e]===null)&&delete l[e];return l}var hn=(()=>{class i{constructor(){this.loggerService=a(k),this.dataService=a(ge),this.storagePersistenceService=a(M),this.urlService=a(X),this.checkSessionService=a(mt),this.resetAuthDataService=a(ce),this.redirectService=a(St)}logoff(e,t,r){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module"));this.loggerService.logDebug(e,"logoff, remove auth",r);let{urlHandler:n,customParams:s}=r||{},o=this.urlService.getEndSessionUrl(e,s);return o?this.checkSessionService.serverStateChanged(e)?(this.loggerService.logDebug(e,"Server State changed. Logoff was only locally. Returning."),g(null)):n?(this.loggerService.logDebug(e,`Custom UrlHandler found. Using this to handle logoff with url '${o}'`),n(o),this.resetAuthDataService.resetAuthorizationData(e,t),g(null)):this.logoffInternal(r,o,e,t):(this.loggerService.logDebug(e,"No endsessionUrl present. Logoff was only locally. Returning."),g(null))}logoffLocal(e,t){this.resetAuthDataService.resetAuthorizationData(e,t),this.checkSessionService.stop()}logoffLocalMultiple(e){e.forEach(t=>this.logoffLocal(t,e))}logoffAndRevokeTokens(e,t,r){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module"));let{revocationEndpoint:n}=this.storagePersistenceService.read("authWellKnownEndPoints",e)||{};return n?this.storagePersistenceService.getRefreshToken(e)?this.revokeRefreshToken(e).pipe(H(s=>this.revokeAccessToken(e)),x(s=>{let o="revoke token failed";return this.loggerService.logError(e,o,s),S(()=>new Error(o))}),P(()=>this.logoff(e,t,r))):this.revokeAccessToken(e).pipe(x(s=>{let o="revoke accessToken failed";return this.loggerService.logError(e,o,s),S(()=>new Error(o))}),P(()=>this.logoff(e,t,r))):(this.loggerService.logDebug(e,"revocation endpoint not supported"),this.logoff(e,t,r))}revokeAccessToken(e,t){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module"));let r=t||this.storagePersistenceService.getAccessToken(e),n=this.urlService.createRevocationEndpointBodyAccessToken(r,e);return this.sendRevokeRequest(e,n)}revokeRefreshToken(e,t){if(!e)return S(()=>new Error("Please provide a configuration before setting up the module"));let r=t||this.storagePersistenceService.getRefreshToken(e),n=this.urlService.createRevocationEndpointBodyRefreshToken(r,e);return this.sendRevokeRequest(e,n)}logoffInternal(e,t,r,n){let{logoffMethod:s,customParams:o}=e||{};if(!s||s==="GET")return this.redirectService.redirectTo(t),this.resetAuthDataService.resetAuthorizationData(r,n),g(null);let{state:c,logout_hint:u,ui_locales:d}=o||{},{clientId:m}=r,b=this.storagePersistenceService.getIdToken(r),w=this.urlService.getPostLogoutRedirectUrl(r),p=this.getHeaders(),{url:W}=this.urlService.getEndSessionEndpoint(r),z=dn({id_token_hint:b,client_id:m,post_logout_redirect_uri:w,state:c,logout_hint:u,ui_locales:d});return this.resetAuthDataService.resetAuthorizationData(r,n),this.dataService.post(W,z,r,p)}sendRevokeRequest(e,t){let r=this.urlService.getRevocationEndpointUrl(e),n=this.getHeaders();return this.dataService.post(r,t,e,n).pipe(re(2),H(s=>(this.loggerService.logDebug(e,"revocation endpoint post response: ",s),g(s))),x(s=>{let o="Revocation request failed";return this.loggerService.logError(e,o,s),S(()=>new Error(o))}))}getHeaders(){let e=new C;return e=e.set("Content-Type","application/x-www-form-urlencoded"),e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),Vr=(()=>{class i{constructor(){this.checkSessionService=a(mt),this.checkAuthService=a(vt),this.userService=a(Ee),this.tokenHelperService=a(Be),this.configurationService=a(Or),this.authStateService=a(Z),this.flowsDataService=a(G),this.callbackService=a(jr),this.logoffRevocationService=a(hn),this.loginService=a(un),this.refreshSessionService=a(qr),this.urlService=a(X),this.authWellKnownService=a(Re),this.userData=lt(this.userData$,{requireSync:!0}),this.authenticated=lt(this.isAuthenticated$,{requireSync:!0})}get userData$(){return this.userService.userData$}get isAuthenticated$(){return this.authStateService.authenticated$}get checkSessionChanged$(){return this.checkSessionService.checkSessionChanged$}get stsCallback$(){return this.callbackService.stsCallback$}preloadAuthWellKnownDocument(e){return this.configurationService.getOpenIDConfiguration(e).pipe(P(t=>this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(t)))}getConfigurations(){return this.configurationService.getAllConfigurations()}getConfiguration(e){return this.configurationService.getOpenIDConfiguration(e)}getUserData(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.userService.getUserDataFromStore(t)))}checkAuth(e,t){return this.configurationService.getOpenIDConfigurations(t).pipe(P(({allConfigs:r,currentConfig:n})=>this.checkAuthService.checkAuth(n,r,e)))}checkAuthMultiple(e){return this.configurationService.getOpenIDConfigurations().pipe(P(({allConfigs:t})=>this.checkAuthService.checkAuthMultiple(t,e)))}isAuthenticated(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.authStateService.isAuthenticated(t)))}checkAuthIncludingServer(e){return this.configurationService.getOpenIDConfigurations(e).pipe(P(({allConfigs:t,currentConfig:r})=>this.checkAuthService.checkAuthIncludingServer(r,t)))}getAccessToken(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.authStateService.getAccessToken(t)))}getIdToken(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.authStateService.getIdToken(t)))}getRefreshToken(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.authStateService.getRefreshToken(t)))}getAuthenticationResult(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.authStateService.getAuthenticationResult(t)))}getPayloadFromIdToken(e=!1,t){return this.configurationService.getOpenIDConfiguration(t).pipe(R(r=>{let n=this.authStateService.getIdToken(r);return this.tokenHelperService.getPayloadFromToken(n,e,r)}))}getPayloadFromAccessToken(e=!1,t){return this.configurationService.getOpenIDConfiguration(t).pipe(R(r=>{let n=this.authStateService.getAccessToken(r);return this.tokenHelperService.getPayloadFromToken(n,e,r)}))}setState(e,t){return this.configurationService.getOpenIDConfiguration(t).pipe(R(r=>this.flowsDataService.setAuthStateControl(e,r)))}getState(e){return this.configurationService.getOpenIDConfiguration(e).pipe(R(t=>this.flowsDataService.getAuthStateControl(t)))}authorize(e,t){this.configurationService.getOpenIDConfiguration(e).subscribe(r=>this.loginService.login(r,t))}authorizeWithPopUp(e,t,r){return this.configurationService.getOpenIDConfigurations(r).pipe(P(({allConfigs:n,currentConfig:s})=>this.loginService.loginWithPopUp(s,n,e,t)))}forceRefreshSession(e,t){return this.configurationService.getOpenIDConfigurations(t).pipe(P(({allConfigs:r,currentConfig:n})=>this.refreshSessionService.userForceRefreshSession(n,r,e)))}logoffAndRevokeTokens(e,t){return this.configurationService.getOpenIDConfigurations(e).pipe(P(({allConfigs:r,currentConfig:n})=>this.logoffRevocationService.logoffAndRevokeTokens(n,r,t)))}logoff(e,t){return this.configurationService.getOpenIDConfigurations(e).pipe(P(({allConfigs:r,currentConfig:n})=>this.logoffRevocationService.logoff(n,r,t)))}logoffLocal(e){this.configurationService.getOpenIDConfigurations(e).subscribe(({allConfigs:t,currentConfig:r})=>this.logoffRevocationService.logoffLocal(r,t))}logoffLocalMultiple(){this.configurationService.getOpenIDConfigurations().subscribe(({allConfigs:e})=>this.logoffRevocationService.logoffLocalMultiple(e))}revokeAccessToken(e,t){return this.configurationService.getOpenIDConfiguration(t).pipe(P(r=>this.logoffRevocationService.revokeAccessToken(r,e)))}revokeRefreshToken(e,t){return this.configurationService.getOpenIDConfiguration(t).pipe(P(r=>this.logoffRevocationService.revokeRefreshToken(r,e)))}getEndSessionUrl(e,t){return this.configurationService.getOpenIDConfiguration(t).pipe(R(r=>this.urlService.getEndSessionUrl(r,e)))}getAuthorizeUrl(e,t){return this.configurationService.getOpenIDConfiguration(t).pipe(P(r=>this.urlService.getAuthorizeUrl(r,e?{customParams:e}:void 0)))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})(),pn=(()=>{class i{read(e){return sessionStorage.getItem(e)}write(e,t){sessionStorage.setItem(e,t)}remove(e){sessionStorage.removeItem(e)}clear(){sessionStorage.clear()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function js(i,...l){let e=fn(i);for(let t of l)e.push(...t.\u0275providers);return Jt(e)}function fn(i){return[{provide:Er,useValue:i},i?.loader||{provide:Ke,useFactory:hi,deps:[Er]},{provide:Hr,useClass:pn},{provide:Fr,useClass:pi}]}var Os=(()=>{class i{read(e){return localStorage.getItem(e)}write(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}clear(){localStorage.clear()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var yt=["campaign_code"],ee=(()=>{class i{constructor(){}getCookie(e){let t=document.cookie.split(";"),r=t.length,n=`${e}=`,s;for(let o=0;o-1?r.substr(0,n):r;this.deleteCookie(s.trim())}}setCookie(e){y.consoleLog("\u{1F36A} set",e);let t=new Date;t.setTime(t.getTime()+e.expireDays*24*60*60*1e3);let r=`expires=${t.toUTCString()}`,n=e.path?`; path=${e.path}`:"",s=e.domain?`; domain=${e.domain}`:"",o=e.sameSite?`; SameSite=${e.sameSite}`:"";document.cookie=`${e.name}=${e.value}; ${r}${n}${s}${o}`}setConsent(e){let t=j.mode===br.local;this.setCookie(E({name:"consentLevel",value:e,expireDays:e===2?3650:30,path:"/"},!t&&{domain:j.cookieConsent.topLevelDomain,sameSite:"Lax"}))}getConsent(){let e=this.getCookie("consentLevel");return e!==""?Number(e):0}get(e){if(yt.includes(e))return this.useSessionStorage("get",e);let t=typeof window.localStorage<"u"?localStorage.getItem(e):null;return t!==null?t:void 0}getJson(e){let t=this.get(e);return t?JSON.parse(t):null}delete(e){if(yt.includes(e)){this.useSessionStorage("delete",e);return}typeof window.localStorage<"u"&&localStorage.removeItem(e)}deleteAll(){this.deleteAllCookies(),typeof window.localStorage<"u"&&localStorage.clear()}set(e,t,r){if(yt.includes(e)){this.useSessionStorage("set",e,t);return}(this.getConsent()>0||r)&&typeof window.localStorage<"u"&&localStorage.setItem(e,t)}useSessionStorage(e,t,r){if(typeof window.sessionStorage>"u")return"";switch(e){case"set":sessionStorage.setItem(t,r??"");break;case"get":return sessionStorage.getItem(t)??"";case"delete":sessionStorage.removeItem(t);break}return""}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var D=new ie("basePath");var v=class{constructor(l={}){this.apiKeys=l.apiKeys,this.username=l.username,this.password=l.password,this.accessToken=l.accessToken,this.basePath=l.basePath,this.withCredentials=l.withCredentials}selectHeaderContentType(l){if(l.length==0)return;let e=l.find(t=>this.isJsonMime(t));return e===void 0?l[0]:e}selectHeaderAccept(l){if(l.length==0)return;let e=l.find(t=>this.isJsonMime(t));return e===void 0?l[0]:e}isJsonMime(l){let e=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return l!=null&&(e.test(l)||l.toLowerCase()==="application/json-patch+json")}};var kt=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}countriesget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/countries`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var U=class extends gr{encodeKey(l){return l=super.encodeKey(l),l.replace(/\+/gi,"%2B")}encodeValue(l){return l=super.encodeValue(l),l.replace(/\+/gi,"%2B")}};var je=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}productsavailableget(e,t,r,n,s="body",o=!1){let c=new F({encoder:new U});e!=null&&(c=c.set("country",e)),t!=null&&(c=c.set("generic",t)),r!=null&&(c=c.set("update_price",r)),n!=null&&(c=c.set("campaign_code",n));let u=this.defaultHeaders,d=["application/json"],m=this.configuration.selectHeaderAccept(d);m!=null&&(u=u.set("Accept",m));let b=[];return this.httpClient.request("get",`${this.basePath}/products/available`,{params:c,withCredentials:this.configuration.withCredentials,headers:u,observe:s,reportProgress:o})}productsget(e,t,r,n="body",s=!1){let o=new F({encoder:new U});e!=null&&(o=o.set("status",e)),t!=null&&(o=o.set("campaign_token",t)),r!=null&&(o=o.set("campaign_code",r));let c=this.defaultHeaders,u=["application/json"],d=this.configuration.selectHeaderAccept(u);d!=null&&(c=c.set("Accept",d));let m=[];return this.httpClient.request("get",`${this.basePath}/products`,{params:o,withCredentials:this.configuration.withCredentials,headers:c,observe:n,reportProgress:s})}productspost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling productspost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/products`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}productsproductIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter product_id was null or undefined when calling productsproductIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/products/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}productsproductIdget(e,t,r,n="body",s=!1){if(e==null)throw new Error("Required parameter product_id was null or undefined when calling productsproductIdget.");let o=new F({encoder:new U});t!=null&&(o=o.set("campaign_token",t)),r!=null&&(o=o.set("campaign_code",r));let c=this.defaultHeaders,u=["application/json"],d=this.configuration.selectHeaderAccept(u);d!=null&&(c=c.set("Accept",d));let m=[];return this.httpClient.request("get",`${this.basePath}/products/${encodeURIComponent(String(e))}`,{params:o,withCredentials:this.configuration.withCredentials,headers:c,observe:n,reportProgress:s})}productsproductIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling productsproductIdput.");if(t==null)throw new Error("Required parameter product_id was null or undefined when calling productsproductIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/products/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var It=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}subscriptionsget(e,t,r,n,s,o,c,u,d,m,b="body",w=!1){let p=new F({encoder:new U});e!=null&&(p=p.set("limit",e)),t!=null&&(p=p.set("offset",t)),r!=null&&(p=p.set("orderby",r)),n!=null&&(p=p.set("status",n)),s!=null&&(p=p.set("active",s)),o!=null&&(p=p.set("sub",o)),c!=null&&(p=p.set("product_id",c)),u!=null&&(p=p.set("billing_plan_id",u)),d!=null&&(p=p.set("client_id",d)),m!=null&&(p=p.set("scopes",m));let W=this.defaultHeaders,O=["application/json"],z=this.configuration.selectHeaderAccept(O);z!=null&&(W=W.set("Accept",z));let le=[];return this.httpClient.request("get",`${this.basePath}/subscriptions`,{params:p,withCredentials:this.configuration.withCredentials,headers:W,observe:b,reportProgress:w})}subscriptionspost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling subscriptionspost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/subscriptions`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}subscriptionssubscriptionIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter subscription_id was null or undefined when calling subscriptionssubscriptionIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/subscriptions/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}subscriptionssubscriptionIdget(e,t="body",r=!1){if(e==null)throw new Error("Required parameter subscription_id was null or undefined when calling subscriptionssubscriptionIdget.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("get",`${this.basePath}/subscriptions/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}subscriptionssubscriptionIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling subscriptionssubscriptionIdput.");if(t==null)throw new Error("Required parameter subscription_id was null or undefined when calling subscriptionssubscriptionIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/subscriptions/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}subscriptionssubscriptionIdupgradeInfoget(e,t,r,n="body",s=!1){if(e==null)throw new Error("Required parameter subscription_id was null or undefined when calling subscriptionssubscriptionIdupgradeInfoget.");if(t==null)throw new Error("Required parameter product_id was null or undefined when calling subscriptionssubscriptionIdupgradeInfoget.");if(r==null)throw new Error("Required parameter billing_plan_id was null or undefined when calling subscriptionssubscriptionIdupgradeInfoget.");let o=new F({encoder:new U});t!=null&&(o=o.set("product_id",t)),r!=null&&(o=o.set("billing_plan_id",r));let c=this.defaultHeaders,u=["application/json"],d=this.configuration.selectHeaderAccept(u);d!=null&&(c=c.set("Accept",d));let m=[];return this.httpClient.request("get",`${this.basePath}/subscriptions/${encodeURIComponent(String(e))}/upgrade-info`,{params:o,withCredentials:this.configuration.withCredentials,headers:c,observe:n,reportProgress:s})}userssubsubscriptionsdelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter sub was null or undefined when calling userssubsubscriptionsdelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/users/${encodeURIComponent(String(e))}/subscriptions`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var gn=(function(i){return i.StatusEnum={WaitingForPaymentConfirmationFromPaymentProvider:"waiting for payment confirmation from payment provider",PaymentReceivedFreeSubscription:"payment received / free subscription",PaymentFailedRetryingPayment:"payment failed - retrying payment",SinglePaymentReceived:"single payment received",UpgradedByUser:"upgraded by user",UpgradedByAdmin:"upgraded by admin",CancelledByUser:"cancelled by user",CancelledByAdmin:"cancelled by admin",NoPaymentRecieved:"no payment recieved"},i})(gn||{});var Ct=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}billingplansbillingPlanIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter billing_plan_id was null or undefined when calling billingplansbillingPlanIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/billingplans/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}billingplansbillingPlanIdget(e,t="body",r=!1){if(e==null)throw new Error("Required parameter billing_plan_id was null or undefined when calling billingplansbillingPlanIdget.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("get",`${this.basePath}/billingplans/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}billingplansbillingPlanIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling billingplansbillingPlanIdput.");if(t==null)throw new Error("Required parameter billing_plan_id was null or undefined when calling billingplansbillingPlanIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/billingplans/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}billingplansget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/billingplans`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}billingplanspost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling billingplanspost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/billingplans`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var At=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}campaignCampaignIdGet(e,t="body",r=!1){if(e==null)throw new Error("Required parameter campaign_id was null or undefined when calling campaignCampaignIdGet.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("get",`${this.basePath}/campaign/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}campaignGet(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/campaign`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}campaigncampaignIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter campaign_id was null or undefined when calling campaigncampaignIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/campaign/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}campaigncampaignIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling campaigncampaignIdput.");if(t==null)throw new Error("Required parameter campaign_id was null or undefined when calling campaigncampaignIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/campaign/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}campaignpost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling campaignpost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/campaign`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Et=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}claimsclaimIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter claim_id was null or undefined when calling claimsclaimIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/claims/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}claimsclaimIdget(e,t="body",r=!1){if(e==null)throw new Error("Required parameter claim_id was null or undefined when calling claimsclaimIdget.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("get",`${this.basePath}/claims/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}claimsclaimIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling claimsclaimIdput.");if(t==null)throw new Error("Required parameter claim_id was null or undefined when calling claimsclaimIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/claims/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}claimsget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/claims`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}claimspost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling claimspost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/claims`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Rt=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}paymentretry(e,t="body",r=!1){if(e==null)throw new Error("Required parameter token was null or undefined when calling paymentretry.");let n=new F({encoder:new U});e!=null&&(n=n.set("token",e));let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=[];return this.httpClient.request("post",`${this.basePath}/payment/retry`,{params:n,withCredentials:this.configuration.withCredentials,headers:s,observe:t,reportProgress:r})}paymentretryToken(e,t="body",r=!1){if(e==null)throw new Error("Required parameter sub was null or undefined when calling paymentretryToken.");let n=new F({encoder:new U});e!=null&&(n=n.set("sub",e));let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=[];return this.httpClient.request("get",`${this.basePath}/payment/retry-token`,{params:n,withCredentials:this.configuration.withCredentials,headers:s,observe:t,reportProgress:r})}subscriptionsvalidget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/subscriptions/valid`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Pt=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}eligibilitiesget(e,t,r,n="body",s=!1){let o=new F({encoder:new U});e!=null&&(o=o.set("sub",e)),t!=null&&(o=o.set("email",t)),r!=null&&(o=o.set("producttype",r));let c=this.defaultHeaders,u=["application/json"],d=this.configuration.selectHeaderAccept(u);d!=null&&(c=c.set("Accept",d));let m=[];return this.httpClient.request("get",`${this.basePath}/eligibilities`,{params:o,withCredentials:this.configuration.withCredentials,headers:c,observe:n,reportProgress:s})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Dt=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}jobsget(e,t,r,n,s,o,c,u,d,m="body",b=!1){let w=new F({encoder:new U});e!=null&&(w=w.set("limit",e)),t!=null&&(w=w.set("offset",t)),r!=null&&(w=w.set("orderby",r)),n!=null&&(w=w.set("status",n)),s!=null&&(w=w.set("subscription_id",s)),o!=null&&(w=w.set("sub",o)),c!=null&&(w=w.set("product_id",c)),u!=null&&(w=w.set("start_date",u.toISOString())),d!=null&&(w=w.set("end_date",d.toISOString()));let p=this.defaultHeaders,W=["application/json"],O=this.configuration.selectHeaderAccept(W);O!=null&&(p=p.set("Accept",O));let z=[];return this.httpClient.request("get",`${this.basePath}/jobs`,{params:w,withCredentials:this.configuration.withCredentials,headers:p,observe:m,reportProgress:b})}jobsjobIddelete(e,t="body",r=!1){if(e==null)throw new Error("Required parameter job_id was null or undefined when calling jobsjobIddelete.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("delete",`${this.basePath}/jobs/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}jobsjobIdget(e,t="body",r=!1){if(e==null)throw new Error("Required parameter job_id was null or undefined when calling jobsjobIdget.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=[];return this.httpClient.request("get",`${this.basePath}/jobs/${encodeURIComponent(String(e))}`,{withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}jobsjobIdput(e,t,r="body",n=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling jobsjobIdput.");if(t==null)throw new Error("Required parameter job_id was null or undefined when calling jobsjobIdput.");let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=["application/json"],d=this.configuration.selectHeaderContentType(u);return d!=null&&(s=s.set("Content-Type",d)),this.httpClient.request("put",`${this.basePath}/jobs/${encodeURIComponent(String(t))}`,{body:e,withCredentials:this.configuration.withCredentials,headers:s,observe:r,reportProgress:n})}jobspost(e,t="body",r=!1){if(e==null)throw new Error("Required parameter body was null or undefined when calling jobspost.");let n=this.defaultHeaders,s=["application/json"],o=this.configuration.selectHeaderAccept(s);o!=null&&(n=n.set("Accept",o));let c=["application/json"],u=this.configuration.selectHeaderContentType(c);return u!=null&&(n=n.set("Content-Type",u)),this.httpClient.request("post",`${this.basePath}/jobs`,{body:e,withCredentials:this.configuration.withCredentials,headers:n,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Tt=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}reportsget(e,t,r,n,s,o,c,u,d,m,b="body",w=!1){let p=new F({encoder:new U});e!=null&&(p=p.set("limit",e)),t!=null&&(p=p.set("offset",t)),r!=null&&(p=p.set("orderby",r)),n!=null&&(p=p.set("from",n)),s!=null&&(p=p.set("to",s)),o!=null&&(p=p.set("type",o)),c!=null&&(p=p.set("status",c)),u!=null&&(p=p.set("sub",u)),d!=null&&(p=p.set("product_id",d)),m!=null&&(p=p.set("billing_plan_id",m));let W=this.defaultHeaders,O=["application/json"],z=this.configuration.selectHeaderAccept(O);z!=null&&(W=W.set("Accept",z));let le=[];return this.httpClient.request("get",`${this.basePath}/reports`,{params:p,withCredentials:this.configuration.withCredentials,headers:W,observe:b,reportProgress:w})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Ft=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}subscriptionspriceindexget(e,t,r,n="body",s=!1){if(e==null)throw new Error("Required parameter country was null or undefined when calling subscriptionspriceindexget.");if(t==null)throw new Error("Required parameter product_id was null or undefined when calling subscriptionspriceindexget.");if(r==null)throw new Error("Required parameter billing_plan_id was null or undefined when calling subscriptionspriceindexget.");let o=new F({encoder:new U});e!=null&&(o=o.set("country",e)),t!=null&&(o=o.set("product_id",t)),r!=null&&(o=o.set("billing_plan_id",r));let c=this.defaultHeaders,u=["application/json"],d=this.configuration.selectHeaderAccept(u);d!=null&&(c=c.set("Accept",d));let m=[];return this.httpClient.request("get",`${this.basePath}/subscriptions/price`,{params:o,withCredentials:this.configuration.withCredentials,headers:c,observe:n,reportProgress:s})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Ht=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}subscriptionspriceexpectedget(e,t="body",r=!1){if(e==null)throw new Error("Required parameter subscription_id was null or undefined when calling subscriptionspriceexpectedget.");let n=new F({encoder:new U});e!=null&&(n=n.set("subscription_id",e));let s=this.defaultHeaders,o=["application/json"],c=this.configuration.selectHeaderAccept(o);c!=null&&(s=s.set("Accept",c));let u=[];return this.httpClient.request("get",`${this.basePath}/subscriptions/price/expected`,{params:n,withCredentials:this.configuration.withCredentials,headers:s,observe:t,reportProgress:r})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var _t=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}wellKnownnavigraphaboutget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/well-known/navigraph/about`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var Ut=(()=>{class i{constructor(e,t,r){this.httpClient=e,this.basePath="https://subscriptions.api.navigraph.com",this.defaultHeaders=new C,this.configuration=new v,t&&(this.basePath=t),r&&(this.configuration=r,this.basePath=t||r.basePath||this.basePath)}canConsumeForm(e){let t="multipart/form-data";for(let r of e)if(t===r)return!0;return!1}wellKnownnavigraphopenapiget(e="body",t=!1){let r=this.defaultHeaders,n=["application/json"],s=this.configuration.selectHeaderAccept(n);s!=null&&(r=r.set("Accept",s));let o=[];return this.httpClient.request("get",`${this.basePath}/well-known/navigraph/openapi`,{withCredentials:this.configuration.withCredentials,headers:r,observe:e,reportProgress:t})}static{this.\u0275fac=function(t){return new(t||i)(f(A),f(D,8),f(v,8))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac})}}return i})();var ka=(()=>{class i{static forRoot(e){return{ngModule:i,providers:[{provide:v,useFactory:e}]}}constructor(e,t){if(e)throw new Error("ApiModule is already loaded. Import in your base AppModule only.");if(!t)throw new Error(`You need to import the HttpClientModule in your AppModule! See also https://github.com/angular/angular/issues/20575`)}static{this.\u0275fac=function(t){return new(t||i)(f(i,12),f(A,8))}}static{this.\u0275mod=he({type:i})}static{this.\u0275inj=de({providers:[Ct,At,Et,kt,Rt,Pt,Dt,je,Tt,It,Ft,Ht,_t,Ut]})}}return i})();var mn=(function(i){return i.IntervalEnum={Monthly:"monthly",Yearly:"yearly",Daily:"daily",Bidaily:"bidaily",None:"none"},i.IntervalUnitEnum={Month:"month",Year:"year",Day:"day",Biday:"biday",Empty:""},i})(mn||{});var Qe=(()=>{class i{constructor(e,t,r,n){this.http=e,this.storage=t,this.router=r,this.productsService=n,this.isKioskSubject$=new te(!1),this.isKiosk$=this.isKioskSubject$.asObservable(),this.isTransparentSubject$=new te(!1),this.isTransparent$=this.isTransparentSubject$.asObservable(),this.slug$=new te(""),this.slug=this.slug$.asObservable(),this.show_spinner=!1,this.show_overlay=!1,this.show_subscription=!1,this.show_login=!1,this.show_success=!1,this.loggedin=!1,this.subscription_button_text="Get Started",this.api_endpoint="/assets/data/",this.spinner_h1="",this.spinner_text="",this.user_email="",this.htmlResponse="",this.is_admin=!1,this.cookieConsentSeen=!1,this.cookieSettings=!1,this.cookieConsentLevel=0,this.currentUrl=this.router.url,r.events.subscribe(s=>{s instanceof yr&&(this.previousUrl=this.currentUrl,this.currentUrl=s.url)})}getKioskMode(){return this.isKioskSubject$.asObservable()}setKioskMode(e){this.isKioskSubject$.next(e)}getTransparentkMode(){return this.isTransparentSubject$.asObservable()}setTransparentkMode(e){this.isTransparentSubject$.next(e)}setSlug(e){this.slug$.next(e)}getSlug(){return this.slug$.asObservable()}spinner(e,t){this.show_spinner=!0,this.spinner_h1=e,this.spinner_text=t,this.show_overlay=!0}hide_spinner(){this.show_spinner=!1,this.spinner_h1="",this.spinner_text="",this.show_overlay=!1}getCurrentLocation(){return Q(this,null,function*(){let e=this.getStoredLocation();if(!e)try{e=yield this.lookupLocation().toPromise(),e?.country_code?this.saveLocation(e):e=void 0}catch(t){j.log_to_console&&console.log({error:t})}return e})}lookupLocation(){return this.http.get("https://api.ipstack.com/check?access_key=a37edef70f4afd9d3faee490fa9bc1b4")}saveLocation(e){this.storage.set("location",JSON.stringify(e)),this.storage.set("location_timestamp",new Date().getTime().toString())}getStoredLocation(){let e=new Date,t=this.storage.get("location_timestamp");if(t!==void 0){let r=new Date(parseInt(t));if(r!==void 0)if(e.getTime(){let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t}))}function yn(i){let l=i.replace(/-/g,"+").replace(/_/g,"/");switch(l.length%4){case 0:break;case 2:l+="==";break;case 3:l+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return wn(l)}catch(e){return atob(l)}}function Kr(i,l){if(typeof i!="string")throw new me("Invalid token specified: must be a string");l||(l={});let e=l.header===!0?0:1,t=i.split(".")[e];if(typeof t!="string")throw new me(`Invalid token specified: missing part #${e+1}`);let r;try{r=yn(t)}catch(n){throw new me(`Invalid token specified: invalid base64 for part #${e+1} (${n.message})`)}try{return JSON.parse(r)}catch(n){throw new me(`Invalid token specified: invalid json for part #${e+1} (${n.message})`)}}var zr=new ie("Window",{providedIn:"root",factory(){return window}});var Br=(()=>{class i{constructor(){this.window=a(zr),this.channel=new BroadcastChannel("tabs-web-app-sync"),this.channel.onmessage=({data:e})=>{this.onMessage(e)}}postMessage(e){this.channel.postMessage(e)}onMessage(e){e==="login"?this.window.location.reload():e==="logout"&&(this.window.location.href="proxy.php?url=https%3A%2F%2Fnavigraph.com%2F")}ngOnDestroy(){this.channel.close()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Ze=(()=>{class i{constructor(){this.oidcSecurityService=a(Vr),this.telemetryService=a(oe),this.storageService=a(ee),this.broadcastService=a(Br),this.globals=a(Qe),this.sanitizer=a(Ce),this.userDeferred=Promise.withResolvers(),this.authStatus=ne("initializing"),this.userSub=se(()=>this.user()?.sub),this.isAdmin=se(()=>this.user()?.roles.includes("admin")),this.isAuthenticated=se(()=>this.authStatus()==="authenticated"),this.isUnAuthenticated=se(()=>this.authStatus()==="unauthenticated"),this.isLoading=se(()=>this.authStatus()==="initializing"),this.user=ne(null)}userAsync(){return Q(this,null,function*(){return this.userDeferred.promise})}initializeSession(){return this.oidcSecurityService.preloadAuthWellKnownDocument().subscribe(()=>{y.consoleLog("OIDC well-known document preloaded")}),this.oidcSecurityService.checkAuth().pipe(L(e=>{let{accessToken:t,userData:r}=e;if(t){let n=this.mapUser(r,t);this.createSession(n)}else this.createSession(null)}),x(e=>(this.createSession(null),this.telemetryService.submit("UserSessionService.OidcSecurityService.checkAuthError",e.message,JSON.stringify(e)),y.consoleLog("Auth Error: ",e),S(()=>e))))}getAccessToken(){return this.oidcSecurityService.getAccessToken()}login(e,t){if(e&&this.storageService.useSessionStorage("set","redirectUrl",e),t){this.oidcSecurityService.authorize(void 0,{customParams:E({},t)});return}this.oidcSecurityService.authorize()}autoLogin(e,t,r){return Q(this,null,function*(){this.storageService.useSessionStorage("set","redirectUrl",r);let n=yield qt(this.oidcSecurityService.getAuthorizeUrl());this.globals.htmlResponse=this.sanitizer.bypassSecurityTrustHtml(`
`),setTimeout(()=>{window.document.getElementById("redirect")?.getElementsByTagName("form")[0].submit()},2e3)})}logout(){return this.oidcSecurityService.logoff().subscribe(()=>{y.consoleLog("user has been logged out")})}refreshToken(){return we(navigator.locks.request("website_token_refresh_lock",()=>Q(this,null,function*(){return yield Lt(this.oidcSecurityService.forceRefreshSession().pipe(re({count:2,delay:(e,t)=>(this.telemetryService.submit("OidcAuthorizationCodeFlowService.forceRefreshSessionRetry",`Retry count: ${t}, error: ${e.message}, user Id: ${this.user()?.sub}`,JSON.stringify(e)),be(2e3))})))}))).pipe(H(e=>Q(this,null,function*(){return yield e})),L(e=>{y.consoleLog("UserSessionService: refreshSession - session refreshed",e),e.isAuthenticated&&this.createSession(this.mapUser(e.userData,e.accessToken))}))}resetSession(){this.broadcastService.postMessage("logout")}createSession(e){e?(this.userDeferred.resolve(e),this.user.set(e),this.authStatus.set("authenticated")):(this.userDeferred.resolve(null),this.user.set(null),this.authStatus.set("unauthenticated"))}mapUser(e,t){let r=[],{role:n}=Kr(t);return Array.isArray(n)?r=n:typeof n=="string"&&(r=[n]),{email:e.email,givenName:e.given_name,familyName:e.family_name,roles:r,sub:e.sub,username:e.preferred_username,country:e.address?.country}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ve=(function(i){return i[i.State=0]="State",i[i.Transition=1]="Transition",i[i.Sequence=2]="Sequence",i[i.Group=3]="Group",i[i.Animate=4]="Animate",i[i.Keyframes=5]="Keyframes",i[i.Style=6]="Style",i[i.Trigger=7]="Trigger",i[i.Reference=8]="Reference",i[i.AnimateChild=9]="AnimateChild",i[i.AnimateRef=10]="AnimateRef",i[i.Query=11]="Query",i[i.Stagger=12]="Stagger",i})(ve||{}),bn="*";function jt(i,l){return{type:ve.Trigger,name:i,definitions:l,options:{}}}function Ot(i,l=null){return{type:ve.Animate,styles:l,timings:i}}function bl(i,l=null){return{type:ve.Sequence,steps:i,options:l}}function Xe(i){return{type:ve.Style,styles:i,offset:null}}function Wt(i,l,e=null){return{type:ve.Transition,expr:i,animation:l,options:e}}var xt=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(l=0,e=0){this.totalTime=l+e}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(l=>l()),this._onDoneFns=[])}onStart(l){this._originalOnStartFns.push(l),this._onStartFns.push(l)}onDone(l){this._originalOnDoneFns.push(l),this._onDoneFns.push(l)}onDestroy(l){this._onDestroyFns.push(l)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(l=>l()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(l=>l()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(l){this._position=this.totalTime?l*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(l){let e=l=="start"?this._onStartFns:this._onDoneFns;e.forEach(t=>t()),e.length=0}},Mt=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(l){this.players=l;let e=0,t=0,r=0,n=this.players.length;n==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(s=>{s.onDone(()=>{++e==n&&this._onFinish()}),s.onDestroy(()=>{++t==n&&this._onDestroy()}),s.onStart(()=>{++r==n&&this._onStart()})}),this.totalTime=this.players.reduce((s,o)=>Math.max(s,o.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(l=>l()),this._onDoneFns=[])}init(){this.players.forEach(l=>l.init())}onStart(l){this._onStartFns.push(l)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(l=>l()),this._onStartFns=[])}onDone(l){this._onDoneFns.push(l)}onDestroy(l){this._onDestroyFns.push(l)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(l=>l.play())}pause(){this.players.forEach(l=>l.pause())}restart(){this.players.forEach(l=>l.restart())}finish(){this._onFinish(),this.players.forEach(l=>l.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(l=>l.destroy()),this._onDestroyFns.forEach(l=>l()),this._onDestroyFns=[])}reset(){this.players.forEach(l=>l.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(l){let e=l*this.totalTime;this.players.forEach(t=>{let r=t.totalTime?Math.min(1,e/t.totalTime):1;t.setPosition(r)})}getPosition(){let l=this.players.reduce((e,t)=>e===null||t.totalTime>e.totalTime?t:e,null);return l!=null?l.getPosition():0}beforeDestroy(){this.players.forEach(l=>{l.beforeDestroy&&l.beforeDestroy()})}triggerCallback(l){let e=l=="start"?this._onStartFns:this._onDoneFns;e.forEach(t=>t()),e.length=0}},kn="!";var In=["blink"];function Cn(i,l){i&1&&N(0,"img",3,0)}function An(i,l){if(i&1){let e=at();$(0,"div")(1,"picture",2),$e(2,Cn,2,0,"img",3),N(3,"source",4)(4,"img",5),V(),Qt(),$(5,"svg",6),ct("click",function(){tt(e);let r=pe();return rt(r.loadYoutube())}),$(6,"g",7),N(7,"circle",8),$(8,"g",9),N(9,"path",10),V(),N(10,"path",11),$(11,"g",12),N(12,"path",13),V()(),$(13,"defs")(14,"filter",14),N(15,"feFlood",15)(16,"feColorMatrix",16)(17,"feOffset")(18,"feGaussianBlur",17)(19,"feColorMatrix",18)(20,"feBlend",19)(21,"feBlend",20),V(),$(22,"filter",21),N(23,"feFlood",15)(24,"feBlend",22)(25,"feGaussianBlur",23),V(),$(26,"filter",24),N(27,"feFlood",15)(28,"feBlend",22)(29,"feGaussianBlur",23),V(),$(30,"linearGradient",25),N(31,"stop",26)(32,"stop",27),V(),$(33,"linearGradient",28),N(34,"stop")(35,"stop",29),V(),$(36,"linearGradient",30),N(37,"stop",31)(38,"stop",32),V(),$(39,"linearGradient",33),N(40,"stop",31)(41,"stop",34),V()()()()}if(i&2){let e=pe();Ie("@fadeOut",void 0),Fe(2),Ne(e.isBlink?2:-1),Fe(),Ie("srcset",lr("https://img.youtube.com/vi/",e.videoId,"/sddefault.jpg")),Fe(),Ie("src",ur("https://img.youtube.com/vi/",e.videoId,"/",e.thumbNailQuality,".jpg"),tr)("alt",Le(e.title))}}function En(i,l){if(i&1){let e=at();$(0,"div")(1,"p")(2,"a",37),Ue(3,"Watch our video on YouTube."),V()(),$(4,"p"),Ue(5," (Your cookie consent settings does not permit embedding of third party services. You can "),$(6,"a",38),ct("click",function(){tt(e);let r=pe(2);return rt(r.globals.cookieSettings=!0)}),Ue(7,"change your settings"),V(),Ue(8," at any time.) "),V()()}}function Rn(i,l){if(i&1&&N(0,"iframe",36),i&2){let e=pe(2);Ie("title",Le(e.title))("src",e.link,ot)}}function Pn(i,l){if(i&1&&N(0,"iframe",36),i&2){let e=pe(2);Ie("title",Le(e.title))("src",e.link,ot)}}function Dn(i,l){if(i&1&&($(0,"div",35),$e(1,En,9,0,"div")(2,Rn,1,3,"iframe",36),V(),nr(3,Pn,1,3,"ng-template",null,1,dr)),i&2){let e=pe();Fe(),Ne(e.globals.cookieConsentLevel<2?1:2)}}var Tn=Wt(":leave",[Xe({opacity:1}),Ot("2s ease-out"),Xe({opacity:0})]),Fn=jt("fadeOut",[Tn]),Jr=(function(i){return i.HD="hqdefault",i.SD="sddefault",i.Max="maxresdefault",i})(Jr||{}),Ul=(()=>{class i{constructor(e,t){this.sanitizer=e,this.globals=t,this.thumbNailQuality=Jr.SD,this.isBlink=!1,this.consent=!1,this.show=!1}ngOnInit(){this.isBlink=this.videoId==="yq01tPexUOM",this.isBlink&&setTimeout(()=>{this.blink.nativeElement.classList.add("close"),setTimeout(()=>{this.blink.nativeElement.classList.remove("close")},150)},1e4)}loadYoutube(){this.link=this.sanitizer.bypassSecurityTrustResourceUrl(`https://www.youtube.com/embed/${this.videoId}?autoplay=1&mute=1&cc_load_policy=1`),this.show=!0}static{this.\u0275fac=function(t){return new(t||i)(He(Ce),He(Qe))}}static{this.\u0275cmp=_e({type:i,selectors:[["app-youtube-lazyload"]],viewQuery:function(t,r){if(t&1&&or(In,5),t&2){let n;ar(n=cr())&&(r.blink=n.first)}},inputs:{videoId:"videoId",title:"title",thumbNailQuality:"thumbNailQuality"},standalone:!1,decls:2,vars:1,consts:[["blink",""],["consent",""],[1,"overlay-wrap"],["src","/assets/images/front-page/eye.png",1,"blink"],["media","(max-width: 799px)",3,"srcset"],[3,"src","alt"],["xmlns","http://www.w3.org/2000/svg","width","104","height","104","viewBox","0 0 104 104","fill","none",3,"click"],["filter","url(#filter0_d_4657_32183)"],["cx","52","cy","52","r","30","fill","url(#paint0_linear_4657_32183)","fill-opacity","0.9"],["opacity","0.18","filter","url(#filter1_f_4657_32183)",2,"mix-blend-mode","overlay"],["d","M29 68.8005C29 63.0292 40.7628 71.6505 51.7629 71.6505C62.7631 71.6505 75 62.0793 75 67.8505C75 73.6218 62.7631 81 51.7629 81C40.7628 81 29 74.5718 29 68.8005Z","fill","url(#paint1_linear_4657_32183)"],["d","M63.0909 50.4629C64.303 51.1461 64.303 52.8539 63.0909 53.5371L46.7273 62.7596C45.5152 63.4427 44 62.5888 44 61.2225L44 42.7775C44 41.4112 45.5152 40.5573 46.7273 41.2404L63.0909 50.4629Z","fill","url(#paint2_linear_4657_32183)"],["opacity","0.25","filter","url(#filter2_f_4657_32183)",2,"mix-blend-mode","overlay"],["d","M79.5 44.5C79.5 51.1796 64.3658 42.5 52.2737 42.5C40.1816 42.5 24 52.1796 24 45.5C24 38.8204 35 23 52.2737 23C67.5 23 79.5 37.8204 79.5 44.5Z","fill","url(#paint3_linear_4657_32183)"],["id","filter0_d_4657_32183","x","0","y","0","width","104","height","104","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["flood-opacity","0","result","BackgroundImageFix"],["in","SourceAlpha","type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0","result","hardAlpha"],["stdDeviation","11"],["type","matrix","values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"],["mode","normal","in2","BackgroundImageFix","result","effect1_dropShadow_4657_32183"],["mode","normal","in","SourceGraphic","in2","effect1_dropShadow_4657_32183","result","shape"],["id","filter1_f_4657_32183","x","22","y","59","width","60","height","29","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["mode","normal","in","SourceGraphic","in2","BackgroundImageFix","result","shape"],["stdDeviation","3.5","result","effect1_foregroundBlur_4657_32183"],["id","filter2_f_4657_32183","x","17","y","16","width","69.5","height","38.8503","filterUnits","userSpaceOnUse","color-interpolation-filters","sRGB"],["id","paint0_linear_4657_32183","x1","57","y1","91.5","x2","56.5","y2","13.5","gradientUnits","userSpaceOnUse"],["stop-color","#0A2A54"],["offset","0.991152","stop-color","#0A2A54"],["id","paint1_linear_4657_32183","x1","49.866","y1","80.4775","x2","50.1416","y2","56.4461","gradientUnits","userSpaceOnUse"],["offset","0.991152","stop-opacity","0"],["id","paint2_linear_4657_32183","x1","51","y1","36.5","x2","70","y2","204","gradientUnits","userSpaceOnUse"],["stop-color","white"],["offset","1","stop-color","white","stop-opacity","0"],["id","paint3_linear_4657_32183","x1","54.3589","y1","23.6047","x2","54.0231","y2","51.4181","gradientUnits","userSpaceOnUse"],["offset","0.991152","stop-color","white","stop-opacity","0.1"],[1,"noConsent"],["frameborder","0","allow","autoplay, accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture","allowfullscreen","",3,"src","title"],["href","https://www.youtube.com/watch?v=yq01tPexUOM"],[3,"click"]],template:function(t,r){t&1&&$e(0,An,42,9,"div")(1,Dn,5,1),t&2&&Ne(r.show?1:0)},styles:[".overlay-wrap[_ngcontent-%COMP%]{display:flex;justify-content:center;overflow:hidden;padding:0;margin:0}img[_ngcontent-%COMP%]{width:100%;object-fit:cover}.overlay-wrap[_ngcontent-%COMP%], svg[_ngcontent-%COMP%]{position:absolute;width:100%;top:0;bottom:0;margin:auto}.overlay-wrap[_ngcontent-%COMP%]:hover svg[_ngcontent-%COMP%]{transform:scale(1.2)}iframe[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%}.blink[_ngcontent-%COMP%]{position:absolute;top:0;left:0;display:none}.blink.close[_ngcontent-%COMP%]{display:flex}"],data:{animation:[Fn]}})}}return i})();var jl=(()=>{class i{static{this.COOKIE_NAME="segment"}static{this.N_SEGMENTS=100}static{this.DEFAULT_SEGMENT="0"}constructor(e){this.storageService=e}generateSegment(e){let t=this.storageService.getCookie(i.COOKIE_NAME);!e&&t&&(e=t),e||(e=Math.floor(Math.random()*i.N_SEGMENTS).toString());let r=new URL(j.siteurl).hostname,n=r==="localhost"?"localhost":`.${r}`;this.storageService.getConsent()>0&&this.storageService.setCookie({name:i.COOKIE_NAME,value:e,expireDays:30,path:"/",domain:n,sameSite:"Strict"})}getSegment(){let e=this.storageService.getCookie(i.COOKIE_NAME);return e||(this.generateSegment(),e=this.storageService.getCookie(i.COOKIE_NAME)),e??i.DEFAULT_SEGMENT}setSegment(e){e=e.toString(),this.generateSegment(e)}static{this.\u0275fac=function(t){return new(t||i)(f(ee))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Wl=(()=>{class i{constructor(e){this.sanitizer=e}transform(e){return this.sanitizer.bypassSecurityTrustHtml(e)}static{this.\u0275fac=function(t){return new(t||i)(He(Ce,16))}}static{this.\u0275pipe=ir({name:"safeHTML",type:i,pure:!0,standalone:!1})}}return i})();var Nl=(()=>{class i{constructor(e,t){this.title=e,this.meta=t}setMetaTags(e){e&&(e.title&&this.title.setTitle(e.title),e.keywords&&this.meta.updateTag({name:"keywords",content:e.keywords}),e.description&&this.meta.updateTag({name:"description",content:e.description}),e.title&&this.meta.updateTag({property:"og:title",content:e.title}),e.description&&this.meta.updateTag({property:"og:description",content:e.description}),e.featured_image?.all_sizes?.large?.src?this.meta.updateTag({property:"og:image",content:e.featured_image.all_sizes.large.src}):e.featured_media?.sizes?.large?.url&&this.meta.updateTag({property:"og:image",content:e.featured_media.sizes.large.url}),e.locale&&this.meta.updateTag({property:"og:locale",content:e.locale}),e.type&&this.meta.updateTag({property:"og:type",content:e.type}),e.url&&this.meta.updateTag({property:"og:url",content:e.url}),e.site_name&&this.meta.updateTag({property:"og:site_name",content:e.site_name}),e.twitter_card&&this.meta.updateTag({property:"twitter:card",content:e.twitter_card}),e.twitter_site&&this.meta.updateTag({property:"twitter:site",content:e.twitter_site}),e.article_modified_time&&this.meta.updateTag({property:"article:modified_time",content:e.article_modified_time}),e.noindex&&this.meta.updateTag({name:"robots",content:e.noindex}),e.noindex||this.meta.removeTag('name="robots"'))}setDefaultMetaTags(){this.title.setTitle("Flight Simulator Software - Real Navigation - Navigraph.com"),this.meta.updateTag({name:"description",content:"Providing the most realistic flight simulation software including aeronautical charts, navigation data and flight planning. "}),this.meta.updateTag({name:"keywords",content:"Aviation charts, IFR charts, VFR charts"}),this.meta.updateTag({property:"og:title",content:"Navigraph - Flight Simulation Charts, Navigation Data and Flight Planning"}),this.meta.updateTag({property:"og:description",content:"Providing Airport Maps, Enroute Charts, and NavData to the Flight Simulation Community since 2003."}),this.meta.updateTag({property:"og:image",content:"assets/images/og_image.png"}),this.meta.updateTag({property:"og:locale",content:"en_US"}),this.meta.updateTag({property:"og:type",content:"website"}),this.meta.updateTag({property:"og:url",content:"https://navigraph.com/"}),this.meta.updateTag({property:"og:site_name",content:"Navigraph"}),this.meta.updateTag({property:"twitter:card",content:"summary_large_image"}),this.meta.updateTag({property:"twitter:site",content:"@navigraph"}),this.meta.updateTag({property:"article:publisher",content:"https://www.facebook.com/Navigraph"}),this.meta.updateTag({property:"article:modified_time",content:""}),this.meta.removeTag('name="robots"')}static{this.\u0275fac=function(t){return new(t||i)(f(wr),f(Sr))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Y=class{appendScriptToHead(l,e){let t=document.createElement("script");t.innerHTML=l,e&&t.setAttribute("src",e),document.head.appendChild(t)}};var Yr=(()=>{class i extends Y{constructor(){super(),this.storage=a(ee),this.telemetry=a(oe),this.userSession=a(Ze),this.trackMap={begin_checkout:"InitiateCheckout",begin_signup:"CompleteRegistration",complete_registration:"CompleteRegistration",cta:"ViewContent",login:"CompleteRegistration",purchase:"Purchase",select_item:"Subscribe",submit_signup:"CompleteRegistration",view_content:"ViewContent",page_view:"PageView",purchase_done:void 0}}init(){if(!j.tracking.facebook_pixel_id){y.consoleLog("\u{1F381} MetaTracker pixel id not found.");return}this.isActive()||(super.appendScriptToHead("","assets/scripts/meta.js"),y.consoleLog("\u{1F381} MetaTracker initialized")),this.isActive()&&(window.fbq("consent","grant"),y.consoleLog("\u{1F381} MetaTracker consent granted"))}isActive(){return window.fbq!==void 0}track(e,t){let r=this.trackMap[e];if(r)if(y.consoleLog("\u{1F381} Submitting tracking Meta event",r,t),r==="Purchase"){window.fbq("track",r,{value:Number(t?.value||0),currency:t?.currency??"EUR"});let n=this.userSession.userSub();n&&(y.consoleLog("\u{1F381} Submitting tracking Meta backend event",r,t),this.telemetry.trackPurchase({eventName:r,userId:n,productId:t?.productId??"",page:t?.page??"",flowId:t?.flowId??"",navigraphSegment:t?.navigraphSegment??"",utm:this.storage.getJson("utm"),fbp:this.storage.getCookie("_fbp"),fbc:this.storage.getCookie("_fbc"),price:Number(t?.value||0)}))}else window.fbq("track",r,t)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Qr=(()=>{class i extends Y{constructor(){super(...arguments),this.trackMap={page_view:void 0,view_content:"ViewContent",purchase:"Purchase",login:void 0,cta:void 0,purchase_done:void 0,begin_checkout:void 0,begin_signup:void 0,submit_signup:void 0,complete_registration:void 0,select_item:void 0}}init(){if(!j.tracking.reddit_id){y.consoleLog("\u{1F381} Reddit pixel id not found.");return}this.isActive()||(super.appendScriptToHead("","assets/scripts/reddit.js"),y.consoleLog("\u{1F381} RedditTracker initialized"))}isActive(){return window.rdt!==void 0}track(e,t){let r=this.trackMap[e];r&&(y.consoleLog("\u{1F381} Submitting tracking Reddit event",r,t),r==="Purchase"?window.rdt("track",r,{value:Number(t?.value??0),currency:t?.currency??"EUR"}):window.rdt("track",r))}static{this.\u0275fac=(()=>{let e;return function(r){return(e||(e=ke(i)))(r||i)}})()}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Zr=(()=>{class i extends Y{constructor(){super(...arguments),this.trackMap={login:"login",cta:"cta",view_content:"view_content",purchase:"purchase",purchase_done:"purchase_done",begin_checkout:"begin_checkout",begin_signup:"begin_signup",submit_signup:"submit_signup",complete_registration:"complete_registration",select_item:"select_item",page_view:void 0},this.gtagId=j.tracking.gtag}init(){if(!this.gtagId){y.consoleLog("\u{1F381} Google tag id not found.");return}this.isActive()||(super.appendScriptToHead("",`https://www.googletagmanager.com/gtag/js?id=${this.gtagId}`),super.appendScriptToHead("","assets/scripts/google.js"),y.consoleLog("\u{1F381} Google tracker initialized")),this.isActive()&&(window.gtag("consent","update",{ad_storage:"granted",ad_user_data:"granted",ad_personalization:"granted",analytics_storage:"granted"}),y.consoleLog("\u{1F381} Google tracker consent granted"))}isActive(){return window.gtag!==void 0}track(e,t){let r=this.trackMap[e];r&&(y.consoleLog("\u{1F381} Submitting tracking Google event",r,t),window.gtag("event",r,Se(E({},t),{send_to:this.gtagId})))}static{this.\u0275fac=(()=>{let e;return function(r){return(e||(e=ke(i)))(r||i)}})()}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Xr=(()=>{class i extends Y{constructor(){super(...arguments),this.trackMap={purchase:"purchase",page_view:void 0,view_content:void 0,login:void 0,cta:void 0,purchase_done:void 0,begin_checkout:void 0,begin_signup:void 0,submit_signup:void 0,complete_registration:void 0,select_item:void 0}}init(){if(!j.tracking.uetq){y.consoleLog("\u{1F381} Microsoft tracking id not found.");return}this.isActive()||(super.appendScriptToHead("","assets/scripts/microsoft.js"),y.consoleLog("\u{1F381} MicrosoftTracker initialized"))}isActive(){return window.uetq!==void 0}track(e,t){let r=this.trackMap[e];r&&(y.consoleLog("\u{1F381} Submitting tracking Microsoft event",r,t),window.uetq.push("event",r,{ecomm_pagetype:"purchase",ecomm_totalvalue:t?.value??0,revenue_value:t?.value??0,currency:t?.currency??"EUR"}))}static{this.\u0275fac=(()=>{let e;return function(r){return(e||(e=ke(i)))(r||i)}})()}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ei=(()=>{class i extends Y{constructor(){super(),this.userSessionService=a(Ze),this.trackMap={page_view:"Pageview",purchase:"CompletePayment",view_content:void 0,login:void 0,cta:void 0,purchase_done:void 0,begin_checkout:void 0,begin_signup:void 0,submit_signup:void 0,complete_registration:void 0,select_item:void 0}}init(){if(!j.tracking.tiktok_id){y.consoleLog("\u{1F381} Tiktok tracking id not found.");return}this.isActive()||(super.appendScriptToHead("","assets/scripts/tiktok.js"),y.consoleLog("\u{1F381} Tiktok initialized"))}isActive(){return window.ttq!==void 0}track(e,t){return Q(this,null,function*(){let r=this.trackMap[e];if(!r)return;let n;if(r==="Pageview"){y.consoleLog("\u{1F381} Submitting tracking Tiktok event",r),window.ttq.page();return}else if(r==="CompletePayment"){let s=yield this.userSessionService.userAsync();s?.email&&(y.consoleLog("\u{1F381} Submitting tracking Tiktok identify"),window.ttq.identify({email:s.email})),n={contents:[{content_id:t.productId,content_type:"product",content_name:t.productName}],value:t.value,currency:"EUR"}}y.consoleLog("\u{1F381} Submitting tracking Tiktok event",r,n),window.ttq.track(r,n)})}digestMessage(e){return Q(this,null,function*(){let r=new TextEncoder().encode(e),n=yield crypto.subtle.digest("SHA-256",r);return this.buf2hex(n)})}buf2hex(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ti=(()=>{class i extends Y{constructor(e){super(),this.telemetryService=e,this.trackMap={login:void 0,cta:void 0,view_content:void 0,purchase:void 0,purchase_done:"purchase_done",begin_checkout:"begin_checkout",begin_signup:void 0,submit_signup:void 0,complete_registration:void 0,select_item:void 0,page_view:void 0}}init(){y.consoleLog("\u{1F381} Navigraph tracker initialized")}isActive(){return!0}track(e,t){let r=this.trackMap[e];r&&this.telemetryService.submitEvent(r,t).subscribe(n=>{y.consoleLog("\u{1F381} Submit request",n)})}static{this.\u0275fac=function(t){return new(t||i)(f(oe))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Su=(()=>{class i{constructor(e,t,r,n,s,o,c,u){this.storage=e,this.telemetry=t,this.metaTracker=r,this.redditTracker=n,this.googleTracker=s,this.microsoftTracker=o,this.tiktokTracker=c,this.navigraphTracker=u,this.trackers=[this.metaTracker,this.redditTracker,this.googleTracker,this.microsoftTracker,this.tiktokTracker,this.navigraphTracker]}init(){if(!(this.storage.getConsent()>1)){y.consoleLog("\u{1F381} No tracking consent. Tracking initialization disabled.");return}if(!window||!document||!document.head||!document.createElement){y.consoleLog("\u{1F381} DOM is incomplete. Tracking initialization aborted.");return}try{this.trackers.map(t=>t.init())}catch(t){this.telemetry.submit("\u{1F381} TrackingService.init",JSON.stringify({error:t})),y.consoleLog(t)}}track(e,t){return Q(this,null,function*(){y.consoleLog("\u{1F381} Tracking event request",e,t);try{this.trackers.filter(r=>r.isActive()).map(r=>r.track(e,t))}catch(r){this.telemetry.submit("\u{1F381} TrackingService.track",JSON.stringify({error:r,eventName:e,eventData:t})),y.consoleLog({error:r})}})}static{this.\u0275fac=function(t){return new(t||i)(f(ee),f(oe),f(Yr),f(Qr),f(Zr),f(Xr),f(ei),f(ti))}}static{this.\u0275prov=h({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{lt as a,xe as b,Hr as c,js as d,Os as e,Kr as f,ee as g,D as h,kt as i,je as j,It as k,mn as l,gn as m,ka as n,Qe as o,Br as p,Ze as q,Su as r,ve as s,bn as t,bl as u,Xe as v,xt as w,Mt as x,kn as y,Jr as z,Ul as A,jl as B,Wl as C,Nl as D,oi as E,Xn as F,es as G,ni as H,Ir as I,cs as J};