diff --git a/demo-app/auth-js/index.html b/demo-app/auth-js/index.html index 8595787..71472c0 100644 --- a/demo-app/auth-js/index.html +++ b/demo-app/auth-js/index.html @@ -25,6 +25,6 @@ } } - + diff --git a/demo-app/auth-js/main.d0d284866fd363c7.js b/demo-app/auth-js/main.842c143fed503457.js similarity index 58% rename from demo-app/auth-js/main.d0d284866fd363c7.js rename to demo-app/auth-js/main.842c143fed503457.js index ff66162..f1ee963 100644 --- a/demo-app/auth-js/main.d0d284866fd363c7.js +++ b/demo-app/auth-js/main.842c143fed503457.js @@ -1 +1 @@ -(self.webpackChunk=self.webpackChunk||[]).push([[792],{6503:(e,t)=>{"use strict";const n=(e=>e.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return n.addPlatform=(e,t)=>{n.platforms.set(e,t)},n.setPlatform=e=>{n.platforms.has(e)&&(n.currentPlatform=n.platforms.get(e))},n})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),s=n.addPlatform,i=n.setPlatform;var r;t.$c=void 0,(r=t.$c||(t.$c={})).Unimplemented="UNIMPLEMENTED",r.Unavailable="UNAVAILABLE";class CapacitorException extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const o=e=>{var n,s,i,r,o;const a=e.CapacitorCustomPlatform||null,c=e.Capacitor||{},l=c.Plugins=c.Plugins||{},d=e.CapacitorPlatforms,u=(null===(n=null==d?void 0:d.currentPlatform)||void 0===n?void 0:n.getPlatform)||(()=>null!==a?a.name:(e=>{var t,n;return(null==e?void 0:e.androidBridge)?"android":(null===(n=null===(t=null==e?void 0:e.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.bridge)?"ios":"web"})(e)),h=(null===(s=null==d?void 0:d.currentPlatform)||void 0===s?void 0:s.isNativePlatform)||(()=>"web"!==u()),p=(null===(i=null==d?void 0:d.currentPlatform)||void 0===i?void 0:i.isPluginAvailable)||(e=>{const t=_.get(e);return!!(null==t?void 0:t.platforms.has(u()))||!!g(e)}),g=(null===(r=null==d?void 0:d.currentPlatform)||void 0===r?void 0:r.getPluginHeader)||(e=>{var t;return null===(t=c.PluginHeaders)||void 0===t?void 0:t.find((t=>t.name===e))}),_=new Map,m=(null===(o=null==d?void 0:d.currentPlatform)||void 0===o?void 0:o.registerPlugin)||((e,n={})=>{const s=_.get(e);if(s)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),s.proxy;const i=u(),r=g(e);let o;const d=s=>{let l;const d=(...d)=>{const u=(async()=>(!o&&i in n?o=o="function"==typeof n[i]?await n[i]():n[i]:null!==a&&!o&&"web"in n&&(o=o="function"==typeof n.web?await n.web():n.web),o))().then((n=>{const o=((n,s)=>{var o,a;if(!r){if(n)return null===(a=n[s])||void 0===a?void 0:a.bind(n);throw new CapacitorException(`"${e}" plugin is not implemented on ${i}`,t.$c.Unimplemented)}{const t=null==r?void 0:r.methods.find((e=>s===e.name));if(t)return"promise"===t.rtype?t=>c.nativePromise(e,s.toString(),t):(t,n)=>c.nativeCallback(e,s.toString(),t,n);if(n)return null===(o=n[s])||void 0===o?void 0:o.bind(n)}})(n,s);if(o){const e=o(...d);return l=null==e?void 0:e.remove,e}throw new CapacitorException(`"${e}.${s}()" is not implemented on ${i}`,t.$c.Unimplemented)}));return"addListener"===s&&(u.remove=async()=>l()),u};return d.toString=()=>`${s.toString()}() { [capacitor code] }`,Object.defineProperty(d,"name",{value:s,writable:!1,configurable:!1}),d},h=d("addListener"),p=d("removeListener"),m=(e,t)=>{const n=h({eventName:e},t),s=async()=>{const s=await n;p({eventName:e,callbackId:s},t)},i=new Promise((e=>n.then((()=>e({remove:s})))));return i.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()},i},f=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return r?m:h;case"removeListener":return p;default:return d(t)}}});return l[e]=f,_.set(e,{name:e,proxy:f,platforms:new Set([...Object.keys(n),...r?[i]:[]])}),f});return c.convertFileSrc||(c.convertFileSrc=e=>e),c.getPlatform=u,c.handleError=t=>e.console.error(t),c.isNativePlatform=h,c.isPluginAvailable=p,c.pluginMethodNoop=(e,t,n)=>Promise.reject(`${n} does not have an implementation of "${t}".`),c.registerPlugin=m,c.Exception=CapacitorException,c.DEBUG=!!c.DEBUG,c.isLoggingEnabled=!!c.isLoggingEnabled,c.platform=c.getPlatform(),c.isNative=c.isNativePlatform(),c},a=(e=>e.Capacitor=o(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),c=a.registerPlugin,l=a.Plugins;class WebPlugin{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const s=async()=>this.removeListener(e,t),i=Promise.resolve({remove:s});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t){const n=this.listeners[e];n&&n.forEach((e=>e(t)))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e="not implemented"){return new a.Exception(e,t.$c.Unimplemented)}unavailable(e="not available"){return new a.Exception(e,t.$c.Unavailable)}async removeListener(e,t){const n=this.listeners[e];if(!n)return;const s=n.indexOf(t);this.listeners[e].splice(s,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const d=c("WebView"),u=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),h=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class CapacitorCookiesPluginWeb extends WebPlugin{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach((e=>{if(e.length<=0)return;let[n,s]=e.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=h(n).trim(),s=h(s).trim(),t[n]=s})),t}async setCookie(e){try{const t=u(e.key),n=u(e.value),s=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),r=null!=e.url&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${n||""}${s}; path=${i}; ${r};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const p=c("CapacitorCookies",{web:()=>new CapacitorCookiesPluginWeb}),g=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),s=((e={})=>{const t=Object.keys(e);return Object.keys(e).map((e=>e.toLocaleLowerCase())).reduce(((n,s,i)=>(n[s]=e[t[i]],n)),{})})(e.headers)["content-type"]||"";if("string"==typeof e.data)n.body=e.data;else if(s.includes("application/x-www-form-urlencoded")){const t=new URLSearchParams;for(const[n,s]of Object.entries(e.data||{}))t.set(n,s);n.body=t.toString()}else if(s.includes("multipart/form-data")||e.data instanceof FormData){const t=new FormData;if(e.data instanceof FormData)e.data.forEach(((e,n)=>{t.append(n,e)}));else for(const n of Object.keys(e.data))t.append(n,e.data[n]);n.body=t;const s=new Headers(n.headers);s.delete("content-type"),n.headers=s}else(s.includes("application/json")||"object"==typeof e.data)&&(n.body=JSON.stringify(e.data));return n};class CapacitorHttpPluginWeb extends WebPlugin{async request(e){const t=g(e,e.webFetchExtra),n=((e,t=!0)=>e?Object.entries(e).reduce(((e,n)=>{const[s,i]=n;let r,o;return Array.isArray(i)?(o="",i.forEach((e=>{r=t?encodeURIComponent(e):e,o+=`${s}=${r}&`})),o.slice(0,-1)):(r=t?encodeURIComponent(i):i,o=`${s}=${r}`),`${e}&${o}`}),"").substr(1):null)(e.params,e.shouldEncodeUrlParams),s=n?`${e.url}?${n}`:e.url,i=await fetch(s,t),r=i.headers.get("content-type")||"";let o,a,{responseType:c="text"}=i.ok?e:{};switch(r.includes("application/json")&&(c="json"),c){case"arraybuffer":case"blob":a=await i.blob(),o=await(async e=>new Promise(((t,n)=>{const s=new FileReader;s.onload=()=>{const e=s.result;t(e.indexOf(",")>=0?e.split(",")[1]:e)},s.onerror=e=>n(e),s.readAsDataURL(e)})))(a);break;case"json":o=await i.json();break;default:o=await i.text()}const l={};return i.headers.forEach(((e,t)=>{l[t]=e})),{data:o,headers:l,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}const _=c("CapacitorHttp",{web:()=>new CapacitorHttpPluginWeb})},8453:(e,t,n)=>{"use strict";var s,i=n(1987),r=n.n(i);class AuthUtils{}s=AuthUtils,AuthUtils.isCordova=()=>!!(window.cordova||window.phonegap||window.PhoneGap),AuthUtils.isCapacitor=()=>{var e;return!(null==(e=window.Capacitor)||!e.isNativePlatform())},AuthUtils.isNativeMobile=()=>s.isCapacitor()||s.isCordova(),AuthUtils.decodeJwt=e=>{try{return e?r()(e):e}catch(t){return console.warn("[@badisi/auth-js] Access token was not decoded as it is not a valid JWT."),e}},AuthUtils.isUrlMatching=(e,t)=>{if(void 0!==t){const n=new URL(e,"http://test"),s=new URL(t,"http://test");if(""!==s.pathname&&"/"!==s.pathname&&!n.pathname.includes(s.pathname))return!1;if("http://test"!==s.origin&&(n.protocol!==s.protocol||n.origin!==s.origin||!`${n.origin}${n.pathname}}`.includes(`${s.origin}${s.pathname}`)))return!1;let i=!0;return s.searchParams.forEach(((e,t)=>{n.searchParams.getAll(t).includes(e)||(i=!1)})),i}return!1},AuthUtils.getBaseUrl=()=>{var e;const t=document.baseURI||(null==(e=document.querySelector("base"))?void 0:e.href)||location.origin;return t.endsWith("/")?t:`${t}/`},AuthUtils.stringToURL=e=>{try{return new URL(e)}catch(t){const n=e.startsWith("/")?e.substring(1,e.length):e;return new URL(`${s.getBaseUrl()}${n}`)}};const o=document.createElement("template");o.innerHTML='\n \n \n \n \n \n';class AppElement extends HTMLElement{constructor(){var e;super(),this.demoAppMainEl=void 0,this.demoAppPlaygroundEl=void 0,this.demoAppDebugEl=void 0,this.authManagerSubs=[],this.listeners=[],this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(o.content,!0))}connectedCallback(){this.demoAppMainEl=this.shadowRoot.querySelector("demo-app-main"),this.demoAppPlaygroundEl=this.shadowRoot.querySelector("demo-app-playground"),this.demoAppDebugEl=this.shadowRoot.querySelector("demo-app-debug"),this.listenForHeaderEvents(),this.listenForPlaygroundEvents(),this.listenForAuthChanges()}disconnectedCallback(){this.authManagerSubs.forEach((e=>e.unsubscribe())),this.listeners.forEach((e=>e()))}async callPrivateApi(e,t){if(window.authManager&&e){var n;const s=null!=(n=await window.authManager.getAccessToken())?n:"",i=new XMLHttpRequest;i.onreadystatechange=()=>{if(4===i.readyState){var e;let s;try{var t;s=JSON.parse(null!=(t=i.responseText)?t:"")}catch(n){s=`${i.status} ${i.statusText}`}null==(e=this.demoAppPlaygroundEl)||e.setApiStatus(s,200!==i.status)}},i.open("GET",e,!0),i.setRequestHeader("Authorization",`Bearer ${s}`),null==t||t.split(";").forEach((e=>{if(e){var t,n;const s=e.split(":");i.setRequestHeader(null==(t=s[0])?void 0:t.trim(),(null==(n=s[1])?void 0:n.trim())||"")}})),i.send()}}refreshInfo(e,t){if(window.authManager&&this.demoAppMainEl&&this.demoAppDebugEl)switch(e){case"renewing":this.demoAppMainEl.isRenewing=t;break;case"authenticated":this.demoAppMainEl.isAuthenticated=t,this.demoAppDebugEl.isAuthenticated=t;break;case"userSession":this.demoAppDebugEl.userSession=t;break;case"accessToken":this.demoAppDebugEl.accessToken=t,this.demoAppDebugEl.accessTokenDecoded=AuthUtils.decodeJwt(t);break;case"idToken":this.demoAppDebugEl.idToken=t,this.demoAppDebugEl.idTokenDecoded=AuthUtils.decodeJwt(t);break;case"userProfile":this.demoAppDebugEl.userProfile=t}}listenForAuthChanges(){const e=window.authManager;e&&this.authManagerSubs.push(e.onRenewingChanged((e=>this.refreshInfo("renewing",e))),e.onAuthenticatedChanged((e=>this.refreshInfo("authenticated",e))),e.onUserSessionChanged((e=>this.refreshInfo("userSession",e))),e.onAccessTokenChanged((e=>this.refreshInfo("accessToken",e))),e.onIdTokenChanged((e=>this.refreshInfo("idToken",e))),e.onUserProfileChanged((e=>this.refreshInfo("userProfile",e))))}listenForPlaygroundEvents(){if(this.demoAppPlaygroundEl){const e=e=>{var t,n;this.callPrivateApi(null==(t=e.detail)?void 0:t.url,null==(n=e.detail)?void 0:n.headers)};this.demoAppPlaygroundEl.addEventListener("api",e),this.listeners.push((()=>{var t;return null==(t=this.demoAppPlaygroundEl)?void 0:t.removeEventListener("api",e)}))}}listenForHeaderEvents(){const e=window.authManager;if(e&&this.demoAppMainEl){const t=()=>{e.login()};this.demoAppMainEl.addEventListener("login",t);const n=()=>{e.logout({redirectUrl:"/"}).then((()=>{var e;const t=document.baseURI||(null==(e=document.querySelector("base"))?void 0:e.href)||location.origin;location.href=t.endsWith("/")?t:`${t}/`}))};this.demoAppMainEl.addEventListener("logout",n);const s=()=>{e.renew()};this.demoAppMainEl.addEventListener("silentRenew",s),this.listeners.push((()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("login",t)}),(()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("logout",n)}),(()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("silentRenew",s)}))}}}customElements.define("app-root",AppElement);const a=function(){this.__data__=[],this.size=0};const c=function(e,t){return e===t||e!=e&&t!=t};const l=function(e,t){for(var n=e.length;n--;)if(c(e[n][0],t))return n;return-1};var d=Array.prototype.splice;const u=function(e){var t=this.__data__,n=l(t,e);return!(n<0)&&(n==t.length-1?t.pop():d.call(t,n,1),--this.size,!0)};const h=function(e){var t=this.__data__,n=l(t,e);return n<0?void 0:t[n][1]};const p=function(e){return l(this.__data__,e)>-1};const g=function(e,t){var n=this.__data__,s=l(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this};function _(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=9007199254740991};const We=function(e){return null!=e&&$e(e.length)&&!O(e)};const De=function(e){return Oe(e)&&We(e)};var Fe=n(2160),Be=Function.prototype,ze=Object.prototype,Je=Be.toString,Ke=ze.hasOwnProperty,Ve=Je.call(Object);const Ge=function(e){if(!Oe(e)||"[object Object]"!=I(e))return!1;var t=Ae(e);if(null===t)return!0;var n=Ke.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Je.call(n)==Ve};var Qe={};Qe["[object Float32Array]"]=Qe["[object Float64Array]"]=Qe["[object Int8Array]"]=Qe["[object Int16Array]"]=Qe["[object Int32Array]"]=Qe["[object Uint8Array]"]=Qe["[object Uint8ClampedArray]"]=Qe["[object Uint16Array]"]=Qe["[object Uint32Array]"]=!0,Qe["[object Arguments]"]=Qe["[object Array]"]=Qe["[object ArrayBuffer]"]=Qe["[object Boolean]"]=Qe["[object DataView]"]=Qe["[object Date]"]=Qe["[object Error]"]=Qe["[object Function]"]=Qe["[object Map]"]=Qe["[object Number]"]=Qe["[object Object]"]=Qe["[object RegExp]"]=Qe["[object Set]"]=Qe["[object String]"]=Qe["[object WeakMap]"]=!1;const Xe=function(e){return Oe(e)&&$e(e.length)&&!!Qe[I(e)]};const Ye=function(e){return function(t){return e(t)}};var Ze=n(2485),et=Ze.A&&Ze.A.isTypedArray;const tt=et?Ye(et):Xe;const nt=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var st=Object.prototype.hasOwnProperty;const it=function(e,t,n){var s=e[t];st.call(e,t)&&c(s,n)&&(void 0!==n||t in e)||ve(e,t,n)};const rt=function(e,t,n,s){var i=!n;n||(n={});for(var r=-1,o=t.length;++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(kt);const Tt=function(e,t){return xt(yt(e,t,wt),e+"")};const Ct=function(e,t,n){if(!P(n))return!1;var s=typeof t;return!!("number"==s?We(n)&&ct(t,n.length):"string"==s&&t in n)&&c(n[t],e)};const Ut=function(e){return Tt((function(t,n){var s=-1,i=n.length,r=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&Ct(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++s{},info:()=>{},warn:()=>{},error:()=>{}},Wt=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Wt||{});(It=Wt||(Wt={})).reset=function(){At=3,Rt=$t},It.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");At=e},It.setLogger=function(e){Rt=e};var Dt=class{constructor(e){this._name=e}debug(...e){At>=4&&Rt.debug(Dt._format(this._name,this._method),...e)}info(...e){At>=3&&Rt.info(Dt._format(this._name,this._method),...e)}warn(...e){At>=2&&Rt.warn(Dt._format(this._name,this._method),...e)}error(...e){At>=1&&Rt.error(Dt._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const n=new Dt(`${e}.${t}`);return n.debug("begin"),n}static _format(e,t){const n=`[${e}]`;return t?`${n} ${t}:`:n}static debug(e,...t){At>=4&&Rt.debug(Dt._format(e),...t)}static info(e,...t){At>=3&&Rt.info(Dt._format(e),...t)}static warn(e,...t){At>=2&&Rt.warn(Dt._format(e),...t)}static error(e,...t){At>=1&&Rt.error(Dt._format(e),...t)}};Wt.reset();var Ft,Bt,zt,Jt=class{static _randomWord(){return Ot().lib.WordArray.random(1).words[0]}static generateUUIDv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^Jt._randomWord()&15>>+e/4).toString(16))).replace(/-/g,"")}static generateCodeVerifier(){return Jt.generateUUIDv4()+Jt.generateUUIDv4()+Jt.generateUUIDv4()}static generateCodeChallenge(e){try{const t=Lt()(e);return Nt().stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){throw Dt.error("CryptoUtils.generateCodeChallenge",t),t}}static generateBasicAuth(e,t){const n=Ht().parse([e,t].join(":"));return Nt().stringify(n)}},Kt=class{constructor(e){this._name=e,this._logger=new Dt(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},Vt=class{static decode(e){try{return r()(e)}catch(t){throw Dt.error("JwtUtils.decode",t),t}}},Gt=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},Qt=class extends Kt{constructor(){super(...arguments),this._logger=new Dt(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-Qt.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=Qt.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const n=Qt.getEpochTime()+e;if(this.expiration===n&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=n;const s=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*s)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Xt=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const n=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(n.slice(1))}},Yt=class extends Error{constructor(e,t){var n,s,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw Dt.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(n=e.error_description)?n:null,this.error_uri=null!=(s=e.error_uri)?s:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null,this.url_state=e.url_state}},Zt=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},en=class{constructor(e){this._logger=new Dt("AccessTokenEvents"),this._expiringTimer=new Qt("Access token expiring"),this._expiredTimer=new Qt("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let e=n-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const s=n+1;t.debug("registering expired timer, raising in",s,"seconds"),this._expiredTimer.init(s)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},tn=class{constructor(e,t,n,s,i){this._callback=e,this._client_id=t,this._intervalInSeconds=s,this._stopOnError=i,this._logger=new Dt("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const r=new URL(n);this._frame_origin=r.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=r.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},nn=class{constructor(){this._logger=new Dt("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},sn=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new Dt("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:n,...s}=t;if(!n)return await fetch(e,s);const i=new AbortController,r=setTimeout((()=>i.abort()),1e3*n);try{return await fetch(e,{...t,signal:i.signal})}catch(o){if(o instanceof DOMException&&"AbortError"===o.name)throw new Zt("Network timed out");throw o}finally{clearTimeout(r)}}async getJson(e,{token:t,credentials:n}={}){const s=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let r;t&&(s.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{s.debug("url:",e),r=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:n})}catch(c){throw s.error("Network Error"),c}s.debug("HTTP response received, status",r.status);const o=r.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&s.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),r.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await r.text());let a;try{a=await r.json()}catch(c){if(s.error("Error parsing JSON response",c),r.ok)throw c;throw new Error(`${r.statusText} (${r.status})`)}if(!r.ok){if(s.error("Error from server:",a),a.error)throw new Yt(a);throw new Error(`${r.statusText} (${r.status}): ${JSON.stringify(a)}`)}return a}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:s,initCredentials:i}){const r=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let a;void 0!==n&&(o.Authorization="Basic "+n),this.appendExtraHeaders(o);try{r.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:s,credentials:i})}catch(u){throw r.error("Network error"),u}r.debug("HTTP response received, status",a.status);const c=a.headers.get("Content-Type");if(c&&!this._contentTypes.find((e=>c.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=c?c:"undefined"}, from URL: ${e}`);const l=await a.text();let d={};if(l)try{d=JSON.parse(l)}catch(u){if(r.error("Error parsing JSON response",u),a.ok)throw u;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(r.error("Error from server:",d),d.error)throw new Yt(d,t);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(d)}`)}return d}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),s=["authorization","accept","content-type"];0!==n.length&&n.forEach((n=>{if(s.includes(n.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",n,s);const i="function"==typeof this._extraHeaders[n]?this._extraHeaders[n]():this._extraHeaders[n];i&&""!==i&&(e[n]=i)}))}},rn=class{constructor(e){this._settings=e,this._logger=new Dt("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new sn(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const n=this._logger.create(`_getMetadataProperty('${e}')`),s=await this.getMetadata();if(n.debug("resolved"),void 0===s[e]){if(!0===t)return void n.warn("Metadata does not contain optional property");n.throw(new Error("Metadata does not contain property "+e))}return s[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const n=await this._jsonService.getJson(t);if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},on=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new Dt("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let n=0;n{const t=this._logger.create("_getClaimsFromJwt");try{const n=Vt.decode(e);return t.debug("JWT decoding successful"),n}catch(n){throw t.error("Error parsing JWT response"),n}},this._jsonService=new sn(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);const s=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",s),s}},ln=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new Dt("TokenClient"),this._jsonService=new sn(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:s=this._settings.client_secret,...i}){const r=this._logger.create("exchangeCode");n||r.throw(new Error("A client_id is required")),t||r.throw(new Error("A redirect_uri is required")),i.code||r.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[d,u]of Object.entries(i))null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!s)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(n,s);break;case"client_secret_post":o.append("client_id",n),s&&o.append("client_secret",s)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:s=this._settings.scope,...i}){const r=this._logger.create("exchangeCredentials");t||r.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:s});for(const[d,u]of Object.entries(i))null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(t,n);break;case"client_secret_post":o.append("client_id",t),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:s,...i}){const r=this._logger.create("exchangeRefreshToken");t||r.throw(new Error("A client_id is required")),i.refresh_token||r.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[d,u]of Object.entries(i))Array.isArray(u)?u.forEach((e=>o.append(d,e))):null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(t,n);break;case"client_secret_post":o.append("client_id",t),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,timeoutInSeconds:s,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async revoke(e){var t;const n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));const s=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[r,o]of Object.entries(e))null!=o&&i.set(r,o);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(s,{body:i}),n.debug("got response")}},dn=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new Dt("ResponseValidator"),this._userInfoService=new cn(this._settings,this._metadataService),this._tokenClient=new ln(this._settings,this._metadataService)}async validateSigninResponse(e,t){const n=this._logger.create("validateSigninResponse");this._processSigninState(e,t),n.debug("state processed"),await this._processCode(e,t),n.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),n.debug("claims processed")}async validateCredentialsResponse(e,t){const n=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),n.debug("claims processed")}async validateRefreshResponse(e,t){const n=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),n.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const s=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,s),n.debug("claims processed")}validateSignoutResponse(e,t){const n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new Yt(e)}_processSigninState(e,t){const n=this._logger.create("_processSigninState");if(t.id!==e.state&&n.throw(new Error("State does not match")),t.client_id||n.throw(new Error("No client_id on state")),t.authority||n.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&n.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&n.throw(new Error("client_id mismatch on settings vs. signin state")),n.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,null!=e.scope||(e.scope=t.scope),e.error)throw n.warn("Response was error",e.error),new Yt(e);t.code_verifier&&!e.code&&n.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){const s=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void s.debug("not loading user info");s.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);s.debug("user info claims received from user info endpoint"),n&&i.sub!==e.profile.sub&&s.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),s.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const n=this._logger.create("_processCode");if(e.code){n.debug("Validating code");const s=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,s)}else n.debug("No code to process")}_validateIdTokenAttributes(e,t){var n;const s=this._logger.create("_validateIdTokenAttributes");s.debug("decoding ID Token JWT");const i=Vt.decode(null!=(n=e.id_token)?n:"");if(i.sub||s.throw(new Error("ID Token is missing a subject claim")),t){const e=Vt.decode(t);i.sub!==e.sub&&s.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&s.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&s.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&s.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}},un=class{constructor(e){this.id=e.id||Jt.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=Qt.getEpochTime(),this.request_type=e.request_type,this.url_state=e.url_state}toStorageString(){return new Dt("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(e){return Dt.createStatic("State","fromStorageString"),new un(JSON.parse(e))}static async clearStaleState(e,t){const n=Dt.createStatic("State","clearStaleState"),s=Qt.getEpochTime()-t,i=await e.getAllKeys();n.debug("got keys",i);for(let o=0;ow.searchParams.append("resource",e)))}for(const[b,y]of Object.entries({response_mode:a,...f,...g}))null!=y&&w.searchParams.append(b,y.toString());this.url=w.href}},gn=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const e=decodeURIComponent(this.state).split(";");this.state=e[0],e.length>1&&(this.url_state=e.slice(1).join(";"))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Qt.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+Qt.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},_n=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:s,extraQueryParams:i,request_type:r,client_id:o}){if(this._logger=new Dt("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const a=new URL(e);n&&a.searchParams.append("id_token_hint",n),o&&a.searchParams.append("client_id",o),s&&(a.searchParams.append("post_logout_redirect_uri",s),t&&(this.state=new un({data:t,request_type:r}),a.searchParams.append("state",this.state.id)));for(const[c,l]of Object.entries({...i}))null!=l&&a.searchParams.append(c,l.toString());this.url=a.href}},mn=class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},fn=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],wn=["sub","iss","aud","exp","iat"],vn=class{constructor(e){this._settings=e,this._logger=new Dt("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:fn;for(const n of e)wn.includes(n)||delete t[n]}return t}mergeClaims(e,t){const n={...e};for(const[s,i]of Object.entries(t))for(const e of Array.isArray(i)?i:[i]){const t=n[s];void 0===t?n[s]=e:Array.isArray(t)?t.includes(e)||t.push(e):n[s]!==e&&("object"==typeof e&&this._settings.mergeClaims?n[s]=this.mergeClaims(t,e):n[s]=[t,e])}return n}},bn=class{constructor(e,t){this._logger=new Dt("OidcClient"),this.settings=e instanceof an?e:new an(e),this.metadataService=null!=t?t:new rn(this.settings),this._claimsService=new vn(this.settings),this._validator=new dn(this.settings,this.metadataService,this._claimsService),this._tokenClient=new ln(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:s,id_token_hint:i,login_hint:r,skipUserInfo:o,nonce:a,url_state:c,response_type:l=this.settings.response_type,scope:d=this.settings.scope,redirect_uri:u=this.settings.redirect_uri,prompt:h=this.settings.prompt,display:p=this.settings.display,max_age:g=this.settings.max_age,ui_locales:_=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:f=this.settings.resource,response_mode:w=this.settings.response_mode,extraQueryParams:v=this.settings.extraQueryParams,extraTokenParams:b=this.settings.extraTokenParams}){const y=this._logger.create("createSigninRequest");if("code"!==l)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const S=await this.metadataService.getAuthorizationEndpoint();y.debug("Received authorization endpoint",S);const k=new pn({url:S,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:u,response_type:l,scope:d,state_data:e,url_state:c,prompt:h,display:p,max_age:g,ui_locales:_,id_token_hint:i,login_hint:r,acr_values:m,resource:f,request:t,request_uri:n,extraQueryParams:v,extraTokenParams:b,request_type:s,response_mode:w,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:a,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const E=k.state;return await this.settings.stateStore.set(E.id,E.toStorageString()),k}async readSigninResponseState(e,t=!1){const n=this._logger.create("readSigninResponseState"),s=new gn(Xt.readParams(e,this.settings.response_mode));if(!s.state)throw n.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](s.state);if(!i)throw n.throw(new Error("No matching state found in storage")),null;return{state:hn.fromStorageString(i),response:s}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:n,response:s}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(s,n),s}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:s={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...s}),r=new gn(new URLSearchParams);return Object.assign(r,i),await this._validator.validateCredentialsResponse(r,n),r}async useRefreshToken({state:e,timeoutInSeconds:t}){var n;const s=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(n=e.scope)?void 0:n.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const r=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,resource:e.resource,scope:i,timeoutInSeconds:t}),o=new gn(new URLSearchParams);return Object.assign(o,r),s.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:s,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:r=this.settings.extraQueryParams}={}){const o=this._logger.create("createSignoutRequest"),a=await this.metadataService.getEndSessionEndpoint();if(!a)throw o.throw(new Error("No end session endpoint")),null;o.debug("Received end session endpoint",a),n||!i||t||(n=this.settings.client_id);const c=new _n({url:a,id_token_hint:t,client_id:n,post_logout_redirect_uri:i,state_data:e,extraQueryParams:r,request_type:s});await this.clearStaleState();const l=c.state;return l&&(o.debug("Signout request has state to persist"),await this.settings.stateStore.set(l.id,l.toStorageString())),c}async readSignoutResponseState(e,t=!1){const n=this._logger.create("readSignoutResponseState"),s=new mn(Xt.readParams(e,this.settings.response_mode));if(!s.state){if(n.debug("No state in response"),s.error)throw n.warn("Response was error:",s.error),new Yt(s);return{state:void 0,response:s}}const i=await this.settings.stateStore[t?"remove":"get"](s.state);if(!i)throw n.throw(new Error("No matching state found in storage")),null;return{state:un.fromStorageString(i),response:s}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:n,response:s}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(s,n)):t.debug("No state from storage; skipping response validation"),s}clearStaleState(){return this._logger.create("clearStaleState"),un.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},yn=class{constructor(e){this._userManager=e,this._logger=new Dt("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const n=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,n.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,n.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){n.debug("initializing check session iframe");const s=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,r=this._userManager.settings.stopCheckSessionOnError,o=new tn(this._callback,s,e,i,r);await o.load(),this._checkSessionIFrame=o,o.start(t)}else n.warn("no check session iframe found in the metadata")}catch(s){n.error("Error from getCheckSessionIframe:",s instanceof Error?s.message:s)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(n){e.error("error from querySessionStatus",n instanceof Error?n.message:n)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let n=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(n=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),n?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}},Sn=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState,this.url_state=e.url_state}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Qt.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+Qt.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new Dt("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return Dt.createStatic("User","fromStorageString"),new Sn(JSON.parse(e))}},kn="oidc-client",En=class{constructor(){this._abort=new Kt("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:n,keepOpen:s}=await new Promise(((n,s)=>{const i=i=>{var r;const o=i.data,a=null!=(r=e.scriptOrigin)?r:window.location.origin;if(i.origin===a&&(null==o?void 0:o.source)===kn){try{const n=Xt.readParams(o.url,e.response_mode).get("state");if(n||t.warn("no state found in response url"),i.source!==this._window&&n!==e.state)return}catch(c){this._dispose(),s(new Error("Invalid response from window"))}n(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),s(e)})))}));return t.debug("got response from window"),this._dispose(),s||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,s=window.location.origin){e.postMessage({source:kn,url:t,keepOpen:n},s)}},xn={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Tn="_blank",Cn=60,Un=2,An=10,Rn=class extends an{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:s=xn,popupWindowTarget:i=Tn,redirectMethod:r="assign",redirectTarget:o="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:l=e.redirect_uri,silentRequestTimeoutInSeconds:d=An,automaticSilentRenew:u=!0,validateSubOnSilentRenew:h=!0,includeIdTokenInSilentRenew:p=!1,monitorSession:g=!1,monitorAnonymousSession:_=!1,checkSessionIntervalInSeconds:m=Un,query_status_response_type:f="code",stopCheckSessionOnError:w=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:b=!1,includeIdTokenInSilentSignout:y=!1,accessTokenExpiringNotificationTimeInSeconds:S=Cn,userStore:k}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=s,this.popupWindowTarget=i,this.redirectMethod=r,this.redirectTarget=o,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=c,this.silent_redirect_uri=l,this.silentRequestTimeoutInSeconds=d,this.automaticSilentRenew=u,this.validateSubOnSilentRenew=h,this.includeIdTokenInSilentRenew=p,this.monitorSession=g,this.monitorAnonymousSession=_,this.checkSessionIntervalInSeconds=m,this.stopCheckSessionOnError=w,this.query_status_response_type=f,this.revokeTokenTypes=v,this.revokeTokensOnSignout=b,this.includeIdTokenInSilentSignout=y,this.accessTokenExpiringNotificationTimeInSeconds=S,k)this.userStore=k;else{const e="undefined"!=typeof window?window.sessionStorage:new nn;this.userStore=new on({store:e})}}},In=class extends En{constructor({silentRequestTimeoutInSeconds:e=An}){super(),this._logger=new Dt("IFrameWindow"),this._timeoutInSeconds=e,this._frame=In.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new Zt("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const n=e.target;null==(t=n.parentNode)||t.removeChild(n),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},Pn=class{constructor(e){this._settings=e,this._logger=new Dt("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new In({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),In.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},On=class extends En{constructor({popupWindowTarget:e=Tn,popupWindowFeatures:t={}}){super(),this._logger=new Dt("PopupWindow");const n=Gt.center({...xn,...t});this._window=window.open(void 0,e,Gt.serialize(n)),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout((()=>{this._window&&"boolean"==typeof this._window.closed&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))}),1e3*t.closePopupWindowAfterInSeconds)}async navigate(e){var t;null==(t=this._window)||t.focus();const n=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(n))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},jn=class{constructor(e){this._settings=e,this._logger=new Dt("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new On({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),On.notifyOpener(e,t)}},Ln=class{constructor(e){this._settings=e,this._logger=new Dt("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let s=window.self;"top"===t&&(s=null!=(n=window.top)?n:window.self);const i=s.location[e].bind(s.location);let r;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{r=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==r||r(new Error("Redirect aborted")),s.stop()}}}async callback(){}},Mn=class extends en{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new Dt("UserManagerEvents"),this._userLoaded=new Kt("User loaded"),this._userUnloaded=new Kt("User unloaded"),this._silentRenewError=new Kt("Silent renew error"),this._userSignedIn=new Kt("User signed in"),this._userSignedOut=new Kt("User signed out"),this._userSessionChanged=new Kt("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},Nn=class{constructor(e){this._userManager=e,this._logger=new Dt("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Qt("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof Zt)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},qn=class{constructor(e,t){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.resource=t,this.data=e.state}},Hn=class{constructor(e,t,n,s){this._logger=new Dt("UserManager"),this.settings=new Rn(e),this._client=new bn(e),this._redirectNavigator=null!=t?t:new Ln(this.settings),this._popupNavigator=null!=n?n:new jn(this.settings),this._iframeNavigator=null!=s?s:new Pn(this.settings),this._events=new Mn(this.settings),this._silentRenewService=new Nn(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new yn(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...n}=e,s=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...n},s)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){const s=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});s.debug("got signin response");const r=await this._buildUser(i);return r.profile&&r.profile.sub?s.info("success, signed in subject",r.profile.sub):s.info("no subject"),r}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:n,popupWindowTarget:s,...i}=e,r=this.settings.popup_redirect_uri;r||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:s}),a=await this._signin({request_type:"si:p",redirect_uri:r,display:"popup",...i},o);return a&&(a.profile&&a.profile.sub?t.info("success, signed in subject",a.profile.sub):t.info("no subject")),a}async signinPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t;const n=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:s,resource:i,...r}=e;let o=await this._loadUser();if(null==o?void 0:o.refresh_token){n.debug("using refresh token");const e=new qn(o,i);return await this._useRefreshToken(e)}const a=this.settings.silent_redirect_uri;let c;a||n.throw(new Error("No silent_redirect_uri configured")),o&&this.settings.validateSubOnSilentRenew&&(n.debug("subject prior to silent renew:",o.profile.sub),c=o.profile.sub);const l=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s});return o=await this._signin({request_type:"si:s",redirect_uri:a,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,...r},l,c),o&&((null==(t=o.profile)?void 0:t.sub)?n.info("success, signed in subject",o.profile.sub):n.info("no subject")),o}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),n=new Sn({...e,...t});return await this.storeUser(n),this._events.load(n),n}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...s}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const r=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==r?void 0:r.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...s},o);try{const e=await this._client.processSigninResponse(a.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof Yt)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(e,t,n){const s=await this._signinStart(e,t);return await this._signinEnd(s.url,n)}async _signinStart(e,t){const n=this._logger.create("_signinStart");try{const s=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:s.url,state:s.state.id,response_mode:s.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(s){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),s}}async _signinEnd(e,t){const n=this._logger.create("_signinEnd"),s=await this._client.processSigninResponse(e);n.debug("got signin response");return await this._buildUser(s,t)}async _buildUser(e,t){const n=this._logger.create("_buildUser"),s=new Sn(e);if(t){if(t!==s.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",s.profile.sub),new Yt({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(s),n.debug("user stored"),this._events.load(s),s}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:n,...s}=e,i=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...s},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:s,...i}=e,r=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:s});await this._signout({request_type:"so:p",post_logout_redirect_uri:r,state:null==r?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){const n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;const s=this._logger.create("_signoutStart");try{const i=await this._loadUser();s.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const r=e.id_token_hint||i&&i.id_token;r&&(s.debug("setting id_token_hint in signout request"),e.id_token_hint=r),await this.removeUser(),s.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return s.debug("got signout request"),await t.navigate({url:o.url,state:null==(n=o.state)?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw s.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;const n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:s,...i}=e,r=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:r,...i},a),n.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const n=this._logger.create("_revokeInternal");if(!e)return;const s=t.filter((t=>"string"==typeof e[t]));if(s.length){for(const t of s)await this._client.revokeToken(e[t],t),n.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),n.debug("user stored"),this._events.load(e)}else n.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),Sn.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}};class AuthManager{}class AuthSubscriptions{constructor(){this.subscribers=[],this.lastNotifiedValue=void 0}add(e){return this.subscribers.push(e),this.lastNotifiedValue&&e(...this.lastNotifiedValue),{unsubscribe:()=>this.unsubscribe(e)}}notify(...e){this.lastNotifiedValue=e,this.subscribers.forEach((t=>{t(...e)}))}unsubscribe(e){if(e){const t=this.subscribers.indexOf(e);-1!==t&&this.subscribers.splice(t,1)}else this.subscribers=[]}}const $n=window.localStorage,Wn=null==(Ft=window.Capacitor)||null==(Ft=Ft.Plugins)?void 0:Ft.Storage,Dn=null==(Bt=window.Capacitor)||null==(Bt=Bt.Plugins)?void 0:Bt.Preferences,Fn=null==(zt=window.Capacitor)||null==(zt=zt.Plugins)?void 0:zt.SecureStoragePlugin;class MobileStorage{constructor(){if(this._logger=new Dt("MobileStorage"),!Fn){let e="[@badisi/auth-js] This application is currently using an unsafe storage.\n\n";e+="\u24d8 Please follow the recommended guide and use `capacitor-secure-storage-plugin` instead.",console.warn(e)}Fn?this._logger.debug("Using `capacitor-secure-storage-plugin` implementation"):Dn?this._logger.debug("Using `@capacitor/preferences` implementation"):Wn?this._logger.debug("Using `@capacitor/storage` implementation"):this._logger.debug("Using `localStorage` implementation")}get length(){return async function(){return Fn?(await Fn.keys()).value.length:Dn?(await Dn.keys()).keys.length:Wn?(await Wn.keys()).keys.length:$n.length}()}async key(e){return Fn?(await Fn.keys()).value[e]:Dn?(await Dn.keys()).keys[e]:Wn?(await Wn.keys()).keys[e]:$n.key(e)}async clear(){this._logger.create("clear"),Fn?await Fn.clear():Dn?await Dn.clear():Wn?await Wn.clear():$n.clear()}async getItem(e){if(this._logger.create(`getItem('${e}')`),!Fn)return Dn?(await Dn.get({key:e})).value:Wn?(await Wn.get({key:e})).value:$n.getItem(e);try{return(await Fn.get({key:e})).value}catch(t){return null}}async setItem(e,t){this._logger.create(`setItem('${e}')`),Fn?await Fn.set({key:e,value:t}):Dn?await Dn.set({key:e,value:t}):Wn?await Wn.set({key:e,value:t}):$n.setItem(e,t)}async removeItem(e){this._logger.create(`removeItem('${e}')`),Fn?await Fn.remove({key:e}):Dn?await Dn.remove({key:e}):Wn?await Wn.remove({key:e}):$n.removeItem(e)}}let Bn=function(e){return e.REDIRECT="REDIRECT",e.POPUP="POPUP",e}({});class UserSession{constructor(){this.expired=void 0,this.expires_in=void 0,this.expires_at=void 0}static deserialize(e){const t=new UserSession,n=Object.keys(t);for(const s of n)t[s]=e[s];return t}}function zn(e,t){if(null==e)return{};var n,s,i={},r=Object.keys(e);for(s=0;s=0||(i[n]=e[n]);return i}var Jn,Kn;const Vn=null==(Jn=window.Capacitor)||null==(Jn=Jn.Plugins)?void 0:Jn.App,Gn=null==(Kn=window.Capacitor)||null==(Kn=Kn.Plugins)?void 0:Kn.Browser;class MobileWindow{constructor(e,t){if(this.redirectUrl=e,this.params=t,this._logger=new Dt("MobileWindow"),this.capacitorAppUrlOpenHandle=void 0,this.capacitorBrowserFinishedHandle=void 0,this.originalHandleOpenURL=window.handleOpenURL,this.timer=void 0,this.navigateLogger=void 0,this._resolve=void 0,this._reject=void 0,!AuthUtils.isCapacitor()&&!AuthUtils.isCordova()){let e="[@badisi/auth-js] Required core dependency not found.\n\n";e+="\u24d8 Please follow the recommended guide and install either `Capacitor` or `Cordova` dependency.",console.error(e)}if(!Gn){let e="[@badisi/auth-js] Required plugin not found.\n\n";e+="\u24d8 Please follow the recommended guide and install either `@badisi/capacitor-browsertab` or `@capacitor/browser` plugin.",console.error(e)}Gn&&this._logger.debug("Using `@capacitor/browser` implementation")}async navigate(e){return this.navigateLogger=this._logger.create("navigate"),this.navigateLogger.debug("url",e.url),new Promise(((t,n)=>{this._resolve=t,this._reject=n,this.installCustomUrlSchemeHandler().then((()=>{Gn&&this.useCapacitorBrowser(e)}))}))}async close(){const e=this._logger.create("close");await(null==Gn?void 0:Gn.close().catch((t=>e.error(t)))),e.debug("success")}async cleanup(){var e,t;const n=this._logger.create("cleanup");window.handleOpenURL=this.originalHandleOpenURL,await(null==(e=this.capacitorBrowserFinishedHandle)?void 0:e.remove()),await(null==(t=this.capacitorAppUrlOpenHandle)?void 0:t.remove()),clearTimeout(this.timer),n.debug("success")}async onError(e){var t,n;null==(t=this.navigateLogger)||t.error("error response:",e),await this.cleanup(),await this.close(),null==(n=this._reject)||n.call(this,new Error(e))}async onSuccess(e){var t,n;null==(t=this.navigateLogger)||t.debug("successful response:",e),await this.cleanup(),await this.close(),null==(n=this._resolve)||n.call(this,{url:e})}async useCapacitorBrowser(e){this.capacitorBrowserFinishedHandle=await(null==Gn?void 0:Gn.addListener("browserFinished",(()=>{this.onError("Capacitor browser closed by user")}))),await(null==Gn?void 0:Gn.open({url:e.url,toolbarColor:this.params.mobileWindowToolbarColor,presentationStyle:this.params.mobileWindowPresentationStyle,width:this.params.mobileWindowWidth,height:this.params.mobileWindowWidth}))}async useBrowserTab(e){}async installCustomUrlSchemeHandler(){const e=this._logger.create("installCustomUrlSchemeHandler");this.timer=setTimeout((()=>{this.onError("Installing custom url scheme handler, timed out without a response")}),1e4),await this.cleanup(),AuthUtils.isCapacitor()?(e.debug("listening to Capacitor `appUrlOpen` event"),this.capacitorAppUrlOpenHandle=await(null==Vn||null==Vn.addListener?void 0:Vn.addListener("appUrlOpen",(({url:e})=>{AuthUtils.isUrlMatching(e,this.redirectUrl)&&this.onSuccess(e)})))):AuthUtils.isCordova()&&(e.debug("waiting for Cordova `handleOpenURL` callback"),window.handleOpenURL=e=>{var t;null==(t=this.originalHandleOpenURL)||t.call(this,e),AuthUtils.isUrlMatching(e,this.redirectUrl)&&this.onSuccess(e)}),e.debug("success")}}class MobileNavigator{constructor(){this._logger=new Dt("MobileNavigator")}prepare(e,t){return this._logger.create("prepare"),new MobileWindow(e,t)}}const Qn=["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"],Xn=["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"];class OidcUserManager extends Hn{constructor(e){super(Object.assign({authority:e.authorityUrl,client_id:e.clientId,scope:e.scope,loadUserInfo:e.loadUserInfo,automaticSilentRenew:e.automaticSilentRenew},e.internal)),this.libSettings=e,this._mobileNavigator=void 0,this._mobileNavigator=new MobileNavigator}async signoutMobile(e={}){var t,n,s,i;const r=this._logger.create("signout"),{mobileWindowToolbarColor:o,mobileWindowPresentationStyle:a,mobileWindowWidth:c,mobileWindowHeight:l}=e,d=zn(e,Qn),u={mobileWindowToolbarColor:null!=o?o:null==(t=this.libSettings.internal)?void 0:t.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=a?a:null==(n=this.libSettings.internal)?void 0:n.mobileWindowPresentationStyle,mobileWindowWidth:null!=c?c:null==(s=this.libSettings.internal)?void 0:s.mobileWindowWidth,mobileWindowHeight:null!=l?l:null==(i=this.libSettings.internal)?void 0:i.mobileWindowHeight},h=this._mobileNavigator.prepare(this.settings.post_logout_redirect_uri,u);await this._signout(Object.assign({request_type:"so:m",post_logout_redirect_uri:this.settings.post_logout_redirect_uri},d),h),r.info("success")}async signinMobile(e={}){var t,n,s,i,r;const o=this._logger.create("signin"),{mobileWindowToolbarColor:a,mobileWindowPresentationStyle:c,mobileWindowWidth:l,mobileWindowHeight:d}=e,u=zn(e,Xn),h={mobileWindowToolbarColor:null!=a?a:null==(t=this.libSettings.internal)?void 0:t.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=c?c:null==(n=this.libSettings.internal)?void 0:n.mobileWindowPresentationStyle,mobileWindowWidth:null!=l?l:null==(s=this.libSettings.internal)?void 0:s.mobileWindowWidth,mobileWindowHeight:null!=d?d:null==(i=this.libSettings.internal)?void 0:i.mobileWindowHeight},p=this._mobileNavigator.prepare(this.settings.redirect_uri,h),g=await this._signin(Object.assign({request_type:"si:m",redirect_uri:this.settings.redirect_uri},u),p);null!=g&&null!=(r=g.profile)&&r.sub?o.info("success, signed in subject",g.profile.sub):o.info("no subject")}}const Yn="auth-js:oidc_manager:redirect_url",Zn={loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!1,automaticSilentRenew:!0,desktopNavigationType:Bn.REDIRECT,scope:"openid profile email phone",logLevel:Wt.NONE,internal:{response_type:"code",redirect_uri:"?oidc-callback=login",post_logout_redirect_uri:"?oidc-callback=logout",popup_redirect_uri:"oidc/callback/popup_redirect.html",popup_post_logout_redirect_uri:"oidc/callback/popup_redirect.html",silent_redirect_uri:"oidc/callback/silent_redirect.html",mobileWindowPresentationStyle:"popover"}};class OIDCAuthManager extends AuthManager{constructor(...e){super(...e),this.idTokenSubs=new AuthSubscriptions,this.accessTokenSubs=new AuthSubscriptions,this.userProfileSubs=new AuthSubscriptions,this.userSessionSubs=new AuthSubscriptions,this.authenticatedSubs=new AuthSubscriptions,this.renewingSubs=new AuthSubscriptions,this.redirectSubs=new AuthSubscriptions,this.userManagerSubs=[],this._idToken=void 0,this._accessToken=void 0,this._userProfile=void 0,this._userSession=void 0,this._isAuthenticated=!1,this._isRenewing=!1,this.userManager=void 0,this.settings=Zn,this._user=void 0}set user(e){this._user!==e&&(this._user=e,this._idToken=e?e.id_token:void 0,this._accessToken=e?e.access_token:void 0,this._userProfile=null!=e&&e.profile?e.profile:void 0,this._userSession=e?UserSession.deserialize(e):void 0,this._isAuthenticated=!(!e||e.expired),this.idTokenSubs.notify(this._idToken),this.accessTokenSubs.notify(this._accessToken),this.userProfileSubs.notify(this._userProfile),this.userSessionSubs.notify(this._userSession),this.authenticatedSubs.notify(this._isAuthenticated))}async init(e){var t,n,s,i,r,o,a,c,l,d=this;Wt.setLevel(null!=(t=null!=(n=e.logLevel)?n:Zn.logLevel)?t:Wt.NONE),Wt.setLogger(console);const u=AuthUtils.isNativeMobile(),h=u?`${e.mobileScheme}://localhost/`:AuthUtils.getBaseUrl();if(this.settings=Ut({},Zn,{internal:{userStore:new on({store:u?new MobileStorage:new nn}),redirect_uri:`${h}${null==(s=Zn.internal)?void 0:s.redirect_uri}`,post_logout_redirect_uri:`${h}${null==(i=Zn.internal)?void 0:i.post_logout_redirect_uri}`,popup_redirect_uri:`${h}${null==(r=Zn.internal)?void 0:r.popup_redirect_uri}`,popup_post_logout_redirect_uri:`${h}${null==(o=Zn.internal)?void 0:o.popup_post_logout_redirect_uri}`,silent_redirect_uri:`${h}${null==(a=Zn.internal)?void 0:a.silent_redirect_uri}`}},e),this.patchAuth0Logout(),this.userManager=new OidcUserManager(this.settings),this.userManagerSubs.push(this.userManager.events.addUserLoaded((e=>{this.user=e})),this.userManager.events.addUserUnloaded((()=>{this.user&&(this.user=null,this.settings.loginRequired&&location.reload())})),this.userManager.events.addSilentRenewError((async function(){await d.removeUser()}))),this.assertNotInInceptionLoop(),AuthUtils.isUrlMatching(location.href,null==(c=this.settings.internal)?void 0:c.redirect_uri))await this.runSyncOrAsync((()=>this.backFromSigninRedirect()));else if(AuthUtils.isUrlMatching(location.href,null==(l=this.settings.internal)?void 0:l.post_logout_redirect_uri))await this.runSyncOrAsync((()=>this.backFromSignoutRedirect()));else if(this.settings.retrieveUserSession||this.settings.loginRequired){var p;const e=async function(){await d.runSyncOrAsync((()=>d.signinSilent().catch((async function(e){const{error:t,message:n}=e;if(d.settings.loginRequired&&(null!=t&&t.includes("_required")||null!=n&&n.includes("_required")))await d.login();else if(console.error("[OIDCAuthManager] User's session cannot be retrieved:",e.message),d.authenticatedSubs.notify(!1),d.settings.loginRequired)throw e}))))},t=await(null==(p=this.userManager)?void 0:p.getUser());!t||t.expired?!u&&this.settings.retrieveUserSession?await e():this.settings.loginRequired?await this.login():this.user=null:this.user=t}else this.user=null}async logout(e){var t,n,s;const i=null!=(t=null==e?void 0:e.redirectUrl)?t:location.href;var r,o;if(AuthUtils.isNativeMobile())await(null==(r=this.userManager)?void 0:r.signoutMobile(e)),await this.redirect(i),this.postLogoutVerification(i);else switch(null!=(o=null==e?void 0:e.desktopNavigationType)?o:this.settings.desktopNavigationType){case Bn.POPUP:await(null==(n=this.userManager)?void 0:n.signoutPopup(e)),await this.redirect(i);break;case Bn.REDIRECT:default:sessionStorage.setItem(Yn,i),await(null==(s=this.userManager)?void 0:s.signoutRedirect(e))}}async login(e){var t,n,s;const i=null!=(t=null==e?void 0:e.redirectUrl)?t:location.href;var r,o;if(AuthUtils.isNativeMobile())this.notifyRenew(!0),await(null==(r=this.userManager)?void 0:r.signinMobile(e).finally((()=>this.notifyRenew(!1)))),await this.redirect(i);else switch(null!=(o=null==e?void 0:e.desktopNavigationType)?o:this.settings.desktopNavigationType){case Bn.POPUP:this.notifyRenew(!0),await(null==(n=this.userManager)?void 0:n.signinPopup(e).catch((e=>{var t;throw"Attempted to navigate on a disposed window"===(null==(t=e)?void 0:t.message)&&((e=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,e.message+="\n\n\u24d8 This may be due to an ad blocker."),e})).finally((()=>this.notifyRenew(!1)))),await this.redirect(i);break;case Bn.REDIRECT:default:sessionStorage.setItem(Yn,i),await(null==(s=this.userManager)?void 0:s.signinRedirect(e))}return this._isAuthenticated}async renew(e){return this.signinSilent(e).catch((e=>console.error(e)))}getSettings(){return this.settings}isRenewing(){return this._isRenewing}async isAuthenticated(){return await this.waitForRenew("isAuthenticated()"),this._isAuthenticated}async getUserProfile(){return await this.waitForRenew("getUserProfile()"),this._userProfile}async getUserSession(){return await this.waitForRenew("getUserSession()"),this._userSession}async getIdToken(){return await this.waitForRenew("getIdToken()"),this._idToken}async getIdTokenDecoded(){return await this.waitForRenew("getIdTokenDecoded()"),AuthUtils.decodeJwt(this._idToken)}async getAccessToken(){return await this.waitForRenew("getAccessToken()"),this._accessToken}async getAccessTokenDecoded(){return await this.waitForRenew("getAccessTokenDecoded()"),AuthUtils.decodeJwt(this._accessToken)}destroy(){this.idTokenSubs.unsubscribe(),this.accessTokenSubs.unsubscribe(),this.userProfileSubs.unsubscribe(),this.userSessionSubs.unsubscribe(),this.authenticatedSubs.unsubscribe(),this.renewingSubs.unsubscribe(),this.redirectSubs.unsubscribe(),this.userManagerSubs.forEach((e=>e()))}onIdTokenChanged(e){return this.idTokenSubs.add(e)}onAccessTokenChanged(e){return this.accessTokenSubs.add(e)}onUserProfileChanged(e){return this.userProfileSubs.add(e)}onUserSessionChanged(e){return this.userSessionSubs.add(e)}onAuthenticatedChanged(e){return this.authenticatedSubs.add(e)}onRenewingChanged(e){return this.renewingSubs.add(e)}onRedirect(e){return this.redirectSubs.add(e)}assertNotInInceptionLoop(){var e,t;[null==(e=this.settings.internal)?void 0:e.silent_redirect_uri,null==(t=this.settings.internal)?void 0:t.popup_redirect_uri].forEach((e=>{var t;const n=null==(t=new RegExp(/^.*\/(.*).html$/gm).exec(null!=e?e:""))?void 0:t[1],s=new Error(`[OIDCAuthManager] ${null!=e?e:"redirect uri"} was not found.`);if(s.stack=void 0,AuthUtils.isUrlMatching(location.href,e))throw s.message+="\n\n\u24d8 This usually means you forgot to include the redirect html files in your application assets.",s;if(location.href.includes(`/${n}.html`))throw s.message+="\n\n\u24d8 This usually means your redirect urls are misconfigured.",s}))}async waitForRenew(e){const t=Date.now();for(;this._isRenewing;){if(Date.now()>t+5e3){console.warn("[@badisi/auth-js]",`\`${e}\``,"timed out waiting for renew to finish.");break}await new Promise((e=>setTimeout(e,100)))}}postLogoutVerification(e){const t=AuthUtils.stringToURL(null!=e?e:"/");this.settings.loginRequired&&location.origin===t.origin&&location.reload()}notifyRenew(e){this._isRenewing=e,this.renewingSubs.notify(e)}async runSyncOrAsync(e){this.settings.loginRequired?await e():e()}async redirect(e,t){t&&(console.error(t),await this.removeUser());const n=AuthUtils.stringToURL(null!=e?e:"/");location.origin===n.origin?(history.replaceState(history.state,"",n.href),this.redirectSubs.notify(n)):location.href=n.href}async removeUser(){var e,t;this.user=null,await Promise.all([null==(e=this.userManager)?void 0:e.clearStaleState(),null==(t=this.userManager)?void 0:t.removeUser()])}async signinSilent(e){this.notifyRenew(!0);try{var t;await(null==(t=this.userManager)?void 0:t.signinSilent(e))}catch(n){throw await this.removeUser(),n}finally{this.notifyRenew(!1)}}async backFromSigninRedirect(){try{var e;await(null==(e=this.userManager)?void 0:e.signinRedirectCallback(location.href)),await this.redirect(sessionStorage.getItem(Yn))}catch(t){throw await this.redirect("/",t),t}finally{sessionStorage.removeItem(Yn)}}async backFromSignoutRedirect(){let e=sessionStorage.getItem(Yn);try{var t;await(null==(t=this.userManager)?void 0:t.signoutRedirectCallback(location.href)),await this.redirect(e),await this.removeUser()}catch(n){throw e="/",await this.redirect(e,n),n}finally{sessionStorage.removeItem(Yn),this.postLogoutVerification(e)}}patchAuth0Logout(){if(this.settings.authorityUrl.endsWith("auth0.com")){var e,t;const{authorityUrl:n,clientId:s,desktopNavigationType:i}=this.settings,r=i===Bn.POPUP?null==(e=this.settings.internal)?void 0:e.popup_post_logout_redirect_uri:null==(t=this.settings.internal)?void 0:t.post_logout_redirect_uri;this.settings.internal=Ut({},{metadataSeed:{end_session_endpoint:`${n}/v2/logout?client_id=${s}&returnTo=${r}`}},this.settings.internal)}}}n(6503);const es='\n .flex {\n flex: 1;\n }\n\n .hidden {\n display: none !important;\n }\n\n .row {\n display: flex;\n flex-direction: row;\n }\n\n .column {\n display: flex;\n flex-direction: column;\n }\n\n .card {\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 4px;\n background-color: white;\n margin: 12px 6px;\n }\n\n .card .card-status {\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n margin-left: 8px;\n background-color: #f2f2f2;\n }\n .card .card-status.error {\n background-color: #ef5350;\n }\n .card .card-status.success {\n background-color: #66bb6a;\n }\n\n .card .card-title {\n padding: 16px;\n font-size: 20px;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.87);\n align-items: center;\n }\n\n .card .box {\n height: 200px;\n border-top: 1px solid lightgray;\n word-break: break-all;\n overflow: auto;\n background-color: #f2f2f2;\n padding: 12px;\n }\n .card .box pre {\n margin: 0;\n }\n\n .card .card-actions {\n padding: 0 14px 8px 14px;\n min-height: 50px;\n }\n .card .card-actions .input {\n display: flex;\n align-items: center;\n }\n .card .card-actions .input:not(:last-child) {\n margin-bottom: 8px;\n }\n .card .card-actions .input label {\n width: 125px;\n text-align: right;\n margin-right: 14px;\n }\n .card .card-actions .input input {\n padding: 4px;\n }\n\n .json-key {\n color: rgb(124, 77, 255);\n }\n\n .json-value {\n color: rgb(67, 122, 237);\n }\n\n .json-string {\n color: rgb(83, 160, 83);\n }\n\n .json-date {\n color: rgb(200, 56, 198);\n }\n\n input {\n color: #5e35b1;\n padding: 10px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n font-size: 14px;\n }\n\n input:invalid {\n border-color: #f44336;\n }\n\n input[type="checkbox"] {\n margin-right: 10px;\n }\n\n select {\n color: #5e35b1;\n padding: 8px 6px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n }\n\n @media only screen and (max-width: 600px) {\n :host {\n padding: 0 !important;\n padding-bottom: 24px !important;\n }\n\n :host .card {\n border-left: 0;\n border-right: 0;\n border-radius: 0;\n margin: 0;\n margin-bottom: 6px;\n }\n }\n',ts=(e,t=[])=>e?JSON.stringify(e,null,2).replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(/^( *)("[\w-]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/gm,((e,n,s,i,r)=>{let o=n||"";const a=s?s.replace(/[": ]/g,""):void 0;if(a&&(o+=`${a}: `),i&&(o+=`${i}`,a&&t.includes(a))){const e=new Date(1e3*Number(i)),t=`${e.toDateString()}, ${e.toLocaleTimeString()}`;t&&(o+=` (${t})`)}return o+(r||"")})):"",ns=document.createElement("template");ns.innerHTML=`\n \n\n
\n
\n\n \n \n \n \n \n \n \n \n\n
\n \ud83d\udee1\ufe0fDemo app { }\n
\ud83d\udc48 choose an implementation
\n
\n\n
\n\n
\n \n \n \n
\n
\n`;class DemoAppHeaderElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.implSelectEl=void 0,this.statusEl=void 0,this.versionEl=void 0,this.loginButtonEl=void 0,this.logoutButtonEl=void 0,this.silentRenewButtonEl=void 0,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(ns.content,!0)),this.implSelectEl=this.shadowRoot.querySelector("#implementation-select"),this.statusEl=this.shadowRoot.querySelector(".status"),this.versionEl=this.shadowRoot.querySelector(".version"),this.loginButtonEl=this.shadowRoot.querySelector("#login-button"),this.logoutButtonEl=this.shadowRoot.querySelector("#logout-button"),this.silentRenewButtonEl=this.shadowRoot.querySelector("#silent-renew-button")}set isRenewing(e){this.statusEl&&this.statusEl.classList[e?"add":"remove"]("loading")}set isAuthenticated(e){this.statusEl&&null!==e&&(this.statusEl.classList.remove("loading"),this.statusEl.title=e?"Authenticated":"Not authenticated",this.statusEl.classList[e?"add":"remove"]("authenticated"),this.statusEl.classList[e?"remove":"add"]("not-authenticated"))}connectedCallback(){if(window.location.href.includes("localhost")){const e=document.createElement("option");e.textContent="localhost",this.implSelectEl.appendChild(e)}else{window.appSettings.getImplementations().forEach((e=>{const t=document.createElement("option");t.value=String(e.label),t.textContent=e.label,this.implSelectEl.appendChild(t)}));const e=()=>{window.location.href=window.appSettings.getImplementations()[this.implSelectEl.selectedIndex].demoUrl};this.implSelectEl.addEventListener("change",e),this.listeners.push((()=>this.implSelectEl.removeEventListener("change",e)))}const e=()=>{var e;null==(e=this.shadowRoot)||null==(e=e.querySelector("header .title .tip"))||e.remove(),window.appSettings.setShowTip(!1)};window.appSettings.get().showTip?(this.implSelectEl.addEventListener("click",e,{once:!0}),this.listeners.push((()=>this.implSelectEl.removeEventListener("click",e)))):e(),this.refreshImplementation(),this.addEventListeners()}disconnectedCallback(){this.listeners.forEach((e=>e()))}addEventListeners(){var e,t,n;const s=()=>this.dispatchEvent(new Event("login",{bubbles:!0,composed:!0}));null==(e=this.loginButtonEl)||e.addEventListener("click",s);const i=()=>this.dispatchEvent(new Event("logout",{bubbles:!0,composed:!0}));null==(t=this.logoutButtonEl)||t.addEventListener("click",i);const r=()=>this.dispatchEvent(new Event("silentRenew",{bubbles:!0,composed:!0}));null==(n=this.silentRenewButtonEl)||n.addEventListener("click",r),this.listeners.push((()=>{var e;return null==(e=this.loginButtonEl)?void 0:e.removeEventListener("click",s)}),(()=>{var e;return null==(e=this.logoutButtonEl)?void 0:e.removeEventListener("click",i)}),(()=>{var e;return null==(e=this.silentRenewButtonEl)?void 0:e.removeEventListener("click",r)}))}refreshImplementation(){const e=window.appSettings.getImplementations();if(window.location.href.includes("localhost"))this.implSelectEl.selectedIndex=0,this.versionEl.innerHTML="@localhost";else{const t=e.findIndex((e=>window.location.href.includes(e.demoUrl))),n=-1!==t?e[t]:e[0];this.implSelectEl.selectedIndex=-1!==t?t:0,this.versionEl.innerHTML=n.version}}}window.customElements.define("demo-app-header",DemoAppHeaderElement);const ss=document.createElement("template");ss.innerHTML=`\n \n\n \n \n
\n \n
\n`;class DemoAppMainElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.tabsContentEl=void 0,this.demoAppHeaderEl=void 0,this.tabs=[],this.views=[],this.currentTabIndex=-1,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(ss.content,!0)),this.tabsContentEl=this.shadowRoot.querySelector(".tabs-content"),this.demoAppHeaderEl=this.shadowRoot.querySelector("demo-app-header")}set isRenewing(e){this.demoAppHeaderEl.isRenewing=e}set isAuthenticated(e){this.demoAppHeaderEl.isAuthenticated=e}connectedCallback(){this.drawTabs(),this.showView(window.appSettings?window.appSettings.get().currentTabIndex:0)}disconnectedCallback(){this.listeners.forEach((e=>e()))}drawTabs(){const e=this.shadowRoot.querySelector("#views"),t=this.shadowRoot.querySelector("#tabs");e&&t&&(this.views=e.assignedElements(),this.views.forEach(((e,n)=>{e.style.display="none";const s=document.createElement("a");s.textContent=e.getAttribute("tabLabel")||"?";const i=()=>this.showView(n);s.addEventListener("click",i),this.listeners.push((()=>s.removeEventListener("click",i))),t.appendChild(s),this.tabs.push(s)})))}showView(e){var t;this.currentTabIndex!==e&&(this.currentTabIndex=e,this.tabs.forEach(((t,n)=>{t.classList[n!==e?"remove":"add"]("selected")})),this.views.forEach(((t,n)=>{t.style.display=n!==e?"none":"flex"})),null==(t=this.tabsContentEl)||t.scrollTo(0,0),window.appSettings.setCurrentTabIndex(e))}}window.customElements.define("demo-app-main",DemoAppMainElement);const is=document.createElement("template");is.innerHTML=`\n \n\n
\n
\n APIs access\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n \n
\n            
\n
\n
\n\n \n`;class DemoAppPlaygroundElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.apiStatusEl=void 0,this.apiResponseEl=void 0,this.apiUrlEl=void 0,this.apiHeadersEl=void 0,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(is.content,!0)),this.apiStatusEl=this.shadowRoot.querySelector("#api-status"),this.apiResponseEl=this.shadowRoot.querySelector("#api-response"),this.apiUrlEl=this.shadowRoot.querySelector("#api-url-input"),this.apiHeadersEl=this.shadowRoot.querySelector("#api-headers-input")}connectedCallback(){var e,t,n;const s=null==(e=this.shadowRoot)?void 0:e.querySelector("#api-get-button"),i=()=>{const e=new CustomEvent("api",{bubbles:!0,composed:!0,detail:{url:this.apiUrlEl.value,headers:this.apiHeadersEl.value}});return this.dispatchEvent(e)};null==s||s.addEventListener("click",i);const r=()=>this.saveSettings({privateApiUrl:this.apiUrlEl.value});null==(t=this.apiUrlEl)||t.addEventListener("input",r);const o=()=>this.saveSettings({privateApiHeaders:this.apiHeadersEl.value});null==(n=this.apiHeadersEl)||n.addEventListener("input",o),this.listeners.push((()=>null==s?void 0:s.removeEventListener("click",i)),(()=>{var e;return null==(e=this.apiUrlEl)?void 0:e.removeEventListener("input",r)}),(()=>{var e;return null==(e=this.apiHeadersEl)?void 0:e.removeEventListener("input",o)}));const{otherSettings:a}=window.appSettings.getCurrentUserSettings();this.apiUrlEl.value=null==a?void 0:a.privateApiUrl,this.apiHeadersEl.value=null==a?void 0:a.privateApiHeaders}disconnectedCallback(){this.listeners.forEach((e=>e()))}setApiStatus(e,t){this.apiStatusEl.classList.remove(t?"success":"error"),this.apiStatusEl.classList.add(t?"error":"success"),this.apiResponseEl.innerHTML=ts(e)}saveSettings(e){const t=window.appSettings.getCurrentUserSettings();t.otherSettings=Object.assign({},t.otherSettings,e),window.appSettings.addOrUpdateUserSettings(t)}}window.customElements.define("demo-app-playground",DemoAppPlaygroundElement);const rs=document.createElement("template");rs.innerHTML=`\n \n\n
\n
\n
Authenticated
\n \n
\n            
\n
\n\n
\n
User session
\n \n
\n            
\n
\n\n
\n
Access token
\n \n
\n                
\n            
\n
\n\n
\n
Id token
\n \n
\n                
\n            
\n
\n\n
\n
User profile
\n \n
\n            
\n
\n
\n`;class DemoAppDebugElement extends HTMLElement{constructor(){var e;super(),this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(rs.content,!0)),this.isAuthenticated=!1,this.userSession=void 0,this.accessToken=void 0,this.accessTokenDecoded=void 0,this.idToken=void 0,this.idTokenDecoded=void 0,this.userProfile=void 0}set isAuthenticated(e){null!==e&&this.update("#isAuthenticated",e)}set userSession(e){this.update("#userSession",ts(e,["expires_at"]))}set accessToken(e){this.update("#accessToken",e)}set accessTokenDecoded(e){const t="string"!=typeof e?ts(e,["exp","iat","auth_time"]):"(no decoded info as it is not a JWT token)";this.update("#accessTokenDecoded",t)}set idToken(e){this.update("#idToken",e)}set idTokenDecoded(e){this.update("#idTokenDecoded",ts(e,["exp","iat","auth_time"]))}set userProfile(e){this.update("#userProfile",ts(e))}update(e,t){var n;const s=null==(n=this.shadowRoot)?void 0:n.querySelector(e);var i,r;s&&(null==t||""===t?null==(i=s.closest(".info"))||i.classList.add("hidden"):(null==(r=s.closest(".info"))||r.classList.remove("hidden"),s.innerHTML=String(t)))}}window.customElements.define("demo-app-debug",DemoAppDebugElement);const os=document.createElement("template");os.innerHTML=`\n \n\n
\n \n
\n \n
\n
\n\n \n\n
\n
\n DELETE\n
\n
\n \n \n
\n
\n
\n`;class DemoAppSettingsElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.formEl=void 0,this.formContentEl=void 0,this.selectEl=void 0,this.settingsNameEl=void 0,this.formIsDirty=!1,this.formIsNew=!1,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(os.content,!0))}connectedCallback(){var e,t,n,s,i;this.formEl=this.shadowRoot.querySelector("form"),this.formContentEl=this.shadowRoot.querySelector(".form-content"),this.selectEl=this.shadowRoot.querySelector("#settings-select"),this.settingsNameEl=this.shadowRoot.querySelector("#settingsName");const r=e=>{this.formIsDirty||"settings-select"===e.target.id||(this.formIsDirty=!0,this.classList.add("dirty"))};this.formEl.addEventListener("input",r),this.listeners.push((()=>this.formEl.removeEventListener("input",r))),this.refreshSelect();const o=()=>this.loadSettings(this.selectEl.value);null==(e=this.selectEl)||e.addEventListener("change",o),this.listeners.push((()=>this.selectEl.removeEventListener("change",o)));const a=null==(t=this.shadowRoot)?void 0:t.querySelector("#add-settings-button"),c=()=>this.add();null==a||a.addEventListener("click",c),this.listeners.push((()=>null==a?void 0:a.removeEventListener("click",c)));const l=null==(n=this.shadowRoot)?void 0:n.querySelector("#delete-settings-button"),d=()=>this.delete();null==l||l.addEventListener("click",d),this.listeners.push((()=>null==l?void 0:l.removeEventListener("click",d)));const u=null==(s=this.shadowRoot)?void 0:s.querySelector("#save-settings-button"),h=()=>this.saveAndReload();null==u||u.addEventListener("click",h),this.listeners.push((()=>null==u?void 0:u.removeEventListener("click",h)));const p=null==(i=this.shadowRoot)?void 0:i.querySelector("#cancel-settings-button"),g=()=>this.cancel();null==p||p.addEventListener("click",g),this.listeners.push((()=>null==p?void 0:p.removeEventListener("click",g))),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}disconnectedCallback(){this.listeners.forEach((e=>e()))}loadSettings(e){window.appSettings.setCurrentUserSettings(e),location.reload()}add(){const e="New settings",t=document.createElement("option");t.selected=!0,t.value=e,t.textContent=e,this.selectEl.appendChild(t),this.formIsNew=!0,this.formIsDirty=!0,this.classList.add("dirty"),this.refreshFormContent({name:e,librarySettings:{}})}delete(){window.appSettings.deleteCurrentUserSettings(),location.reload()}cancel(){this.formIsNew=!1,this.formIsDirty=!1,this.classList.remove("dirty"),this.refreshSelect(),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}setPathValue(e,t,n){const s=t.split(".");s.reduce(((e,t,i)=>(i===s.length-1?e[t]=n:Object.prototype.hasOwnProperty.call(e,t)||(e[t]={}),e[t])),e)}getPathValue(e,t){return t.split(".").reduce(((e,t)=>e?e[t]:e),e)}refreshSelect(){this.selectEl.innerHTML="";const{userSettings:e,currentUserSettingsId:t}=window.appSettings.get();e.sort(((e,t)=>e.name.localeCompare(t.name))).forEach((e=>{const n=document.createElement("option");n.selected=e.name===t,n.value=String(e.name),n.textContent=e.name,this.selectEl.appendChild(n)}))}refreshFormContent(e){this.formContentEl.innerHTML="";const{librarySettingsDefinition:t}=window.appSettings.get(),{name:n,librarySettings:s}=e;this.settingsNameEl.value=n,t.sort(((e,t)=>(t._sortIndex||0)-(e._sortIndex||0))).forEach((e=>{var t;const n=document.createElement("div");this.formContentEl.prepend(n);const i=document.createElement("label");i.htmlFor=e.name.replace(".",""),i.textContent=`${e.label}${e.required?" *":""}`;const r=document.createElement("list"===e.type?"select":"input");switch(r.id=e.name.replace(".",""),r.name=e.name.replace(".",""),r.required=!0===e.required,e.type){case"boolean":r.checked=this.getPathValue(s,e.name),r.type="checkbox",n.appendChild(r),n.appendChild(i);break;case"list":null==(t=e.values)||t.forEach((e=>{const t=document.createElement("option");t.value=String(e.value),t.textContent=e.label,r.appendChild(t)})),r.value=this.getPathValue(s,e.name),r.classList.add("flex"),n.classList.add("input","column"),n.appendChild(i),n.appendChild(r);break;default:{const t=this.getPathValue(s,e.name);"json"===e.type?r.value=t?JSON.stringify(t):"":r.value=null!=t?t:"",n.classList.add("input","column"),n.appendChild(i),n.appendChild(r);break}}}))}saveAndReload(){if(this.formEl.reportValidity()){const{librarySettingsDefinition:e}=window.appSettings.get(),t=this.formIsNew?{name:"",librarySettings:{}}:window.appSettings.getCurrentUserSettings();t.name=this.settingsNameEl.value,e.forEach((e=>{var n;const s=null==(n=this.shadowRoot)?void 0:n.querySelector(`#${e.name.replace(".","")}`);let i;switch(e.type){case"boolean":i=s.checked;break;case"list":default:i=s.value;break;case"json":try{const e=s.value;e&&""!==e.trim()&&(i=JSON.parse(e))}catch(r){console.error(r)}}this.setPathValue(t.librarySettings,e.name,i)})),window.appSettings.addOrUpdateUserSettings(t),this.formIsNew&&window.appSettings.setCurrentUserSettings(t.name),location.reload()}}}window.customElements.define("demo-app-settings",DemoAppSettingsElement);const as=JSON.parse('{"UU":"@badisi/auth-js","rE":"0.0.0-semantically-released","TB":"https://github.com/Badisi/auth-js/tree/main/projects/auth-js"}'),cs=JSON.parse('{"UU":"@badisi/ngx-auth","TB":"https://github.com/Badisi/auth-js/tree/main/projects/ngx-auth"}');const ls=[{name:"authorityUrl",label:"Authority url",type:"string",required:!0},{name:"clientId",label:"Client id",type:"string",required:!0},{name:"mobileScheme",label:"Custom mobile scheme name",type:"string"},{name:"scope",label:"Scope",type:"string"},{name:"internal.extraQueryParams",label:"Extra query params",type:"json"},{name:"desktopNavigationType",label:"Desktop navigation type",type:"list",values:[{label:"REDIRECT",value:Bn.REDIRECT},{label:"POPUP",value:Bn.POPUP}]},{name:"logLevel",label:"Log level",type:"list",values:[{label:"NONE",value:Wt.NONE},{label:"ERROR",value:Wt.ERROR},{label:"WARN",value:Wt.WARN},{label:"INFO",value:Wt.INFO},{label:"DEBUG",value:Wt.DEBUG}]},{name:"loginRequired",label:"Login required",type:"boolean"},{name:"retrieveUserSession",label:"Retrieve user's session",type:"boolean"},{name:"loadUserInfo",label:"Load user's info",type:"boolean"},{name:"automaticSilentRenew",label:"Automatic silent renew",type:"boolean"}],ds=[...ls,{name:"automaticLoginOn401",label:"Automatic login on 401",type:"boolean"},{name:"automaticInjectToken",label:"Automatic inject token",type:"boolean"}];ds.splice(3,0,{name:"authGuardRedirectUrl",label:"AuthGuard redirect url",type:"string"});const us=(e=!1)=>{const t=[{name:"Auth0",otherSettings:{privateApiUrl:"https://dev-fijd1e9x.us.auth0.com/api/v2/users/auth0|631b171682c639d40cb84d5c",privateApiHeaders:""},librarySettings:{authorityUrl:"https://dev-fijd1e9x.us.auth0.com",clientId:"kRVVEnAWKMpxxpcodl0TqLXfIHgQvmmt",mobileScheme:"demo-app",scope:"openid profile email phone offline_access read:current_user",internal:{extraQueryParams:{audience:"https://dev-fijd1e9x.us.auth0.com/api/v2/"}},desktopNavigationType:Bn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}},{name:"Zitadel",otherSettings:{privateApiUrl:"",privateApiHeaders:""},librarySettings:{authorityUrl:"https://auth-js-0pdipf.zitadel.cloud",clientId:"178200751804317953@demo-app",mobileScheme:"demo-app",scope:"openid profile email phone offline_access",desktopNavigationType:Bn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}];return e||t.push({name:"Keycloak (local)",otherSettings:{privateApiUrl:"/api/my-api",privateApiHeaders:""},librarySettings:{authorityUrl:"http://localhost:8080/auth/realms/demo",clientId:"demo-app",mobileScheme:"demo-app",scope:"openid profile email phone",desktopNavigationType:Bn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}),t},hs=new class DemoAppSettings{constructor(e,t){this.storageKey=e,this.defaultAppSettings=t,this.implementations=[{label:"VanillaJS",demoUrl:"https://badisi.github.io/auth-js/demo-app/auth-js",version:`${as.UU}@main`},{label:"Angular",demoUrl:"https://badisi.github.io/auth-js/demo-app/ngx-auth",version:`${cs.UU}@main`}],this.defaultAppSettings.librarySettingsDefinition.forEach(((e,t)=>e._sortIndex=t))}getImplementations(){return this.implementations}setShowTip(e){const t=this.get();t.showTip=e,this.saveAppSettings(t)}setCurrentTabIndex(e){const t=this.get();t.currentTabIndex=e,this.saveAppSettings(t)}addOrUpdateUserSettings(e){const t=this.get(),n=t.userSettings.findIndex((t=>t.name===e.name));-1!==n?t.userSettings[n]=e:t.userSettings.push(e),this.saveAppSettings(t)}deleteCurrentUserSettings(){const e=this.get(),{name:t}=this.getCurrentUserSettings(),n=e.userSettings.findIndex((e=>e.name===t));-1!==n&&(e.userSettings.splice(n,1),delete e.currentUserSettingsId,this.saveAppSettings(e))}setCurrentUserSettings(e){const t=this.get();-1!==t.userSettings.findIndex((t=>t.name===e))&&(t.currentUserSettingsId=e,this.saveAppSettings(t))}getCurrentUserSettings(){const e=this.get(),t=e.userSettings.findIndex((t=>t.name===e.currentUserSettingsId));return-1!==t?e.userSettings[t]:e.userSettings.sort(((e,t)=>e.name.localeCompare(t.name)))[0]}get(){const e=sessionStorage.getItem(this.storageKey);if(e){const t=Object.assign({},this.defaultAppSettings,JSON.parse(e));return this.defaultAppSettings.userSettings.forEach((e=>{t.userSettings.find((t=>t.name===e.name))||t.userSettings.push(e)})),t}return Object.assign({},this.defaultAppSettings)}saveAppSettings(e){delete e.librarySettingsDefinition,sessionStorage.setItem(this.storageKey,JSON.stringify(e))}}(`auth-js:${as.rE}:demo-app:settings`,{showTip:!0,currentTabIndex:0,userSettings:us(!0),librarySettingsDefinition:ls});(()=>{window.appSettings=hs;const e=document.createElement("div");e.innerHTML="Loading...",document.body.appendChild(e),(async e=>await(async(e,t)=>{const n=new t;return await n.init(e),n})(e,OIDCAuthManager))(hs.getCurrentUserSettings().librarySettings).then((t=>{window.authManager=t,e.replaceWith(document.createElement("app-root"))})).catch((t=>{var n;console.error(t),e.innerHTML=`${t.message}
`,null==(n=document.body.querySelector("#loginButton"))||n.addEventListener("click",(()=>location.reload()),{once:!0})}))})()},7436:function(e,t,n){var s;e.exports=(s=s||function(e,t){var s;if("undefined"!=typeof window&&window.crypto&&(s=window.crypto),"undefined"!=typeof self&&self.crypto&&(s=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(s=globalThis.crypto),!s&&"undefined"!=typeof window&&window.msCrypto&&(s=window.msCrypto),!s&&"undefined"!=typeof global&&global.crypto&&(s=global.crypto),!s)try{s=n(9366)}catch(m){}var i=function(){if(s){if("function"==typeof s.getRandomValues)try{return s.getRandomValues(new Uint32Array(1))[0]}catch(m){}if("function"==typeof s.randomBytes)try{return s.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=a.WordArray=c.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,i=e.sigBytes;if(this.clamp(),s%4)for(var r=0;r>>2]>>>24-r%4*8&255;t[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new l.init(n,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],i=0;i>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new l.init(n,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,d=e.min(4*c,r);if(c){for(var u=0;u>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return t.create(i,r)}e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,s=this._map;e.clamp();for(var i=[],r=0;r>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,s=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r>>7)^(g<<14|g>>>18)^g>>>3,m=l[p-2],f=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;l[p]=_+l[p-7]+f+l[p-16]}var w=s&i^s&r^i&r,v=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&d^~a&u)+c[p]+l[p];h=u,u=d,d=a,a=o+b|0,o=r,r=i,i=s,s=b+(v+w)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+d|0,n[6]=n[6]+u|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(d),t.HmacSHA256=r._createHmacHelper(d)}(Math),s.SHA256)},1987:e=>{"use strict";function t(e){this.message=e}t.prototype=new Error,t.prototype.name="InvalidCharacterError";var n="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var n=String(e).replace(/=+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,r=0,o=0,a="";i=n.charAt(o++);~i&&(s=r%4?64*s+i:i,r++%4)?a+=String.fromCharCode(255&s>>(-2*r&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function s(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(n(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return n(t)}}function i(e){this.message=e}function r(e,t){if("string"!=typeof e)throw new i("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(s(e.split(".")[n]))}catch(e){throw new i("Invalid token specified: "+e.message)}}i.prototype=new Error,i.prototype.name="InvalidTokenError";const o=r;o.default=r,o.InvalidTokenError=i,e.exports=o},8566:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var s=n(1753);e=n.hmd(e);var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&e&&!e.nodeType&&e,o=r&&r.exports===i?s.A.Buffer:void 0,a=o?o.allocUnsafe:void 0;const c=function(e,t){if(t)return e.slice();var n=e.length,s=a?a(n):new e.constructor(n);return e.copy(s),s}},724:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s="object"==typeof global&&global&&global.Object===Object&&global},2485:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var s=n(724);e=n.hmd(e);var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&e&&!e.nodeType&&e,o=r&&r.exports===i&&s.A.process;const a=function(){try{var e=r&&r.require&&r.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(t){}}()},1753:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var s=n(724),i="object"==typeof self&&self&&self.Object===Object&&self;const r=s.A||i||Function("return this")()},2160:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var s=n(1753);const i=function(){return!1};e=n.hmd(e);var r="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=r&&e&&!e.nodeType&&e,a=o&&o.exports===r?s.A.Buffer:void 0;const c=(a?a.isBuffer:void 0)||i},9366:()=>{}},e=>{var t;t=8453,e(e.s=t)}]); \ No newline at end of file +(self.webpackChunk=self.webpackChunk||[]).push([[792],{6503:(e,t)=>{"use strict";const n=(e=>e.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return n.addPlatform=(e,t)=>{n.platforms.set(e,t)},n.setPlatform=e=>{n.platforms.has(e)&&(n.currentPlatform=n.platforms.get(e))},n})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),s=n.addPlatform,i=n.setPlatform;var r;t.$c=void 0,(r=t.$c||(t.$c={})).Unimplemented="UNIMPLEMENTED",r.Unavailable="UNAVAILABLE";class CapacitorException extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const o=e=>{var n,s,i,r,o;const a=e.CapacitorCustomPlatform||null,c=e.Capacitor||{},l=c.Plugins=c.Plugins||{},d=e.CapacitorPlatforms,u=(null===(n=null==d?void 0:d.currentPlatform)||void 0===n?void 0:n.getPlatform)||(()=>null!==a?a.name:(e=>{var t,n;return(null==e?void 0:e.androidBridge)?"android":(null===(n=null===(t=null==e?void 0:e.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.bridge)?"ios":"web"})(e)),h=(null===(s=null==d?void 0:d.currentPlatform)||void 0===s?void 0:s.isNativePlatform)||(()=>"web"!==u()),p=(null===(i=null==d?void 0:d.currentPlatform)||void 0===i?void 0:i.isPluginAvailable)||(e=>{const t=_.get(e);return!!(null==t?void 0:t.platforms.has(u()))||!!g(e)}),g=(null===(r=null==d?void 0:d.currentPlatform)||void 0===r?void 0:r.getPluginHeader)||(e=>{var t;return null===(t=c.PluginHeaders)||void 0===t?void 0:t.find((t=>t.name===e))}),_=new Map,m=(null===(o=null==d?void 0:d.currentPlatform)||void 0===o?void 0:o.registerPlugin)||((e,n={})=>{const s=_.get(e);if(s)return console.warn(`Capacitor plugin "${e}" already registered. Cannot register plugins twice.`),s.proxy;const i=u(),r=g(e);let o;const d=s=>{let l;const d=(...d)=>{const u=(async()=>(!o&&i in n?o=o="function"==typeof n[i]?await n[i]():n[i]:null!==a&&!o&&"web"in n&&(o=o="function"==typeof n.web?await n.web():n.web),o))().then((n=>{const o=((n,s)=>{var o,a;if(!r){if(n)return null===(a=n[s])||void 0===a?void 0:a.bind(n);throw new CapacitorException(`"${e}" plugin is not implemented on ${i}`,t.$c.Unimplemented)}{const t=null==r?void 0:r.methods.find((e=>s===e.name));if(t)return"promise"===t.rtype?t=>c.nativePromise(e,s.toString(),t):(t,n)=>c.nativeCallback(e,s.toString(),t,n);if(n)return null===(o=n[s])||void 0===o?void 0:o.bind(n)}})(n,s);if(o){const e=o(...d);return l=null==e?void 0:e.remove,e}throw new CapacitorException(`"${e}.${s}()" is not implemented on ${i}`,t.$c.Unimplemented)}));return"addListener"===s&&(u.remove=async()=>l()),u};return d.toString=()=>`${s.toString()}() { [capacitor code] }`,Object.defineProperty(d,"name",{value:s,writable:!1,configurable:!1}),d},h=d("addListener"),p=d("removeListener"),m=(e,t)=>{const n=h({eventName:e},t),s=async()=>{const s=await n;p({eventName:e,callbackId:s},t)},i=new Promise((e=>n.then((()=>e({remove:s})))));return i.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()},i},f=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return r?m:h;case"removeListener":return p;default:return d(t)}}});return l[e]=f,_.set(e,{name:e,proxy:f,platforms:new Set([...Object.keys(n),...r?[i]:[]])}),f});return c.convertFileSrc||(c.convertFileSrc=e=>e),c.getPlatform=u,c.handleError=t=>e.console.error(t),c.isNativePlatform=h,c.isPluginAvailable=p,c.pluginMethodNoop=(e,t,n)=>Promise.reject(`${n} does not have an implementation of "${t}".`),c.registerPlugin=m,c.Exception=CapacitorException,c.DEBUG=!!c.DEBUG,c.isLoggingEnabled=!!c.isLoggingEnabled,c.platform=c.getPlatform(),c.isNative=c.isNativePlatform(),c},a=(e=>e.Capacitor=o(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),c=a.registerPlugin,l=a.Plugins;class WebPlugin{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const s=async()=>this.removeListener(e,t),i=Promise.resolve({remove:s});return Object.defineProperty(i,"remove",{value:async()=>{console.warn("Using addListener() without 'await' is deprecated."),await s()}}),i}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t){const n=this.listeners[e];n&&n.forEach((e=>e(t)))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:e=>{this.notifyListeners(t,e)}}}unimplemented(e="not implemented"){return new a.Exception(e,t.$c.Unimplemented)}unavailable(e="not available"){return new a.Exception(e,t.$c.Unavailable)}async removeListener(e,t){const n=this.listeners[e];if(!n)return;const s=n.indexOf(t);this.listeners[e].splice(s,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const d=c("WebView"),u=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),h=e=>e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class CapacitorCookiesPluginWeb extends WebPlugin{async getCookies(){const e=document.cookie,t={};return e.split(";").forEach((e=>{if(e.length<=0)return;let[n,s]=e.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");n=h(n).trim(),s=h(s).trim(),t[n]=s})),t}async setCookie(e){try{const t=u(e.key),n=u(e.value),s=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),r=null!=e.url&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${n||""}${s}; path=${i}; ${r};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}const p=c("CapacitorCookies",{web:()=>new CapacitorCookiesPluginWeb}),g=(e,t={})=>{const n=Object.assign({method:e.method||"GET",headers:e.headers},t),s=((e={})=>{const t=Object.keys(e);return Object.keys(e).map((e=>e.toLocaleLowerCase())).reduce(((n,s,i)=>(n[s]=e[t[i]],n)),{})})(e.headers)["content-type"]||"";if("string"==typeof e.data)n.body=e.data;else if(s.includes("application/x-www-form-urlencoded")){const t=new URLSearchParams;for(const[n,s]of Object.entries(e.data||{}))t.set(n,s);n.body=t.toString()}else if(s.includes("multipart/form-data")||e.data instanceof FormData){const t=new FormData;if(e.data instanceof FormData)e.data.forEach(((e,n)=>{t.append(n,e)}));else for(const n of Object.keys(e.data))t.append(n,e.data[n]);n.body=t;const s=new Headers(n.headers);s.delete("content-type"),n.headers=s}else(s.includes("application/json")||"object"==typeof e.data)&&(n.body=JSON.stringify(e.data));return n};class CapacitorHttpPluginWeb extends WebPlugin{async request(e){const t=g(e,e.webFetchExtra),n=((e,t=!0)=>e?Object.entries(e).reduce(((e,n)=>{const[s,i]=n;let r,o;return Array.isArray(i)?(o="",i.forEach((e=>{r=t?encodeURIComponent(e):e,o+=`${s}=${r}&`})),o.slice(0,-1)):(r=t?encodeURIComponent(i):i,o=`${s}=${r}`),`${e}&${o}`}),"").substr(1):null)(e.params,e.shouldEncodeUrlParams),s=n?`${e.url}?${n}`:e.url,i=await fetch(s,t),r=i.headers.get("content-type")||"";let o,a,{responseType:c="text"}=i.ok?e:{};switch(r.includes("application/json")&&(c="json"),c){case"arraybuffer":case"blob":a=await i.blob(),o=await(async e=>new Promise(((t,n)=>{const s=new FileReader;s.onload=()=>{const e=s.result;t(e.indexOf(",")>=0?e.split(",")[1]:e)},s.onerror=e=>n(e),s.readAsDataURL(e)})))(a);break;case"json":o=await i.json();break;default:o=await i.text()}const l={};return i.headers.forEach(((e,t)=>{l[t]=e})),{data:o,headers:l,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}const _=c("CapacitorHttp",{web:()=>new CapacitorHttpPluginWeb})},8453:(e,t,n)=>{"use strict";var s,i=n(1987),r=n.n(i);class AuthUtils{}s=AuthUtils,AuthUtils.isCordova=()=>!!(window.cordova||window.phonegap||window.PhoneGap),AuthUtils.isCapacitor=()=>{var e;return!(null==(e=window.Capacitor)||!e.isNativePlatform())},AuthUtils.isNativeMobile=()=>s.isCapacitor()||s.isCordova(),AuthUtils.decodeJwt=e=>{try{return e?r()(e):e}catch(t){return console.warn("[@badisi/auth-js] Access token was not decoded as it is not a valid JWT."),e}},AuthUtils.isUrlMatching=(e,t)=>{if(void 0!==t){const n=new URL(e,"http://test"),s=new URL(t,"http://test");if(""!==s.pathname&&"/"!==s.pathname&&!n.pathname.includes(s.pathname))return!1;if("http://test"!==s.origin&&(n.protocol!==s.protocol||n.origin!==s.origin||!`${n.origin}${n.pathname}}`.includes(`${s.origin}${s.pathname}`)))return!1;let i=!0;return s.searchParams.forEach(((e,t)=>{n.searchParams.getAll(t).includes(e)||(i=!1)})),i}return!1},AuthUtils.getBaseUrl=()=>{var e;const t=document.baseURI||(null==(e=document.querySelector("base"))?void 0:e.href)||location.origin;return t.endsWith("/")?t:`${t}/`},AuthUtils.stringToURL=e=>{try{return new URL(e)}catch(t){const n=e.startsWith("/")?e.substring(1,e.length):e;return new URL(`${s.getBaseUrl()}${n}`)}};const o=document.createElement("template");o.innerHTML='\n \n \n \n \n \n';class AppElement extends HTMLElement{constructor(){var e;super(),this.demoAppMainEl=void 0,this.demoAppPlaygroundEl=void 0,this.demoAppDebugEl=void 0,this.authManagerSubs=[],this.listeners=[],this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(o.content,!0))}connectedCallback(){this.demoAppMainEl=this.shadowRoot.querySelector("demo-app-main"),this.demoAppPlaygroundEl=this.shadowRoot.querySelector("demo-app-playground"),this.demoAppDebugEl=this.shadowRoot.querySelector("demo-app-debug"),this.listenForHeaderEvents(),this.listenForPlaygroundEvents(),this.listenForAuthChanges()}disconnectedCallback(){this.authManagerSubs.forEach((e=>e.unsubscribe())),this.listeners.forEach((e=>e()))}async callPrivateApi(e,t){if(window.authManager&&e){var n;const s=null!=(n=await window.authManager.getAccessToken())?n:"",i=new XMLHttpRequest;i.onreadystatechange=()=>{if(4===i.readyState){var e;let s;try{var t;s=JSON.parse(null!=(t=i.responseText)?t:"")}catch(n){s=`${i.status} ${i.statusText}`}null==(e=this.demoAppPlaygroundEl)||e.setApiStatus(s,200!==i.status)}},i.open("GET",e,!0),i.setRequestHeader("Authorization",`Bearer ${s}`),null==t||t.split(";").forEach((e=>{if(e){var t,n;const s=e.split(":");i.setRequestHeader(null==(t=s[0])?void 0:t.trim(),(null==(n=s[1])?void 0:n.trim())||"")}})),i.send()}}refreshInfo(e,t){if(window.authManager&&this.demoAppMainEl&&this.demoAppDebugEl)switch(e){case"renewing":this.demoAppMainEl.isRenewing=t;break;case"authenticated":this.demoAppMainEl.isAuthenticated=t,this.demoAppDebugEl.isAuthenticated=t;break;case"userSession":this.demoAppDebugEl.userSession=t;break;case"accessToken":this.demoAppDebugEl.accessToken=t,this.demoAppDebugEl.accessTokenDecoded=AuthUtils.decodeJwt(t);break;case"idToken":this.demoAppDebugEl.idToken=t,this.demoAppDebugEl.idTokenDecoded=AuthUtils.decodeJwt(t);break;case"userProfile":this.demoAppDebugEl.userProfile=t}}listenForAuthChanges(){const e=window.authManager;e&&this.authManagerSubs.push(e.onRenewingChanged((e=>this.refreshInfo("renewing",e))),e.onAuthenticatedChanged((e=>this.refreshInfo("authenticated",e))),e.onUserSessionChanged((e=>this.refreshInfo("userSession",e))),e.onAccessTokenChanged((e=>this.refreshInfo("accessToken",e))),e.onIdTokenChanged((e=>this.refreshInfo("idToken",e))),e.onUserProfileChanged((e=>this.refreshInfo("userProfile",e))))}listenForPlaygroundEvents(){if(this.demoAppPlaygroundEl){const e=e=>{var t,n;this.callPrivateApi(null==(t=e.detail)?void 0:t.url,null==(n=e.detail)?void 0:n.headers)};this.demoAppPlaygroundEl.addEventListener("api",e),this.listeners.push((()=>{var t;return null==(t=this.demoAppPlaygroundEl)?void 0:t.removeEventListener("api",e)}))}}listenForHeaderEvents(){const e=window.authManager;if(e&&this.demoAppMainEl){const t=()=>{e.login()};this.demoAppMainEl.addEventListener("login",t);const n=()=>{e.logout({redirectUrl:"/"}).then((()=>{var e;const t=document.baseURI||(null==(e=document.querySelector("base"))?void 0:e.href)||location.origin;location.href=t.endsWith("/")?t:`${t}/`}))};this.demoAppMainEl.addEventListener("logout",n);const s=()=>{e.renew()};this.demoAppMainEl.addEventListener("silentRenew",s),this.listeners.push((()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("login",t)}),(()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("logout",n)}),(()=>{var e;return null==(e=this.demoAppMainEl)?void 0:e.removeEventListener("silentRenew",s)}))}}}customElements.define("app-root",AppElement);const a=function(){this.__data__=[],this.size=0};const c=function(e,t){return e===t||e!=e&&t!=t};const l=function(e,t){for(var n=e.length;n--;)if(c(e[n][0],t))return n;return-1};var d=Array.prototype.splice;const u=function(e){var t=this.__data__,n=l(t,e);return!(n<0)&&(n==t.length-1?t.pop():d.call(t,n,1),--this.size,!0)};const h=function(e){var t=this.__data__,n=l(t,e);return n<0?void 0:t[n][1]};const p=function(e){return l(this.__data__,e)>-1};const g=function(e,t){var n=this.__data__,s=l(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this};function _(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=9007199254740991};const We=function(e){return null!=e&&$e(e.length)&&!O(e)};const De=function(e){return Oe(e)&&We(e)};var Be=n(2160),Fe=Function.prototype,ze=Object.prototype,Je=Fe.toString,Ke=ze.hasOwnProperty,Ve=Je.call(Object);const Ge=function(e){if(!Oe(e)||"[object Object]"!=I(e))return!1;var t=Ae(e);if(null===t)return!0;var n=Ke.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Je.call(n)==Ve};var Qe={};Qe["[object Float32Array]"]=Qe["[object Float64Array]"]=Qe["[object Int8Array]"]=Qe["[object Int16Array]"]=Qe["[object Int32Array]"]=Qe["[object Uint8Array]"]=Qe["[object Uint8ClampedArray]"]=Qe["[object Uint16Array]"]=Qe["[object Uint32Array]"]=!0,Qe["[object Arguments]"]=Qe["[object Array]"]=Qe["[object ArrayBuffer]"]=Qe["[object Boolean]"]=Qe["[object DataView]"]=Qe["[object Date]"]=Qe["[object Error]"]=Qe["[object Function]"]=Qe["[object Map]"]=Qe["[object Number]"]=Qe["[object Object]"]=Qe["[object RegExp]"]=Qe["[object Set]"]=Qe["[object String]"]=Qe["[object WeakMap]"]=!1;const Xe=function(e){return Oe(e)&&$e(e.length)&&!!Qe[I(e)]};const Ye=function(e){return function(t){return e(t)}};var Ze=n(2485),et=Ze.A&&Ze.A.isTypedArray;const tt=et?Ye(et):Xe;const nt=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var st=Object.prototype.hasOwnProperty;const it=function(e,t,n){var s=e[t];st.call(e,t)&&c(s,n)&&(void 0!==n||t in e)||ve(e,t,n)};const rt=function(e,t,n,s){var i=!n;n||(n={});for(var r=-1,o=t.length;++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(kt);const Tt=function(e,t){return xt(yt(e,t,wt),e+"")};const Ct=function(e,t,n){if(!P(n))return!1;var s=typeof t;return!!("number"==s?We(n)&&ct(t,n.length):"string"==s&&t in n)&&c(n[t],e)};const Ut=function(e){return Tt((function(t,n){var s=-1,i=n.length,r=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&Ct(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++s{},info:()=>{},warn:()=>{},error:()=>{}},Wt=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Wt||{});(It=Wt||(Wt={})).reset=function(){At=3,Rt=$t},It.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");At=e},It.setLogger=function(e){Rt=e};var Dt=class{constructor(e){this._name=e}debug(...e){At>=4&&Rt.debug(Dt._format(this._name,this._method),...e)}info(...e){At>=3&&Rt.info(Dt._format(this._name,this._method),...e)}warn(...e){At>=2&&Rt.warn(Dt._format(this._name,this._method),...e)}error(...e){At>=1&&Rt.error(Dt._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const n=new Dt(`${e}.${t}`);return n.debug("begin"),n}static _format(e,t){const n=`[${e}]`;return t?`${n} ${t}:`:n}static debug(e,...t){At>=4&&Rt.debug(Dt._format(e),...t)}static info(e,...t){At>=3&&Rt.info(Dt._format(e),...t)}static warn(e,...t){At>=2&&Rt.warn(Dt._format(e),...t)}static error(e,...t){At>=1&&Rt.error(Dt._format(e),...t)}};Wt.reset();var Bt,Ft,zt,Jt=class{static _randomWord(){return Ot().lib.WordArray.random(1).words[0]}static generateUUIDv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^Jt._randomWord()&15>>+e/4).toString(16))).replace(/-/g,"")}static generateCodeVerifier(){return Jt.generateUUIDv4()+Jt.generateUUIDv4()+Jt.generateUUIDv4()}static generateCodeChallenge(e){try{const t=Lt()(e);return Nt().stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){throw Dt.error("CryptoUtils.generateCodeChallenge",t),t}}static generateBasicAuth(e,t){const n=Ht().parse([e,t].join(":"));return Nt().stringify(n)}},Kt=class{constructor(e){this._name=e,this._logger=new Dt(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},Vt=class{static decode(e){try{return r()(e)}catch(t){throw Dt.error("JwtUtils.decode",t),t}}},Gt=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},Qt=class extends Kt{constructor(){super(...arguments),this._logger=new Dt(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-Qt.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=Qt.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const n=Qt.getEpochTime()+e;if(this.expiration===n&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=n;const s=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*s)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Xt=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const n=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(n.slice(1))}},Yt=class extends Error{constructor(e,t){var n,s,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw Dt.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(n=e.error_description)?n:null,this.error_uri=null!=(s=e.error_uri)?s:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null,this.url_state=e.url_state}},Zt=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},en=class{constructor(e){this._logger=new Dt("AccessTokenEvents"),this._expiringTimer=new Qt("Access token expiring"),this._expiredTimer=new Qt("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let e=n-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const s=n+1;t.debug("registering expired timer, raising in",s,"seconds"),this._expiredTimer.init(s)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},tn=class{constructor(e,t,n,s,i){this._callback=e,this._client_id=t,this._intervalInSeconds=s,this._stopOnError=i,this._logger=new Dt("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const r=new URL(n);this._frame_origin=r.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=r.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},nn=class{constructor(){this._logger=new Dt("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},sn=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new Dt("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:n,...s}=t;if(!n)return await fetch(e,s);const i=new AbortController,r=setTimeout((()=>i.abort()),1e3*n);try{return await fetch(e,{...t,signal:i.signal})}catch(o){if(o instanceof DOMException&&"AbortError"===o.name)throw new Zt("Network timed out");throw o}finally{clearTimeout(r)}}async getJson(e,{token:t,credentials:n}={}){const s=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let r;t&&(s.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{s.debug("url:",e),r=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:n})}catch(c){throw s.error("Network Error"),c}s.debug("HTTP response received, status",r.status);const o=r.headers.get("Content-Type");if(o&&!this._contentTypes.find((e=>o.startsWith(e)))&&s.throw(new Error(`Invalid response Content-Type: ${null!=o?o:"undefined"}, from URL: ${e}`)),r.ok&&this._jwtHandler&&(null==o?void 0:o.startsWith("application/jwt")))return await this._jwtHandler(await r.text());let a;try{a=await r.json()}catch(c){if(s.error("Error parsing JSON response",c),r.ok)throw c;throw new Error(`${r.statusText} (${r.status})`)}if(!r.ok){if(s.error("Error from server:",a),a.error)throw new Yt(a);throw new Error(`${r.statusText} (${r.status}): ${JSON.stringify(a)}`)}return a}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:s,initCredentials:i}){const r=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let a;void 0!==n&&(o.Authorization="Basic "+n),this.appendExtraHeaders(o);try{r.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:s,credentials:i})}catch(u){throw r.error("Network error"),u}r.debug("HTTP response received, status",a.status);const c=a.headers.get("Content-Type");if(c&&!this._contentTypes.find((e=>c.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=c?c:"undefined"}, from URL: ${e}`);const l=await a.text();let d={};if(l)try{d=JSON.parse(l)}catch(u){if(r.error("Error parsing JSON response",u),a.ok)throw u;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(r.error("Error from server:",d),d.error)throw new Yt(d,t);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(d)}`)}return d}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),s=["authorization","accept","content-type"];0!==n.length&&n.forEach((n=>{if(s.includes(n.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",n,s);const i="function"==typeof this._extraHeaders[n]?this._extraHeaders[n]():this._extraHeaders[n];i&&""!==i&&(e[n]=i)}))}},rn=class{constructor(e){this._settings=e,this._logger=new Dt("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new sn(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const n=this._logger.create(`_getMetadataProperty('${e}')`),s=await this.getMetadata();if(n.debug("resolved"),void 0===s[e]){if(!0===t)return void n.warn("Metadata does not contain optional property");n.throw(new Error("Metadata does not contain property "+e))}return s[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const n=await this._jsonService.getJson(t);if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},on=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new Dt("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let n=0;n{const t=this._logger.create("_getClaimsFromJwt");try{const n=Vt.decode(e);return t.debug("JWT decoding successful"),n}catch(n){throw t.error("Error parsing JWT response"),n}},this._jsonService=new sn(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);const s=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",s),s}},ln=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new Dt("TokenClient"),this._jsonService=new sn(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:s=this._settings.client_secret,...i}){const r=this._logger.create("exchangeCode");n||r.throw(new Error("A client_id is required")),t||r.throw(new Error("A redirect_uri is required")),i.code||r.throw(new Error("A code is required"));const o=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[d,u]of Object.entries(i))null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!s)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(n,s);break;case"client_secret_post":o.append("client_id",n),s&&o.append("client_secret",s)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:s=this._settings.scope,...i}){const r=this._logger.create("exchangeCredentials");t||r.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e,scope:s});for(const[d,u]of Object.entries(i))null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(t,n);break;case"client_secret_post":o.append("client_id",t),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:s,...i}){const r=this._logger.create("exchangeRefreshToken");t||r.throw(new Error("A client_id is required")),i.refresh_token||r.throw(new Error("A refresh_token is required"));const o=new URLSearchParams({grant_type:e});for(const[d,u]of Object.entries(i))Array.isArray(u)?u.forEach((e=>o.append(d,e))):null!=u&&o.set(d,u);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw r.throw(new Error("A client_secret is required")),null;a=Jt.generateBasicAuth(t,n);break;case"client_secret_post":o.append("client_id",t),n&&o.append("client_secret",n)}const c=await this._metadataService.getTokenEndpoint(!1);r.debug("got token endpoint");const l=await this._jsonService.postForm(c,{body:o,basicAuth:a,timeoutInSeconds:s,initCredentials:this._settings.fetchRequestCredentials});return r.debug("got response"),l}async revoke(e){var t;const n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));const s=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[r,o]of Object.entries(e))null!=o&&i.set(r,o);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(s,{body:i}),n.debug("got response")}},dn=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new Dt("ResponseValidator"),this._userInfoService=new cn(this._settings,this._metadataService),this._tokenClient=new ln(this._settings,this._metadataService)}async validateSigninResponse(e,t){const n=this._logger.create("validateSigninResponse");this._processSigninState(e,t),n.debug("state processed"),await this._processCode(e,t),n.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),n.debug("claims processed")}async validateCredentialsResponse(e,t){const n=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),n.debug("claims processed")}async validateRefreshResponse(e,t){const n=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),n.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const s=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,s),n.debug("claims processed")}validateSignoutResponse(e,t){const n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new Yt(e)}_processSigninState(e,t){const n=this._logger.create("_processSigninState");if(t.id!==e.state&&n.throw(new Error("State does not match")),t.client_id||n.throw(new Error("No client_id on state")),t.authority||n.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&n.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&n.throw(new Error("client_id mismatch on settings vs. signin state")),n.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,null!=e.scope||(e.scope=t.scope),e.error)throw n.warn("Response was error",e.error),new Yt(e);t.code_verifier&&!e.code&&n.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){const s=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void s.debug("not loading user info");s.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);s.debug("user info claims received from user info endpoint"),n&&i.sub!==e.profile.sub&&s.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),s.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const n=this._logger.create("_processCode");if(e.code){n.debug("Validating code");const s=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,s)}else n.debug("No code to process")}_validateIdTokenAttributes(e,t){var n;const s=this._logger.create("_validateIdTokenAttributes");s.debug("decoding ID Token JWT");const i=Vt.decode(null!=(n=e.id_token)?n:"");if(i.sub||s.throw(new Error("ID Token is missing a subject claim")),t){const e=Vt.decode(t);i.sub!==e.sub&&s.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&s.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&s.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&s.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}},un=class{constructor(e){this.id=e.id||Jt.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=Qt.getEpochTime(),this.request_type=e.request_type,this.url_state=e.url_state}toStorageString(){return new Dt("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(e){return Dt.createStatic("State","fromStorageString"),new un(JSON.parse(e))}static async clearStaleState(e,t){const n=Dt.createStatic("State","clearStaleState"),s=Qt.getEpochTime()-t,i=await e.getAllKeys();n.debug("got keys",i);for(let o=0;ow.searchParams.append("resource",e)))}for(const[b,y]of Object.entries({response_mode:a,...f,...g}))null!=y&&w.searchParams.append(b,y.toString());this.url=w.href}},gn=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const e=decodeURIComponent(this.state).split(";");this.state=e[0],e.length>1&&(this.url_state=e.slice(1).join(";"))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Qt.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+Qt.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},_n=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:s,extraQueryParams:i,request_type:r,client_id:o}){if(this._logger=new Dt("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const a=new URL(e);n&&a.searchParams.append("id_token_hint",n),o&&a.searchParams.append("client_id",o),s&&(a.searchParams.append("post_logout_redirect_uri",s),t&&(this.state=new un({data:t,request_type:r}),a.searchParams.append("state",this.state.id)));for(const[c,l]of Object.entries({...i}))null!=l&&a.searchParams.append(c,l.toString());this.url=a.href}},mn=class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},fn=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],wn=["sub","iss","aud","exp","iat"],vn=class{constructor(e){this._settings=e,this._logger=new Dt("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:fn;for(const n of e)wn.includes(n)||delete t[n]}return t}mergeClaims(e,t){const n={...e};for(const[s,i]of Object.entries(t))for(const e of Array.isArray(i)?i:[i]){const t=n[s];void 0===t?n[s]=e:Array.isArray(t)?t.includes(e)||t.push(e):n[s]!==e&&("object"==typeof e&&this._settings.mergeClaims?n[s]=this.mergeClaims(t,e):n[s]=[t,e])}return n}},bn=class{constructor(e,t){this._logger=new Dt("OidcClient"),this.settings=e instanceof an?e:new an(e),this.metadataService=null!=t?t:new rn(this.settings),this._claimsService=new vn(this.settings),this._validator=new dn(this.settings,this.metadataService,this._claimsService),this._tokenClient=new ln(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:s,id_token_hint:i,login_hint:r,skipUserInfo:o,nonce:a,url_state:c,response_type:l=this.settings.response_type,scope:d=this.settings.scope,redirect_uri:u=this.settings.redirect_uri,prompt:h=this.settings.prompt,display:p=this.settings.display,max_age:g=this.settings.max_age,ui_locales:_=this.settings.ui_locales,acr_values:m=this.settings.acr_values,resource:f=this.settings.resource,response_mode:w=this.settings.response_mode,extraQueryParams:v=this.settings.extraQueryParams,extraTokenParams:b=this.settings.extraTokenParams}){const y=this._logger.create("createSigninRequest");if("code"!==l)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const S=await this.metadataService.getAuthorizationEndpoint();y.debug("Received authorization endpoint",S);const k=new pn({url:S,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:u,response_type:l,scope:d,state_data:e,url_state:c,prompt:h,display:p,max_age:g,ui_locales:_,id_token_hint:i,login_hint:r,acr_values:m,resource:f,request:t,request_uri:n,extraQueryParams:v,extraTokenParams:b,request_type:s,response_mode:w,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:a,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const E=k.state;return await this.settings.stateStore.set(E.id,E.toStorageString()),k}async readSigninResponseState(e,t=!1){const n=this._logger.create("readSigninResponseState"),s=new gn(Xt.readParams(e,this.settings.response_mode));if(!s.state)throw n.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](s.state);if(!i)throw n.throw(new Error("No matching state found in storage")),null;return{state:hn.fromStorageString(i),response:s}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:n,response:s}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(s,n),s}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:s={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...s}),r=new gn(new URLSearchParams);return Object.assign(r,i),await this._validator.validateCredentialsResponse(r,n),r}async useRefreshToken({state:e,timeoutInSeconds:t}){var n;const s=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(n=e.scope)?void 0:n.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const r=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,resource:e.resource,scope:i,timeoutInSeconds:t}),o=new gn(new URLSearchParams);return Object.assign(o,r),s.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:s,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:r=this.settings.extraQueryParams}={}){const o=this._logger.create("createSignoutRequest"),a=await this.metadataService.getEndSessionEndpoint();if(!a)throw o.throw(new Error("No end session endpoint")),null;o.debug("Received end session endpoint",a),n||!i||t||(n=this.settings.client_id);const c=new _n({url:a,id_token_hint:t,client_id:n,post_logout_redirect_uri:i,state_data:e,extraQueryParams:r,request_type:s});await this.clearStaleState();const l=c.state;return l&&(o.debug("Signout request has state to persist"),await this.settings.stateStore.set(l.id,l.toStorageString())),c}async readSignoutResponseState(e,t=!1){const n=this._logger.create("readSignoutResponseState"),s=new mn(Xt.readParams(e,this.settings.response_mode));if(!s.state){if(n.debug("No state in response"),s.error)throw n.warn("Response was error:",s.error),new Yt(s);return{state:void 0,response:s}}const i=await this.settings.stateStore[t?"remove":"get"](s.state);if(!i)throw n.throw(new Error("No matching state found in storage")),null;return{state:un.fromStorageString(i),response:s}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:n,response:s}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(s,n)):t.debug("No state from storage; skipping response validation"),s}clearStaleState(){return this._logger.create("clearStaleState"),un.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},yn=class{constructor(e){this._userManager=e,this._logger=new Dt("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const n=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,n.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,n.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){n.debug("initializing check session iframe");const s=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,r=this._userManager.settings.stopCheckSessionOnError,o=new tn(this._callback,s,e,i,r);await o.load(),this._checkSessionIFrame=o,o.start(t)}else n.warn("no check session iframe found in the metadata")}catch(s){n.error("Error from getCheckSessionIframe:",s instanceof Error?s.message:s)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(n){e.error("error from querySessionStatus",n instanceof Error?n.message:n)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let n=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(n=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),n?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}},Sn=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState,this.url_state=e.url_state}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Qt.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+Qt.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new Dt("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return Dt.createStatic("User","fromStorageString"),new Sn(JSON.parse(e))}},kn="oidc-client",En=class{constructor(){this._abort=new Kt("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:n,keepOpen:s}=await new Promise(((n,s)=>{const i=i=>{var r;const o=i.data,a=null!=(r=e.scriptOrigin)?r:window.location.origin;if(i.origin===a&&(null==o?void 0:o.source)===kn){try{const n=Xt.readParams(o.url,e.response_mode).get("state");if(n||t.warn("no state found in response url"),i.source!==this._window&&n!==e.state)return}catch(c){this._dispose(),s(new Error("Invalid response from window"))}n(o)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),s(e)})))}));return t.debug("got response from window"),this._dispose(),s||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,s=window.location.origin){e.postMessage({source:kn,url:t,keepOpen:n},s)}},xn={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Tn="_blank",Cn=60,Un=2,An=10,Rn=class extends an{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:s=xn,popupWindowTarget:i=Tn,redirectMethod:r="assign",redirectTarget:o="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,silent_redirect_uri:l=e.redirect_uri,silentRequestTimeoutInSeconds:d=An,automaticSilentRenew:u=!0,validateSubOnSilentRenew:h=!0,includeIdTokenInSilentRenew:p=!1,monitorSession:g=!1,monitorAnonymousSession:_=!1,checkSessionIntervalInSeconds:m=Un,query_status_response_type:f="code",stopCheckSessionOnError:w=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:b=!1,includeIdTokenInSilentSignout:y=!1,accessTokenExpiringNotificationTimeInSeconds:S=Cn,userStore:k}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=s,this.popupWindowTarget=i,this.redirectMethod=r,this.redirectTarget=o,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=c,this.silent_redirect_uri=l,this.silentRequestTimeoutInSeconds=d,this.automaticSilentRenew=u,this.validateSubOnSilentRenew=h,this.includeIdTokenInSilentRenew=p,this.monitorSession=g,this.monitorAnonymousSession=_,this.checkSessionIntervalInSeconds=m,this.stopCheckSessionOnError=w,this.query_status_response_type=f,this.revokeTokenTypes=v,this.revokeTokensOnSignout=b,this.includeIdTokenInSilentSignout=y,this.accessTokenExpiringNotificationTimeInSeconds=S,k)this.userStore=k;else{const e="undefined"!=typeof window?window.sessionStorage:new nn;this.userStore=new on({store:e})}}},In=class extends En{constructor({silentRequestTimeoutInSeconds:e=An}){super(),this._logger=new Dt("IFrameWindow"),this._timeoutInSeconds=e,this._frame=In.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new Zt("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const n=e.target;null==(t=n.parentNode)||t.removeChild(n),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},Pn=class{constructor(e){this._settings=e,this._logger=new Dt("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new In({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),In.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},On=class extends En{constructor({popupWindowTarget:e=Tn,popupWindowFeatures:t={}}){super(),this._logger=new Dt("PopupWindow");const n=Gt.center({...xn,...t});this._window=window.open(void 0,e,Gt.serialize(n)),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout((()=>{this._window&&"boolean"==typeof this._window.closed&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))}),1e3*t.closePopupWindowAfterInSeconds)}async navigate(e){var t;null==(t=this._window)||t.focus();const n=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(n))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},jn=class{constructor(e){this._settings=e,this._logger=new Dt("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new On({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),On.notifyOpener(e,t)}},Ln=class{constructor(e){this._settings=e,this._logger=new Dt("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let s=window.self;"top"===t&&(s=null!=(n=window.top)?n:window.self);const i=s.location[e].bind(s.location);let r;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{r=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==r||r(new Error("Redirect aborted")),s.stop()}}}async callback(){}},Mn=class extends en{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new Dt("UserManagerEvents"),this._userLoaded=new Kt("User loaded"),this._userUnloaded=new Kt("User unloaded"),this._silentRenewError=new Kt("Silent renew error"),this._userSignedIn=new Kt("User signed in"),this._userSignedOut=new Kt("User signed out"),this._userSessionChanged=new Kt("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},Nn=class{constructor(e){this._userManager=e,this._logger=new Dt("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Qt("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof Zt)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},qn=class{constructor(e,t){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.resource=t,this.data=e.state}},Hn=class{constructor(e,t,n,s){this._logger=new Dt("UserManager"),this.settings=new Rn(e),this._client=new bn(e),this._redirectNavigator=null!=t?t:new Ln(this.settings),this._popupNavigator=null!=n?n:new jn(this.settings),this._iframeNavigator=null!=s?s:new Pn(this.settings),this._events=new Mn(this.settings),this._silentRenewService=new Nn(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new yn(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...n}=e,s=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...n},s)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){const s=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});s.debug("got signin response");const r=await this._buildUser(i);return r.profile&&r.profile.sub?s.info("success, signed in subject",r.profile.sub):s.info("no subject"),r}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:n,popupWindowTarget:s,...i}=e,r=this.settings.popup_redirect_uri;r||t.throw(new Error("No popup_redirect_uri configured"));const o=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:s}),a=await this._signin({request_type:"si:p",redirect_uri:r,display:"popup",...i},o);return a&&(a.profile&&a.profile.sub?t.info("success, signed in subject",a.profile.sub):t.info("no subject")),a}async signinPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t;const n=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:s,resource:i,...r}=e;let o=await this._loadUser();if(null==o?void 0:o.refresh_token){n.debug("using refresh token");const e=new qn(o,i);return await this._useRefreshToken(e)}const a=this.settings.silent_redirect_uri;let c;a||n.throw(new Error("No silent_redirect_uri configured")),o&&this.settings.validateSubOnSilentRenew&&(n.debug("subject prior to silent renew:",o.profile.sub),c=o.profile.sub);const l=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s});return o=await this._signin({request_type:"si:s",redirect_uri:a,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,...r},l,c),o&&((null==(t=o.profile)?void 0:t.sub)?n.info("success, signed in subject",o.profile.sub):n.info("no subject")),o}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),n=new Sn({...e,...t});return await this.storeUser(n),this._events.load(n),n}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...s}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const r=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==r?void 0:r.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...s},o);try{const e=await this._client.processSigninResponse(a.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof Yt)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(e,t,n){const s=await this._signinStart(e,t);return await this._signinEnd(s.url,n)}async _signinStart(e,t){const n=this._logger.create("_signinStart");try{const s=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:s.url,state:s.state.id,response_mode:s.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(s){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),s}}async _signinEnd(e,t){const n=this._logger.create("_signinEnd"),s=await this._client.processSigninResponse(e);n.debug("got signin response");return await this._buildUser(s,t)}async _buildUser(e,t){const n=this._logger.create("_buildUser"),s=new Sn(e);if(t){if(t!==s.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",s.profile.sub),new Yt({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(s),n.debug("user stored"),this._events.load(s),s}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:n,...s}=e,i=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...s},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:s,...i}=e,r=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:s});await this._signout({request_type:"so:p",post_logout_redirect_uri:r,state:null==r?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){const n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;const s=this._logger.create("_signoutStart");try{const i=await this._loadUser();s.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const r=e.id_token_hint||i&&i.id_token;r&&(s.debug("setting id_token_hint in signout request"),e.id_token_hint=r),await this.removeUser(),s.debug("user removed, creating signout request");const o=await this._client.createSignoutRequest(e);return s.debug("got signout request"),await t.navigate({url:o.url,state:null==(n=o.state)?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw s.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;const n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:s,...i}=e,r=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:r,...i},a),n.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const n=this._logger.create("_revokeInternal");if(!e)return;const s=t.filter((t=>"string"==typeof e[t]));if(s.length){for(const t of s)await this._client.revokeToken(e[t],t),n.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),n.debug("user stored"),this._events.load(e)}else n.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),Sn.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}};class AuthManager{}class AuthSubscriptions{constructor(){this.subscribers=[],this.lastNotifiedValue=void 0}add(e){return this.subscribers.push(e),this.lastNotifiedValue&&e(...this.lastNotifiedValue),{unsubscribe:()=>this.unsubscribe(e)}}notify(...e){this.lastNotifiedValue=e,this.subscribers.forEach((t=>{t(...e)}))}unsubscribe(e){if(e){const t=this.subscribers.indexOf(e);-1!==t&&this.subscribers.splice(t,1)}else this.subscribers=[]}}const $n=window.localStorage,Wn=null==(Bt=window.Capacitor)||null==(Bt=Bt.Plugins)?void 0:Bt.Storage,Dn=null==(Ft=window.Capacitor)||null==(Ft=Ft.Plugins)?void 0:Ft.Preferences,Bn=null==(zt=window.Capacitor)||null==(zt=zt.Plugins)?void 0:zt.SecureStoragePlugin;class MobileStorage{constructor(){if(this._logger=new Dt("MobileStorage"),!Bn){let e="[@badisi/auth-js] This application is currently using an unsafe storage.\n\n";e+="\u24d8 Please follow the recommended guide and use `capacitor-secure-storage-plugin` instead.",console.warn(e)}Bn?this._logger.debug("Using `capacitor-secure-storage-plugin` implementation"):Dn?this._logger.debug("Using `@capacitor/preferences` implementation"):Wn?this._logger.debug("Using `@capacitor/storage` implementation"):this._logger.debug("Using `localStorage` implementation")}get length(){return async function(){return Bn?(await Bn.keys()).value.length:Dn?(await Dn.keys()).keys.length:Wn?(await Wn.keys()).keys.length:$n.length}()}async key(e){return Bn?(await Bn.keys()).value[e]:Dn?(await Dn.keys()).keys[e]:Wn?(await Wn.keys()).keys[e]:$n.key(e)}async clear(){this._logger.create("clear"),Bn?await Bn.clear():Dn?await Dn.clear():Wn?await Wn.clear():$n.clear()}async getItem(e){if(this._logger.create(`getItem('${e}')`),!Bn)return Dn?(await Dn.get({key:e})).value:Wn?(await Wn.get({key:e})).value:$n.getItem(e);try{return(await Bn.get({key:e})).value}catch(t){return null}}async setItem(e,t){this._logger.create(`setItem('${e}')`),Bn?await Bn.set({key:e,value:t}):Dn?await Dn.set({key:e,value:t}):Wn?await Wn.set({key:e,value:t}):$n.setItem(e,t)}async removeItem(e){if(this._logger.create(`removeItem('${e}')`),Bn)try{await Bn.remove({key:e})}catch(t){}else Dn?await Dn.remove({key:e}):Wn?await Wn.remove({key:e}):$n.removeItem(e)}}let Fn=function(e){return e.REDIRECT="REDIRECT",e.POPUP="POPUP",e}({});class UserSession{constructor(){this.expired=void 0,this.expires_in=void 0,this.expires_at=void 0}static deserialize(e){const t=new UserSession,n=Object.keys(t);for(const s of n)t[s]=e[s];return t}}function zn(e,t){if(null==e)return{};var n,s,i={},r=Object.keys(e);for(s=0;s=0||(i[n]=e[n]);return i}var Jn,Kn;const Vn=null==(Jn=window.Capacitor)||null==(Jn=Jn.Plugins)?void 0:Jn.App,Gn=null==(Kn=window.Capacitor)||null==(Kn=Kn.Plugins)?void 0:Kn.Browser;class MobileWindow{constructor(e,t){if(this.redirectUrl=e,this.params=t,this._logger=new Dt("MobileWindow"),this.capacitorAppUrlOpenHandle=void 0,this.capacitorBrowserFinishedHandle=void 0,this.originalHandleOpenURL=window.handleOpenURL,this.timer=void 0,this.navigateLogger=void 0,this._resolve=void 0,this._reject=void 0,this._isClosed=!0,this._receivedResult=!1,!AuthUtils.isCapacitor()&&!AuthUtils.isCordova()){let e="[@badisi/auth-js] Required core dependency not found.\n\n";e+="\u24d8 Please follow the recommended guide and install either `Capacitor` or `Cordova` dependency.",console.error(e)}if(!Gn){let e="[@badisi/auth-js] Required plugin not found.\n\n";e+="\u24d8 Please follow the recommended guide and install either `@badisi/capacitor-browsertab` or `@capacitor/browser` plugin.",console.error(e)}Gn&&this._logger.debug("Using `@capacitor/browser` implementation")}async navigate(e){return this.navigateLogger=this._logger.create("navigate"),this.navigateLogger.debug("url",e.url),this._isClosed=!1,this._receivedResult=!1,new Promise(((t,n)=>{this._resolve=t,this._reject=n,this.installCustomUrlSchemeHandler().then((()=>{Gn&&this.useCapacitorBrowser(e)}))}))}async close(){const e=this._logger.create("close");this._isClosed||await(null==Gn?void 0:Gn.close().catch((t=>e.error(t)))),e.debug("success")}async cleanup(){var e,t;const n=this._logger.create("cleanup");window.handleOpenURL=this.originalHandleOpenURL,await(null==(e=this.capacitorBrowserFinishedHandle)?void 0:e.remove()),await(null==(t=this.capacitorAppUrlOpenHandle)?void 0:t.remove()),clearTimeout(this.timer),n.debug("success")}async onError(e){var t,n;null==(t=this.navigateLogger)||t.error("error response:",e),await this.close(),await this.cleanup(),null==(n=this._reject)||n.call(this,new Error(e)),this._receivedResult=!0}async onSuccess(e){var t,n;null==(t=this.navigateLogger)||t.debug("successful response:",e),await this.close(),await this.cleanup(),null==(n=this._resolve)||n.call(this,{url:e}),this._receivedResult=!0}async useCapacitorBrowser(e){this.capacitorBrowserFinishedHandle=await(null==Gn?void 0:Gn.addListener("browserFinished",(()=>{this._isClosed=!0,setTimeout((()=>{var e;this._receivedResult||(this.cleanup(),null==(e=this._reject)||e.call(this,"Capacitor browser closed by user"))}),1e3)}))),await(null==Gn?void 0:Gn.open({url:e.url,toolbarColor:this.params.mobileWindowToolbarColor,presentationStyle:this.params.mobileWindowPresentationStyle,width:this.params.mobileWindowWidth,height:this.params.mobileWindowWidth}))}async useBrowserTab(e){}async installCustomUrlSchemeHandler(){const e=this._logger.create("installCustomUrlSchemeHandler");this.timer=setTimeout((()=>{this.onError("Installing custom url scheme handler, timed out without a response")}),1e4),await this.cleanup(),AuthUtils.isCapacitor()?(e.debug("listening to Capacitor `appUrlOpen` event"),this.capacitorAppUrlOpenHandle=await(null==Vn||null==Vn.addListener?void 0:Vn.addListener("appUrlOpen",(({url:e})=>{AuthUtils.isUrlMatching(e,this.redirectUrl)&&this.onSuccess(e)})))):AuthUtils.isCordova()&&(e.debug("waiting for Cordova `handleOpenURL` callback"),window.handleOpenURL=e=>{var t;null==(t=this.originalHandleOpenURL)||t.call(this,e),AuthUtils.isUrlMatching(e,this.redirectUrl)&&this.onSuccess(e)}),e.debug("success")}}class MobileNavigator{constructor(){this._logger=new Dt("MobileNavigator")}prepare(e,t){return this._logger.create("prepare"),new MobileWindow(e,t)}}const Qn=["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"],Xn=["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"];class OidcUserManager extends Hn{constructor(e){super(Object.assign({authority:e.authorityUrl,client_id:e.clientId,scope:e.scope,loadUserInfo:e.loadUserInfo,automaticSilentRenew:e.automaticSilentRenew},e.internal)),this.libSettings=e,this._mobileNavigator=void 0,this._mobileNavigator=new MobileNavigator}async signoutMobile(e={}){var t,n,s,i;const r=this._logger.create("signout"),{mobileWindowToolbarColor:o,mobileWindowPresentationStyle:a,mobileWindowWidth:c,mobileWindowHeight:l}=e,d=zn(e,Qn),u={mobileWindowToolbarColor:null!=o?o:null==(t=this.libSettings.internal)?void 0:t.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=a?a:null==(n=this.libSettings.internal)?void 0:n.mobileWindowPresentationStyle,mobileWindowWidth:null!=c?c:null==(s=this.libSettings.internal)?void 0:s.mobileWindowWidth,mobileWindowHeight:null!=l?l:null==(i=this.libSettings.internal)?void 0:i.mobileWindowHeight},h=this._mobileNavigator.prepare(this.settings.post_logout_redirect_uri,u);try{await this._signout(Object.assign({request_type:"so:m",post_logout_redirect_uri:this.settings.post_logout_redirect_uri},d),h),r.info("success")}catch(p){r.error(p)}}async signinMobile(e={}){var t,n,s,i;const r=this._logger.create("signin"),{mobileWindowToolbarColor:o,mobileWindowPresentationStyle:a,mobileWindowWidth:c,mobileWindowHeight:l}=e,d=zn(e,Xn),u={mobileWindowToolbarColor:null!=o?o:null==(t=this.libSettings.internal)?void 0:t.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=a?a:null==(n=this.libSettings.internal)?void 0:n.mobileWindowPresentationStyle,mobileWindowWidth:null!=c?c:null==(s=this.libSettings.internal)?void 0:s.mobileWindowWidth,mobileWindowHeight:null!=l?l:null==(i=this.libSettings.internal)?void 0:i.mobileWindowHeight},h=this._mobileNavigator.prepare(this.settings.redirect_uri,u);try{var p;const e=await this._signin(Object.assign({request_type:"si:m",redirect_uri:this.settings.redirect_uri},d),h);null!=e&&null!=(p=e.profile)&&p.sub?r.info("success, signed in subject",e.profile.sub):r.info("no subject")}catch(g){r.error(g)}}}const Yn="auth-js:oidc_manager:redirect_url",Zn={loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!1,automaticSilentRenew:!0,desktopNavigationType:Fn.REDIRECT,scope:"openid profile email phone",logLevel:Wt.NONE,internal:{response_type:"code",redirect_uri:"?oidc-callback=login",post_logout_redirect_uri:"?oidc-callback=logout",popup_redirect_uri:"oidc/callback/popup_redirect.html",popup_post_logout_redirect_uri:"oidc/callback/popup_redirect.html",silent_redirect_uri:"oidc/callback/silent_redirect.html",mobileWindowPresentationStyle:"popover"}};class OIDCAuthManager extends AuthManager{constructor(...e){super(...e),this.idTokenSubs=new AuthSubscriptions,this.accessTokenSubs=new AuthSubscriptions,this.userProfileSubs=new AuthSubscriptions,this.userSessionSubs=new AuthSubscriptions,this.authenticatedSubs=new AuthSubscriptions,this.renewingSubs=new AuthSubscriptions,this.redirectSubs=new AuthSubscriptions,this.userManagerSubs=[],this._idToken=void 0,this._accessToken=void 0,this._userProfile=void 0,this._userSession=void 0,this._isAuthenticated=!1,this._isRenewing=!1,this.userManager=void 0,this.settings=Zn,this._user=void 0}set user(e){this._user!==e&&(this._user=e,this._idToken=e?e.id_token:void 0,this._accessToken=e?e.access_token:void 0,this._userProfile=null!=e&&e.profile?e.profile:void 0,this._userSession=e?UserSession.deserialize(e):void 0,this._isAuthenticated=!(!e||e.expired),this.idTokenSubs.notify(this._idToken),this.accessTokenSubs.notify(this._accessToken),this.userProfileSubs.notify(this._userProfile),this.userSessionSubs.notify(this._userSession),this.authenticatedSubs.notify(this._isAuthenticated))}async init(e){var t,n,s,i,r,o,a,c,l,d=this;Wt.setLevel(null!=(t=null!=(n=e.logLevel)?n:Zn.logLevel)?t:Wt.NONE),Wt.setLogger(console);const u=AuthUtils.isNativeMobile(),h=u?`${e.mobileScheme}://localhost/`:AuthUtils.getBaseUrl();if(this.settings=Ut({},Zn,{internal:{userStore:new on({store:u?new MobileStorage:new nn}),redirect_uri:`${h}${null==(s=Zn.internal)?void 0:s.redirect_uri}`,post_logout_redirect_uri:`${h}${null==(i=Zn.internal)?void 0:i.post_logout_redirect_uri}`,popup_redirect_uri:`${h}${null==(r=Zn.internal)?void 0:r.popup_redirect_uri}`,popup_post_logout_redirect_uri:`${h}${null==(o=Zn.internal)?void 0:o.popup_post_logout_redirect_uri}`,silent_redirect_uri:`${h}${null==(a=Zn.internal)?void 0:a.silent_redirect_uri}`}},e),this.patchAuth0Logout(),this.userManager=new OidcUserManager(this.settings),this.userManagerSubs.push(this.userManager.events.addUserLoaded((e=>{this.user=e})),this.userManager.events.addUserUnloaded((()=>{this.user&&(this.user=null,this.settings.loginRequired&&location.reload())})),this.userManager.events.addSilentRenewError((async function(){await d.removeUser()}))),this.assertNotInInceptionLoop(),AuthUtils.isUrlMatching(location.href,null==(c=this.settings.internal)?void 0:c.redirect_uri))await this.runSyncOrAsync((async function(){const e=sessionStorage.getItem(Yn);await d.callSignin((()=>d.userManager.signinRedirectCallback(location.href)),e),sessionStorage.removeItem(Yn)}));else if(AuthUtils.isUrlMatching(location.href,null==(l=this.settings.internal)?void 0:l.post_logout_redirect_uri))await this.runSyncOrAsync((async function(){const e=sessionStorage.getItem(Yn);await d.callSignout((()=>d.userManager.signoutRedirectCallback(location.href)),e),sessionStorage.removeItem(Yn)}));else if(this.settings.retrieveUserSession||this.settings.loginRequired){var p;const e=async function(){await d.runSyncOrAsync((()=>d.signinSilent().catch((async function(e){const{error:t,message:n}=e;if(d.settings.loginRequired&&(null!=t&&t.includes("_required")||null!=n&&n.includes("_required")))await d.login();else if(console.error("[OIDCAuthManager] User's session cannot be retrieved:",e.message),d.authenticatedSubs.notify(!1),d.settings.loginRequired)throw e}))))},t=await(null==(p=this.userManager)?void 0:p.getUser());!t||t.expired?!u&&this.settings.retrieveUserSession?await e():this.settings.loginRequired?await this.login():this.user=null:this.user=t}else this.user=null}async logout(e){var t,n;const s=null!=(t=null==e?void 0:e.redirectUrl)?t:location.href;var i;if(AuthUtils.isNativeMobile())await this.callSignout((()=>this.userManager.signoutMobile(e)),s);else switch(null!=(i=null==e?void 0:e.desktopNavigationType)?i:this.settings.desktopNavigationType){case Fn.POPUP:await this.callSignout((()=>this.userManager.signoutPopup(e)),s);break;case Fn.REDIRECT:default:sessionStorage.setItem(Yn,s),await(null==(n=this.userManager)?void 0:n.signoutRedirect(e))}}async login(e){var t,n;const s=null!=(t=null==e?void 0:e.redirectUrl)?t:location.href;var i;if(AuthUtils.isNativeMobile())await this.callSignin((()=>this.userManager.signinMobile(e)),s);else switch(null!=(i=null==e?void 0:e.desktopNavigationType)?i:this.settings.desktopNavigationType){case Fn.POPUP:await this.callSignin((()=>this.userManager.signinPopup(e)),s);break;case Fn.REDIRECT:default:sessionStorage.setItem(Yn,s),await(null==(n=this.userManager)?void 0:n.signinRedirect(e))}return this._isAuthenticated}async renew(e){return this.signinSilent(e).catch((e=>console.error(e)))}getSettings(){return this.settings}isRenewing(){return this._isRenewing}async isAuthenticated(){return await this.waitForRenew("isAuthenticated()"),this._isAuthenticated}async getUserProfile(){return await this.waitForRenew("getUserProfile()"),this._userProfile}async getUserSession(){return await this.waitForRenew("getUserSession()"),this._userSession}async getIdToken(){return await this.waitForRenew("getIdToken()"),this._idToken}async getIdTokenDecoded(){return await this.waitForRenew("getIdTokenDecoded()"),AuthUtils.decodeJwt(this._idToken)}async getAccessToken(){return await this.waitForRenew("getAccessToken()"),this._accessToken}async getAccessTokenDecoded(){return await this.waitForRenew("getAccessTokenDecoded()"),AuthUtils.decodeJwt(this._accessToken)}destroy(){this.idTokenSubs.unsubscribe(),this.accessTokenSubs.unsubscribe(),this.userProfileSubs.unsubscribe(),this.userSessionSubs.unsubscribe(),this.authenticatedSubs.unsubscribe(),this.renewingSubs.unsubscribe(),this.redirectSubs.unsubscribe(),this.userManagerSubs.forEach((e=>e()))}onIdTokenChanged(e){return this.idTokenSubs.add(e)}onAccessTokenChanged(e){return this.accessTokenSubs.add(e)}onUserProfileChanged(e){return this.userProfileSubs.add(e)}onUserSessionChanged(e){return this.userSessionSubs.add(e)}onAuthenticatedChanged(e){return this.authenticatedSubs.add(e)}onRenewingChanged(e){return this.renewingSubs.add(e)}onRedirect(e){return this.redirectSubs.add(e)}assertNotInInceptionLoop(){var e,t;[null==(e=this.settings.internal)?void 0:e.silent_redirect_uri,null==(t=this.settings.internal)?void 0:t.popup_redirect_uri].forEach((e=>{var t;const n=null==(t=new RegExp(/^.*\/(.*).html$/gm).exec(null!=e?e:""))?void 0:t[1],s=new Error(`[OIDCAuthManager] ${null!=e?e:"redirect uri"} was not found.`);if(s.stack=void 0,AuthUtils.isUrlMatching(location.href,e))throw s.message+="\n\n\u24d8 This usually means you forgot to include the redirect html files in your application assets.",s;if(location.href.includes(`/${n}.html`))throw s.message+="\n\n\u24d8 This usually means your redirect urls are misconfigured.",s}))}async waitForRenew(e){const t=Date.now();for(;this._isRenewing;){if(Date.now()>t+5e3){console.warn("[@badisi/auth-js]",`\`${e}\``,"timed out waiting for renew to finish.");break}await new Promise((e=>setTimeout(e,100)))}}postLogoutVerification(e){const t=AuthUtils.stringToURL(null!=e?e:"/");this.settings.loginRequired&&location.origin===t.origin&&location.reload()}notifyRenew(e){this._isRenewing=e,this.renewingSubs.notify(e)}async runSyncOrAsync(e){this.settings.loginRequired?await e():e()}async redirect(e,t){t&&(console.error(t),await this.removeUser());const n=AuthUtils.stringToURL(null!=e?e:"/");location.origin===n.origin?(history.replaceState(history.state,"",n.href),this.redirectSubs.notify(n)):location.href=n.href}async removeUser(){var e,t;this.user=null,await Promise.all([null==(e=this.userManager)?void 0:e.clearStaleState(),null==(t=this.userManager)?void 0:t.removeUser()])}async signinSilent(e){this.notifyRenew(!0);try{var t;await(null==(t=this.userManager)?void 0:t.signinSilent(e))}catch(n){throw await this.removeUser(),n}finally{this.notifyRenew(!1)}}async callSignin(e,t){try{this.notifyRenew(!0),await e().catch((e=>{var t;throw"Attempted to navigate on a disposed window"===(null==(t=e)?void 0:t.message)&&((e=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,e.message+="\n\n\u24d8 This may be due to an ad blocker."),e})),await this.redirect(t)}catch(n){await this.redirect("/",n)}finally{this.notifyRenew(!1)}}async callSignout(e,t){try{await e().catch((e=>{var t;throw"Attempted to navigate on a disposed window"===(null==(t=e)?void 0:t.message)&&((e=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,e.message+="\n\n\u24d8 This may be due to an ad blocker."),e})),await this.redirect(t),await this.removeUser()}catch(n){t="/",await this.redirect(t,n)}finally{this.postLogoutVerification(t)}}patchAuth0Logout(){if(this.settings.authorityUrl.endsWith("auth0.com")){var e,t;const{authorityUrl:n,clientId:s,desktopNavigationType:i}=this.settings,r=i===Fn.POPUP?null==(e=this.settings.internal)?void 0:e.popup_post_logout_redirect_uri:null==(t=this.settings.internal)?void 0:t.post_logout_redirect_uri;this.settings.internal=Ut({},{metadataSeed:{end_session_endpoint:`${n}/v2/logout?client_id=${s}&returnTo=${r}`}},this.settings.internal)}}}n(6503);const es='\n .flex {\n flex: 1;\n }\n\n .hidden {\n display: none !important;\n }\n\n .row {\n display: flex;\n flex-direction: row;\n }\n\n .column {\n display: flex;\n flex-direction: column;\n }\n\n .card {\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 4px;\n background-color: white;\n margin: 12px 6px;\n }\n\n .card .card-status {\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n margin-left: 8px;\n background-color: #f2f2f2;\n }\n .card .card-status.error {\n background-color: #ef5350;\n }\n .card .card-status.success {\n background-color: #66bb6a;\n }\n\n .card .card-title {\n padding: 16px;\n font-size: 20px;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.87);\n align-items: center;\n }\n\n .card .box {\n height: 200px;\n border-top: 1px solid lightgray;\n word-break: break-all;\n overflow: auto;\n background-color: #f2f2f2;\n padding: 12px;\n }\n .card .box pre {\n margin: 0;\n }\n\n .card .card-actions {\n padding: 0 14px 8px 14px;\n min-height: 50px;\n }\n .card .card-actions .input {\n display: flex;\n align-items: center;\n }\n .card .card-actions .input:not(:last-child) {\n margin-bottom: 8px;\n }\n .card .card-actions .input label {\n width: 125px;\n text-align: right;\n margin-right: 14px;\n }\n .card .card-actions .input input {\n padding: 4px;\n }\n\n .json-key {\n color: rgb(124, 77, 255);\n }\n\n .json-value {\n color: rgb(67, 122, 237);\n }\n\n .json-string {\n color: rgb(83, 160, 83);\n }\n\n .json-date {\n color: rgb(200, 56, 198);\n }\n\n input {\n color: #5e35b1;\n padding: 10px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n font-size: 14px;\n }\n\n input:invalid {\n border-color: #f44336;\n }\n\n input[type="checkbox"] {\n margin-right: 10px;\n }\n\n select {\n color: #5e35b1;\n padding: 8px 6px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n }\n\n @media only screen and (max-width: 600px) {\n :host {\n padding: 0 !important;\n padding-bottom: 24px !important;\n }\n\n :host .card {\n border-left: 0;\n border-right: 0;\n border-radius: 0;\n margin: 0;\n margin-bottom: 6px;\n }\n }\n',ts=(e,t=[])=>e?JSON.stringify(e,null,2).replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(/^( *)("[\w-]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/gm,((e,n,s,i,r)=>{let o=n||"";const a=s?s.replace(/[": ]/g,""):void 0;if(a&&(o+=`${a}: `),i&&(o+=`${i}`,a&&t.includes(a))){const e=new Date(1e3*Number(i)),t=`${e.toDateString()}, ${e.toLocaleTimeString()}`;t&&(o+=` (${t})`)}return o+(r||"")})):"",ns=document.createElement("template");ns.innerHTML=`\n \n\n
\n
\n\n \n \n \n \n \n \n \n \n\n
\n \ud83d\udee1\ufe0fDemo app { }\n
\ud83d\udc48 choose an implementation
\n
\n\n
\n\n
\n \n \n \n
\n
\n`;class DemoAppHeaderElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.implSelectEl=void 0,this.statusEl=void 0,this.versionEl=void 0,this.loginButtonEl=void 0,this.logoutButtonEl=void 0,this.silentRenewButtonEl=void 0,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(ns.content,!0)),this.implSelectEl=this.shadowRoot.querySelector("#implementation-select"),this.statusEl=this.shadowRoot.querySelector(".status"),this.versionEl=this.shadowRoot.querySelector(".version"),this.loginButtonEl=this.shadowRoot.querySelector("#login-button"),this.logoutButtonEl=this.shadowRoot.querySelector("#logout-button"),this.silentRenewButtonEl=this.shadowRoot.querySelector("#silent-renew-button")}set isRenewing(e){this.statusEl&&this.statusEl.classList[e?"add":"remove"]("loading")}set isAuthenticated(e){this.statusEl&&null!==e&&(this.statusEl.classList.remove("loading"),this.statusEl.title=e?"Authenticated":"Not authenticated",this.statusEl.classList[e?"add":"remove"]("authenticated"),this.statusEl.classList[e?"remove":"add"]("not-authenticated"))}connectedCallback(){if(window.location.href.includes("localhost")){const e=document.createElement("option");e.textContent="localhost",this.implSelectEl.appendChild(e)}else{window.appSettings.getImplementations().forEach((e=>{const t=document.createElement("option");t.value=String(e.label),t.textContent=e.label,this.implSelectEl.appendChild(t)}));const e=()=>{window.location.href=window.appSettings.getImplementations()[this.implSelectEl.selectedIndex].demoUrl};this.implSelectEl.addEventListener("change",e),this.listeners.push((()=>this.implSelectEl.removeEventListener("change",e)))}const e=()=>{var e;null==(e=this.shadowRoot)||null==(e=e.querySelector("header .title .tip"))||e.remove(),window.appSettings.setShowTip(!1)};window.appSettings.get().showTip?(this.implSelectEl.addEventListener("click",e,{once:!0}),this.listeners.push((()=>this.implSelectEl.removeEventListener("click",e)))):e(),this.refreshImplementation(),this.addEventListeners()}disconnectedCallback(){this.listeners.forEach((e=>e()))}addEventListeners(){var e,t,n;const s=()=>this.dispatchEvent(new Event("login",{bubbles:!0,composed:!0}));null==(e=this.loginButtonEl)||e.addEventListener("click",s);const i=()=>this.dispatchEvent(new Event("logout",{bubbles:!0,composed:!0}));null==(t=this.logoutButtonEl)||t.addEventListener("click",i);const r=()=>this.dispatchEvent(new Event("silentRenew",{bubbles:!0,composed:!0}));null==(n=this.silentRenewButtonEl)||n.addEventListener("click",r),this.listeners.push((()=>{var e;return null==(e=this.loginButtonEl)?void 0:e.removeEventListener("click",s)}),(()=>{var e;return null==(e=this.logoutButtonEl)?void 0:e.removeEventListener("click",i)}),(()=>{var e;return null==(e=this.silentRenewButtonEl)?void 0:e.removeEventListener("click",r)}))}refreshImplementation(){const e=window.appSettings.getImplementations();if(window.location.href.includes("localhost"))this.implSelectEl.selectedIndex=0,this.versionEl.innerHTML="@localhost";else{const t=e.findIndex((e=>window.location.href.includes(e.demoUrl))),n=-1!==t?e[t]:e[0];this.implSelectEl.selectedIndex=-1!==t?t:0,this.versionEl.innerHTML=n.version}}}window.customElements.define("demo-app-header",DemoAppHeaderElement);const ss=document.createElement("template");ss.innerHTML=`\n \n\n \n \n
\n \n
\n`;class DemoAppMainElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.tabsContentEl=void 0,this.demoAppHeaderEl=void 0,this.tabs=[],this.views=[],this.currentTabIndex=-1,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(ss.content,!0)),this.tabsContentEl=this.shadowRoot.querySelector(".tabs-content"),this.demoAppHeaderEl=this.shadowRoot.querySelector("demo-app-header")}set isRenewing(e){this.demoAppHeaderEl.isRenewing=e}set isAuthenticated(e){this.demoAppHeaderEl.isAuthenticated=e}connectedCallback(){this.drawTabs(),this.showView(window.appSettings?window.appSettings.get().currentTabIndex:0)}disconnectedCallback(){this.listeners.forEach((e=>e()))}drawTabs(){const e=this.shadowRoot.querySelector("#views"),t=this.shadowRoot.querySelector("#tabs");e&&t&&(this.views=e.assignedElements(),this.views.forEach(((e,n)=>{e.style.display="none";const s=document.createElement("a");s.textContent=e.getAttribute("tabLabel")||"?";const i=()=>this.showView(n);s.addEventListener("click",i),this.listeners.push((()=>s.removeEventListener("click",i))),t.appendChild(s),this.tabs.push(s)})))}showView(e){var t;this.currentTabIndex!==e&&(this.currentTabIndex=e,this.tabs.forEach(((t,n)=>{t.classList[n!==e?"remove":"add"]("selected")})),this.views.forEach(((t,n)=>{t.style.display=n!==e?"none":"flex"})),null==(t=this.tabsContentEl)||t.scrollTo(0,0),window.appSettings.setCurrentTabIndex(e))}}window.customElements.define("demo-app-main",DemoAppMainElement);const is=document.createElement("template");is.innerHTML=`\n \n\n
\n
\n APIs access\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n \n
\n            
\n
\n
\n\n \n`;class DemoAppPlaygroundElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.apiStatusEl=void 0,this.apiResponseEl=void 0,this.apiUrlEl=void 0,this.apiHeadersEl=void 0,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(is.content,!0)),this.apiStatusEl=this.shadowRoot.querySelector("#api-status"),this.apiResponseEl=this.shadowRoot.querySelector("#api-response"),this.apiUrlEl=this.shadowRoot.querySelector("#api-url-input"),this.apiHeadersEl=this.shadowRoot.querySelector("#api-headers-input")}connectedCallback(){var e,t,n;const s=null==(e=this.shadowRoot)?void 0:e.querySelector("#api-get-button"),i=()=>{const e=new CustomEvent("api",{bubbles:!0,composed:!0,detail:{url:this.apiUrlEl.value,headers:this.apiHeadersEl.value}});return this.dispatchEvent(e)};null==s||s.addEventListener("click",i);const r=()=>this.saveSettings({privateApiUrl:this.apiUrlEl.value});null==(t=this.apiUrlEl)||t.addEventListener("input",r);const o=()=>this.saveSettings({privateApiHeaders:this.apiHeadersEl.value});null==(n=this.apiHeadersEl)||n.addEventListener("input",o),this.listeners.push((()=>null==s?void 0:s.removeEventListener("click",i)),(()=>{var e;return null==(e=this.apiUrlEl)?void 0:e.removeEventListener("input",r)}),(()=>{var e;return null==(e=this.apiHeadersEl)?void 0:e.removeEventListener("input",o)}));const{otherSettings:a}=window.appSettings.getCurrentUserSettings();this.apiUrlEl.value=null==a?void 0:a.privateApiUrl,this.apiHeadersEl.value=null==a?void 0:a.privateApiHeaders}disconnectedCallback(){this.listeners.forEach((e=>e()))}setApiStatus(e,t){this.apiStatusEl.classList.remove(t?"success":"error"),this.apiStatusEl.classList.add(t?"error":"success"),this.apiResponseEl.innerHTML=ts(e)}saveSettings(e){const t=window.appSettings.getCurrentUserSettings();t.otherSettings=Object.assign({},t.otherSettings,e),window.appSettings.addOrUpdateUserSettings(t)}}window.customElements.define("demo-app-playground",DemoAppPlaygroundElement);const rs=document.createElement("template");rs.innerHTML=`\n \n\n
\n
\n
Authenticated
\n \n
\n            
\n
\n\n
\n
User session
\n \n
\n            
\n
\n\n
\n
Access token
\n \n
\n                
\n            
\n
\n\n
\n
Id token
\n \n
\n                
\n            
\n
\n\n
\n
User profile
\n \n
\n            
\n
\n
\n`;class DemoAppDebugElement extends HTMLElement{constructor(){var e;super(),this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(rs.content,!0)),this.isAuthenticated=!1,this.userSession=void 0,this.accessToken=void 0,this.accessTokenDecoded=void 0,this.idToken=void 0,this.idTokenDecoded=void 0,this.userProfile=void 0}set isAuthenticated(e){null!==e&&this.update("#isAuthenticated",e)}set userSession(e){this.update("#userSession",ts(e,["expires_at"]))}set accessToken(e){this.update("#accessToken",e)}set accessTokenDecoded(e){const t="string"!=typeof e?ts(e,["exp","iat","auth_time"]):"(no decoded info as it is not a JWT token)";this.update("#accessTokenDecoded",t)}set idToken(e){this.update("#idToken",e)}set idTokenDecoded(e){this.update("#idTokenDecoded",ts(e,["exp","iat","auth_time"]))}set userProfile(e){this.update("#userProfile",ts(e))}update(e,t){var n;const s=null==(n=this.shadowRoot)?void 0:n.querySelector(e);var i,r;s&&(null==t||""===t?null==(i=s.closest(".info"))||i.classList.add("hidden"):(null==(r=s.closest(".info"))||r.classList.remove("hidden"),s.innerHTML=String(t)))}}window.customElements.define("demo-app-debug",DemoAppDebugElement);const os=document.createElement("template");os.innerHTML=`\n \n\n
\n \n
\n \n
\n
\n\n \n\n
\n
\n DELETE\n
\n
\n \n \n
\n
\n
\n`;class DemoAppSettingsElement extends HTMLElement{constructor(){var e;super(),this.listeners=[],this.formEl=void 0,this.formContentEl=void 0,this.selectEl=void 0,this.settingsNameEl=void 0,this.formIsDirty=!1,this.formIsNew=!1,this.attachShadow({mode:"open"}),null==(e=this.shadowRoot)||e.appendChild(document.importNode(os.content,!0))}connectedCallback(){var e,t,n,s,i;this.formEl=this.shadowRoot.querySelector("form"),this.formContentEl=this.shadowRoot.querySelector(".form-content"),this.selectEl=this.shadowRoot.querySelector("#settings-select"),this.settingsNameEl=this.shadowRoot.querySelector("#settingsName");const r=e=>{this.formIsDirty||"settings-select"===e.target.id||(this.formIsDirty=!0,this.classList.add("dirty"))};this.formEl.addEventListener("input",r),this.listeners.push((()=>this.formEl.removeEventListener("input",r))),this.refreshSelect();const o=()=>this.loadSettings(this.selectEl.value);null==(e=this.selectEl)||e.addEventListener("change",o),this.listeners.push((()=>this.selectEl.removeEventListener("change",o)));const a=null==(t=this.shadowRoot)?void 0:t.querySelector("#add-settings-button"),c=()=>this.add();null==a||a.addEventListener("click",c),this.listeners.push((()=>null==a?void 0:a.removeEventListener("click",c)));const l=null==(n=this.shadowRoot)?void 0:n.querySelector("#delete-settings-button"),d=()=>this.delete();null==l||l.addEventListener("click",d),this.listeners.push((()=>null==l?void 0:l.removeEventListener("click",d)));const u=null==(s=this.shadowRoot)?void 0:s.querySelector("#save-settings-button"),h=()=>this.saveAndReload();null==u||u.addEventListener("click",h),this.listeners.push((()=>null==u?void 0:u.removeEventListener("click",h)));const p=null==(i=this.shadowRoot)?void 0:i.querySelector("#cancel-settings-button"),g=()=>this.cancel();null==p||p.addEventListener("click",g),this.listeners.push((()=>null==p?void 0:p.removeEventListener("click",g))),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}disconnectedCallback(){this.listeners.forEach((e=>e()))}loadSettings(e){window.appSettings.setCurrentUserSettings(e),location.reload()}add(){const e="New settings",t=document.createElement("option");t.selected=!0,t.value=e,t.textContent=e,this.selectEl.appendChild(t),this.formIsNew=!0,this.formIsDirty=!0,this.classList.add("dirty"),this.refreshFormContent({name:e,librarySettings:{}})}delete(){window.appSettings.deleteCurrentUserSettings(),location.reload()}cancel(){this.formIsNew=!1,this.formIsDirty=!1,this.classList.remove("dirty"),this.refreshSelect(),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}setPathValue(e,t,n){const s=t.split(".");s.reduce(((e,t,i)=>(i===s.length-1?e[t]=n:Object.prototype.hasOwnProperty.call(e,t)||(e[t]={}),e[t])),e)}getPathValue(e,t){return t.split(".").reduce(((e,t)=>e?e[t]:e),e)}refreshSelect(){this.selectEl.innerHTML="";const{userSettings:e,currentUserSettingsId:t}=window.appSettings.get();e.sort(((e,t)=>e.name.localeCompare(t.name))).forEach((e=>{const n=document.createElement("option");n.selected=e.name===t,n.value=String(e.name),n.textContent=e.name,this.selectEl.appendChild(n)}))}refreshFormContent(e){this.formContentEl.innerHTML="";const{librarySettingsDefinition:t}=window.appSettings.get(),{name:n,librarySettings:s}=e;this.settingsNameEl.value=n,t.sort(((e,t)=>(t._sortIndex||0)-(e._sortIndex||0))).forEach((e=>{var t;const n=document.createElement("div");this.formContentEl.prepend(n);const i=document.createElement("label");i.htmlFor=e.name.replace(".",""),i.textContent=`${e.label}${e.required?" *":""}`;const r=document.createElement("list"===e.type?"select":"input");switch(r.id=e.name.replace(".",""),r.name=e.name.replace(".",""),r.required=!0===e.required,e.type){case"boolean":r.checked=this.getPathValue(s,e.name),r.type="checkbox",n.appendChild(r),n.appendChild(i);break;case"list":null==(t=e.values)||t.forEach((e=>{const t=document.createElement("option");t.value=String(e.value),t.textContent=e.label,r.appendChild(t)})),r.value=this.getPathValue(s,e.name),r.classList.add("flex"),n.classList.add("input","column"),n.appendChild(i),n.appendChild(r);break;default:{const t=this.getPathValue(s,e.name);"json"===e.type?r.value=t?JSON.stringify(t):"":r.value=null!=t?t:"",n.classList.add("input","column"),n.appendChild(i),n.appendChild(r);break}}}))}saveAndReload(){if(this.formEl.reportValidity()){const{librarySettingsDefinition:e}=window.appSettings.get(),t=this.formIsNew?{name:"",librarySettings:{}}:window.appSettings.getCurrentUserSettings();t.name=this.settingsNameEl.value,e.forEach((e=>{var n;const s=null==(n=this.shadowRoot)?void 0:n.querySelector(`#${e.name.replace(".","")}`);let i;switch(e.type){case"boolean":i=s.checked;break;case"list":default:i=s.value;break;case"json":try{const e=s.value;e&&""!==e.trim()&&(i=JSON.parse(e))}catch(r){console.error(r)}}this.setPathValue(t.librarySettings,e.name,i)})),window.appSettings.addOrUpdateUserSettings(t),this.formIsNew&&window.appSettings.setCurrentUserSettings(t.name),location.reload()}}}window.customElements.define("demo-app-settings",DemoAppSettingsElement);const as=JSON.parse('{"UU":"@badisi/auth-js","rE":"0.0.0-semantically-released","TB":"https://github.com/Badisi/auth-js/tree/main/projects/auth-js"}'),cs=JSON.parse('{"UU":"@badisi/ngx-auth","TB":"https://github.com/Badisi/auth-js/tree/main/projects/ngx-auth"}');const ls=[{name:"authorityUrl",label:"Authority url",type:"string",required:!0},{name:"clientId",label:"Client id",type:"string",required:!0},{name:"mobileScheme",label:"Custom mobile scheme name",type:"string"},{name:"scope",label:"Scope",type:"string"},{name:"internal.extraQueryParams",label:"Extra query params",type:"json"},{name:"desktopNavigationType",label:"Desktop navigation type",type:"list",values:[{label:"REDIRECT",value:Fn.REDIRECT},{label:"POPUP",value:Fn.POPUP}]},{name:"logLevel",label:"Log level",type:"list",values:[{label:"NONE",value:Wt.NONE},{label:"ERROR",value:Wt.ERROR},{label:"WARN",value:Wt.WARN},{label:"INFO",value:Wt.INFO},{label:"DEBUG",value:Wt.DEBUG}]},{name:"loginRequired",label:"Login required",type:"boolean"},{name:"retrieveUserSession",label:"Retrieve user's session",type:"boolean"},{name:"loadUserInfo",label:"Load user's info",type:"boolean"},{name:"automaticSilentRenew",label:"Automatic silent renew",type:"boolean"}],ds=[...ls,{name:"automaticLoginOn401",label:"Automatic login on 401",type:"boolean"},{name:"automaticInjectToken",label:"Automatic inject token",type:"boolean"}];ds.splice(3,0,{name:"authGuardRedirectUrl",label:"AuthGuard redirect url",type:"string"});const us=(e=!1)=>{const t=[{name:"Auth0",otherSettings:{privateApiUrl:"https://dev-fijd1e9x.us.auth0.com/api/v2/users/auth0|631b171682c639d40cb84d5c",privateApiHeaders:""},librarySettings:{authorityUrl:"https://dev-fijd1e9x.us.auth0.com",clientId:"kRVVEnAWKMpxxpcodl0TqLXfIHgQvmmt",mobileScheme:"demo-app",scope:"openid profile email phone offline_access read:current_user",internal:{extraQueryParams:{audience:"https://dev-fijd1e9x.us.auth0.com/api/v2/"}},desktopNavigationType:Fn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}},{name:"Zitadel",otherSettings:{privateApiUrl:"",privateApiHeaders:""},librarySettings:{authorityUrl:"https://auth-js-0pdipf.zitadel.cloud",clientId:"178200751804317953@demo-app",mobileScheme:"demo-app",scope:"openid profile email phone offline_access",desktopNavigationType:Fn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}];return e||t.push({name:"Keycloak (local)",otherSettings:{privateApiUrl:"/api/my-api",privateApiHeaders:""},librarySettings:{authorityUrl:"http://localhost:8080/auth/realms/demo",clientId:"demo-app",mobileScheme:"demo-app",scope:"openid profile email phone",desktopNavigationType:Fn.REDIRECT,logLevel:Wt.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}),t},hs=new class DemoAppSettings{constructor(e,t){this.storageKey=e,this.defaultAppSettings=t,this.implementations=[{label:"VanillaJS",demoUrl:"https://badisi.github.io/auth-js/demo-app/auth-js",version:`${as.UU}@main`},{label:"Angular",demoUrl:"https://badisi.github.io/auth-js/demo-app/ngx-auth",version:`${cs.UU}@main`}],this.defaultAppSettings.librarySettingsDefinition.forEach(((e,t)=>e._sortIndex=t))}getImplementations(){return this.implementations}setShowTip(e){const t=this.get();t.showTip=e,this.saveAppSettings(t)}setCurrentTabIndex(e){const t=this.get();t.currentTabIndex=e,this.saveAppSettings(t)}addOrUpdateUserSettings(e){const t=this.get(),n=t.userSettings.findIndex((t=>t.name===e.name));-1!==n?t.userSettings[n]=e:t.userSettings.push(e),this.saveAppSettings(t)}deleteCurrentUserSettings(){const e=this.get(),{name:t}=this.getCurrentUserSettings(),n=e.userSettings.findIndex((e=>e.name===t));-1!==n&&(e.userSettings.splice(n,1),delete e.currentUserSettingsId,this.saveAppSettings(e))}setCurrentUserSettings(e){const t=this.get();-1!==t.userSettings.findIndex((t=>t.name===e))&&(t.currentUserSettingsId=e,this.saveAppSettings(t))}getCurrentUserSettings(){const e=this.get(),t=e.userSettings.findIndex((t=>t.name===e.currentUserSettingsId));return-1!==t?e.userSettings[t]:e.userSettings.sort(((e,t)=>e.name.localeCompare(t.name)))[0]}get(){const e=sessionStorage.getItem(this.storageKey);if(e){const t=Object.assign({},this.defaultAppSettings,JSON.parse(e));return this.defaultAppSettings.userSettings.forEach((e=>{t.userSettings.find((t=>t.name===e.name))||t.userSettings.push(e)})),t}return Object.assign({},this.defaultAppSettings)}saveAppSettings(e){delete e.librarySettingsDefinition,sessionStorage.setItem(this.storageKey,JSON.stringify(e))}}(`auth-js:${as.rE}:demo-app:settings`,{showTip:!0,currentTabIndex:0,userSettings:us(!0),librarySettingsDefinition:ls});(()=>{window.appSettings=hs;const e=document.createElement("div");e.innerHTML="Loading...",document.body.appendChild(e),(async e=>await(async(e,t)=>{const n=new t;return await n.init(e),n})(e,OIDCAuthManager))(hs.getCurrentUserSettings().librarySettings).then((t=>{window.authManager=t,e.replaceWith(document.createElement("app-root"))})).catch((t=>{var n;console.error(t),e.innerHTML=`${t.message}
`,null==(n=document.body.querySelector("#loginButton"))||n.addEventListener("click",(()=>location.reload()),{once:!0})}))})()},7436:function(e,t,n){var s;e.exports=(s=s||function(e,t){var s;if("undefined"!=typeof window&&window.crypto&&(s=window.crypto),"undefined"!=typeof self&&self.crypto&&(s=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(s=globalThis.crypto),!s&&"undefined"!=typeof window&&window.msCrypto&&(s=window.msCrypto),!s&&"undefined"!=typeof global&&global.crypto&&(s=global.crypto),!s)try{s=n(9366)}catch(m){}var i=function(){if(s){if("function"==typeof s.getRandomValues)try{return s.getRandomValues(new Uint32Array(1))[0]}catch(m){}if("function"==typeof s.randomBytes)try{return s.randomBytes(4).readInt32LE()}catch(m){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=a.WordArray=c.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,s=this.sigBytes,i=e.sigBytes;if(this.clamp(),s%4)for(var r=0;r>>2]>>>24-r%4*8&255;t[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new l.init(n,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,s=[],i=0;i>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new l.init(n,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,d=e.min(4*c,r);if(c){for(var u=0;u>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return t.create(i,r)}e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,s=this._map;e.clamp();for(var i=[],r=0;r>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a>>6*(3-a)&63));var c=s.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,s=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r>>7)^(g<<14|g>>>18)^g>>>3,m=l[p-2],f=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;l[p]=_+l[p-7]+f+l[p-16]}var w=s&i^s&r^i&r,v=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&d^~a&u)+c[p]+l[p];h=u,u=d,d=a,a=o+b|0,o=r,r=i,i=s,s=b+(v+w)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+d|0,n[6]=n[6]+u|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(d),t.HmacSHA256=r._createHmacHelper(d)}(Math),s.SHA256)},1987:e=>{"use strict";function t(e){this.message=e}t.prototype=new Error,t.prototype.name="InvalidCharacterError";var n="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var n=String(e).replace(/=+$/,"");if(n.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,i,r=0,o=0,a="";i=n.charAt(o++);~i&&(s=r%4?64*s+i:i,r++%4)?a+=String.fromCharCode(255&s>>(-2*r&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function s(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(n(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return n(t)}}function i(e){this.message=e}function r(e,t){if("string"!=typeof e)throw new i("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(s(e.split(".")[n]))}catch(e){throw new i("Invalid token specified: "+e.message)}}i.prototype=new Error,i.prototype.name="InvalidTokenError";const o=r;o.default=r,o.InvalidTokenError=i,e.exports=o},8566:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var s=n(1753);e=n.hmd(e);var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&e&&!e.nodeType&&e,o=r&&r.exports===i?s.A.Buffer:void 0,a=o?o.allocUnsafe:void 0;const c=function(e,t){if(t)return e.slice();var n=e.length,s=a?a(n):new e.constructor(n);return e.copy(s),s}},724:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s="object"==typeof global&&global&&global.Object===Object&&global},2485:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var s=n(724);e=n.hmd(e);var i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&e&&!e.nodeType&&e,o=r&&r.exports===i&&s.A.process;const a=function(){try{var e=r&&r.require&&r.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(t){}}()},1753:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var s=n(724),i="object"==typeof self&&self&&self.Object===Object&&self;const r=s.A||i||Function("return this")()},2160:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var s=n(1753);const i=function(){return!1};e=n.hmd(e);var r="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=r&&e&&!e.nodeType&&e,a=o&&o.exports===r?s.A.Buffer:void 0;const c=(a?a.isBuffer:void 0)||i},9366:()=>{}},e=>{var t;t=8453,e(e.s=t)}]); \ No newline at end of file diff --git a/demo-app/ngx-auth/index.html b/demo-app/ngx-auth/index.html index 8e35eeb..c24f6f7 100644 --- a/demo-app/ngx-auth/index.html +++ b/demo-app/ngx-auth/index.html @@ -18,7 +18,7 @@ } } - + \ No newline at end of file diff --git a/demo-app/ngx-auth/main.1d72f1f7f7fcdda23cfb.js b/demo-app/ngx-auth/main.c48484b7390341d3b8d4.js similarity index 61% rename from demo-app/ngx-auth/main.1d72f1f7f7fcdda23cfb.js rename to demo-app/ngx-auth/main.c48484b7390341d3b8d4.js index cd8de6f..b6ed96f 100644 --- a/demo-app/ngx-auth/main.1d72f1f7f7fcdda23cfb.js +++ b/demo-app/ngx-auth/main.c48484b7390341d3b8d4.js @@ -1 +1 @@ -var jI=Object.defineProperty,BI=Object.defineProperties,HI=Object.getOwnPropertyDescriptors,Sp=Object.getOwnPropertySymbols,Zw=Object.prototype.hasOwnProperty,Xw=Object.prototype.propertyIsEnumerable,e0=(Ie,ne,O)=>ne in Ie?jI(Ie,ne,{enumerable:!0,configurable:!0,writable:!0,value:O}):Ie[ne]=O,dn=(Ie,ne)=>{for(var O in ne||(ne={}))Zw.call(ne,O)&&e0(Ie,O,ne[O]);if(Sp)for(var O of Sp(ne))Xw.call(ne,O)&&e0(Ie,O,ne[O]);return Ie},Tp=(Ie,ne)=>BI(Ie,HI(ne)),Lr=(Ie,ne)=>{var O={};for(var x in Ie)Zw.call(Ie,x)&&ne.indexOf(x)<0&&(O[x]=Ie[x]);if(null!=Ie&&Sp)for(var x of Sp(Ie))ne.indexOf(x)<0&&Xw.call(Ie,x)&&(O[x]=Ie[x]);return O};(self.webpackChunk_badisi_auth_js=self.webpackChunk_badisi_auth_js||[]).push([[179],{8583:(Ie,ne,O)=>{"use strict";O.d(ne,{mr:()=>ge,Ov:()=>Li,ez:()=>Sl,K0:()=>Z,Do:()=>de,V_:()=>re,Ye:()=>he,S$:()=>je,b0:()=>se,lw:()=>ye,EM:()=>Ca,JF:()=>yo,w_:()=>Ae,bD:()=>li,q:()=>ce,Mx:()=>Vt,HT:()=>ee});var x=O(7525);let m=null;function ce(){return m}function ee(C){m||(m=C)}class Ae{}const Z=new x.OlP("DocumentToken");let ye=(()=>{class C{historyGo(b){throw new Error("Not implemented")}}return C.\u0275fac=function(b){return new(b||C)},C.\u0275prov=(0,x.Yz7)({factory:pe,token:C,providedIn:"platform"}),C})();function pe(){return(0,x.LFG)(Y)}const re=new x.OlP("Location Initialized");let Y=(()=>{class C extends ye{constructor(b){super(),this._doc=b,this._init()}_init(){this.location=window.location,this._history=window.history}getBaseHrefFromDOM(){return ce().getBaseHref(this._doc)}onPopState(b){const M=ce().getGlobalEventTarget(this._doc,"window");return M.addEventListener("popstate",b,!1),()=>M.removeEventListener("popstate",b)}onHashChange(b){const M=ce().getGlobalEventTarget(this._doc,"window");return M.addEventListener("hashchange",b,!1),()=>M.removeEventListener("hashchange",b)}get href(){return this.location.href}get protocol(){return this.location.protocol}get hostname(){return this.location.hostname}get port(){return this.location.port}get pathname(){return this.location.pathname}get search(){return this.location.search}get hash(){return this.location.hash}set pathname(b){this.location.pathname=b}pushState(b,M,V){_e()?this._history.pushState(b,M,V):this.location.hash=V}replaceState(b,M,V){_e()?this._history.replaceState(b,M,V):this.location.hash=V}forward(){this._history.forward()}back(){this._history.back()}historyGo(b=0){this._history.go(b)}getState(){return this._history.state}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(Z))},C.\u0275prov=(0,x.Yz7)({factory:xe,token:C,providedIn:"platform"}),C})();function _e(){return!!window.history.pushState}function xe(){return new Y((0,x.LFG)(Z))}function z(C,S){if(0==C.length)return S;if(0==S.length)return C;let b=0;return C.endsWith("/")&&b++,S.startsWith("/")&&b++,2==b?C+S.substring(1):1==b?C+S:C+"/"+S}function Oe(C){const S=C.match(/#|\?|$/),b=S&&S.index||C.length;return C.slice(0,b-("/"===C[b-1]?1:0))+C.slice(b)}function ue(C){return C&&"?"!==C[0]?"?"+C:C}let je=(()=>{class C{historyGo(b){throw new Error("Not implemented")}}return C.\u0275fac=function(b){return new(b||C)},C.\u0275prov=(0,x.Yz7)({factory:te,token:C,providedIn:"root"}),C})();function te(C){const S=(0,x.LFG)(Z).location;return new se((0,x.LFG)(ye),S&&S.origin||"")}const ge=new x.OlP("appBaseHref");let se=(()=>{class C extends je{constructor(b,M){if(super(),this._platformLocation=b,this._removeListenerFns=[],null==M&&(M=this._platformLocation.getBaseHrefFromDOM()),null==M)throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");this._baseHref=M}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(b){this._removeListenerFns.push(this._platformLocation.onPopState(b),this._platformLocation.onHashChange(b))}getBaseHref(){return this._baseHref}prepareExternalUrl(b){return z(this._baseHref,b)}path(b=!1){const M=this._platformLocation.pathname+ue(this._platformLocation.search),V=this._platformLocation.hash;return V&&b?`${M}${V}`:M}pushState(b,M,V,K){const fe=this.prepareExternalUrl(V+ue(K));this._platformLocation.pushState(b,M,fe)}replaceState(b,M,V,K){const fe=this.prepareExternalUrl(V+ue(K));this._platformLocation.replaceState(b,M,fe)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformLocation).historyGo)||void 0===V||V.call(M,b)}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(ye),x.LFG(ge,8))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})(),de=(()=>{class C extends je{constructor(b,M){super(),this._platformLocation=b,this._baseHref="",this._removeListenerFns=[],null!=M&&(this._baseHref=M)}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(b){this._removeListenerFns.push(this._platformLocation.onPopState(b),this._platformLocation.onHashChange(b))}getBaseHref(){return this._baseHref}path(b=!1){let M=this._platformLocation.hash;return null==M&&(M="#"),M.length>0?M.substring(1):M}prepareExternalUrl(b){const M=z(this._baseHref,b);return M.length>0?"#"+M:M}pushState(b,M,V,K){let fe=this.prepareExternalUrl(V+ue(K));0==fe.length&&(fe=this._platformLocation.pathname),this._platformLocation.pushState(b,M,fe)}replaceState(b,M,V,K){let fe=this.prepareExternalUrl(V+ue(K));0==fe.length&&(fe=this._platformLocation.pathname),this._platformLocation.replaceState(b,M,fe)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformLocation).historyGo)||void 0===V||V.call(M,b)}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(ye),x.LFG(ge,8))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})(),he=(()=>{class C{constructor(b,M){this._subject=new x.vpe,this._urlChangeListeners=[],this._platformStrategy=b;const V=this._platformStrategy.getBaseHref();this._platformLocation=M,this._baseHref=Oe(Se(V)),this._platformStrategy.onPopState(K=>{this._subject.emit({url:this.path(!0),pop:!0,state:K.state,type:K.type})})}path(b=!1){return this.normalize(this._platformStrategy.path(b))}getState(){return this._platformLocation.getState()}isCurrentPathEqualTo(b,M=""){return this.path()==this.normalize(b+ue(M))}normalize(b){return C.stripTrailingSlash(function(C,S){return C&&S.startsWith(C)?S.substring(C.length):S}(this._baseHref,Se(b)))}prepareExternalUrl(b){return b&&"/"!==b[0]&&(b="/"+b),this._platformStrategy.prepareExternalUrl(b)}go(b,M="",V=null){this._platformStrategy.pushState(V,"",b,M),this._notifyUrlChangeListeners(this.prepareExternalUrl(b+ue(M)),V)}replaceState(b,M="",V=null){this._platformStrategy.replaceState(V,"",b,M),this._notifyUrlChangeListeners(this.prepareExternalUrl(b+ue(M)),V)}forward(){this._platformStrategy.forward()}back(){this._platformStrategy.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformStrategy).historyGo)||void 0===V||V.call(M,b)}onUrlChange(b){this._urlChangeListeners.push(b),this._urlChangeSubscription||(this._urlChangeSubscription=this.subscribe(M=>{this._notifyUrlChangeListeners(M.url,M.state)}))}_notifyUrlChangeListeners(b="",M){this._urlChangeListeners.forEach(V=>V(b,M))}subscribe(b,M,V){return this._subject.subscribe({next:b,error:M,complete:V})}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(je),x.LFG(ye))},C.normalizeQueryParams=ue,C.joinWithSlash=z,C.stripTrailingSlash=Oe,C.\u0275prov=(0,x.Yz7)({factory:be,token:C,providedIn:"root"}),C})();function be(){return new he((0,x.LFG)(je),(0,x.LFG)(ye))}function Se(C){return C.replace(/\/index.html$/,"")}var ve=(()=>((ve=ve||{})[ve.Zero=0]="Zero",ve[ve.One=1]="One",ve[ve.Two=2]="Two",ve[ve.Few=3]="Few",ve[ve.Many=4]="Many",ve[ve.Other=5]="Other",ve))();const Ct=x.kL8;class en{}let zt=(()=>{class C extends en{constructor(b){super(),this.locale=b}getPluralCategory(b,M){switch(Ct(M||this.locale)(b)){case ve.Zero:return"zero";case ve.One:return"one";case ve.Two:return"two";case ve.Few:return"few";case ve.Many:return"many";default:return"other"}}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(x.soG))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})();function Vt(C,S){S=encodeURIComponent(S);for(const b of C.split(";")){const M=b.indexOf("="),[V,K]=-1==M?[b,""]:[b.slice(0,M),b.slice(M+1)];if(V.trim()===S)return decodeURIComponent(K)}return null}class zo{createSubscription(S,b){return S.subscribe({next:b,error:M=>{throw M}})}dispose(S){S.unsubscribe()}onDestroy(S){S.unsubscribe()}}class Xn{createSubscription(S,b){return S.then(b,M=>{throw M})}dispose(S){}onDestroy(S){}}const Dn=new Xn,po=new zo;let Li=(()=>{class C{constructor(b){this._ref=b,this._latestValue=null,this._subscription=null,this._obj=null,this._strategy=null}ngOnDestroy(){this._subscription&&this._dispose()}transform(b){return this._obj?b!==this._obj?(this._dispose(),this.transform(b)):this._latestValue:(b&&this._subscribe(b),this._latestValue)}_subscribe(b){this._obj=b,this._strategy=this._selectStrategy(b),this._subscription=this._strategy.createSubscription(b,M=>this._updateLatestValue(b,M))}_selectStrategy(b){if((0,x.QGY)(b))return Dn;if((0,x.F4k)(b))return po;throw function(C,S){return Error(`InvalidPipeArgument: '${S}' for pipe '${(0,x.AaK)(C)}'`)}(C,b)}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(b,M){b===this._obj&&(this._latestValue=M,this._ref.markForCheck())}}return C.\u0275fac=function(b){return new(b||C)(x.Y36(x.sBO,16))},C.\u0275pipe=x.Yjl({name:"async",type:C,pure:!1}),C})(),Sl=(()=>{class C{}return C.\u0275fac=function(b){return new(b||C)},C.\u0275mod=x.oAB({type:C}),C.\u0275inj=x.cJS({providers:[{provide:en,useClass:zt}]}),C})();const li="browser";let Ca=(()=>{class C{}return C.\u0275prov=(0,x.Yz7)({token:C,providedIn:"root",factory:()=>new ba((0,x.LFG)(Z),window)}),C})();class ba{constructor(S,b){this.document=S,this.window=b,this.offset=()=>[0,0]}setOffset(S){this.offset=Array.isArray(S)?()=>S:S}getScrollPosition(){return this.supportsScrolling()?[this.window.pageXOffset,this.window.pageYOffset]:[0,0]}scrollToPosition(S){this.supportsScrolling()&&this.window.scrollTo(S[0],S[1])}scrollToAnchor(S){if(!this.supportsScrolling())return;const b=function(C,S){const b=C.getElementById(S)||C.getElementsByName(S)[0];if(b)return b;if("function"==typeof C.createTreeWalker&&C.body&&(C.body.createShadowRoot||C.body.attachShadow)){const M=C.createTreeWalker(C.body,NodeFilter.SHOW_ELEMENT);let V=M.currentNode;for(;V;){const K=V.shadowRoot;if(K){const fe=K.getElementById(S)||K.querySelector(`[name="${S}"]`);if(fe)return fe}V=M.nextNode()}}return null}(this.document,S);b&&(this.scrollToElement(b),this.attemptFocus(b))}setHistoryScrollRestoration(S){if(this.supportScrollRestoration()){const b=this.window.history;b&&b.scrollRestoration&&(b.scrollRestoration=S)}}scrollToElement(S){const b=S.getBoundingClientRect(),M=b.left+this.window.pageXOffset,V=b.top+this.window.pageYOffset,K=this.offset();this.window.scrollTo(M-K[0],V-K[1])}attemptFocus(S){return S.focus(),this.document.activeElement===S}supportScrollRestoration(){try{if(!this.supportsScrolling())return!1;const S=Br(this.window.history)||Br(Object.getPrototypeOf(this.window.history));return!(!S||!S.writable&&!S.set)}catch(S){return!1}}supportsScrolling(){try{return!!this.window&&!!this.window.scrollTo&&"pageXOffset"in this.window}catch(S){return!1}}}function Br(C){return Object.getOwnPropertyDescriptor(C,"scrollRestoration")}class yo{}},7525:(Ie,ne,O)=>{"use strict";O.d(ne,{deG:()=>xp,tb:()=>uw,AFp:()=>sw,ip1:()=>w_,CZH:()=>Ku,hGG:()=>$A,z2F:()=>of,sBO:()=>xD,Sil:()=>rf,_Vd:()=>Bu,EJc:()=>dw,SBq:()=>Ho,qLn:()=>us,vpe:()=>$o,gxx:()=>Uo,tBr:()=>zs,XFs:()=>Ge,OlP:()=>Zt,zs3:()=>Jt,ZZ4:()=>np,aQg:()=>rp,soG:()=>pp,YKP:()=>XC,v3s:()=>wA,h0i:()=>gl,PXZ:()=>mA,R0b:()=>Qr,FiY:()=>gi,Lbi:()=>lw,g9A:()=>aw,Qsj:()=>gD,FYo:()=>tp,JOm:()=>qi,Tiy:()=>Jm,q3G:()=>Ut,tp0:()=>Mo,EAV:()=>TA,Rgc:()=>Wd,dDg:()=>gw,DyG:()=>Gl,GfV:()=>WC,s_b:()=>sp,ifc:()=>ct,eFA:()=>bw,G48:()=>uA,Gpc:()=>ge,_c5:()=>kA,VLi:()=>lA,c2e:()=>cw,zSh:()=>hs,wAp:()=>Je,vHH:()=>be,EiD:()=>Hc,mCW:()=>Or,qzn:()=>Po,JVY:()=>Oc,pB0:()=>hg,eBb:()=>Fc,L6k:()=>Nc,LAX:()=>kc,cg1:()=>Bm,Tjo:()=>NA,kL8:()=>hC,yhl:()=>Pc,dqk:()=>Pt,sIi:()=>Ou,CqO:()=>Pm,QGY:()=>Rm,F4k:()=>bv,RDi:()=>K,AaK:()=>ue,z3N:()=>Xt,qOj:()=>Hh,TTD:()=>Ms,_Bn:()=>jC,xp6:()=>kg,uIk:()=>u,ekj:()=>km,Suo:()=>Vb,Xpm:()=>ti,lG2:()=>Wo,Yz7:()=>Ct,cJS:()=>wn,oAB:()=>ur,Yjl:()=>ha,Y36:()=>Vd,_UZ:()=>_v,qZA:()=>xm,TgZ:()=>Mm,EpF:()=>Cv,n5z:()=>zr,Ikx:()=>jm,LFG:()=>ln,$8M:()=>To,NdJ:()=>Om,CRH:()=>Ub,ALo:()=>Pb,lcZ:()=>Ob,Q6J:()=>Am,iGM:()=>kb,MAs:()=>kr,CHM:()=>Il,LSH:()=>Ya,kYT:()=>ho,_uU:()=>Yv,Oqu:()=>Vm,Gf:()=>Lb});var x=O(549),m=O(5955),ce=O(9018),Q=O(8007),ee=O(9517),Z=O(9359),ye=O(9593),pe=O(7980),re=O(817),Y=O(2085);function xe(e,t,...n){if(!0===t)return void e();if(!1===t)return;const r=new re.Hp({next:()=>{r.unsubscribe(),e()}});return(0,m.Xf)(t(...n)).subscribe(r)}function z(e){for(let t in e)if(e[t]===z)return t;throw Error("Could not find renamed property on target object.")}function Oe(e,t){for(const n in t)t.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(e[n]=t[n])}function ue(e){if("string"==typeof e)return e;if(Array.isArray(e))return"["+e.map(ue).join(", ")+"]";if(null==e)return""+e;if(e.overriddenName)return`${e.overriddenName}`;if(e.name)return`${e.name}`;const t=e.toString();if(null==t)return""+t;const n=t.indexOf("\n");return-1===n?t:t.substring(0,n)}function je(e,t){return null==e||""===e?null===t?"":t:null==t||""===t?e:e+" "+t}const te=z({__forward_ref__:z});function ge(e){return e.__forward_ref__=ge,e.toString=function(){return ue(this())},e}function se(e){return de(e)?e():e}function de(e){return"function"==typeof e&&e.hasOwnProperty(te)&&e.__forward_ref__===ge}class be extends Error{constructor(t,n){super(function(e,t){return`${e?`NG0${e}: `:""}${t}`}(t,n)),this.code=t}}function ae(e){return"string"==typeof e?e:null==e?"":String(e)}function Le(e){return"function"==typeof e?e.name||e.toString():"object"==typeof e&&null!=e&&"function"==typeof e.type?e.type.name||e.type.toString():ae(e)}function pt(e,t){const n=t?` in ${t}`:"";throw new be("201",`No provider for ${Le(e)} found${n}`)}function Pe(e,t){null==e&&function(e,t,n,r){throw new Error(`ASSERTION ERROR: ${e}`+(null==r?"":` [Expected=> ${n} ${r} ${t} <=Actual]`))}(t,e,null,"!=")}function Ct(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}function wn(e){return{providers:e.providers||[],imports:e.imports||[]}}function fn(e){return da(e,uo)||da(e,vs)}function da(e,t){return e.hasOwnProperty(t)?e[t]:null}function ys(e){return e&&(e.hasOwnProperty(co)||e.hasOwnProperty(Oi))?e[co]:null}const uo=z({\u0275prov:z}),co=z({\u0275inj:z}),vs=z({ngInjectableDef:z}),Oi=z({ngInjectorDef:z});var Ge=(()=>((Ge=Ge||{})[Ge.Default=0]="Default",Ge[Ge.Host=1]="Host",Ge[Ge.Self=2]="Self",Ge[Ge.SkipSelf=4]="SkipSelf",Ge[Ge.Optional=8]="Optional",Ge))();let Lt;function ze(e){const t=Lt;return Lt=e,t}function tt(e,t,n){const r=fn(e);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:n&Ge.Optional?null:void 0!==t?t:void pt(ue(e),"Injector")}function Gt(e){return{toString:e}.toString()}var hn=(()=>((hn=hn||{})[hn.OnPush=0]="OnPush",hn[hn.Default=1]="Default",hn))(),ct=(()=>((ct=ct||{})[ct.Emulated=0]="Emulated",ct[ct.None=2]="None",ct[ct.ShadowDom=3]="ShadowDom",ct))();const fa="undefined"!=typeof globalThis&&globalThis,dt="undefined"!=typeof window&&window,bs="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,Pt=fa||"undefined"!=typeof global&&global||dt||bs,sn={},vt=[],ei=z({\u0275cmp:z}),Ni=z({\u0275dir:z}),fo=z({\u0275pipe:z}),Go=z({\u0275mod:z}),Es=z({\u0275loc:z}),lr=z({\u0275fac:z}),Fi=z({__NG_ELEMENT_ID__:z});let Ds=0;function ti(e){return Gt(()=>{const n={},r={type:e.type,providersResolver:null,decls:e.decls,vars:e.vars,factory:null,template:e.template||null,consts:e.consts||null,ngContentSelectors:e.ngContentSelectors,hostBindings:e.hostBindings||null,hostVars:e.hostVars||0,hostAttrs:e.hostAttrs||null,contentQueries:e.contentQueries||null,declaredInputs:n,inputs:null,outputs:null,exportAs:e.exportAs||null,onPush:e.changeDetection===hn.OnPush,directiveDefs:null,pipeDefs:null,selectors:e.selectors||vt,viewQuery:e.viewQuery||null,features:e.features||null,data:e.data||{},encapsulation:e.encapsulation||ct.Emulated,id:"c",styles:e.styles||vt,_:null,setInput:null,schemas:e.schemas||null,tView:null},s=e.directives,l=e.features,c=e.pipes;return r.id+=Ds++,r.inputs=Vr(e.inputs,n),r.outputs=Vr(e.outputs),l&&l.forEach(d=>d(r)),r.directiveDefs=s?()=>("function"==typeof s?s():s).map(lt):null,r.pipeDefs=c?()=>("function"==typeof c?c():c).map(an):null,r})}function lt(e){return Wt(e)||function(e){return e[Ni]||null}(e)}function an(e){return function(e){return e[fo]||null}(e)}const ri={};function ur(e){return Gt(()=>{const t={type:e.type,bootstrap:e.bootstrap||vt,declarations:e.declarations||vt,imports:e.imports||vt,exports:e.exports||vt,transitiveCompileScopes:null,schemas:e.schemas||null,id:e.id||null};return null!=e.id&&(ri[e.id]=e.type),t})}function ho(e,t){return Gt(()=>{const n=pn(e,!0);n.declarations=t.declarations||vt,n.imports=t.imports||vt,n.exports=t.exports||vt})}function Vr(e,t){if(null==e)return sn;const n={};for(const r in e)if(e.hasOwnProperty(r)){let s=e[r],l=s;Array.isArray(s)&&(l=s[1],s=s[0]),n[s]=r,t&&(t[s]=l)}return n}const Wo=ti;function ha(e){return{type:e.type,name:e.name,factory:null,pure:!1!==e.pure,onDestroy:e.type.prototype.ngOnDestroy||null}}function Wt(e){return e[ei]||null}function pn(e,t){const n=e[Go]||null;if(!n&&!0===t)throw new Error(`Type ${ue(e)} does not have '\u0275mod' property.`);return n}function Xn(e){return Array.isArray(e)&&"object"==typeof e[1]}function Dn(e){return Array.isArray(e)&&!0===e[1]}function po(e){return 0!=(8&e.flags)}function Li(e){return 2==(2&e.flags)}function go(e){return 1==(1&e.flags)}function Wn(e){return null!==e.template}function mo(e){return 0!=(512&e[2])}function ui(e,t){return e.hasOwnProperty(lr)?e[lr]:null}class jr{constructor(t,n,r){this.previousValue=t,this.currentValue=n,this.firstChange=r}isFirstChange(){return this.firstChange}}function Ms(){return va}function va(e){return e.type.prototype.ngOnChanges&&(e.setInput=ba),Ca}function Ca(){const e=ci(this),t=null==e?void 0:e.current;if(t){const n=e.previous;if(n===sn)e.previous=t;else for(let r in t)n[r]=t[r];e.current=null,this.ngOnChanges(t)}}function ba(e,t,n,r){const s=ci(e)||function(e,t){return e[Br]=t}(e,{previous:sn,current:null}),l=s.current||(s.current={}),c=s.previous,d=this.declaredInputs[n],g=c[d];l[d]=new jr(g&&g.currentValue,t,c===sn),e[r]=t}Ms.ngInherit=!0;const Br="__ngSimpleChanges__";function ci(e){return e[Br]||null}let V;function K(e){V=e}function $e(e){return!!e.listen}const Et={createRenderer:(e,t)=>void 0!==V?V:"undefined"!=typeof document?document:void 0};function ut(e){for(;Array.isArray(e);)e=e[0];return e}function kn(e,t){return ut(t[e])}function qt(e,t){return ut(t[e.index])}function dr(e,t){return e.data[t]}function $r(e,t){return e[t]}function _n(e,t){const n=t[e];return Xn(n)?n:n[0]}function Yo(e){return 4==(4&e[2])}function wa(e){return 128==(128&e[2])}function Sr(e,t){return null==t?null:e[t]}function Al(e){e[18]=0}function Rs(e,t){e[5]+=t;let n=e,r=e[3];for(;null!==r&&(1===t&&1===n[5]||-1===t&&0===n[5]);)r[5]+=t,n=r,r=r[3]}const Ye={lFrame:Ll(null),bindingsEnabled:!0,isInCheckNoChangesMode:!1};function Hi(){return Ye.bindingsEnabled}function le(){return Ye.lFrame.lView}function mt(){return Ye.lFrame.tView}function Il(e){return Ye.lFrame.contextLView=e,e[8]}function tn(){let e=Ml();for(;null!==e&&64===e.type;)e=e.parent;return e}function Ml(){return Ye.lFrame.currentTNode}function Tr(e,t){const n=Ye.lFrame;n.currentTNode=e,n.isParent=t}function Ea(){return Ye.lFrame.isParent}function Ps(){return Ye.isInCheckNoChangesMode}function Os(e){Ye.isInCheckNoChangesMode=e}function tr(){return Ye.lFrame.bindingIndex++}function Ol(e,t){const n=Ye.lFrame;n.bindingIndex=n.bindingRootIndex=e,Ta(t)}function Ta(e){Ye.lFrame.currentDirectiveIndex=e}function Fl(){return Ye.lFrame.currentQueryIndex}function Aa(e){Ye.lFrame.currentQueryIndex=e}function oc(e){const t=e[1];return 2===t.type?t.declTNode:1===t.type?e[6]:null}function Ns(e,t,n){if(n&Ge.SkipSelf){let s=t,l=e;for(;!(s=s.parent,null!==s||n&Ge.Host||(s=oc(l),null===s||(l=l[15],10&s.type))););if(null===s)return!1;t=s,e=l}const r=Ye.lFrame=kl();return r.currentTNode=t,r.lView=e,!0}function Fs(e){const t=kl(),n=e[1];Ye.lFrame=t,t.currentTNode=n.firstChild,t.lView=e,t.tView=n,t.contextLView=e,t.bindingIndex=n.bindingStartIndex,t.inI18n=!1}function kl(){const e=Ye.lFrame,t=null===e?null:e.child;return null===t?Ll(e):t}function Ll(e){const t={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:e,child:null,inI18n:!1};return null!==e&&(e.child=t),t}function ks(){const e=Ye.lFrame;return Ye.lFrame=e.parent,e.currentTNode=null,e.lView=null,e}const di=ks;function Ls(){const e=ks();e.isParent=!0,e.tView=null,e.selectedIndex=-1,e.contextLView=null,e.elementDepthCount=0,e.currentDirectiveIndex=-1,e.currentNamespace=null,e.bindingRootIndex=-1,e.bindingIndex=-1,e.currentQueryIndex=0}function Mn(){return Ye.lFrame.selectedIndex}function zn(e){Ye.lFrame.selectedIndex=e}function $t(){const e=Ye.lFrame;return dr(e.tView,e.selectedIndex)}function $i(e,t){for(let n=t.directiveStart,r=t.directiveEnd;n=r)break}else t[g]<0&&(e[18]+=65536),(d>11>16&&(3&e[2])===t){e[2]+=2048;try{l.call(d)}finally{}}}else try{l.call(d)}finally{}}class Gi{constructor(t,n,r){this.factory=t,this.resolving=!1,this.canSeeViewProviders=n,this.injectImpl=r}}function js(e,t,n){const r=$e(e);let s=0;for(;st){c=l-1;break}}}for(;l>16}(e),r=t;for(;n>0;)r=r[15],n--;return r}let Bs=!0;function So(e){const t=Bs;return Bs=e,t}let dc=0;function _(e,t){const n=f(e,t);if(-1!==n)return n;const r=t[1];r.firstCreatePass&&(e.injectorIndex=t.length,p(r.data,e),p(t,null),p(r.blueprint,null));const s=y(e,t),l=e.injectorIndex;if($l(s)){const c=zi(s),d=Do(s,t),g=d[1].data;for(let v=0;v<8;v++)t[l+v]=d[c+v]|g[c+v]}return t[l+8]=s,l}function p(e,t){e.push(0,0,0,0,0,0,0,0,t)}function f(e,t){return-1===e.injectorIndex||e.parent&&e.parent.injectorIndex===e.injectorIndex||null===t[e.injectorIndex+8]?-1:e.injectorIndex}function y(e,t){if(e.parent&&-1!==e.parent.injectorIndex)return e.parent.injectorIndex;let n=0,r=null,s=t;for(;null!==s;){const l=s[1],c=l.type;if(r=2===c?l.declTNode:1===c?s[6]:null,null===r)return-1;if(n++,s=s[15],-1!==r.injectorIndex)return r.injectorIndex|n<<16}return-1}function E(e,t,n){!function(e,t,n){let r;"string"==typeof n?r=n.charCodeAt(0)||0:n.hasOwnProperty(Fi)&&(r=n[Fi]),null==r&&(r=n[Fi]=dc++);const s=255&r;t.data[e+(s>>5)]|=1<=0?255&t:ot:t}(n);if("function"==typeof l){if(!Ns(t,e,r))return r&Ge.Host?N(s,n,r):L(t,n,r,s);try{const c=l(r);if(null!=c||r&Ge.Optional)return c;pt(n)}finally{di()}}else if("number"==typeof l){let c=null,d=f(e,t),g=-1,v=r&Ge.Host?t[16][6]:null;for((-1===d||r&Ge.SkipSelf)&&(g=-1===d?y(e,t):t[d+8],-1!==g&&fr(r,!1)?(c=t[1],d=zi(g),t=Do(g,t)):d=-1);-1!==d;){const D=t[1];if(nr(l,d,D.data)){const I=Be(d,t,n,c,r,v);if(I!==we)return I}g=t[d+8],-1!==g&&fr(r,t[1].data[d+8]===v)&&nr(l,d,t)?(c=D,d=zi(g),t=Do(g,t)):d=-1}}}return L(t,n,r,s)}const we={};function ot(){return new Ir(tn(),le())}function Be(e,t,n,r,s,l){const c=t[1],d=c.data[e+8],D=Dt(d,c,n,null==r?Li(d)&&Bs:r!=c&&0!=(3&d.type),s&Ge.Host&&l===d);return null!==D?ft(t,c,D,d):we}function Dt(e,t,n,r,s){const l=e.providerIndexes,c=t.data,d=1048575&l,g=e.directiveStart,D=l>>20,R=s?d+D:e.directiveEnd;for(let k=r?d:d+D;k=g&&U.type===n)return k}if(s){const k=c[g];if(k&&Wn(k)&&k.type===n)return g}return null}function ft(e,t,n,r){let s=e[n];const l=t.data;if(function(e){return e instanceof Gi}(s)){const c=s;c.resolving&&function(e,t){throw new be("200",`Circular dependency in DI detected for ${e}`)}(Le(l[n]));const d=So(c.canSeeViewProviders);c.resolving=!0;const g=c.injectImpl?ze(c.injectImpl):null;Ns(e,r,Ge.Default);try{s=e[n]=c.factory(void 0,l,e,r),t.firstCreatePass&&n>=r.directiveStart&&function(e,t,n){const{ngOnChanges:r,ngOnInit:s,ngDoCheck:l}=t.type.prototype;if(r){const c=va(t);(n.preOrderHooks||(n.preOrderHooks=[])).push(e,c),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(e,c)}s&&(n.preOrderHooks||(n.preOrderHooks=[])).push(0-e,s),l&&((n.preOrderHooks||(n.preOrderHooks=[])).push(e,l),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(e,l))}(n,l[n],t)}finally{null!==g&&ze(g),So(d),c.resolving=!1,di()}}return s}function nr(e,t,n){return!!(n[t+(e>>5)]&1<{const t=e.prototype.constructor,n=t[lr]||Mr(t),r=Object.prototype;let s=Object.getPrototypeOf(e.prototype).constructor;for(;s&&s!==r;){const l=s[lr]||Mr(s);if(l&&l!==n)return l;s=Object.getPrototypeOf(s)}return l=>new l})}function Mr(e){return de(e)?()=>{const t=Mr(se(e));return t&&t()}:ui(e)}function To(e){return function(e,t){if("class"===t)return e.classes;if("style"===t)return e.styles;const n=e.attrs;if(n){const r=n.length;let s=0;for(;s{const r=function(e){return function(...n){if(e){const r=e(...n);for(const s in r)this[s]=r[s]}}}(t);function s(...l){if(this instanceof s)return r.apply(this,l),this;const c=new s(...l);return d.annotation=c,d;function d(g,v,D){const I=g.hasOwnProperty(Hs)?g[Hs]:Object.defineProperty(g,Hs,{value:[]})[Hs];for(;I.length<=D;)I.push(null);return(I[D]=I[D]||[]).push(c),g}}return n&&(s.prototype=Object.create(n.prototype)),s.prototype.ngMetadataName=e,s.annotationCls=s,s})}class Zt{constructor(t,n){this._desc=t,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof n?this.__NG_ELEMENT_ID__=n:void 0!==n&&(this.\u0275prov=Ct({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}toString(){return`InjectionToken ${this._desc}`}}const xp=new Zt("AnalyzeForEntryComponents"),Gl=Function;function xr(e,t){void 0===t&&(t=e);for(let n=0;nArray.isArray(n)?pi(n,t):t(n))}function zl(e,t,n){t>=e.length?e.push(n):e.splice(t,0,n)}function ns(e,t){return t>=e.length-1?e.pop():e.splice(t,1)[0]}function hr(e,t,n){let r=rs(e,t);return r>=0?e[1|r]=n:(r=~r,function(e,t,n,r){let s=e.length;if(s==t)e.push(n,r);else if(1===s)e.push(r,e[0]),e[0]=n;else{for(s--,e.push(e[s-1],e[s]);s>t;)e[s]=e[s-2],s--;e[t]=n,e[t+1]=r}}(e,r,t,n)),r}function hc(e,t){const n=rs(e,t);if(n>=0)return e[1|n]}function rs(e,t){return function(e,t,n){let r=0,s=e.length>>n;for(;s!==r;){const l=r+(s-r>>1),c=e[l<t?s=l:r=l+1}return~(s< ");else if("object"==typeof t){let l=[];for(let c in t)if(t.hasOwnProperty(c)){let d=t[c];l.push(c+":"+("string"==typeof d?JSON.stringify(d):ue(d)))}s=`{${l.join(", ")}}`}return`${n}${r?"("+r+")":""}[${s}]: ${e.replace(Lp,"\n ")}`}("\n"+e.message,s,n,r),e.ngTokenPath=s,e[Ws]=null,e}const zs=La(Ao("Inject",e=>({token:e})),-1),gi=La(Ao("Optional"),8),Mo=La(Ao("SkipSelf"),4);var qi=(()=>((qi=qi||{})[qi.Important=1]="Important",qi[qi.DashCase=2]="DashCase",qi))();const Zp="__ngContext__";function Ln(e,t){e[Zp]=t}function Cc(e){const t=function(e){return e[Zp]||null}(e);return t?Array.isArray(t)?t:t.lView:null}function _i(e,t){return undefined(e,t)}function Vn(e){const t=e[3];return Dn(t)?t[3]:t}function Yi(e){return Of(e[13])}function Va(e){return Of(e[4])}function Of(e){for(;null!==e&&!Dn(e);)e=e[4];return e}function xo(e,t,n,r,s){if(null!=r){let l,c=!1;Dn(r)?l=r:Xn(r)&&(c=!0,r=r[0]);const d=ut(r);0===e&&null!==n?null==s?Vf(t,n,d):ss(t,n,d,s||null,!0):1===e&&null!==n?ss(t,n,d,s||null,!0):2===e?function(e,t,n){const r=nu(e,t);r&&function(e,t,n,r){$e(e)?e.removeChild(t,n,r):t.removeChild(n)}(e,r,t,n)}(t,d,c):3===e&&t.destroyNode(d),null!=l&&function(e,t,n,r,s){const l=n[7];l!==ut(n)&&xo(t,e,r,l,s);for(let d=10;d0&&(e[n-1][4]=r[4]);const l=ns(e,10+t);!function(e,t){$a(e,t,t[11],2,null,null),t[0]=null,t[6]=null}(r[1],r);const c=l[19];null!==c&&c.detachView(l[1]),r[3]=null,r[4]=null,r[2]&=-129}return r}function kf(e,t){if(!(256&t[2])){const n=t[11];$e(n)&&n.destroyNode&&$a(e,t,n,3,null,null),function(e){let t=e[13];if(!t)return Ro(e[1],e);for(;t;){let n=null;if(Xn(t))n=t[13];else{const r=t[10];r&&(n=r)}if(!n){for(;t&&!t[4]&&t!==e;)Xn(t)&&Ro(t[1],t),t=t[3];null===t&&(t=e),Xn(t)&&Ro(t[1],t),n=t&&t[4]}t=n}}(t)}}function Ro(e,t){if(!(256&t[2])){t[2]&=-129,t[2]|=256,function(e,t){let n;if(null!=e&&null!=(n=e.destroyHooks))for(let r=0;r=0?r[s=v]():r[s=-v].unsubscribe(),l+=2}else{const c=r[s=n[l+1]];n[l].call(c)}if(null!==r){for(let l=s+1;le,createScript:e=>e,createScriptURL:e=>e})}catch(e){}return su}())||void 0===t?void 0:t.createHTML(e))||e}class Ki{constructor(t){this.changingThisBreaksApplicationSecurity=t}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see https://g.co/ng/security#xss)`}}class Qs extends Ki{getTypeName(){return"HTML"}}class pr extends Ki{getTypeName(){return"Style"}}class gr extends Ki{getTypeName(){return"Script"}}class rr extends Ki{getTypeName(){return"URL"}}class fg extends Ki{getTypeName(){return"ResourceURL"}}function Xt(e){return e instanceof Ki?e.changingThisBreaksApplicationSecurity:e}function Po(e,t){const n=Pc(e);if(null!=n&&n!==t){if("ResourceURL"===n&&"URL"===t)return!0;throw new Error(`Required a safe ${t}, got a ${n} (see https://g.co/ng/security#xss)`)}return n===t}function Pc(e){return e instanceof Ki&&e.getTypeName()||null}function Oc(e){return new Qs(e)}function Nc(e){return new pr(e)}function Fc(e){return new gr(e)}function kc(e){return new rr(e)}function hg(e){return new fg(e)}class Pr{constructor(t){this.inertDocumentHelper=t}getInertBodyElement(t){t=""+t;try{const n=(new window.DOMParser).parseFromString(as(t),"text/html").body;return null===n?this.inertDocumentHelper.getInertBodyElement(t):(n.removeChild(n.firstChild),n)}catch(n){return null}}}class Lc{constructor(t){if(this.defaultDoc=t,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert"),null==this.inertDocument.body){const n=this.inertDocument.createElement("html");this.inertDocument.appendChild(n);const r=this.inertDocument.createElement("body");n.appendChild(r)}}getInertBodyElement(t){const n=this.inertDocument.createElement("template");if("content"in n)return n.innerHTML=as(t),n;const r=this.inertDocument.createElement("body");return r.innerHTML=as(t),this.defaultDoc.documentMode&&this.stripCustomNsAttrs(r),r}stripCustomNsAttrs(t){const n=t.attributes;for(let s=n.length-1;0Or(t.trim())).join(", ")),this.buf.push(" ",c,'="',qf(g),'"')}var e;return this.buf.push(">"),!0}endElement(t){const n=t.nodeName.toLowerCase();mr.hasOwnProperty(n)&&!Oo.hasOwnProperty(n)&&(this.buf.push(""))}chars(t){this.buf.push(qf(t))}checkClobberedElement(t,n){if(n&&(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY)===Node.DOCUMENT_POSITION_CONTAINED_BY)throw new Error(`Failed to sanitize html because the element is clobbered: ${t.outerHTML}`);return n}}const Dy=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yg=/([^\#-~ |!])/g;function qf(e){return e.replace(/&/g,"&").replace(Dy,function(t){return"&#"+(1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320)+65536)+";"}).replace(yg,function(t){return"&#"+t.charCodeAt(0)+";"}).replace(//g,">")}let qa;function Hc(e,t){let n=null;try{qa=qa||function(e){const t=new Lc(e);return function(){try{return!!(new window.DOMParser).parseFromString(as(""),"text/html")}catch(e){return!1}}()?new Pr(t):t}(e);let r=t?String(t):"";n=qa.getInertBodyElement(r);let s=5,l=r;do{if(0===s)throw new Error("Failed to sanitize html because the input is unstable");s--,r=l,l=n.innerHTML,n=qa.getInertBodyElement(r)}while(r!==l);return as((new No).sanitizeChildren(cu(n)||n))}finally{if(n){const r=cu(n)||n;for(;r.firstChild;)r.removeChild(r.firstChild)}}}function cu(e){return"content"in e&&function(e){return e.nodeType===Node.ELEMENT_NODE&&"TEMPLATE"===e.nodeName}(e)?e.content:null}var Ut=(()=>((Ut=Ut||{})[Ut.NONE=0]="NONE",Ut[Ut.HTML=1]="HTML",Ut[Ut.STYLE=2]="STYLE",Ut[Ut.SCRIPT=3]="SCRIPT",Ut[Ut.URL=4]="URL",Ut[Ut.RESOURCE_URL=5]="RESOURCE_URL",Ut))();function Ya(e){const t=function(){const e=le();return e&&e[12]}();return t?t.sanitize(Ut.URL,e)||"":Po(e,"URL")?Xt(e):Or(ae(e))}function Ja(e){return e.ngOriginalError}function qc(e,...t){e.error(...t)}class us{constructor(){this._console=console}handleError(t){const n=this._findOriginalError(t),r=this._findContext(t),s=(e=t)&&e.ngErrorLogger||qc;var e;s(this._console,"ERROR",t),n&&s(this._console,"ORIGINAL ERROR",n),r&&s(this._console,"ERROR CONTEXT",r)}_findContext(t){return t?t.ngDebugContext||this._findContext(Ja(t)):null}_findOriginalError(t){let n=t&&Ja(t);for(;n&&Ja(n);)n=Ja(n);return n||null}}const Sg=(()=>("undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||setTimeout).bind(Pt))();function vi(e){return e instanceof Function?e():e}function Qa(e,t,n){let r=e.length;for(;;){const s=e.indexOf(t,n);if(-1===s)return s;if(0===s||e.charCodeAt(s-1)<=32){const l=t.length;if(s+l===r||e.charCodeAt(s+l)<=32)return s}n=s+1}}const Zc="ng-template";function cs(e,t,n){let r=0;for(;rl?"":s[I+1].toLowerCase();const k=8&r?R:null;if(k&&-1!==Qa(k,v,0)||2&r&&v!==R){if(Yr(r))return!1;c=!0}}}}else{if(!c&&!Yr(r)&&!Yr(g))return!1;if(c&&Yr(g))continue;c=!1,r=g|1&r}}return Yr(r)||c}function Yr(e){return 0==(1&e)}function xg(e,t,n,r){if(null===t)return-1;let s=0;if(r||!n){let l=!1;for(;s-1)for(n++;n0?'="'+d+'"':"")+"]"}else 8&r?s+="."+c:4&r&&(s+=" "+c);else""!==s&&!Yr(c)&&(t+=nh(l,s),s=""),r=c,l=l||!Yr(r);n++}return""!==s&&(t+=nh(l,s)),t}const nt={};function kg(e){ih(mt(),le(),Mn()+e,Ps())}function ih(e,t,n,r){if(!r)if(3==(3&t[2])){const l=e.preOrderCheckHooks;null!==l&&Qo(t,l,n)}else{const l=e.preOrderHooks;null!==l&&Wr(t,l,0,n)}zn(n)}function Ci(e,t){return e<<17|t<<2}function _r(e){return e>>17&32767}function sh(e){return 2|e}function yr(e){return(131068&e)>>2}function fu(e,t){return-131069&e|t<<2}function ah(e){return 1|e}function id(e,t){const n=e.contentQueries;if(null!==n)for(let r=0;r20&&ih(e,t,20,Ps()),n(r,s)}finally{zn(l)}}function ad(e){const t=e.tView;return null===t||t.incompleteFirstPass?e.tView=el(1,null,e.template,e.decls,e.vars,e.directiveDefs,e.pipeDefs,e.viewQuery,e.schemas,e.consts):t}function el(e,t,n,r,s,l,c,d,g,v){const D=20+r,I=D+s,R=function(e,t){const n=[];for(let r=0;r0;){const n=e[--t];if("number"==typeof n&&n<0)return n}return 0})(d)!=g&&d.push(g),d.push(r,s,c)}}function _h(e,t){null!==e.hostBindings&&e.hostBindings(1,t)}function tl(e,t){t.flags|=2,(e.components||(e.components=[])).push(t.index)}function vd(e,t,n){if(n){if(t.exportAs)for(let r=0;r0&&Cd(n)}}function Cd(e){for(let r=Yi(e);null!==r;r=Va(r))for(let s=10;s0&&Cd(l)}const n=e[1].components;if(null!==n)for(let r=0;r0&&Cd(s)}}function bd(e,t){const n=_n(t,e),r=n[1];(function(e,t){for(let n=t.length;nPromise.resolve(null))();function Du(e){return e[7]||(e[7]=[])}function ol(e){return e.cleanup||(e.cleanup=[])}function ra(e,t){const n=e[9],r=n?n.get(us,null):null;r&&r.handleError(t)}function sl(e,t,n,r,s){for(let l=0;lthis.processProvider(d,t,n)),pi([t],d=>this.processInjectorType(d,[],l)),this.records.set(Uo,cl(void 0,this));const c=this.records.get(hs);this.scope=null!=c?c.value:null,this.source=s||("object"==typeof t?null:ue(t))}get destroyed(){return this._destroyed}destroy(){this.assertNotDestroyed(),this._destroyed=!0;try{this.onDestroy.forEach(t=>t.ngOnDestroy())}finally{this.records.clear(),this.onDestroy.clear(),this.injectorDefTypes.clear()}}get(t,n=Fa,r=Ge.Default){this.assertNotDestroyed();const s=is(this),l=ze(void 0);try{if(!(r&Ge.SkipSelf)){let d=this.records.get(t);if(void 0===d){const g=("function"==typeof(e=t)||"object"==typeof e&&e instanceof Zt)&&fn(t);d=g&&this.injectableDefInScope(g)?cl(ul(t),ps):null,this.records.set(t,d)}if(null!=d)return this.hydrate(t,d)}return(r&Ge.Self?Eh():this.parent).get(t,n=r&Ge.Optional&&n===Fa?null:n)}catch(c){if("NullInjectorError"===c.name){if((c[Ws]=c[Ws]||[]).unshift(ue(t)),s)throw c;return Df(c,t,"R3InjectorError",this.source)}throw c}finally{ze(l),is(s)}var e}_resolveInjectorDefTypes(){this.injectorDefTypes.forEach(t=>this.get(t))}toString(){const t=[];return this.records.forEach((r,s)=>t.push(ue(s))),`R3Injector[${t.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new Error("Injector has already been destroyed.")}processInjectorType(t,n,r){if(!(t=se(t)))return!1;let s=ys(t);const l=null==s&&t.ngModule||void 0,c=void 0===l?t:l,d=-1!==r.indexOf(c);if(void 0!==l&&(s=ys(l)),null==s)return!1;if(null!=s.imports&&!d){let D;r.push(c);try{pi(s.imports,I=>{this.processInjectorType(I,n,r)&&(void 0===D&&(D=[]),D.push(I))})}finally{}if(void 0!==D)for(let I=0;Ithis.processProvider(U,R,k||vt))}}this.injectorDefTypes.add(c);const g=ui(c)||(()=>new c);this.records.set(c,cl(g,ps));const v=s.providers;if(null!=v&&!d){const D=t;pi(v,I=>this.processProvider(I,D,v))}return void 0!==l&&void 0!==t.providers}processProvider(t,n,r){let s=ia(t=se(t))?t:se(t&&t.provide);const l=(e=t,lm(e)?cl(void 0,e.useValue):cl(am(e),ps));var e;if(ia(t)||!0!==t.multi)this.records.get(s);else{let c=this.records.get(s);c||(c=cl(void 0,ps,!0),c.factory=()=>os(c.multi),this.records.set(s,c)),s=t,c.multi.push(t)}this.records.set(s,l)}hydrate(t,n){return n.value===ps&&(n.value=Su,n.value=n.factory()),"object"==typeof n.value&&n.value&&null!==(e=n.value)&&"object"==typeof e&&"function"==typeof e.ngOnDestroy&&this.onDestroy.add(n.value),n.value;var e}injectableDefInScope(t){if(!t.providedIn)return!1;const n=se(t.providedIn);return"string"==typeof n?"any"===n||n===this.scope:this.injectorDefTypes.has(n)}}function ul(e){const t=fn(e),n=null!==t?t.factory:ui(e);if(null!==n)return n;if(e instanceof Zt)throw new Error(`Token ${ue(e)} is missing a \u0275prov definition.`);if(e instanceof Function)return function(e){const t=e.length;if(t>0){const r=function(e,t){const n=[];for(let r=0;rn.factory(e):()=>new e}(e);throw new Error("unreachable")}function am(e,t,n){let r;if(ia(e)){const s=se(e);return ui(s)||ul(s)}if(lm(e))r=()=>se(e.useValue);else if(function(e){return!(!e||!e.useFactory)}(e))r=()=>e.useFactory(...os(e.deps||[]));else if(function(e){return!(!e||!e.useExisting)}(e))r=()=>ln(se(e.useExisting));else{const s=se(e&&(e.useClass||e.provide));if(!function(e){return!!e.deps}(e))return ui(s)||ul(s);r=()=>new s(...os(e.deps))}return r}function cl(e,t,n=!1){return{factory:e,value:t,multi:n?[]:void 0}}function lm(e){return null!==e&&"object"==typeof e&&yc in e}function ia(e){return"function"==typeof e}const Ih=function(e,t,n){return function(e,t=null,n=null,r){const s=sm(e,t,n,r);return s._resolveInjectorDefTypes(),s}({name:n},t,e,n)};let Jt=(()=>{class e{static create(n,r){return Array.isArray(n)?Ih(n,r,""):Ih(n.providers,n.parent,n.name||"")}}return e.THROW_IF_NOT_FOUND=Fa,e.NULL=new Sd,e.\u0275prov=Ct({token:e,providedIn:"any",factory:()=>ln(Uo)}),e.__NG_ELEMENT_ID__=-1,e})();function Bh(e,t){$i(Cc(e)[1],tn())}function Hh(e){let t=function(e){return Object.getPrototypeOf(e.prototype).constructor}(e.type),n=!0;const r=[e];for(;t;){let s;if(Wn(e))s=t.\u0275cmp||t.\u0275dir;else{if(t.\u0275cmp)throw new Error("Directives cannot inherit Components");s=t.\u0275dir}if(s){if(n){r.push(s);const c=e;c.inputs=$h(e.inputs),c.declaredInputs=$h(e.declaredInputs),c.outputs=$h(e.outputs);const d=s.hostBindings;d&&sv(e,d);const g=s.viewQuery,v=s.contentQueries;if(g&&Gh(e,g),v&&Cm(e,v),Oe(e.inputs,s.inputs),Oe(e.declaredInputs,s.declaredInputs),Oe(e.outputs,s.outputs),Wn(s)&&s.data.animation){const D=e.data;D.animation=(D.animation||[]).concat(s.data.animation)}}const l=s.features;if(l)for(let c=0;c=0;r--){const s=e[r];s.hostVars=t+=s.hostVars,s.hostAttrs=Xo(s.hostAttrs,n=Xo(n,s.hostAttrs))}}(r)}function $h(e){return e===sn?{}:e===vt?[]:e}function Gh(e,t){const n=e.viewQuery;e.viewQuery=n?(r,s)=>{t(r,s),n(r,s)}:t}function Cm(e,t){const n=e.contentQueries;e.contentQueries=n?(r,s,l)=>{t(r,s,l),n(r,s,l)}:t}function sv(e,t){const n=e.hostBindings;e.hostBindings=n?(r,s)=>{t(r,s),n(r,s)}:t}let Pu=null;function sa(){if(!Pu){const e=Pt.Symbol;if(e&&e.iterator)Pu=e.iterator;else{const t=Object.getOwnPropertyNames(Map.prototype);for(let n=0;nd(ut(Xe[r.index])):r.index;if($e(n)){let Xe=null;if(!d&&g&&(Xe=function(e,t,n,r){const s=e.cleanup;if(null!=s)for(let l=0;lg?d[g]:null}"string"==typeof c&&(l+=2)}return null}(e,t,s,r.index)),null!==Xe)(Xe.__ngLastListenerFn__||Xe).__ngNextListenerFn__=l,Xe.__ngLastListenerFn__=l,k=!1;else{l=Nm(r,t,I,l,!1);const yt=n.listen(me,s,l);R.push(l,yt),D&&D.push(s,He,X,X+1)}}else l=Nm(r,t,I,l,!0),me.addEventListener(s,l,c),R.push(l),D&&D.push(s,He,X,c)}else l=Nm(r,t,I,l,!1);const U=r.outputs;let W;if(k&&null!==U&&(W=U[s])){const B=W.length;if(B)for(let me=0;me=0}function km(e,t){return function(e,t,n,r){const s=le(),l=mt(),c=function(e){const t=Ye.lFrame,n=t.bindingIndex;return t.bindingIndex=t.bindingIndex+e,n}(2);l.firstUpdatePass&&function(e,t,n,r){const s=e.data;if(null===s[n+1]){const l=s[Mn()],c=function(e,t){return t>=e.expandoStartIndex}(e,n);(function(e,t){return 0!=(e.flags&(t?16:32))})(l,r)&&null===t&&!c&&(t=!1),t=function(e,t,n,r){const s=function(e){const t=Ye.lFrame.currentDirectiveIndex;return-1===t?null:e[t]}(e);let l=r?t.residualClasses:t.residualStyles;if(null===s)0===(r?t.classBindings:t.styleBindings)&&(n=Ud(n=Lm(null,e,t,n,r),t.attrs,r),l=null);else{const c=t.directiveStylingLast;if(-1===c||e[c]!==s)if(n=Lm(s,e,t,n,r),null===l){let g=function(e,t,n){const r=n?t.classBindings:t.styleBindings;if(0!==yr(r))return e[_r(r)]}(e,t,r);void 0!==g&&Array.isArray(g)&&(g=Lm(null,e,t,g[1],r),g=Ud(g,t.attrs,r),function(e,t,n,r){e[_r(n?t.classBindings:t.styleBindings)]=r}(e,t,r,g))}else l=function(e,t,n){let r;const s=t.directiveEnd;for(let l=1+t.directiveStylingLast;l0)&&(v=!0)}else D=n;if(s)if(0!==g){const R=_r(e[d+1]);e[r+1]=Ci(R,d),0!==R&&(e[R+1]=fu(e[R+1],r)),e[d+1]=function(e,t){return 131071&e|t<<17}(e[d+1],r)}else e[r+1]=Ci(d,0),0!==d&&(e[d+1]=fu(e[d+1],r)),d=r;else e[r+1]=Ci(g,0),0===d?d=r:e[g+1]=fu(e[g+1],r),g=r;v&&(e[r+1]=sh(e[r+1])),Nv(e,D,r,!0),Nv(e,D,r,!1),function(e,t,n,r,s){const l=s?e.residualClasses:e.residualStyles;null!=l&&"string"==typeof t&&rs(l,t)>=0&&(n[r+1]=ah(n[r+1]))}(t,D,e,r,l),c=Ci(d,g),l?t.classBindings=c:t.styleBindings=c}(s,l,t,n,c,r)}}(l,e,c,r),t!==nt&&Rn(s,c,t)&&function(e,t,n,r,s,l,c,d){if(!(3&t.type))return;const g=e.data,v=g[d+1];Yh(function(e){return 1==(1&e)}(v)?zv(g,t,n,s,yr(v),c):void 0)||(Yh(l)||function(e){return 2==(2&e)}(v)&&(l=zv(g,null,n,s,d,c)),function(e,t,n,r,s){const l=$e(e);if(t)s?l?e.addClass(n,r):n.classList.add(r):l?e.removeClass(n,r):n.classList.remove(r);else{let c=-1===r.indexOf("-")?void 0:qi.DashCase;if(null==s)l?e.removeStyle(n,r,c):n.style.removeProperty(r);else{const d="string"==typeof s&&s.endsWith("!important");d&&(s=s.slice(0,-10),c|=qi.Important),l?e.setStyle(n,r,s,c):n.style.setProperty(r,s,d?"important":"")}}}(r,c,kn(Mn(),n),s,l))}(l,l.data[Mn()],s,s[11],e,s[c+1]=function(e,t){return null==e||("string"==typeof t?e+=t:"object"==typeof e&&(e=ue(Xt(e)))),e}(t,n),r,c)}(e,t,null,!0),km}function Lm(e,t,n,r,s){let l=null;const c=n.directiveEnd;let d=n.directiveStylingLast;for(-1===d?d=n.directiveStart:d++;d0;){const g=e[s],v=Array.isArray(g),D=v?g[1]:g,I=null===D;let R=n[s+1];R===nt&&(R=I?vt:void 0);let k=I?hc(R,r):D===r?R:void 0;if(v&&!Yh(k)&&(k=hc(g,r)),Yh(k)&&(d=k,c))return d;const U=e[s+1];s=c?_r(U):yr(U)}if(null!==t){let g=l?t.residualClasses:t.residualStyles;null!=g&&(d=hc(g,r))}return d}function Yh(e){return void 0!==e}function Yv(e,t=""){const n=le(),r=mt(),s=e+20,l=r.firstCreatePass?Xa(r,s,1,t,null):r.data[s],c=n[s]=function(e,t){return $e(e)?e.createText(t):e.createTextNode(t)}(n[11],t);Ba(r,n,c,l),Tr(l,!1)}function Vm(e){return Um("",e,""),Vm}function Um(e,t,n){const r=le(),s=function(e,t,n,r){return Rn(e,tr(),n)?t+ae(n)+r:nt}(r,e,t,n);return s!==nt&&or(r,Mn(),s),Um}function jm(e,t,n){const r=le();return Rn(r,tr(),t)&&ir(mt(),$t(),r,e,t,r[11],n,!0),jm}const pl=void 0;var dE=["en",[["a","p"],["AM","PM"],pl],[["AM","PM"],pl,pl],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],pl,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],pl,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm a","h:mm:ss a","h:mm:ss a z","h:mm:ss a zzzz"],["{1}, {0}",pl,"{1} 'at' {0}",pl],[".",",",";","%","+","-","E","\xd7","\u2030","\u221e","NaN",":"],["#,##0.###","#,##0%","\xa4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",function(e){const t=Math.floor(Math.abs(e)),n=e.toString().replace(/^[^.]*\.?/,"").length;return 1===t&&0===n?1:5}];let Uu={};function Bm(e){const t=function(e){return e.toLowerCase().replace(/_/g,"-")}(e);let n=pC(t);if(n)return n;const r=t.split("-")[0];if(n=pC(r),n)return n;if("en"===r)return dE;throw new Error(`Missing locale data for the locale "${e}".`)}function hC(e){return Bm(e)[Je.PluralCase]}function pC(e){return e in Uu||(Uu[e]=Pt.ng&&Pt.ng.common&&Pt.ng.common.locales&&Pt.ng.common.locales[e]),Uu[e]}var Je=(()=>((Je=Je||{})[Je.LocaleId=0]="LocaleId",Je[Je.DayPeriodsFormat=1]="DayPeriodsFormat",Je[Je.DayPeriodsStandalone=2]="DayPeriodsStandalone",Je[Je.DaysFormat=3]="DaysFormat",Je[Je.DaysStandalone=4]="DaysStandalone",Je[Je.MonthsFormat=5]="MonthsFormat",Je[Je.MonthsStandalone=6]="MonthsStandalone",Je[Je.Eras=7]="Eras",Je[Je.FirstDayOfWeek=8]="FirstDayOfWeek",Je[Je.WeekendRange=9]="WeekendRange",Je[Je.DateFormat=10]="DateFormat",Je[Je.TimeFormat=11]="TimeFormat",Je[Je.DateTimeFormat=12]="DateTimeFormat",Je[Je.NumberSymbols=13]="NumberSymbols",Je[Je.NumberFormats=14]="NumberFormats",Je[Je.CurrencyCode=15]="CurrencyCode",Je[Je.CurrencySymbol=16]="CurrencySymbol",Je[Je.CurrencyName=17]="CurrencyName",Je[Je.Currencies=18]="Currencies",Je[Je.Directionality=19]="Directionality",Je[Je.PluralCase=20]="PluralCase",Je[Je.ExtraData=21]="ExtraData",Je))();const Kh="en-US";let gC=Kh;function Hm(e){Pe(e,"Expected localeId to be defined"),"string"==typeof e&&(gC=e.toLowerCase().replace(/_/g,"-"))}function Wm(e,t,n,r,s){if(e=se(e),Array.isArray(e))for(let l=0;l>20;if(ia(e)||!e.multi){const k=new Gi(g,s,Vd),U=qm(d,t,s?D:D+R,I);-1===U?(E(_(v,c),l,d),zm(l,e,t.length),t.push(d),v.directiveStart++,v.directiveEnd++,s&&(v.providerIndexes+=1048576),n.push(k),c.push(k)):(n[U]=k,c[U]=k)}else{const k=qm(d,t,D+R,I),U=qm(d,t,D,D+R),W=k>=0&&n[k],B=U>=0&&n[U];if(s&&!B||!s&&!W){E(_(v,c),l,d);const me=function(e,t,n,r,s){const l=new Gi(e,n,Vd);return l.multi=[],l.index=t,l.componentProviders=0,UC(l,s,r&&!n),l}(s?lD:aD,n.length,s,r,g);!s&&B&&(n[U].providerFactory=me),zm(l,e,t.length,0),t.push(d),v.directiveStart++,v.directiveEnd++,s&&(v.providerIndexes+=1048576),n.push(me),c.push(me)}else zm(l,e,k>-1?k:U,UC(n[s?U:k],g,!s&&r));!s&&r&&B&&n[U].componentProviders++}}}function zm(e,t,n,r){const s=ia(t);if(s||function(e){return!!e.useClass}(t)){const c=(t.useClass||t).prototype.ngOnDestroy;if(c){const d=e.destroyHooks||(e.destroyHooks=[]);if(!s&&t.multi){const g=d.indexOf(n);-1===g?d.push(n,[r,c]):d[g+1].push(r,c)}else d.push(n,c)}}}function UC(e,t,n){return n&&e.componentProviders++,e.multi.push(t)-1}function qm(e,t,n,r){for(let s=n;s{n.providersResolver=(r,s)=>function(e,t,n){const r=mt();if(r.firstCreatePass){const s=Wn(e);Wm(n,r.data,r.blueprint,s,!0),Wm(t,r.data,r.blueprint,s,!1)}}(r,s?s(e):e,t)}}class BC{}const $C="ngComponent";class dD{resolveComponentFactory(t){throw function(e){const t=Error(`No component factory found for ${ue(e)}. Did you add it to @NgModule.entryComponents?`);return t[$C]=e,t}(t)}}let Bu=(()=>{class e{}return e.NULL=new dD,e})();function ep(...e){}function Hu(e,t){return new Ho(qt(e,t))}const pD=function(){return Hu(tn(),le())};let Ho=(()=>{class e{constructor(n){this.nativeElement=n}}return e.__NG_ELEMENT_ID__=pD,e})();function GC(e){return e instanceof Ho?e.nativeElement:e}class tp{}let gD=(()=>{class e{}return e.__NG_ELEMENT_ID__=()=>_D(),e})();const _D=function(){const e=le(),n=_n(tn().index,e);return function(e){return e[11]}(Xn(n)?n:e)};let Jm=(()=>{class e{}return e.\u0275prov=Ct({token:e,providedIn:"root",factory:()=>null}),e})();class WC{constructor(t){this.full=t,this.major=t.split(".")[0],this.minor=t.split(".")[1],this.patch=t.split(".").slice(2).join(".")}}const zC=new WC("12.2.17");class qC{constructor(){}supports(t){return Ou(t)}create(t){return new bD(t)}}const CD=(e,t)=>t;class bD{constructor(t){this.length=0,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null,this._identityChangesHead=null,this._identityChangesTail=null,this._trackByFn=t||CD}forEachItem(t){let n;for(n=this._itHead;null!==n;n=n._next)t(n)}forEachOperation(t){let n=this._itHead,r=this._removalsHead,s=0,l=null;for(;n||r;){const c=!r||n&&n.currentIndex{c=this._trackByFn(s,d),null!==n&&Object.is(n.trackById,c)?(r&&(n=this._verifyReinsertion(n,d,c,s)),Object.is(n.item,d)||this._addIdentityChange(n,d)):(n=this._mismatch(n,d,c,s),r=!0),n=n._next,s++}),this.length=s;return this._truncate(n),this.collection=t,this.isDirty}get isDirty(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead||null!==this._identityChangesHead}_reset(){if(this.isDirty){let t;for(t=this._previousItHead=this._itHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._additionsHead;null!==t;t=t._nextAdded)t.previousIndex=t.currentIndex;for(this._additionsHead=this._additionsTail=null,t=this._movesHead;null!==t;t=t._nextMoved)t.previousIndex=t.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(t,n,r,s){let l;return null===t?l=this._itTail:(l=t._prev,this._remove(t)),null!==(t=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null))?(Object.is(t.item,n)||this._addIdentityChange(t,n),this._reinsertAfter(t,l,s)):null!==(t=null===this._linkedRecords?null:this._linkedRecords.get(r,s))?(Object.is(t.item,n)||this._addIdentityChange(t,n),this._moveAfter(t,l,s)):t=this._addAfter(new wD(n,r),l,s),t}_verifyReinsertion(t,n,r,s){let l=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null);return null!==l?t=this._reinsertAfter(l,t._prev,s):t.currentIndex!=s&&(t.currentIndex=s,this._addToMoves(t,s)),t}_truncate(t){for(;null!==t;){const n=t._next;this._addToRemovals(this._unlink(t)),t=n}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null),null!==this._identityChangesTail&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(t,n,r){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(t);const s=t._prevRemoved,l=t._nextRemoved;return null===s?this._removalsHead=l:s._nextRemoved=l,null===l?this._removalsTail=s:l._prevRemoved=s,this._insertAfter(t,n,r),this._addToMoves(t,r),t}_moveAfter(t,n,r){return this._unlink(t),this._insertAfter(t,n,r),this._addToMoves(t,r),t}_addAfter(t,n,r){return this._insertAfter(t,n,r),this._additionsTail=null===this._additionsTail?this._additionsHead=t:this._additionsTail._nextAdded=t,t}_insertAfter(t,n,r){const s=null===n?this._itHead:n._next;return t._next=s,t._prev=n,null===s?this._itTail=t:s._prev=t,null===n?this._itHead=t:n._next=t,null===this._linkedRecords&&(this._linkedRecords=new YC),this._linkedRecords.put(t),t.currentIndex=r,t}_remove(t){return this._addToRemovals(this._unlink(t))}_unlink(t){null!==this._linkedRecords&&this._linkedRecords.remove(t);const n=t._prev,r=t._next;return null===n?this._itHead=r:n._next=r,null===r?this._itTail=n:r._prev=n,t}_addToMoves(t,n){return t.previousIndex===n||(this._movesTail=null===this._movesTail?this._movesHead=t:this._movesTail._nextMoved=t),t}_addToRemovals(t){return null===this._unlinkedRecords&&(this._unlinkedRecords=new YC),this._unlinkedRecords.put(t),t.currentIndex=null,t._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=t,t._prevRemoved=null):(t._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=t),t}_addIdentityChange(t,n){return t.item=n,this._identityChangesTail=null===this._identityChangesTail?this._identityChangesHead=t:this._identityChangesTail._nextIdentityChange=t,t}}class wD{constructor(t,n){this.item=t,this.trackById=n,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null,this._nextIdentityChange=null}}class ED{constructor(){this._head=null,this._tail=null}add(t){null===this._head?(this._head=this._tail=t,t._nextDup=null,t._prevDup=null):(this._tail._nextDup=t,t._prevDup=this._tail,t._nextDup=null,this._tail=t)}get(t,n){let r;for(r=this._head;null!==r;r=r._nextDup)if((null===n||n<=r.currentIndex)&&Object.is(r.trackById,t))return r;return null}remove(t){const n=t._prevDup,r=t._nextDup;return null===n?this._head=r:n._nextDup=r,null===r?this._tail=n:r._prevDup=n,null===this._head}}class YC{constructor(){this.map=new Map}put(t){const n=t.trackById;let r=this.map.get(n);r||(r=new ED,this.map.set(n,r)),r.add(t)}get(t,n){const s=this.map.get(t);return s?s.get(t,n):null}remove(t){const n=t.trackById;return this.map.get(n).remove(t)&&this.map.delete(n),t}get isEmpty(){return 0===this.map.size}clear(){this.map.clear()}}function KC(e,t,n){const r=e.previousIndex;if(null===r)return r;let s=0;return n&&r{if(n&&n.key===s)this._maybeAddToChanges(n,r),this._appendAfter=n,n=n._next;else{const l=this._getOrCreateRecordForKey(s,r);n=this._insertBeforeOrAppend(n,l)}}),n){n._prev&&(n._prev._next=null),this._removalsHead=n;for(let r=n;null!==r;r=r._nextRemoved)r===this._mapHead&&(this._mapHead=null),this._records.delete(r.key),r._nextRemoved=r._next,r.previousValue=r.currentValue,r.currentValue=null,r._prev=null,r._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(t,n){if(t){const r=t._prev;return n._next=t,n._prev=r,t._prev=n,r&&(r._next=n),t===this._mapHead&&(this._mapHead=n),this._appendAfter=t,t}return this._appendAfter?(this._appendAfter._next=n,n._prev=this._appendAfter):this._mapHead=n,this._appendAfter=n,null}_getOrCreateRecordForKey(t,n){if(this._records.has(t)){const s=this._records.get(t);this._maybeAddToChanges(s,n);const l=s._prev,c=s._next;return l&&(l._next=c),c&&(c._prev=l),s._next=null,s._prev=null,s}const r=new SD(t);return this._records.set(t,r),r.currentValue=n,this._addToAdditions(r),r}_reset(){if(this.isDirty){let t;for(this._previousMapHead=this._mapHead,t=this._previousMapHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._changesHead;null!==t;t=t._nextChanged)t.previousValue=t.currentValue;for(t=this._additionsHead;null!=t;t=t._nextAdded)t.previousValue=t.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(t,n){Object.is(n,t.currentValue)||(t.previousValue=t.currentValue,t.currentValue=n,this._addToChanges(t))}_addToAdditions(t){null===this._additionsHead?this._additionsHead=this._additionsTail=t:(this._additionsTail._nextAdded=t,this._additionsTail=t)}_addToChanges(t){null===this._changesHead?this._changesHead=this._changesTail=t:(this._changesTail._nextChanged=t,this._changesTail=t)}_forEach(t,n){t instanceof Map?t.forEach(n):Object.keys(t).forEach(r=>n(t[r],r))}}class SD{constructor(t){this.key=t,this.previousValue=null,this.currentValue=null,this._nextPrevious=null,this._next=null,this._prev=null,this._nextAdded=null,this._nextRemoved=null,this._nextChanged=null}}function QC(){return new np([new qC])}let np=(()=>{class e{constructor(n){this.factories=n}static create(n,r){if(null!=r){const s=r.factories.slice();n=n.concat(s)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||QC()),deps:[[e,new Mo,new gi]]}}find(n){const r=this.factories.find(s=>s.supports(n));if(null!=r)return r;throw new Error(`Cannot find a differ supporting object '${n}' of type '${function(e){return e.name||typeof e}(n)}'`)}}return e.\u0275prov=Ct({token:e,providedIn:"root",factory:QC}),e})();function ZC(){return new rp([new JC])}let rp=(()=>{class e{constructor(n){this.factories=n}static create(n,r){if(r){const s=r.factories.slice();n=n.concat(s)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||ZC()),deps:[[e,new Mo,new gi]]}}find(n){const r=this.factories.find(s=>s.supports(n));if(r)return r;throw new Error(`Cannot find a differ supporting object '${n}'`)}}return e.\u0275prov=Ct({token:e,providedIn:"root",factory:ZC}),e})();function ip(e,t,n,r,s=!1){for(;null!==n;){const l=t[n.index];if(null!==l&&r.push(ut(l)),Dn(l))for(let d=10;d-1&&(eu(t,r),ns(n,r))}this._attachedToViewContainer=!1}kf(this._lView[1],this._lView)}onDestroy(t){cd(this._lView[1],this._lView,null,t)}markForCheck(){wd(this._cdRefInjectingView||this._lView)}detach(){this._lView[2]&=-129}reattach(){this._lView[2]|=128}detectChanges(){Eu(this._lView[1],this._lView,this.context)}checkNoChanges(){!function(e,t,n){Os(!0);try{Eu(e,t,n)}finally{Os(!1)}}(this._lView[1],this._lView,this.context)}attachToViewContainerRef(){if(this._appRef)throw new Error("This view is already attached directly to the ApplicationRef!");this._attachedToViewContainer=!0}detachFromAppRef(){var t;this._appRef=null,$a(this._lView[1],t=this._lView,t[11],2,null,null)}attachToAppRef(t){if(this._attachedToViewContainer)throw new Error("This view is already attached to a ViewContainer!");this._appRef=t}}class AD extends Gd{constructor(t){super(t),this._view=t}detectChanges(){bh(this._view)}checkNoChanges(){!function(e){Os(!0);try{bh(e)}finally{Os(!1)}}(this._view)}get context(){return null}}const MD=function(e){return function(e,t,n){if(Li(e)&&!n){const r=_n(e.index,t);return new Gd(r,r)}return 47&e.type?new Gd(t[16],t):null}(tn(),le(),16==(16&e))};let xD=(()=>{class e{}return e.__NG_ELEMENT_ID__=MD,e})();const OD=[new JC],FD=new np([new qC]),kD=new rp(OD),VD=function(){return op(tn(),le())};let Wd=(()=>{class e{}return e.__NG_ELEMENT_ID__=VD,e})();const UD=Wd,jD=class extends UD{constructor(t,n,r){super(),this._declarationLView=t,this._declarationTContainer=n,this.elementRef=r}createEmbeddedView(t){const n=this._declarationTContainer.tViews,r=Za(this._declarationLView,n,t,16,null,n.declTNode,null,null,null,null);r[17]=this._declarationLView[this._declarationTContainer.index];const l=this._declarationLView[19];return null!==l&&(r[19]=l.createEmbeddedView(n)),na(n,r,t),new Gd(r)}};function op(e,t){return 4&e.type?new jD(t,e,Hu(e,t)):null}class gl{}class XC{}const $D=function(){return nb(tn(),le())};let sp=(()=>{class e{}return e.__NG_ELEMENT_ID__=$D,e})();const WD=sp,eb=class extends WD{constructor(t,n,r){super(),this._lContainer=t,this._hostTNode=n,this._hostLView=r}get element(){return Hu(this._hostTNode,this._hostLView)}get injector(){return new Ir(this._hostTNode,this._hostLView)}get parentInjector(){const t=y(this._hostTNode,this._hostLView);if($l(t)){const n=Do(t,this._hostLView),r=zi(t);return new Ir(n[1].data[r+8],n)}return new Ir(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(t){const n=tb(this._lContainer);return null!==n&&n[t]||null}get length(){return this._lContainer.length-10}createEmbeddedView(t,n,r){const s=t.createEmbeddedView(n||{});return this.insert(s,r),s}createComponent(t,n,r,s,l){const c=r||this.parentInjector;if(!l&&null==t.ngModule&&c){const g=c.get(gl,null);g&&(l=g)}const d=t.create(c,s,void 0,l);return this.insert(d.hostView,n),d}insert(t,n){const r=t._lView,s=r[1];if(Dn(r[3])){const D=this.indexOf(t);if(-1!==D)this.detach(D);else{const I=r[3],R=new eb(I,I[6],I[3]);R.detach(R.indexOf(t))}}const l=this._adjustIndex(n),c=this._lContainer;!function(e,t,n,r){const s=10+r,l=n.length;r>0&&(n[s-1][4]=t),rSg});class Db extends BC{constructor(t,n){super(),this.componentDef=t,this.ngModule=n,this.componentType=t.type,this.selector=t.selectors.map(Fg).join(","),this.ngContentSelectors=t.ngContentSelectors?t.ngContentSelectors:[],this.isBoundToModule=!!n}get inputs(){return Eb(this.componentDef.inputs)}get outputs(){return Eb(this.componentDef.outputs)}create(t,n,r,s){const l=(s=s||this.ngModule)?function(e,t){return{get:(n,r,s)=>{const l=e.get(n,zu,s);return l!==zu||r===zu?l:t.get(n,r,s)}}}(t,s.injector):t,c=l.get(tp,Et),d=l.get(Jm,null),g=c.createRenderer(null,this.componentDef),v=this.componentDef.selectors[0][0]||"div",D=r?function(e,t,n){if($e(e))return e.selectRootElement(t,n===ct.ShadowDom);let r="string"==typeof t?e.querySelector(t):t;return r.textContent="",r}(g,r,this.componentDef.encapsulation):Dc(c.createRenderer(null,this.componentDef),v,function(e){const t=e.toLowerCase();return"svg"===t?"http://www.w3.org/2000/svg":"math"===t?"http://www.w3.org/1998/MathML/":null}(v)),I=this.componentDef.onPush?576:528,R=function(e,t){return{components:[],scheduler:e||Sg,clean:wh,playerHandler:t||null,flags:0}}(),k=el(0,null,null,1,0,null,null,null,null,null),U=Za(null,k,R,I,null,null,c,g,d,l);let W,B;Fs(U);try{const me=function(e,t,n,r,s,l){const c=n[1];n[20]=e;const g=Xa(c,20,2,"#host",null),v=g.mergedAttrs=t.hostAttrs;null!==v&&(Vo(g,v,!0),null!==e&&(js(s,e,v),null!==g.classes&&xc(s,e,g.classes),null!==g.styles&&Gf(s,e,g.styles)));const D=r.createRenderer(e,t),I=Za(n,ad(t),null,t.onPush?64:16,n[20],g,r,D,l||null,null);return c.firstCreatePass&&(E(_(g,n),c,t.type),tl(c,g),yh(g,n.length,1)),wu(n,I),n[20]=I}(D,this.componentDef,U,c,g);if(D)if(r)js(g,D,["ng-version",zC.full]);else{const{attrs:X,classes:He}=function(e){const t=[],n=[];let r=1,s=2;for(;r0&&xc(g,D,He.join(" "))}if(B=dr(k,20),void 0!==n){const X=B.projection=[];for(let He=0;Heg(c,t)),t.contentQueries){const g=tn();t.contentQueries(1,c,g.directiveStart)}const d=tn();return!l.firstCreatePass||null===t.hostBindings&&null===t.hostAttrs||(zn(d.index),_d(n[1],d,0,d.directiveStart,d.directiveEnd,t),_h(t,c)),c}(me,this.componentDef,U,R,[Bh]),na(k,U,null)}finally{Ls()}return new GS(this.componentType,W,Hu(B,U),U,B)}}class GS extends class{}{constructor(t,n,r,s,l){super(),this.location=r,this._rootLView=s,this._tNode=l,this.instance=n,this.hostView=this.changeDetectorRef=new AD(s),this.componentType=t}get injector(){return new Ir(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(t){this.hostView.onDestroy(t)}}const qu=new Map;class qS extends gl{constructor(t,n){super(),this._parent=n,this._bootstrapComponents=[],this.injector=this,this.destroyCbs=[],this.componentFactoryResolver=new wb(this);const r=pn(t),s=t[Es]||null;s&&Hm(s),this._bootstrapComponents=vi(r.bootstrap),this._r3Injector=sm(t,n,[{provide:gl,useValue:this},{provide:Bu,useValue:this.componentFactoryResolver}],ue(t)),this._r3Injector._resolveInjectorDefTypes(),this.instance=this.get(t)}get(t,n=Jt.THROW_IF_NOT_FOUND,r=Ge.Default){return t===Jt||t===gl||t===Uo?this:this._r3Injector.get(t,n,r)}destroy(){const t=this._r3Injector;!t.destroyed&&t.destroy(),this.destroyCbs.forEach(n=>n()),this.destroyCbs=null}onDestroy(t){this.destroyCbs.push(t)}}class c_ extends XC{constructor(t){super(),this.moduleType=t,null!==pn(t)&&function(e){const t=new Set;!function n(r){const s=pn(r,!0),l=s.id;null!==l&&(function(e,t,n){if(t&&t!==n)throw new Error(`Duplicate module registered for ${e} - ${ue(t)} vs ${ue(t.name)}`)}(l,qu.get(l),r),qu.set(l,r));const c=vi(s.imports);for(const d of c)t.has(d)||(t.add(d),n(d))}(e)}(t)}create(t){return new qS(this.moduleType,t)}}function Ab(e,t,n,r,s,l){const c=t+n;return Rn(e,c,s)?function(e,t,n){return e[t]=n}(e,c+1,l?r.call(l,s):r(s)):function(e,t){const n=e[t];return n===nt?void 0:n}(e,c+1)}function Pb(e,t){const n=mt();let r;const s=e+20;n.firstCreatePass?(r=function(e,t){if(t)for(let n=t.length-1;n>=0;n--){const r=t[n];if(e===r.name)return r}throw new be("302",`The pipe '${e}' could not be found!`)}(t,n.pipeRegistry),n.data[s]=r,r.onDestroy&&(n.destroyHooks||(n.destroyHooks=[])).push(s,r.onDestroy)):r=n.data[s];const l=r.factory||(r.factory=ui(r.type)),c=ze(Vd);try{const d=So(!1),g=l();return So(d),function(e,t,n,r){n>=e.data.length&&(e.data[n]=null,e.blueprint[n]=null),t[n]=r}(n,le(),s,g),g}finally{ze(c)}}function Ob(e,t,n){const r=e+20,s=le(),l=$r(s,r);return function(e,t){Si.isWrapped(t)&&(t=Si.unwrap(t),e[Ye.lFrame.bindingIndex]=nt);return t}(s,function(e,t){return e[1].data[t].pure}(s,r)?Ab(s,function(){const e=Ye.lFrame;let t=e.bindingRootIndex;return-1===t&&(t=e.bindingRootIndex=e.tView.bindingStartIndex),t}(),t,l.transform,n,l):l.transform(n))}function d_(e){return t=>{setTimeout(e,void 0,t)}}const $o=class extends Z.x{constructor(t=!1){super(),this.__isAsync=t}emit(t){super.next(t)}subscribe(t,n,r){var s,l,c;let d=t,g=n||(()=>null),v=r;if(t&&"object"==typeof t){const I=t;d=null===(s=I.next)||void 0===s?void 0:s.bind(I),g=null===(l=I.error)||void 0===l?void 0:l.bind(I),v=null===(c=I.complete)||void 0===c?void 0:c.bind(I)}this.__isAsync&&(g=d_(g),d&&(d=d_(d)),v&&(v=d_(v)));const D=super.subscribe({next:d,error:g,complete:v});return t instanceof ye.w0&&t.add(D),D}};function cT(){return this._results[sa()]()}class dp{constructor(t=!1){this._emitDistinctChangesOnly=t,this.dirty=!0,this._results=[],this._changesDetected=!1,this._changes=null,this.length=0,this.first=void 0,this.last=void 0;const n=sa(),r=dp.prototype;r[n]||(r[n]=cT)}get changes(){return this._changes||(this._changes=new $o)}get(t){return this._results[t]}map(t){return this._results.map(t)}filter(t){return this._results.filter(t)}find(t){return this._results.find(t)}reduce(t,n){return this._results.reduce(t,n)}forEach(t){this._results.forEach(t)}some(t){return this._results.some(t)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(t,n){const r=this;r.dirty=!1;const s=xr(t);(this._changesDetected=!function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r0)r.push(c[d/2]);else{const v=l[d+1],D=t[-g];for(let I=10;I{class e{constructor(n){this.appInits=n,this.resolve=ep,this.reject=ep,this.initialized=!1,this.done=!1,this.donePromise=new Promise((r,s)=>{this.resolve=r,this.reject=s})}runInitializers(){if(this.initialized)return;const n=[],r=()=>{this.done=!0,this.resolve()};if(this.appInits)for(let s=0;s{l.subscribe({complete:d,error:g})});n.push(c)}}Promise.all(n).then(()=>{r()}).catch(s=>{this.reject(s)}),0===n.length&&r(),this.initialized=!0}}return e.\u0275fac=function(n){return new(n||e)(ln(w_,8))},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();const sw=new Zt("AppId"),zT={provide:sw,useFactory:function(){return`${E_()}${E_()}${E_()}`},deps:[]};function E_(){return String.fromCharCode(97+Math.floor(25*Math.random()))}const aw=new Zt("Platform Initializer"),lw=new Zt("Platform ID"),uw=new Zt("appBootstrapListener");let cw=(()=>{class e{log(n){console.log(n)}warn(n){console.warn(n)}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();const pp=new Zt("LocaleId"),dw=new Zt("DefaultCurrencyCode");class YT{constructor(t,n){this.ngModuleFactory=t,this.componentFactories=n}}const D_=function(e){return new c_(e)},KT=D_,JT=function(e){return Promise.resolve(D_(e))},fw=function(e){const t=D_(e),r=vi(pn(e).declarations).reduce((s,l)=>{const c=Wt(l);return c&&s.push(new Db(c)),s},[]);return new YT(t,r)},QT=fw,ZT=function(e){return Promise.resolve(fw(e))};let rf=(()=>{class e{constructor(){this.compileModuleSync=KT,this.compileModuleAsync=JT,this.compileModuleAndAllComponentsSync=QT,this.compileModuleAndAllComponentsAsync=ZT}clearCache(){}clearCacheFor(n){}getModuleId(n){}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();const tA=(()=>Promise.resolve(0))();function S_(e){"undefined"==typeof Zone?tA.then(()=>{e&&e.apply(null,null)}):Zone.current.scheduleMicroTask("scheduleMicrotask",e)}class Qr{constructor({enableLongStackTrace:t=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new $o(!1),this.onMicrotaskEmpty=new $o(!1),this.onStable=new $o(!1),this.onError=new $o(!1),"undefined"==typeof Zone)throw new Error("In this configuration Angular requires Zone.js");Zone.assertZonePatched();const s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),t&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!r&&n,s.shouldCoalesceRunChangeDetection=r,s.lastRequestAnimationFrameId=-1,s.nativeRequestAnimationFrame=function(){let e=Pt.requestAnimationFrame,t=Pt.cancelAnimationFrame;if("undefined"!=typeof Zone&&e&&t){const n=e[Zone.__symbol__("OriginalDelegate")];n&&(e=n);const r=t[Zone.__symbol__("OriginalDelegate")];r&&(t=r)}return{nativeRequestAnimationFrame:e,nativeCancelAnimationFrame:t}}().nativeRequestAnimationFrame,function(e){const t=()=>{!function(e){e.isCheckStableRunning||-1!==e.lastRequestAnimationFrameId||(e.lastRequestAnimationFrameId=e.nativeRequestAnimationFrame.call(Pt,()=>{e.fakeTopEventTask||(e.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{e.lastRequestAnimationFrameId=-1,A_(e),e.isCheckStableRunning=!0,T_(e),e.isCheckStableRunning=!1},void 0,()=>{},()=>{})),e.fakeTopEventTask.invoke()}),A_(e))}(e)};e._inner=e._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(n,r,s,l,c,d)=>{try{return hw(e),n.invokeTask(s,l,c,d)}finally{(e.shouldCoalesceEventChangeDetection&&"eventTask"===l.type||e.shouldCoalesceRunChangeDetection)&&t(),pw(e)}},onInvoke:(n,r,s,l,c,d,g)=>{try{return hw(e),n.invoke(s,l,c,d,g)}finally{e.shouldCoalesceRunChangeDetection&&t(),pw(e)}},onHasTask:(n,r,s,l)=>{n.hasTask(s,l),r===s&&("microTask"==l.change?(e._hasPendingMicrotasks=l.microTask,A_(e),T_(e)):"macroTask"==l.change&&(e.hasPendingMacrotasks=l.macroTask))},onHandleError:(n,r,s,l)=>(n.handleError(s,l),e.runOutsideAngular(()=>e.onError.emit(l)),!1)})}(s)}static isInAngularZone(){return!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!Qr.isInAngularZone())throw new Error("Expected to be in Angular Zone, but it is not!")}static assertNotInAngularZone(){if(Qr.isInAngularZone())throw new Error("Expected to not be in Angular Zone, but it is!")}run(t,n,r){return this._inner.run(t,n,r)}runTask(t,n,r,s){const l=this._inner,c=l.scheduleEventTask("NgZoneEvent: "+s,t,rA,ep,ep);try{return l.runTask(c,n,r)}finally{l.cancelTask(c)}}runGuarded(t,n,r){return this._inner.runGuarded(t,n,r)}runOutsideAngular(t){return this._outer.run(t)}}const rA={};function T_(e){if(0==e._nesting&&!e.hasPendingMicrotasks&&!e.isStable)try{e._nesting++,e.onMicrotaskEmpty.emit(null)}finally{if(e._nesting--,!e.hasPendingMicrotasks)try{e.runOutsideAngular(()=>e.onStable.emit(null))}finally{e.isStable=!0}}}function A_(e){e.hasPendingMicrotasks=!!(e._hasPendingMicrotasks||(e.shouldCoalesceEventChangeDetection||e.shouldCoalesceRunChangeDetection)&&-1!==e.lastRequestAnimationFrameId)}function hw(e){e._nesting++,e.isStable&&(e.isStable=!1,e.onUnstable.emit(null))}function pw(e){e._nesting--,T_(e)}class sA{constructor(){this.hasPendingMicrotasks=!1,this.hasPendingMacrotasks=!1,this.isStable=!0,this.onUnstable=new $o,this.onMicrotaskEmpty=new $o,this.onStable=new $o,this.onError=new $o}run(t,n,r){return t.apply(n,r)}runGuarded(t,n,r){return t.apply(n,r)}runOutsideAngular(t){return t()}runTask(t,n,r,s){return t.apply(n,r)}}let gw=(()=>{class e{constructor(n){this._ngZone=n,this._pendingCount=0,this._isZoneStable=!0,this._didWork=!1,this._callbacks=[],this.taskTrackingZone=null,this._watchAngularEvents(),n.run(()=>{this.taskTrackingZone="undefined"==typeof Zone?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){this._ngZone.onUnstable.subscribe({next:()=>{this._didWork=!0,this._isZoneStable=!1}}),this._ngZone.runOutsideAngular(()=>{this._ngZone.onStable.subscribe({next:()=>{Qr.assertNotInAngularZone(),S_(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}})})}increasePendingRequestCount(){return this._pendingCount+=1,this._didWork=!0,this._pendingCount}decreasePendingRequestCount(){if(this._pendingCount-=1,this._pendingCount<0)throw new Error("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount}isStable(){return this._isZoneStable&&0===this._pendingCount&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())S_(()=>{for(;0!==this._callbacks.length;){let n=this._callbacks.pop();clearTimeout(n.timeoutId),n.doneCb(this._didWork)}this._didWork=!1});else{let n=this.getPendingTasks();this._callbacks=this._callbacks.filter(r=>!r.updateCb||!r.updateCb(n)||(clearTimeout(r.timeoutId),!1)),this._didWork=!0}}getPendingTasks(){return this.taskTrackingZone?this.taskTrackingZone.macroTasks.map(n=>({source:n.source,creationLocation:n.creationLocation,data:n.data})):[]}addCallback(n,r,s){let l=-1;r&&r>0&&(l=setTimeout(()=>{this._callbacks=this._callbacks.filter(c=>c.timeoutId!==l),n(this._didWork,this.getPendingTasks())},r)),this._callbacks.push({doneCb:n,timeoutId:l,updateCb:s})}whenStable(n,r,s){if(s&&!this.taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(n,r,s),this._runCallbacksIfReady()}getPendingRequestCount(){return this._pendingCount}findProviders(n,r,s){return[]}}return e.\u0275fac=function(n){return new(n||e)(ln(Qr))},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})(),mw=(()=>{class e{constructor(){this._applications=new Map,I_.addToWindow(this)}registerApplication(n,r){this._applications.set(n,r)}unregisterApplication(n){this._applications.delete(n)}unregisterAllApplications(){this._applications.clear()}getTestability(n){return this._applications.get(n)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(n,r=!0){return I_.findTestabilityInTree(this,n,r)}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();class aA{addToWindow(t){}findTestabilityInTree(t,n,r){return null}}function lA(e){I_=e}let I_=new aA,_w=!0,yw=!1;function uA(){if(yw)throw new Error("Cannot enable prod mode after platform setup.");_w=!1}let io;const Cw=new Zt("AllowMultipleToken");class mA{constructor(t,n){this.name=t,this.token=n}}function bw(e,t,n=[]){const r=`Platform: ${t}`,s=new Zt(r);return(l=[])=>{let c=ww();if(!c||c.injector.get(Cw,!1))if(e)e(n.concat(l).concat({provide:s,useValue:!0}));else{const d=n.concat(l).concat({provide:s,useValue:!0},{provide:hs,useValue:"platform"});!function(e){if(io&&!io.destroyed&&!io.injector.get(Cw,!1))throw new Error("There can be only one platform. Destroy the previous one to create a new one.");io=e.get(Ew);const t=e.get(aw,null);t&&t.forEach(n=>n())}(Jt.create({providers:d,name:r}))}return function(e){const t=ww();if(!t)throw new Error("No platform exists!");if(!t.injector.get(e,null))throw new Error("A platform with a different configuration has been created. Please destroy it first.");return t}(s)}}function ww(){return io&&!io.destroyed?io:null}let Ew=(()=>{class e{constructor(n){this._injector=n,this._modules=[],this._destroyListeners=[],this._destroyed=!1}bootstrapModuleFactory(n,r){const d=function(e,t){let n;return n="noop"===e?new sA:("zone.js"===e?void 0:e)||new Qr({enableLongStackTrace:(yw=!0,_w),shouldCoalesceEventChangeDetection:!!(null==t?void 0:t.ngZoneEventCoalescing),shouldCoalesceRunChangeDetection:!!(null==t?void 0:t.ngZoneRunCoalescing)}),n}(r?r.ngZone:void 0,{ngZoneEventCoalescing:r&&r.ngZoneEventCoalescing||!1,ngZoneRunCoalescing:r&&r.ngZoneRunCoalescing||!1}),g=[{provide:Qr,useValue:d}];return d.run(()=>{const v=Jt.create({providers:g,parent:this.injector,name:n.moduleType.name}),D=n.create(v),I=D.injector.get(us,null);if(!I)throw new Error("No ErrorHandler. Is platform module (BrowserModule) included?");return d.runOutsideAngular(()=>{const R=d.onError.subscribe({next:k=>{I.handleError(k)}});D.onDestroy(()=>{M_(this._modules,D),R.unsubscribe()})}),function(e,t,n){try{const r=n();return Rm(r)?r.catch(s=>{throw t.runOutsideAngular(()=>e.handleError(s)),s}):r}catch(r){throw t.runOutsideAngular(()=>e.handleError(r)),r}}(I,d,()=>{const R=D.injector.get(Ku);return R.runInitializers(),R.donePromise.then(()=>(Hm(D.injector.get(pp,Kh)||Kh),this._moduleDoBootstrap(D),D))})})}bootstrapModule(n,r=[]){const s=Dw({},r);return function(e,t,n){const r=new c_(n);return Promise.resolve(r)}(0,0,n).then(l=>this.bootstrapModuleFactory(l,s))}_moduleDoBootstrap(n){const r=n.injector.get(of);if(n._bootstrapComponents.length>0)n._bootstrapComponents.forEach(s=>r.bootstrap(s));else{if(!n.instance.ngDoBootstrap)throw new Error(`The module ${ue(n.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);n.instance.ngDoBootstrap(r)}this._modules.push(n)}onDestroy(n){this._destroyListeners.push(n)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new Error("The platform has already been destroyed!");this._modules.slice().forEach(n=>n.destroy()),this._destroyListeners.forEach(n=>n()),this._destroyed=!0}get destroyed(){return this._destroyed}}return e.\u0275fac=function(n){return new(n||e)(ln(Jt))},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();function Dw(e,t){return Array.isArray(t)?t.reduce(Dw,e):Object.assign(Object.assign({},e),t)}let of=(()=>{class e{constructor(n,r,s,l,c){this._zone=n,this._injector=r,this._exceptionHandler=s,this._componentFactoryResolver=l,this._initStatus=c,this._bootstrapListeners=[],this._views=[],this._runningTick=!1,this._stable=!0,this.componentTypes=[],this.components=[],this._onMicrotaskEmptySubscription=this._zone.onMicrotaskEmpty.subscribe({next:()=>{this._zone.run(()=>{this.tick()})}});const d=new pe.y(v=>{this._stable=this._zone.isStable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks,this._zone.runOutsideAngular(()=>{v.next(this._stable),v.complete()})}),g=new pe.y(v=>{let D;this._zone.runOutsideAngular(()=>{D=this._zone.onStable.subscribe(()=>{Qr.assertNotInAngularZone(),S_(()=>{!this._stable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks&&(this._stable=!0,v.next(!0))})})});const I=this._zone.onUnstable.subscribe(()=>{Qr.assertInAngularZone(),this._stable&&(this._stable=!1,this._zone.runOutsideAngular(()=>{v.next(!1)}))});return()=>{D.unsubscribe(),I.unsubscribe()}});this.isStable=function(...e){const t=(0,Q.yG)(e),n=(0,Q._6)(e,1/0),r=e;return r.length?1===r.length?(0,m.Xf)(r[0]):(0,x.J)(n)((0,ee.D)(r,t)):ce.E}(d,g.pipe(function(e={}){const{connector:t=(()=>new Z.x),resetOnError:n=!0,resetOnComplete:r=!0,resetOnRefCountZero:s=!0}=e;return l=>{let c,d,g,v=0,D=!1,I=!1;const R=()=>{null==d||d.unsubscribe(),d=void 0},k=()=>{R(),c=g=void 0,D=I=!1},U=()=>{const W=c;k(),null==W||W.unsubscribe()};return(0,Y.e)((W,B)=>{v++,!I&&!D&&R();const me=g=null!=g?g:t();B.add(()=>{v--,0===v&&!I&&!D&&(d=xe(U,s))}),me.subscribe(B),!c&&v>0&&(c=new re.Hp({next:X=>me.next(X),error:X=>{I=!0,R(),d=xe(k,n,X),me.error(X)},complete:()=>{D=!0,R(),d=xe(k,r),me.complete()}}),(0,m.Xf)(W).subscribe(c))})(l)}}()))}bootstrap(n,r){if(!this._initStatus.done)throw new Error("Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.");let s;s=n instanceof BC?n:this._componentFactoryResolver.resolveComponentFactory(n),this.componentTypes.push(s.componentType);const l=function(e){return e.isBoundToModule}(s)?void 0:this._injector.get(gl),d=s.create(Jt.NULL,[],r||s.selector,l),g=d.location.nativeElement,v=d.injector.get(gw,null),D=v&&d.injector.get(mw);return v&&D&&D.registerApplication(g,v),d.onDestroy(()=>{this.detachView(d.hostView),M_(this.components,d),D&&D.unregisterApplication(g)}),this._loadComponent(d),d}tick(){if(this._runningTick)throw new Error("ApplicationRef.tick is called recursively");try{this._runningTick=!0;for(let n of this._views)n.detectChanges()}catch(n){this._zone.runOutsideAngular(()=>this._exceptionHandler.handleError(n))}finally{this._runningTick=!1}}attachView(n){const r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){const r=n;M_(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n),this._injector.get(uw,[]).concat(this._bootstrapListeners).forEach(s=>s(n))}ngOnDestroy(){this._views.slice().forEach(n=>n.destroy()),this._onMicrotaskEmptySubscription.unsubscribe()}get viewCount(){return this._views.length}}return e.\u0275fac=function(n){return new(n||e)(ln(Qr),ln(Jt),ln(us),ln(Bu),ln(Ku))},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();function M_(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class wA{}class DA{}const SA={factoryPathPrefix:"",factoryPathSuffix:".ngfactory"};let TA=(()=>{class e{constructor(n,r){this._compiler=n,this._config=r||SA}load(n){return this.loadAndCompile(n)}loadAndCompile(n){let[r,s]=n.split("#");return void 0===s&&(s="default"),O(9647)(r).then(l=>l[s]).then(l=>Iw(l,r,s)).then(l=>this._compiler.compileModuleAsync(l))}loadFactory(n){let[r,s]=n.split("#"),l="NgFactory";return void 0===s&&(s="default",l=""),O(9647)(this._config.factoryPathPrefix+r+this._config.factoryPathSuffix).then(c=>c[s+l]).then(c=>Iw(c,r,s))}}return e.\u0275fac=function(n){return new(n||e)(ln(rf),ln(DA,8))},e.\u0275prov=Ct({token:e,factory:e.\u0275fac}),e})();function Iw(e,t,n){if(!e)throw new Error(`Cannot find '${n}' in '${t}'`);return e}const NA=function(e){return null},kA=bw(null,"core",[{provide:lw,useValue:"unknown"},{provide:Ew,deps:[Jt]},{provide:mw,deps:[]},{provide:cw,deps:[]}]),BA=[{provide:of,useClass:of,deps:[Qr,Jt,us,Bu,Ku]},{provide:BS,deps:[Qr],useFactory:function(e){let t=[];return e.onStable.subscribe(()=>{for(;t.length;)t.pop()()}),function(n){t.push(n)}}},{provide:Ku,useClass:Ku,deps:[[new gi,w_]]},{provide:rf,useClass:rf,deps:[]},zT,{provide:np,useFactory:function(){return FD},deps:[]},{provide:rp,useFactory:function(){return kD},deps:[]},{provide:pp,useFactory:function(e){return Hm(e=e||"undefined"!=typeof $localize&&$localize.locale||Kh),e},deps:[[new zs(pp),new gi,new Mo]]},{provide:dw,useValue:"USD"}];let $A=(()=>{class e{constructor(n){}}return e.\u0275fac=function(n){return new(n||e)(ln(of))},e.\u0275mod=ur({type:e}),e.\u0275inj=wn({providers:BA}),e})()},8967:(Ie,ne,O)=>{"use strict";O.d(ne,{gz:()=>gn,F0:()=>yn,rH:()=>$i,Bz:()=>xa,lC:()=>Us});var x=O(8583),m=O(7525),ce=O(9359);class Q extends ce.x{constructor(p){super(),this._value=p}get value(){return this.getValue()}_subscribe(p){const f=super._subscribe(p);return!f.closed&&p.next(this._value),f}getValue(){const{hasError:p,thrownError:f,_value:y}=this;if(p)throw f;return this._throwIfClosed(),y}next(p){super.next(this._value=p)}}var ee=O(7980),Ae=O(447),Z=O(9517),ye=O(8330),pe=O(2692),re=O(8007),Y=O(9299),_e=O(8499),xe=O(6903);function ue(_,p,f){_?(0,xe.f)(f,_,p):p()}const te=(0,O(5776).d)(_=>function(){_(this),this.name="EmptyError",this.message="no elements in sequence"});var ge=O(549);function de(..._){return(0,ge.J)(1)((0,Z.D)(_,(0,re.yG)(_)))}var he=O(5955);function be(_){return new ee.y(p=>{(0,he.Xf)(_()).subscribe(p)})}var at=O(9593),Se=O(2085);function ae(){return(0,Se.e)((_,p)=>{let f=null;_._refCount++;const y=(0,_e.x)(p,void 0,void 0,void 0,()=>{if(!_||_._refCount<=0||0<--_._refCount)return void(f=null);const E=_._connection,A=f;f=null,E&&(!A||E===A)&&E.unsubscribe(),p.unsubscribe()});_.subscribe(y),y.closed||(f=_.connect())})}class Le extends ee.y{constructor(p,f){super(),this.source=p,this.subjectFactory=f,this._subject=null,this._refCount=0,this._connection=null,(0,Se.A)(p)&&(this.lift=p.lift)}_subscribe(p){return this.getSubject().subscribe(p)}getSubject(){const p=this._subject;return(!p||p.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;const{_connection:p}=this;this._subject=this._connection=null,null==p||p.unsubscribe()}connect(){let p=this._connection;if(!p){p=this._connection=new at.w0;const f=this.getSubject();p.add(this.source.subscribe((0,_e.x)(f,void 0,()=>{this._teardown(),f.complete()},y=>{this._teardown(),f.error(y)},()=>this._teardown()))),p.closed&&(this._connection=null,p=at.w0.EMPTY)}return p}refCount(){return ae()(this)}}var ve=O(4945),Qe=O(9018);function pt(_,p,f,y,E){return(A,N)=>{let L=f,$=p,we=0;A.subscribe((0,_e.x)(N,ot=>{const Be=we++;$=L?_($,ot,Be):(L=!0,ot),y&&N.next($)},E&&(()=>{L&&N.next($),N.complete()})))}}function Me(_,p){return(0,Se.e)(pt(_,p,arguments.length>=2,!0))}var Nn=O(4970);function Zr(_){return _<=0?()=>Qe.E:(0,Se.e)((p,f)=>{let y=[];p.subscribe((0,_e.x)(f,E=>{y.push(E),_{for(const E of y)f.next(E);f.complete()},void 0,()=>{y=null}))})}function ao(_=G){return(0,Se.e)((p,f)=>{let y=!1;p.subscribe((0,_e.x)(f,E=>{y=!0,f.next(E)},()=>y?f.complete():f.error(_())))})}function G(){return new te}function q(_){return(0,Se.e)((p,f)=>{let y=!1;p.subscribe((0,_e.x)(f,E=>{y=!0,f.next(E)},()=>{y||f.next(_),f.complete()}))})}var ie=O(5598);function De(_,p){const f=arguments.length>=2;return y=>y.pipe(_?(0,Nn.h)((E,A)=>_(E,A,y)):ye.y,(0,ie.q)(1),f?q(p):ao(()=>new te))}var Ce=O(5975);function Ne(_,p,f){const y=(0,Ce.m)(_)||p||f?{next:_,error:p,complete:f}:_;return y?(0,Se.e)((E,A)=>{var N;null===(N=y.subscribe)||void 0===N||N.call(y);let L=!0;E.subscribe((0,_e.x)(A,$=>{var we;null===(we=y.next)||void 0===we||we.call(y,$),A.next($)},()=>{var $;L=!1,null===($=y.complete)||void 0===$||$.call(y),A.complete()},$=>{var we;L=!1,null===(we=y.error)||void 0===we||we.call(y,$),A.error($)},()=>{var $,we;L&&(null===($=y.unsubscribe)||void 0===$||$.call(y)),null===(we=y.finalize)||void 0===we||we.call(y)}))}):ye.y}var qe=O(7969),Pe=O(1528),Ue=O(3568),kt=O(4551),_t=O(3159);class Kt{constructor(p,f){this.id=p,this.url=f}}class Ct extends Kt{constructor(p,f,y="imperative",E=null){super(p,f),this.navigationTrigger=y,this.restoredState=E}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}}class bn extends Kt{constructor(p,f,y){super(p,f),this.urlAfterRedirects=y}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}}class wn extends Kt{constructor(p,f,y){super(p,f),this.reason=y}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}}class fn extends Kt{constructor(p,f,y){super(p,f),this.error=y}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}}class da extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class En extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class lo extends Kt{constructor(p,f,y,E,A){super(p,f),this.urlAfterRedirects=y,this.state=E,this.shouldActivate=A}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}}class ys extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class uo extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class co{constructor(p){this.route=p}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}}class vs{constructor(p){this.route=p}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}}class Oi{constructor(p){this.snapshot=p}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class Ge{constructor(p){this.snapshot=p}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class Lt{constructor(p){this.snapshot=p}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class We{constructor(p){this.snapshot=p}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class ze{constructor(p,f,y){this.routerEvent=p,this.position=f,this.anchor=y}toString(){return`Scroll(anchor: '${this.anchor}', position: '${this.position?`${this.position[0]}, ${this.position[1]}`:null}')`}}const tt="primary";class Cs{constructor(p){this.params=p||{}}has(p){return Object.prototype.hasOwnProperty.call(this.params,p)}get(p){if(this.has(p)){const f=this.params[p];return Array.isArray(f)?f[0]:f}return null}getAll(p){if(this.has(p)){const f=this.params[p];return Array.isArray(f)?f:[f]}return[]}get keys(){return Object.keys(this.params)}}function Gt(_){return new Cs(_)}const hn="ngNavigationCancelingError";function Gn(_){const p=Error("NavigationCancelingError: "+_);return p[hn]=!0,p}function ct(_,p,f){const y=f.path.split("/");if(y.length>_.length||"full"===f.pathMatch&&(p.hasChildren()||y.length<_.length))return null;const E={};for(let A=0;Ay[A]===E)}return _===p}function Xr(_){return Array.prototype.concat.apply([],_)}function Pt(_){return _.length>0?_[_.length-1]:null}function on(_,p){for(const f in _)_.hasOwnProperty(f)&&p(_[f],f)}function sn(_){return(0,m.CqO)(_)?_:(0,m.QGY)(_)?(0,Z.D)(Promise.resolve(_)):(0,ve.of)(_)}const ei={exact:function Es(_,p,f){if(!ur(_.segments,p.segments)||!ti(_.segments,p.segments,f)||_.numberOfChildren!==p.numberOfChildren)return!1;for(const y in p.children)if(!_.children[y]||!Es(_.children[y],p.children[y],f))return!1;return!0},subset:Fi},Ni={exact:function(_,p){return dt(_,p)},subset:function(_,p){return Object.keys(p).length<=Object.keys(_).length&&Object.keys(p).every(f=>bs(_[f],p[f]))},ignored:()=>!0};function fo(_,p,f){return ei[f.paths](_.root,p.root,f.matrixParams)&&Ni[f.queryParams](_.queryParams,p.queryParams)&&!("exact"===f.fragment&&_.fragment!==p.fragment)}function Fi(_,p,f){return Ds(_,p,p.segments,f)}function Ds(_,p,f,y){if(_.segments.length>f.length){const E=_.segments.slice(0,f.length);return!(!ur(E,f)||p.hasChildren()||!ti(E,f,y))}if(_.segments.length===f.length){if(!ur(_.segments,f)||!ti(_.segments,f,y))return!1;for(const E in p.children)if(!_.children[E]||!Fi(_.children[E],p.children[E],y))return!1;return!0}{const E=f.slice(0,_.segments.length),A=f.slice(_.segments.length);return!!(ur(_.segments,E)&&ti(_.segments,E,y)&&_.children[tt])&&Ds(_.children[tt],p,A,y)}}function ti(_,p,f){return p.every((y,E)=>Ni[f](_[E].parameters,y.parameters))}class ni{constructor(p,f,y){this.root=p,this.queryParams=f,this.fragment=y}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=Gt(this.queryParams)),this._queryParamMap}toString(){return ha.serialize(this)}}class lt{constructor(p,f){this.segments=p,this.children=f,this.parent=null,on(f,(y,E)=>y.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return Wt(this)}}class an{constructor(p,f){this.path=p,this.parameters=f}get parameterMap(){return this._parameterMap||(this._parameterMap=Gt(this.parameters)),this._parameterMap}toString(){return St(this)}}function ur(_,p){return _.length===p.length&&_.every((f,y)=>f.path===p[y].path)}class Vr{}class Wo{parse(p){const f=new Ot(p);return new ni(f.parseRootSegment(),f.parseQueryParams(),f.parseFragment())}serialize(p){const f=`/${Fn(p.root,!0)}`,y=function(_){const p=Object.keys(_).map(f=>{const y=_[f];return Array.isArray(y)?y.map(E=>`${pn(f)}=${pn(E)}`).join("&"):`${pn(f)}=${pn(y)}`}).filter(f=>!!f);return p.length?`?${p.join("&")}`:""}(p.queryParams);var _;return`${f}${y}${"string"==typeof p.fragment?`#${_=p.fragment,encodeURI(_)}`:""}`}}const ha=new Wo;function Wt(_){return _.segments.map(p=>St(p)).join("/")}function Fn(_,p){if(!_.hasChildren())return Wt(_);if(p){const f=_.children[tt]?Fn(_.children[tt],!1):"",y=[];return on(_.children,(E,A)=>{A!==tt&&y.push(`${A}:${Fn(E,!1)}`)}),y.length>0?`${f}(${y.join("//")})`:f}{const f=function(_,p){let f=[];return on(_.children,(y,E)=>{E===tt&&(f=f.concat(p(y,E)))}),on(_.children,(y,E)=>{E!==tt&&(f=f.concat(p(y,E)))}),f}(_,(y,E)=>E===tt?[Fn(_.children[tt],!1)]:[`${E}:${Fn(y,!1)}`]);return 1===Object.keys(_.children).length&&null!=_.children[tt]?`${Wt(_)}/${f[0]}`:`${Wt(_)}/(${f.join("//")})`}}function Ur(_){return encodeURIComponent(_).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function pn(_){return Ur(_).replace(/%3B/gi,";")}function Tn(_){return Ur(_).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function Te(_){return decodeURIComponent(_)}function it(_){return Te(_.replace(/\+/g,"%20"))}function St(_){return`${Tn(_.path)}${function(_){return Object.keys(_).map(p=>`;${Tn(p)}=${Tn(_[p])}`).join("")}(_.parameters)}`}const zt=/^[^\/()?;=#]+/;function Kn(_){const p=_.match(zt);return p?p[0]:""}const Vt=/^[^=?&#]+/,ii=/^[^?&#]+/;class Ot{constructor(p){this.url=p,this.remaining=p}parseRootSegment(){return this.consumeOptional("/"),""===this.remaining||this.peekStartsWith("?")||this.peekStartsWith("#")?new lt([],{}):new lt([],this.parseChildren())}parseQueryParams(){const p={};if(this.consumeOptional("?"))do{this.parseQueryParam(p)}while(this.consumeOptional("&"));return p}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(""===this.remaining)return{};this.consumeOptional("/");const p=[];for(this.peekStartsWith("(")||p.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),p.push(this.parseSegment());let f={};this.peekStartsWith("/(")&&(this.capture("/"),f=this.parseParens(!0));let y={};return this.peekStartsWith("(")&&(y=this.parseParens(!1)),(p.length>0||Object.keys(f).length>0)&&(y[tt]=new lt(p,f)),y}parseSegment(){const p=Kn(this.remaining);if(""===p&&this.peekStartsWith(";"))throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);return this.capture(p),new an(Te(p),this.parseMatrixParams())}parseMatrixParams(){const p={};for(;this.consumeOptional(";");)this.parseParam(p);return p}parseParam(p){const f=Kn(this.remaining);if(!f)return;this.capture(f);let y="";if(this.consumeOptional("=")){const E=Kn(this.remaining);E&&(y=E,this.capture(y))}p[Te(f)]=Te(y)}parseQueryParam(p){const f=function(_){const p=_.match(Vt);return p?p[0]:""}(this.remaining);if(!f)return;this.capture(f);let y="";if(this.consumeOptional("=")){const N=function(_){const p=_.match(ii);return p?p[0]:""}(this.remaining);N&&(y=N,this.capture(y))}const E=it(f),A=it(y);if(p.hasOwnProperty(E)){let N=p[E];Array.isArray(N)||(N=[N],p[E]=N),N.push(A)}else p[E]=A}parseParens(p){const f={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){const y=Kn(this.remaining),E=this.remaining[y.length];if("/"!==E&&")"!==E&&";"!==E)throw new Error(`Cannot parse url '${this.url}'`);let A;y.indexOf(":")>-1?(A=y.substr(0,y.indexOf(":")),this.capture(A),this.capture(":")):p&&(A=tt);const N=this.parseChildren();f[A]=1===Object.keys(N).length?N[tt]:new lt([],N),this.consumeOptional("//")}return f}peekStartsWith(p){return this.remaining.startsWith(p)}consumeOptional(p){return!!this.peekStartsWith(p)&&(this.remaining=this.remaining.substring(p.length),!0)}capture(p){if(!this.consumeOptional(p))throw new Error(`Expected "${p}".`)}}class Er{constructor(p){this._root=p}get root(){return this._root.value}parent(p){const f=this.pathFromRoot(p);return f.length>1?f[f.length-2]:null}children(p){const f=oi(p,this._root);return f?f.children.map(y=>y.value):[]}firstChild(p){const f=oi(p,this._root);return f&&f.children.length>0?f.children[0].value:null}siblings(p){const f=An(p,this._root);return f.length<2?[]:f[f.length-2].children.map(E=>E.value).filter(E=>E!==p)}pathFromRoot(p){return An(p,this._root).map(f=>f.value)}}function oi(_,p){if(_===p.value)return p;for(const f of p.children){const y=oi(_,f);if(y)return y}return null}function An(_,p){if(_===p.value)return[p];for(const f of p.children){const y=An(_,f);if(y.length)return y.unshift(p),y}return[]}class Nt{constructor(p,f){this.value=p,this.children=f}toString(){return`TreeNode(${this.value})`}}function Jn(_){const p={};return _&&_.children.forEach(f=>p[f.value.outlet]=f),p}class Qn extends Er{constructor(p,f){super(p),this.snapshot=f,ai(this,p)}toString(){return this.snapshot.toString()}}function Ht(_,p){const f=function(_,p){const N=new si([],{},{},"",{},tt,p,null,_.root,-1,{});return new cr("",new Nt(N,[]))}(_,p),y=new Q([new an("",{})]),E=new Q({}),A=new Q({}),N=new Q({}),L=new Q(""),$=new gn(y,E,N,L,A,tt,p,f.root);return $.snapshot=f.root,new Qn(new Nt($,[]),f)}class gn{constructor(p,f,y,E,A,N,L,$){this.url=p,this.params=f,this.queryParams=y,this.fragment=E,this.data=A,this.outlet=N,this.component=L,this._futureSnapshot=$}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap||(this._paramMap=this.params.pipe((0,qe.U)(p=>Gt(p)))),this._paramMap}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=this.queryParams.pipe((0,qe.U)(p=>Gt(p)))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}}function pa(_,p="emptyOnly"){const f=_.pathFromRoot;let y=0;if("always"!==p)for(y=f.length-1;y>=1;){const E=f[y],A=f[y-1];if(E.routeConfig&&""===E.routeConfig.path)y--;else{if(A.component)break;y--}}return function(_){return _.reduce((p,f)=>({params:Object.assign(Object.assign({},p.params),f.params),data:Object.assign(Object.assign({},p.data),f.data),resolve:Object.assign(Object.assign({},p.resolve),f._resolvedData)}),{params:{},data:{},resolve:{}})}(f.slice(y))}class si{constructor(p,f,y,E,A,N,L,$,we,ot,Be){this.url=p,this.params=f,this.queryParams=y,this.fragment=E,this.data=A,this.outlet=N,this.component=L,this.routeConfig=$,this._urlSegment=we,this._lastPathIndex=ot,this._resolve=Be}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap||(this._paramMap=Gt(this.params)),this._paramMap}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=Gt(this.queryParams)),this._queryParamMap}toString(){return`Route(url:'${this.url.map(y=>y.toString()).join("/")}', path:'${this.routeConfig?this.routeConfig.path:""}')`}}class cr extends Er{constructor(p,f){super(f),this.url=p,ai(this,f)}toString(){return Zn(this._root)}}function ai(_,p){p.value._routerState=_,p.children.forEach(f=>ai(_,f))}function Zn(_){const p=_.children.length>0?` { ${_.children.map(Zn).join(", ")} } `:"";return`${_.value}${p}`}function wt(_){if(_.snapshot){const p=_.snapshot,f=_._futureSnapshot;_.snapshot=f,dt(p.queryParams,f.queryParams)||_.queryParams.next(f.queryParams),p.fragment!==f.fragment&&_.fragment.next(f.fragment),dt(p.params,f.params)||_.params.next(f.params),function(_,p){if(_.length!==p.length)return!1;for(let f=0;f<_.length;++f)if(!dt(_[f],p[f]))return!1;return!0}(p.url,f.url)||_.url.next(f.url),dt(p.data,f.data)||_.data.next(f.data)}else _.snapshot=_._futureSnapshot,_.data.next(_._futureSnapshot.data)}function zo(_,p){const f=dt(_.params,p.params)&&function(_,p){return ur(_,p)&&_.every((f,y)=>dt(f.parameters,p[y].parameters))}(_.url,p.url);return f&&!(!_.parent!=!p.parent)&&(!_.parent||zo(_.parent,p.parent))}function Dn(_,p,f){if(f&&_.shouldReuseRoute(p.value,f.value.snapshot)){const y=f.value;y._futureSnapshot=p.value;const E=function(_,p,f){return p.children.map(y=>{for(const E of f.children)if(_.shouldReuseRoute(y.value,E.value.snapshot))return Dn(_,y,E);return Dn(_,y)})}(_,p,f);return new Nt(y,E)}{if(_.shouldAttach(p.value)){const A=_.retrieve(p.value);if(null!==A){const N=A.route;return po(p,N),N}}const y=function(_){return new gn(new Q(_.url),new Q(_.params),new Q(_.queryParams),new Q(_.fragment),new Q(_.data),_.outlet,_.component,_)}(p.value),E=p.children.map(A=>Dn(_,A));return new Nt(y,E)}}function po(_,p){if(_.value.routeConfig!==p.value.routeConfig)throw new Error("Cannot reattach ActivatedRouteSnapshot created from a different route");if(_.children.length!==p.children.length)throw new Error("Cannot reattach ActivatedRouteSnapshot with a different number of children");p.value._futureSnapshot=_.value;for(let f=0;f<_.children.length;++f)po(_.children[f],p.children[f])}function mo(_){return"object"==typeof _&&null!=_&&!_.outlets&&!_.segmentPath}function _o(_){return"object"==typeof _&&null!=_&&_.outlets}function Dr(_,p,f,y,E){let A={};return y&&on(y,(N,L)=>{A[L]=Array.isArray(N)?N.map($=>`${$}`):`${N}`}),new ni(f.root===_?p:Vi(f.root,_,p),A,E)}function Vi(_,p,f){const y={};return on(_.children,(E,A)=>{y[A]=E===p?f:Vi(E,p,f)}),new lt(_.segments,y)}class ga{constructor(p,f,y){if(this.isAbsolute=p,this.numberOfDoubleDots=f,this.commands=y,p&&y.length>0&&mo(y[0]))throw new Error("Root segment cannot have matrix parameters");const E=y.find(_o);if(E&&E!==Pt(y))throw new Error("{outlets:{}} has to be the last command")}toRoot(){return this.isAbsolute&&1===this.commands.length&&"/"==this.commands[0]}}class Ts{constructor(p,f,y){this.segmentGroup=p,this.processChildren=f,this.index=y}}function _a(_,p,f){if(_||(_=new lt([],{})),0===_.segments.length&&_.hasChildren())return qo(_,p,f);const y=function(_,p,f){let y=0,E=p;const A={match:!1,pathIndex:0,commandIndex:0};for(;E<_.segments.length;){if(y>=f.length)return A;const N=_.segments[E],L=f[y];if(_o(L))break;const $=`${L}`,we=y0&&void 0===$)break;if($&&we&&"object"==typeof we&&void 0===we.outlets){if(!ji($,we,N))return A;y+=2}else{if(!ji($,{},N))return A;y++}E++}return{match:!0,pathIndex:E,commandIndex:y}}(_,p,f),E=f.slice(y.commandIndex);if(y.match&&y.pathIndex<_.segments.length){const A=new lt(_.segments.slice(0,y.pathIndex),{});return A.children[tt]=new lt(_.segments.slice(y.pathIndex),_.children),qo(A,0,E)}return y.match&&0===E.length?new lt(_.segments,{}):y.match&&!_.hasChildren()?Ui(_,p,f):y.match?qo(_,0,E):Ui(_,p,f)}function qo(_,p,f){if(0===f.length)return new lt(_.segments,{});{const y=function(_){return _o(_[0])?_[0].outlets:{[tt]:_}}(f),E={};return on(y,(A,N)=>{"string"==typeof A&&(A=[A]),null!==A&&(E[N]=_a(_.children[N],p,A))}),on(_.children,(A,N)=>{void 0===y[N]&&(E[N]=A)}),new lt(_.segments,E)}}function Ui(_,p,f){const y=_.segments.slice(0,p);let E=0;for(;E{"string"==typeof f&&(f=[f]),null!==f&&(p[y]=Ui(new lt([],{}),0,f))}),p}function ya(_){const p={};return on(_,(f,y)=>p[y]=`${f}`),p}function ji(_,p,f){return _==f.path&&dt(p,f.parameters)}class li{constructor(p,f,y,E){this.routeReuseStrategy=p,this.futureState=f,this.currState=y,this.forwardEvent=E}activate(p){const f=this.futureState._root,y=this.currState?this.currState._root:null;this.deactivateChildRoutes(f,y,p),wt(this.futureState.root),this.activateChildRoutes(f,y,p)}deactivateChildRoutes(p,f,y){const E=Jn(f);p.children.forEach(A=>{const N=A.value.outlet;this.deactivateRoutes(A,E[N],y),delete E[N]}),on(E,(A,N)=>{this.deactivateRouteAndItsChildren(A,y)})}deactivateRoutes(p,f,y){const E=p.value,A=f?f.value:null;if(E===A)if(E.component){const N=y.getContext(E.outlet);N&&this.deactivateChildRoutes(p,f,N.children)}else this.deactivateChildRoutes(p,f,y);else A&&this.deactivateRouteAndItsChildren(f,y)}deactivateRouteAndItsChildren(p,f){this.routeReuseStrategy.shouldDetach(p.value.snapshot)?this.detachAndStoreRouteSubtree(p,f):this.deactivateRouteAndOutlet(p,f)}detachAndStoreRouteSubtree(p,f){const y=f.getContext(p.value.outlet);if(y&&y.outlet){const E=y.outlet.detach(),A=y.children.onOutletDeactivated();this.routeReuseStrategy.store(p.value.snapshot,{componentRef:E,route:p,contexts:A})}}deactivateRouteAndOutlet(p,f){const y=f.getContext(p.value.outlet),E=y&&p.value.component?y.children:f,A=Jn(p);for(const N of Object.keys(A))this.deactivateRouteAndItsChildren(A[N],E);y&&y.outlet&&(y.outlet.deactivate(),y.children.onOutletDeactivated(),y.attachRef=null,y.resolver=null,y.route=null)}activateChildRoutes(p,f,y){const E=Jn(f);p.children.forEach(A=>{this.activateRoutes(A,E[A.value.outlet],y),this.forwardEvent(new We(A.value.snapshot))}),p.children.length&&this.forwardEvent(new Ge(p.value.snapshot))}activateRoutes(p,f,y){const E=p.value,A=f?f.value:null;if(wt(E),E===A)if(E.component){const N=y.getOrCreateContext(E.outlet);this.activateChildRoutes(p,f,N.children)}else this.activateChildRoutes(p,f,y);else if(E.component){const N=y.getOrCreateContext(E.outlet);if(this.routeReuseStrategy.shouldAttach(E.snapshot)){const L=this.routeReuseStrategy.retrieve(E.snapshot);this.routeReuseStrategy.store(E.snapshot,null),N.children.onOutletReAttached(L.contexts),N.attachRef=L.componentRef,N.route=L.route.value,N.outlet&&N.outlet.attach(L.componentRef,L.route.value),Bi(L.route)}else{const L=function(_){for(let p=_.parent;p;p=p.parent){const f=p.routeConfig;if(f&&f._loadedConfig)return f._loadedConfig;if(f&&f.component)return null}return null}(E.snapshot),$=L?L.module.componentFactoryResolver:null;N.attachRef=null,N.route=E,N.resolver=$,N.outlet&&N.outlet.activateWith(E,$),this.activateChildRoutes(p,null,N.children)}}else this.activateChildRoutes(p,null,y)}}function Bi(_){wt(_.value),_.children.forEach(Bi)}class Is{constructor(p,f){this.routes=p,this.module=f}}function er(_){return"function"==typeof _}function jr(_){return _ instanceof ni}const Br=Symbol("INITIAL_VALUE");function ci(){return(0,Pe.w)(_=>function(..._){const p=(0,re.yG)(_),f=(0,re.jO)(_),{args:y,keys:E}=(0,Ae.D)(_);if(0===y.length)return(0,Z.D)([],p);const A=new ee.y(function(_,p,f=ye.y){return y=>{ue(p,()=>{const{length:E}=_,A=new Array(E);let N=E,L=E;for(let $=0;${const we=(0,Z.D)(_[$],p);let ot=!1;we.subscribe((0,_e.x)(y,Be=>{A[$]=Be,ot||(ot=!0,L--),L||y.next(f(A.slice()))},()=>{--N||y.complete()}))},y)},y)}}(y,p,E?N=>(0,Y.n)(E,N):ye.y));return f?A.pipe((0,pe.Z)(f)):A}(_.map(p=>p.pipe((0,ie.q)(1),function(..._){const p=(0,re.yG)(_);return(0,Se.e)((f,y)=>{(p?de(_,f,p):de(_,f)).subscribe(y)})}(Br)))).pipe(Me((p,f)=>{let y=!1;return f.reduce((E,A,N)=>E!==Br?E:(A===Br&&(y=!0),y||!1!==A&&N!==f.length-1&&!jr(A)?E:A),p)},Br),(0,Nn.h)(p=>p!==Br),(0,qe.U)(p=>jr(p)?p:!0===p),(0,ie.q)(1)))}let xs=(()=>{class _{}return _.\u0275fac=function(f){return new(f||_)},_.\u0275cmp=m.Xpm({type:_,selectors:[["ng-component"]],decls:1,vars:0,template:function(f,y){1&f&&m._UZ(0,"router-outlet")},directives:function(){return[Us]},encapsulation:2}),_})();function yo(_,p=""){for(let f=0;f<_.length;f++){const y=_[f];C(y,S(p,y))}}function C(_,p){_.children&&yo(_.children,p)}function S(_,p){return p?_||p.path?_&&!p.path?`${_}/`:!_&&p.path?p.path:`${_}/${p.path}`:"":_}function b(_){const p=_.children&&_.children.map(b),f=p?Object.assign(Object.assign({},_),{children:p}):Object.assign({},_);return!f.component&&(p||f.loadChildren)&&f.outlet&&f.outlet!==tt&&(f.component=xs),f}function M(_){return _.outlet||tt}function V(_,p){const f=_.filter(y=>M(y)===p);return f.push(..._.filter(y=>M(y)!==p)),f}const K={matched:!1,consumedSegments:[],lastChild:0,parameters:{},positionalParamSegments:{}};function fe(_,p,f){var y;if(""===p.path)return"full"===p.pathMatch&&(_.hasChildren()||f.length>0)?Object.assign({},K):{matched:!0,consumedSegments:[],lastChild:0,parameters:{},positionalParamSegments:{}};const A=(p.matcher||ct)(f,_,p);if(!A)return Object.assign({},K);const N={};on(A.posParams,($,we)=>{N[we]=$.path});const L=A.consumed.length>0?Object.assign(Object.assign({},N),A.consumed[A.consumed.length-1].parameters):N;return{matched:!0,consumedSegments:A.consumed,lastChild:A.consumed.length,parameters:L,positionalParamSegments:null!==(y=A.posParams)&&void 0!==y?y:{}}}function Ve(_,p,f,y,E="corrected"){if(f.length>0&&function(_,p,f){return f.some(y=>ut(_,p,y)&&M(y)!==tt)}(_,f,y)){const N=new lt(p,function(_,p,f,y){const E={};E[tt]=y,y._sourceSegment=_,y._segmentIndexShift=p.length;for(const A of f)if(""===A.path&&M(A)!==tt){const N=new lt([],{});N._sourceSegment=_,N._segmentIndexShift=p.length,E[M(A)]=N}return E}(_,p,y,new lt(f,_.children)));return N._sourceSegment=_,N._segmentIndexShift=p.length,{segmentGroup:N,slicedSegments:[]}}if(0===f.length&&function(_,p,f){return f.some(y=>ut(_,p,y))}(_,f,y)){const N=new lt(_.segments,function(_,p,f,y,E,A){const N={};for(const L of y)if(ut(_,f,L)&&!E[M(L)]){const $=new lt([],{});$._sourceSegment=_,$._segmentIndexShift="legacy"===A?_.segments.length:p.length,N[M(L)]=$}return Object.assign(Object.assign({},E),N)}(_,p,f,y,_.children,E));return N._sourceSegment=_,N._segmentIndexShift=p.length,{segmentGroup:N,slicedSegments:f}}const A=new lt(_.segments,_.children);return A._sourceSegment=_,A._segmentIndexShift=p.length,{segmentGroup:A,slicedSegments:f}}function ut(_,p,f){return(!(_.hasChildren()||p.length>0)||"full"!==f.pathMatch)&&""===f.path}function At(_,p,f,y){return!!(M(_)===y||y!==tt&&ut(p,f,_))&&("**"===_.path||fe(p,_,f).matched)}function mn(_,p,f){return 0===p.length&&!_.children[f]}class kn{constructor(p){this.segmentGroup=p||null}}class qt{constructor(p){this.urlTree=p}}function Hr(_){return new ee.y(p=>p.error(new kn(_)))}function dr(_){return new ee.y(p=>p.error(new qt(_)))}function $r(_){return new ee.y(p=>p.error(new Error(`Only absolute redirects can have named outlets. redirectTo: '${_}'`)))}class wa{constructor(p,f,y,E,A){this.configLoader=f,this.urlSerializer=y,this.urlTree=E,this.config=A,this.allowRedirects=!0,this.ngModule=p.get(m.h0i)}apply(){const p=Ve(this.urlTree.root,[],[],this.config).segmentGroup,f=new lt(p.segments,p.children);return this.expandSegmentGroup(this.ngModule,this.config,f,tt).pipe((0,qe.U)(A=>this.createUrlTree(Sr(A),this.urlTree.queryParams,this.urlTree.fragment))).pipe((0,Ue.K)(A=>{if(A instanceof qt)return this.allowRedirects=!1,this.match(A.urlTree);throw A instanceof kn?this.noMatchError(A):A}))}match(p){return this.expandSegmentGroup(this.ngModule,this.config,p.root,tt).pipe((0,qe.U)(E=>this.createUrlTree(Sr(E),p.queryParams,p.fragment))).pipe((0,Ue.K)(E=>{throw E instanceof kn?this.noMatchError(E):E}))}noMatchError(p){return new Error(`Cannot match any routes. URL Segment: '${p.segmentGroup}'`)}createUrlTree(p,f,y){const E=p.segments.length>0?new lt([],{[tt]:p}):p;return new ni(E,f,y)}expandSegmentGroup(p,f,y,E){return 0===y.segments.length&&y.hasChildren()?this.expandChildren(p,f,y).pipe((0,qe.U)(A=>new lt([],A))):this.expandSegment(p,y,f,y.segments,E,!0)}expandChildren(p,f,y){const E=[];for(const A of Object.keys(y.children))"primary"===A?E.unshift(A):E.push(A);return(0,Z.D)(E).pipe((0,kt.b)(A=>{const N=y.children[A],L=V(f,A);return this.expandSegmentGroup(p,L,N,A).pipe((0,qe.U)($=>({segment:$,outlet:A})))}),Me((A,N)=>(A[N.outlet]=N.segment,A),{}),function(_,p){const f=arguments.length>=2;return y=>y.pipe(_?(0,Nn.h)((E,A)=>_(E,A,y)):ye.y,Zr(1),f?q(p):ao(()=>new te))}())}expandSegment(p,f,y,E,A,N){return(0,Z.D)(y).pipe((0,kt.b)(L=>this.expandSegmentAgainstRoute(p,f,y,L,E,A,N).pipe((0,Ue.K)(we=>{if(we instanceof kn)return(0,ve.of)(null);throw we}))),De(L=>!!L),(0,Ue.K)((L,$)=>{if(L instanceof te||"EmptyError"===L.name){if(mn(f,E,A))return(0,ve.of)(new lt([],{}));throw new kn(f)}throw L}))}expandSegmentAgainstRoute(p,f,y,E,A,N,L){return At(E,f,A,N)?void 0===E.redirectTo?this.matchSegmentAgainstRoute(p,f,E,A,N):L&&this.allowRedirects?this.expandSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N):Hr(f):Hr(f)}expandSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N){return"**"===E.path?this.expandWildCardWithParamsAgainstRouteUsingRedirect(p,y,E,N):this.expandRegularSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N)}expandWildCardWithParamsAgainstRouteUsingRedirect(p,f,y,E){const A=this.applyRedirectCommands([],y.redirectTo,{});return y.redirectTo.startsWith("/")?dr(A):this.lineralizeSegments(y,A).pipe((0,_t.z)(N=>{const L=new lt(N,{});return this.expandSegment(p,L,f,N,E,!1)}))}expandRegularSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N){const{matched:L,consumedSegments:$,lastChild:we,positionalParamSegments:ot}=fe(f,E,A);if(!L)return Hr(f);const Be=this.applyRedirectCommands($,E.redirectTo,ot);return E.redirectTo.startsWith("/")?dr(Be):this.lineralizeSegments(E,Be).pipe((0,_t.z)(Dt=>this.expandSegment(p,f,y,Dt.concat(A.slice(we)),N,!1)))}matchSegmentAgainstRoute(p,f,y,E,A){if("**"===y.path)return y.loadChildren?(y._loadedConfig?(0,ve.of)(y._loadedConfig):this.configLoader.load(p.injector,y)).pipe((0,qe.U)(Dt=>(y._loadedConfig=Dt,new lt(E,{})))):(0,ve.of)(new lt(E,{}));const{matched:N,consumedSegments:L,lastChild:$}=fe(f,y,E);if(!N)return Hr(f);const we=E.slice($);return this.getChildConfig(p,y,E).pipe((0,_t.z)(Be=>{const Dt=Be.module,ft=Be.routes,{segmentGroup:hi,slicedSegments:nr}=Ve(f,L,we,ft),fr=new lt(hi.segments,hi.children);if(0===nr.length&&fr.hasChildren())return this.expandChildren(Dt,ft,fr).pipe((0,qe.U)(To=>new lt(L,To)));if(0===ft.length&&0===nr.length)return(0,ve.of)(new lt(L,{}));const Ir=M(y)===A;return this.expandSegment(Dt,fr,ft,nr,Ir?tt:A,!0).pipe((0,qe.U)(Mr=>new lt(L.concat(Mr.segments),Mr.children)))}))}getChildConfig(p,f,y){return f.children?(0,ve.of)(new Is(f.children,p)):f.loadChildren?void 0!==f._loadedConfig?(0,ve.of)(f._loadedConfig):this.runCanLoadGuards(p.injector,f,y).pipe((0,_t.z)(E=>{return E?this.configLoader.load(p.injector,f).pipe((0,qe.U)(A=>(f._loadedConfig=A,A))):(_=f,new ee.y(p=>p.error(Gn(`Cannot load children because the guard of the route "path: '${_.path}'" returned false`))));var _})):(0,ve.of)(new Is([],p))}runCanLoadGuards(p,f,y){const E=f.canLoad;if(!E||0===E.length)return(0,ve.of)(!0);const A=E.map(N=>{const L=p.get(N);let $;if((_=L)&&er(_.canLoad))$=L.canLoad(f,y);else{if(!er(L))throw new Error("Invalid CanLoad guard");$=L(f,y)}var _;return sn($)});return(0,ve.of)(A).pipe(ci(),Ne(N=>{if(!jr(N))return;const L=Gn(`Redirecting to "${this.urlSerializer.serialize(N)}"`);throw L.url=N,L}),(0,qe.U)(N=>!0===N))}lineralizeSegments(p,f){let y=[],E=f.root;for(;;){if(y=y.concat(E.segments),0===E.numberOfChildren)return(0,ve.of)(y);if(E.numberOfChildren>1||!E.children[tt])return $r(p.redirectTo);E=E.children[tt]}}applyRedirectCommands(p,f,y){return this.applyRedirectCreatreUrlTree(f,this.urlSerializer.parse(f),p,y)}applyRedirectCreatreUrlTree(p,f,y,E){const A=this.createSegmentGroup(p,f.root,y,E);return new ni(A,this.createQueryParams(f.queryParams,this.urlTree.queryParams),f.fragment)}createQueryParams(p,f){const y={};return on(p,(E,A)=>{if("string"==typeof E&&E.startsWith(":")){const L=E.substring(1);y[A]=f[L]}else y[A]=E}),y}createSegmentGroup(p,f,y,E){const A=this.createSegments(p,f.segments,y,E);let N={};return on(f.children,(L,$)=>{N[$]=this.createSegmentGroup(p,L,y,E)}),new lt(A,N)}createSegments(p,f,y,E){return f.map(A=>A.path.startsWith(":")?this.findPosParam(p,A,E):this.findOrReturn(A,y))}findPosParam(p,f,y){const E=y[f.path.substring(1)];if(!E)throw new Error(`Cannot redirect to '${p}'. Cannot find '${f.path}'.`);return E}findOrReturn(p,f){let y=0;for(const E of f){if(E.path===p.path)return f.splice(y),E;y++}return p}}function Sr(_){const p={};for(const y of Object.keys(_.children)){const A=Sr(_.children[y]);(A.segments.length>0||A.hasChildren())&&(p[y]=A)}return function(_){if(1===_.numberOfChildren&&_.children[tt]){const p=_.children[tt];return new lt(_.segments.concat(p.segments),p.children)}return _}(new lt(_.segments,p))}class Rs{constructor(p){this.path=p,this.route=this.path[this.path.length-1]}}class Ye{constructor(p,f){this.component=p,this.route=f}}function df(_,p,f){const y=_._root;return Hi(y,p?p._root:null,f,[y.value])}function vo(_,p,f){const y=function(_){if(!_)return null;for(let p=_.parent;p;p=p.parent){const f=p.routeConfig;if(f&&f._loadedConfig)return f._loadedConfig}return null}(p);return(y?y.module.injector:f).get(_)}function Hi(_,p,f,y,E={canDeactivateChecks:[],canActivateChecks:[]}){const A=Jn(p);return _.children.forEach(N=>{(function(_,p,f,y,E={canDeactivateChecks:[],canActivateChecks:[]}){const A=_.value,N=p?p.value:null,L=f?f.getContext(_.value.outlet):null;if(N&&A.routeConfig===N.routeConfig){const $=function(_,p,f){if("function"==typeof f)return f(_,p);switch(f){case"pathParamsChange":return!ur(_.url,p.url);case"pathParamsOrQueryParamsChange":return!ur(_.url,p.url)||!dt(_.queryParams,p.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!zo(_,p)||!dt(_.queryParams,p.queryParams);default:return!zo(_,p)}}(N,A,A.routeConfig.runGuardsAndResolvers);$?E.canActivateChecks.push(new Rs(y)):(A.data=N.data,A._resolvedData=N._resolvedData),Hi(_,p,A.component?L?L.children:null:f,y,E),$&&L&&L.outlet&&L.outlet.isActivated&&E.canDeactivateChecks.push(new Ye(L.outlet.component,N))}else N&&le(p,L,E),E.canActivateChecks.push(new Rs(y)),Hi(_,null,A.component?L?L.children:null:f,y,E)})(N,A[N.value.outlet],f,y.concat([N.value]),E),delete A[N.value.outlet]}),on(A,(N,L)=>le(N,f.getContext(L),E)),E}function le(_,p,f){const y=Jn(_),E=_.value;on(y,(A,N)=>{le(A,E.component?p?p.children.getContext(N):null:p,f)}),f.canDeactivateChecks.push(new Ye(E.component&&p&&p.outlet&&p.outlet.isActivated?p.outlet.component:null,E))}class ff{}function xl(_){return new ee.y(p=>p.error(_))}class Os{constructor(p,f,y,E,A,N){this.rootComponentType=p,this.config=f,this.urlTree=y,this.url=E,this.paramsInheritanceStrategy=A,this.relativeLinkResolution=N}recognize(){const p=Ve(this.urlTree.root,[],[],this.config.filter(N=>void 0===N.redirectTo),this.relativeLinkResolution).segmentGroup,f=this.processSegmentGroup(this.config,p,tt);if(null===f)return null;const y=new si([],Object.freeze({}),Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,{},tt,this.rootComponentType,null,this.urlTree.root,-1,{}),E=new Nt(y,f),A=new cr(this.url,E);return this.inheritParamsAndData(A._root),A}inheritParamsAndData(p){const f=p.value,y=pa(f,this.paramsInheritanceStrategy);f.params=Object.freeze(y.params),f.data=Object.freeze(y.data),p.children.forEach(E=>this.inheritParamsAndData(E))}processSegmentGroup(p,f,y){return 0===f.segments.length&&f.hasChildren()?this.processChildren(p,f):this.processSegment(p,f,f.segments,y)}processChildren(p,f){const y=[];for(const A of Object.keys(f.children)){const N=f.children[A],L=V(p,A),$=this.processSegmentGroup(L,N,A);if(null===$)return null;y.push(...$)}const E=tr(y);return E.sort((p,f)=>p.value.outlet===tt?-1:f.value.outlet===tt?1:p.value.outlet.localeCompare(f.value.outlet)),E}processSegment(p,f,y,E){for(const A of p){const N=this.processSegmentAgainstRoute(A,f,y,E);if(null!==N)return N}return mn(f,y,E)?[]:null}processSegmentAgainstRoute(p,f,y,E){if(p.redirectTo||!At(p,f,y,E))return null;let A,N=[],L=[];if("**"===p.path){const ft=y.length>0?Pt(y).parameters:{};A=new si(y,ft,Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,Ol(p),M(p),p.component,p,Pl(f),Sa(f)+y.length,Nl(p))}else{const ft=fe(f,p,y);if(!ft.matched)return null;N=ft.consumedSegments,L=y.slice(ft.lastChild),A=new si(N,ft.parameters,Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,Ol(p),M(p),p.component,p,Pl(f),Sa(f)+N.length,Nl(p))}const $=(_=p).children?_.children:_.loadChildren?_._loadedConfig.routes:[],{segmentGroup:we,slicedSegments:ot}=Ve(f,N,L,$.filter(ft=>void 0===ft.redirectTo),this.relativeLinkResolution);var _;if(0===ot.length&&we.hasChildren()){const ft=this.processChildren($,we);return null===ft?null:[new Nt(A,ft)]}if(0===$.length&&0===ot.length)return[new Nt(A,[])];const Be=M(p)===E,Dt=this.processSegment($,we,ot,Be?tt:E);return null===Dt?null:[new Nt(A,Dt)]}}function Rl(_){const p=_.value.routeConfig;return p&&""===p.path&&void 0===p.redirectTo}function tr(_){const p=[],f=new Set;for(const y of _){if(!Rl(y)){p.push(y);continue}const E=p.find(A=>y.value.routeConfig===A.value.routeConfig);void 0!==E?(E.children.push(...y.children),f.add(E)):p.push(y)}for(const y of f){const E=tr(y.children);p.push(new Nt(y.value,E))}return p.filter(y=>!f.has(y))}function Pl(_){let p=_;for(;p._sourceSegment;)p=p._sourceSegment;return p}function Sa(_){let p=_,f=p._segmentIndexShift?p._segmentIndexShift:0;for(;p._sourceSegment;)p=p._sourceSegment,f+=p._segmentIndexShift?p._segmentIndexShift:0;return f-1}function Ol(_){return _.data||{}}function Nl(_){return _.resolve||{}}function Ns(_){return(0,Pe.w)(p=>{const f=_(p);return f?(0,Z.D)(f).pipe((0,qe.U)(()=>p)):(0,ve.of)(p)})}class Ll extends class{shouldDetach(p){return!1}store(p,f){}shouldAttach(p){return!1}retrieve(p){return null}shouldReuseRoute(p,f){return p.routeConfig===f.routeConfig}}{}const ks=new m.OlP("ROUTES");class di{constructor(p,f,y,E){this.loader=p,this.compiler=f,this.onLoadStartListener=y,this.onLoadEndListener=E}load(p,f){if(f._loader$)return f._loader$;this.onLoadStartListener&&this.onLoadStartListener(f);const E=this.loadModuleFactory(f.loadChildren).pipe((0,qe.U)(A=>{this.onLoadEndListener&&this.onLoadEndListener(f);const N=A.create(p);return new Is(Xr(N.injector.get(ks,void 0,m.XFs.Self|m.XFs.Optional)).map(b),N)}),(0,Ue.K)(A=>{throw f._loader$=void 0,A}));return f._loader$=new Le(E,()=>new ce.x).pipe(ae()),f._loader$}loadModuleFactory(p){return"string"==typeof p?(0,Z.D)(this.loader.load(p)):sn(p()).pipe((0,_t.z)(f=>f instanceof m.YKP?(0,ve.of)(f):(0,Z.D)(this.compiler.compileModuleAsync(f))))}}class Ls{constructor(){this.outlet=null,this.route=null,this.resolver=null,this.children=new bo,this.attachRef=null}}class bo{constructor(){this.contexts=new Map}onChildOutletCreated(p,f){const y=this.getOrCreateContext(p);y.outlet=f,this.contexts.set(p,y)}onChildOutletDestroyed(p){const f=this.getContext(p);f&&(f.outlet=null,f.attachRef=null)}onOutletDeactivated(){const p=this.contexts;return this.contexts=new Map,p}onOutletReAttached(p){this.contexts=p}getOrCreateContext(p){let f=this.getContext(p);return f||(f=new Ls,this.contexts.set(p,f)),f}getContext(p){return this.contexts.get(p)||null}}class Mn{shouldProcessUrl(p){return!0}extract(p){return p}merge(p,f){return p}}function zn(_){throw _}function $t(_,p,f){return p.parse("/")}function Vl(_,p){return(0,ve.of)(null)}const Vs={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},ac={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};let yn=(()=>{class _{constructor(f,y,E,A,N,L,$,we){this.rootComponentType=f,this.urlSerializer=y,this.rootContexts=E,this.location=A,this.config=we,this.lastSuccessfulNavigation=null,this.currentNavigation=null,this.disposed=!1,this.lastLocationChangeInfo=null,this.navigationId=0,this.currentPageId=0,this.isNgZoneEnabled=!1,this.events=new ce.x,this.errorHandler=zn,this.malformedUriErrorHandler=$t,this.navigated=!1,this.lastSuccessfulId=-1,this.hooks={beforePreactivation:Vl,afterPreactivation:Vl},this.urlHandlingStrategy=new Mn,this.routeReuseStrategy=new Ll,this.onSameUrlNavigation="ignore",this.paramsInheritanceStrategy="emptyOnly",this.urlUpdateStrategy="deferred",this.relativeLinkResolution="corrected",this.canceledNavigationResolution="replace",this.ngModule=N.get(m.h0i),this.console=N.get(m.c2e);const Dt=N.get(m.R0b);this.isNgZoneEnabled=Dt instanceof m.R0b&&m.R0b.isInAngularZone(),this.resetConfig(we),this.currentUrlTree=new ni(new lt([],{}),{},null),this.rawUrlTree=this.currentUrlTree,this.browserUrlTree=this.currentUrlTree,this.configLoader=new di(L,$,ft=>this.triggerEvent(new co(ft)),ft=>this.triggerEvent(new vs(ft))),this.routerState=Ht(this.currentUrlTree,this.rootComponentType),this.transitions=new Q({id:0,targetPageId:0,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,extractedUrl:this.urlHandlingStrategy.extract(this.currentUrlTree),urlAfterRedirects:this.urlHandlingStrategy.extract(this.currentUrlTree),rawUrl:this.currentUrlTree,extras:{},resolve:null,reject:null,promise:Promise.resolve(!0),source:"imperative",restoredState:null,currentSnapshot:this.routerState.snapshot,targetSnapshot:null,currentRouterState:this.routerState,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.navigations=this.setupNavigations(this.transitions),this.processNavigations()}get browserPageId(){var f;return null===(f=this.location.getState())||void 0===f?void 0:f.\u0275routerPageId}setupNavigations(f){const y=this.events;return f.pipe((0,Nn.h)(E=>0!==E.id),(0,qe.U)(E=>Object.assign(Object.assign({},E),{extractedUrl:this.urlHandlingStrategy.extract(E.rawUrl)})),(0,Pe.w)(E=>{let A=!1,N=!1;return(0,ve.of)(E).pipe(Ne(L=>{this.currentNavigation={id:L.id,initialUrl:L.currentRawUrl,extractedUrl:L.extractedUrl,trigger:L.source,extras:L.extras,previousNavigation:this.lastSuccessfulNavigation?Object.assign(Object.assign({},this.lastSuccessfulNavigation),{previousNavigation:null}):null}}),(0,Pe.w)(L=>{const $=this.browserUrlTree.toString(),we=!this.navigated||L.extractedUrl.toString()!==$||$!==this.currentUrlTree.toString();if(("reload"===this.onSameUrlNavigation||we)&&this.urlHandlingStrategy.shouldProcessUrl(L.rawUrl))return wo(L.source)&&(this.browserUrlTree=L.extractedUrl),(0,ve.of)(L).pipe((0,Pe.w)(Be=>{const Dt=this.transitions.getValue();return y.next(new Ct(Be.id,this.serializeUrl(Be.extractedUrl),Be.source,Be.restoredState)),Dt!==this.transitions.getValue()?Qe.E:Promise.resolve(Be)}),function(_,p,f,y){return(0,Pe.w)(E=>function(_,p,f,y,E){return new wa(_,p,f,y,E).apply()}(_,p,f,E.extractedUrl,y).pipe((0,qe.U)(A=>Object.assign(Object.assign({},E),{urlAfterRedirects:A}))))}(this.ngModule.injector,this.configLoader,this.urlSerializer,this.config),Ne(Be=>{this.currentNavigation=Object.assign(Object.assign({},this.currentNavigation),{finalUrl:Be.urlAfterRedirects})}),function(_,p,f,y,E){return(0,_t.z)(A=>function(_,p,f,y,E="emptyOnly",A="legacy"){try{const N=new Os(_,p,f,y,E,A).recognize();return null===N?xl(new ff):(0,ve.of)(N)}catch(N){return xl(N)}}(_,p,A.urlAfterRedirects,f(A.urlAfterRedirects),y,E).pipe((0,qe.U)(N=>Object.assign(Object.assign({},A),{targetSnapshot:N}))))}(this.rootComponentType,this.config,Be=>this.serializeUrl(Be),this.paramsInheritanceStrategy,this.relativeLinkResolution),Ne(Be=>{"eager"===this.urlUpdateStrategy&&(Be.extras.skipLocationChange||this.setBrowserUrl(Be.urlAfterRedirects,Be),this.browserUrlTree=Be.urlAfterRedirects);const Dt=new da(Be.id,this.serializeUrl(Be.extractedUrl),this.serializeUrl(Be.urlAfterRedirects),Be.targetSnapshot);y.next(Dt)}));if(we&&this.rawUrlTree&&this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree)){const{id:Dt,extractedUrl:ft,source:hi,restoredState:nr,extras:fr}=L,Ir=new Ct(Dt,this.serializeUrl(ft),hi,nr);y.next(Ir);const zr=Ht(ft,this.rootComponentType).snapshot;return(0,ve.of)(Object.assign(Object.assign({},L),{targetSnapshot:zr,urlAfterRedirects:ft,extras:Object.assign(Object.assign({},fr),{skipLocationChange:!1,replaceUrl:!1})}))}return this.rawUrlTree=L.rawUrl,this.browserUrlTree=L.urlAfterRedirects,L.resolve(null),Qe.E}),Ns(L=>{const{targetSnapshot:$,id:we,extractedUrl:ot,rawUrl:Be,extras:{skipLocationChange:Dt,replaceUrl:ft}}=L;return this.hooks.beforePreactivation($,{navigationId:we,appliedUrlTree:ot,rawUrlTree:Be,skipLocationChange:!!Dt,replaceUrl:!!ft})}),Ne(L=>{const $=new En(L.id,this.serializeUrl(L.extractedUrl),this.serializeUrl(L.urlAfterRedirects),L.targetSnapshot);this.triggerEvent($)}),(0,qe.U)(L=>Object.assign(Object.assign({},L),{guards:df(L.targetSnapshot,L.currentSnapshot,this.rootContexts)})),function(_,p){return(0,_t.z)(f=>{const{targetSnapshot:y,currentSnapshot:E,guards:{canActivateChecks:A,canDeactivateChecks:N}}=f;return 0===N.length&&0===A.length?(0,ve.of)(Object.assign(Object.assign({},f),{guardsResult:!0})):function(_,p,f,y){return(0,Z.D)(_).pipe((0,_t.z)(E=>function(_,p,f,y,E){const A=p&&p.routeConfig?p.routeConfig.canDeactivate:null;if(!A||0===A.length)return(0,ve.of)(!0);const N=A.map(L=>{const $=vo(L,p,E);let we;if(function(_){return _&&er(_.canDeactivate)}($))we=sn($.canDeactivate(_,p,f,y));else{if(!er($))throw new Error("Invalid CanDeactivate guard");we=sn($(_,p,f,y))}return we.pipe(De())});return(0,ve.of)(N).pipe(ci())}(E.component,E.route,f,p,y)),De(E=>!0!==E,!0))}(N,y,E,_).pipe((0,_t.z)(L=>L&&function(_){return"boolean"==typeof _}(L)?function(_,p,f,y){return(0,Z.D)(p).pipe((0,kt.b)(E=>de(function(_,p){return null!==_&&p&&p(new Oi(_)),(0,ve.of)(!0)}(E.route.parent,y),function(_,p){return null!==_&&p&&p(new Lt(_)),(0,ve.of)(!0)}(E.route,y),function(_,p,f){const y=p[p.length-1],A=p.slice(0,p.length-1).reverse().map(N=>function(_){const p=_.routeConfig?_.routeConfig.canActivateChild:null;return p&&0!==p.length?{node:_,guards:p}:null}(N)).filter(N=>null!==N).map(N=>be(()=>{const L=N.guards.map($=>{const we=vo($,N.node,f);let ot;if(function(_){return _&&er(_.canActivateChild)}(we))ot=sn(we.canActivateChild(y,_));else{if(!er(we))throw new Error("Invalid CanActivateChild guard");ot=sn(we(y,_))}return ot.pipe(De())});return(0,ve.of)(L).pipe(ci())}));return(0,ve.of)(A).pipe(ci())}(_,E.path,f),function(_,p,f){const y=p.routeConfig?p.routeConfig.canActivate:null;if(!y||0===y.length)return(0,ve.of)(!0);const E=y.map(A=>be(()=>{const N=vo(A,p,f);let L;if(function(_){return _&&er(_.canActivate)}(N))L=sn(N.canActivate(p,_));else{if(!er(N))throw new Error("Invalid CanActivate guard");L=sn(N(p,_))}return L.pipe(De())}));return(0,ve.of)(E).pipe(ci())}(_,E.route,f))),De(E=>!0!==E,!0))}(y,A,_,p):(0,ve.of)(L)),(0,qe.U)(L=>Object.assign(Object.assign({},f),{guardsResult:L})))})}(this.ngModule.injector,L=>this.triggerEvent(L)),Ne(L=>{if(jr(L.guardsResult)){const we=Gn(`Redirecting to "${this.serializeUrl(L.guardsResult)}"`);throw we.url=L.guardsResult,we}const $=new lo(L.id,this.serializeUrl(L.extractedUrl),this.serializeUrl(L.urlAfterRedirects),L.targetSnapshot,!!L.guardsResult);this.triggerEvent($)}),(0,Nn.h)(L=>!!L.guardsResult||(this.restoreHistory(L),this.cancelNavigationTransition(L,""),!1)),Ns(L=>{if(L.guards.canActivateChecks.length)return(0,ve.of)(L).pipe(Ne($=>{const we=new ys($.id,this.serializeUrl($.extractedUrl),this.serializeUrl($.urlAfterRedirects),$.targetSnapshot);this.triggerEvent(we)}),(0,Pe.w)($=>{let we=!1;return(0,ve.of)($).pipe(function(_,p){return(0,_t.z)(f=>{const{targetSnapshot:y,guards:{canActivateChecks:E}}=f;if(!E.length)return(0,ve.of)(f);let A=0;return(0,Z.D)(E).pipe((0,kt.b)(N=>function(_,p,f,y){return function(_,p,f,y){const E=Object.keys(_);if(0===E.length)return(0,ve.of)({});const A={};return(0,Z.D)(E).pipe((0,_t.z)(N=>function(_,p,f,y){const E=vo(_,p,y);return sn(E.resolve?E.resolve(p,f):E(p,f))}(_[N],p,f,y).pipe(Ne(L=>{A[N]=L}))),Zr(1),(0,_t.z)(()=>Object.keys(A).length===E.length?(0,ve.of)(A):Qe.E))}(_._resolve,_,p,y).pipe((0,qe.U)(A=>(_._resolvedData=A,_.data=Object.assign(Object.assign({},_.data),pa(_,f).resolve),null)))}(N.route,y,_,p)),Ne(()=>A++),Zr(1),(0,_t.z)(N=>A===E.length?(0,ve.of)(f):Qe.E))})}(this.paramsInheritanceStrategy,this.ngModule.injector),Ne({next:()=>we=!0,complete:()=>{we||(this.restoreHistory($),this.cancelNavigationTransition($,"At least one route resolver didn't emit any value."))}}))}),Ne($=>{const we=new uo($.id,this.serializeUrl($.extractedUrl),this.serializeUrl($.urlAfterRedirects),$.targetSnapshot);this.triggerEvent(we)}))}),Ns(L=>{const{targetSnapshot:$,id:we,extractedUrl:ot,rawUrl:Be,extras:{skipLocationChange:Dt,replaceUrl:ft}}=L;return this.hooks.afterPreactivation($,{navigationId:we,appliedUrlTree:ot,rawUrlTree:Be,skipLocationChange:!!Dt,replaceUrl:!!ft})}),(0,qe.U)(L=>{const $=function(_,p,f){const y=Dn(_,p._root,f?f._root:void 0);return new Qn(y,p)}(this.routeReuseStrategy,L.targetSnapshot,L.currentRouterState);return Object.assign(Object.assign({},L),{targetRouterState:$})}),Ne(L=>{this.currentUrlTree=L.urlAfterRedirects,this.rawUrlTree=this.urlHandlingStrategy.merge(L.urlAfterRedirects,L.rawUrl),this.routerState=L.targetRouterState,"deferred"===this.urlUpdateStrategy&&(L.extras.skipLocationChange||this.setBrowserUrl(this.rawUrlTree,L),this.browserUrlTree=L.urlAfterRedirects)}),((_,p,f)=>(0,qe.U)(y=>(new li(p,y.targetRouterState,y.currentRouterState,f).activate(_),y)))(this.rootContexts,this.routeReuseStrategy,L=>this.triggerEvent(L)),Ne({next(){A=!0},complete(){A=!0}}),function(_){return(0,Se.e)((p,f)=>{try{p.subscribe(f)}finally{f.add(_)}})}(()=>{var L;if(!A&&!N){const $=`Navigation ID ${E.id} is not equal to the current navigation id ${this.navigationId}`;"replace"===this.canceledNavigationResolution?(this.restoreHistory(E),this.cancelNavigationTransition(E,$)):this.cancelNavigationTransition(E,$)}(null===(L=this.currentNavigation)||void 0===L?void 0:L.id)===E.id&&(this.currentNavigation=null)}),(0,Ue.K)(L=>{if(N=!0,function(_){return _&&_[hn]}(L)){const $=jr(L.url);$||(this.navigated=!0,this.restoreHistory(E,!0));const we=new wn(E.id,this.serializeUrl(E.extractedUrl),L.message);y.next(we),$?setTimeout(()=>{const ot=this.urlHandlingStrategy.merge(L.url,this.rawUrlTree),Be={skipLocationChange:E.extras.skipLocationChange,replaceUrl:"eager"===this.urlUpdateStrategy||wo(E.source)};this.scheduleNavigation(ot,"imperative",null,Be,{resolve:E.resolve,reject:E.reject,promise:E.promise})},0):E.resolve(!1)}else{this.restoreHistory(E,!0);const $=new fn(E.id,this.serializeUrl(E.extractedUrl),L);y.next($);try{E.resolve(this.errorHandler(L))}catch(we){E.reject(we)}}return Qe.E}))}))}resetRootComponentType(f){this.rootComponentType=f,this.routerState.root.component=this.rootComponentType}getTransition(){const f=this.transitions.value;return f.urlAfterRedirects=this.browserUrlTree,f}setTransition(f){this.transitions.next(Object.assign(Object.assign({},this.getTransition()),f))}initialNavigation(){this.setUpLocationChangeListener(),0===this.navigationId&&this.navigateByUrl(this.location.path(!0),{replaceUrl:!0})}setUpLocationChangeListener(){this.locationSubscription||(this.locationSubscription=this.location.subscribe(f=>{const y=this.extractLocationChangeInfoFromEvent(f);this.shouldScheduleNavigation(this.lastLocationChangeInfo,y)&&setTimeout(()=>{const{source:E,state:A,urlTree:N}=y,L={replaceUrl:!0};if(A){const $=Object.assign({},A);delete $.navigationId,delete $.\u0275routerPageId,0!==Object.keys($).length&&(L.state=$)}this.scheduleNavigation(N,E,A,L)},0),this.lastLocationChangeInfo=y}))}extractLocationChangeInfoFromEvent(f){var y;return{source:"popstate"===f.type?"popstate":"hashchange",urlTree:this.parseUrl(f.url),state:(null===(y=f.state)||void 0===y?void 0:y.navigationId)?f.state:null,transitionId:this.getTransition().id}}shouldScheduleNavigation(f,y){if(!f)return!0;const E=y.urlTree.toString()===f.urlTree.toString();return y.transitionId!==f.transitionId||!E||!("hashchange"===y.source&&"popstate"===f.source||"popstate"===y.source&&"hashchange"===f.source)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.currentNavigation}triggerEvent(f){this.events.next(f)}resetConfig(f){yo(f),this.config=f.map(b),this.navigated=!1,this.lastSuccessfulId=-1}ngOnDestroy(){this.dispose()}dispose(){this.transitions.complete(),this.locationSubscription&&(this.locationSubscription.unsubscribe(),this.locationSubscription=void 0),this.disposed=!0}createUrlTree(f,y={}){const{relativeTo:E,queryParams:A,fragment:N,queryParamsHandling:L,preserveFragment:$}=y,we=E||this.routerState.root,ot=$?this.currentUrlTree.fragment:N;let Be=null;switch(L){case"merge":Be=Object.assign(Object.assign({},this.currentUrlTree.queryParams),A);break;case"preserve":Be=this.currentUrlTree.queryParams;break;default:Be=A||null}return null!==Be&&(Be=this.removeEmptyProps(Be)),function(_,p,f,y,E){if(0===f.length)return Dr(p.root,p.root,p,y,E);const A=function(_){if("string"==typeof _[0]&&1===_.length&&"/"===_[0])return new ga(!0,0,_);let p=0,f=!1;const y=_.reduce((E,A,N)=>{if("object"==typeof A&&null!=A){if(A.outlets){const L={};return on(A.outlets,($,we)=>{L[we]="string"==typeof $?$.split("/"):$}),[...E,{outlets:L}]}if(A.segmentPath)return[...E,A.segmentPath]}return"string"!=typeof A?[...E,A]:0===N?(A.split("/").forEach((L,$)=>{0==$&&"."===L||(0==$&&""===L?f=!0:".."===L?p++:""!=L&&E.push(L))}),E):[...E,A]},[]);return new ga(f,p,y)}(f);if(A.toRoot())return Dr(p.root,new lt([],{}),p,y,E);const N=function(_,p,f){if(_.isAbsolute)return new Ts(p.root,!0,0);if(-1===f.snapshot._lastPathIndex){const A=f.snapshot._urlSegment;return new Ts(A,A===p.root,0)}const y=mo(_.commands[0])?0:1;return function(_,p,f){let y=_,E=p,A=f;for(;A>E;){if(A-=E,y=y.parent,!y)throw new Error("Invalid number of '../'");E=y.segments.length}return new Ts(y,!1,E-A)}(f.snapshot._urlSegment,f.snapshot._lastPathIndex+y,_.numberOfDoubleDots)}(A,p,_),L=N.processChildren?qo(N.segmentGroup,N.index,A.commands):_a(N.segmentGroup,N.index,A.commands);return Dr(N.segmentGroup,L,p,y,E)}(we,this.currentUrlTree,f,Be,null!=ot?ot:null)}navigateByUrl(f,y={skipLocationChange:!1}){const E=jr(f)?f:this.parseUrl(f),A=this.urlHandlingStrategy.merge(E,this.rawUrlTree);return this.scheduleNavigation(A,"imperative",null,y)}navigate(f,y={skipLocationChange:!1}){return function(_){for(let p=0;p<_.length;p++){const f=_[p];if(null==f)throw new Error(`The requested path contains ${f} segment at index ${p}`)}}(f),this.navigateByUrl(this.createUrlTree(f,y),y)}serializeUrl(f){return this.urlSerializer.serialize(f)}parseUrl(f){let y;try{y=this.urlSerializer.parse(f)}catch(E){y=this.malformedUriErrorHandler(E,this.urlSerializer,f)}return y}isActive(f,y){let E;if(E=!0===y?Object.assign({},Vs):!1===y?Object.assign({},ac):y,jr(f))return fo(this.currentUrlTree,f,E);const A=this.parseUrl(f);return fo(this.currentUrlTree,A,E)}removeEmptyProps(f){return Object.keys(f).reduce((y,E)=>{const A=f[E];return null!=A&&(y[E]=A),y},{})}processNavigations(){this.navigations.subscribe(f=>{this.navigated=!0,this.lastSuccessfulId=f.id,this.currentPageId=f.targetPageId,this.events.next(new bn(f.id,this.serializeUrl(f.extractedUrl),this.serializeUrl(this.currentUrlTree))),this.lastSuccessfulNavigation=this.currentNavigation,f.resolve(!0)},f=>{this.console.warn(`Unhandled Navigation Error: ${f}`)})}scheduleNavigation(f,y,E,A,N){var L,$;if(this.disposed)return Promise.resolve(!1);const we=this.getTransition(),ot=wo(y)&&we&&!wo(we.source),ft=(this.lastSuccessfulId===we.id||this.currentNavigation?we.rawUrl:we.urlAfterRedirects).toString()===f.toString();if(ot&&ft)return Promise.resolve(!0);let hi,nr,fr;N?(hi=N.resolve,nr=N.reject,fr=N.promise):fr=new Promise((Mr,To)=>{hi=Mr,nr=To});const Ir=++this.navigationId;let zr;return"computed"===this.canceledNavigationResolution?(0===this.currentPageId&&(E=this.location.getState()),zr=E&&E.\u0275routerPageId?E.\u0275routerPageId:A.replaceUrl||A.skipLocationChange?null!==(L=this.browserPageId)&&void 0!==L?L:0:(null!==($=this.browserPageId)&&void 0!==$?$:0)+1):zr=0,this.setTransition({id:Ir,targetPageId:zr,source:y,restoredState:E,currentUrlTree:this.currentUrlTree,currentRawUrl:this.rawUrlTree,rawUrl:f,extras:A,resolve:hi,reject:nr,promise:fr,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),fr.catch(Mr=>Promise.reject(Mr))}setBrowserUrl(f,y){const E=this.urlSerializer.serialize(f),A=Object.assign(Object.assign({},y.extras.state),this.generateNgRouterState(y.id,y.targetPageId));this.location.isCurrentPathEqualTo(E)||y.extras.replaceUrl?this.location.replaceState(E,"",A):this.location.go(E,"",A)}restoreHistory(f,y=!1){var E,A;if("computed"===this.canceledNavigationResolution){const N=this.currentPageId-f.targetPageId;"popstate"!==f.source&&"eager"!==this.urlUpdateStrategy&&this.currentUrlTree!==(null===(E=this.currentNavigation)||void 0===E?void 0:E.finalUrl)||0===N?this.currentUrlTree===(null===(A=this.currentNavigation)||void 0===A?void 0:A.finalUrl)&&0===N&&(this.resetState(f),this.browserUrlTree=f.currentUrlTree,this.resetUrlToCurrentUrlTree()):this.location.historyGo(N)}else"replace"===this.canceledNavigationResolution&&(y&&this.resetState(f),this.resetUrlToCurrentUrlTree())}resetState(f){this.routerState=f.currentRouterState,this.currentUrlTree=f.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,f.rawUrl)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}cancelNavigationTransition(f,y){const E=new wn(f.id,this.serializeUrl(f.extractedUrl),y);this.triggerEvent(E),f.resolve(!1)}generateNgRouterState(f,y){return"computed"===this.canceledNavigationResolution?{navigationId:f,\u0275routerPageId:y}:{navigationId:f}}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(m.DyG),m.LFG(Vr),m.LFG(bo),m.LFG(x.Ye),m.LFG(m.zs3),m.LFG(m.v3s),m.LFG(m.Sil),m.LFG(void 0))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();function wo(_){return"imperative"!==_}let $i=(()=>{class _{constructor(f,y,E,A,N){this.router=f,this.route=y,this.commands=[],this.onChanges=new ce.x,null==E&&A.setAttribute(N.nativeElement,"tabindex","0")}ngOnChanges(f){this.onChanges.next(this)}set routerLink(f){this.commands=null!=f?Array.isArray(f)?f:[f]:[]}onClick(){const f={skipLocationChange:Wr(this.skipLocationChange),replaceUrl:Wr(this.replaceUrl),state:this.state};return this.router.navigateByUrl(this.urlTree,f),!0}get urlTree(){return this.router.createUrlTree(this.commands,{relativeTo:void 0!==this.relativeTo?this.relativeTo:this.route,queryParams:this.queryParams,fragment:this.fragment,queryParamsHandling:this.queryParamsHandling,preserveFragment:Wr(this.preserveFragment)})}}return _.\u0275fac=function(f){return new(f||_)(m.Y36(yn),m.Y36(gn),m.$8M("tabindex"),m.Y36(m.Qsj),m.Y36(m.SBq))},_.\u0275dir=m.lG2({type:_,selectors:[["","routerLink","",5,"a",5,"area"]],hostBindings:function(f,y){1&f&&m.NdJ("click",function(){return y.onClick()})},inputs:{routerLink:"routerLink",queryParams:"queryParams",fragment:"fragment",queryParamsHandling:"queryParamsHandling",preserveFragment:"preserveFragment",skipLocationChange:"skipLocationChange",replaceUrl:"replaceUrl",state:"state",relativeTo:"relativeTo"},features:[m.TTD]}),_})();function Wr(_){return""===_||!!_}let Us=(()=>{class _{constructor(f,y,E,A,N){this.parentContexts=f,this.location=y,this.resolver=E,this.changeDetector=N,this.activated=null,this._activatedRoute=null,this.activateEvents=new m.vpe,this.deactivateEvents=new m.vpe,this.name=A||tt,f.onChildOutletCreated(this.name,this)}ngOnDestroy(){this.parentContexts.onChildOutletDestroyed(this.name)}ngOnInit(){if(!this.activated){const f=this.parentContexts.getContext(this.name);f&&f.route&&(f.attachRef?this.attach(f.attachRef,f.route):this.activateWith(f.route,f.resolver||null))}}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new Error("Outlet is not activated");return this.activated.instance}get activatedRoute(){if(!this.activated)throw new Error("Outlet is not activated");return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new Error("Outlet is not activated");this.location.detach();const f=this.activated;return this.activated=null,this._activatedRoute=null,f}attach(f,y){this.activated=f,this._activatedRoute=y,this.location.insert(f.hostView)}deactivate(){if(this.activated){const f=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(f)}}activateWith(f,y){if(this.isActivated)throw new Error("Cannot activate an already activated outlet");this._activatedRoute=f;const N=(y=y||this.resolver).resolveComponentFactory(f._futureSnapshot.routeConfig.component),L=this.parentContexts.getOrCreateContext(this.name).children,$=new fi(f,L,this.location.injector);this.activated=this.location.createComponent(N,this.location.length,$),this.changeDetector.markForCheck(),this.activateEvents.emit(this.activated.instance)}}return _.\u0275fac=function(f){return new(f||_)(m.Y36(bo),m.Y36(m.s_b),m.Y36(m._Vd),m.$8M("name"),m.Y36(m.sBO))},_.\u0275dir=m.lG2({type:_,selectors:[["router-outlet"]],outputs:{activateEvents:"activate",deactivateEvents:"deactivate"},exportAs:["outlet"]}),_})();class fi{constructor(p,f,y){this.route=p,this.childContexts=f,this.parent=y}get(p,f){return p===gn?this.route:p===bo?this.childContexts:this.parent.get(p,f)}}class Gi{}class jl{preload(p,f){return(0,ve.of)(null)}}let Eo=(()=>{class _{constructor(f,y,E,A,N){this.router=f,this.injector=A,this.preloadingStrategy=N,this.loader=new di(y,E,we=>f.triggerEvent(new co(we)),we=>f.triggerEvent(new vs(we)))}setUpPreloading(){this.subscription=this.router.events.pipe((0,Nn.h)(f=>f instanceof bn),(0,kt.b)(()=>this.preload())).subscribe(()=>{})}preload(){const f=this.injector.get(m.h0i);return this.processRoutes(f,this.router.config)}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}processRoutes(f,y){const E=[];for(const A of y)if(A.loadChildren&&!A.canLoad&&A._loadedConfig){const N=A._loadedConfig;E.push(this.processRoutes(N.module,N.routes))}else A.loadChildren&&!A.canLoad?E.push(this.preloadConfig(f,A)):A.children&&E.push(this.processRoutes(f,A.children));return(0,Z.D)(E).pipe((0,ge.J)(),(0,qe.U)(A=>{}))}preloadConfig(f,y){return this.preloadingStrategy.preload(y,()=>(y._loadedConfig?(0,ve.of)(y._loadedConfig):this.loader.load(f.injector,y)).pipe((0,_t.z)(A=>(y._loadedConfig=A,this.processRoutes(A.module,A.routes)))))}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(yn),m.LFG(m.v3s),m.LFG(m.Sil),m.LFG(m.zs3),m.LFG(Gi))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})(),Zo=(()=>{class _{constructor(f,y,E={}){this.router=f,this.viewportScroller=y,this.options=E,this.lastId=0,this.lastSource="imperative",this.restoredId=0,this.store={},E.scrollPositionRestoration=E.scrollPositionRestoration||"disabled",E.anchorScrolling=E.anchorScrolling||"disabled"}init(){"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents()}createScrollEvents(){return this.router.events.subscribe(f=>{f instanceof Ct?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=f.navigationTrigger,this.restoredId=f.restoredState?f.restoredState.navigationId:0):f instanceof bn&&(this.lastId=f.id,this.scheduleScrollEvent(f,this.router.parseUrl(f.urlAfterRedirects).fragment))})}consumeScrollEvents(){return this.router.events.subscribe(f=>{f instanceof ze&&(f.position?"top"===this.options.scrollPositionRestoration?this.viewportScroller.scrollToPosition([0,0]):"enabled"===this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition(f.position):f.anchor&&"enabled"===this.options.anchorScrolling?this.viewportScroller.scrollToAnchor(f.anchor):"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition([0,0]))})}scheduleScrollEvent(f,y){this.router.triggerEvent(new ze(f,"popstate"===this.lastSource?this.store[this.restoredId]:null,y))}ngOnDestroy(){this.routerEventsSubscription&&this.routerEventsSubscription.unsubscribe(),this.scrollEventsSubscription&&this.scrollEventsSubscription.unsubscribe()}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(yn),m.LFG(x.EM),m.LFG(void 0))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();const Wi=new m.OlP("ROUTER_CONFIGURATION"),cc=new m.OlP("ROUTER_FORROOT_GUARD"),js=[x.Ye,{provide:Vr,useClass:Wo},{provide:yn,useFactory:function(_,p,f,y,E,A,N,L={},$,we){const ot=new yn(null,_,p,f,y,E,A,Xr(N));return $&&(ot.urlHandlingStrategy=$),we&&(ot.routeReuseStrategy=we),function(_,p){_.errorHandler&&(p.errorHandler=_.errorHandler),_.malformedUriErrorHandler&&(p.malformedUriErrorHandler=_.malformedUriErrorHandler),_.onSameUrlNavigation&&(p.onSameUrlNavigation=_.onSameUrlNavigation),_.paramsInheritanceStrategy&&(p.paramsInheritanceStrategy=_.paramsInheritanceStrategy),_.relativeLinkResolution&&(p.relativeLinkResolution=_.relativeLinkResolution),_.urlUpdateStrategy&&(p.urlUpdateStrategy=_.urlUpdateStrategy)}(L,ot),L.enableTracing&&ot.events.subscribe(Be=>{var Dt,ft;null===(Dt=console.group)||void 0===Dt||Dt.call(console,`Router Event: ${Be.constructor.name}`),console.log(Be.toString()),console.log(Be),null===(ft=console.groupEnd)||void 0===ft||ft.call(console)}),ot},deps:[Vr,bo,x.Ye,m.zs3,m.v3s,m.Sil,ks,Wi,[class{},new m.FiY],[class{},new m.FiY]]},bo,{provide:gn,useFactory:function(_){return _.routerState.root},deps:[yn]},{provide:m.v3s,useClass:m.EAV},Eo,jl,class{preload(p,f){return f().pipe((0,Ue.K)(()=>(0,ve.of)(null)))}},{provide:Wi,useValue:{enableTracing:!1}}];function Bl(){return new m.PXZ("Router",yn)}let xa=(()=>{class _{constructor(f,y){}static forRoot(f,y){return{ngModule:_,providers:[js,zi(f),{provide:cc,useFactory:$l,deps:[[yn,new m.FiY,new m.tp0]]},{provide:Wi,useValue:y||{}},{provide:x.S$,useFactory:Hl,deps:[x.lw,[new m.tBr(x.mr),new m.FiY],Wi]},{provide:Zo,useFactory:Xo,deps:[yn,x.EM,Wi]},{provide:Gi,useExisting:y&&y.preloadingStrategy?y.preloadingStrategy:jl},{provide:m.PXZ,multi:!0,useFactory:Bl},[So,{provide:m.ip1,multi:!0,useFactory:gf,deps:[So]},{provide:Pa,useFactory:Ra,deps:[So]},{provide:m.tb,multi:!0,useExisting:Pa}]]}}static forChild(f){return{ngModule:_,providers:[zi(f)]}}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(cc,8),m.LFG(yn,8))},_.\u0275mod=m.oAB({type:_}),_.\u0275inj=m.cJS({}),_})();function Xo(_,p,f){return f.scrollOffset&&p.setOffset(f.scrollOffset),new Zo(_,p,f)}function Hl(_,p,f={}){return f.useHash?new x.Do(_,p):new x.b0(_,p)}function $l(_){return"guarded"}function zi(_){return[{provide:m.deG,multi:!0,useValue:_},{provide:ks,multi:!0,useValue:_}]}let So=(()=>{class _{constructor(f){this.injector=f,this.initNavigation=!1,this.destroyed=!1,this.resultOfPreactivationDone=new ce.x}appInitializer(){return this.injector.get(x.V_,Promise.resolve(null)).then(()=>{if(this.destroyed)return Promise.resolve(!0);let y=null;const E=new Promise(L=>y=L),A=this.injector.get(yn),N=this.injector.get(Wi);return"disabled"===N.initialNavigation?(A.setUpLocationChangeListener(),y(!0)):"enabled"===N.initialNavigation||"enabledBlocking"===N.initialNavigation?(A.hooks.afterPreactivation=()=>this.initNavigation?(0,ve.of)(null):(this.initNavigation=!0,y(!0),this.resultOfPreactivationDone),A.initialNavigation()):y(!0),E})}bootstrapListener(f){const y=this.injector.get(Wi),E=this.injector.get(Eo),A=this.injector.get(Zo),N=this.injector.get(yn),L=this.injector.get(m.z2F);f===L.components[0]&&(("enabledNonBlocking"===y.initialNavigation||void 0===y.initialNavigation)&&N.initialNavigation(),E.setUpPreloading(),A.init(),N.resetRootComponentType(L.componentTypes[0]),this.resultOfPreactivationDone.next(null),this.resultOfPreactivationDone.complete())}ngOnDestroy(){this.destroyed=!0}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(m.zs3))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();function gf(_){return _.appInitializer.bind(_)}function Ra(_){return _.bootstrapListener.bind(_)}const Pa=new m.OlP("Router Initializer")},1823:function(Ie,ne,O){var x;Ie.exports=(x=x||function(m,ce){var Q;if("undefined"!=typeof window&&window.crypto&&(Q=window.crypto),"undefined"!=typeof self&&self.crypto&&(Q=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(Q=globalThis.crypto),!Q&&"undefined"!=typeof window&&window.msCrypto&&(Q=window.msCrypto),!Q&&"undefined"!=typeof global&&global.crypto&&(Q=global.crypto),!Q)try{Q=O(2480)}catch(te){}var ee=function(){if(Q){if("function"==typeof Q.getRandomValues)try{return Q.getRandomValues(new Uint32Array(1))[0]}catch(te){}if("function"==typeof Q.randomBytes)try{return Q.randomBytes(4).readInt32LE()}catch(te){}}throw new Error("Native crypto module could not be used to get secure random number.")},Ae=Object.create||function(){function te(){}return function(ge){var se;return te.prototype=ge,se=new te,te.prototype=null,se}}(),Z={},ye=Z.lib={},pe=ye.Base={extend:function(te){var ge=Ae(this);return te&&ge.mixIn(te),(!ge.hasOwnProperty("init")||this.init===ge.init)&&(ge.init=function(){ge.$super.init.apply(this,arguments)}),ge.init.prototype=ge,ge.$super=this,ge},create:function(){var te=this.extend();return te.init.apply(te,arguments),te},init:function(){},mixIn:function(te){for(var ge in te)te.hasOwnProperty(ge)&&(this[ge]=te[ge]);te.hasOwnProperty("toString")&&(this.toString=te.toString)},clone:function(){return this.init.prototype.extend(this)}},re=ye.WordArray=pe.extend({init:function(te,ge){te=this.words=te||[],this.sigBytes=null!=ge?ge:4*te.length},toString:function(te){return(te||_e).stringify(this)},concat:function(te){var ge=this.words,se=te.words,de=this.sigBytes,he=te.sigBytes;if(this.clamp(),de%4)for(var be=0;be>>2]|=(se[be>>>2]>>>24-be%4*8&255)<<24-(de+be)%4*8;else for(var Se=0;Se>>2]=se[Se>>>2];return this.sigBytes+=he,this},clamp:function(){var te=this.words,ge=this.sigBytes;te[ge>>>2]&=4294967295<<32-ge%4*8,te.length=m.ceil(ge/4)},clone:function(){var te=pe.clone.call(this);return te.words=this.words.slice(0),te},random:function(te){for(var ge=[],se=0;se>>2]>>>24-he%4*8&255;de.push((be>>>4).toString(16)),de.push((15&be).toString(16))}return de.join("")},parse:function(te){for(var ge=te.length,se=[],de=0;de>>3]|=parseInt(te.substr(de,2),16)<<24-de%8*4;return new re.init(se,ge/2)}},xe=Y.Latin1={stringify:function(te){for(var ge=te.words,se=te.sigBytes,de=[],he=0;he>>2]>>>24-he%4*8&255));return de.join("")},parse:function(te){for(var ge=te.length,se=[],de=0;de>>2]|=(255&te.charCodeAt(de))<<24-de%4*8;return new re.init(se,ge)}},z=Y.Utf8={stringify:function(te){try{return decodeURIComponent(escape(xe.stringify(te)))}catch(ge){throw new Error("Malformed UTF-8 data")}},parse:function(te){return xe.parse(unescape(encodeURIComponent(te)))}},Oe=ye.BufferedBlockAlgorithm=pe.extend({reset:function(){this._data=new re.init,this._nDataBytes=0},_append:function(te){"string"==typeof te&&(te=z.parse(te)),this._data.concat(te),this._nDataBytes+=te.sigBytes},_process:function(te){var ge,se=this._data,de=se.words,he=se.sigBytes,be=this.blockSize,Se=he/(4*be),ae=(Se=te?m.ceil(Se):m.max((0|Se)-this._minBufferSize,0))*be,Le=m.min(4*ae,he);if(ae){for(var ve=0;ve>>2]>>>24-xe%4*8&255)<<16|(pe[xe+1>>>2]>>>24-(xe+1)%4*8&255)<<8|pe[xe+2>>>2]>>>24-(xe+2)%4*8&255,te=0;te<4&&xe+.75*te>>6*(3-te)&63));var ge=Y.charAt(64);if(ge)for(;_e.length%4;)_e.push(ge);return _e.join("")},parse:function(ye){var pe=ye.length,re=this._map,Y=this._reverseMap;if(!Y){Y=this._reverseMap=[];for(var _e=0;_e>>6-xe%4*2;Y[_e>>>2]|=(z|Oe)<<24-_e%4*8,_e++}return Q.create(Y,_e)}(ye,pe,Y)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},x.enc.Base64)},9706:function(Ie,ne,O){Ie.exports=O(1823).enc.Utf8},6946:function(Ie,ne,O){var x;Ie.exports=(x=O(1823),function(m){var ce=x,Q=ce.lib,ee=Q.WordArray,Ae=Q.Hasher,Z=ce.algo,ye=[],pe=[];!function(){function _e(ue){for(var je=m.sqrt(ue),te=2;te<=je;te++)if(!(ue%te))return!1;return!0}function xe(ue){return 4294967296*(ue-(0|ue))|0}for(var z=2,Oe=0;Oe<64;)_e(z)&&(Oe<8&&(ye[Oe]=xe(m.pow(z,.5))),pe[Oe]=xe(m.pow(z,1/3)),Oe++),z++}();var re=[],Y=Z.SHA256=Ae.extend({_doReset:function(){this._hash=new ee.init(ye.slice(0))},_doProcessBlock:function(_e,xe){for(var z=this._hash.words,Oe=z[0],ue=z[1],je=z[2],te=z[3],ge=z[4],se=z[5],de=z[6],he=z[7],be=0;be<64;be++){if(be<16)re[be]=0|_e[xe+be];else{var at=re[be-15],ae=re[be-2];re[be]=((at<<25|at>>>7)^(at<<14|at>>>18)^at>>>3)+re[be-7]+((ae<<15|ae>>>17)^(ae<<13|ae>>>19)^ae>>>10)+re[be-16]}var Qe=Oe&ue^Oe&je^ue&je,Me=he+((ge<<26|ge>>>6)^(ge<<21|ge>>>11)^(ge<<7|ge>>>25))+(ge&se^~ge&de)+pe[be]+re[be];he=de,de=se,se=ge,ge=te+Me|0,te=je,je=ue,ue=Oe,Oe=Me+(((Oe<<30|Oe>>>2)^(Oe<<19|Oe>>>13)^(Oe<<10|Oe>>>22))+Qe)|0}z[0]=z[0]+Oe|0,z[1]=z[1]+ue|0,z[2]=z[2]+je|0,z[3]=z[3]+te|0,z[4]=z[4]+ge|0,z[5]=z[5]+se|0,z[6]=z[6]+de|0,z[7]=z[7]+he|0},_doFinalize:function(){var _e=this._data,xe=_e.words,z=8*this._nDataBytes,Oe=8*_e.sigBytes;return xe[Oe>>>5]|=128<<24-Oe%32,xe[14+(Oe+64>>>9<<4)]=m.floor(z/4294967296),xe[15+(Oe+64>>>9<<4)]=z,_e.sigBytes=4*xe.length,this._process(),this._hash},clone:function(){var _e=Ae.clone.call(this);return _e._hash=this._hash.clone(),_e}});ce.SHA256=Ae._createHelper(Y),ce.HmacSHA256=Ae._createHmacHelper(Y)}(Math),x.SHA256)},7980:(Ie,ne,O)=>{"use strict";O.d(ne,{y:()=>re});var x=O(817),m=O(9593),ce=O(3122),Q=O(8330);var Z=O(2046),ye=O(5975),pe=O(1519);let re=(()=>{class z{constructor(ue){ue&&(this._subscribe=ue)}lift(ue){const je=new z;return je.source=this,je.operator=ue,je}subscribe(ue,je,te){const ge=function(z){return z&&z instanceof x.Lv||function(z){return z&&(0,ye.m)(z.next)&&(0,ye.m)(z.error)&&(0,ye.m)(z.complete)}(z)&&(0,m.Nn)(z)}(ue)?ue:new x.Hp(ue,je,te);return(0,pe.x)(()=>{const{operator:se,source:de}=this;ge.add(se?se.call(ge,de):de?this._subscribe(ge):this._trySubscribe(ge))}),ge}_trySubscribe(ue){try{return this._subscribe(ue)}catch(je){ue.error(je)}}forEach(ue,je){return new(je=Y(je))((te,ge)=>{const se=new x.Hp({next:de=>{try{ue(de)}catch(he){ge(he),se.unsubscribe()}},error:ge,complete:te});this.subscribe(se)})}_subscribe(ue){var je;return null===(je=this.source)||void 0===je?void 0:je.subscribe(ue)}[ce.L](){return this}pipe(...ue){return function(z){return 0===z.length?Q.y:1===z.length?z[0]:function(ue){return z.reduce((je,te)=>te(je),ue)}}(ue)(this)}toPromise(ue){return new(ue=Y(ue))((je,te)=>{let ge;this.subscribe(se=>ge=se,se=>te(se),()=>je(ge))})}}return z.create=Oe=>new z(Oe),z})();function Y(z){var Oe;return null!==(Oe=null!=z?z:Z.v.Promise)&&void 0!==Oe?Oe:Promise}},9359:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>Z});var x=O(7980),m=O(9593);const Q=(0,O(5776).d)(pe=>function(){pe(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var ee=O(8308),Ae=O(1519);let Z=(()=>{class pe extends x.y{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(Y){const _e=new ye(this,this);return _e.operator=Y,_e}_throwIfClosed(){if(this.closed)throw new Q}next(Y){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const _e of this.currentObservers)_e.next(Y)}})}error(Y){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=Y;const{observers:_e}=this;for(;_e.length;)_e.shift().error(Y)}})}complete(){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:Y}=this;for(;Y.length;)Y.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var Y;return(null===(Y=this.observers)||void 0===Y?void 0:Y.length)>0}_trySubscribe(Y){return this._throwIfClosed(),super._trySubscribe(Y)}_subscribe(Y){return this._throwIfClosed(),this._checkFinalizedStatuses(Y),this._innerSubscribe(Y)}_innerSubscribe(Y){const{hasError:_e,isStopped:xe,observers:z}=this;return _e||xe?m.Lc:(this.currentObservers=null,z.push(Y),new m.w0(()=>{this.currentObservers=null,(0,ee.P)(z,Y)}))}_checkFinalizedStatuses(Y){const{hasError:_e,thrownError:xe,isStopped:z}=this;_e?Y.error(xe):z&&Y.complete()}asObservable(){const Y=new x.y;return Y.source=this,Y}}return pe.create=(re,Y)=>new ye(re,Y),pe})();class ye extends Z{constructor(re,Y){super(),this.destination=re,this.source=Y}next(re){var Y,_e;null===(_e=null===(Y=this.destination)||void 0===Y?void 0:Y.next)||void 0===_e||_e.call(Y,re)}error(re){var Y,_e;null===(_e=null===(Y=this.destination)||void 0===Y?void 0:Y.error)||void 0===_e||_e.call(Y,re)}complete(){var re,Y;null===(Y=null===(re=this.destination)||void 0===re?void 0:re.complete)||void 0===Y||Y.call(re)}_subscribe(re){var Y,_e;return null!==(_e=null===(Y=this.source)||void 0===Y?void 0:Y.subscribe(re))&&void 0!==_e?_e:m.Lc}}},817:(Ie,ne,O)=>{"use strict";O.d(ne,{Hp:()=>ue,Lv:()=>_e});var x=O(5975),m=O(9593),ce=O(2046),Q=O(4922);function ee(){}const Ae=pe("C",void 0,void 0);function pe(de,he,be){return{kind:de,value:he,error:be}}var re=O(4146),Y=O(1519);class _e extends m.w0{constructor(he){super(),this.isStopped=!1,he?(this.destination=he,(0,m.Nn)(he)&&he.add(this)):this.destination=se}static create(he,be,at){return new ue(he,be,at)}next(he){this.isStopped?ge(pe("N",he,void 0),this):this._next(he)}error(he){this.isStopped?ge(pe("E",void 0,he),this):(this.isStopped=!0,this._error(he))}complete(){this.isStopped?ge(Ae,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(he){this.destination.next(he)}_error(he){try{this.destination.error(he)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const xe=Function.prototype.bind;function z(de,he){return xe.call(de,he)}class Oe{constructor(he){this.partialObserver=he}next(he){const{partialObserver:be}=this;if(be.next)try{be.next(he)}catch(at){je(at)}}error(he){const{partialObserver:be}=this;if(be.error)try{be.error(he)}catch(at){je(at)}else je(he)}complete(){const{partialObserver:he}=this;if(he.complete)try{he.complete()}catch(be){je(be)}}}class ue extends _e{constructor(he,be,at){let Se;if(super(),(0,x.m)(he)||!he)Se={next:null!=he?he:void 0,error:null!=be?be:void 0,complete:null!=at?at:void 0};else{let ae;this&&ce.v.useDeprecatedNextContext?(ae=Object.create(he),ae.unsubscribe=()=>this.unsubscribe(),Se={next:he.next&&z(he.next,ae),error:he.error&&z(he.error,ae),complete:he.complete&&z(he.complete,ae)}):Se=he}this.destination=new Oe(Se)}}function je(de){ce.v.useDeprecatedSynchronousErrorHandling?(0,Y.O)(de):(0,Q.h)(de)}function ge(de,he){const{onStoppedNotification:be}=ce.v;be&&re.z.setTimeout(()=>be(de,he))}const se={closed:!0,next:ee,error:function(de){throw de},complete:ee}},9593:(Ie,ne,O)=>{"use strict";O.d(ne,{Lc:()=>Ae,w0:()=>ee,Nn:()=>Z});var x=O(5975);const ce=(0,O(5776).d)(pe=>function(Y){pe(this),this.message=Y?`${Y.length} errors occurred during unsubscription:\n${Y.map((_e,xe)=>`${xe+1}) ${_e.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=Y});var Q=O(8308);class ee{constructor(re){this.initialTeardown=re,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let re;if(!this.closed){this.closed=!0;const{_parentage:Y}=this;if(Y)if(this._parentage=null,Array.isArray(Y))for(const z of Y)z.remove(this);else Y.remove(this);const{initialTeardown:_e}=this;if((0,x.m)(_e))try{_e()}catch(z){re=z instanceof ce?z.errors:[z]}const{_finalizers:xe}=this;if(xe){this._finalizers=null;for(const z of xe)try{ye(z)}catch(Oe){re=null!=re?re:[],Oe instanceof ce?re=[...re,...Oe.errors]:re.push(Oe)}}if(re)throw new ce(re)}}add(re){var Y;if(re&&re!==this)if(this.closed)ye(re);else{if(re instanceof ee){if(re.closed||re._hasParent(this))return;re._addParent(this)}(this._finalizers=null!==(Y=this._finalizers)&&void 0!==Y?Y:[]).push(re)}}_hasParent(re){const{_parentage:Y}=this;return Y===re||Array.isArray(Y)&&Y.includes(re)}_addParent(re){const{_parentage:Y}=this;this._parentage=Array.isArray(Y)?(Y.push(re),Y):Y?[Y,re]:re}_removeParent(re){const{_parentage:Y}=this;Y===re?this._parentage=null:Array.isArray(Y)&&(0,Q.P)(Y,re)}remove(re){const{_finalizers:Y}=this;Y&&(0,Q.P)(Y,re),re instanceof ee&&re._removeParent(this)}}ee.EMPTY=(()=>{const pe=new ee;return pe.closed=!0,pe})();const Ae=ee.EMPTY;function Z(pe){return pe instanceof ee||pe&&"closed"in pe&&(0,x.m)(pe.remove)&&(0,x.m)(pe.add)&&(0,x.m)(pe.unsubscribe)}function ye(pe){(0,x.m)(pe)?pe():pe.unsubscribe()}},2046:(Ie,ne,O)=>{"use strict";O.d(ne,{v:()=>x});const x={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},9018:(Ie,ne,O)=>{"use strict";O.d(ne,{E:()=>m});const m=new(O(7980).y)(ee=>ee.complete())},9517:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>at});var x=O(5955),m=O(6903),ce=O(2085),Q=O(8499);function ee(Se,ae=0){return(0,ce.e)((Le,ve)=>{Le.subscribe((0,Q.x)(ve,Qe=>(0,m.f)(ve,Se,()=>ve.next(Qe),ae),()=>(0,m.f)(ve,Se,()=>ve.complete(),ae),Qe=>(0,m.f)(ve,Se,()=>ve.error(Qe),ae)))})}function Ae(Se,ae=0){return(0,ce.e)((Le,ve)=>{ve.add(Se.schedule(()=>Le.subscribe(ve),ae))})}var pe=O(7980),Y=O(4565),_e=O(5975);function z(Se,ae){if(!Se)throw new Error("Iterable cannot be null");return new pe.y(Le=>{(0,m.f)(Le,ae,()=>{const ve=Se[Symbol.asyncIterator]();(0,m.f)(Le,ae,()=>{ve.next().then(Qe=>{Qe.done?Le.complete():Le.next(Qe.value)})},0,!0)})})}var Oe=O(2021),ue=O(9450),je=O(6602),te=O(6920),ge=O(2604),se=O(5626),de=O(1559);function at(Se,ae){return ae?function(Se,ae){if(null!=Se){if((0,Oe.c)(Se))return function(Se,ae){return(0,x.Xf)(Se).pipe(Ae(ae),ee(ae))}(Se,ae);if((0,je.z)(Se))return function(Se,ae){return new pe.y(Le=>{let ve=0;return ae.schedule(function(){ve===Se.length?Le.complete():(Le.next(Se[ve++]),Le.closed||this.schedule())})})}(Se,ae);if((0,ue.t)(Se))return function(Se,ae){return(0,x.Xf)(Se).pipe(Ae(ae),ee(ae))}(Se,ae);if((0,ge.D)(Se))return z(Se,ae);if((0,te.T)(Se))return function(Se,ae){return new pe.y(Le=>{let ve;return(0,m.f)(Le,ae,()=>{ve=Se[Y.h](),(0,m.f)(Le,ae,()=>{let Qe,Ke;try{({value:Qe,done:Ke}=ve.next())}catch(pt){return void Le.error(pt)}Ke?Le.complete():Le.next(Qe)},0,!0)}),()=>(0,_e.m)(null==ve?void 0:ve.return)&&ve.return()})}(Se,ae);if((0,de.L)(Se))return function(Se,ae){return z((0,de.Q)(Se),ae)}(Se,ae)}throw(0,se.z)(Se)}(Se,ae):(0,x.Xf)(Se)}},5955:(Ie,ne,O)=>{"use strict";O.d(ne,{Xf:()=>xe});var x=O(7582),m=O(6602),ce=O(9450),Q=O(7980),ee=O(2021),Ae=O(2604),Z=O(5626),ye=O(6920),pe=O(1559),re=O(5975),Y=O(4922),_e=O(3122);function xe(de){if(de instanceof Q.y)return de;if(null!=de){if((0,ee.c)(de))return function(de){return new Q.y(he=>{const be=de[_e.L]();if((0,re.m)(be.subscribe))return be.subscribe(he);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(de);if((0,m.z)(de))return function(de){return new Q.y(he=>{for(let be=0;be{de.then(be=>{he.closed||(he.next(be),he.complete())},be=>he.error(be)).then(null,Y.h)})}(de);if((0,Ae.D)(de))return te(de);if((0,ye.T)(de))return function(de){return new Q.y(he=>{for(const be of de)if(he.next(be),he.closed)return;he.complete()})}(de);if((0,pe.L)(de))return function(de){return te((0,pe.Q)(de))}(de)}throw(0,Z.z)(de)}function te(de){return new Q.y(he=>{(function(de,he){var be,at,Se,ae;return(0,x.mG)(this,void 0,void 0,function*(){try{for(be=(0,x.KL)(de);!(at=yield be.next()).done;)if(he.next(at.value),he.closed)return}catch(Le){Se={error:Le}}finally{try{at&&!at.done&&(ae=be.return)&&(yield ae.call(be))}finally{if(Se)throw Se.error}}he.complete()})})(de,he).catch(be=>he.error(be))})}},4945:(Ie,ne,O)=>{"use strict";O.d(ne,{of:()=>ce});var x=O(8007),m=O(9517);function ce(...Q){const ee=(0,x.yG)(Q);return(0,m.D)(Q,ee)}},8499:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>m});var x=O(817);function m(Q,ee,Ae,Z,ye){return new ce(Q,ee,Ae,Z,ye)}class ce extends x.Lv{constructor(ee,Ae,Z,ye,pe,re){super(ee),this.onFinalize=pe,this.shouldUnsubscribe=re,this._next=Ae?function(Y){try{Ae(Y)}catch(_e){ee.error(_e)}}:super._next,this._error=ye?function(Y){try{ye(Y)}catch(_e){ee.error(_e)}finally{this.unsubscribe()}}:super._error,this._complete=Z?function(){try{Z()}catch(Y){ee.error(Y)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var ee;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:Ae}=this;super.unsubscribe(),!Ae&&(null===(ee=this.onFinalize)||void 0===ee||ee.call(this))}}}},3568:(Ie,ne,O)=>{"use strict";O.d(ne,{K:()=>Q});var x=O(5955),m=O(8499),ce=O(2085);function Q(ee){return(0,ce.e)((Ae,Z)=>{let re,ye=null,pe=!1;ye=Ae.subscribe((0,m.x)(Z,void 0,void 0,Y=>{re=(0,x.Xf)(ee(Y,Q(ee)(Ae))),ye?(ye.unsubscribe(),ye=null,re.subscribe(Z)):pe=!0})),pe&&(ye.unsubscribe(),ye=null,re.subscribe(Z))})}},4551:(Ie,ne,O)=>{"use strict";O.d(ne,{b:()=>ce});var x=O(3159),m=O(5975);function ce(Q,ee){return(0,m.m)(ee)?(0,x.z)(Q,ee,1):(0,x.z)(Q,1)}},4970:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>ce});var x=O(2085),m=O(8499);function ce(Q,ee){return(0,x.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,m.x)(Z,pe=>Q.call(ee,pe,ye++)&&Z.next(pe)))})}},7969:(Ie,ne,O)=>{"use strict";O.d(ne,{U:()=>ce});var x=O(2085),m=O(8499);function ce(Q,ee){return(0,x.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,m.x)(Z,pe=>{Z.next(Q.call(ee,pe,ye++))}))})}},549:(Ie,ne,O)=>{"use strict";O.d(ne,{J:()=>ce});var x=O(3159),m=O(8330);function ce(Q=1/0){return(0,x.z)(m.y,Q)}},3159:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>ye});var x=O(7969),m=O(5955),ce=O(2085),ee=(O(6903),O(8499)),Z=O(5975);function ye(pe,re,Y=1/0){return(0,Z.m)(re)?ye((_e,xe)=>(0,x.U)((z,Oe)=>re(_e,z,xe,Oe))((0,m.Xf)(pe(_e,xe))),Y):("number"==typeof re&&(Y=re),(0,ce.e)((_e,xe)=>function(pe,re,Y,_e,xe,z,Oe,ue){const je=[];let te=0,ge=0,se=!1;const de=()=>{se&&!je.length&&!te&&re.complete()},he=at=>te<_e?be(at):je.push(at),be=at=>{te++;let Se=!1;(0,m.Xf)(Y(at,ge++)).subscribe((0,ee.x)(re,ae=>{re.next(ae)},()=>{Se=!0},void 0,()=>{if(Se)try{for(te--;je.length&&te<_e;){const ae=je.shift();be(ae)}de()}catch(ae){re.error(ae)}}))};return pe.subscribe((0,ee.x)(re,he,()=>{se=!0,de()})),()=>{}}(_e,xe,pe,Y)))}},1528:(Ie,ne,O)=>{"use strict";O.d(ne,{w:()=>Q});var x=O(5955),m=O(2085),ce=O(8499);function Q(ee,Ae){return(0,m.e)((Z,ye)=>{let pe=null,re=0,Y=!1;const _e=()=>Y&&!pe&&ye.complete();Z.subscribe((0,ce.x)(ye,xe=>{null==pe||pe.unsubscribe();let z=0;const Oe=re++;(0,x.Xf)(ee(xe,Oe)).subscribe(pe=(0,ce.x)(ye,ue=>ye.next(Ae?Ae(xe,ue,Oe,z++):ue),()=>{pe=null,_e()}))},()=>{Y=!0,_e()}))})}},5598:(Ie,ne,O)=>{"use strict";O.d(ne,{q:()=>Q});var x=O(9018),m=O(2085),ce=O(8499);function Q(ee){return ee<=0?()=>x.E:(0,m.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,ce.x)(Z,pe=>{++ye<=ee&&(Z.next(pe),ee<=ye&&Z.complete())}))})}},4146:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>x});const x={setTimeout(m,ce,...Q){const{delegate:ee}=x;return(null==ee?void 0:ee.setTimeout)?ee.setTimeout(m,ce,...Q):setTimeout(m,ce,...Q)},clearTimeout(m){const{delegate:ce}=x;return((null==ce?void 0:ce.clearTimeout)||clearTimeout)(m)},delegate:void 0}},4565:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>m});const m="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},3122:(Ie,ne,O)=>{"use strict";O.d(ne,{L:()=>x});const x="function"==typeof Symbol&&Symbol.observable||"@@observable"},8007:(Ie,ne,O)=>{"use strict";O.d(ne,{_6:()=>Ae,jO:()=>Q,yG:()=>ee});var x=O(5975);function ce(Z){return Z[Z.length-1]}function Q(Z){return(0,x.m)(ce(Z))?Z.pop():void 0}function ee(Z){return function(Z){return Z&&(0,x.m)(Z.schedule)}(ce(Z))?Z.pop():void 0}function Ae(Z,ye){return"number"==typeof ce(Z)?Z.pop():ye}},447:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>ee});const{isArray:x}=Array,{getPrototypeOf:m,prototype:ce,keys:Q}=Object;function ee(Z){if(1===Z.length){const ye=Z[0];if(x(ye))return{args:ye,keys:null};if(function(Z){return Z&&"object"==typeof Z&&m(Z)===ce}(ye)){const pe=Q(ye);return{args:pe.map(re=>ye[re]),keys:pe}}}return{args:Z,keys:null}}},8308:(Ie,ne,O)=>{"use strict";function x(m,ce){if(m){const Q=m.indexOf(ce);0<=Q&&m.splice(Q,1)}}O.d(ne,{P:()=>x})},5776:(Ie,ne,O)=>{"use strict";function x(m){const Q=m(ee=>{Error.call(ee),ee.stack=(new Error).stack});return Q.prototype=Object.create(Error.prototype),Q.prototype.constructor=Q,Q}O.d(ne,{d:()=>x})},9299:(Ie,ne,O)=>{"use strict";function x(m,ce){return m.reduce((Q,ee,Ae)=>(Q[ee]=ce[Ae],Q),{})}O.d(ne,{n:()=>x})},1519:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>ce,O:()=>Q});var x=O(2046);let m=null;function ce(ee){if(x.v.useDeprecatedSynchronousErrorHandling){const Ae=!m;if(Ae&&(m={errorThrown:!1,error:null}),ee(),Ae){const{errorThrown:Z,error:ye}=m;if(m=null,Z)throw ye}}else ee()}function Q(ee){x.v.useDeprecatedSynchronousErrorHandling&&m&&(m.errorThrown=!0,m.error=ee)}},6903:(Ie,ne,O)=>{"use strict";function x(m,ce,Q,ee=0,Ae=!1){const Z=ce.schedule(function(){Q(),Ae?m.add(this.schedule(null,ee)):this.unsubscribe()},ee);if(m.add(Z),!Ae)return Z}O.d(ne,{f:()=>x})},8330:(Ie,ne,O)=>{"use strict";function x(m){return m}O.d(ne,{y:()=>x})},6602:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>x});const x=m=>m&&"number"==typeof m.length&&"function"!=typeof m},2604:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>m});var x=O(5975);function m(ce){return Symbol.asyncIterator&&(0,x.m)(null==ce?void 0:ce[Symbol.asyncIterator])}},5975:(Ie,ne,O)=>{"use strict";function x(m){return"function"==typeof m}O.d(ne,{m:()=>x})},2021:(Ie,ne,O)=>{"use strict";O.d(ne,{c:()=>ce});var x=O(3122),m=O(5975);function ce(Q){return(0,m.m)(Q[x.L])}},6920:(Ie,ne,O)=>{"use strict";O.d(ne,{T:()=>ce});var x=O(4565),m=O(5975);function ce(Q){return(0,m.m)(null==Q?void 0:Q[x.h])}},9450:(Ie,ne,O)=>{"use strict";O.d(ne,{t:()=>m});var x=O(5975);function m(ce){return(0,x.m)(null==ce?void 0:ce.then)}},1559:(Ie,ne,O)=>{"use strict";O.d(ne,{Q:()=>ce,L:()=>Q});var x=O(7582),m=O(5975);function ce(ee){return(0,x.FC)(this,arguments,function*(){const Z=ee.getReader();try{for(;;){const{value:ye,done:pe}=yield(0,x.qq)(Z.read());if(pe)return yield(0,x.qq)(void 0);yield yield(0,x.qq)(ye)}}finally{Z.releaseLock()}})}function Q(ee){return(0,m.m)(null==ee?void 0:ee.getReader)}},2085:(Ie,ne,O)=>{"use strict";O.d(ne,{A:()=>m,e:()=>ce});var x=O(5975);function m(Q){return(0,x.m)(null==Q?void 0:Q.lift)}function ce(Q){return ee=>{if(m(ee))return ee.lift(function(Ae){try{return Q(Ae,this)}catch(Z){this.error(Z)}});throw new TypeError("Unable to lift unknown Observable type")}}},2692:(Ie,ne,O)=>{"use strict";O.d(ne,{Z:()=>Q});var x=O(7969);const{isArray:m}=Array;function Q(ee){return(0,x.U)(Ae=>function(ee,Ae){return m(Ae)?ee(...Ae):ee(Ae)}(ee,Ae))}},4922:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>ce});var x=O(2046),m=O(4146);function ce(Q){m.z.setTimeout(()=>{const{onUnhandledError:ee}=x.v;if(!ee)throw Q;ee(Q)})}},5626:(Ie,ne,O)=>{"use strict";function x(m){return new TypeError(`You provided ${null!==m&&"object"==typeof m?"an invalid object":`'${m}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}O.d(ne,{z:()=>x})},2462:(Ie,ne,O)=>{"use strict";O.r(ne),O.d(ne,{PageModule:()=>Ae});var x=O(8967),m=O(7525);const Q=[{path:"",component:(()=>{class Z{constructor(pe){this.route=pe,this.title=""}ngOnInit(){this.title=this.route.snapshot.data.title}}return Z.\u0275fac=function(pe){return new(pe||Z)(m.Y36(x.gz))},Z.\u0275cmp=m.Xpm({type:Z,selectors:[["app-page"]],decls:2,vars:1,template:function(pe,re){1&pe&&(m.TgZ(0,"h2"),m._uU(1),m.qZA()),2&pe&&(m.xp6(1),m.Oqu(re.title))},styles:["[_nghost-%COMP%]{display:flex;justify-content:center;align-items:center;height:100%;color:#bdbdbd}"]}),Z})()}];let ee=(()=>{class Z{}return Z.\u0275fac=function(pe){return new(pe||Z)},Z.\u0275mod=m.oAB({type:Z}),Z.\u0275inj=m.cJS({imports:[[x.Bz.forChild(Q)],x.Bz]}),Z})(),Ae=(()=>{class Z{}return Z.\u0275fac=function(pe){return new(pe||Z)},Z.\u0275mod=m.oAB({type:Z}),Z.\u0275inj=m.cJS({imports:[[ee]]}),Z})()},4159:(Ie,ne,O)=>{"use strict";var x=O(8583),m=O(7525);class ce extends x.w_{constructor(){super(...arguments),this.supportsDOMEvents=!0}}class Q extends ce{static makeCurrent(){(0,x.HT)(new Q)}onAndCancel(i,o,u){return i.addEventListener(o,u,!1),()=>{i.removeEventListener(o,u,!1)}}dispatchEvent(i,o){i.dispatchEvent(o)}remove(i){i.parentNode&&i.parentNode.removeChild(i)}createElement(i,o){return(o=o||this.getDefaultDocument()).createElement(i)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(i){return i.nodeType===Node.ELEMENT_NODE}isShadowRoot(i){return i instanceof DocumentFragment}getGlobalEventTarget(i,o){return"window"===o?window:"document"===o?i:"body"===o?i.body:null}getBaseHref(i){const o=(ee=ee||document.querySelector("base"),ee?ee.getAttribute("href"):null);return null==o?null:function(a){Z=Z||document.createElement("a"),Z.setAttribute("href",a);const i=Z.pathname;return"/"===i.charAt(0)?i:`/${i}`}(o)}resetBaseElement(){ee=null}getUserAgent(){return window.navigator.userAgent}getCookie(i){return(0,x.Mx)(document.cookie,i)}}let Z,ee=null;const pe=new m.OlP("TRANSITION_ID"),Y=[{provide:m.ip1,useFactory:function(a,i,o){return()=>{o.get(m.CZH).donePromise.then(()=>{const u=(0,x.q)(),h=i.querySelectorAll(`style[ng-transition="${a}"]`);for(let w=0;w{const w=i.findTestabilityInTree(u,h);if(null==w)throw new Error("Could not find testability for element.");return w},m.dqk.getAllAngularTestabilities=()=>i.getAllTestabilities(),m.dqk.getAllAngularRootElements=()=>i.getAllRootElements(),m.dqk.frameworkStabilizers||(m.dqk.frameworkStabilizers=[]),m.dqk.frameworkStabilizers.push(u=>{const h=m.dqk.getAllAngularTestabilities();let w=h.length,T=!1;const P=function(F){T=T||F,w--,0==w&&u(T)};h.forEach(function(F){F.whenStable(P)})})}findTestabilityInTree(i,o,u){if(null==o)return null;const h=i.getTestability(o);return null!=h?h:u?(0,x.q)().isShadowRoot(o)?this.findTestabilityInTree(i,o.host,!0):this.findTestabilityInTree(i,o.parentElement,!0):null}}let xe=(()=>{class a{build(){return new XMLHttpRequest}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Qe=new m.OlP("EventManagerPlugins");let Ke=(()=>{class a{constructor(o,u){this._zone=u,this._eventNameToPlugin=new Map,o.forEach(h=>h.manager=this),this._plugins=o.slice().reverse()}addEventListener(o,u,h){return this._findPluginFor(u).addEventListener(o,u,h)}addGlobalEventListener(o,u,h){return this._findPluginFor(u).addGlobalEventListener(o,u,h)}getZone(){return this._zone}_findPluginFor(o){const u=this._eventNameToPlugin.get(o);if(u)return u;const h=this._plugins;for(let w=0;w{class a{constructor(){this._stylesSet=new Set}addStyles(o){const u=new Set;o.forEach(h=>{this._stylesSet.has(h)||(this._stylesSet.add(h),u.add(h))}),this.onStylesAdded(u)}onStylesAdded(o){}getAllStyles(){return Array.from(this._stylesSet)}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Nn=(()=>{class a extends Me{constructor(o){super(),this._doc=o,this._hostNodes=new Map,this._hostNodes.set(o.head,[])}_addStylesToHost(o,u,h){o.forEach(w=>{const T=this._doc.createElement("style");T.textContent=w,h.push(u.appendChild(T))})}addHost(o){const u=[];this._addStylesToHost(this._stylesSet,o,u),this._hostNodes.set(o,u)}removeHost(o){const u=this._hostNodes.get(o);u&&u.forEach(Zr),this._hostNodes.delete(o)}onStylesAdded(o){this._hostNodes.forEach((u,h)=>{this._addStylesToHost(o,h,u)})}ngOnDestroy(){this._hostNodes.forEach(o=>o.forEach(Zr))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();function Zr(a){(0,x.q)().remove(a)}const ao={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},G=/%COMP%/g;function ht(a,i,o){for(let u=0;u{if("__ngUnwrap__"===i)return a;!1===a(i)&&(i.preventDefault(),i.returnValue=!1)}}let Ue=(()=>{class a{constructor(o,u,h){this.eventManager=o,this.sharedStylesHost=u,this.appId=h,this.rendererByCompId=new Map,this.defaultRenderer=new kt(o)}createRenderer(o,u){if(!o||!u)return this.defaultRenderer;switch(u.encapsulation){case m.ifc.Emulated:{let h=this.rendererByCompId.get(u.id);return h||(h=new bn(this.eventManager,this.sharedStylesHost,u,this.appId),this.rendererByCompId.set(u.id,h)),h.applyToHost(o),h}case 1:case m.ifc.ShadowDom:return new wn(this.eventManager,this.sharedStylesHost,o,u);default:if(!this.rendererByCompId.has(u.id)){const h=ht(u.id,u.styles,[]);this.sharedStylesHost.addStyles(h),this.rendererByCompId.set(u.id,this.defaultRenderer)}return this.defaultRenderer}}begin(){}end(){}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(Ke),m.LFG(Nn),m.LFG(m.AFp))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();class kt{constructor(i){this.eventManager=i,this.data=Object.create(null)}destroy(){}createElement(i,o){return o?document.createElementNS(ao[o]||o,i):document.createElement(i)}createComment(i){return document.createComment(i)}createText(i){return document.createTextNode(i)}appendChild(i,o){i.appendChild(o)}insertBefore(i,o,u){i&&i.insertBefore(o,u)}removeChild(i,o){i&&i.removeChild(o)}selectRootElement(i,o){let u="string"==typeof i?document.querySelector(i):i;if(!u)throw new Error(`The selector "${i}" did not match any elements`);return o||(u.textContent=""),u}parentNode(i){return i.parentNode}nextSibling(i){return i.nextSibling}setAttribute(i,o,u,h){if(h){o=h+":"+o;const w=ao[h];w?i.setAttributeNS(w,o,u):i.setAttribute(o,u)}else i.setAttribute(o,u)}removeAttribute(i,o,u){if(u){const h=ao[u];h?i.removeAttributeNS(h,o):i.removeAttribute(`${u}:${o}`)}else i.removeAttribute(o)}addClass(i,o){i.classList.add(o)}removeClass(i,o){i.classList.remove(o)}setStyle(i,o,u,h){h&(m.JOm.DashCase|m.JOm.Important)?i.style.setProperty(o,u,h&m.JOm.Important?"important":""):i.style[o]=u}removeStyle(i,o,u){u&m.JOm.DashCase?i.style.removeProperty(o):i.style[o]=""}setProperty(i,o,u){i[o]=u}setValue(i,o){i.nodeValue=o}listen(i,o,u){return"string"==typeof i?this.eventManager.addGlobalEventListener(i,o,qe(u)):this.eventManager.addEventListener(i,o,qe(u))}}class bn extends kt{constructor(i,o,u,h){super(i),this.component=u;const w=ht(h+"-"+u.id,u.styles,[]);o.addStyles(w),this.contentAttr="_ngcontent-%COMP%".replace(G,h+"-"+u.id),this.hostAttr=function(a){return"_nghost-%COMP%".replace(G,a)}(h+"-"+u.id)}applyToHost(i){super.setAttribute(i,this.hostAttr,"")}createElement(i,o){const u=super.createElement(i,o);return super.setAttribute(u,this.contentAttr,""),u}}class wn extends kt{constructor(i,o,u,h){super(i),this.sharedStylesHost=o,this.hostEl=u,this.shadowRoot=u.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const w=ht(h.id,h.styles,[]);for(let T=0;T{class a extends pt{constructor(o){super(o)}supports(o){return!0}addEventListener(o,u,h){return o.addEventListener(u,h,!1),()=>this.removeEventListener(o,u,h)}removeEventListener(o,u,h){return o.removeEventListener(u,h)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Lt=["alt","control","meta","shift"],ze={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},tt={A:"1",B:"2",C:"3",D:"4",E:"5",F:"6",G:"7",H:"8",I:"9",J:"*",K:"+",M:"-",N:".",O:"/","`":"0","\x90":"NumLock"},Cl={alt:a=>a.altKey,control:a=>a.ctrlKey,meta:a=>a.metaKey,shift:a=>a.shiftKey};let ct=(()=>{class a extends pt{constructor(o){super(o)}supports(o){return null!=a.parseEventName(o)}addEventListener(o,u,h){const w=a.parseEventName(u),T=a.eventCallback(w.fullKey,h,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>(0,x.q)().onAndCancel(o,w.domEventName,T))}static parseEventName(o){const u=o.toLowerCase().split("."),h=u.shift();if(0===u.length||"keydown"!==h&&"keyup"!==h)return null;const w=a._normalizeKey(u.pop());let T="";if(Lt.forEach(F=>{const j=u.indexOf(F);j>-1&&(u.splice(j,1),T+=F+".")}),T+=w,0!=u.length||0===w.length)return null;const P={};return P.domEventName=h,P.fullKey=T,P}static getEventFullKey(o){let u="",h=function(a){let i=a.key;if(null==i){if(i=a.keyIdentifier,null==i)return"Unidentified";i.startsWith("U+")&&(i=String.fromCharCode(parseInt(i.substring(2),16)),3===a.location&&tt.hasOwnProperty(i)&&(i=tt[i]))}return ze[i]||i}(o);return h=h.toLowerCase()," "===h?h="space":"."===h&&(h="dot"),Lt.forEach(w=>{w!=h&&Cl[w](o)&&(u+=w+".")}),u+=h,u}static eventCallback(o,u,h){return w=>{a.getEventFullKey(w)===o&&h.runGuarded(()=>u(w))}}static _normalizeKey(o){return"esc"===o?"escape":o}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Go=(0,m.eFA)(m._c5,"browser",[{provide:m.Lbi,useValue:x.bD},{provide:m.g9A,useValue:function(){Q.makeCurrent(),_e.init()},multi:!0},{provide:x.K0,useFactory:function(){return(0,m.RDi)(document),document},deps:[]}]),Es=[[],{provide:m.zSh,useValue:"root"},{provide:m.qLn,useFactory:function(){return new m.qLn},deps:[]},{provide:Qe,useClass:fn,multi:!0,deps:[x.K0,m.R0b,m.Lbi]},{provide:Qe,useClass:ct,multi:!0,deps:[x.K0]},[],{provide:Ue,useClass:Ue,deps:[Ke,Nn,m.AFp]},{provide:m.FYo,useExisting:Ue},{provide:Me,useExisting:Nn},{provide:Nn,useClass:Nn,deps:[x.K0]},{provide:m.dDg,useClass:m.dDg,deps:[m.R0b]},{provide:Ke,useClass:Ke,deps:[Qe,m.R0b]},{provide:x.JF,useClass:xe,deps:[]},[]];let lr=(()=>{class a{constructor(o){if(o)throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.")}static withServerTransition(o){return{ngModule:a,providers:[{provide:m.AFp,useValue:o.appId},{provide:pe,useExisting:m.AFp},Y]}}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(a,12))},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:Es,imports:[x.ez,m.hGG]}),a})();function en(a,i,o,u,h,w,T){try{var P=a[w](T),F=P.value}catch(j){return void o(j)}P.done?i(F):Promise.resolve(F).then(u,h)}function H(a){return function(){var i=this,o=arguments;return new Promise(function(u,h){var w=a.apply(i,o);function T(F){en(w,u,h,T,P,"next",F)}function P(F){en(w,u,h,T,P,"throw",F)}T(void 0)})}}function zt(a){this.message=a}"undefined"!=typeof window&&window,(zt.prototype=new Error).name="InvalidCharacterError";var Kn="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(a){var i=String(a).replace(/=+$/,"");if(i.length%4==1)throw new zt("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,u,h=0,w=0,T="";u=i.charAt(w++);~u&&(o=h%4?64*o+u:u,h++%4)?T+=String.fromCharCode(255&o>>(-2*h&6)):0)u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(u);return T};function wr(a){this.message=a}(wr.prototype=new Error).name="InvalidTokenError";const Ze=function(a,i){if("string"!=typeof a)throw new wr("Invalid token specified");var o=!0===(i=i||{}).header?0:1;try{return JSON.parse(function(a){var i=a.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(Kn(i).replace(/(.)/g,function(u,h){var w=h.charCodeAt(0).toString(16).toUpperCase();return w.length<2&&(w="0"+w),"%"+w}))}catch(o){return Kn(i)}}(a.split(".")[o]))}catch(u){throw new wr("Invalid token specified: "+u.message)}};let Ot=(()=>{class a{}return a.isCordova=()=>!!(window.cordova||window.phonegap||window.PhoneGap),a.isCapacitor=()=>{var i;return!!(null===(i=window.Capacitor)||void 0===i?void 0:i.isNativePlatform())},a.isNativeMobile=()=>a.isCapacitor()||a.isCordova(),a.decodeJwt=i=>{try{return i&&Ze(i)}catch(o){return console.warn("[@badisi/auth-js] Access token was not decoded as it is not a valid JWT."),i}},a.isUrlMatching=(i,o)=>{if(void 0!==o){const u=new URL(i,"http://test"),h=new URL(o,"http://test");if(""!==h.pathname&&"/"!==h.pathname&&!u.pathname.includes(h.pathname)||"http://test"!==h.origin&&(u.protocol!==h.protocol||u.origin!==h.origin||!`${u.origin}${u.pathname}}`.includes(`${h.origin}${h.pathname}`)))return!1;let w=!0;return h.searchParams.forEach((T,P)=>{u.searchParams.getAll(P).includes(T)||(w=!1)}),w}return!1},a.getBaseUrl=()=>{var i;const o=document.baseURI||(null===(i=document.querySelector("base"))||void 0===i?void 0:i.href)||location.origin;return o.endsWith("/")?o:`${o}/`},a.stringToURL=i=>{try{return new URL(i)}catch(o){const u=i.startsWith("/")?i.substring(1,i.length):i;return new URL(`${a.getBaseUrl()}${u}`)}},a})();var Er=O(9359);const oi={now:()=>(oi.delegate||Date).now(),delegate:void 0};class An extends Er.x{constructor(i=1/0,o=1/0,u=oi){super(),this._bufferSize=i,this._windowTime=o,this._timestampProvider=u,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=o===1/0,this._bufferSize=Math.max(1,i),this._windowTime=Math.max(1,o)}next(i){const{isStopped:o,_buffer:u,_infiniteTimeWindow:h,_timestampProvider:w,_windowTime:T}=this;o||(u.push(i),!h&&u.push(w.now()+T)),this._trimBuffer(),super.next(i)}_subscribe(i){this._throwIfClosed(),this._trimBuffer();const o=this._innerSubscribe(i),{_infiniteTimeWindow:u,_buffer:h}=this,w=h.slice();for(let T=0;T{let h,w=!0;o.subscribe((0,Qn.x)(u,T=>{const P=i(T);(w||!a(h,P))&&(w=!1,h=P,u.next(T))}))})}function Tt(a,i){return a===i}var gn=O(7969);const cr=function(a,i){return a===i||a!=a&&i!=i},Zn=function(a,i){for(var o=a.length;o--;)if(cr(a[o][0],i))return o;return-1};var zo=Array.prototype.splice;function Dr(a){var i=-1,o=null==a?0:a.length;for(this.clear();++i-1},Dr.prototype.set=function(a,i){var o=this.__data__,u=Zn(o,a);return u<0?(++this.size,o.push([a,i])):o[u][1]=i,this};const Vi=Dr,Ui="object"==typeof global&&global&&global.Object===Object&&global;var As="object"==typeof self&&self&&self.Object===Object&&self;const ji=Ui||As||Function("return this")();var Sl=ji.Symbol,Bi=Object.prototype,Tl=Bi.hasOwnProperty,Is=Bi.toString,er=Sl?Sl.toStringTag:void 0;var va=Object.prototype.toString;var xs=Sl?Sl.toStringTag:void 0;const C=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":xs&&xs in Object(a)?function(a){var i=Tl.call(a,er),o=a[er];try{a[er]=void 0;var u=!0}catch(w){}var h=Is.call(a);return u&&(i?a[er]=o:delete a[er]),h}(a):function(a){return va.call(a)}(a)},b=function(a){var i=typeof a;return null!=a&&("object"==i||"function"==i)},$e=function(a){if(!b(a))return!1;var i=C(a);return"[object Function]"==i||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i};var a,Ft=ji["__core-js_shared__"],gt=(a=/[^.]+$/.exec(Ft&&Ft.keys&&Ft.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";var kn=Function.prototype.toString;var $r=/^\[object .+?Constructor\]$/,Sr=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Rs=function(a){return!(!b(a)||function(a){return!!gt&> in a}(a))&&($e(a)?Sr:$r).test(function(a){if(null!=a){try{return kn.call(a)}catch(i){}try{return a+""}catch(i){}}return""}(a))},vo=function(a,i){var o=function(a,i){return null==a?void 0:a[i]}(a,i);return Rs(o)?o:void 0},Hi=vo(ji,"Map"),Ko=vo(Object,"create");var Tr=Object.prototype.hasOwnProperty;var xl=Object.prototype.hasOwnProperty;function tr(a){var i=-1,o=null==a?0:a.length;for(this.clear();++i-1&&a%1==0&&a<=9007199254740991},nr=function(a){return null!=a&&ft(a.length)&&!$e(a)};var To="object"==typeof exports&&exports&&!exports.nodeType&&exports,es=To&&"object"==typeof module&&module&&!module.nodeType&&module,ts=es&&es.exports===To?ji.Buffer:void 0;const Ao=(ts?ts.isBuffer:void 0)||function(){return!1};var Ip=Function.prototype.toString,Mp=Object.prototype.hasOwnProperty,Zt=Ip.call(Object);var Yt={};Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object Boolean]"]=Yt["[object DataView]"]=Yt["[object Date]"]=Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object WeakMap]"]=!1;var rs="object"==typeof exports&&exports&&!exports.nodeType&&exports,ql=rs&&"object"==typeof module&&module&&!module.nodeType&&module,pc=ql&&ql.exports===rs&&Ui.process,Np=function(){try{return ql&&ql.require&&ql.require("util").types||pc&&pc.binding&&pc.binding("util")}catch(i){}}(),wf=Np&&Np.isTypedArray;const $s=wf?function(a){return function(i){return a(i)}}(wf):function(a){return _(a)&&ft(a.length)&&!!Yt[C(a)]},Gs=function(a,i){if(("constructor"!==i||"function"!=typeof a[i])&&"__proto__"!=i)return a[i]};var Fa=Object.prototype.hasOwnProperty;const Ws=function(a,i,o){var u=a[i];(!Fa.call(a,i)||!cr(u,o)||void 0===o&&!(i in a))&&yn(a,i,o)};var yc=/^(?:0|[1-9]\d*)$/;const is=function(a,i){var o=typeof a;return!!(i=null==i?9007199254740991:i)&&("number"==o||"symbol"!=o&&yc.test(a))&&a>-1&&a%1==0&&a0){if(++i>=800)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}(py);const Jp=Kp,Ql=function(a,i){return Jp(function(a,i,o){return i=Ys(void 0===i?a.length-1:i,0),function(){for(var u=arguments,h=-1,w=Ys(u.length-i,0),T=Array(w);++h1?o[h-1]:void 0,T=h>2?o[2]:void 0;for(w=a.length>3&&"function"==typeof w?(h--,w):void 0,T&&function(a,i,o){if(!b(o))return!1;var u=typeof i;return!!("number"==u?nr(o)&&is(i,o.length):"string"==u&&i in o)&&cr(o[i],a)}(o[0],o[1],T)&&(w=h<3?void 0:w,h=1),i=Object(i);++u{},info:()=>{},warn:()=>{},error:()=>{}},xn=(a=>(a[a.NONE=0]="NONE",a[a.ERROR=1]="ERROR",a[a.WARN=2]="WARN",a[a.INFO=3]="INFO",a[a.DEBUG=4]="DEBUG",a))(xn||{});(a=>{a.reset=function(){qr=3,mi=eg},a.setLevel=function(h){if(!(0<=h&&h<=4))throw new Error("Invalid log level");qr=h},a.setLogger=function(h){mi=h}})(xn||(xn={}));var et=class{constructor(a){this._name=a}debug(...a){qr>=4&&mi.debug(et._format(this._name,this._method),...a)}info(...a){qr>=3&&mi.info(et._format(this._name,this._method),...a)}warn(...a){qr>=2&&mi.warn(et._format(this._name,this._method),...a)}error(...a){qr>=1&&mi.error(et._format(this._name,this._method),...a)}throw(a){throw this.error(a),a}create(a){const i=Object.create(this);return i._method=a,i.debug("begin"),i}static createStatic(a,i){const o=new et(`${a}.${i}`);return o.debug("begin"),o}static _format(a,i){const o=`[${a}]`;return i?`${o} ${i}:`:o}static debug(a,...i){qr>=4&&mi.debug(et._format(a),...i)}static info(a,...i){qr>=3&&mi.info(et._format(a),...i)}static warn(a,...i){qr>=2&&mi.warn(et._format(a),...i)}static error(a,...i){qr>=1&&mi.error(et._format(a),...i)}};xn.reset();var Js,Ga,au,lu,uu,Ki,Rr=class{static _randomWord(){return Cc.lib.WordArray.random(1).words[0]}static generateUUIDv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^Rr._randomWord()&15>>+i/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return Rr.generateUUIDv4()+Rr.generateUUIDv4()+Rr.generateUUIDv4()}static generateCodeChallenge(a){try{const i=Xp(a);return Rf.stringify(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(i){throw et.error("CryptoUtils.generateCodeChallenge",i),i}}static generateBasicAuth(a,i){const o=Pf.parse([a,i].join(":"));return Rf.stringify(o)}},_i=class{constructor(a){this._name=a,this._logger=new et(`Event('${this._name}')`),this._callbacks=[]}addHandler(a){return this._callbacks.push(a),()=>this.removeHandler(a)}removeHandler(a){const i=this._callbacks.lastIndexOf(a);i>=0&&this._callbacks.splice(i,1)}raise(...a){this._logger.debug("raise:",...a);for(const i of this._callbacks)i(...a)}},bc=class{static decode(a){try{return Ze(a)}catch(i){throw et.error("JwtUtils.decode",i),i}}},wc=class{static center(i){var o,a=Lr(i,[]);return null==a.width&&(a.width=null!=(o=[800,720,600,480].find(w=>w<=window.outerWidth/1.618))?o:360),null!=a.left||(a.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-a.width)/2))),null!=a.height&&(null!=a.top||(a.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-a.height)/2)))),a}static serialize(a){return Object.entries(a).filter(([,i])=>null!=i).map(([i,o])=>`${i}=${"boolean"!=typeof o?o:o?"yes":"no"}`).join(",")}},Vn=class extends _i{constructor(){super(...arguments),this._logger=new et(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const a=this._expiration-Vn.getEpochTime();this._logger.debug("timer completes in",a),this._expiration<=Vn.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(a){const i=this._logger.create("init");a=Math.max(Math.floor(a),1);const o=Vn.getEpochTime()+a;if(this.expiration===o&&this._timerHandle)return void i.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),i.debug("using duration",a),this._expiration=o;const u=Math.min(a,5);this._timerHandle=setInterval(this._callback,1e3*u)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Zl=class{static readParams(a,i="query"){if(!a)throw new TypeError("Invalid URL");const u=new URL(a,"http://127.0.0.1")["fragment"===i?"hash":"search"];return new URLSearchParams(u.slice(1))}},Yi=class extends Error{constructor(a,i){var o,u,h;if(super(a.error_description||a.error||""),this.form=i,this.name="ErrorResponse",!a.error)throw et.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=a.error,this.error_description=null!=(o=a.error_description)?o:null,this.error_uri=null!=(u=a.error_uri)?u:null,this.state=a.userState,this.session_state=null!=(h=a.session_state)?h:null,this.url_state=a.url_state}},Va=class extends Error{constructor(a){super(a),this.name="ErrorTimeout"}},xo=class{constructor(){this._logger=new et("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(a){return this._logger.create(`getItem('${a}')`),this._data[a]}setItem(a,i){this._logger.create(`setItem('${a}')`),this._data[a]=i}removeItem(a){this._logger.create(`removeItem('${a}')`),delete this._data[a]}get length(){return Object.getOwnPropertyNames(this._data).length}key(a){return Object.getOwnPropertyNames(this._data)[a]}},Ua=class{constructor(a=[],i=null,o={}){this._jwtHandler=i,this._extraHeaders=o,this._logger=new et("JsonService"),this._contentTypes=[],this._contentTypes.push(...a,"application/json"),i&&this._contentTypes.push("application/jwt")}fetchWithTimeout(a,i={}){return H(function*(){const T=i,{timeoutInSeconds:o}=T,u=Lr(T,["timeoutInSeconds"]);if(!o)return yield fetch(a,u);const h=new AbortController,w=setTimeout(()=>h.abort(),1e3*o);try{return yield fetch(a,Tp(dn({},i),{signal:h.signal}))}catch(P){throw P instanceof DOMException&&"AbortError"===P.name?new Va("Network timed out"):P}finally{clearTimeout(w)}})()}getJson(a,{token:i,credentials:o}={}){var u=this;return H(function*(){const h=u._logger.create("getJson"),w={Accept:u._contentTypes.join(", ")};let T;i&&(h.debug("token passed, setting Authorization header"),w.Authorization="Bearer "+i),u.appendExtraHeaders(w);try{h.debug("url:",a),T=yield u.fetchWithTimeout(a,{method:"GET",headers:w,credentials:o})}catch(j){throw h.error("Network Error"),j}h.debug("HTTP response received, status",T.status);const P=T.headers.get("Content-Type");if(P&&!u._contentTypes.find(j=>P.startsWith(j))&&h.throw(new Error(`Invalid response Content-Type: ${null!=P?P:"undefined"}, from URL: ${a}`)),T.ok&&u._jwtHandler&&(null==P?void 0:P.startsWith("application/jwt")))return yield u._jwtHandler(yield T.text());let F;try{F=yield T.json()}catch(j){throw h.error("Error parsing JSON response",j),T.ok?j:new Error(`${T.statusText} (${T.status})`)}if(!T.ok)throw h.error("Error from server:",F),F.error?new Yi(F):new Error(`${T.statusText} (${T.status}): ${JSON.stringify(F)}`);return F})()}postForm(a,{body:i,basicAuth:o,timeoutInSeconds:u,initCredentials:h}){var w=this;return H(function*(){const T=w._logger.create("postForm"),P={Accept:w._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let F;void 0!==o&&(P.Authorization="Basic "+o),w.appendExtraHeaders(P);try{T.debug("url:",a),F=yield w.fetchWithTimeout(a,{method:"POST",headers:P,body:i,timeoutInSeconds:u,credentials:h})}catch(Re){throw T.error("Network error"),Re}T.debug("HTTP response received, status",F.status);const j=F.headers.get("Content-Type");if(j&&!w._contentTypes.find(Re=>j.startsWith(Re)))throw new Error(`Invalid response Content-Type: ${null!=j?j:"undefined"}, from URL: ${a}`);const J=yield F.text();let Ee={};if(J)try{Ee=JSON.parse(J)}catch(Re){throw T.error("Error parsing JSON response",Re),F.ok?Re:new Error(`${F.statusText} (${F.status})`)}if(!F.ok)throw T.error("Error from server:",Ee),Ee.error?new Yi(Ee,i):new Error(`${F.statusText} (${F.status}): ${JSON.stringify(Ee)}`);return Ee})()}appendExtraHeaders(a){const i=this._logger.create("appendExtraHeaders"),o=Object.keys(this._extraHeaders),u=["authorization","accept","content-type"];0!==o.length&&o.forEach(h=>{if(u.includes(h.toLocaleLowerCase()))return void i.warn("Protected header could not be overridden",h,u);const w="function"==typeof this._extraHeaders[h]?this._extraHeaders[h]():this._extraHeaders[h];w&&""!==w&&(a[h]=w)})}},Ec=class{constructor({prefix:a="oidc.",store:i=localStorage}={}){this._logger=new et("WebStorageStateStore"),this._store=i,this._prefix=a}set(a,i){var o=this;return H(function*(){o._logger.create(`set('${a}')`),a=o._prefix+a,yield o._store.setItem(a,i)})()}get(a){var i=this;return H(function*(){return i._logger.create(`get('${a}')`),a=i._prefix+a,yield i._store.getItem(a)})()}remove(a){var i=this;return H(function*(){i._logger.create(`remove('${a}')`),a=i._prefix+a;const o=yield i._store.getItem(a);return yield i._store.removeItem(a),o})()}getAllKeys(){var a=this;return H(function*(){a._logger.create("getAllKeys");const i=yield a._store.length,o=[];for(let u=0;uj.append(Fe,It)):null!=ke&&j.set(Fe,ke);let J;switch(P._settings.client_authentication){case"client_secret_basic":if(!o)throw F.throw(new Error("A client_secret is required")),null;J=Rr.generateBasicAuth(i,o);break;case"client_secret_post":j.append("client_id",i),o&&j.append("client_secret",o)}const Ee=yield P._metadataService.getTokenEndpoint(!1);F.debug("got token endpoint");const Re=yield P._jsonService.postForm(Ee,{body:j,basicAuth:J,timeoutInSeconds:u,initCredentials:P._settings.fetchRequestCredentials});return F.debug("got response"),Re})()}revoke(a){var i=this;return H(function*(){var o;const u=i._logger.create("revoke");a.token||u.throw(new Error("A token is required"));const h=yield i._metadataService.getRevocationEndpoint(!1);u.debug(`got revocation endpoint, revoking ${null!=(o=a.token_type_hint)?o:"default token type"}`);const w=new URLSearchParams;for(const[T,P]of Object.entries(a))null!=P&&w.set(T,P);w.set("client_id",i._settings.client_id),i._settings.client_secret&&w.set("client_secret",i._settings.client_secret),yield i._jsonService.postForm(h,{body:w}),u.debug("got response")})()}},Ro=class{constructor(a){this.id=a.id||Rr.generateUUIDv4(),this.data=a.data,this.created=a.created&&a.created>0?a.created:Vn.getEpochTime(),this.request_type=a.request_type,this.url_state=a.url_state}toStorageString(){return new et("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(a){return et.createStatic("State","fromStorageString"),new Ro(JSON.parse(a))}static clearStaleState(a,i){return H(function*(){const o=et.createStatic("State","clearStaleState"),u=Vn.getEpochTime()-i,h=yield a.getAllKeys();o.debug("got keys",h);for(let w=0;w1&&(this.url_state=i.slice(1).join(";"))}this.error=a.get("error"),this.error_description=a.get("error_description"),this.error_uri=a.get("error_uri"),this.code=a.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Vn.getEpochTime()}set expires_in(a){"string"==typeof a&&(a=Number(a)),void 0!==a&&a>=0&&(this.expires_at=Math.floor(a)+Vn.getEpochTime())}get isOpenId(){var a;return(null==(a=this.scope)?void 0:a.split(" ").includes("openid"))||!!this.id_token}},Uf=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],lg=["sub","iss","aud","exp","iat"],ja=class{constructor(a){var i;this.id_token=a.id_token,this.session_state=null!=(i=a.session_state)?i:null,this.access_token=a.access_token,this.refresh_token=a.refresh_token,this.token_type=a.token_type,this.scope=a.scope,this.profile=a.profile,this.expires_at=a.expires_at,this.state=a.userState,this.url_state=a.url_state}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Vn.getEpochTime()}set expires_in(a){void 0!==a&&(this.expires_at=Math.floor(a)+Vn.getEpochTime())}get expired(){const a=this.expires_in;if(void 0!==a)return a<=0}get scopes(){var a,i;return null!=(i=null==(a=this.scope)?void 0:a.split(" "))?i:[]}toStorageString(){return new et("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(a){return et.createStatic("User","fromStorageString"),new ja(JSON.parse(a))}},Ac="oidc-client",ru=class{constructor(){this._abort=new _i("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}navigate(a){var i=this;return H(function*(){const o=i._logger.create("navigate");if(!i._window)throw new Error("Attempted to navigate on a disposed window");o.debug("setting URL in window"),i._window.location.replace(a.url);const{url:u,keepOpen:h}=yield new Promise((w,T)=>{const P=F=>{var j;const J=F.data,Ee=null!=(j=a.scriptOrigin)?j:window.location.origin;if(F.origin===Ee&&(null==J?void 0:J.source)===Ac){try{const Re=Zl.readParams(J.url,a.response_mode).get("state");if(Re||o.warn("no state found in response url"),F.source!==i._window&&Re!==a.state)return}catch(Re){i._dispose(),T(new Error("Invalid response from window"))}w(J)}};window.addEventListener("message",P,!1),i._disposeHandlers.add(()=>window.removeEventListener("message",P,!1)),i._disposeHandlers.add(i._abort.addHandler(F=>{i._dispose(),T(F)}))});return o.debug("got response from window"),i._dispose(),h||i.close(),{url:u}})()}_dispose(){this._logger.create("_dispose");for(const a of this._disposeHandlers)a();this._disposeHandlers.clear()}static _notifyParent(a,i,o=!1,u=window.location.origin){a.postMessage({source:Ac,url:i,keepOpen:o},u)}},Ic={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Ba="_blank",iu=60,Bf=2,ou=10,Mc=class extends Sc{constructor(a){const{popup_redirect_uri:i=a.redirect_uri,popup_post_logout_redirect_uri:o=a.post_logout_redirect_uri,popupWindowFeatures:u=Ic,popupWindowTarget:h=Ba,redirectMethod:w="assign",redirectTarget:T="self",iframeNotifyParentOrigin:P=a.iframeNotifyParentOrigin,iframeScriptOrigin:F=a.iframeScriptOrigin,silent_redirect_uri:j=a.redirect_uri,silentRequestTimeoutInSeconds:J=ou,automaticSilentRenew:Ee=!0,validateSubOnSilentRenew:Re=!0,includeIdTokenInSilentRenew:Fe=!1,monitorSession:ke=!1,monitorAnonymousSession:It=!1,checkSessionIntervalInSeconds:jt=Bf,query_status_response_type:Mt="code",stopCheckSessionOnError:jn=!0,revokeTokenTypes:Cn=["access_token","refresh_token"],revokeTokensOnSignout:xt=!1,includeIdTokenInSilentSignout:Qt=!1,accessTokenExpiringNotificationTimeInSeconds:Ai=iu,userStore:bt}=a;if(super(a),this.popup_redirect_uri=i,this.popup_post_logout_redirect_uri=o,this.popupWindowFeatures=u,this.popupWindowTarget=h,this.redirectMethod=w,this.redirectTarget=T,this.iframeNotifyParentOrigin=P,this.iframeScriptOrigin=F,this.silent_redirect_uri=j,this.silentRequestTimeoutInSeconds=J,this.automaticSilentRenew=Ee,this.validateSubOnSilentRenew=Re,this.includeIdTokenInSilentRenew=Fe,this.monitorSession=ke,this.monitorAnonymousSession=It,this.checkSessionIntervalInSeconds=jt,this.stopCheckSessionOnError=jn,this.query_status_response_type=Mt,this.revokeTokenTypes=Cn,this.revokeTokensOnSignout=xt,this.includeIdTokenInSilentSignout=Qt,this.accessTokenExpiringNotificationTimeInSeconds=Ai,bt)this.userStore=bt;else{const Bt="undefined"!=typeof window?window.sessionStorage:new xo;this.userStore=new Ec({store:Bt})}}},Ha=class extends ru{constructor({silentRequestTimeoutInSeconds:a=ou}){super(),this._logger=new et("IFrameWindow"),this._timeoutInSeconds=a,this._frame=Ha.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const a=window.document.createElement("iframe");return a.style.visibility="hidden",a.style.position="fixed",a.style.left="-1000px",a.style.top="0",a.width="0",a.height="0",window.document.body.appendChild(a),a}navigate(a){var i=()=>super.navigate,o=this;return H(function*(){o._logger.debug("navigate: Using timeout of:",o._timeoutInSeconds);const u=setTimeout(()=>o._abort.raise(new Va("IFrame timed out without a response")),1e3*o._timeoutInSeconds);return o._disposeHandlers.add(()=>clearTimeout(u)),yield i().call(o,a)})()}close(){var a;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",i=>{var o;const u=i.target;null==(o=u.parentNode)||o.removeChild(u),this._abort.raise(new Error("IFrame removed from DOM"))},!0),null==(a=this._frame.contentWindow)||a.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(a,i){return super._notifyParent(window.parent,a,!1,i)}},$f=class extends ru{constructor({popupWindowTarget:a=Ba,popupWindowFeatures:i={}}){super(),this._logger=new et("PopupWindow");const o=wc.center(dn(dn({},Ic),i));this._window=window.open(void 0,a,wc.serialize(o)),i.closePopupWindowAfterInSeconds&&i.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{this._window&&"boolean"==typeof this._window.closed&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))},1e3*i.closePopupWindowAfterInSeconds)}navigate(a){var i=()=>super.navigate,o=this;return H(function*(){var u;null==(u=o._window)||u.focus();const h=setInterval(()=>{(!o._window||o._window.closed)&&o._abort.raise(new Error("Popup closed by user"))},500);return o._disposeHandlers.add(()=>clearInterval(h)),yield i().call(o,a)})()}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(a,i){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,a,i)}};class ls{constructor(){this.subscribers=[]}add(i){return this.subscribers.push(i),this.lastNotifiedValue&&i(...this.lastNotifiedValue),{unsubscribe:()=>this.unsubscribe(i)}}notify(...i){this.lastNotifiedValue=i,this.subscribers.forEach(o=>{o(...i)})}unsubscribe(i){if(i){const o=this.subscribers.indexOf(i);-1!==o&&this.subscribers.splice(o,1)}else this.subscribers=[]}}const Qs=window.localStorage,pr=null===(Ga=null===(Js=window.Capacitor)||void 0===Js?void 0:Js.Plugins)||void 0===Ga?void 0:Ga.Storage,gr=null===(lu=null===(au=window.Capacitor)||void 0===au?void 0:au.Plugins)||void 0===lu?void 0:lu.Preferences,rr=null===(Ki=null===(uu=window.Capacitor)||void 0===uu?void 0:uu.Plugins)||void 0===Ki?void 0:Ki.SecureStoragePlugin;class fg{constructor(){if(this._logger=new et("MobileStorage"),!rr){let i="[@badisi/auth-js] This application is currently using an unsafe storage.\n\n";i+="\u24d8 Please follow the recommended guide and use `capacitor-secure-storage-plugin` instead.",console.warn(i)}this._logger.debug(rr?"Using `capacitor-secure-storage-plugin` implementation":gr?"Using `@capacitor/preferences` implementation":pr?"Using `@capacitor/storage` implementation":"Using `localStorage` implementation")}get length(){return H(function*(){return rr?(yield rr.keys()).value.length:gr?(yield gr.keys()).keys.length:pr?(yield pr.keys()).keys.length:Qs.length})()}key(i){return H(function*(){return rr?(yield rr.keys()).value[i]:gr?(yield gr.keys()).keys[i]:pr?(yield pr.keys()).keys[i]:Qs.key(i)})()}clear(){var i=this;return H(function*(){i._logger.create("clear"),rr?yield rr.clear():gr?yield gr.clear():pr?yield pr.clear():Qs.clear()})()}getItem(i){var o=this;return H(function*(){if(o._logger.create(`getItem('${i}')`),!rr)return gr?(yield gr.get({key:i})).value:pr?(yield pr.get({key:i})).value:Qs.getItem(i);try{return(yield rr.get({key:i})).value}catch(u){return null}})()}setItem(i,o){var u=this;return H(function*(){u._logger.create(`setItem('${i}')`),rr?yield rr.set({key:i,value:o}):gr?yield gr.set({key:i,value:o}):pr?yield pr.set({key:i,value:o}):Qs.setItem(i,o)})()}removeItem(i){var o=this;return H(function*(){o._logger.create(`removeItem('${i}')`),rr?yield rr.remove({key:i}):gr?yield gr.remove({key:i}):pr?yield pr.remove({key:i}):Qs.removeItem(i)})()}}var Xt=(()=>(function(a){a.REDIRECT="REDIRECT",a.POPUP="POPUP"}(Xt||(Xt={})),Xt))();class Po{constructor(){this.expired=void 0,this.expires_in=void 0,this.expires_at=void 0}static deserialize(i){const o=new Po,u=Object.keys(o);for(const h of u)o[h]=i[h];return o}}var Oc,Nc,Fc,kc,Pc=O(7582);const Wa=null===(Nc=null===(Oc=window.Capacitor)||void 0===Oc?void 0:Oc.Plugins)||void 0===Nc?void 0:Nc.App,Pr=null===(kc=null===(Fc=window.Capacitor)||void 0===Fc?void 0:Fc.Plugins)||void 0===kc?void 0:kc.Browser;class pg{constructor(i,o){if(this.redirectUrl=i,this.params=o,this._logger=new et("MobileWindow"),this.originalHandleOpenURL=window.handleOpenURL,!Ot.isCapacitor()&&!Ot.isCordova()){let u="[@badisi/auth-js] Required core dependency not found.\n\n";u+="\u24d8 Please follow the recommended guide and install either `Capacitor` or `Cordova` dependency.",console.error(u)}if(!Pr){let u="[@badisi/auth-js] Required plugin not found.\n\n";u+="\u24d8 Please follow the recommended guide and install either `@badisi/capacitor-browsertab` or `@capacitor/browser` plugin.",console.error(u)}Pr&&this._logger.debug("Using `@capacitor/browser` implementation")}navigate(i){var o=this;return H(function*(){return o.navigateLogger=o._logger.create("navigate"),o.navigateLogger.debug("url",i.url),new Promise((u,h)=>{o._resolve=u,o._reject=h,o.installCustomUrlSchemeHandler().then(()=>{Pr&&o.useCapacitorBrowser(i)})})})()}close(){var i=this;return H(function*(){const o=i._logger.create("close");yield null==Pr?void 0:Pr.close().catch(u=>o.error(u)),o.debug("success")})()}cleanup(){var i=this;return H(function*(){var o,u;const h=i._logger.create("cleanup");window.handleOpenURL=i.originalHandleOpenURL,yield null===(o=i.capacitorBrowserFinishedHandle)||void 0===o?void 0:o.remove(),yield null===(u=i.capacitorAppUrlOpenHandle)||void 0===u?void 0:u.remove(),clearTimeout(i.timer),h.debug("success")})()}onError(i){var o=this;return H(function*(){var u,h;null===(u=o.navigateLogger)||void 0===u||u.error("error response:",i),yield o.cleanup(),yield o.close(),null===(h=o._reject)||void 0===h||h.call(o,new Error(i))})()}onSuccess(i){var o=this;return H(function*(){var u,h;null===(u=o.navigateLogger)||void 0===u||u.debug("successful response:",i),yield o.cleanup(),yield o.close(),null===(h=o._resolve)||void 0===h||h.call(o,{url:i})})()}useCapacitorBrowser(i){var o=this;return H(function*(){o.capacitorBrowserFinishedHandle=yield null==Pr?void 0:Pr.addListener("browserFinished",()=>{o.onError("Capacitor browser closed by user")}),yield null==Pr?void 0:Pr.open({url:i.url,toolbarColor:o.params.mobileWindowToolbarColor,presentationStyle:o.params.mobileWindowPresentationStyle,width:o.params.mobileWindowWidth,height:o.params.mobileWindowWidth})})()}useBrowserTab(i){return H(function*(){})()}installCustomUrlSchemeHandler(){var i=this;return H(function*(){var o;const u=i._logger.create("installCustomUrlSchemeHandler");i.timer=setTimeout(()=>{i.onError("Installing custom url scheme handler, timed out without a response")},1e4),yield i.cleanup(),Ot.isCapacitor()?(u.debug("listening to Capacitor `appUrlOpen` event"),i.capacitorAppUrlOpenHandle=yield null===(o=null==Wa?void 0:Wa.addListener)||void 0===o?void 0:o.call(Wa,"appUrlOpen",({url:h})=>{Ot.isUrlMatching(h,i.redirectUrl)&&i.onSuccess(h)})):Ot.isCordova()&&(u.debug("waiting for Cordova `handleOpenURL` callback"),window.handleOpenURL=h=>{var w;null===(w=i.originalHandleOpenURL)||void 0===w||w.call(i,h),Ot.isUrlMatching(h,i.redirectUrl)&&i.onSuccess(h)}),u.debug("success")})()}}class gg{constructor(){this._logger=new et("MobileNavigator")}prepare(i,o){return this._logger.create("prepare"),new pg(i,o)}}class Cy extends class{constructor(a,i,o,u){this._logger=new et("UserManager"),this.settings=new Mc(a),this._client=new class{constructor(a,i){this._logger=new et("OidcClient"),this.settings=a instanceof Sc?a:new Sc(a),this.metadataService=null!=i?i:new class{constructor(a){this._settings=a,this._logger=new et("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Ua(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}getMetadata(){var a=this;return H(function*(){const i=a._logger.create("getMetadata");if(a._metadata)return i.debug("using cached values"),a._metadata;if(!a._metadataUrl)throw i.throw(new Error("No authority or metadataUrl configured on settings")),null;i.debug("getting metadata from",a._metadataUrl);const o=yield a._jsonService.getJson(a._metadataUrl,{credentials:a._fetchRequestCredentials});return i.debug("merging remote JSON with seed metadata"),a._metadata=Object.assign({},a._settings.metadataSeed,o),a._metadata})()}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(a=!0){return this._getMetadataProperty("token_endpoint",a)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(a=!0){return this._getMetadataProperty("revocation_endpoint",a)}getKeysEndpoint(a=!0){return this._getMetadataProperty("jwks_uri",a)}_getMetadataProperty(a,i=!1){var o=this;return H(function*(){const u=o._logger.create(`_getMetadataProperty('${a}')`),h=yield o.getMetadata();if(u.debug("resolved"),void 0===h[a]){if(!0===i)return void u.warn("Metadata does not contain optional property");u.throw(new Error("Metadata does not contain property "+a))}return h[a]})()}getSigningKeys(){var a=this;return H(function*(){const i=a._logger.create("getSigningKeys");if(a._signingKeys)return i.debug("returning signingKeys from cache"),a._signingKeys;const o=yield a.getKeysEndpoint(!1);i.debug("got jwks_uri",o);const u=yield a._jsonService.getJson(o);if(i.debug("got key set",u),!Array.isArray(u.keys))throw i.throw(new Error("Missing keys on keyset")),null;return a._signingKeys=u.keys,a._signingKeys})()}}(this.settings),this._claimsService=new class{constructor(a){this._settings=a,this._logger=new et("ClaimsService")}filterProtocolClaims(a){const i=dn({},a);if(this._settings.filterProtocolClaims){let o;o=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:Uf;for(const u of o)lg.includes(u)||delete i[u]}return i}mergeClaims(a,i){const o=dn({},a);for(const[u,h]of Object.entries(i))for(const w of Array.isArray(h)?h:[h]){const T=o[u];void 0===T?o[u]=w:Array.isArray(T)?T.includes(w)||T.push(w):o[u]!==w&&(o[u]="object"==typeof w&&this._settings.mergeClaims?this.mergeClaims(T,w):[T,w])}return o}}(this.settings),this._validator=new class{constructor(a,i,o){this._settings=a,this._metadataService=i,this._claimsService=o,this._logger=new et("ResponseValidator"),this._userInfoService=new class{constructor(a,i){var o=this;this._settings=a,this._metadataService=i,this._logger=new et("UserInfoService"),this._getClaimsFromJwt=function(){var u=H(function*(h){const w=o._logger.create("_getClaimsFromJwt");try{const T=bc.decode(h);return w.debug("JWT decoding successful"),T}catch(T){throw w.error("Error parsing JWT response"),T}});return function(h){return u.apply(this,arguments)}}(),this._jsonService=new Ua(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}getClaims(a){var i=this;return H(function*(){const o=i._logger.create("getClaims");a||i._logger.throw(new Error("No token passed"));const u=yield i._metadataService.getUserInfoEndpoint();o.debug("got userinfo url",u);const h=yield i._jsonService.getJson(u,{token:a,credentials:i._settings.fetchRequestCredentials});return o.debug("got claims",h),h})()}}(this._settings,this._metadataService),this._tokenClient=new eu(this._settings,this._metadataService)}validateSigninResponse(a,i){var o=this;return H(function*(){const u=o._logger.create("validateSigninResponse");o._processSigninState(a,i),u.debug("state processed"),yield o._processCode(a,i),u.debug("code processed"),a.isOpenId&&o._validateIdTokenAttributes(a),u.debug("tokens validated"),yield o._processClaims(a,null==i?void 0:i.skipUserInfo,a.isOpenId),u.debug("claims processed")})()}validateCredentialsResponse(a,i){var o=this;return H(function*(){const u=o._logger.create("validateCredentialsResponse");a.isOpenId&&!!a.id_token&&o._validateIdTokenAttributes(a),u.debug("tokens validated"),yield o._processClaims(a,i,a.isOpenId),u.debug("claims processed")})()}validateRefreshResponse(a,i){var o=this;return H(function*(){const w=o._logger.create("validateRefreshResponse");a.userState=i.data,null!=a.session_state||(a.session_state=i.session_state),null!=a.scope||(a.scope=i.scope),a.isOpenId&&!!a.id_token&&(o._validateIdTokenAttributes(a,i.id_token),w.debug("ID Token validated")),a.id_token||(a.id_token=i.id_token,a.profile=i.profile);const T=a.isOpenId&&!!a.id_token;yield o._processClaims(a,!1,T),w.debug("claims processed")})()}validateSignoutResponse(a,i){const o=this._logger.create("validateSignoutResponse");if(i.id!==a.state&&o.throw(new Error("State does not match")),o.debug("state validated"),a.userState=i.data,a.error)throw o.warn("Response was error",a.error),new Yi(a)}_processSigninState(a,i){const u=this._logger.create("_processSigninState");if(i.id!==a.state&&u.throw(new Error("State does not match")),i.client_id||u.throw(new Error("No client_id on state")),i.authority||u.throw(new Error("No authority on state")),this._settings.authority!==i.authority&&u.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==i.client_id&&u.throw(new Error("client_id mismatch on settings vs. signin state")),u.debug("state validated"),a.userState=i.data,a.url_state=i.url_state,null!=a.scope||(a.scope=i.scope),a.error)throw u.warn("Response was error",a.error),new Yi(a);i.code_verifier&&!a.code&&u.throw(new Error("Expected code in response"))}_processClaims(a,i=!1,o=!0){var u=this;return H(function*(){const h=u._logger.create("_processClaims");if(a.profile=u._claimsService.filterProtocolClaims(a.profile),i||!u._settings.loadUserInfo||!a.access_token)return void h.debug("not loading user info");h.debug("loading user info");const w=yield u._userInfoService.getClaims(a.access_token);h.debug("user info claims received from user info endpoint"),o&&w.sub!==a.profile.sub&&h.throw(new Error("subject from UserInfo response does not match subject in ID Token")),a.profile=u._claimsService.mergeClaims(a.profile,u._claimsService.filterProtocolClaims(w)),h.debug("user info claims received, updated profile:",a.profile)})()}_processCode(a,i){var o=this;return H(function*(){const u=o._logger.create("_processCode");if(a.code){u.debug("Validating code");const h=yield o._tokenClient.exchangeCode(dn({client_id:i.client_id,client_secret:i.client_secret,code:a.code,redirect_uri:i.redirect_uri,code_verifier:i.code_verifier},i.extraTokenParams));Object.assign(a,h)}else u.debug("No code to process")})()}_validateIdTokenAttributes(a,i){var o;const u=this._logger.create("_validateIdTokenAttributes");u.debug("decoding ID Token JWT");const h=bc.decode(null!=(o=a.id_token)?o:"");if(h.sub||u.throw(new Error("ID Token is missing a subject claim")),i){const w=bc.decode(i);h.sub!==w.sub&&u.throw(new Error("sub in id_token does not match current sub")),h.auth_time&&h.auth_time!==w.auth_time&&u.throw(new Error("auth_time in id_token does not match original auth_time")),h.azp&&h.azp!==w.azp&&u.throw(new Error("azp in id_token does not match original azp")),!h.azp&&w.azp&&u.throw(new Error("azp not in id_token, but present in original id_token"))}a.profile=h}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new eu(this.settings,this.metadataService)}createSigninRequest({state:a,request:i,request_uri:o,request_type:u,id_token_hint:h,login_hint:w,skipUserInfo:T,nonce:P,url_state:F,response_type:j=this.settings.response_type,scope:J=this.settings.scope,redirect_uri:Ee=this.settings.redirect_uri,prompt:Re=this.settings.prompt,display:Fe=this.settings.display,max_age:ke=this.settings.max_age,ui_locales:It=this.settings.ui_locales,acr_values:jt=this.settings.acr_values,resource:Mt=this.settings.resource,response_mode:jn=this.settings.response_mode,extraQueryParams:Cn=this.settings.extraQueryParams,extraTokenParams:xt=this.settings.extraTokenParams}){var Qt=this;return H(function*(){const Ai=Qt._logger.create("createSigninRequest");if("code"!==j)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const bt=yield Qt.metadataService.getAuthorizationEndpoint();Ai.debug("Received authorization endpoint",bt);const Bt=new class{constructor(jn){var Cn=jn,{url:a,authority:i,client_id:o,redirect_uri:u,response_type:h,scope:w,state_data:T,response_mode:P,request_type:F,client_secret:j,nonce:J,url_state:Ee,resource:Re,skipUserInfo:Fe,extraQueryParams:ke,extraTokenParams:It,disablePKCE:jt}=Cn,Mt=Lr(Cn,["url","authority","client_id","redirect_uri","response_type","scope","state_data","response_mode","request_type","client_secret","nonce","url_state","resource","skipUserInfo","extraQueryParams","extraTokenParams","disablePKCE"]);if(this._logger=new et("SigninRequest"),!a)throw this._logger.error("ctor: No url passed"),new Error("url");if(!o)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!u)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!h)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!w)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!i)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new Tc({data:T,request_type:F,url_state:Ee,code_verifier:!jt,client_id:o,authority:i,redirect_uri:u,response_mode:P,client_secret:j,scope:w,extraTokenParams:It,skipUserInfo:Fe});const xt=new URL(a);xt.searchParams.append("client_id",o),xt.searchParams.append("redirect_uri",u),xt.searchParams.append("response_type",h),xt.searchParams.append("scope",w),J&&xt.searchParams.append("nonce",J);let Qt=this.state.id;Ee&&(Qt=`${Qt};${Ee}`),xt.searchParams.append("state",Qt),this.state.code_challenge&&(xt.searchParams.append("code_challenge",this.state.code_challenge),xt.searchParams.append("code_challenge_method","S256")),Re&&(Array.isArray(Re)?Re:[Re]).forEach(bt=>xt.searchParams.append("resource",bt));for(const[Ai,bt]of Object.entries(dn(dn({response_mode:P},Mt),ke)))null!=bt&&xt.searchParams.append(Ai,bt.toString());this.url=xt.href}}({url:bt,authority:Qt.settings.authority,client_id:Qt.settings.client_id,redirect_uri:Ee,response_type:j,scope:J,state_data:a,url_state:F,prompt:Re,display:Fe,max_age:ke,ui_locales:It,id_token_hint:h,login_hint:w,acr_values:jt,resource:Mt,request:i,request_uri:o,extraQueryParams:Cn,extraTokenParams:xt,request_type:u,response_mode:jn,client_secret:Qt.settings.client_secret,skipUserInfo:T,nonce:P,disablePKCE:Qt.settings.disablePKCE});yield Qt.clearStaleState();const kr=Bt.state;return yield Qt.settings.stateStore.set(kr.id,kr.toStorageString()),Bt})()}readSigninResponseState(a,i=!1){var o=this;return H(function*(){const u=o._logger.create("readSigninResponseState"),h=new tu(Zl.readParams(a,o.settings.response_mode));if(!h.state)throw u.throw(new Error("No state in response")),null;const w=yield o.settings.stateStore[i?"remove":"get"](h.state);if(!w)throw u.throw(new Error("No matching state found in storage")),null;return{state:Tc.fromStorageString(w),response:h}})()}processSigninResponse(a){var i=this;return H(function*(){const o=i._logger.create("processSigninResponse"),{state:u,response:h}=yield i.readSigninResponseState(a,!0);return o.debug("received state from storage; validating response"),yield i._validator.validateSigninResponse(h,u),h})()}processResourceOwnerPasswordCredentials({username:a,password:i,skipUserInfo:o=!1,extraTokenParams:u={}}){var h=this;return H(function*(){const w=yield h._tokenClient.exchangeCredentials(dn({username:a,password:i},u)),T=new tu(new URLSearchParams);return Object.assign(T,w),yield h._validator.validateCredentialsResponse(T,o),T})()}useRefreshToken({state:a,timeoutInSeconds:i}){var o=this;return H(function*(){var u;const h=o._logger.create("useRefreshToken");let w;if(void 0===o.settings.refreshTokenAllowedScope)w=a.scope;else{const F=o.settings.refreshTokenAllowedScope.split(" ");w=((null==(u=a.scope)?void 0:u.split(" "))||[]).filter(J=>F.includes(J)).join(" ")}const T=yield o._tokenClient.exchangeRefreshToken({refresh_token:a.refresh_token,resource:a.resource,scope:w,timeoutInSeconds:i}),P=new tu(new URLSearchParams);return Object.assign(P,T),h.debug("validating response",P),yield o._validator.validateRefreshResponse(P,Tp(dn({},a),{scope:w})),P})()}createSignoutRequest({state:a,id_token_hint:i,client_id:o,request_type:u,post_logout_redirect_uri:h=this.settings.post_logout_redirect_uri,extraQueryParams:w=this.settings.extraQueryParams}={}){var T=this;return H(function*(){const P=T._logger.create("createSignoutRequest"),F=yield T.metadataService.getEndSessionEndpoint();if(!F)throw P.throw(new Error("No end session endpoint")),null;P.debug("Received end session endpoint",F),!o&&h&&!i&&(o=T.settings.client_id);const j=new class{constructor({url:a,state_data:i,id_token_hint:o,post_logout_redirect_uri:u,extraQueryParams:h,request_type:w,client_id:T}){if(this._logger=new et("SignoutRequest"),!a)throw this._logger.error("ctor: No url passed"),new Error("url");const P=new URL(a);o&&P.searchParams.append("id_token_hint",o),T&&P.searchParams.append("client_id",T),u&&(P.searchParams.append("post_logout_redirect_uri",u),i&&(this.state=new Ro({data:i,request_type:w}),P.searchParams.append("state",this.state.id)));for(const[F,j]of Object.entries(dn({},h)))null!=j&&P.searchParams.append(F,j.toString());this.url=P.href}}({url:F,id_token_hint:i,client_id:o,post_logout_redirect_uri:h,state_data:a,extraQueryParams:w,request_type:u});yield T.clearStaleState();const J=j.state;return J&&(P.debug("Signout request has state to persist"),yield T.settings.stateStore.set(J.id,J.toStorageString())),j})()}readSignoutResponseState(a,i=!1){var o=this;return H(function*(){const u=o._logger.create("readSignoutResponseState"),h=new class{constructor(a){this.state=a.get("state"),this.error=a.get("error"),this.error_description=a.get("error_description"),this.error_uri=a.get("error_uri")}}(Zl.readParams(a,o.settings.response_mode));if(!h.state){if(u.debug("No state in response"),h.error)throw u.warn("Response was error:",h.error),new Yi(h);return{state:void 0,response:h}}const w=yield o.settings.stateStore[i?"remove":"get"](h.state);if(!w)throw u.throw(new Error("No matching state found in storage")),null;return{state:Ro.fromStorageString(w),response:h}})()}processSignoutResponse(a){var i=this;return H(function*(){const o=i._logger.create("processSignoutResponse"),{state:u,response:h}=yield i.readSignoutResponseState(a,!0);return u?(o.debug("Received state from storage; validating response"),i._validator.validateSignoutResponse(h,u)):o.debug("No state from storage; skipping response validation"),h})()}clearStaleState(){return this._logger.create("clearStaleState"),Ro.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}revokeToken(a,i){var o=this;return H(function*(){return o._logger.create("revokeToken"),yield o._tokenClient.revoke({token:a,token_type_hint:i})})()}}(a),this._redirectNavigator=null!=i?i:new class{constructor(a){this._settings=a,this._logger=new et("RedirectNavigator")}prepare({redirectMethod:a=this._settings.redirectMethod,redirectTarget:i=this._settings.redirectTarget}){var o=this;return H(function*(){var u;o._logger.create("prepare");let h=window.self;"top"===i&&(h=null!=(u=window.top)?u:window.self);const w=h.location[a].bind(h.location);let T;return{navigate:(P=H(function*(F){o._logger.create("navigate");const j=new Promise((J,Ee)=>{T=Ee});return w(F.url),yield j}),function(j){return P.apply(this,arguments)}),close:()=>{o._logger.create("close"),null==T||T(new Error("Redirect aborted")),h.stop()}};var P})()}callback(){return H(function*(){})()}}(this.settings),this._popupNavigator=null!=o?o:new class{constructor(a){this._settings=a,this._logger=new et("PopupNavigator")}prepare({popupWindowFeatures:a=this._settings.popupWindowFeatures,popupWindowTarget:i=this._settings.popupWindowTarget}){return H(function*(){return new $f({popupWindowFeatures:a,popupWindowTarget:i})})()}callback(a,{keepOpen:i=!1}){var o=this;return H(function*(){o._logger.create("callback"),$f.notifyOpener(a,i)})()}}(this.settings),this._iframeNavigator=null!=u?u:new class{constructor(a){this._settings=a,this._logger=new et("IFrameNavigator")}prepare({silentRequestTimeoutInSeconds:a=this._settings.silentRequestTimeoutInSeconds}){return H(function*(){return new Ha({silentRequestTimeoutInSeconds:a})})()}callback(a){var i=this;return H(function*(){i._logger.create("callback"),Ha.notifyParent(a,i._settings.iframeNotifyParentOrigin)})()}}(this.settings),this._events=new class extends class{constructor(a){this._logger=new et("AccessTokenEvents"),this._expiringTimer=new Vn("Access token expiring"),this._expiredTimer=new Vn("Access token expired"),this._expiringNotificationTimeInSeconds=a.expiringNotificationTimeInSeconds}load(a){const i=this._logger.create("load");if(a.access_token&&void 0!==a.expires_in){const o=a.expires_in;if(i.debug("access token present, remaining duration:",o),o>0){let h=o-this._expiringNotificationTimeInSeconds;h<=0&&(h=1),i.debug("registering expiring timer, raising in",h,"seconds"),this._expiringTimer.init(h)}else i.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const u=o+1;i.debug("registering expired timer, raising in",u,"seconds"),this._expiredTimer.init(u)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(a){return this._expiringTimer.addHandler(a)}removeAccessTokenExpiring(a){this._expiringTimer.removeHandler(a)}addAccessTokenExpired(a){return this._expiredTimer.addHandler(a)}removeAccessTokenExpired(a){this._expiredTimer.removeHandler(a)}}{constructor(a){super({expiringNotificationTimeInSeconds:a.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new et("UserManagerEvents"),this._userLoaded=new _i("User loaded"),this._userUnloaded=new _i("User unloaded"),this._silentRenewError=new _i("Silent renew error"),this._userSignedIn=new _i("User signed in"),this._userSignedOut=new _i("User signed out"),this._userSessionChanged=new _i("User session changed")}load(a,i=!0){super.load(a),i&&this._userLoaded.raise(a)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(a){return this._userLoaded.addHandler(a)}removeUserLoaded(a){return this._userLoaded.removeHandler(a)}addUserUnloaded(a){return this._userUnloaded.addHandler(a)}removeUserUnloaded(a){return this._userUnloaded.removeHandler(a)}addSilentRenewError(a){return this._silentRenewError.addHandler(a)}removeSilentRenewError(a){return this._silentRenewError.removeHandler(a)}_raiseSilentRenewError(a){this._silentRenewError.raise(a)}addUserSignedIn(a){return this._userSignedIn.addHandler(a)}removeUserSignedIn(a){this._userSignedIn.removeHandler(a)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(a){return this._userSignedOut.addHandler(a)}removeUserSignedOut(a){this._userSignedOut.removeHandler(a)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(a){return this._userSessionChanged.addHandler(a)}removeUserSessionChanged(a){this._userSessionChanged.removeHandler(a)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}}(this.settings),this._silentRenewService=new class{constructor(a){var i=this;this._userManager=a,this._logger=new et("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Vn("Retry Silent Renew"),this._tokenExpiring=H(function*(){const o=i._logger.create("_tokenExpiring");try{yield i._userManager.signinSilent(),o.debug("silent token renewal successful")}catch(u){if(u instanceof Va)return o.warn("ErrorTimeout from signinSilent:",u,"retry in 5s"),void i._retryTimer.init(5);o.error("Error from signinSilent:",u),i._userManager.events._raiseSilentRenewError(u)}})}start(){var a=this;return H(function*(){const i=a._logger.create("start");if(!a._isStarted){a._isStarted=!0,a._userManager.events.addAccessTokenExpiring(a._tokenExpiring),a._retryTimer.addHandler(a._tokenExpiring);try{yield a._userManager.getUser()}catch(o){i.error("getUser error",o)}}})()}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(a){var i=this;this._userManager=a,this._logger=new et("SessionMonitor"),this._start=function(){var o=H(function*(u){const h=u.session_state;if(!h)return;const w=i._logger.create("_start");if(u.profile?(i._sub=u.profile.sub,i._sid=u.profile.sid,w.debug("session_state",h,", sub",i._sub)):(i._sub=void 0,i._sid=void 0,w.debug("session_state",h,", anonymous user")),i._checkSessionIFrame)i._checkSessionIFrame.start(h);else try{const T=yield i._userManager.metadataService.getCheckSessionIframe();if(T){w.debug("initializing check session iframe");const P=i._userManager.settings.client_id,F=i._userManager.settings.checkSessionIntervalInSeconds,j=i._userManager.settings.stopCheckSessionOnError,J=new class{constructor(a,i,o,u,h){this._callback=a,this._client_id=i,this._intervalInSeconds=u,this._stopOnError=h,this._logger=new et("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=T=>{T.origin===this._frame_origin&&T.source===this._frame.contentWindow&&("error"===T.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===T.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(T.data+" message from check session op iframe"))};const w=new URL(o);this._frame_origin=w.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=w.href}load(){return new Promise(a=>{this._frame.onload=()=>{a()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(a){if(this._session_state===a)return;this._logger.create("start"),this.stop(),this._session_state=a;const i=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};i(),this._timer=setInterval(i,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(i._callback,P,T,F,j);yield J.load(),i._checkSessionIFrame=J,J.start(h)}else w.warn("no check session iframe found in the metadata")}catch(T){w.error("Error from getCheckSessionIframe:",T instanceof Error?T.message:T)}});return function(u){return o.apply(this,arguments)}}(),this._stop=()=>{const o=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const u=setInterval(H(function*(){clearInterval(u);try{const h=yield i._userManager.querySessionStatus();h&&i._start({session_state:h.session_state,profile:h.sub&&h.sid?{sub:h.sub,sid:h.sid}:null})}catch(h){o.error("error from querySessionStatus",h instanceof Error?h.message:h)}}),1e3)}},this._callback=H(function*(){const o=i._logger.create("_callback");try{const u=yield i._userManager.querySessionStatus();let h=!0;u&&i._checkSessionIFrame?u.sub===i._sub?(h=!1,i._checkSessionIFrame.start(u.session_state),u.sid===i._sid?o.debug("same sub still logged in at OP, restarting check session iframe; session_state",u.session_state):(o.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",u.session_state),i._userManager.events._raiseUserSessionChanged())):o.debug("different subject signed into OP",u.sub):o.debug("subject no longer signed into OP"),h?i._sub?i._userManager.events._raiseUserSignedOut():i._userManager.events._raiseUserSignedIn():o.debug("no change in session detected, no event to raise")}catch(u){i._sub&&(o.debug("Error calling queryCurrentSigninSession; raising signed out event",u),i._userManager.events._raiseUserSignedOut())}}),a||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(o=>{this._logger.error(o)})}_init(){var a=this;return H(function*(){a._logger.create("_init");const i=yield a._userManager.getUser();if(i)a._start(i);else if(a._userManager.settings.monitorAnonymousSession){const o=yield a._userManager.querySessionStatus();o&&a._start({session_state:o.session_state,profile:o.sub&&o.sid?{sub:o.sub,sid:o.sid}:null})}})()}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}getUser(){var a=this;return H(function*(){const i=a._logger.create("getUser"),o=yield a._loadUser();return o?(i.info("user loaded"),a._events.load(o,!1),o):(i.info("user not found in storage"),null)})()}removeUser(){var a=this;return H(function*(){const i=a._logger.create("removeUser");yield a.storeUser(null),i.info("user removed from storage"),a._events.unload()})()}signinRedirect(a={}){var i=this;return H(function*(){i._logger.create("signinRedirect");const w=a,{redirectMethod:o}=w,u=Lr(w,["redirectMethod"]),h=yield i._redirectNavigator.prepare({redirectMethod:o});yield i._signinStart(dn({request_type:"si:r"},u),h)})()}signinRedirectCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signinRedirectCallback"),u=yield i._signinEnd(a);return u.profile&&u.profile.sub?o.info("success, signed in subject",u.profile.sub):o.info("no subject"),u})()}signinResourceOwnerCredentials({username:a,password:i,skipUserInfo:o=!1}){var u=this;return H(function*(){const h=u._logger.create("signinResourceOwnerCredential"),w=yield u._client.processResourceOwnerPasswordCredentials({username:a,password:i,skipUserInfo:o,extraTokenParams:u.settings.extraTokenParams});h.debug("got signin response");const T=yield u._buildUser(w);return T.profile&&T.profile.sub?h.info("success, signed in subject",T.profile.sub):h.info("no subject"),T})()}signinPopup(a={}){var i=this;return H(function*(){const o=i._logger.create("signinPopup"),j=a,{popupWindowFeatures:u,popupWindowTarget:h}=j,w=Lr(j,["popupWindowFeatures","popupWindowTarget"]),T=i.settings.popup_redirect_uri;T||o.throw(new Error("No popup_redirect_uri configured"));const P=yield i._popupNavigator.prepare({popupWindowFeatures:u,popupWindowTarget:h}),F=yield i._signin(dn({request_type:"si:p",redirect_uri:T,display:"popup"},w),P);return F&&(F.profile&&F.profile.sub?o.info("success, signed in subject",F.profile.sub):o.info("no subject")),F})()}signinPopupCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const u=o._logger.create("signinPopupCallback");yield o._popupNavigator.callback(a,{keepOpen:i}),u.info("success")})()}signinSilent(a={}){var i=this;return H(function*(){var o;const u=i._logger.create("signinSilent"),Ee=a,{silentRequestTimeoutInSeconds:h,resource:w}=Ee,T=Lr(Ee,["silentRequestTimeoutInSeconds","resource"]);let P=yield i._loadUser();if(null==P?void 0:P.refresh_token){u.debug("using refresh token");const Re=new class{constructor(a,i){this.refresh_token=a.refresh_token,this.id_token=a.id_token,this.session_state=a.session_state,this.scope=a.scope,this.profile=a.profile,this.resource=i,this.data=a.state}}(P,w);return yield i._useRefreshToken(Re)}const F=i.settings.silent_redirect_uri;let j;F||u.throw(new Error("No silent_redirect_uri configured")),P&&i.settings.validateSubOnSilentRenew&&(u.debug("subject prior to silent renew:",P.profile.sub),j=P.profile.sub);const J=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:h});return P=yield i._signin(dn({request_type:"si:s",redirect_uri:F,prompt:"none",id_token_hint:i.settings.includeIdTokenInSilentRenew?null==P?void 0:P.id_token:void 0},T),J,j),P&&((null==(o=P.profile)?void 0:o.sub)?u.info("success, signed in subject",P.profile.sub):u.info("no subject")),P})()}_useRefreshToken(a){var i=this;return H(function*(){const o=yield i._client.useRefreshToken({state:a,timeoutInSeconds:i.settings.silentRequestTimeoutInSeconds}),u=new ja(dn(dn({},a),o));return yield i.storeUser(u),i._events.load(u),u})()}signinSilentCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signinSilentCallback");yield i._iframeNavigator.callback(a),o.info("success")})()}signinCallback(a=window.location.href){var i=this;return H(function*(){const{state:o}=yield i._client.readSigninResponseState(a);switch(o.request_type){case"si:r":return yield i.signinRedirectCallback(a);case"si:p":return yield i.signinPopupCallback(a);case"si:s":return yield i.signinSilentCallback(a);default:throw new Error("invalid response_type in state")}})()}signoutCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const{state:u}=yield o._client.readSignoutResponseState(a);if(u)switch(u.request_type){case"so:r":yield o.signoutRedirectCallback(a);break;case"so:p":yield o.signoutPopupCallback(a,i);break;case"so:s":yield o.signoutSilentCallback(a);break;default:throw new Error("invalid response_type in state")}})()}querySessionStatus(a={}){var i=this;return H(function*(){const o=i._logger.create("querySessionStatus"),j=a,{silentRequestTimeoutInSeconds:u}=j,h=Lr(j,["silentRequestTimeoutInSeconds"]),w=i.settings.silent_redirect_uri;w||o.throw(new Error("No silent_redirect_uri configured"));const T=yield i._loadUser(),P=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:u}),F=yield i._signinStart(dn({request_type:"si:s",redirect_uri:w,prompt:"none",id_token_hint:i.settings.includeIdTokenInSilentRenew?null==T?void 0:T.id_token:void 0,response_type:i.settings.query_status_response_type,scope:"openid",skipUserInfo:!0},h),P);try{const J=yield i._client.processSigninResponse(F.url);return o.debug("got signin response"),J.session_state&&J.profile.sub?(o.info("success for subject",J.profile.sub),{session_state:J.session_state,sub:J.profile.sub,sid:J.profile.sid}):(o.info("success, user not authenticated"),null)}catch(J){if(i.settings.monitorAnonymousSession&&J instanceof Yi)switch(J.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return o.info("success for anonymous user"),{session_state:J.session_state}}throw J}})()}_signin(a,i,o){var u=this;return H(function*(){const h=yield u._signinStart(a,i);return yield u._signinEnd(h.url,o)})()}_signinStart(a,i){var o=this;return H(function*(){const u=o._logger.create("_signinStart");try{const h=yield o._client.createSigninRequest(a);return u.debug("got signin request"),yield i.navigate({url:h.url,state:h.state.id,response_mode:h.state.response_mode,scriptOrigin:o.settings.iframeScriptOrigin})}catch(h){throw u.debug("error after preparing navigator, closing navigator window"),i.close(),h}})()}_signinEnd(a,i){var o=this;return H(function*(){const u=o._logger.create("_signinEnd"),h=yield o._client.processSigninResponse(a);return u.debug("got signin response"),yield o._buildUser(h,i)})()}_buildUser(a,i){var o=this;return H(function*(){const u=o._logger.create("_buildUser"),h=new ja(a);if(i){if(i!==h.profile.sub)throw u.debug("current user does not match user returned from signin. sub from signin:",h.profile.sub),new Yi(Tp(dn({},a),{error:"login_required"}));u.debug("current user matches user returned from signin")}return yield o.storeUser(h),u.debug("user stored"),o._events.load(h),h})()}signoutRedirect(a={}){var i=this;return H(function*(){const o=i._logger.create("signoutRedirect"),T=a,{redirectMethod:u}=T,h=Lr(T,["redirectMethod"]),w=yield i._redirectNavigator.prepare({redirectMethod:u});yield i._signoutStart(dn({request_type:"so:r",post_logout_redirect_uri:i.settings.post_logout_redirect_uri},h),w),o.info("success")})()}signoutRedirectCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signoutRedirectCallback"),u=yield i._signoutEnd(a);return o.info("success"),u})()}signoutPopup(a={}){var i=this;return H(function*(){const o=i._logger.create("signoutPopup"),F=a,{popupWindowFeatures:u,popupWindowTarget:h}=F,w=Lr(F,["popupWindowFeatures","popupWindowTarget"]),T=i.settings.popup_post_logout_redirect_uri,P=yield i._popupNavigator.prepare({popupWindowFeatures:u,popupWindowTarget:h});yield i._signout(dn({request_type:"so:p",post_logout_redirect_uri:T,state:null==T?void 0:{}},w),P),o.info("success")})()}signoutPopupCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const u=o._logger.create("signoutPopupCallback");yield o._popupNavigator.callback(a,{keepOpen:i}),u.info("success")})()}_signout(a,i){var o=this;return H(function*(){const u=yield o._signoutStart(a,i);return yield o._signoutEnd(u.url)})()}_signoutStart(a={},i){var o=this;return H(function*(){var u;const h=o._logger.create("_signoutStart");try{const w=yield o._loadUser();h.debug("loaded current user from storage"),o.settings.revokeTokensOnSignout&&(yield o._revokeInternal(w));const T=a.id_token_hint||w&&w.id_token;T&&(h.debug("setting id_token_hint in signout request"),a.id_token_hint=T),yield o.removeUser(),h.debug("user removed, creating signout request");const P=yield o._client.createSignoutRequest(a);return h.debug("got signout request"),yield i.navigate({url:P.url,state:null==(u=P.state)?void 0:u.id,scriptOrigin:o.settings.iframeScriptOrigin})}catch(w){throw h.debug("error after preparing navigator, closing navigator window"),i.close(),w}})()}_signoutEnd(a){var i=this;return H(function*(){const o=i._logger.create("_signoutEnd"),u=yield i._client.processSignoutResponse(a);return o.debug("got signout response"),u})()}signoutSilent(a={}){var i=this;return H(function*(){var o;const u=i._logger.create("signoutSilent"),j=a,{silentRequestTimeoutInSeconds:h}=j,w=Lr(j,["silentRequestTimeoutInSeconds"]),T=i.settings.includeIdTokenInSilentSignout?null==(o=yield i._loadUser())?void 0:o.id_token:void 0,P=i.settings.popup_post_logout_redirect_uri,F=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:h});yield i._signout(dn({request_type:"so:s",post_logout_redirect_uri:P,id_token_hint:T},w),F),u.info("success")})()}signoutSilentCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signoutSilentCallback");yield i._iframeNavigator.callback(a),o.info("success")})()}revokeTokens(a){var i=this;return H(function*(){const o=yield i._loadUser();yield i._revokeInternal(o,a)})()}_revokeInternal(a,i=this.settings.revokeTokenTypes){var o=this;return H(function*(){const u=o._logger.create("_revokeInternal");if(!a)return;const h=i.filter(w=>"string"==typeof a[w]);if(h.length){for(const w of h)yield o._client.revokeToken(a[w],w),u.info(`${w} revoked successfully`),"access_token"!==w&&(a[w]=null);yield o.storeUser(a),u.debug("user stored"),o._events.load(a)}else u.debug("no need to revoke due to no token(s)")})()}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}_loadUser(){var a=this;return H(function*(){const i=a._logger.create("_loadUser"),o=yield a.settings.userStore.get(a._userStoreKey);return o?(i.debug("user storageString loaded"),ja.fromStorageString(o)):(i.debug("no user storageString"),null)})()}storeUser(a){var i=this;return H(function*(){const o=i._logger.create("storeUser");if(a){o.debug("storing user");const u=a.toStorageString();yield i.settings.userStore.set(i._userStoreKey,u)}else i._logger.debug("removing user"),yield i.settings.userStore.remove(i._userStoreKey)})()}clearStaleState(){var a=this;return H(function*(){yield a._client.clearStaleState()})()}}{constructor(i){super(Object.assign({authority:i.authorityUrl,client_id:i.clientId,scope:i.scope,loadUserInfo:i.loadUserInfo,automaticSilentRenew:i.automaticSilentRenew},i.internal)),this.libSettings=i,this._mobileNavigator=new gg}signoutMobile(i={}){var o=this;return H(function*(){var u,h,w,T;const P=o._logger.create("signout"),{mobileWindowToolbarColor:F,mobileWindowPresentationStyle:j,mobileWindowWidth:J,mobileWindowHeight:Ee}=i,Re=(0,Pc._T)(i,["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"]),Fe={mobileWindowToolbarColor:null!=F?F:null===(u=o.libSettings.internal)||void 0===u?void 0:u.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=j?j:null===(h=o.libSettings.internal)||void 0===h?void 0:h.mobileWindowPresentationStyle,mobileWindowWidth:null!=J?J:null===(w=o.libSettings.internal)||void 0===w?void 0:w.mobileWindowWidth,mobileWindowHeight:null!=Ee?Ee:null===(T=o.libSettings.internal)||void 0===T?void 0:T.mobileWindowHeight},ke=o._mobileNavigator.prepare(o.settings.post_logout_redirect_uri,Fe);yield o._signout(Object.assign({request_type:"so:m",post_logout_redirect_uri:o.settings.post_logout_redirect_uri},Re),ke),P.info("success")})()}signinMobile(i={}){var o=this;return H(function*(){var u,h,w,T,P;const F=o._logger.create("signin"),{mobileWindowToolbarColor:j,mobileWindowPresentationStyle:J,mobileWindowWidth:Ee,mobileWindowHeight:Re}=i,Fe=(0,Pc._T)(i,["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"]),ke={mobileWindowToolbarColor:null!=j?j:null===(u=o.libSettings.internal)||void 0===u?void 0:u.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=J?J:null===(h=o.libSettings.internal)||void 0===h?void 0:h.mobileWindowPresentationStyle,mobileWindowWidth:null!=Ee?Ee:null===(w=o.libSettings.internal)||void 0===w?void 0:w.mobileWindowWidth,mobileWindowHeight:null!=Re?Re:null===(T=o.libSettings.internal)||void 0===T?void 0:T.mobileWindowHeight},It=o._mobileNavigator.prepare(o.settings.redirect_uri,ke),jt=yield o._signin(Object.assign({request_type:"si:m",redirect_uri:o.settings.redirect_uri},Fe),It);(null===(P=null==jt?void 0:jt.profile)||void 0===P?void 0:P.sub)?F.info("success, signed in subject",jt.profile.sub):F.info("no subject")})()}}const Zs="auth-js:oidc_manager:redirect_url",Or={loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!1,automaticSilentRenew:!0,desktopNavigationType:Xt.REDIRECT,scope:"openid profile email phone",logLevel:xn.NONE,internal:{response_type:"code",redirect_uri:"?oidc-callback=login",post_logout_redirect_uri:"?oidc-callback=logout",popup_redirect_uri:"oidc/callback/popup_redirect.html",popup_post_logout_redirect_uri:"oidc/callback/popup_redirect.html",silent_redirect_uri:"oidc/callback/silent_redirect.html",mobileWindowPresentationStyle:"popover"}};class Vc extends class{}{constructor(){super(...arguments),this.idTokenSubs=new ls,this.accessTokenSubs=new ls,this.userProfileSubs=new ls,this.userSessionSubs=new ls,this.authenticatedSubs=new ls,this.renewingSubs=new ls,this.redirectSubs=new ls,this.userManagerSubs=[],this._isAuthenticated=!1,this._isRenewing=!1,this.settings=Or}set user(i){this._user!==i&&(this._user=i,this._idToken=i?i.id_token:void 0,this._accessToken=i?i.access_token:void 0,this._userProfile=(null==i?void 0:i.profile)?i.profile:void 0,this._userSession=i?Po.deserialize(i):void 0,this._isAuthenticated=!(!i||i.expired),this.idTokenSubs.notify(this._idToken),this.accessTokenSubs.notify(this._accessToken),this.userProfileSubs.notify(this._userProfile),this.userSessionSubs.notify(this._userSession),this.authenticatedSubs.notify(this._isAuthenticated))}init(i){var o=this;return H(function*(){var u,h,w,T,P,F,j,J,Ee,Re;xn.setLevel(null!==(h=null!==(u=i.logLevel)&&void 0!==u?u:Or.logLevel)&&void 0!==h?h:xn.NONE),xn.setLogger(console);const Fe=Ot.isNativeMobile(),ke=Fe?`${i.mobileScheme}://localhost/`:Ot.getBaseUrl();if(o.settings=Ks({},Or,{internal:{userStore:new Ec({store:Fe?new fg:new xo}),redirect_uri:`${ke}${null===(w=Or.internal)||void 0===w?void 0:w.redirect_uri}`,post_logout_redirect_uri:`${ke}${null===(T=Or.internal)||void 0===T?void 0:T.post_logout_redirect_uri}`,popup_redirect_uri:`${ke}${null===(P=Or.internal)||void 0===P?void 0:P.popup_redirect_uri}`,popup_post_logout_redirect_uri:`${ke}${null===(F=Or.internal)||void 0===F?void 0:F.popup_post_logout_redirect_uri}`,silent_redirect_uri:`${ke}${null===(j=Or.internal)||void 0===j?void 0:j.silent_redirect_uri}`}},i),o.patchAuth0Logout(),o.userManager=new Cy(o.settings),o.userManagerSubs.push(o.userManager.events.addUserLoaded(It=>{o.user=It}),o.userManager.events.addUserUnloaded(()=>{o.user&&(o.user=null,o.settings.loginRequired&&location.reload())}),o.userManager.events.addSilentRenewError(H(function*(){yield o.removeUser()}))),o.assertNotInInceptionLoop(),Ot.isUrlMatching(location.href,null===(J=o.settings.internal)||void 0===J?void 0:J.redirect_uri))yield o.runSyncOrAsync(()=>o.backFromSigninRedirect());else if(Ot.isUrlMatching(location.href,null===(Ee=o.settings.internal)||void 0===Ee?void 0:Ee.post_logout_redirect_uri))yield o.runSyncOrAsync(()=>o.backFromSignoutRedirect());else if(o.settings.retrieveUserSession||o.settings.loginRequired){const It=function(){var Mt=H(function*(){yield o.runSyncOrAsync(()=>o.signinSilent().catch(function(){var jn=H(function*(Cn){const{error:xt,message:Qt}=Cn;if(o.settings.loginRequired&&((null==xt?void 0:xt.includes("_required"))||(null==Qt?void 0:Qt.includes("_required"))))yield o.login();else if(console.error("[OIDCAuthManager] User's session cannot be retrieved:",Cn.message),o.authenticatedSubs.notify(!1),o.settings.loginRequired)throw Cn});return function(Cn){return jn.apply(this,arguments)}}()))});return function(){return Mt.apply(this,arguments)}}(),jt=yield null===(Re=o.userManager)||void 0===Re?void 0:Re.getUser();!jt||jt.expired?!Fe&&o.settings.retrieveUserSession?yield It():o.settings.loginRequired?yield o.login():o.user=null:o.user=jt}else o.user=null})()}logout(i){var o=this;return H(function*(){var u,h,w,T,P;const F=null!==(u=null==i?void 0:i.redirectUrl)&&void 0!==u?u:location.href;Ot.isNativeMobile()?(yield null===(h=o.userManager)||void 0===h?void 0:h.signoutMobile(i),yield o.redirect(F),o.postLogoutVerification(F)):(null!==(w=null==i?void 0:i.desktopNavigationType)&&void 0!==w?w:o.settings.desktopNavigationType)===Xt.POPUP?(yield null===(T=o.userManager)||void 0===T?void 0:T.signoutPopup(i),yield o.redirect(F)):(sessionStorage.setItem(Zs,F),yield null===(P=o.userManager)||void 0===P?void 0:P.signoutRedirect(i))})()}login(i){var o=this;return H(function*(){var u,h,w,T,P;const F=null!==(u=null==i?void 0:i.redirectUrl)&&void 0!==u?u:location.href;return Ot.isNativeMobile()?(o.notifyRenew(!0),yield null===(h=o.userManager)||void 0===h?void 0:h.signinMobile(i).finally(()=>o.notifyRenew(!1)),yield o.redirect(F)):(null!==(w=null==i?void 0:i.desktopNavigationType)&&void 0!==w?w:o.settings.desktopNavigationType)===Xt.POPUP?(o.notifyRenew(!0),yield null===(T=o.userManager)||void 0===T?void 0:T.signinPopup(i).catch(j=>{throw"Attempted to navigate on a disposed window"===(null==j?void 0:j.message)&&((j=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,j.message+="\n\n\u24d8 This may be due to an ad blocker."),j}).finally(()=>o.notifyRenew(!1)),yield o.redirect(F)):(sessionStorage.setItem(Zs,F),yield null===(P=o.userManager)||void 0===P?void 0:P.signinRedirect(i)),o._isAuthenticated})()}renew(i){var o=this;return H(function*(){return o.signinSilent(i).catch(u=>console.error(u))})()}getSettings(){return this.settings}isRenewing(){return this._isRenewing}isAuthenticated(){var i=this;return H(function*(){return yield i.waitForRenew("isAuthenticated()"),i._isAuthenticated})()}getUserProfile(){var i=this;return H(function*(){return yield i.waitForRenew("getUserProfile()"),i._userProfile})()}getUserSession(){var i=this;return H(function*(){return yield i.waitForRenew("getUserSession()"),i._userSession})()}getIdToken(){var i=this;return H(function*(){return yield i.waitForRenew("getIdToken()"),i._idToken})()}getIdTokenDecoded(){var i=this;return H(function*(){return yield i.waitForRenew("getIdTokenDecoded()"),Ot.decodeJwt(i._idToken)})()}getAccessToken(){var i=this;return H(function*(){return yield i.waitForRenew("getAccessToken()"),i._accessToken})()}getAccessTokenDecoded(){var i=this;return H(function*(){return yield i.waitForRenew("getAccessTokenDecoded()"),Ot.decodeJwt(i._accessToken)})()}destroy(){this.idTokenSubs.unsubscribe(),this.accessTokenSubs.unsubscribe(),this.userProfileSubs.unsubscribe(),this.userSessionSubs.unsubscribe(),this.authenticatedSubs.unsubscribe(),this.renewingSubs.unsubscribe(),this.redirectSubs.unsubscribe(),this.userManagerSubs.forEach(i=>i())}onIdTokenChanged(i){return this.idTokenSubs.add(i)}onAccessTokenChanged(i){return this.accessTokenSubs.add(i)}onUserProfileChanged(i){return this.userProfileSubs.add(i)}onUserSessionChanged(i){return this.userSessionSubs.add(i)}onAuthenticatedChanged(i){return this.authenticatedSubs.add(i)}onRenewingChanged(i){return this.renewingSubs.add(i)}onRedirect(i){return this.redirectSubs.add(i)}assertNotInInceptionLoop(){var i,o;[null===(i=this.settings.internal)||void 0===i?void 0:i.silent_redirect_uri,null===(o=this.settings.internal)||void 0===o?void 0:o.popup_redirect_uri].forEach(u=>{var h;const w=null===(h=new RegExp(/^.*\/(.*).html$/gm).exec(null!=u?u:""))||void 0===h?void 0:h[1],T=new Error(`[OIDCAuthManager] ${null!=u?u:"redirect uri"} was not found.`);if(T.stack=void 0,Ot.isUrlMatching(location.href,u))throw T.message+="\n\n\u24d8 This usually means you forgot to include the redirect html files in your application assets.",T;if(location.href.includes(`/${w}.html`))throw T.message+="\n\n\u24d8 This usually means your redirect urls are misconfigured.",T})}waitForRenew(i){var o=this;return H(function*(){const u=Date.now();for(;o._isRenewing;){if(Date.now()>u+5e3){console.warn("[@badisi/auth-js]",`\`${i}\``,"timed out waiting for renew to finish.");break}yield new Promise(h=>setTimeout(h,100))}})()}postLogoutVerification(i){const o=Ot.stringToURL(null!=i?i:"/");this.settings.loginRequired&&location.origin===o.origin&&location.reload()}notifyRenew(i){this._isRenewing=i,this.renewingSubs.notify(i)}runSyncOrAsync(i){var o=this;return H(function*(){o.settings.loginRequired?yield i():i()})()}redirect(i,o){var u=this;return H(function*(){o&&(console.error(o),yield u.removeUser());const h=Ot.stringToURL(null!=i?i:"/");location.origin===h.origin?(history.replaceState(history.state,"",h.href),u.redirectSubs.notify(h)):location.href=h.href})()}removeUser(){var i=this;return H(function*(){var o,u;i.user=null,yield Promise.all([null===(o=i.userManager)||void 0===o?void 0:o.clearStaleState(),null===(u=i.userManager)||void 0===u?void 0:u.removeUser()])})()}signinSilent(i){var o=this;return H(function*(){var u;o.notifyRenew(!0);try{yield null===(u=o.userManager)||void 0===u?void 0:u.signinSilent(i)}catch(h){throw yield o.removeUser(),h}finally{o.notifyRenew(!1)}})()}backFromSigninRedirect(){var i=this;return H(function*(){var o;try{yield null===(o=i.userManager)||void 0===o?void 0:o.signinRedirectCallback(location.href),yield i.redirect(sessionStorage.getItem(Zs))}catch(u){throw yield i.redirect("/",u),u}finally{sessionStorage.removeItem(Zs)}})()}backFromSignoutRedirect(){var i=this;return H(function*(){var o;let u=sessionStorage.getItem(Zs);try{yield null===(o=i.userManager)||void 0===o?void 0:o.signoutRedirectCallback(location.href),yield i.redirect(u),yield i.removeUser()}catch(h){throw u="/",yield i.redirect(u,h),h}finally{sessionStorage.removeItem(Zs),i.postLogoutVerification(u)}})()}patchAuth0Logout(){var i,o;if(this.settings.authorityUrl.endsWith("auth0.com")){const{authorityUrl:u,clientId:h,desktopNavigationType:w}=this.settings,T=w===Xt.POPUP?null===(i=this.settings.internal)||void 0===i?void 0:i.popup_post_logout_redirect_uri:null===(o=this.settings.internal)||void 0===o?void 0:o.post_logout_redirect_uri;this.settings.internal=Ks({},{metadataSeed:{end_session_endpoint:`${u}/v2/logout?client_id=${h}&returnTo=${T}`}},this.settings.internal)}}}var nn=O(8967);let yi=(()=>{class a{constructor(o,u,h){this.manager=o,this.ngZone=u,this.router=h,this._idToken$=new An(1),this._accessToken$=new An(1),this._userProfile$=new An(1),this._userSession$=new An(1),this._isAuthenticated$=new An(1),this._isRenewing$=new An(1),this.authManagerSubs=[],this.isRenewing$=this._isRenewing$.asObservable().pipe(Ht()),this.isAuthenticated$=this._isAuthenticated$.asObservable().pipe(Ht()),this.userProfile$=this._userProfile$.asObservable().pipe(Ht()),this.userSession$=this._userSession$.asObservable().pipe(Ht()),this.idToken$=this._idToken$.asObservable().pipe(Ht()),this.idTokenDecoded$=this._idToken$.asObservable().pipe(Ht(),(0,gn.U)(w=>Ot.decodeJwt(w))),this.accessToken$=this._accessToken$.asObservable().pipe(Ht()),this.accessTokenDecoded$=this._accessToken$.asObservable().pipe(Ht(),(0,gn.U)(w=>Ot.decodeJwt(w))),this.listenForManagerChanges()}ngOnDestroy(){this.authManagerSubs.forEach(o=>o.unsubscribe())}login(o){var u=this;return H(function*(){return u.manager.login(o)})()}logout(o){var u=this;return H(function*(){return u.manager.logout(o)})()}renew(o){var u=this;return H(function*(){return u.manager.renew(o)})()}getSettings(){return this.manager.getSettings()}isRenewing(){return this.manager.isRenewing()}isAuthenticated(){var o=this;return H(function*(){return o.manager.isAuthenticated()})()}getUserProfile(){var o=this;return H(function*(){return o.manager.getUserProfile()})()}getUserSession(){var o=this;return H(function*(){return o.manager.getUserSession()})()}getIdToken(){var o=this;return H(function*(){return o.manager.getIdToken()})()}getIdTokenDecoded(){var o=this;return H(function*(){return o.manager.getIdTokenDecoded()})()}getAccessToken(){var o=this;return H(function*(){return o.manager.getAccessToken()})()}getAccessTokenDecoded(){var o=this;return H(function*(){return o.manager.getAccessTokenDecoded()})()}listenForManagerChanges(){this.authManagerSubs.push(this.manager.onIdTokenChanged(o=>this.ngZone.run(()=>this._idToken$.next(o))),this.manager.onAccessTokenChanged(o=>this.ngZone.run(()=>this._accessToken$.next(o))),this.manager.onUserProfileChanged(o=>this.ngZone.run(()=>this._userProfile$.next(o))),this.manager.onUserSessionChanged(o=>this.ngZone.run(()=>this._userSession$.next(o))),this.manager.onAuthenticatedChanged(o=>this.ngZone.run(()=>this._isAuthenticated$.next(o))),this.manager.onRenewingChanged(o=>this.ngZone.run(()=>this._isRenewing$.next(o))),this.manager.onRedirect(o=>{this.router.getCurrentNavigation()||this.ngZone.run(()=>{const u=o.href.replace(Ot.getBaseUrl(),"");this.router.navigateByUrl(u)})}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(Vc),m.LFG(m.R0b),m.LFG(nn.F0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();var Oo=O(4945),za=O(7980),Wf=O(4551),by=O(4970);class mg{}class _g{}class mr{constructor(i){this.normalizedNames=new Map,this.lazyUpdate=null,i?this.lazyInit="string"==typeof i?()=>{this.headers=new Map,i.split("\n").forEach(o=>{const u=o.indexOf(":");if(u>0){const h=o.slice(0,u),w=h.toLowerCase(),T=o.slice(u+1).trim();this.maybeSetNormalizedName(h,w),this.headers.has(w)?this.headers.get(w).push(T):this.headers.set(w,[T])}})}:()=>{this.headers=new Map,Object.keys(i).forEach(o=>{let u=i[o];const h=o.toLowerCase();"string"==typeof u&&(u=[u]),u.length>0&&(this.headers.set(h,u),this.maybeSetNormalizedName(o,h))})}:this.headers=new Map}has(i){return this.init(),this.headers.has(i.toLowerCase())}get(i){this.init();const o=this.headers.get(i.toLowerCase());return o&&o.length>0?o[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(i){return this.init(),this.headers.get(i.toLowerCase())||null}append(i,o){return this.clone({name:i,value:o,op:"a"})}set(i,o){return this.clone({name:i,value:o,op:"s"})}delete(i,o){return this.clone({name:i,value:o,op:"d"})}maybeSetNormalizedName(i,o){this.normalizedNames.has(o)||this.normalizedNames.set(o,i)}init(){this.lazyInit&&(this.lazyInit instanceof mr?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(i=>this.applyUpdate(i)),this.lazyUpdate=null))}copyFrom(i){i.init(),Array.from(i.headers.keys()).forEach(o=>{this.headers.set(o,i.headers.get(o)),this.normalizedNames.set(o,i.normalizedNames.get(o))})}clone(i){const o=new mr;return o.lazyInit=this.lazyInit&&this.lazyInit instanceof mr?this.lazyInit:this,o.lazyUpdate=(this.lazyUpdate||[]).concat([i]),o}applyUpdate(i){const o=i.name.toLowerCase();switch(i.op){case"a":case"s":let u=i.value;if("string"==typeof u&&(u=[u]),0===u.length)return;this.maybeSetNormalizedName(i.name,o);const h=("a"===i.op?this.headers.get(o):void 0)||[];h.push(...u),this.headers.set(o,h);break;case"d":const w=i.value;if(w){let T=this.headers.get(o);if(!T)return;T=T.filter(P=>-1===w.indexOf(P)),0===T.length?(this.headers.delete(o),this.normalizedNames.delete(o)):this.headers.set(o,T)}else this.headers.delete(o),this.normalizedNames.delete(o)}}forEach(i){this.init(),Array.from(this.normalizedNames.keys()).forEach(o=>i(this.normalizedNames.get(o),this.headers.get(o)))}}class Uc{encodeKey(i){return Bc(i)}encodeValue(i){return Bc(i)}decodeKey(i){return decodeURIComponent(i)}decodeValue(i){return decodeURIComponent(i)}}const wy=/%(\d[a-f0-9])/gi,Ey={40:"@","3A":":",24:"$","2C":",","3B":";","2B":"+","3D":"=","3F":"?","2F":"/"};function Bc(a){return encodeURIComponent(a).replace(wy,(i,o)=>{var u;return null!==(u=Ey[o])&&void 0!==u?u:i})}function zf(a){return`${a}`}class No{constructor(i={}){if(this.updates=null,this.cloneFrom=null,this.encoder=i.encoder||new Uc,i.fromString){if(i.fromObject)throw new Error("Cannot specify both fromString and fromObject.");this.map=function(a,i){const o=new Map;return a.length>0&&a.replace(/^\?/,"").split("&").forEach(h=>{const w=h.indexOf("="),[T,P]=-1==w?[i.decodeKey(h),""]:[i.decodeKey(h.slice(0,w)),i.decodeValue(h.slice(w+1))],F=o.get(T)||[];F.push(P),o.set(T,F)}),o}(i.fromString,this.encoder)}else i.fromObject?(this.map=new Map,Object.keys(i.fromObject).forEach(o=>{const u=i.fromObject[o];this.map.set(o,Array.isArray(u)?u:[u])})):this.map=null}has(i){return this.init(),this.map.has(i)}get(i){this.init();const o=this.map.get(i);return o?o[0]:null}getAll(i){return this.init(),this.map.get(i)||null}keys(){return this.init(),Array.from(this.map.keys())}append(i,o){return this.clone({param:i,value:o,op:"a"})}appendAll(i){const o=[];return Object.keys(i).forEach(u=>{const h=i[u];Array.isArray(h)?h.forEach(w=>{o.push({param:u,value:w,op:"a"})}):o.push({param:u,value:h,op:"a"})}),this.clone(o)}set(i,o){return this.clone({param:i,value:o,op:"s"})}delete(i,o){return this.clone({param:i,value:o,op:"d"})}toString(){return this.init(),this.keys().map(i=>{const o=this.encoder.encodeKey(i);return this.map.get(i).map(u=>o+"="+this.encoder.encodeValue(u)).join("&")}).filter(i=>""!==i).join("&")}clone(i){const o=new No({encoder:this.encoder});return o.cloneFrom=this.cloneFrom||this,o.updates=(this.updates||[]).concat(i),o}init(){null===this.map&&(this.map=new Map),null!==this.cloneFrom&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(i=>this.map.set(i,this.cloneFrom.map.get(i))),this.updates.forEach(i=>{switch(i.op){case"a":case"s":const o=("a"===i.op?this.map.get(i.param):void 0)||[];o.push(zf(i.value)),this.map.set(i.param,o);break;case"d":if(void 0===i.value){this.map.delete(i.param);break}{let u=this.map.get(i.param)||[];const h=u.indexOf(zf(i.value));-1!==h&&u.splice(h,1),u.length>0?this.map.set(i.param,u):this.map.delete(i.param)}}}),this.cloneFrom=this.updates=null)}}class yg{constructor(){this.map=new Map}set(i,o){return this.map.set(i,o),this}get(i){return this.map.has(i)||this.map.set(i,i.defaultValue()),this.map.get(i)}delete(i){return this.map.delete(i),this}keys(){return this.map.keys()}}function qa(a){return"undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer}function Hc(a){return"undefined"!=typeof Blob&&a instanceof Blob}function cu(a){return"undefined"!=typeof FormData&&a instanceof FormData}class Ut{constructor(i,o,u,h){let w;if(this.url=o,this.body=null,this.reportProgress=!1,this.withCredentials=!1,this.responseType="json",this.method=i.toUpperCase(),function(a){switch(a){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}(this.method)||h?(this.body=void 0!==u?u:null,w=h):w=u,w&&(this.reportProgress=!!w.reportProgress,this.withCredentials=!!w.withCredentials,w.responseType&&(this.responseType=w.responseType),w.headers&&(this.headers=w.headers),w.context&&(this.context=w.context),w.params&&(this.params=w.params)),this.headers||(this.headers=new mr),this.context||(this.context=new yg),this.params){const T=this.params.toString();if(0===T.length)this.urlWithParams=o;else{const P=o.indexOf("?");this.urlWithParams=o+(-1===P?"?":PRe.set(Fe,i.setHeaders[Fe]),j)),i.setParams&&(J=Object.keys(i.setParams).reduce((Re,Fe)=>Re.set(Fe,i.setParams[Fe]),J)),new Ut(u,h,T,{params:J,headers:j,context:Ee,reportProgress:F,responseType:w,withCredentials:P})}}var un=(()=>((un=un||{})[un.Sent=0]="Sent",un[un.UploadProgress=1]="UploadProgress",un[un.ResponseHeader=2]="ResponseHeader",un[un.DownloadProgress=3]="DownloadProgress",un[un.Response=4]="Response",un[un.User=5]="User",un))();class $c{constructor(i,o=200,u="OK"){this.headers=i.headers||new mr,this.status=void 0!==i.status?i.status:o,this.statusText=i.statusText||u,this.url=i.url||null,this.ok=this.status>=200&&this.status<300}}class Ya extends $c{constructor(i={}){super(i),this.type=un.ResponseHeader}clone(i={}){return new Ya({headers:i.headers||this.headers,status:void 0!==i.status?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}}class Ka extends $c{constructor(i={}){super(i),this.type=un.Response,this.body=void 0!==i.body?i.body:null}clone(i={}){return new Ka({body:void 0!==i.body?i.body:this.body,headers:i.headers||this.headers,status:void 0!==i.status?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}}class Yf extends $c{constructor(i){super(i,0,"Unknown Error"),this.name="HttpErrorResponse",this.ok=!1,this.message=this.status>=200&&this.status<300?`Http failure during parsing for ${i.url||"(unknown url)"}`:`Http failure response for ${i.url||"(unknown url)"}: ${i.status} ${i.statusText}`,this.error=i.error||null}}function Gc(a,i){return{body:i,headers:a.headers,context:a.context,observe:a.observe,params:a.params,reportProgress:a.reportProgress,responseType:a.responseType,withCredentials:a.withCredentials}}let Kf=(()=>{class a{constructor(o){this.handler=o}request(o,u,h={}){let w;if(o instanceof Ut)w=o;else{let F,j;F=h.headers instanceof mr?h.headers:new mr(h.headers),h.params&&(j=h.params instanceof No?h.params:new No({fromObject:h.params})),w=new Ut(o,u,void 0!==h.body?h.body:null,{headers:F,context:h.context,params:j,reportProgress:h.reportProgress,responseType:h.responseType||"json",withCredentials:h.withCredentials})}const T=(0,Oo.of)(w).pipe((0,Wf.b)(F=>this.handler.handle(F)));if(o instanceof Ut||"events"===h.observe)return T;const P=T.pipe((0,by.h)(F=>F instanceof Ka));switch(h.observe||"body"){case"body":switch(w.responseType){case"arraybuffer":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&!(F.body instanceof ArrayBuffer))throw new Error("Response is not an ArrayBuffer.");return F.body}));case"blob":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&!(F.body instanceof Blob))throw new Error("Response is not a Blob.");return F.body}));case"text":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&"string"!=typeof F.body)throw new Error("Response is not a string.");return F.body}));default:return P.pipe((0,gn.U)(F=>F.body))}case"response":return P;default:throw new Error(`Unreachable: unhandled observe type ${h.observe}}`)}}delete(o,u={}){return this.request("DELETE",o,u)}get(o,u={}){return this.request("GET",o,u)}head(o,u={}){return this.request("HEAD",o,u)}jsonp(o,u){return this.request("JSONP",o,{params:(new No).append(u,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(o,u={}){return this.request("OPTIONS",o,u)}patch(o,u,h={}){return this.request("PATCH",o,Gc(h,u))}post(o,u,h={}){return this.request("POST",o,Gc(h,u))}put(o,u,h={}){return this.request("PUT",o,Gc(h,u))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(mg))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();class Jf{constructor(i,o){this.next=i,this.interceptor=o}handle(i){return this.interceptor.intercept(i,this.next)}}const Wc=new m.OlP("HTTP_INTERCEPTORS");let Sy=(()=>{class a{intercept(o,u){return u.handle(o)}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Iy=/^\)\]\}',?\n/;let Ja=(()=>{class a{constructor(o){this.xhrFactory=o}handle(o){if("JSONP"===o.method)throw new Error("Attempted to construct Jsonp request without HttpClientJsonpModule installed.");return new za.y(u=>{const h=this.xhrFactory.build();if(h.open(o.method,o.urlWithParams),o.withCredentials&&(h.withCredentials=!0),o.headers.forEach((Fe,ke)=>h.setRequestHeader(Fe,ke.join(","))),o.headers.has("Accept")||h.setRequestHeader("Accept","application/json, text/plain, */*"),!o.headers.has("Content-Type")){const Fe=o.detectContentTypeHeader();null!==Fe&&h.setRequestHeader("Content-Type",Fe)}if(o.responseType){const Fe=o.responseType.toLowerCase();h.responseType="json"!==Fe?Fe:"text"}const w=o.serializeBody();let T=null;const P=()=>{if(null!==T)return T;const Fe=1223===h.status?204:h.status,ke=h.statusText||"OK",It=new mr(h.getAllResponseHeaders()),jt=function(a){return"responseURL"in a&&a.responseURL?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):null}(h)||o.url;return T=new Ya({headers:It,status:Fe,statusText:ke,url:jt}),T},F=()=>{let{headers:Fe,status:ke,statusText:It,url:jt}=P(),Mt=null;204!==ke&&(Mt=void 0===h.response?h.responseText:h.response),0===ke&&(ke=Mt?200:0);let jn=ke>=200&&ke<300;if("json"===o.responseType&&"string"==typeof Mt){const Cn=Mt;Mt=Mt.replace(Iy,"");try{Mt=""!==Mt?JSON.parse(Mt):null}catch(xt){Mt=Cn,jn&&(jn=!1,Mt={error:xt,text:Mt})}}jn?(u.next(new Ka({body:Mt,headers:Fe,status:ke,statusText:It,url:jt||void 0})),u.complete()):u.error(new Yf({error:Mt,headers:Fe,status:ke,statusText:It,url:jt||void 0}))},j=Fe=>{const{url:ke}=P(),It=new Yf({error:Fe,status:h.status||0,statusText:h.statusText||"Unknown Error",url:ke||void 0});u.error(It)};let J=!1;const Ee=Fe=>{J||(u.next(P()),J=!0);let ke={type:un.DownloadProgress,loaded:Fe.loaded};Fe.lengthComputable&&(ke.total=Fe.total),"text"===o.responseType&&!!h.responseText&&(ke.partialText=h.responseText),u.next(ke)},Re=Fe=>{let ke={type:un.UploadProgress,loaded:Fe.loaded};Fe.lengthComputable&&(ke.total=Fe.total),u.next(ke)};return h.addEventListener("load",F),h.addEventListener("error",j),h.addEventListener("timeout",j),h.addEventListener("abort",j),o.reportProgress&&(h.addEventListener("progress",Ee),null!==w&&h.upload&&h.upload.addEventListener("progress",Re)),h.send(w),u.next({type:un.Sent}),()=>{h.removeEventListener("error",j),h.removeEventListener("abort",j),h.removeEventListener("load",F),h.removeEventListener("timeout",j),o.reportProgress&&(h.removeEventListener("progress",Ee),null!==w&&h.upload&&h.upload.removeEventListener("progress",Re)),h.readyState!==h.DONE&&h.abort()}})}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.JF))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const zc=new m.OlP("XSRF_COOKIE_NAME"),qc=new m.OlP("XSRF_HEADER_NAME");class us{}let wg=(()=>{class a{constructor(o,u,h){this.doc=o,this.platform=u,this.cookieName=h,this.lastCookieString="",this.lastToken=null,this.parseCount=0}getToken(){if("server"===this.platform)return null;const o=this.doc.cookie||"";return o!==this.lastCookieString&&(this.parseCount++,this.lastToken=(0,x.Mx)(o,this.cookieName),this.lastCookieString=o),this.lastToken}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0),m.LFG(m.Lbi),m.LFG(zc))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Yc=(()=>{class a{constructor(o,u){this.tokenService=o,this.headerName=u}intercept(o,u){const h=o.url.toLowerCase();if("GET"===o.method||"HEAD"===o.method||h.startsWith("http://")||h.startsWith("https://"))return u.handle(o);const w=this.tokenService.getToken();return null!==w&&!o.headers.has(this.headerName)&&(o=o.clone({headers:o.headers.set(this.headerName,w)})),u.handle(o)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(us),m.LFG(qc))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Nr=(()=>{class a{constructor(o,u){this.backend=o,this.injector=u,this.chain=null}handle(o){if(null===this.chain){const u=this.injector.get(Wc,[]);this.chain=u.reduceRight((h,w)=>new Jf(h,w),this.backend)}return this.chain.handle(o)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(_g),m.LFG(m.zs3))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Dg=(()=>{class a{static disable(){return{ngModule:a,providers:[{provide:Yc,useClass:Sy}]}}static withOptions(o={}){return{ngModule:a,providers:[o.cookieName?{provide:zc,useValue:o.cookieName}:[],o.headerName?{provide:qc,useValue:o.headerName}:[]]}}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[Yc,{provide:Wc,useExisting:Yc,multi:!0},{provide:us,useClass:wg},{provide:zc,useValue:"XSRF-TOKEN"},{provide:qc,useValue:"X-XSRF-TOKEN"}]}),a})(),Xf=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[Kf,{provide:mg,useClass:Nr},Ja,{provide:_g,useExisting:Ja}],imports:[[Dg.withOptions({cookieName:"XSRF-TOKEN",headerName:"X-XSRF-TOKEN"})]]}),a})();var Kc=O(5975),Jc=O(9517),Xs=O(447),vi=O(5955),xy=O(8007),Ry=O(2692),eh=O(9299);function Ag(...a){const i=(0,xy.jO)(a),{args:o,keys:u}=(0,Xs.D)(a),h=new za.y(w=>{const{length:T}=o;if(!T)return void w.complete();const P=new Array(T);let F=T,j=T;for(let J=0;J{Ee||(Ee=!0,j--),P[J]=Re},()=>F--,void 0,()=>{(!F||!Ee)&&(j||w.next(u?(0,eh.n)(u,P):P),w.complete())}))}});return i?h.pipe((0,Ry.Z)(i)):h}var Qa=O(5598),Qc=O(1528),Zc=O(3568);let cs=(()=>{class a{constructor(o,u){this.authService=o,this.router=u}canLoad(o){var u,h;const w=null===(h=null===(u=this.router.getCurrentNavigation())||void 0===u?void 0:u.extractedUrl)||void 0===h?void 0:h.toString();return this.isAllowed(o.data,w)}canActivate(o,u){return this.isAllowed(o.data,u.url)}canActivateChild(o,u){return this.isAllowed(o.data,u.url)}isAuthorized(){return!0}isPromise(o){return Boolean((null==o?void 0:o.then)&&"function"==typeof o.then)}isAuthorized$(o){const u=w=>"boolean"==typeof w?(0,Oo.of)(w):function(a){return!!a&&(a instanceof za.y||(0,Kc.m)(a.lift)&&(0,Kc.m)(a.subscribe))}(w)?w:this.isPromise(w)?(0,Jc.D)(w):(0,Oo.of)(!1),h=null==o?void 0:o.authGuardValidator;return"function"==typeof h?Ag({userProfile:this.authService.userProfile$.pipe((0,Qa.q)(1)),accessToken:this.authService.accessTokenDecoded$.pipe((0,Qa.q)(1))}).pipe((0,Qc.w)(({userProfile:w,accessToken:T})=>u(h(w,T)))):h?(console.error("authGuardValidator must be a function"),(0,Oo.of)(!1)):u(this.isAuthorized())}isAuthenticated$(o=location.href){return this.authService.isAuthenticated$.pipe((0,Qa.q)(1),(0,Qc.w)(u=>u?(0,Oo.of)(u):(0,Jc.D)(this.authService.login({redirectUrl:o})).pipe((0,Zc.K)(()=>(0,Oo.of)(!1)))))}isAllowed(o,u=location.href){return this.isAuthenticated$(u).pipe((0,Qc.w)(h=>h?this.isAuthorized$(o):(0,Oo.of)(!1)),(0,gn.U)(h=>{var w;if(!h){const T=(null==o?void 0:o.authGuardRedirectUrl)||(null===(w=this.authService.getSettings())||void 0===w?void 0:w.authGuardRedirectUrl);return this.router.parseUrl(T||this.router.url)}return!0}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(yi),m.LFG(nn.F0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Ig=(()=>{class a{constructor(o){this.authService=o,this.injectToken=!1,this.loginOn401=!1;const u=o.getSettings();u&&(this.injectToken=u.automaticInjectToken,this.loginOn401=u.automaticLoginOn401)}intercept(o,u){return this.injectAuthTokenIfNeeded$(o).pipe((0,Qc.w)(h=>u.handle(h)),(0,Zc.K)(h=>(this.loginOn401&&401===h.status&&this.authService.login(),function(a,i){const o=(0,Kc.m)(a)?a:()=>a,u=h=>h.error(o());return new za.y(u)}(()=>h))))}getCompleteUrl(o){try{return new URL(o).href}catch(u){return new URL(`${location.origin}${o.startsWith("/")?"":"/"}${o}`).href}}isMatching(o,u){const h=this.getCompleteUrl(o);if("function"==typeof u)return u(h);if("string"==typeof u){const w=u.replace(/\//g,"\\/").replace(/\./g,"\\.").replace(/\*\*/g,"*").replace(/\*/g,".*");return null!==new RegExp(w).exec(h)}return null!==u.exec(h)}isAllowedRequest(o){var u;let h=!1;if("boolean"==typeof this.injectToken)h=this.injectToken;else{const{include:w,exclude:T}=null!==(u=this.injectToken)&&void 0!==u?u:{};Array.isArray(w)?h=w.some(P=>this.isMatching(o.url,P)):w&&(h=this.isMatching(o.url,w)),Array.isArray(T)?T.some(P=>this.isMatching(o.url,P))&&(h=!1):T&&this.isMatching(o.url,T)&&(h=!1)}return h}injectAuthTokenIfNeeded$(o){return this.authService.accessToken$.pipe((0,Qa.q)(1),(0,gn.U)(u=>{if(!1!==this.injectToken&&u&&this.isAllowedRequest(o)){const h=o.headers?o.headers:new mr;return o.clone({headers:h.append("Authorization",`Bearer ${u}`)})}return o}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(yi))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Mg=function(){var a=H(function*(i,o){const u=new o;return yield u.init(i),u});return function(o,u){return a.apply(this,arguments)}}(),Yr=function(){var a=H(function*(i){return yield Mg(i,Vc)});return function(o){return a.apply(this,arguments)}}(),xg={automaticLoginOn401:!0,automaticInjectToken:{include:a=>{const i=new URL(a,"http://default-base");return i.hostname.startsWith("api")||i.pathname.startsWith("/api")||!1}}},Xc=new m.OlP("AUTH_MANAGER"),Rg=function(){var a=H(function*(i){return{provide:Xc,useValue:yield Yr(Object.assign(Object.assign({},xg),i)),multi:!1}});return function(o){return a.apply(this,arguments)}}();let Pg=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[cs,nn.Bz,{provide:yi,useFactory:(i,o,u)=>new yi(i,o,u),deps:[Xc,m.R0b,nn.F0]},{provide:Wc,useClass:Ig,deps:[yi],multi:!0}]}),a})(),Og=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=m.Xpm({type:a,selectors:[["app-root"]],decls:1,vars:0,template:function(o,u){1&o&&m._UZ(0,"router-outlet")},directives:[nn.lC],encapsulation:2}),a})();const Ng=[{path:"**",pathMatch:"full",redirectTo:""}];let nh=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[nn.Bz.forRoot(Ng,{onSameUrlNavigation:"reload",enableTracing:!1})],nn.Bz]}),a})();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global&&global;var Ci=(()=>(function(a){a.Unimplemented="UNIMPLEMENTED",a.Unavailable="UNAVAILABLE"}(Ci||(Ci={})),Ci))();class _r extends Error{constructor(i,o,u){super(i),this.message=i,this.code=o,this.data=u}}const Lg=a=>{var i,o,u,h,w;const T=a.CapacitorCustomPlatform||null,P=a.Capacitor||{},F=P.Plugins=P.Plugins||{},j=a.CapacitorPlatforms,Ee=(null===(i=null==j?void 0:j.currentPlatform)||void 0===i?void 0:i.getPlatform)||(()=>null!==T?T.name:(a=>{var i,o;return(null==a?void 0:a.androidBridge)?"android":(null===(o=null===(i=null==a?void 0:a.webkit)||void 0===i?void 0:i.messageHandlers)||void 0===o?void 0:o.bridge)?"ios":"web"})(a)),Fe=(null===(o=null==j?void 0:j.currentPlatform)||void 0===o?void 0:o.isNativePlatform)||(()=>"web"!==Ee()),It=(null===(u=null==j?void 0:j.currentPlatform)||void 0===u?void 0:u.isPluginAvailable)||(bt=>{const Bt=xt.get(bt);return!(!(null==Bt?void 0:Bt.platforms.has(Ee()))&&!Mt(bt))}),Mt=(null===(h=null==j?void 0:j.currentPlatform)||void 0===h?void 0:h.getPluginHeader)||(bt=>{var Bt;return null===(Bt=P.PluginHeaders)||void 0===Bt?void 0:Bt.find(kr=>kr.name===bt)}),xt=new Map,Ai=(null===(w=null==j?void 0:j.currentPlatform)||void 0===w?void 0:w.registerPlugin)||((bt,Bt={})=>{const kr=xt.get(bt);if(kr)return console.warn(`Capacitor plugin "${bt}" already registered. Cannot register plugins twice.`),kr.proxy;const Kr=Ee(),Ii=Mt(bt);let Mi;const dl=function(){var Sn=H(function*(){return!Mi&&Kr in Bt?Mi=Mi="function"==typeof Bt[Kr]?yield Bt[Kr]():Bt[Kr]:null!==T&&!Mi&&"web"in Bt&&(Mi=Mi="function"==typeof Bt.web?yield Bt.web():Bt.web),Mi});return function(){return Sn.apply(this,arguments)}}(),fl=Sn=>{let Bn;const Xi=(...gs)=>{const ms=dl().then(Jr=>{const la=((Sn,Bn)=>{var Xi,gs;if(!Ii){if(Sn)return null===(gs=Sn[Bn])||void 0===gs?void 0:gs.bind(Sn);throw new _r(`"${bt}" plugin is not implemented on ${Kr}`,Ci.Unimplemented)}{const ms=null==Ii?void 0:Ii.methods.find(Jr=>Bn===Jr.name);if(ms)return"promise"===ms.rtype?Jr=>P.nativePromise(bt,Bn.toString(),Jr):(Jr,la)=>P.nativeCallback(bt,Bn.toString(),Jr,la);if(Sn)return null===(Xi=Sn[Bn])||void 0===Xi?void 0:Xi.bind(Sn)}})(Jr,Sn);if(la){const ku=la(...gs);return Bn=null==ku?void 0:ku.remove,ku}throw new _r(`"${bt}.${Sn}()" is not implemented on ${Kr}`,Ci.Unimplemented)});return"addListener"===Sn&&(ms.remove=H(function*(){return Bn()})),ms};return Xi.toString=()=>`${Sn.toString()}() { [capacitor code] }`,Object.defineProperty(Xi,"name",{value:Sn,writable:!1,configurable:!1}),Xi},hl=fl("addListener"),Fu=fl("removeListener"),Ld=(Sn,Bn)=>{const Xi=hl({eventName:Sn},Bn),gs=function(){var Jr=H(function*(){const la=yield Xi;Fu({eventName:Sn,callbackId:la},Bn)});return function(){return Jr.apply(this,arguments)}}(),ms=new Promise(Jr=>Xi.then(()=>Jr({remove:gs})));return ms.remove=H(function*(){console.warn("Using addListener() without 'await' is deprecated."),yield gs()}),ms},zh=new Proxy({},{get(Sn,Bn){switch(Bn){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return Ii?Ld:hl;case"removeListener":return Fu;default:return fl(Bn)}}});return F[bt]=zh,xt.set(bt,{name:bt,proxy:zh,platforms:new Set([...Object.keys(Bt),...Ii?[Kr]:[]])}),zh});return P.convertFileSrc||(P.convertFileSrc=bt=>bt),P.getPlatform=Ee,P.handleError=bt=>a.console.error(bt),P.isNativePlatform=Fe,P.isPluginAvailable=It,P.pluginMethodNoop=(bt,Bt,kr)=>Promise.reject(`${kr} does not have an implementation of "${Bt}".`),P.registerPlugin=Ai,P.Exception=_r,P.DEBUG=!!P.DEBUG,P.isLoggingEnabled=!!P.isLoggingEnabled,P.platform=P.getPlatform(),P.isNative=P.isNativePlatform(),P},yr=(a=>a.Capacitor=Lg(a))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),fu=yr.registerPlugin;class Ug{constructor(i){this.listeners={},this.windowListeners={},i&&(console.warn(`Capacitor WebPlugin "${i.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=i)}addListener(i,o){var u=this;this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(o);const w=this.windowListeners[i];w&&!w.registered&&this.addWindowListener(w);const T=function(){var F=H(function*(){return u.removeListener(i,o)});return function(){return F.apply(this,arguments)}}(),P=Promise.resolve({remove:T});return Object.defineProperty(P,"remove",{value:(F=H(function*(){console.warn("Using addListener() without 'await' is deprecated."),yield T()}),function(){return F.apply(this,arguments)})}),P;var F}removeAllListeners(){var i=this;return H(function*(){i.listeners={};for(const o in i.windowListeners)i.removeWindowListener(i.windowListeners[o]);i.windowListeners={}})()}notifyListeners(i,o){const u=this.listeners[i];u&&u.forEach(h=>h(o))}hasListeners(i){return!!this.listeners[i].length}registerWindowListener(i,o){this.windowListeners[o]={registered:!1,windowEventName:i,pluginEventName:o,handler:u=>{this.notifyListeners(o,u)}}}unimplemented(i="not implemented"){return new yr.Exception(i,Ci.Unimplemented)}unavailable(i="not available"){return new yr.Exception(i,Ci.Unavailable)}removeListener(i,o){var u=this;return H(function*(){const h=u.listeners[i];if(!h)return;const w=h.indexOf(o);u.listeners[i].splice(w,1),u.listeners[i].length||u.removeWindowListener(u.windowListeners[i])})()}addWindowListener(i){window.addEventListener(i.windowEventName,i.handler),i.registered=!0}removeWindowListener(i){!i||(window.removeEventListener(i.windowEventName,i.handler),i.registered=!1)}}const Bg=a=>encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),bi=a=>a.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class hu extends Ug{getCookies(){return H(function*(){const i=document.cookie,o={};return i.split(";").forEach(u=>{if(u.length<=0)return;let[h,w]=u.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");h=bi(h).trim(),w=bi(w).trim(),o[h]=w}),o})()}setCookie(i){return H(function*(){try{const o=Bg(i.key),u=Bg(i.value),h=`; expires=${(i.expires||"").replace("expires=","")}`,w=(i.path||"/").replace("path=",""),T=null!=i.url&&i.url.length>0?`domain=${i.url}`:"";document.cookie=`${o}=${u||""}${h}; path=${w}; ${T};`}catch(o){return Promise.reject(o)}})()}deleteCookie(i){return H(function*(){try{document.cookie=`${i.key}=; Max-Age=0`}catch(o){return Promise.reject(o)}})()}clearCookies(){return H(function*(){try{const i=document.cookie.split(";")||[];for(const o of i)document.cookie=o.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(i){return Promise.reject(i)}})()}clearAllCookies(){var i=this;return H(function*(){try{yield i.clearCookies()}catch(o){return Promise.reject(o)}})()}}fu("CapacitorCookies",{web:()=>new hu});const td=function(){var a=H(function*(i){return new Promise((o,u)=>{const h=new FileReader;h.onload=()=>{const w=h.result;o(w.indexOf(",")>=0?w.split(",")[1]:w)},h.onerror=w=>u(w),h.readAsDataURL(i)})});return function(o){return a.apply(this,arguments)}}();class Ny extends Ug{request(i){return H(function*(){const o=((a,i={})=>{const o=Object.assign({method:a.method||"GET",headers:a.headers},i),h=((a={})=>{const i=Object.keys(a);return Object.keys(a).map(h=>h.toLocaleLowerCase()).reduce((h,w,T)=>(h[w]=a[i[T]],h),{})})(a.headers)["content-type"]||"";if("string"==typeof a.data)o.body=a.data;else if(h.includes("application/x-www-form-urlencoded")){const w=new URLSearchParams;for(const[T,P]of Object.entries(a.data||{}))w.set(T,P);o.body=w.toString()}else if(h.includes("multipart/form-data")||a.data instanceof FormData){const w=new FormData;if(a.data instanceof FormData)a.data.forEach((P,F)=>{w.append(F,P)});else for(const P of Object.keys(a.data))w.append(P,a.data[P]);o.body=w;const T=new Headers(o.headers);T.delete("content-type"),o.headers=T}else(h.includes("application/json")||"object"==typeof a.data)&&(o.body=JSON.stringify(a.data));return o})(i,i.webFetchExtra),u=((a,i=!0)=>a?Object.entries(a).reduce((u,h)=>{const[w,T]=h;let P,F;return Array.isArray(T)?(F="",T.forEach(j=>{P=i?encodeURIComponent(j):j,F+=`${w}=${P}&`}),F.slice(0,-1)):(P=i?encodeURIComponent(T):T,F=`${w}=${P}`),`${u}&${F}`},"").substr(1):null)(i.params,i.shouldEncodeUrlParams),h=u?`${i.url}?${u}`:i.url,w=yield fetch(h,o),T=w.headers.get("content-type")||"";let F,j,{responseType:P="text"}=w.ok?i:{};switch(T.includes("application/json")&&(P="json"),P){case"arraybuffer":case"blob":j=yield w.blob(),F=yield td(j);break;case"json":F=yield w.json();break;default:F=yield w.text()}const J={};return w.headers.forEach((Ee,Re)=>{J[Re]=Ee}),{data:F,headers:J,status:w.status,url:w.url}})()}get(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"GET"}))})()}post(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"POST"}))})()}put(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"PUT"}))})()}patch(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"PATCH"}))})()}delete(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"DELETE"}))})()}}fu("CapacitorHttp",{web:()=>new Ny});const pu='\n .flex {\n flex: 1;\n }\n\n .hidden {\n display: none !important;\n }\n\n .row {\n display: flex;\n flex-direction: row;\n }\n\n .column {\n display: flex;\n flex-direction: column;\n }\n\n .card {\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 4px;\n background-color: white;\n margin: 12px 6px;\n }\n\n .card .card-status {\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n margin-left: 8px;\n background-color: #f2f2f2;\n }\n .card .card-status.error {\n background-color: #ef5350;\n }\n .card .card-status.success {\n background-color: #66bb6a;\n }\n\n .card .card-title {\n padding: 16px;\n font-size: 20px;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.87);\n align-items: center;\n }\n\n .card .box {\n height: 200px;\n border-top: 1px solid lightgray;\n word-break: break-all;\n overflow: auto;\n background-color: #f2f2f2;\n padding: 12px;\n }\n .card .box pre {\n margin: 0;\n }\n\n .card .card-actions {\n padding: 0 14px 8px 14px;\n min-height: 50px;\n }\n .card .card-actions .input {\n display: flex;\n align-items: center;\n }\n .card .card-actions .input:not(:last-child) {\n margin-bottom: 8px;\n }\n .card .card-actions .input label {\n width: 125px;\n text-align: right;\n margin-right: 14px;\n }\n .card .card-actions .input input {\n padding: 4px;\n }\n\n .json-key {\n color: rgb(124, 77, 255);\n }\n\n .json-value {\n color: rgb(67, 122, 237);\n }\n\n .json-string {\n color: rgb(83, 160, 83);\n }\n\n .json-date {\n color: rgb(200, 56, 198);\n }\n\n input {\n color: #5e35b1;\n padding: 10px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n font-size: 14px;\n }\n\n input:invalid {\n border-color: #f44336;\n }\n\n input[type="checkbox"] {\n margin-right: 10px;\n }\n\n select {\n color: #5e35b1;\n padding: 8px 6px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n }\n\n @media only screen and (max-width: 600px) {\n :host {\n padding: 0 !important;\n padding-bottom: 24px !important;\n }\n\n :host .card {\n border-left: 0;\n border-right: 0;\n border-radius: 0;\n margin: 0;\n margin-bottom: 6px;\n }\n }\n',ea=(a,i=[])=>a?JSON.stringify(a,null,2).replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(/^( *)("[\w-]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/gm,(h,w,T,P,F)=>{let j=w||"";const J=T?T.replace(/[": ]/g,""):void 0;if(J&&(j+=`${J}: `),P&&(j+=`${P}`,J&&i.includes(J))){const Ee=new Date(1e3*Number(P)),Re=`${Ee.toDateString()}, ${Ee.toLocaleTimeString()}`;Re&&(j+=` (${Re})`)}return j+(F||"")}):"",nd=document.createElement("template");nd.innerHTML=`\n \n\n
\n
\n\n \n \n \n \n \n \n \n \n\n
\n \u{1f6e1}\ufe0fDemo app { }\n
\u{1f448} choose an implementation
\n
\n\n
\n\n
\n \n \n \n
\n
\n`;class $g extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(nd.content,!0)),this.implSelectEl=this.shadowRoot.querySelector("#implementation-select"),this.statusEl=this.shadowRoot.querySelector(".status"),this.versionEl=this.shadowRoot.querySelector(".version"),this.loginButtonEl=this.shadowRoot.querySelector("#login-button"),this.logoutButtonEl=this.shadowRoot.querySelector("#logout-button"),this.silentRenewButtonEl=this.shadowRoot.querySelector("#silent-renew-button")}set isRenewing(i){this.statusEl&&this.statusEl.classList[i?"add":"remove"]("loading")}set isAuthenticated(i){this.statusEl&&null!==i&&(this.statusEl.classList.remove("loading"),this.statusEl.title=i?"Authenticated":"Not authenticated",this.statusEl.classList[i?"add":"remove"]("authenticated"),this.statusEl.classList[i?"remove":"add"]("not-authenticated"))}connectedCallback(){if(window.location.href.includes("localhost")){const o=document.createElement("option");o.textContent="localhost",this.implSelectEl.appendChild(o)}else{window.appSettings.getImplementations().forEach(u=>{const h=document.createElement("option");h.value=String(u.label),h.textContent=u.label,this.implSelectEl.appendChild(h)});const o=()=>{window.location.href=window.appSettings.getImplementations()[this.implSelectEl.selectedIndex].demoUrl};this.implSelectEl.addEventListener("change",o),this.listeners.push(()=>this.implSelectEl.removeEventListener("change",o))}const i=()=>{var o,u;null===(u=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector("header .title .tip"))||void 0===u||u.remove(),window.appSettings.setShowTip(!1)};window.appSettings.get().showTip?(this.implSelectEl.addEventListener("click",i,{once:!0}),this.listeners.push(()=>this.implSelectEl.removeEventListener("click",i))):i(),this.refreshImplementation(),this.addEventListeners()}disconnectedCallback(){this.listeners.forEach(i=>i())}addEventListeners(){var i,o,u;const h=()=>this.dispatchEvent(new Event("login",{bubbles:!0,composed:!0}));null===(i=this.loginButtonEl)||void 0===i||i.addEventListener("click",h);const w=()=>this.dispatchEvent(new Event("logout",{bubbles:!0,composed:!0}));null===(o=this.logoutButtonEl)||void 0===o||o.addEventListener("click",w);const T=()=>this.dispatchEvent(new Event("silentRenew",{bubbles:!0,composed:!0}));null===(u=this.silentRenewButtonEl)||void 0===u||u.addEventListener("click",T),this.listeners.push(()=>{var P;return null===(P=this.loginButtonEl)||void 0===P?void 0:P.removeEventListener("click",h)},()=>{var P;return null===(P=this.logoutButtonEl)||void 0===P?void 0:P.removeEventListener("click",w)},()=>{var P;return null===(P=this.silentRenewButtonEl)||void 0===P?void 0:P.removeEventListener("click",T)})}refreshImplementation(){const i=window.appSettings.getImplementations();if(window.location.href.includes("localhost"))this.implSelectEl.selectedIndex=0,this.versionEl.innerHTML="@localhost";else{const o=i.findIndex(h=>window.location.href.includes(h.demoUrl)),u=-1!==o?i[o]:i[0];this.implSelectEl.selectedIndex=-1!==o?o:0,this.versionEl.innerHTML=u.version}}}window.customElements.define("demo-app-header",$g);const gu=document.createElement("template");gu.innerHTML=`\n \n\n \n \n
\n \n
\n`;class ky extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.tabs=[],this.views=[],this.currentTabIndex=-1,this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(gu.content,!0)),this.tabsContentEl=this.shadowRoot.querySelector(".tabs-content"),this.demoAppHeaderEl=this.shadowRoot.querySelector("demo-app-header")}set isRenewing(i){this.demoAppHeaderEl.isRenewing=i}set isAuthenticated(i){this.demoAppHeaderEl.isAuthenticated=i}connectedCallback(){this.drawTabs(),this.showView(window.appSettings?window.appSettings.get().currentTabIndex:0)}disconnectedCallback(){this.listeners.forEach(i=>i())}drawTabs(){const i=this.shadowRoot.querySelector("#views"),o=this.shadowRoot.querySelector("#tabs");i&&o&&(this.views=i.assignedElements(),this.views.forEach((u,h)=>{u.style.display="none";const w=document.createElement("a");w.textContent=u.getAttribute("tabLabel")||"?";const T=()=>this.showView(h);w.addEventListener("click",T),this.listeners.push(()=>w.removeEventListener("click",T)),o.appendChild(w),this.tabs.push(w)}))}showView(i){var o;this.currentTabIndex!==i&&(this.currentTabIndex=i,this.tabs.forEach((u,h)=>{u.classList[h!==i?"remove":"add"]("selected")}),this.views.forEach((u,h)=>{u.style.display=h!==i?"none":"flex"}),null===(o=this.tabsContentEl)||void 0===o||o.scrollTo(0,0),window.appSettings.setCurrentTabIndex(i))}}window.customElements.define("demo-app-main",ky);const Gg=document.createElement("template");Gg.innerHTML=`\n \n\n
\n
\n APIs access\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n \n
\n            
\n
\n
\n\n \n`;class Ly extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(Gg.content,!0)),this.apiStatusEl=this.shadowRoot.querySelector("#api-status"),this.apiResponseEl=this.shadowRoot.querySelector("#api-response"),this.apiUrlEl=this.shadowRoot.querySelector("#api-url-input"),this.apiHeadersEl=this.shadowRoot.querySelector("#api-headers-input")}connectedCallback(){var i,o,u;const h=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("#api-get-button"),w=()=>{const j=new CustomEvent("api",{bubbles:!0,composed:!0,detail:{url:this.apiUrlEl.value,headers:this.apiHeadersEl.value}});return this.dispatchEvent(j)};null==h||h.addEventListener("click",w);const T=()=>this.saveSettings({privateApiUrl:this.apiUrlEl.value});null===(o=this.apiUrlEl)||void 0===o||o.addEventListener("input",T);const P=()=>this.saveSettings({privateApiHeaders:this.apiHeadersEl.value});null===(u=this.apiHeadersEl)||void 0===u||u.addEventListener("input",P),this.listeners.push(()=>null==h?void 0:h.removeEventListener("click",w),()=>{var j;return null===(j=this.apiUrlEl)||void 0===j?void 0:j.removeEventListener("input",T)},()=>{var j;return null===(j=this.apiHeadersEl)||void 0===j?void 0:j.removeEventListener("input",P)});const{otherSettings:F}=window.appSettings.getCurrentUserSettings();this.apiUrlEl.value=null==F?void 0:F.privateApiUrl,this.apiHeadersEl.value=null==F?void 0:F.privateApiHeaders}disconnectedCallback(){this.listeners.forEach(i=>i())}setApiStatus(i,o){this.apiStatusEl.classList.remove(o?"success":"error"),this.apiStatusEl.classList.add(o?"error":"success"),this.apiResponseEl.innerHTML=ea(i)}saveSettings(i){const o=window.appSettings.getCurrentUserSettings();o.otherSettings=Object.assign(Object.assign({},o.otherSettings),i),window.appSettings.addOrUpdateUserSettings(o)}}window.customElements.define("demo-app-playground",Ly);const Wg=document.createElement("template");Wg.innerHTML=`\n \n\n
\n
\n
Authenticated
\n \n
\n            
\n
\n\n
\n
User session
\n \n
\n            
\n
\n\n
\n
Access token
\n \n
\n                
\n            
\n
\n\n
\n
Id token
\n \n
\n                
\n            
\n
\n\n
\n
User profile
\n \n
\n            
\n
\n
\n`;class Vy extends HTMLElement{constructor(){var i;super(),this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(Wg.content,!0)),this.isAuthenticated=!1,this.userSession=void 0,this.accessToken=void 0,this.accessTokenDecoded=void 0,this.idToken=void 0,this.idTokenDecoded=void 0,this.userProfile=void 0}set isAuthenticated(i){null!==i&&this.update("#isAuthenticated",i)}set userSession(i){this.update("#userSession",ea(i,["expires_at"]))}set accessToken(i){this.update("#accessToken",i)}set accessTokenDecoded(i){const o="string"!=typeof i?ea(i,["exp","iat","auth_time"]):"(no decoded info as it is not a JWT token)";this.update("#accessTokenDecoded",o)}set idToken(i){this.update("#idToken",i)}set idTokenDecoded(i){this.update("#idTokenDecoded",ea(i,["exp","iat","auth_time"]))}set userProfile(i){this.update("#userProfile",ea(i))}update(i,o){var u,h,w;const T=null===(u=this.shadowRoot)||void 0===u?void 0:u.querySelector(i);T&&(null==o||""===o?null===(h=T.closest(".info"))||void 0===h||h.classList.add("hidden"):(null===(w=T.closest(".info"))||void 0===w||w.classList.remove("hidden"),T.innerHTML=String(o)))}}window.customElements.define("demo-app-debug",Vy);const zg=document.createElement("template");zg.innerHTML=`\n \n\n
\n \n
\n \n
\n
\n\n \n\n
\n
\n DELETE\n
\n
\n \n \n
\n
\n
\n`;class Uy extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.formIsDirty=!1,this.formIsNew=!1,this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(zg.content,!0))}connectedCallback(){var i,o,u,h,w;this.formEl=this.shadowRoot.querySelector("form"),this.formContentEl=this.shadowRoot.querySelector(".form-content"),this.selectEl=this.shadowRoot.querySelector("#settings-select"),this.settingsNameEl=this.shadowRoot.querySelector("#settingsName");const T=jt=>{!this.formIsDirty&&"settings-select"!==jt.target.id&&(this.formIsDirty=!0,this.classList.add("dirty"))};this.formEl.addEventListener("input",T),this.listeners.push(()=>this.formEl.removeEventListener("input",T)),this.refreshSelect();const P=()=>this.loadSettings(this.selectEl.value);null===(i=this.selectEl)||void 0===i||i.addEventListener("change",P),this.listeners.push(()=>this.selectEl.removeEventListener("change",P));const F=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector("#add-settings-button"),j=()=>this.add();null==F||F.addEventListener("click",j),this.listeners.push(()=>null==F?void 0:F.removeEventListener("click",j));const J=null===(u=this.shadowRoot)||void 0===u?void 0:u.querySelector("#delete-settings-button"),Ee=()=>this.delete();null==J||J.addEventListener("click",Ee),this.listeners.push(()=>null==J?void 0:J.removeEventListener("click",Ee));const Re=null===(h=this.shadowRoot)||void 0===h?void 0:h.querySelector("#save-settings-button"),Fe=()=>this.saveAndReload();null==Re||Re.addEventListener("click",Fe),this.listeners.push(()=>null==Re?void 0:Re.removeEventListener("click",Fe));const ke=null===(w=this.shadowRoot)||void 0===w?void 0:w.querySelector("#cancel-settings-button"),It=()=>this.cancel();null==ke||ke.addEventListener("click",It),this.listeners.push(()=>null==ke?void 0:ke.removeEventListener("click",It)),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}disconnectedCallback(){this.listeners.forEach(i=>i())}loadSettings(i){window.appSettings.setCurrentUserSettings(i),location.reload()}add(){const i="New settings",o=document.createElement("option");o.selected=!0,o.value=i,o.textContent=i,this.selectEl.appendChild(o),this.formIsNew=!0,this.formIsDirty=!0,this.classList.add("dirty"),this.refreshFormContent({name:i,librarySettings:{}})}delete(){window.appSettings.deleteCurrentUserSettings(),location.reload()}cancel(){this.formIsNew=!1,this.formIsDirty=!1,this.classList.remove("dirty"),this.refreshSelect(),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}setPathValue(i,o,u){const h=o.split(".");h.reduce((w,T,P)=>(P===h.length-1?w[T]=u:Object.prototype.hasOwnProperty.call(w,T)||(w[T]={}),w[T]),i)}getPathValue(i,o){return o.split(".").reduce((u,h)=>u&&u[h],i)}refreshSelect(){this.selectEl.innerHTML="";const{userSettings:i,currentUserSettingsId:o}=window.appSettings.get();i.sort((u,h)=>u.name.localeCompare(h.name)).forEach(u=>{const h=document.createElement("option");h.selected=u.name===o,h.value=String(u.name),h.textContent=u.name,this.selectEl.appendChild(h)})}refreshFormContent(i){this.formContentEl.innerHTML="";const{librarySettingsDefinition:o}=window.appSettings.get(),{name:u,librarySettings:h}=i;this.settingsNameEl.value=u,o.sort((w,T)=>(T._sortIndex||0)-(w._sortIndex||0)).forEach(w=>{var T;const P=document.createElement("div");this.formContentEl.prepend(P);const F=document.createElement("label");F.htmlFor=w.name.replace(".",""),F.textContent=`${w.label}${w.required?" *":""}`;const j=document.createElement("list"===w.type?"select":"input");switch(j.id=w.name.replace(".",""),j.name=w.name.replace(".",""),j.required=!0===w.required,w.type){case"boolean":j.checked=this.getPathValue(h,w.name),j.type="checkbox",P.appendChild(j),P.appendChild(F);break;case"list":null===(T=w.values)||void 0===T||T.forEach(J=>{const Ee=document.createElement("option");Ee.value=String(J.value),Ee.textContent=J.label,j.appendChild(Ee)}),j.value=this.getPathValue(h,w.name),j.classList.add("flex"),P.classList.add("input","column"),P.appendChild(F),P.appendChild(j);break;default:{const J=this.getPathValue(h,w.name);j.value="json"===w.type?J?JSON.stringify(J):"":null!=J?J:"",P.classList.add("input","column"),P.appendChild(F),P.appendChild(j);break}}})}saveAndReload(){if(this.formEl.reportValidity()){const{librarySettingsDefinition:i}=window.appSettings.get(),o=this.formIsNew?{name:"",librarySettings:{}}:window.appSettings.getCurrentUserSettings();o.name=this.settingsNameEl.value,i.forEach(u=>{var h;const w=null===(h=this.shadowRoot)||void 0===h?void 0:h.querySelector(`#${u.name.replace(".","")}`);let T;switch(u.type){case"boolean":T=w.checked;break;case"list":default:T=w.value;break;case"json":try{const P=w.value;P&&""!==P.trim()&&(T=JSON.parse(P))}catch(P){console.error(P)}}this.setPathValue(o.librarySettings,u.name,T)}),window.appSettings.addOrUpdateUserSettings(o),this.formIsNew&&window.appSettings.setCurrentUserSettings(o.name),location.reload()}}}window.customElements.define("demo-app-settings",Uy);const qg=JSON.parse('{"u2":"@badisi/auth-js","Xh":"https://github.com/Badisi/auth-js/tree/main/projects/auth-js"}'),uh=JSON.parse('{"u2":"@badisi/ngx-auth","i8":"0.0.0-semantically-released","Xh":"https://github.com/Badisi/auth-js/tree/main/projects/ngx-auth"}'),Ji=[{name:"authorityUrl",label:"Authority url",type:"string",required:!0},{name:"clientId",label:"Client id",type:"string",required:!0},{name:"mobileScheme",label:"Custom mobile scheme name",type:"string"},{name:"scope",label:"Scope",type:"string"},{name:"internal.extraQueryParams",label:"Extra query params",type:"json"},{name:"desktopNavigationType",label:"Desktop navigation type",type:"list",values:[{label:"REDIRECT",value:Xt.REDIRECT},{label:"POPUP",value:Xt.POPUP}]},{name:"logLevel",label:"Log level",type:"list",values:[{label:"NONE",value:xn.NONE},{label:"ERROR",value:xn.ERROR},{label:"WARN",value:xn.WARN},{label:"INFO",value:xn.INFO},{label:"DEBUG",value:xn.DEBUG}]},{name:"loginRequired",label:"Login required",type:"boolean"},{name:"retrieveUserSession",label:"Retrieve user's session",type:"boolean"},{name:"loadUserInfo",label:"Load user's info",type:"boolean"},{name:"automaticSilentRenew",label:"Automatic silent renew",type:"boolean"},{name:"automaticLoginOn401",label:"Automatic login on 401",type:"boolean"},{name:"automaticInjectToken",label:"Automatic inject token",type:"boolean"}];Ji.splice(3,0,{name:"authGuardRedirectUrl",label:"AuthGuard redirect url",type:"string"});const rd=Ji;let mu=(()=>{class a{constructor(o,u){this._renderer=o,this._elementRef=u,this.onChange=h=>{},this.onTouched=()=>{}}setProperty(o,u){this._renderer.setProperty(this._elementRef.nativeElement,o,u)}registerOnTouched(o){this.onTouched=o}registerOnChange(o){this.onChange=o}setDisabledState(o){this.setProperty("disabled",o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(m.Qsj),m.Y36(m.SBq))},a.\u0275dir=m.lG2({type:a}),a})(),Fo=(()=>{class a extends mu{}return a.\u0275fac=function(){let i;return function(u){return(i||(i=m.n5z(a)))(u||a)}}(),a.\u0275dir=m.lG2({type:a,features:[m.qOj]}),a})();const Fr=new m.OlP("NgValueAccessor"),dh={provide:Fr,useExisting:(0,m.Gpc)(()=>ta),multi:!0},By=new m.OlP("CompositionEventMode");let ta=(()=>{class a extends mu{constructor(o,u,h){super(o,u),this._compositionMode=h,this._composing=!1,null==this._compositionMode&&(this._compositionMode=!function(){const a=(0,x.q)()?(0,x.q)().getUserAgent():"";return/android (\d+)/.test(a.toLowerCase())}())}writeValue(o){this.setProperty("value",null==o?"":o)}_handleInput(o){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(o)}_compositionStart(){this._composing=!0}_compositionEnd(o){this._composing=!1,this._compositionMode&&this.onChange(o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(m.Qsj),m.Y36(m.SBq),m.Y36(By,8))},a.\u0275dir=m.lG2({type:a,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(o,u){1&o&&m.NdJ("input",function(w){return u._handleInput(w.target.value)})("blur",function(){return u.onTouched()})("compositionstart",function(){return u._compositionStart()})("compositionend",function(w){return u._compositionEnd(w.target.value)})},features:[m._Bn([dh]),m.qOj]}),a})();const Un=new m.OlP("NgValidators"),Lo=new m.OlP("NgAsyncValidators");function ad(a){return null!=a}function el(a){const i=(0,m.QGY)(a)?(0,Jc.D)(a):a;return(0,m.CqO)(i),i}function hh(a){let i={};return a.forEach(o=>{i=null!=o?Object.assign(Object.assign({},i),o):i}),0===Object.keys(i).length?null:i}function ld(a,i){return i.map(o=>o(a))}function ud(a){return a.map(i=>function(a){return!a.validate}(i)?i:o=>i.validate(o))}function dd(a){return null!=a?function(a){if(!a)return null;const i=a.filter(ad);return 0==i.length?null:function(o){return hh(ld(o,i))}}(ud(a)):null}function hd(a){return null!=a?function(a){if(!a)return null;const i=a.filter(ad);return 0==i.length?null:function(o){return Ag(ld(o,i).map(el)).pipe((0,gn.U)(hh))}}(ud(a)):null}function ph(a,i){return null===a?[i]:Array.isArray(a)?[...a,i]:[a,i]}function pd(a){return a?Array.isArray(a)?a:[a]:[]}function gd(a,i){return Array.isArray(a)?a.includes(i):a===i}function Qg(a,i){const o=pd(i);return pd(a).forEach(h=>{gd(o,h)||o.push(h)}),o}function md(a,i){return pd(i).filter(o=>!gd(a,o))}let Zg=(()=>{class a{constructor(){this._rawValidators=[],this._rawAsyncValidators=[],this._onDestroyCallbacks=[]}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(o){this._rawValidators=o||[],this._composedValidatorFn=dd(this._rawValidators)}_setAsyncValidators(o){this._rawAsyncValidators=o||[],this._composedAsyncValidatorFn=hd(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(o){this._onDestroyCallbacks.push(o)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(o=>o()),this._onDestroyCallbacks=[]}reset(o){this.control&&this.control.reset(o)}hasError(o,u){return!!this.control&&this.control.hasError(o,u)}getError(o,u){return this.control?this.control.getError(o,u):null}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275dir=m.lG2({type:a}),a})(),Yn=(()=>{class a extends Zg{get formDirective(){return null}get path(){return null}}return a.\u0275fac=function(){let i;return function(u){return(i||(i=m.n5z(a)))(u||a)}}(),a.\u0275dir=m.lG2({type:a,features:[m.qOj]}),a})();class Ei extends Zg{constructor(){super(...arguments),this._parent=null,this.name=null,this.valueAccessor=null}}let mh=(()=>{class a extends class{constructor(i){this._cd=i}is(i){var o,u,h;return"submitted"===i?!!(null===(o=this._cd)||void 0===o?void 0:o.submitted):!!(null===(h=null===(u=this._cd)||void 0===u?void 0:u.control)||void 0===h?void 0:h[i])}}{constructor(o){super(o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(Ei,2))},a.\u0275dir=m.lG2({type:a,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(o,u){2&o&&m.ekj("ng-untouched",u.is("untouched"))("ng-touched",u.is("touched"))("ng-pristine",u.is("pristine"))("ng-dirty",u.is("dirty"))("ng-valid",u.is("valid"))("ng-invalid",u.is("invalid"))("ng-pending",u.is("pending"))},features:[m.qOj]}),a})();function rl(a,i){(function(a,i){const o=function(a){return a._rawValidators}(a);null!==i.validator?a.setValidators(ph(o,i.validator)):"function"==typeof o&&a.setValidators([o]);const u=function(a){return a._rawAsyncValidators}(a);null!==i.asyncValidator?a.setAsyncValidators(ph(u,i.asyncValidator)):"function"==typeof u&&a.setAsyncValidators([u]);const h=()=>a.updateValueAndValidity();Cu(i._rawValidators,h),Cu(i._rawAsyncValidators,h)})(a,i),i.valueAccessor.writeValue(a.value),function(a,i){i.valueAccessor.registerOnChange(o=>{a._pendingValue=o,a._pendingChange=!0,a._pendingDirty=!0,"change"===a.updateOn&&Ch(a,i)})}(a,i),function(a,i){const o=(u,h)=>{i.valueAccessor.writeValue(u),h&&i.viewToModelUpdate(u)};a.registerOnChange(o),i._registerOnDestroy(()=>{a._unregisterOnChange(o)})}(a,i),function(a,i){i.valueAccessor.registerOnTouched(()=>{a._pendingTouched=!0,"blur"===a.updateOn&&a._pendingChange&&Ch(a,i),"submit"!==a.updateOn&&a.markAsTouched()})}(a,i),function(a,i){if(i.valueAccessor.setDisabledState){const o=u=>{i.valueAccessor.setDisabledState(u)};a.registerOnDisabledChange(o),i._registerOnDestroy(()=>{a._unregisterOnDisabledChange(o)})}}(a,i)}function Cu(a,i){a.forEach(o=>{o.registerOnValidatorChange&&o.registerOnValidatorChange(i)})}function Ch(a,i){a._pendingDirty&&a.markAsDirty(),a.setValue(a._pendingValue,{emitModelToViewChange:!1}),i.viewToModelUpdate(a._pendingValue),a._pendingChange=!1}function ol(a,i){const o=a.indexOf(i);o>-1&&a.splice(o,1)}const ra="VALID",sl="INVALID",or="PENDING",Vo="DISABLED";function Dd(a){return(hs(a)?a.validators:a)||null}function im(a){return Array.isArray(a)?dd(a):a||null}function Uo(a,i){return(hs(i)?i.asyncValidators:a)||null}function Sd(a){return Array.isArray(a)?hd(a):a||null}function hs(a){return null!=a&&!Array.isArray(a)&&"object"==typeof a}class ps{constructor(i,o){this._hasOwnPendingAsyncValidator=!1,this._onCollectionChange=()=>{},this._parent=null,this.pristine=!0,this.touched=!1,this._onDisabledChange=[],this._rawValidators=i,this._rawAsyncValidators=o,this._composedValidatorFn=im(this._rawValidators),this._composedAsyncValidatorFn=Sd(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn}set validator(i){this._rawValidators=this._composedValidatorFn=i}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(i){this._rawAsyncValidators=this._composedAsyncValidatorFn=i}get parent(){return this._parent}get valid(){return this.status===ra}get invalid(){return this.status===sl}get pending(){return this.status==or}get disabled(){return this.status===Vo}get enabled(){return this.status!==Vo}get dirty(){return!this.pristine}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(i){this._rawValidators=i,this._composedValidatorFn=im(i)}setAsyncValidators(i){this._rawAsyncValidators=i,this._composedAsyncValidatorFn=Sd(i)}addValidators(i){this.setValidators(Qg(i,this._rawValidators))}addAsyncValidators(i){this.setAsyncValidators(Qg(i,this._rawAsyncValidators))}removeValidators(i){this.setValidators(md(i,this._rawValidators))}removeAsyncValidators(i){this.setAsyncValidators(md(i,this._rawAsyncValidators))}hasValidator(i){return gd(this._rawValidators,i)}hasAsyncValidator(i){return gd(this._rawAsyncValidators,i)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(i={}){this.touched=!0,this._parent&&!i.onlySelf&&this._parent.markAsTouched(i)}markAllAsTouched(){this.markAsTouched({onlySelf:!0}),this._forEachChild(i=>i.markAllAsTouched())}markAsUntouched(i={}){this.touched=!1,this._pendingTouched=!1,this._forEachChild(o=>{o.markAsUntouched({onlySelf:!0})}),this._parent&&!i.onlySelf&&this._parent._updateTouched(i)}markAsDirty(i={}){this.pristine=!1,this._parent&&!i.onlySelf&&this._parent.markAsDirty(i)}markAsPristine(i={}){this.pristine=!0,this._pendingDirty=!1,this._forEachChild(o=>{o.markAsPristine({onlySelf:!0})}),this._parent&&!i.onlySelf&&this._parent._updatePristine(i)}markAsPending(i={}){this.status=or,!1!==i.emitEvent&&this.statusChanges.emit(this.status),this._parent&&!i.onlySelf&&this._parent.markAsPending(i)}disable(i={}){const o=this._parentMarkedDirty(i.onlySelf);this.status=Vo,this.errors=null,this._forEachChild(u=>{u.disable(Object.assign(Object.assign({},i),{onlySelf:!0}))}),this._updateValue(),!1!==i.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(Object.assign(Object.assign({},i),{skipPristineCheck:o})),this._onDisabledChange.forEach(u=>u(!0))}enable(i={}){const o=this._parentMarkedDirty(i.onlySelf);this.status=ra,this._forEachChild(u=>{u.enable(Object.assign(Object.assign({},i),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:i.emitEvent}),this._updateAncestors(Object.assign(Object.assign({},i),{skipPristineCheck:o})),this._onDisabledChange.forEach(u=>u(!1))}_updateAncestors(i){this._parent&&!i.onlySelf&&(this._parent.updateValueAndValidity(i),i.skipPristineCheck||this._parent._updatePristine(),this._parent._updateTouched())}setParent(i){this._parent=i}updateValueAndValidity(i={}){this._setInitialStatus(),this._updateValue(),this.enabled&&(this._cancelExistingSubscription(),this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===ra||this.status===or)&&this._runAsyncValidator(i.emitEvent)),!1!==i.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!i.onlySelf&&this._parent.updateValueAndValidity(i)}_updateTreeValidity(i={emitEvent:!0}){this._forEachChild(o=>o._updateTreeValidity(i)),this.updateValueAndValidity({onlySelf:!0,emitEvent:i.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?Vo:ra}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(i){if(this.asyncValidator){this.status=or,this._hasOwnPendingAsyncValidator=!0;const o=el(this.asyncValidator(this));this._asyncValidationSubscription=o.subscribe(u=>{this._hasOwnPendingAsyncValidator=!1,this.setErrors(u,{emitEvent:i})})}}_cancelExistingSubscription(){this._asyncValidationSubscription&&(this._asyncValidationSubscription.unsubscribe(),this._hasOwnPendingAsyncValidator=!1)}setErrors(i,o={}){this.errors=i,this._updateControlsErrors(!1!==o.emitEvent)}get(i){return function(a,i,o){if(null==i||(Array.isArray(i)||(i=i.split(".")),Array.isArray(i)&&0===i.length))return null;let u=a;return i.forEach(h=>{u=u instanceof al?u.controls.hasOwnProperty(h)?u.controls[h]:null:u instanceof Eh&&u.at(h)||null}),u}(this,i)}getError(i,o){const u=o?this.get(o):this;return u&&u.errors?u.errors[i]:null}hasError(i,o){return!!this.getError(i,o)}get root(){let i=this;for(;i._parent;)i=i._parent;return i}_updateControlsErrors(i){this.status=this._calculateStatus(),i&&this.statusChanges.emit(this.status),this._parent&&this._parent._updateControlsErrors(i)}_initObservables(){this.valueChanges=new m.vpe,this.statusChanges=new m.vpe}_calculateStatus(){return this._allControlsDisabled()?Vo:this.errors?sl:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(or)?or:this._anyControlsHaveStatus(sl)?sl:ra}_anyControlsHaveStatus(i){return this._anyControls(o=>o.status===i)}_anyControlsDirty(){return this._anyControls(i=>i.dirty)}_anyControlsTouched(){return this._anyControls(i=>i.touched)}_updatePristine(i={}){this.pristine=!this._anyControlsDirty(),this._parent&&!i.onlySelf&&this._parent._updatePristine(i)}_updateTouched(i={}){this.touched=this._anyControlsTouched(),this._parent&&!i.onlySelf&&this._parent._updateTouched(i)}_isBoxedValue(i){return"object"==typeof i&&null!==i&&2===Object.keys(i).length&&"value"in i&&"disabled"in i}_registerOnCollectionChange(i){this._onCollectionChange=i}_setUpdateStrategy(i){hs(i)&&null!=i.updateOn&&(this._updateOn=i.updateOn)}_parentMarkedDirty(i){return!i&&!(!this._parent||!this._parent.dirty)&&!this._parent._anyControlsDirty()}}class Su extends ps{constructor(i=null,o,u){super(Dd(o),Uo(u,o)),this._onChange=[],this._applyFormState(i),this._setUpdateStrategy(o),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}setValue(i,o={}){this.value=this._pendingValue=i,this._onChange.length&&!1!==o.emitModelToViewChange&&this._onChange.forEach(u=>u(this.value,!1!==o.emitViewToModelChange)),this.updateValueAndValidity(o)}patchValue(i,o={}){this.setValue(i,o)}reset(i=null,o={}){this._applyFormState(i),this.markAsPristine(o),this.markAsUntouched(o),this.setValue(this.value,o),this._pendingChange=!1}_updateValue(){}_anyControls(i){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(i){this._onChange.push(i)}_unregisterOnChange(i){ol(this._onChange,i)}registerOnDisabledChange(i){this._onDisabledChange.push(i)}_unregisterOnDisabledChange(i){ol(this._onDisabledChange,i)}_forEachChild(i){}_syncPendingControls(){return!("submit"!==this.updateOn||(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),!this._pendingChange)||(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),0))}_applyFormState(i){this._isBoxedValue(i)?(this.value=this._pendingValue=i.value,i.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=i}}class al extends ps{constructor(i,o,u){super(Dd(o),Uo(u,o)),this.controls=i,this._initObservables(),this._setUpdateStrategy(o),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}registerControl(i,o){return this.controls[i]?this.controls[i]:(this.controls[i]=o,o.setParent(this),o._registerOnCollectionChange(this._onCollectionChange),o)}addControl(i,o,u={}){this.registerControl(i,o),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}removeControl(i,o={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),delete this.controls[i],this.updateValueAndValidity({emitEvent:o.emitEvent}),this._onCollectionChange()}setControl(i,o,u={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),delete this.controls[i],o&&this.registerControl(i,o),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}contains(i){return this.controls.hasOwnProperty(i)&&this.controls[i].enabled}setValue(i,o={}){this._checkAllValuesPresent(i),Object.keys(i).forEach(u=>{this._throwIfControlMissing(u),this.controls[u].setValue(i[u],{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o)}patchValue(i,o={}){null!=i&&(Object.keys(i).forEach(u=>{this.controls[u]&&this.controls[u].patchValue(i[u],{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o))}reset(i={},o={}){this._forEachChild((u,h)=>{u.reset(i[h],{onlySelf:!0,emitEvent:o.emitEvent})}),this._updatePristine(o),this._updateTouched(o),this.updateValueAndValidity(o)}getRawValue(){return this._reduceChildren({},(i,o,u)=>(i[u]=o instanceof Su?o.value:o.getRawValue(),i))}_syncPendingControls(){let i=this._reduceChildren(!1,(o,u)=>!!u._syncPendingControls()||o);return i&&this.updateValueAndValidity({onlySelf:!0}),i}_throwIfControlMissing(i){if(!Object.keys(this.controls).length)throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.controls[i])throw new Error(`Cannot find form control with name: ${i}.`)}_forEachChild(i){Object.keys(this.controls).forEach(o=>{const u=this.controls[o];u&&i(u,o)})}_setUpControls(){this._forEachChild(i=>{i.setParent(this),i._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(i){for(const o of Object.keys(this.controls)){const u=this.controls[o];if(this.contains(o)&&i(u))return!0}return!1}_reduceValue(){return this._reduceChildren({},(i,o,u)=>((o.enabled||this.disabled)&&(i[u]=o.value),i))}_reduceChildren(i,o){let u=i;return this._forEachChild((h,w)=>{u=o(u,h,w)}),u}_allControlsDisabled(){for(const i of Object.keys(this.controls))if(this.controls[i].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_checkAllValuesPresent(i){this._forEachChild((o,u)=>{if(void 0===i[u])throw new Error(`Must supply a value for form control with name: '${u}'.`)})}}class Eh extends ps{constructor(i,o,u){super(Dd(o),Uo(u,o)),this.controls=i,this._initObservables(),this._setUpdateStrategy(o),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}at(i){return this.controls[i]}push(i,o={}){this.controls.push(i),this._registerControl(i),this.updateValueAndValidity({emitEvent:o.emitEvent}),this._onCollectionChange()}insert(i,o,u={}){this.controls.splice(i,0,o),this._registerControl(o),this.updateValueAndValidity({emitEvent:u.emitEvent})}removeAt(i,o={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),this.controls.splice(i,1),this.updateValueAndValidity({emitEvent:o.emitEvent})}setControl(i,o,u={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),this.controls.splice(i,1),o&&(this.controls.splice(i,0,o),this._registerControl(o)),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}get length(){return this.controls.length}setValue(i,o={}){this._checkAllValuesPresent(i),i.forEach((u,h)=>{this._throwIfControlMissing(h),this.at(h).setValue(u,{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o)}patchValue(i,o={}){null!=i&&(i.forEach((u,h)=>{this.at(h)&&this.at(h).patchValue(u,{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o))}reset(i=[],o={}){this._forEachChild((u,h)=>{u.reset(i[h],{onlySelf:!0,emitEvent:o.emitEvent})}),this._updatePristine(o),this._updateTouched(o),this.updateValueAndValidity(o)}getRawValue(){return this.controls.map(i=>i instanceof Su?i.value:i.getRawValue())}clear(i={}){this.controls.length<1||(this._forEachChild(o=>o._registerOnCollectionChange(()=>{})),this.controls.splice(0),this.updateValueAndValidity({emitEvent:i.emitEvent}))}_syncPendingControls(){let i=this.controls.reduce((o,u)=>!!u._syncPendingControls()||o,!1);return i&&this.updateValueAndValidity({onlySelf:!0}),i}_throwIfControlMissing(i){if(!this.controls.length)throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.at(i))throw new Error(`Cannot find form control at index ${i}`)}_forEachChild(i){this.controls.forEach((o,u)=>{i(o,u)})}_updateValue(){this.value=this.controls.filter(i=>i.enabled||this.disabled).map(i=>i.value)}_anyControls(i){return this.controls.some(o=>o.enabled&&i(o))}_setUpControls(){this._forEachChild(i=>this._registerControl(i))}_checkAllValuesPresent(i){this._forEachChild((o,u)=>{if(void 0===i[u])throw new Error(`Must supply a value for form control at index: ${u}.`)})}_allControlsDisabled(){for(const i of this.controls)if(i.enabled)return!1;return this.controls.length>0||this.disabled}_registerControl(i){i.setParent(this),i._registerOnCollectionChange(this._onCollectionChange)}}const ia={provide:Ei,useExisting:(0,m.Gpc)(()=>Td)},Th=(()=>Promise.resolve(null))();let Td=(()=>{class a extends Ei{constructor(o,u,h,w){super(),this.control=new Su,this._registered=!1,this.update=new m.vpe,this._parent=o,this._setValidators(u),this._setAsyncValidators(h),this.valueAccessor=function(a,i){if(!i)return null;let o,u,h;return Array.isArray(i),i.forEach(w=>{w.constructor===ta?o=w:function(a){return Object.getPrototypeOf(a.constructor)===Fo}(w)?u=w:h=w}),h||u||o||null}(0,w)}ngOnChanges(o){this._checkForErrors(),this._registered||this._setUpControl(),"isDisabled"in o&&this._updateDisabled(o),function(a,i){if(!a.hasOwnProperty("model"))return!1;const o=a.model;return!!o.isFirstChange()||!Object.is(i,o.currentValue)}(o,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._parent?function(a,i){return[...i.path,a]}(this.name,this._parent):[this.name]}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(o){this.viewModel=o,this.update.emit(o)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&null!=this.options.updateOn&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!(!this.options||!this.options.standalone)}_setUpStandalone(){rl(this.control,this),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),this._isStandalone()}_updateValue(o){Th.then(()=>{this.control.setValue(o,{emitViewToModelChange:!1})})}_updateDisabled(o){const u=o.isDisabled.currentValue,h=""===u||u&&"false"!==u;Th.then(()=>{h&&!this.control.disabled?this.control.disable():!h&&this.control.disabled&&this.control.enable()})}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(Yn,9),m.Y36(Un,10),m.Y36(Lo,10),m.Y36(Fr,10))},a.\u0275dir=m.lG2({type:a,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:["disabled","isDisabled"],model:["ngModel","model"],options:["ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],features:[m._Bn([ia]),m.qOj,m.TTD]}),a})(),Tu=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({}),a})(),Gh=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[Tu]]}),a})(),Cm=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[Gh]}),a})();var Pu=O(2462);const sa=["demoAppPlayground"],Wh=["queryParamsInput"],bm=[{path:"",component:(()=>{class a{constructor(o,u,h){this.router=o,this.authService=u,this.httpClient=h}ngAfterViewInit(){setTimeout(()=>{const o=window.appSettings.getCurrentUserSettings().otherSettings;if(this.roles=null==o?void 0:o.roles,this.queryParams=null==o?void 0:o.queryParams,this.queryParams){let u="";Object.entries(this.queryParams).forEach(([h,w],T)=>{T>0&&(u+="&"),u+=`${h}=${w}`}),this.queryParamsInputEl.nativeElement.value=u}})}callPrivateApi(o){var u;const{url:h,headers:w}=o.detail;if(h){let T=new mr;null==w||w.split(";").forEach(F=>{var j,J;if(F){const Ee=F.split(":");T=T.append(null===(j=Ee[0])||void 0===j?void 0:j.trim(),(null===(J=Ee[1])||void 0===J?void 0:J.trim())||"")}});const P=null===(u=this.demoAppPlaygroundEl)||void 0===u?void 0:u.nativeElement;this.httpClient.get(h,w?{headers:T}:{}).subscribe({next:F=>null==P?void 0:P.setApiStatus(F,!1),error:F=>null==P?void 0:P.setApiStatus(F,!0)})}}saveSettings(){var o;(null===(o=this.demoAppPlaygroundEl)||void 0===o?void 0:o.nativeElement).saveSettings({roles:this.roles,queryParams:this.queryParams})}onQueryParamsInputChange(o){const u={};null==o||o.split("&").forEach(h=>{const w=h.split("=");2===w.length&&(u[w[0]]=w[1])}),this.queryParams=u,this.saveSettings()}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(nn.F0),m.Y36(yi),m.Y36(Kf))},a.\u0275cmp=m.Xpm({type:a,selectors:[["app-demo"]],viewQuery:function(o,u){if(1&o&&(m.Gf(sa,5),m.Gf(Wh,5)),2&o){let h;m.iGM(h=m.CRH())&&(u.demoAppPlaygroundEl=h.first),m.iGM(h=m.CRH())&&(u.queryParamsInputEl=h.first)}},decls:48,vars:32,consts:[[3,"isRenewing","isAuthenticated","login","logout","silentRenew"],["tabLabel","Playground",3,"api"],["demoAppPlayground",""],[1,"card","routes"],[1,"card-title"],[1,"card-actions","column"],[1,"route","query-params"],[1,"info"],["placeholder","param1=one¶m2=two",3,"input"],["queryParamsInput",""],[1,"route"],["routerLink","/",3,"queryParams"],["routerLink","/public",3,"queryParams"],["routerLink","/private",3,"queryParams"],["routerLink","/protected",3,"queryParams"],["id","roles-input",3,"ngModel","input","keydown.enter","ngModelChange"],[1,"box"],["tabLabel","Debug",3,"isAuthenticated","userProfile","userSession","idToken","idTokenDecoded","accessToken","accessTokenDecoded"],["tabLabel","Settings"]],template:function(o,u){if(1&o){const h=m.EpF();m.TgZ(0,"demo-app-main",0),m.NdJ("login",function(){return u.authService.login()})("logout",function(){return u.authService.logout({redirectUrl:"/"})})("silentRenew",function(){return u.authService.renew()}),m.ALo(1,"async"),m.ALo(2,"async"),m.TgZ(3,"demo-app-playground",1,2),m.NdJ("api",function(T){return u.callPrivateApi(T)}),m.TgZ(5,"div",3),m.TgZ(6,"div",4),m._uU(7,"Routes access"),m.qZA(),m.TgZ(8,"div",5),m.TgZ(9,"div",6),m.TgZ(10,"div",7),m.TgZ(11,"label"),m._uU(12,"Query params"),m.qZA(),m.TgZ(13,"input",8,9),m.NdJ("input",function(){m.CHM(h);const T=m.MAs(14);return u.onQueryParamsInputChange(T.value)}),m.qZA(),m.qZA(),m.qZA(),m.TgZ(15,"div",10),m.TgZ(16,"button",11),m._uU(17,"HOME"),m.qZA(),m.TgZ(18,"div",7),m._uU(19,"Home page"),m.qZA(),m.qZA(),m.TgZ(20,"div",10),m.TgZ(21,"button",12),m._uU(22,"PUBLIC"),m.qZA(),m.TgZ(23,"div",7),m._uU(24,"Public content (no login required)"),m.qZA(),m.qZA(),m.TgZ(25,"div",10),m.TgZ(26,"button",13),m._uU(27,"PRIVATE"),m.qZA(),m.TgZ(28,"div",7),m._uU(29,"Private content (login required)"),m.qZA(),m.qZA(),m.TgZ(30,"div",10),m.TgZ(31,"button",14),m._uU(32,"PROTECTED"),m.qZA(),m.TgZ(33,"div",7),m._uU(34,"Protected content (login required + role(s): "),m.TgZ(35,"input",15),m.NdJ("input",function(){return u.saveSettings()})("keydown.enter",function(){return u.router.navigateByUrl("/protected")})("ngModelChange",function(T){return u.roles=T}),m.qZA(),m._uU(36,") "),m.qZA(),m.qZA(),m.qZA(),m.TgZ(37,"div",16),m._UZ(38,"router-outlet"),m.qZA(),m.qZA(),m.qZA(),m._UZ(39,"demo-app-debug",17),m.ALo(40,"async"),m.ALo(41,"async"),m.ALo(42,"async"),m.ALo(43,"async"),m.ALo(44,"async"),m.ALo(45,"async"),m.ALo(46,"async"),m._UZ(47,"demo-app-settings",18),m.qZA()}2&o&&(m.Q6J("isRenewing",m.lcZ(1,14,u.authService.isRenewing$))("isAuthenticated",m.lcZ(2,16,u.authService.isAuthenticated$)),m.xp6(16),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(4),m.Q6J("ngModel",u.roles),m.xp6(4),m.Q6J("isAuthenticated",m.lcZ(40,18,u.authService.isAuthenticated$))("userProfile",m.lcZ(41,20,u.authService.userProfile$))("userSession",m.lcZ(42,22,u.authService.userSession$))("idToken",m.lcZ(43,24,u.authService.idToken$))("idTokenDecoded",m.lcZ(44,26,u.authService.idTokenDecoded$))("accessToken",m.lcZ(45,28,u.authService.accessToken$))("accessTokenDecoded",m.lcZ(46,30,u.authService.accessTokenDecoded$)))},directives:[nn.rH,ta,mh,Td,nn.lC],pipes:[x.Ov],styles:[":host .card.routes{margin-top:20px}:host .card.routes .route{display:flex;align-items:center}:host .card.routes .route.query-params{margin:0 0 10px 10px}:host .card.routes .route.query-params label{font-size:16px;color:#000;margin-right:12px}:host .card.routes .route.query-params input{width:500px}:host .card.routes .route button{padding:2px 10px;min-width:104px;margin:8px 12px 8px 8px}:host .card.routes .route input{margin:0 2px;padding:4px}:host .card.routes .route .info{padding-bottom:2px;font-size:14px;line-height:22px;text-align:left;color:#0000008a}:host .card.routes .box{height:100px}@media only screen and (max-width: 600px){:host .card.routes{margin-top:12px}:host .card.routes .route{margin-left:3px!important}:host .card.routes .route.query-params .info{display:flex;flex-direction:column;flex:1;grid-gap:8px;gap:8px}:host .card.routes .route.query-params .info input{margin:0;width:inherit;align-self:normal}:host .card.routes .route #roles-input{width:90%}:host .card.routes .route button{margin-left:3px}}\n",".flex{flex:1}.hidden{display:none!important}.row{display:flex;flex-direction:row}.column{display:flex;flex-direction:column}.card{border:1px solid rgba(0,0,0,.12);border-radius:4px;background-color:#fff;margin:12px 6px}.card .card-status{display:block;width:10px;height:10px;border-radius:50%;margin-left:8px;background-color:#f2f2f2}.card .card-status.error{background-color:#ef5350}.card .card-status.success{background-color:#66bb6a}.card .card-title{padding:16px;font-size:20px;font-weight:500;color:#000000de;align-items:center}.card .box{height:200px;border-top:1px solid lightgray;word-break:break-all;overflow:auto;background-color:#f2f2f2;padding:12px}.card .box pre{margin:0}.card .card-actions{padding:0 14px 8px;min-height:50px}.card .card-actions .input{display:flex;align-items:center}.card .card-actions .input:not(:last-child){margin-bottom:8px}.card .card-actions .input label{width:125px;text-align:right;margin-right:14px}.card .card-actions .input input{padding:4px}.json-key{color:#7c4dff}.json-value{color:#437aed}.json-string{color:#53a053}.json-date{color:#c838c6}input{color:#5e35b1;padding:10px;border:1px solid #0000001f;border-radius:4px;font-size:14px}input:invalid{border-color:#f44336}input[type=checkbox]{margin-right:10px}select{color:#5e35b1;padding:8px 6px;border:1px solid #0000001f;border-radius:4px}@media only screen and (max-width: 600px){:host{padding:0 0 24px!important}:host .card{border-left:0;border-right:0;border-radius:0;margin:0 0 6px}}\n"],encapsulation:3}),a})(),children:[{path:"public",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",data:{title:"PUBLIC CONTENT"}},{path:"private",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",canLoad:[cs],canActivate:[cs],canActivateChild:[cs],data:{title:"PRIVATE CONTENT"}},{path:"forbidden",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",data:{title:"ACCESS FORBIDDEN"}},{path:"protected",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",canLoad:[cs],canActivate:[cs],canActivateChild:[cs],data:{title:"PROTECTED CONTENT",authGuardValidator:(a,i)=>{var o,u,h,w,T;const{otherSettings:P,librarySettings:F}=window.appSettings.getCurrentUserSettings(),j=P&&(null===(o=P.roles)||void 0===o?void 0:o.split(","))||[];let J;if(F.authorityUrl.includes("auth0"))J=null===(u=i)||void 0===u?void 0:u["http://ngx-auth.com/roles"];else if(F.authorityUrl.includes("zitadel")){const Ee=null===(h=i)||void 0===h?void 0:h["urn:zitadel:iam:org:project:roles"];J=Object.keys(null!=Ee?Ee:{})}else J=null===(T=null===(w=i.resource_access)||void 0===w?void 0:w.account)||void 0===T?void 0:T.roles;return j.every(Ee=>(null!=J?J:[]).includes(Ee))}}}]}];let wm=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[nn.Bz.forChild(bm)],nn.Bz]}),a})(),kd=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[x.ez,wm,Cm,Xf,Pu.PageModule]]}),a})(),Ti=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a,bootstrap:[Og]}),a.\u0275inj=m.cJS({imports:[[Pg,lr,x.ez,kd,nh]]}),a})();const Rn=new class{constructor(i,o){this.storageKey=i,this.defaultAppSettings=o,this.implementations=[{label:"VanillaJS",demoUrl:"https://badisi.github.io/auth-js/demo-app/auth-js",version:`${qg.u2}@main`},{label:"Angular",demoUrl:"https://badisi.github.io/auth-js/demo-app/ngx-auth",version:`${uh.u2}@main`}],this.defaultAppSettings.librarySettingsDefinition.forEach((u,h)=>u._sortIndex=h)}getImplementations(){return this.implementations}setShowTip(i){const o=this.get();o.showTip=i,this.saveAppSettings(o)}setCurrentTabIndex(i){const o=this.get();o.currentTabIndex=i,this.saveAppSettings(o)}addOrUpdateUserSettings(i){const o=this.get(),u=o.userSettings.findIndex(h=>h.name===i.name);-1!==u?o.userSettings[u]=i:o.userSettings.push(i),this.saveAppSettings(o)}deleteCurrentUserSettings(){const i=this.get(),{name:o}=this.getCurrentUserSettings(),u=i.userSettings.findIndex(h=>h.name===o);-1!==u&&(i.userSettings.splice(u,1),delete i.currentUserSettingsId,this.saveAppSettings(i))}setCurrentUserSettings(i){const o=this.get();-1!==o.userSettings.findIndex(h=>h.name===i)&&(o.currentUserSettingsId=i,this.saveAppSettings(o))}getCurrentUserSettings(){const i=this.get(),o=i.userSettings.findIndex(u=>u.name===i.currentUserSettingsId);return-1!==o?i.userSettings[o]:i.userSettings.sort((u,h)=>u.name.localeCompare(h.name))[0]}get(){const i=sessionStorage.getItem(this.storageKey);if(i){const o=Object.assign(Object.assign({},this.defaultAppSettings),JSON.parse(i));return this.defaultAppSettings.userSettings.forEach(u=>{o.userSettings.find(h=>h.name===u.name)||o.userSettings.push(u)}),o}return Object.assign({},this.defaultAppSettings)}saveAppSettings(i){delete i.librarySettingsDefinition,sessionStorage.setItem(this.storageKey,JSON.stringify(i))}}(`ngx-auth:${uh.i8}:demo-app:settings`,{showTip:!0,currentTabIndex:0,userSettings:((a=!1)=>{const i=((a=!1)=>{const i=[{name:"Auth0",otherSettings:{privateApiUrl:"https://dev-fijd1e9x.us.auth0.com/api/v2/users/auth0|631b171682c639d40cb84d5c",privateApiHeaders:""},librarySettings:{authorityUrl:"https://dev-fijd1e9x.us.auth0.com",clientId:"kRVVEnAWKMpxxpcodl0TqLXfIHgQvmmt",mobileScheme:"demo-app",scope:"openid profile email phone offline_access read:current_user",internal:{extraQueryParams:{audience:"https://dev-fijd1e9x.us.auth0.com/api/v2/"}},desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}},{name:"Zitadel",otherSettings:{privateApiUrl:"",privateApiHeaders:""},librarySettings:{authorityUrl:"https://auth-js-0pdipf.zitadel.cloud",clientId:"178200751804317953@demo-app",mobileScheme:"demo-app",scope:"openid profile email phone offline_access",desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}];return a||i.push({name:"Keycloak (local)",otherSettings:{privateApiUrl:"/api/my-api",privateApiHeaders:""},librarySettings:{authorityUrl:"http://localhost:8080/auth/realms/demo",clientId:"demo-app",mobileScheme:"demo-app",scope:"openid profile email phone",desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}),i})(a),o=[{name:"Auth0",otherSettings:Object.assign(Object.assign({},i[0].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[0].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})},{name:"Zitadel",otherSettings:Object.assign(Object.assign({},i[1].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[1].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})}];return a||o.push({name:"Keycloak (local)",otherSettings:Object.assign(Object.assign({},i[i.length-1].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[i.length-1].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})}),o})(true),librarySettingsDefinition:rd});(0,m.G48)(),(()=>{window.appSettings=Rn;const a=document.createElement("div");a.innerHTML="Loading...",document.body.appendChild(a),Rg(Rn.getCurrentUserSettings().librarySettings).then(i=>{a.replaceWith(document.createElement("app-root")),Go([i]).bootstrapModule(Ti).catch(o=>console.error(o))}).catch(i=>{var o;a.innerHTML=`${i.message}
`,null===(o=document.body.querySelector("#loginButton"))||void 0===o||o.addEventListener("click",()=>location.reload(),{once:!0})})})()},9647:Ie=>{function ne(O){return Promise.resolve().then(()=>{var x=new Error("Cannot find module '"+O+"'");throw x.code="MODULE_NOT_FOUND",x})}ne.keys=()=>[],ne.resolve=ne,ne.id=9647,Ie.exports=ne},2480:()=>{},7582:(Ie,ne,O)=>{"use strict";function Q(G,q){var oe={};for(var ie in G)Object.prototype.hasOwnProperty.call(G,ie)&&q.indexOf(ie)<0&&(oe[ie]=G[ie]);if(null!=G&&"function"==typeof Object.getOwnPropertySymbols){var De=0;for(ie=Object.getOwnPropertySymbols(G);De1||ht(_t,Kt)})})}function ht(_t,Kt){try{!function(_t){_t.value instanceof de?Promise.resolve(_t.value.v).then(Pe,Ue):kt(Ce[0][2],_t)}(ie[_t](Kt))}catch(Ct){kt(Ce[0][3],Ct)}}function Pe(_t){ht("next",_t)}function Ue(_t){ht("throw",_t)}function kt(_t,Kt){_t(Kt),Ce.shift(),Ce.length&&ht(Ce[0][0],Ce[0][1])}}function at(G){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var oe,q=G[Symbol.asyncIterator];return q?q.call(G):(G=function(G){var q="function"==typeof Symbol&&Symbol.iterator,oe=q&&G[q],ie=0;if(oe)return oe.call(G);if(G&&"number"==typeof G.length)return{next:function(){return G&&ie>=G.length&&(G=void 0),{value:G&&G[ie++],done:!G}}};throw new TypeError(q?"Object is not iterable.":"Symbol.iterator is not defined.")}(G),oe={},ie("next"),ie("throw"),ie("return"),oe[Symbol.asyncIterator]=function(){return this},oe);function ie(Ce){oe[Ce]=G[Ce]&&function(Ne){return new Promise(function(ht,qe){!function(Ce,Ne,ht,qe){Promise.resolve(qe).then(function(Pe){Ce({value:Pe,done:ht})},Ne)}(ht,qe,(Ne=G[Ce](Ne)).done,Ne.value)})}}}O.d(ne,{_T:()=>Q,mG:()=>_e,qq:()=>de,FC:()=>he,KL:()=>at}),"function"==typeof SuppressedError&&SuppressedError}},Ie=>{Ie(Ie.s=4159)}]); \ No newline at end of file +var jI=Object.defineProperty,BI=Object.defineProperties,HI=Object.getOwnPropertyDescriptors,Sp=Object.getOwnPropertySymbols,Zw=Object.prototype.hasOwnProperty,Xw=Object.prototype.propertyIsEnumerable,e0=(Ie,ne,O)=>ne in Ie?jI(Ie,ne,{enumerable:!0,configurable:!0,writable:!0,value:O}):Ie[ne]=O,dn=(Ie,ne)=>{for(var O in ne||(ne={}))Zw.call(ne,O)&&e0(Ie,O,ne[O]);if(Sp)for(var O of Sp(ne))Xw.call(ne,O)&&e0(Ie,O,ne[O]);return Ie},Tp=(Ie,ne)=>BI(Ie,HI(ne)),Lr=(Ie,ne)=>{var O={};for(var x in Ie)Zw.call(Ie,x)&&ne.indexOf(x)<0&&(O[x]=Ie[x]);if(null!=Ie&&Sp)for(var x of Sp(Ie))ne.indexOf(x)<0&&Xw.call(Ie,x)&&(O[x]=Ie[x]);return O};(self.webpackChunk_badisi_auth_js=self.webpackChunk_badisi_auth_js||[]).push([[179],{8583:(Ie,ne,O)=>{"use strict";O.d(ne,{mr:()=>ge,Ov:()=>Li,ez:()=>Sl,K0:()=>Z,Do:()=>de,V_:()=>re,Ye:()=>he,S$:()=>je,b0:()=>se,lw:()=>ye,EM:()=>Ca,JF:()=>yo,w_:()=>Ae,bD:()=>li,q:()=>ce,Mx:()=>Ut,HT:()=>ee});var x=O(7525);let m=null;function ce(){return m}function ee(C){m||(m=C)}class Ae{}const Z=new x.OlP("DocumentToken");let ye=(()=>{class C{historyGo(b){throw new Error("Not implemented")}}return C.\u0275fac=function(b){return new(b||C)},C.\u0275prov=(0,x.Yz7)({factory:pe,token:C,providedIn:"platform"}),C})();function pe(){return(0,x.LFG)(Y)}const re=new x.OlP("Location Initialized");let Y=(()=>{class C extends ye{constructor(b){super(),this._doc=b,this._init()}_init(){this.location=window.location,this._history=window.history}getBaseHrefFromDOM(){return ce().getBaseHref(this._doc)}onPopState(b){const M=ce().getGlobalEventTarget(this._doc,"window");return M.addEventListener("popstate",b,!1),()=>M.removeEventListener("popstate",b)}onHashChange(b){const M=ce().getGlobalEventTarget(this._doc,"window");return M.addEventListener("hashchange",b,!1),()=>M.removeEventListener("hashchange",b)}get href(){return this.location.href}get protocol(){return this.location.protocol}get hostname(){return this.location.hostname}get port(){return this.location.port}get pathname(){return this.location.pathname}get search(){return this.location.search}get hash(){return this.location.hash}set pathname(b){this.location.pathname=b}pushState(b,M,V){_e()?this._history.pushState(b,M,V):this.location.hash=V}replaceState(b,M,V){_e()?this._history.replaceState(b,M,V):this.location.hash=V}forward(){this._history.forward()}back(){this._history.back()}historyGo(b=0){this._history.go(b)}getState(){return this._history.state}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(Z))},C.\u0275prov=(0,x.Yz7)({factory:xe,token:C,providedIn:"platform"}),C})();function _e(){return!!window.history.pushState}function xe(){return new Y((0,x.LFG)(Z))}function z(C,S){if(0==C.length)return S;if(0==S.length)return C;let b=0;return C.endsWith("/")&&b++,S.startsWith("/")&&b++,2==b?C+S.substring(1):1==b?C+S:C+"/"+S}function Oe(C){const S=C.match(/#|\?|$/),b=S&&S.index||C.length;return C.slice(0,b-("/"===C[b-1]?1:0))+C.slice(b)}function ue(C){return C&&"?"!==C[0]?"?"+C:C}let je=(()=>{class C{historyGo(b){throw new Error("Not implemented")}}return C.\u0275fac=function(b){return new(b||C)},C.\u0275prov=(0,x.Yz7)({factory:te,token:C,providedIn:"root"}),C})();function te(C){const S=(0,x.LFG)(Z).location;return new se((0,x.LFG)(ye),S&&S.origin||"")}const ge=new x.OlP("appBaseHref");let se=(()=>{class C extends je{constructor(b,M){if(super(),this._platformLocation=b,this._removeListenerFns=[],null==M&&(M=this._platformLocation.getBaseHrefFromDOM()),null==M)throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");this._baseHref=M}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(b){this._removeListenerFns.push(this._platformLocation.onPopState(b),this._platformLocation.onHashChange(b))}getBaseHref(){return this._baseHref}prepareExternalUrl(b){return z(this._baseHref,b)}path(b=!1){const M=this._platformLocation.pathname+ue(this._platformLocation.search),V=this._platformLocation.hash;return V&&b?`${M}${V}`:M}pushState(b,M,V,K){const fe=this.prepareExternalUrl(V+ue(K));this._platformLocation.pushState(b,M,fe)}replaceState(b,M,V,K){const fe=this.prepareExternalUrl(V+ue(K));this._platformLocation.replaceState(b,M,fe)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformLocation).historyGo)||void 0===V||V.call(M,b)}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(ye),x.LFG(ge,8))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})(),de=(()=>{class C extends je{constructor(b,M){super(),this._platformLocation=b,this._baseHref="",this._removeListenerFns=[],null!=M&&(this._baseHref=M)}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(b){this._removeListenerFns.push(this._platformLocation.onPopState(b),this._platformLocation.onHashChange(b))}getBaseHref(){return this._baseHref}path(b=!1){let M=this._platformLocation.hash;return null==M&&(M="#"),M.length>0?M.substring(1):M}prepareExternalUrl(b){const M=z(this._baseHref,b);return M.length>0?"#"+M:M}pushState(b,M,V,K){let fe=this.prepareExternalUrl(V+ue(K));0==fe.length&&(fe=this._platformLocation.pathname),this._platformLocation.pushState(b,M,fe)}replaceState(b,M,V,K){let fe=this.prepareExternalUrl(V+ue(K));0==fe.length&&(fe=this._platformLocation.pathname),this._platformLocation.replaceState(b,M,fe)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformLocation).historyGo)||void 0===V||V.call(M,b)}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(ye),x.LFG(ge,8))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})(),he=(()=>{class C{constructor(b,M){this._subject=new x.vpe,this._urlChangeListeners=[],this._platformStrategy=b;const V=this._platformStrategy.getBaseHref();this._platformLocation=M,this._baseHref=Oe(Se(V)),this._platformStrategy.onPopState(K=>{this._subject.emit({url:this.path(!0),pop:!0,state:K.state,type:K.type})})}path(b=!1){return this.normalize(this._platformStrategy.path(b))}getState(){return this._platformLocation.getState()}isCurrentPathEqualTo(b,M=""){return this.path()==this.normalize(b+ue(M))}normalize(b){return C.stripTrailingSlash(function(C,S){return C&&S.startsWith(C)?S.substring(C.length):S}(this._baseHref,Se(b)))}prepareExternalUrl(b){return b&&"/"!==b[0]&&(b="/"+b),this._platformStrategy.prepareExternalUrl(b)}go(b,M="",V=null){this._platformStrategy.pushState(V,"",b,M),this._notifyUrlChangeListeners(this.prepareExternalUrl(b+ue(M)),V)}replaceState(b,M="",V=null){this._platformStrategy.replaceState(V,"",b,M),this._notifyUrlChangeListeners(this.prepareExternalUrl(b+ue(M)),V)}forward(){this._platformStrategy.forward()}back(){this._platformStrategy.back()}historyGo(b=0){var M,V;null===(V=(M=this._platformStrategy).historyGo)||void 0===V||V.call(M,b)}onUrlChange(b){this._urlChangeListeners.push(b),this._urlChangeSubscription||(this._urlChangeSubscription=this.subscribe(M=>{this._notifyUrlChangeListeners(M.url,M.state)}))}_notifyUrlChangeListeners(b="",M){this._urlChangeListeners.forEach(V=>V(b,M))}subscribe(b,M,V){return this._subject.subscribe({next:b,error:M,complete:V})}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(je),x.LFG(ye))},C.normalizeQueryParams=ue,C.joinWithSlash=z,C.stripTrailingSlash=Oe,C.\u0275prov=(0,x.Yz7)({factory:be,token:C,providedIn:"root"}),C})();function be(){return new he((0,x.LFG)(je),(0,x.LFG)(ye))}function Se(C){return C.replace(/\/index.html$/,"")}var ve=(()=>((ve=ve||{})[ve.Zero=0]="Zero",ve[ve.One=1]="One",ve[ve.Two=2]="Two",ve[ve.Few=3]="Few",ve[ve.Many=4]="Many",ve[ve.Other=5]="Other",ve))();const bt=x.kL8;class en{}let zt=(()=>{class C extends en{constructor(b){super(),this.locale=b}getPluralCategory(b,M){switch(bt(M||this.locale)(b)){case ve.Zero:return"zero";case ve.One:return"one";case ve.Two:return"two";case ve.Few:return"few";case ve.Many:return"many";default:return"other"}}}return C.\u0275fac=function(b){return new(b||C)(x.LFG(x.soG))},C.\u0275prov=x.Yz7({token:C,factory:C.\u0275fac}),C})();function Ut(C,S){S=encodeURIComponent(S);for(const b of C.split(";")){const M=b.indexOf("="),[V,K]=-1==M?[b,""]:[b.slice(0,M),b.slice(M+1)];if(V.trim()===S)return decodeURIComponent(K)}return null}class zo{createSubscription(S,b){return S.subscribe({next:b,error:M=>{throw M}})}dispose(S){S.unsubscribe()}onDestroy(S){S.unsubscribe()}}class Xn{createSubscription(S,b){return S.then(b,M=>{throw M})}dispose(S){}onDestroy(S){}}const Dn=new Xn,po=new zo;let Li=(()=>{class C{constructor(b){this._ref=b,this._latestValue=null,this._subscription=null,this._obj=null,this._strategy=null}ngOnDestroy(){this._subscription&&this._dispose()}transform(b){return this._obj?b!==this._obj?(this._dispose(),this.transform(b)):this._latestValue:(b&&this._subscribe(b),this._latestValue)}_subscribe(b){this._obj=b,this._strategy=this._selectStrategy(b),this._subscription=this._strategy.createSubscription(b,M=>this._updateLatestValue(b,M))}_selectStrategy(b){if((0,x.QGY)(b))return Dn;if((0,x.F4k)(b))return po;throw function(C,S){return Error(`InvalidPipeArgument: '${S}' for pipe '${(0,x.AaK)(C)}'`)}(C,b)}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(b,M){b===this._obj&&(this._latestValue=M,this._ref.markForCheck())}}return C.\u0275fac=function(b){return new(b||C)(x.Y36(x.sBO,16))},C.\u0275pipe=x.Yjl({name:"async",type:C,pure:!1}),C})(),Sl=(()=>{class C{}return C.\u0275fac=function(b){return new(b||C)},C.\u0275mod=x.oAB({type:C}),C.\u0275inj=x.cJS({providers:[{provide:en,useClass:zt}]}),C})();const li="browser";let Ca=(()=>{class C{}return C.\u0275prov=(0,x.Yz7)({token:C,providedIn:"root",factory:()=>new ba((0,x.LFG)(Z),window)}),C})();class ba{constructor(S,b){this.document=S,this.window=b,this.offset=()=>[0,0]}setOffset(S){this.offset=Array.isArray(S)?()=>S:S}getScrollPosition(){return this.supportsScrolling()?[this.window.pageXOffset,this.window.pageYOffset]:[0,0]}scrollToPosition(S){this.supportsScrolling()&&this.window.scrollTo(S[0],S[1])}scrollToAnchor(S){if(!this.supportsScrolling())return;const b=function(C,S){const b=C.getElementById(S)||C.getElementsByName(S)[0];if(b)return b;if("function"==typeof C.createTreeWalker&&C.body&&(C.body.createShadowRoot||C.body.attachShadow)){const M=C.createTreeWalker(C.body,NodeFilter.SHOW_ELEMENT);let V=M.currentNode;for(;V;){const K=V.shadowRoot;if(K){const fe=K.getElementById(S)||K.querySelector(`[name="${S}"]`);if(fe)return fe}V=M.nextNode()}}return null}(this.document,S);b&&(this.scrollToElement(b),this.attemptFocus(b))}setHistoryScrollRestoration(S){if(this.supportScrollRestoration()){const b=this.window.history;b&&b.scrollRestoration&&(b.scrollRestoration=S)}}scrollToElement(S){const b=S.getBoundingClientRect(),M=b.left+this.window.pageXOffset,V=b.top+this.window.pageYOffset,K=this.offset();this.window.scrollTo(M-K[0],V-K[1])}attemptFocus(S){return S.focus(),this.document.activeElement===S}supportScrollRestoration(){try{if(!this.supportsScrolling())return!1;const S=Br(this.window.history)||Br(Object.getPrototypeOf(this.window.history));return!(!S||!S.writable&&!S.set)}catch(S){return!1}}supportsScrolling(){try{return!!this.window&&!!this.window.scrollTo&&"pageXOffset"in this.window}catch(S){return!1}}}function Br(C){return Object.getOwnPropertyDescriptor(C,"scrollRestoration")}class yo{}},7525:(Ie,ne,O)=>{"use strict";O.d(ne,{deG:()=>xp,tb:()=>uw,AFp:()=>sw,ip1:()=>w_,CZH:()=>Ku,hGG:()=>$A,z2F:()=>of,sBO:()=>xD,Sil:()=>rf,_Vd:()=>Bu,EJc:()=>dw,SBq:()=>Ho,qLn:()=>us,vpe:()=>$o,gxx:()=>Uo,tBr:()=>zs,XFs:()=>Ge,OlP:()=>Zt,zs3:()=>Jt,ZZ4:()=>np,aQg:()=>rp,soG:()=>pp,YKP:()=>XC,v3s:()=>wA,h0i:()=>gl,PXZ:()=>mA,R0b:()=>Qr,FiY:()=>gi,Lbi:()=>lw,g9A:()=>aw,Qsj:()=>gD,FYo:()=>tp,JOm:()=>qi,Tiy:()=>Jm,q3G:()=>jt,tp0:()=>Mo,EAV:()=>TA,Rgc:()=>Wd,dDg:()=>gw,DyG:()=>Gl,GfV:()=>WC,s_b:()=>sp,ifc:()=>ct,eFA:()=>bw,G48:()=>uA,Gpc:()=>ge,_c5:()=>kA,VLi:()=>lA,c2e:()=>cw,zSh:()=>hs,wAp:()=>Je,vHH:()=>be,EiD:()=>Hc,mCW:()=>Or,qzn:()=>Po,JVY:()=>Oc,pB0:()=>hg,eBb:()=>Fc,L6k:()=>Nc,LAX:()=>kc,cg1:()=>Bm,Tjo:()=>NA,kL8:()=>hC,yhl:()=>Pc,dqk:()=>Ot,sIi:()=>Ou,CqO:()=>Pm,QGY:()=>Rm,F4k:()=>bv,RDi:()=>K,AaK:()=>ue,z3N:()=>Xt,qOj:()=>Hh,TTD:()=>Ms,_Bn:()=>jC,xp6:()=>kg,uIk:()=>u,ekj:()=>km,Suo:()=>Vb,Xpm:()=>ti,lG2:()=>Wo,Yz7:()=>bt,cJS:()=>wn,oAB:()=>ur,Yjl:()=>ha,Y36:()=>Vd,_UZ:()=>_v,qZA:()=>xm,TgZ:()=>Mm,EpF:()=>Cv,n5z:()=>zr,Ikx:()=>jm,LFG:()=>ln,$8M:()=>To,NdJ:()=>Om,CRH:()=>Ub,ALo:()=>Pb,lcZ:()=>Ob,Q6J:()=>Am,iGM:()=>kb,MAs:()=>kr,CHM:()=>Il,LSH:()=>Ya,kYT:()=>ho,_uU:()=>Yv,Oqu:()=>Vm,Gf:()=>Lb});var x=O(549),m=O(5955),ce=O(9018),Q=O(8007),ee=O(9517),Z=O(9359),ye=O(9593),pe=O(7980),re=O(817),Y=O(2085);function xe(e,t,...n){if(!0===t)return void e();if(!1===t)return;const r=new re.Hp({next:()=>{r.unsubscribe(),e()}});return(0,m.Xf)(t(...n)).subscribe(r)}function z(e){for(let t in e)if(e[t]===z)return t;throw Error("Could not find renamed property on target object.")}function Oe(e,t){for(const n in t)t.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(e[n]=t[n])}function ue(e){if("string"==typeof e)return e;if(Array.isArray(e))return"["+e.map(ue).join(", ")+"]";if(null==e)return""+e;if(e.overriddenName)return`${e.overriddenName}`;if(e.name)return`${e.name}`;const t=e.toString();if(null==t)return""+t;const n=t.indexOf("\n");return-1===n?t:t.substring(0,n)}function je(e,t){return null==e||""===e?null===t?"":t:null==t||""===t?e:e+" "+t}const te=z({__forward_ref__:z});function ge(e){return e.__forward_ref__=ge,e.toString=function(){return ue(this())},e}function se(e){return de(e)?e():e}function de(e){return"function"==typeof e&&e.hasOwnProperty(te)&&e.__forward_ref__===ge}class be extends Error{constructor(t,n){super(function(e,t){return`${e?`NG0${e}: `:""}${t}`}(t,n)),this.code=t}}function ae(e){return"string"==typeof e?e:null==e?"":String(e)}function Le(e){return"function"==typeof e?e.name||e.toString():"object"==typeof e&&null!=e&&"function"==typeof e.type?e.type.name||e.type.toString():ae(e)}function pt(e,t){const n=t?` in ${t}`:"";throw new be("201",`No provider for ${Le(e)} found${n}`)}function Pe(e,t){null==e&&function(e,t,n,r){throw new Error(`ASSERTION ERROR: ${e}`+(null==r?"":` [Expected=> ${n} ${r} ${t} <=Actual]`))}(t,e,null,"!=")}function bt(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}function wn(e){return{providers:e.providers||[],imports:e.imports||[]}}function fn(e){return da(e,uo)||da(e,vs)}function da(e,t){return e.hasOwnProperty(t)?e[t]:null}function ys(e){return e&&(e.hasOwnProperty(co)||e.hasOwnProperty(Oi))?e[co]:null}const uo=z({\u0275prov:z}),co=z({\u0275inj:z}),vs=z({ngInjectableDef:z}),Oi=z({ngInjectorDef:z});var Ge=(()=>((Ge=Ge||{})[Ge.Default=0]="Default",Ge[Ge.Host=1]="Host",Ge[Ge.Self=2]="Self",Ge[Ge.SkipSelf=4]="SkipSelf",Ge[Ge.Optional=8]="Optional",Ge))();let Vt;function ze(e){const t=Vt;return Vt=e,t}function tt(e,t,n){const r=fn(e);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:n&Ge.Optional?null:void 0!==t?t:void pt(ue(e),"Injector")}function Gt(e){return{toString:e}.toString()}var hn=(()=>((hn=hn||{})[hn.OnPush=0]="OnPush",hn[hn.Default=1]="Default",hn))(),ct=(()=>((ct=ct||{})[ct.Emulated=0]="Emulated",ct[ct.None=2]="None",ct[ct.ShadowDom=3]="ShadowDom",ct))();const fa="undefined"!=typeof globalThis&&globalThis,dt="undefined"!=typeof window&&window,bs="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,Ot=fa||"undefined"!=typeof global&&global||dt||bs,sn={},vt=[],ei=z({\u0275cmp:z}),Ni=z({\u0275dir:z}),fo=z({\u0275pipe:z}),Go=z({\u0275mod:z}),Es=z({\u0275loc:z}),lr=z({\u0275fac:z}),Fi=z({__NG_ELEMENT_ID__:z});let Ds=0;function ti(e){return Gt(()=>{const n={},r={type:e.type,providersResolver:null,decls:e.decls,vars:e.vars,factory:null,template:e.template||null,consts:e.consts||null,ngContentSelectors:e.ngContentSelectors,hostBindings:e.hostBindings||null,hostVars:e.hostVars||0,hostAttrs:e.hostAttrs||null,contentQueries:e.contentQueries||null,declaredInputs:n,inputs:null,outputs:null,exportAs:e.exportAs||null,onPush:e.changeDetection===hn.OnPush,directiveDefs:null,pipeDefs:null,selectors:e.selectors||vt,viewQuery:e.viewQuery||null,features:e.features||null,data:e.data||{},encapsulation:e.encapsulation||ct.Emulated,id:"c",styles:e.styles||vt,_:null,setInput:null,schemas:e.schemas||null,tView:null},s=e.directives,l=e.features,c=e.pipes;return r.id+=Ds++,r.inputs=Vr(e.inputs,n),r.outputs=Vr(e.outputs),l&&l.forEach(d=>d(r)),r.directiveDefs=s?()=>("function"==typeof s?s():s).map(lt):null,r.pipeDefs=c?()=>("function"==typeof c?c():c).map(an):null,r})}function lt(e){return Wt(e)||function(e){return e[Ni]||null}(e)}function an(e){return function(e){return e[fo]||null}(e)}const ri={};function ur(e){return Gt(()=>{const t={type:e.type,bootstrap:e.bootstrap||vt,declarations:e.declarations||vt,imports:e.imports||vt,exports:e.exports||vt,transitiveCompileScopes:null,schemas:e.schemas||null,id:e.id||null};return null!=e.id&&(ri[e.id]=e.type),t})}function ho(e,t){return Gt(()=>{const n=pn(e,!0);n.declarations=t.declarations||vt,n.imports=t.imports||vt,n.exports=t.exports||vt})}function Vr(e,t){if(null==e)return sn;const n={};for(const r in e)if(e.hasOwnProperty(r)){let s=e[r],l=s;Array.isArray(s)&&(l=s[1],s=s[0]),n[s]=r,t&&(t[s]=l)}return n}const Wo=ti;function ha(e){return{type:e.type,name:e.name,factory:null,pure:!1!==e.pure,onDestroy:e.type.prototype.ngOnDestroy||null}}function Wt(e){return e[ei]||null}function pn(e,t){const n=e[Go]||null;if(!n&&!0===t)throw new Error(`Type ${ue(e)} does not have '\u0275mod' property.`);return n}function Xn(e){return Array.isArray(e)&&"object"==typeof e[1]}function Dn(e){return Array.isArray(e)&&!0===e[1]}function po(e){return 0!=(8&e.flags)}function Li(e){return 2==(2&e.flags)}function go(e){return 1==(1&e.flags)}function Wn(e){return null!==e.template}function mo(e){return 0!=(512&e[2])}function ui(e,t){return e.hasOwnProperty(lr)?e[lr]:null}class jr{constructor(t,n,r){this.previousValue=t,this.currentValue=n,this.firstChange=r}isFirstChange(){return this.firstChange}}function Ms(){return va}function va(e){return e.type.prototype.ngOnChanges&&(e.setInput=ba),Ca}function Ca(){const e=ci(this),t=null==e?void 0:e.current;if(t){const n=e.previous;if(n===sn)e.previous=t;else for(let r in t)n[r]=t[r];e.current=null,this.ngOnChanges(t)}}function ba(e,t,n,r){const s=ci(e)||function(e,t){return e[Br]=t}(e,{previous:sn,current:null}),l=s.current||(s.current={}),c=s.previous,d=this.declaredInputs[n],g=c[d];l[d]=new jr(g&&g.currentValue,t,c===sn),e[r]=t}Ms.ngInherit=!0;const Br="__ngSimpleChanges__";function ci(e){return e[Br]||null}let V;function K(e){V=e}function $e(e){return!!e.listen}const Dt={createRenderer:(e,t)=>void 0!==V?V:"undefined"!=typeof document?document:void 0};function ut(e){for(;Array.isArray(e);)e=e[0];return e}function kn(e,t){return ut(t[e])}function qt(e,t){return ut(t[e.index])}function dr(e,t){return e.data[t]}function $r(e,t){return e[t]}function _n(e,t){const n=t[e];return Xn(n)?n:n[0]}function Yo(e){return 4==(4&e[2])}function wa(e){return 128==(128&e[2])}function Sr(e,t){return null==t?null:e[t]}function Al(e){e[18]=0}function Rs(e,t){e[5]+=t;let n=e,r=e[3];for(;null!==r&&(1===t&&1===n[5]||-1===t&&0===n[5]);)r[5]+=t,n=r,r=r[3]}const Ye={lFrame:Ll(null),bindingsEnabled:!0,isInCheckNoChangesMode:!1};function Hi(){return Ye.bindingsEnabled}function le(){return Ye.lFrame.lView}function mt(){return Ye.lFrame.tView}function Il(e){return Ye.lFrame.contextLView=e,e[8]}function tn(){let e=Ml();for(;null!==e&&64===e.type;)e=e.parent;return e}function Ml(){return Ye.lFrame.currentTNode}function Tr(e,t){const n=Ye.lFrame;n.currentTNode=e,n.isParent=t}function Ea(){return Ye.lFrame.isParent}function Ps(){return Ye.isInCheckNoChangesMode}function Os(e){Ye.isInCheckNoChangesMode=e}function tr(){return Ye.lFrame.bindingIndex++}function Ol(e,t){const n=Ye.lFrame;n.bindingIndex=n.bindingRootIndex=e,Ta(t)}function Ta(e){Ye.lFrame.currentDirectiveIndex=e}function Fl(){return Ye.lFrame.currentQueryIndex}function Aa(e){Ye.lFrame.currentQueryIndex=e}function oc(e){const t=e[1];return 2===t.type?t.declTNode:1===t.type?e[6]:null}function Ns(e,t,n){if(n&Ge.SkipSelf){let s=t,l=e;for(;!(s=s.parent,null!==s||n&Ge.Host||(s=oc(l),null===s||(l=l[15],10&s.type))););if(null===s)return!1;t=s,e=l}const r=Ye.lFrame=kl();return r.currentTNode=t,r.lView=e,!0}function Fs(e){const t=kl(),n=e[1];Ye.lFrame=t,t.currentTNode=n.firstChild,t.lView=e,t.tView=n,t.contextLView=e,t.bindingIndex=n.bindingStartIndex,t.inI18n=!1}function kl(){const e=Ye.lFrame,t=null===e?null:e.child;return null===t?Ll(e):t}function Ll(e){const t={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:e,child:null,inI18n:!1};return null!==e&&(e.child=t),t}function ks(){const e=Ye.lFrame;return Ye.lFrame=e.parent,e.currentTNode=null,e.lView=null,e}const di=ks;function Ls(){const e=ks();e.isParent=!0,e.tView=null,e.selectedIndex=-1,e.contextLView=null,e.elementDepthCount=0,e.currentDirectiveIndex=-1,e.currentNamespace=null,e.bindingRootIndex=-1,e.bindingIndex=-1,e.currentQueryIndex=0}function Mn(){return Ye.lFrame.selectedIndex}function zn(e){Ye.lFrame.selectedIndex=e}function $t(){const e=Ye.lFrame;return dr(e.tView,e.selectedIndex)}function $i(e,t){for(let n=t.directiveStart,r=t.directiveEnd;n=r)break}else t[g]<0&&(e[18]+=65536),(d>11>16&&(3&e[2])===t){e[2]+=2048;try{l.call(d)}finally{}}}else try{l.call(d)}finally{}}class Gi{constructor(t,n,r){this.factory=t,this.resolving=!1,this.canSeeViewProviders=n,this.injectImpl=r}}function js(e,t,n){const r=$e(e);let s=0;for(;st){c=l-1;break}}}for(;l>16}(e),r=t;for(;n>0;)r=r[15],n--;return r}let Bs=!0;function So(e){const t=Bs;return Bs=e,t}let dc=0;function _(e,t){const n=f(e,t);if(-1!==n)return n;const r=t[1];r.firstCreatePass&&(e.injectorIndex=t.length,p(r.data,e),p(t,null),p(r.blueprint,null));const s=y(e,t),l=e.injectorIndex;if($l(s)){const c=zi(s),d=Do(s,t),g=d[1].data;for(let v=0;v<8;v++)t[l+v]=d[c+v]|g[c+v]}return t[l+8]=s,l}function p(e,t){e.push(0,0,0,0,0,0,0,0,t)}function f(e,t){return-1===e.injectorIndex||e.parent&&e.parent.injectorIndex===e.injectorIndex||null===t[e.injectorIndex+8]?-1:e.injectorIndex}function y(e,t){if(e.parent&&-1!==e.parent.injectorIndex)return e.parent.injectorIndex;let n=0,r=null,s=t;for(;null!==s;){const l=s[1],c=l.type;if(r=2===c?l.declTNode:1===c?s[6]:null,null===r)return-1;if(n++,s=s[15],-1!==r.injectorIndex)return r.injectorIndex|n<<16}return-1}function E(e,t,n){!function(e,t,n){let r;"string"==typeof n?r=n.charCodeAt(0)||0:n.hasOwnProperty(Fi)&&(r=n[Fi]),null==r&&(r=n[Fi]=dc++);const s=255&r;t.data[e+(s>>5)]|=1<=0?255&t:ot:t}(n);if("function"==typeof l){if(!Ns(t,e,r))return r&Ge.Host?N(s,n,r):L(t,n,r,s);try{const c=l(r);if(null!=c||r&Ge.Optional)return c;pt(n)}finally{di()}}else if("number"==typeof l){let c=null,d=f(e,t),g=-1,v=r&Ge.Host?t[16][6]:null;for((-1===d||r&Ge.SkipSelf)&&(g=-1===d?y(e,t):t[d+8],-1!==g&&fr(r,!1)?(c=t[1],d=zi(g),t=Do(g,t)):d=-1);-1!==d;){const D=t[1];if(nr(l,d,D.data)){const I=Be(d,t,n,c,r,v);if(I!==we)return I}g=t[d+8],-1!==g&&fr(r,t[1].data[d+8]===v)&&nr(l,d,t)?(c=D,d=zi(g),t=Do(g,t)):d=-1}}}return L(t,n,r,s)}const we={};function ot(){return new Ir(tn(),le())}function Be(e,t,n,r,s,l){const c=t[1],d=c.data[e+8],D=St(d,c,n,null==r?Li(d)&&Bs:r!=c&&0!=(3&d.type),s&Ge.Host&&l===d);return null!==D?ft(t,c,D,d):we}function St(e,t,n,r,s){const l=e.providerIndexes,c=t.data,d=1048575&l,g=e.directiveStart,D=l>>20,R=s?d+D:e.directiveEnd;for(let k=r?d:d+D;k=g&&U.type===n)return k}if(s){const k=c[g];if(k&&Wn(k)&&k.type===n)return g}return null}function ft(e,t,n,r){let s=e[n];const l=t.data;if(function(e){return e instanceof Gi}(s)){const c=s;c.resolving&&function(e,t){throw new be("200",`Circular dependency in DI detected for ${e}`)}(Le(l[n]));const d=So(c.canSeeViewProviders);c.resolving=!0;const g=c.injectImpl?ze(c.injectImpl):null;Ns(e,r,Ge.Default);try{s=e[n]=c.factory(void 0,l,e,r),t.firstCreatePass&&n>=r.directiveStart&&function(e,t,n){const{ngOnChanges:r,ngOnInit:s,ngDoCheck:l}=t.type.prototype;if(r){const c=va(t);(n.preOrderHooks||(n.preOrderHooks=[])).push(e,c),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(e,c)}s&&(n.preOrderHooks||(n.preOrderHooks=[])).push(0-e,s),l&&((n.preOrderHooks||(n.preOrderHooks=[])).push(e,l),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(e,l))}(n,l[n],t)}finally{null!==g&&ze(g),So(d),c.resolving=!1,di()}}return s}function nr(e,t,n){return!!(n[t+(e>>5)]&1<{const t=e.prototype.constructor,n=t[lr]||Mr(t),r=Object.prototype;let s=Object.getPrototypeOf(e.prototype).constructor;for(;s&&s!==r;){const l=s[lr]||Mr(s);if(l&&l!==n)return l;s=Object.getPrototypeOf(s)}return l=>new l})}function Mr(e){return de(e)?()=>{const t=Mr(se(e));return t&&t()}:ui(e)}function To(e){return function(e,t){if("class"===t)return e.classes;if("style"===t)return e.styles;const n=e.attrs;if(n){const r=n.length;let s=0;for(;s{const r=function(e){return function(...n){if(e){const r=e(...n);for(const s in r)this[s]=r[s]}}}(t);function s(...l){if(this instanceof s)return r.apply(this,l),this;const c=new s(...l);return d.annotation=c,d;function d(g,v,D){const I=g.hasOwnProperty(Hs)?g[Hs]:Object.defineProperty(g,Hs,{value:[]})[Hs];for(;I.length<=D;)I.push(null);return(I[D]=I[D]||[]).push(c),g}}return n&&(s.prototype=Object.create(n.prototype)),s.prototype.ngMetadataName=e,s.annotationCls=s,s})}class Zt{constructor(t,n){this._desc=t,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof n?this.__NG_ELEMENT_ID__=n:void 0!==n&&(this.\u0275prov=bt({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}toString(){return`InjectionToken ${this._desc}`}}const xp=new Zt("AnalyzeForEntryComponents"),Gl=Function;function xr(e,t){void 0===t&&(t=e);for(let n=0;nArray.isArray(n)?pi(n,t):t(n))}function zl(e,t,n){t>=e.length?e.push(n):e.splice(t,0,n)}function ns(e,t){return t>=e.length-1?e.pop():e.splice(t,1)[0]}function hr(e,t,n){let r=rs(e,t);return r>=0?e[1|r]=n:(r=~r,function(e,t,n,r){let s=e.length;if(s==t)e.push(n,r);else if(1===s)e.push(r,e[0]),e[0]=n;else{for(s--,e.push(e[s-1],e[s]);s>t;)e[s]=e[s-2],s--;e[t]=n,e[t+1]=r}}(e,r,t,n)),r}function hc(e,t){const n=rs(e,t);if(n>=0)return e[1|n]}function rs(e,t){return function(e,t,n){let r=0,s=e.length>>n;for(;s!==r;){const l=r+(s-r>>1),c=e[l<t?s=l:r=l+1}return~(s< ");else if("object"==typeof t){let l=[];for(let c in t)if(t.hasOwnProperty(c)){let d=t[c];l.push(c+":"+("string"==typeof d?JSON.stringify(d):ue(d)))}s=`{${l.join(", ")}}`}return`${n}${r?"("+r+")":""}[${s}]: ${e.replace(Lp,"\n ")}`}("\n"+e.message,s,n,r),e.ngTokenPath=s,e[Ws]=null,e}const zs=La(Ao("Inject",e=>({token:e})),-1),gi=La(Ao("Optional"),8),Mo=La(Ao("SkipSelf"),4);var qi=(()=>((qi=qi||{})[qi.Important=1]="Important",qi[qi.DashCase=2]="DashCase",qi))();const Zp="__ngContext__";function Ln(e,t){e[Zp]=t}function Cc(e){const t=function(e){return e[Zp]||null}(e);return t?Array.isArray(t)?t:t.lView:null}function _i(e,t){return undefined(e,t)}function Vn(e){const t=e[3];return Dn(t)?t[3]:t}function Yi(e){return Of(e[13])}function Va(e){return Of(e[4])}function Of(e){for(;null!==e&&!Dn(e);)e=e[4];return e}function xo(e,t,n,r,s){if(null!=r){let l,c=!1;Dn(r)?l=r:Xn(r)&&(c=!0,r=r[0]);const d=ut(r);0===e&&null!==n?null==s?Vf(t,n,d):ss(t,n,d,s||null,!0):1===e&&null!==n?ss(t,n,d,s||null,!0):2===e?function(e,t,n){const r=nu(e,t);r&&function(e,t,n,r){$e(e)?e.removeChild(t,n,r):t.removeChild(n)}(e,r,t,n)}(t,d,c):3===e&&t.destroyNode(d),null!=l&&function(e,t,n,r,s){const l=n[7];l!==ut(n)&&xo(t,e,r,l,s);for(let d=10;d0&&(e[n-1][4]=r[4]);const l=ns(e,10+t);!function(e,t){$a(e,t,t[11],2,null,null),t[0]=null,t[6]=null}(r[1],r);const c=l[19];null!==c&&c.detachView(l[1]),r[3]=null,r[4]=null,r[2]&=-129}return r}function kf(e,t){if(!(256&t[2])){const n=t[11];$e(n)&&n.destroyNode&&$a(e,t,n,3,null,null),function(e){let t=e[13];if(!t)return Ro(e[1],e);for(;t;){let n=null;if(Xn(t))n=t[13];else{const r=t[10];r&&(n=r)}if(!n){for(;t&&!t[4]&&t!==e;)Xn(t)&&Ro(t[1],t),t=t[3];null===t&&(t=e),Xn(t)&&Ro(t[1],t),n=t&&t[4]}t=n}}(t)}}function Ro(e,t){if(!(256&t[2])){t[2]&=-129,t[2]|=256,function(e,t){let n;if(null!=e&&null!=(n=e.destroyHooks))for(let r=0;r=0?r[s=v]():r[s=-v].unsubscribe(),l+=2}else{const c=r[s=n[l+1]];n[l].call(c)}if(null!==r){for(let l=s+1;le,createScript:e=>e,createScriptURL:e=>e})}catch(e){}return su}())||void 0===t?void 0:t.createHTML(e))||e}class Ki{constructor(t){this.changingThisBreaksApplicationSecurity=t}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see https://g.co/ng/security#xss)`}}class Qs extends Ki{getTypeName(){return"HTML"}}class pr extends Ki{getTypeName(){return"Style"}}class gr extends Ki{getTypeName(){return"Script"}}class rr extends Ki{getTypeName(){return"URL"}}class fg extends Ki{getTypeName(){return"ResourceURL"}}function Xt(e){return e instanceof Ki?e.changingThisBreaksApplicationSecurity:e}function Po(e,t){const n=Pc(e);if(null!=n&&n!==t){if("ResourceURL"===n&&"URL"===t)return!0;throw new Error(`Required a safe ${t}, got a ${n} (see https://g.co/ng/security#xss)`)}return n===t}function Pc(e){return e instanceof Ki&&e.getTypeName()||null}function Oc(e){return new Qs(e)}function Nc(e){return new pr(e)}function Fc(e){return new gr(e)}function kc(e){return new rr(e)}function hg(e){return new fg(e)}class Pr{constructor(t){this.inertDocumentHelper=t}getInertBodyElement(t){t=""+t;try{const n=(new window.DOMParser).parseFromString(as(t),"text/html").body;return null===n?this.inertDocumentHelper.getInertBodyElement(t):(n.removeChild(n.firstChild),n)}catch(n){return null}}}class Lc{constructor(t){if(this.defaultDoc=t,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert"),null==this.inertDocument.body){const n=this.inertDocument.createElement("html");this.inertDocument.appendChild(n);const r=this.inertDocument.createElement("body");n.appendChild(r)}}getInertBodyElement(t){const n=this.inertDocument.createElement("template");if("content"in n)return n.innerHTML=as(t),n;const r=this.inertDocument.createElement("body");return r.innerHTML=as(t),this.defaultDoc.documentMode&&this.stripCustomNsAttrs(r),r}stripCustomNsAttrs(t){const n=t.attributes;for(let s=n.length-1;0Or(t.trim())).join(", ")),this.buf.push(" ",c,'="',qf(g),'"')}var e;return this.buf.push(">"),!0}endElement(t){const n=t.nodeName.toLowerCase();mr.hasOwnProperty(n)&&!Oo.hasOwnProperty(n)&&(this.buf.push(""))}chars(t){this.buf.push(qf(t))}checkClobberedElement(t,n){if(n&&(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY)===Node.DOCUMENT_POSITION_CONTAINED_BY)throw new Error(`Failed to sanitize html because the element is clobbered: ${t.outerHTML}`);return n}}const Dy=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yg=/([^\#-~ |!])/g;function qf(e){return e.replace(/&/g,"&").replace(Dy,function(t){return"&#"+(1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320)+65536)+";"}).replace(yg,function(t){return"&#"+t.charCodeAt(0)+";"}).replace(//g,">")}let qa;function Hc(e,t){let n=null;try{qa=qa||function(e){const t=new Lc(e);return function(){try{return!!(new window.DOMParser).parseFromString(as(""),"text/html")}catch(e){return!1}}()?new Pr(t):t}(e);let r=t?String(t):"";n=qa.getInertBodyElement(r);let s=5,l=r;do{if(0===s)throw new Error("Failed to sanitize html because the input is unstable");s--,r=l,l=n.innerHTML,n=qa.getInertBodyElement(r)}while(r!==l);return as((new No).sanitizeChildren(cu(n)||n))}finally{if(n){const r=cu(n)||n;for(;r.firstChild;)r.removeChild(r.firstChild)}}}function cu(e){return"content"in e&&function(e){return e.nodeType===Node.ELEMENT_NODE&&"TEMPLATE"===e.nodeName}(e)?e.content:null}var jt=(()=>((jt=jt||{})[jt.NONE=0]="NONE",jt[jt.HTML=1]="HTML",jt[jt.STYLE=2]="STYLE",jt[jt.SCRIPT=3]="SCRIPT",jt[jt.URL=4]="URL",jt[jt.RESOURCE_URL=5]="RESOURCE_URL",jt))();function Ya(e){const t=function(){const e=le();return e&&e[12]}();return t?t.sanitize(jt.URL,e)||"":Po(e,"URL")?Xt(e):Or(ae(e))}function Ja(e){return e.ngOriginalError}function qc(e,...t){e.error(...t)}class us{constructor(){this._console=console}handleError(t){const n=this._findOriginalError(t),r=this._findContext(t),s=(e=t)&&e.ngErrorLogger||qc;var e;s(this._console,"ERROR",t),n&&s(this._console,"ORIGINAL ERROR",n),r&&s(this._console,"ERROR CONTEXT",r)}_findContext(t){return t?t.ngDebugContext||this._findContext(Ja(t)):null}_findOriginalError(t){let n=t&&Ja(t);for(;n&&Ja(n);)n=Ja(n);return n||null}}const Sg=(()=>("undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||setTimeout).bind(Ot))();function vi(e){return e instanceof Function?e():e}function Qa(e,t,n){let r=e.length;for(;;){const s=e.indexOf(t,n);if(-1===s)return s;if(0===s||e.charCodeAt(s-1)<=32){const l=t.length;if(s+l===r||e.charCodeAt(s+l)<=32)return s}n=s+1}}const Zc="ng-template";function cs(e,t,n){let r=0;for(;rl?"":s[I+1].toLowerCase();const k=8&r?R:null;if(k&&-1!==Qa(k,v,0)||2&r&&v!==R){if(Yr(r))return!1;c=!0}}}}else{if(!c&&!Yr(r)&&!Yr(g))return!1;if(c&&Yr(g))continue;c=!1,r=g|1&r}}return Yr(r)||c}function Yr(e){return 0==(1&e)}function xg(e,t,n,r){if(null===t)return-1;let s=0;if(r||!n){let l=!1;for(;s-1)for(n++;n0?'="'+d+'"':"")+"]"}else 8&r?s+="."+c:4&r&&(s+=" "+c);else""!==s&&!Yr(c)&&(t+=nh(l,s),s=""),r=c,l=l||!Yr(r);n++}return""!==s&&(t+=nh(l,s)),t}const nt={};function kg(e){ih(mt(),le(),Mn()+e,Ps())}function ih(e,t,n,r){if(!r)if(3==(3&t[2])){const l=e.preOrderCheckHooks;null!==l&&Qo(t,l,n)}else{const l=e.preOrderHooks;null!==l&&Wr(t,l,0,n)}zn(n)}function Ci(e,t){return e<<17|t<<2}function _r(e){return e>>17&32767}function sh(e){return 2|e}function yr(e){return(131068&e)>>2}function fu(e,t){return-131069&e|t<<2}function ah(e){return 1|e}function id(e,t){const n=e.contentQueries;if(null!==n)for(let r=0;r20&&ih(e,t,20,Ps()),n(r,s)}finally{zn(l)}}function ad(e){const t=e.tView;return null===t||t.incompleteFirstPass?e.tView=el(1,null,e.template,e.decls,e.vars,e.directiveDefs,e.pipeDefs,e.viewQuery,e.schemas,e.consts):t}function el(e,t,n,r,s,l,c,d,g,v){const D=20+r,I=D+s,R=function(e,t){const n=[];for(let r=0;r0;){const n=e[--t];if("number"==typeof n&&n<0)return n}return 0})(d)!=g&&d.push(g),d.push(r,s,c)}}function _h(e,t){null!==e.hostBindings&&e.hostBindings(1,t)}function tl(e,t){t.flags|=2,(e.components||(e.components=[])).push(t.index)}function vd(e,t,n){if(n){if(t.exportAs)for(let r=0;r0&&Cd(n)}}function Cd(e){for(let r=Yi(e);null!==r;r=Va(r))for(let s=10;s0&&Cd(l)}const n=e[1].components;if(null!==n)for(let r=0;r0&&Cd(s)}}function bd(e,t){const n=_n(t,e),r=n[1];(function(e,t){for(let n=t.length;nPromise.resolve(null))();function Du(e){return e[7]||(e[7]=[])}function ol(e){return e.cleanup||(e.cleanup=[])}function ra(e,t){const n=e[9],r=n?n.get(us,null):null;r&&r.handleError(t)}function sl(e,t,n,r,s){for(let l=0;lthis.processProvider(d,t,n)),pi([t],d=>this.processInjectorType(d,[],l)),this.records.set(Uo,cl(void 0,this));const c=this.records.get(hs);this.scope=null!=c?c.value:null,this.source=s||("object"==typeof t?null:ue(t))}get destroyed(){return this._destroyed}destroy(){this.assertNotDestroyed(),this._destroyed=!0;try{this.onDestroy.forEach(t=>t.ngOnDestroy())}finally{this.records.clear(),this.onDestroy.clear(),this.injectorDefTypes.clear()}}get(t,n=Fa,r=Ge.Default){this.assertNotDestroyed();const s=is(this),l=ze(void 0);try{if(!(r&Ge.SkipSelf)){let d=this.records.get(t);if(void 0===d){const g=("function"==typeof(e=t)||"object"==typeof e&&e instanceof Zt)&&fn(t);d=g&&this.injectableDefInScope(g)?cl(ul(t),ps):null,this.records.set(t,d)}if(null!=d)return this.hydrate(t,d)}return(r&Ge.Self?Eh():this.parent).get(t,n=r&Ge.Optional&&n===Fa?null:n)}catch(c){if("NullInjectorError"===c.name){if((c[Ws]=c[Ws]||[]).unshift(ue(t)),s)throw c;return Df(c,t,"R3InjectorError",this.source)}throw c}finally{ze(l),is(s)}var e}_resolveInjectorDefTypes(){this.injectorDefTypes.forEach(t=>this.get(t))}toString(){const t=[];return this.records.forEach((r,s)=>t.push(ue(s))),`R3Injector[${t.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new Error("Injector has already been destroyed.")}processInjectorType(t,n,r){if(!(t=se(t)))return!1;let s=ys(t);const l=null==s&&t.ngModule||void 0,c=void 0===l?t:l,d=-1!==r.indexOf(c);if(void 0!==l&&(s=ys(l)),null==s)return!1;if(null!=s.imports&&!d){let D;r.push(c);try{pi(s.imports,I=>{this.processInjectorType(I,n,r)&&(void 0===D&&(D=[]),D.push(I))})}finally{}if(void 0!==D)for(let I=0;Ithis.processProvider(U,R,k||vt))}}this.injectorDefTypes.add(c);const g=ui(c)||(()=>new c);this.records.set(c,cl(g,ps));const v=s.providers;if(null!=v&&!d){const D=t;pi(v,I=>this.processProvider(I,D,v))}return void 0!==l&&void 0!==t.providers}processProvider(t,n,r){let s=ia(t=se(t))?t:se(t&&t.provide);const l=(e=t,lm(e)?cl(void 0,e.useValue):cl(am(e),ps));var e;if(ia(t)||!0!==t.multi)this.records.get(s);else{let c=this.records.get(s);c||(c=cl(void 0,ps,!0),c.factory=()=>os(c.multi),this.records.set(s,c)),s=t,c.multi.push(t)}this.records.set(s,l)}hydrate(t,n){return n.value===ps&&(n.value=Su,n.value=n.factory()),"object"==typeof n.value&&n.value&&null!==(e=n.value)&&"object"==typeof e&&"function"==typeof e.ngOnDestroy&&this.onDestroy.add(n.value),n.value;var e}injectableDefInScope(t){if(!t.providedIn)return!1;const n=se(t.providedIn);return"string"==typeof n?"any"===n||n===this.scope:this.injectorDefTypes.has(n)}}function ul(e){const t=fn(e),n=null!==t?t.factory:ui(e);if(null!==n)return n;if(e instanceof Zt)throw new Error(`Token ${ue(e)} is missing a \u0275prov definition.`);if(e instanceof Function)return function(e){const t=e.length;if(t>0){const r=function(e,t){const n=[];for(let r=0;rn.factory(e):()=>new e}(e);throw new Error("unreachable")}function am(e,t,n){let r;if(ia(e)){const s=se(e);return ui(s)||ul(s)}if(lm(e))r=()=>se(e.useValue);else if(function(e){return!(!e||!e.useFactory)}(e))r=()=>e.useFactory(...os(e.deps||[]));else if(function(e){return!(!e||!e.useExisting)}(e))r=()=>ln(se(e.useExisting));else{const s=se(e&&(e.useClass||e.provide));if(!function(e){return!!e.deps}(e))return ui(s)||ul(s);r=()=>new s(...os(e.deps))}return r}function cl(e,t,n=!1){return{factory:e,value:t,multi:n?[]:void 0}}function lm(e){return null!==e&&"object"==typeof e&&yc in e}function ia(e){return"function"==typeof e}const Ih=function(e,t,n){return function(e,t=null,n=null,r){const s=sm(e,t,n,r);return s._resolveInjectorDefTypes(),s}({name:n},t,e,n)};let Jt=(()=>{class e{static create(n,r){return Array.isArray(n)?Ih(n,r,""):Ih(n.providers,n.parent,n.name||"")}}return e.THROW_IF_NOT_FOUND=Fa,e.NULL=new Sd,e.\u0275prov=bt({token:e,providedIn:"any",factory:()=>ln(Uo)}),e.__NG_ELEMENT_ID__=-1,e})();function Bh(e,t){$i(Cc(e)[1],tn())}function Hh(e){let t=function(e){return Object.getPrototypeOf(e.prototype).constructor}(e.type),n=!0;const r=[e];for(;t;){let s;if(Wn(e))s=t.\u0275cmp||t.\u0275dir;else{if(t.\u0275cmp)throw new Error("Directives cannot inherit Components");s=t.\u0275dir}if(s){if(n){r.push(s);const c=e;c.inputs=$h(e.inputs),c.declaredInputs=$h(e.declaredInputs),c.outputs=$h(e.outputs);const d=s.hostBindings;d&&sv(e,d);const g=s.viewQuery,v=s.contentQueries;if(g&&Gh(e,g),v&&Cm(e,v),Oe(e.inputs,s.inputs),Oe(e.declaredInputs,s.declaredInputs),Oe(e.outputs,s.outputs),Wn(s)&&s.data.animation){const D=e.data;D.animation=(D.animation||[]).concat(s.data.animation)}}const l=s.features;if(l)for(let c=0;c=0;r--){const s=e[r];s.hostVars=t+=s.hostVars,s.hostAttrs=Xo(s.hostAttrs,n=Xo(n,s.hostAttrs))}}(r)}function $h(e){return e===sn?{}:e===vt?[]:e}function Gh(e,t){const n=e.viewQuery;e.viewQuery=n?(r,s)=>{t(r,s),n(r,s)}:t}function Cm(e,t){const n=e.contentQueries;e.contentQueries=n?(r,s,l)=>{t(r,s,l),n(r,s,l)}:t}function sv(e,t){const n=e.hostBindings;e.hostBindings=n?(r,s)=>{t(r,s),n(r,s)}:t}let Pu=null;function sa(){if(!Pu){const e=Ot.Symbol;if(e&&e.iterator)Pu=e.iterator;else{const t=Object.getOwnPropertyNames(Map.prototype);for(let n=0;nd(ut(Xe[r.index])):r.index;if($e(n)){let Xe=null;if(!d&&g&&(Xe=function(e,t,n,r){const s=e.cleanup;if(null!=s)for(let l=0;lg?d[g]:null}"string"==typeof c&&(l+=2)}return null}(e,t,s,r.index)),null!==Xe)(Xe.__ngLastListenerFn__||Xe).__ngNextListenerFn__=l,Xe.__ngLastListenerFn__=l,k=!1;else{l=Nm(r,t,I,l,!1);const yt=n.listen(me,s,l);R.push(l,yt),D&&D.push(s,He,X,X+1)}}else l=Nm(r,t,I,l,!0),me.addEventListener(s,l,c),R.push(l),D&&D.push(s,He,X,c)}else l=Nm(r,t,I,l,!1);const U=r.outputs;let W;if(k&&null!==U&&(W=U[s])){const B=W.length;if(B)for(let me=0;me=0}function km(e,t){return function(e,t,n,r){const s=le(),l=mt(),c=function(e){const t=Ye.lFrame,n=t.bindingIndex;return t.bindingIndex=t.bindingIndex+e,n}(2);l.firstUpdatePass&&function(e,t,n,r){const s=e.data;if(null===s[n+1]){const l=s[Mn()],c=function(e,t){return t>=e.expandoStartIndex}(e,n);(function(e,t){return 0!=(e.flags&(t?16:32))})(l,r)&&null===t&&!c&&(t=!1),t=function(e,t,n,r){const s=function(e){const t=Ye.lFrame.currentDirectiveIndex;return-1===t?null:e[t]}(e);let l=r?t.residualClasses:t.residualStyles;if(null===s)0===(r?t.classBindings:t.styleBindings)&&(n=Ud(n=Lm(null,e,t,n,r),t.attrs,r),l=null);else{const c=t.directiveStylingLast;if(-1===c||e[c]!==s)if(n=Lm(s,e,t,n,r),null===l){let g=function(e,t,n){const r=n?t.classBindings:t.styleBindings;if(0!==yr(r))return e[_r(r)]}(e,t,r);void 0!==g&&Array.isArray(g)&&(g=Lm(null,e,t,g[1],r),g=Ud(g,t.attrs,r),function(e,t,n,r){e[_r(n?t.classBindings:t.styleBindings)]=r}(e,t,r,g))}else l=function(e,t,n){let r;const s=t.directiveEnd;for(let l=1+t.directiveStylingLast;l0)&&(v=!0)}else D=n;if(s)if(0!==g){const R=_r(e[d+1]);e[r+1]=Ci(R,d),0!==R&&(e[R+1]=fu(e[R+1],r)),e[d+1]=function(e,t){return 131071&e|t<<17}(e[d+1],r)}else e[r+1]=Ci(d,0),0!==d&&(e[d+1]=fu(e[d+1],r)),d=r;else e[r+1]=Ci(g,0),0===d?d=r:e[g+1]=fu(e[g+1],r),g=r;v&&(e[r+1]=sh(e[r+1])),Nv(e,D,r,!0),Nv(e,D,r,!1),function(e,t,n,r,s){const l=s?e.residualClasses:e.residualStyles;null!=l&&"string"==typeof t&&rs(l,t)>=0&&(n[r+1]=ah(n[r+1]))}(t,D,e,r,l),c=Ci(d,g),l?t.classBindings=c:t.styleBindings=c}(s,l,t,n,c,r)}}(l,e,c,r),t!==nt&&Rn(s,c,t)&&function(e,t,n,r,s,l,c,d){if(!(3&t.type))return;const g=e.data,v=g[d+1];Yh(function(e){return 1==(1&e)}(v)?zv(g,t,n,s,yr(v),c):void 0)||(Yh(l)||function(e){return 2==(2&e)}(v)&&(l=zv(g,null,n,s,d,c)),function(e,t,n,r,s){const l=$e(e);if(t)s?l?e.addClass(n,r):n.classList.add(r):l?e.removeClass(n,r):n.classList.remove(r);else{let c=-1===r.indexOf("-")?void 0:qi.DashCase;if(null==s)l?e.removeStyle(n,r,c):n.style.removeProperty(r);else{const d="string"==typeof s&&s.endsWith("!important");d&&(s=s.slice(0,-10),c|=qi.Important),l?e.setStyle(n,r,s,c):n.style.setProperty(r,s,d?"important":"")}}}(r,c,kn(Mn(),n),s,l))}(l,l.data[Mn()],s,s[11],e,s[c+1]=function(e,t){return null==e||("string"==typeof t?e+=t:"object"==typeof e&&(e=ue(Xt(e)))),e}(t,n),r,c)}(e,t,null,!0),km}function Lm(e,t,n,r,s){let l=null;const c=n.directiveEnd;let d=n.directiveStylingLast;for(-1===d?d=n.directiveStart:d++;d0;){const g=e[s],v=Array.isArray(g),D=v?g[1]:g,I=null===D;let R=n[s+1];R===nt&&(R=I?vt:void 0);let k=I?hc(R,r):D===r?R:void 0;if(v&&!Yh(k)&&(k=hc(g,r)),Yh(k)&&(d=k,c))return d;const U=e[s+1];s=c?_r(U):yr(U)}if(null!==t){let g=l?t.residualClasses:t.residualStyles;null!=g&&(d=hc(g,r))}return d}function Yh(e){return void 0!==e}function Yv(e,t=""){const n=le(),r=mt(),s=e+20,l=r.firstCreatePass?Xa(r,s,1,t,null):r.data[s],c=n[s]=function(e,t){return $e(e)?e.createText(t):e.createTextNode(t)}(n[11],t);Ba(r,n,c,l),Tr(l,!1)}function Vm(e){return Um("",e,""),Vm}function Um(e,t,n){const r=le(),s=function(e,t,n,r){return Rn(e,tr(),n)?t+ae(n)+r:nt}(r,e,t,n);return s!==nt&&or(r,Mn(),s),Um}function jm(e,t,n){const r=le();return Rn(r,tr(),t)&&ir(mt(),$t(),r,e,t,r[11],n,!0),jm}const pl=void 0;var dE=["en",[["a","p"],["AM","PM"],pl],[["AM","PM"],pl,pl],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],pl,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],pl,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm a","h:mm:ss a","h:mm:ss a z","h:mm:ss a zzzz"],["{1}, {0}",pl,"{1} 'at' {0}",pl],[".",",",";","%","+","-","E","\xd7","\u2030","\u221e","NaN",":"],["#,##0.###","#,##0%","\xa4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",function(e){const t=Math.floor(Math.abs(e)),n=e.toString().replace(/^[^.]*\.?/,"").length;return 1===t&&0===n?1:5}];let Uu={};function Bm(e){const t=function(e){return e.toLowerCase().replace(/_/g,"-")}(e);let n=pC(t);if(n)return n;const r=t.split("-")[0];if(n=pC(r),n)return n;if("en"===r)return dE;throw new Error(`Missing locale data for the locale "${e}".`)}function hC(e){return Bm(e)[Je.PluralCase]}function pC(e){return e in Uu||(Uu[e]=Ot.ng&&Ot.ng.common&&Ot.ng.common.locales&&Ot.ng.common.locales[e]),Uu[e]}var Je=(()=>((Je=Je||{})[Je.LocaleId=0]="LocaleId",Je[Je.DayPeriodsFormat=1]="DayPeriodsFormat",Je[Je.DayPeriodsStandalone=2]="DayPeriodsStandalone",Je[Je.DaysFormat=3]="DaysFormat",Je[Je.DaysStandalone=4]="DaysStandalone",Je[Je.MonthsFormat=5]="MonthsFormat",Je[Je.MonthsStandalone=6]="MonthsStandalone",Je[Je.Eras=7]="Eras",Je[Je.FirstDayOfWeek=8]="FirstDayOfWeek",Je[Je.WeekendRange=9]="WeekendRange",Je[Je.DateFormat=10]="DateFormat",Je[Je.TimeFormat=11]="TimeFormat",Je[Je.DateTimeFormat=12]="DateTimeFormat",Je[Je.NumberSymbols=13]="NumberSymbols",Je[Je.NumberFormats=14]="NumberFormats",Je[Je.CurrencyCode=15]="CurrencyCode",Je[Je.CurrencySymbol=16]="CurrencySymbol",Je[Je.CurrencyName=17]="CurrencyName",Je[Je.Currencies=18]="Currencies",Je[Je.Directionality=19]="Directionality",Je[Je.PluralCase=20]="PluralCase",Je[Je.ExtraData=21]="ExtraData",Je))();const Kh="en-US";let gC=Kh;function Hm(e){Pe(e,"Expected localeId to be defined"),"string"==typeof e&&(gC=e.toLowerCase().replace(/_/g,"-"))}function Wm(e,t,n,r,s){if(e=se(e),Array.isArray(e))for(let l=0;l>20;if(ia(e)||!e.multi){const k=new Gi(g,s,Vd),U=qm(d,t,s?D:D+R,I);-1===U?(E(_(v,c),l,d),zm(l,e,t.length),t.push(d),v.directiveStart++,v.directiveEnd++,s&&(v.providerIndexes+=1048576),n.push(k),c.push(k)):(n[U]=k,c[U]=k)}else{const k=qm(d,t,D+R,I),U=qm(d,t,D,D+R),W=k>=0&&n[k],B=U>=0&&n[U];if(s&&!B||!s&&!W){E(_(v,c),l,d);const me=function(e,t,n,r,s){const l=new Gi(e,n,Vd);return l.multi=[],l.index=t,l.componentProviders=0,UC(l,s,r&&!n),l}(s?lD:aD,n.length,s,r,g);!s&&B&&(n[U].providerFactory=me),zm(l,e,t.length,0),t.push(d),v.directiveStart++,v.directiveEnd++,s&&(v.providerIndexes+=1048576),n.push(me),c.push(me)}else zm(l,e,k>-1?k:U,UC(n[s?U:k],g,!s&&r));!s&&r&&B&&n[U].componentProviders++}}}function zm(e,t,n,r){const s=ia(t);if(s||function(e){return!!e.useClass}(t)){const c=(t.useClass||t).prototype.ngOnDestroy;if(c){const d=e.destroyHooks||(e.destroyHooks=[]);if(!s&&t.multi){const g=d.indexOf(n);-1===g?d.push(n,[r,c]):d[g+1].push(r,c)}else d.push(n,c)}}}function UC(e,t,n){return n&&e.componentProviders++,e.multi.push(t)-1}function qm(e,t,n,r){for(let s=n;s{n.providersResolver=(r,s)=>function(e,t,n){const r=mt();if(r.firstCreatePass){const s=Wn(e);Wm(n,r.data,r.blueprint,s,!0),Wm(t,r.data,r.blueprint,s,!1)}}(r,s?s(e):e,t)}}class BC{}const $C="ngComponent";class dD{resolveComponentFactory(t){throw function(e){const t=Error(`No component factory found for ${ue(e)}. Did you add it to @NgModule.entryComponents?`);return t[$C]=e,t}(t)}}let Bu=(()=>{class e{}return e.NULL=new dD,e})();function ep(...e){}function Hu(e,t){return new Ho(qt(e,t))}const pD=function(){return Hu(tn(),le())};let Ho=(()=>{class e{constructor(n){this.nativeElement=n}}return e.__NG_ELEMENT_ID__=pD,e})();function GC(e){return e instanceof Ho?e.nativeElement:e}class tp{}let gD=(()=>{class e{}return e.__NG_ELEMENT_ID__=()=>_D(),e})();const _D=function(){const e=le(),n=_n(tn().index,e);return function(e){return e[11]}(Xn(n)?n:e)};let Jm=(()=>{class e{}return e.\u0275prov=bt({token:e,providedIn:"root",factory:()=>null}),e})();class WC{constructor(t){this.full=t,this.major=t.split(".")[0],this.minor=t.split(".")[1],this.patch=t.split(".").slice(2).join(".")}}const zC=new WC("12.2.17");class qC{constructor(){}supports(t){return Ou(t)}create(t){return new bD(t)}}const CD=(e,t)=>t;class bD{constructor(t){this.length=0,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null,this._identityChangesHead=null,this._identityChangesTail=null,this._trackByFn=t||CD}forEachItem(t){let n;for(n=this._itHead;null!==n;n=n._next)t(n)}forEachOperation(t){let n=this._itHead,r=this._removalsHead,s=0,l=null;for(;n||r;){const c=!r||n&&n.currentIndex{c=this._trackByFn(s,d),null!==n&&Object.is(n.trackById,c)?(r&&(n=this._verifyReinsertion(n,d,c,s)),Object.is(n.item,d)||this._addIdentityChange(n,d)):(n=this._mismatch(n,d,c,s),r=!0),n=n._next,s++}),this.length=s;return this._truncate(n),this.collection=t,this.isDirty}get isDirty(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead||null!==this._identityChangesHead}_reset(){if(this.isDirty){let t;for(t=this._previousItHead=this._itHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._additionsHead;null!==t;t=t._nextAdded)t.previousIndex=t.currentIndex;for(this._additionsHead=this._additionsTail=null,t=this._movesHead;null!==t;t=t._nextMoved)t.previousIndex=t.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(t,n,r,s){let l;return null===t?l=this._itTail:(l=t._prev,this._remove(t)),null!==(t=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null))?(Object.is(t.item,n)||this._addIdentityChange(t,n),this._reinsertAfter(t,l,s)):null!==(t=null===this._linkedRecords?null:this._linkedRecords.get(r,s))?(Object.is(t.item,n)||this._addIdentityChange(t,n),this._moveAfter(t,l,s)):t=this._addAfter(new wD(n,r),l,s),t}_verifyReinsertion(t,n,r,s){let l=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null);return null!==l?t=this._reinsertAfter(l,t._prev,s):t.currentIndex!=s&&(t.currentIndex=s,this._addToMoves(t,s)),t}_truncate(t){for(;null!==t;){const n=t._next;this._addToRemovals(this._unlink(t)),t=n}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null),null!==this._identityChangesTail&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(t,n,r){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(t);const s=t._prevRemoved,l=t._nextRemoved;return null===s?this._removalsHead=l:s._nextRemoved=l,null===l?this._removalsTail=s:l._prevRemoved=s,this._insertAfter(t,n,r),this._addToMoves(t,r),t}_moveAfter(t,n,r){return this._unlink(t),this._insertAfter(t,n,r),this._addToMoves(t,r),t}_addAfter(t,n,r){return this._insertAfter(t,n,r),this._additionsTail=null===this._additionsTail?this._additionsHead=t:this._additionsTail._nextAdded=t,t}_insertAfter(t,n,r){const s=null===n?this._itHead:n._next;return t._next=s,t._prev=n,null===s?this._itTail=t:s._prev=t,null===n?this._itHead=t:n._next=t,null===this._linkedRecords&&(this._linkedRecords=new YC),this._linkedRecords.put(t),t.currentIndex=r,t}_remove(t){return this._addToRemovals(this._unlink(t))}_unlink(t){null!==this._linkedRecords&&this._linkedRecords.remove(t);const n=t._prev,r=t._next;return null===n?this._itHead=r:n._next=r,null===r?this._itTail=n:r._prev=n,t}_addToMoves(t,n){return t.previousIndex===n||(this._movesTail=null===this._movesTail?this._movesHead=t:this._movesTail._nextMoved=t),t}_addToRemovals(t){return null===this._unlinkedRecords&&(this._unlinkedRecords=new YC),this._unlinkedRecords.put(t),t.currentIndex=null,t._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=t,t._prevRemoved=null):(t._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=t),t}_addIdentityChange(t,n){return t.item=n,this._identityChangesTail=null===this._identityChangesTail?this._identityChangesHead=t:this._identityChangesTail._nextIdentityChange=t,t}}class wD{constructor(t,n){this.item=t,this.trackById=n,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null,this._nextIdentityChange=null}}class ED{constructor(){this._head=null,this._tail=null}add(t){null===this._head?(this._head=this._tail=t,t._nextDup=null,t._prevDup=null):(this._tail._nextDup=t,t._prevDup=this._tail,t._nextDup=null,this._tail=t)}get(t,n){let r;for(r=this._head;null!==r;r=r._nextDup)if((null===n||n<=r.currentIndex)&&Object.is(r.trackById,t))return r;return null}remove(t){const n=t._prevDup,r=t._nextDup;return null===n?this._head=r:n._nextDup=r,null===r?this._tail=n:r._prevDup=n,null===this._head}}class YC{constructor(){this.map=new Map}put(t){const n=t.trackById;let r=this.map.get(n);r||(r=new ED,this.map.set(n,r)),r.add(t)}get(t,n){const s=this.map.get(t);return s?s.get(t,n):null}remove(t){const n=t.trackById;return this.map.get(n).remove(t)&&this.map.delete(n),t}get isEmpty(){return 0===this.map.size}clear(){this.map.clear()}}function KC(e,t,n){const r=e.previousIndex;if(null===r)return r;let s=0;return n&&r{if(n&&n.key===s)this._maybeAddToChanges(n,r),this._appendAfter=n,n=n._next;else{const l=this._getOrCreateRecordForKey(s,r);n=this._insertBeforeOrAppend(n,l)}}),n){n._prev&&(n._prev._next=null),this._removalsHead=n;for(let r=n;null!==r;r=r._nextRemoved)r===this._mapHead&&(this._mapHead=null),this._records.delete(r.key),r._nextRemoved=r._next,r.previousValue=r.currentValue,r.currentValue=null,r._prev=null,r._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(t,n){if(t){const r=t._prev;return n._next=t,n._prev=r,t._prev=n,r&&(r._next=n),t===this._mapHead&&(this._mapHead=n),this._appendAfter=t,t}return this._appendAfter?(this._appendAfter._next=n,n._prev=this._appendAfter):this._mapHead=n,this._appendAfter=n,null}_getOrCreateRecordForKey(t,n){if(this._records.has(t)){const s=this._records.get(t);this._maybeAddToChanges(s,n);const l=s._prev,c=s._next;return l&&(l._next=c),c&&(c._prev=l),s._next=null,s._prev=null,s}const r=new SD(t);return this._records.set(t,r),r.currentValue=n,this._addToAdditions(r),r}_reset(){if(this.isDirty){let t;for(this._previousMapHead=this._mapHead,t=this._previousMapHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._changesHead;null!==t;t=t._nextChanged)t.previousValue=t.currentValue;for(t=this._additionsHead;null!=t;t=t._nextAdded)t.previousValue=t.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(t,n){Object.is(n,t.currentValue)||(t.previousValue=t.currentValue,t.currentValue=n,this._addToChanges(t))}_addToAdditions(t){null===this._additionsHead?this._additionsHead=this._additionsTail=t:(this._additionsTail._nextAdded=t,this._additionsTail=t)}_addToChanges(t){null===this._changesHead?this._changesHead=this._changesTail=t:(this._changesTail._nextChanged=t,this._changesTail=t)}_forEach(t,n){t instanceof Map?t.forEach(n):Object.keys(t).forEach(r=>n(t[r],r))}}class SD{constructor(t){this.key=t,this.previousValue=null,this.currentValue=null,this._nextPrevious=null,this._next=null,this._prev=null,this._nextAdded=null,this._nextRemoved=null,this._nextChanged=null}}function QC(){return new np([new qC])}let np=(()=>{class e{constructor(n){this.factories=n}static create(n,r){if(null!=r){const s=r.factories.slice();n=n.concat(s)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||QC()),deps:[[e,new Mo,new gi]]}}find(n){const r=this.factories.find(s=>s.supports(n));if(null!=r)return r;throw new Error(`Cannot find a differ supporting object '${n}' of type '${function(e){return e.name||typeof e}(n)}'`)}}return e.\u0275prov=bt({token:e,providedIn:"root",factory:QC}),e})();function ZC(){return new rp([new JC])}let rp=(()=>{class e{constructor(n){this.factories=n}static create(n,r){if(r){const s=r.factories.slice();n=n.concat(s)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||ZC()),deps:[[e,new Mo,new gi]]}}find(n){const r=this.factories.find(s=>s.supports(n));if(r)return r;throw new Error(`Cannot find a differ supporting object '${n}'`)}}return e.\u0275prov=bt({token:e,providedIn:"root",factory:ZC}),e})();function ip(e,t,n,r,s=!1){for(;null!==n;){const l=t[n.index];if(null!==l&&r.push(ut(l)),Dn(l))for(let d=10;d-1&&(eu(t,r),ns(n,r))}this._attachedToViewContainer=!1}kf(this._lView[1],this._lView)}onDestroy(t){cd(this._lView[1],this._lView,null,t)}markForCheck(){wd(this._cdRefInjectingView||this._lView)}detach(){this._lView[2]&=-129}reattach(){this._lView[2]|=128}detectChanges(){Eu(this._lView[1],this._lView,this.context)}checkNoChanges(){!function(e,t,n){Os(!0);try{Eu(e,t,n)}finally{Os(!1)}}(this._lView[1],this._lView,this.context)}attachToViewContainerRef(){if(this._appRef)throw new Error("This view is already attached directly to the ApplicationRef!");this._attachedToViewContainer=!0}detachFromAppRef(){var t;this._appRef=null,$a(this._lView[1],t=this._lView,t[11],2,null,null)}attachToAppRef(t){if(this._attachedToViewContainer)throw new Error("This view is already attached to a ViewContainer!");this._appRef=t}}class AD extends Gd{constructor(t){super(t),this._view=t}detectChanges(){bh(this._view)}checkNoChanges(){!function(e){Os(!0);try{bh(e)}finally{Os(!1)}}(this._view)}get context(){return null}}const MD=function(e){return function(e,t,n){if(Li(e)&&!n){const r=_n(e.index,t);return new Gd(r,r)}return 47&e.type?new Gd(t[16],t):null}(tn(),le(),16==(16&e))};let xD=(()=>{class e{}return e.__NG_ELEMENT_ID__=MD,e})();const OD=[new JC],FD=new np([new qC]),kD=new rp(OD),VD=function(){return op(tn(),le())};let Wd=(()=>{class e{}return e.__NG_ELEMENT_ID__=VD,e})();const UD=Wd,jD=class extends UD{constructor(t,n,r){super(),this._declarationLView=t,this._declarationTContainer=n,this.elementRef=r}createEmbeddedView(t){const n=this._declarationTContainer.tViews,r=Za(this._declarationLView,n,t,16,null,n.declTNode,null,null,null,null);r[17]=this._declarationLView[this._declarationTContainer.index];const l=this._declarationLView[19];return null!==l&&(r[19]=l.createEmbeddedView(n)),na(n,r,t),new Gd(r)}};function op(e,t){return 4&e.type?new jD(t,e,Hu(e,t)):null}class gl{}class XC{}const $D=function(){return nb(tn(),le())};let sp=(()=>{class e{}return e.__NG_ELEMENT_ID__=$D,e})();const WD=sp,eb=class extends WD{constructor(t,n,r){super(),this._lContainer=t,this._hostTNode=n,this._hostLView=r}get element(){return Hu(this._hostTNode,this._hostLView)}get injector(){return new Ir(this._hostTNode,this._hostLView)}get parentInjector(){const t=y(this._hostTNode,this._hostLView);if($l(t)){const n=Do(t,this._hostLView),r=zi(t);return new Ir(n[1].data[r+8],n)}return new Ir(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(t){const n=tb(this._lContainer);return null!==n&&n[t]||null}get length(){return this._lContainer.length-10}createEmbeddedView(t,n,r){const s=t.createEmbeddedView(n||{});return this.insert(s,r),s}createComponent(t,n,r,s,l){const c=r||this.parentInjector;if(!l&&null==t.ngModule&&c){const g=c.get(gl,null);g&&(l=g)}const d=t.create(c,s,void 0,l);return this.insert(d.hostView,n),d}insert(t,n){const r=t._lView,s=r[1];if(Dn(r[3])){const D=this.indexOf(t);if(-1!==D)this.detach(D);else{const I=r[3],R=new eb(I,I[6],I[3]);R.detach(R.indexOf(t))}}const l=this._adjustIndex(n),c=this._lContainer;!function(e,t,n,r){const s=10+r,l=n.length;r>0&&(n[s-1][4]=t),rSg});class Db extends BC{constructor(t,n){super(),this.componentDef=t,this.ngModule=n,this.componentType=t.type,this.selector=t.selectors.map(Fg).join(","),this.ngContentSelectors=t.ngContentSelectors?t.ngContentSelectors:[],this.isBoundToModule=!!n}get inputs(){return Eb(this.componentDef.inputs)}get outputs(){return Eb(this.componentDef.outputs)}create(t,n,r,s){const l=(s=s||this.ngModule)?function(e,t){return{get:(n,r,s)=>{const l=e.get(n,zu,s);return l!==zu||r===zu?l:t.get(n,r,s)}}}(t,s.injector):t,c=l.get(tp,Dt),d=l.get(Jm,null),g=c.createRenderer(null,this.componentDef),v=this.componentDef.selectors[0][0]||"div",D=r?function(e,t,n){if($e(e))return e.selectRootElement(t,n===ct.ShadowDom);let r="string"==typeof t?e.querySelector(t):t;return r.textContent="",r}(g,r,this.componentDef.encapsulation):Dc(c.createRenderer(null,this.componentDef),v,function(e){const t=e.toLowerCase();return"svg"===t?"http://www.w3.org/2000/svg":"math"===t?"http://www.w3.org/1998/MathML/":null}(v)),I=this.componentDef.onPush?576:528,R=function(e,t){return{components:[],scheduler:e||Sg,clean:wh,playerHandler:t||null,flags:0}}(),k=el(0,null,null,1,0,null,null,null,null,null),U=Za(null,k,R,I,null,null,c,g,d,l);let W,B;Fs(U);try{const me=function(e,t,n,r,s,l){const c=n[1];n[20]=e;const g=Xa(c,20,2,"#host",null),v=g.mergedAttrs=t.hostAttrs;null!==v&&(Vo(g,v,!0),null!==e&&(js(s,e,v),null!==g.classes&&xc(s,e,g.classes),null!==g.styles&&Gf(s,e,g.styles)));const D=r.createRenderer(e,t),I=Za(n,ad(t),null,t.onPush?64:16,n[20],g,r,D,l||null,null);return c.firstCreatePass&&(E(_(g,n),c,t.type),tl(c,g),yh(g,n.length,1)),wu(n,I),n[20]=I}(D,this.componentDef,U,c,g);if(D)if(r)js(g,D,["ng-version",zC.full]);else{const{attrs:X,classes:He}=function(e){const t=[],n=[];let r=1,s=2;for(;r0&&xc(g,D,He.join(" "))}if(B=dr(k,20),void 0!==n){const X=B.projection=[];for(let He=0;Heg(c,t)),t.contentQueries){const g=tn();t.contentQueries(1,c,g.directiveStart)}const d=tn();return!l.firstCreatePass||null===t.hostBindings&&null===t.hostAttrs||(zn(d.index),_d(n[1],d,0,d.directiveStart,d.directiveEnd,t),_h(t,c)),c}(me,this.componentDef,U,R,[Bh]),na(k,U,null)}finally{Ls()}return new GS(this.componentType,W,Hu(B,U),U,B)}}class GS extends class{}{constructor(t,n,r,s,l){super(),this.location=r,this._rootLView=s,this._tNode=l,this.instance=n,this.hostView=this.changeDetectorRef=new AD(s),this.componentType=t}get injector(){return new Ir(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(t){this.hostView.onDestroy(t)}}const qu=new Map;class qS extends gl{constructor(t,n){super(),this._parent=n,this._bootstrapComponents=[],this.injector=this,this.destroyCbs=[],this.componentFactoryResolver=new wb(this);const r=pn(t),s=t[Es]||null;s&&Hm(s),this._bootstrapComponents=vi(r.bootstrap),this._r3Injector=sm(t,n,[{provide:gl,useValue:this},{provide:Bu,useValue:this.componentFactoryResolver}],ue(t)),this._r3Injector._resolveInjectorDefTypes(),this.instance=this.get(t)}get(t,n=Jt.THROW_IF_NOT_FOUND,r=Ge.Default){return t===Jt||t===gl||t===Uo?this:this._r3Injector.get(t,n,r)}destroy(){const t=this._r3Injector;!t.destroyed&&t.destroy(),this.destroyCbs.forEach(n=>n()),this.destroyCbs=null}onDestroy(t){this.destroyCbs.push(t)}}class c_ extends XC{constructor(t){super(),this.moduleType=t,null!==pn(t)&&function(e){const t=new Set;!function n(r){const s=pn(r,!0),l=s.id;null!==l&&(function(e,t,n){if(t&&t!==n)throw new Error(`Duplicate module registered for ${e} - ${ue(t)} vs ${ue(t.name)}`)}(l,qu.get(l),r),qu.set(l,r));const c=vi(s.imports);for(const d of c)t.has(d)||(t.add(d),n(d))}(e)}(t)}create(t){return new qS(this.moduleType,t)}}function Ab(e,t,n,r,s,l){const c=t+n;return Rn(e,c,s)?function(e,t,n){return e[t]=n}(e,c+1,l?r.call(l,s):r(s)):function(e,t){const n=e[t];return n===nt?void 0:n}(e,c+1)}function Pb(e,t){const n=mt();let r;const s=e+20;n.firstCreatePass?(r=function(e,t){if(t)for(let n=t.length-1;n>=0;n--){const r=t[n];if(e===r.name)return r}throw new be("302",`The pipe '${e}' could not be found!`)}(t,n.pipeRegistry),n.data[s]=r,r.onDestroy&&(n.destroyHooks||(n.destroyHooks=[])).push(s,r.onDestroy)):r=n.data[s];const l=r.factory||(r.factory=ui(r.type)),c=ze(Vd);try{const d=So(!1),g=l();return So(d),function(e,t,n,r){n>=e.data.length&&(e.data[n]=null,e.blueprint[n]=null),t[n]=r}(n,le(),s,g),g}finally{ze(c)}}function Ob(e,t,n){const r=e+20,s=le(),l=$r(s,r);return function(e,t){Si.isWrapped(t)&&(t=Si.unwrap(t),e[Ye.lFrame.bindingIndex]=nt);return t}(s,function(e,t){return e[1].data[t].pure}(s,r)?Ab(s,function(){const e=Ye.lFrame;let t=e.bindingRootIndex;return-1===t&&(t=e.bindingRootIndex=e.tView.bindingStartIndex),t}(),t,l.transform,n,l):l.transform(n))}function d_(e){return t=>{setTimeout(e,void 0,t)}}const $o=class extends Z.x{constructor(t=!1){super(),this.__isAsync=t}emit(t){super.next(t)}subscribe(t,n,r){var s,l,c;let d=t,g=n||(()=>null),v=r;if(t&&"object"==typeof t){const I=t;d=null===(s=I.next)||void 0===s?void 0:s.bind(I),g=null===(l=I.error)||void 0===l?void 0:l.bind(I),v=null===(c=I.complete)||void 0===c?void 0:c.bind(I)}this.__isAsync&&(g=d_(g),d&&(d=d_(d)),v&&(v=d_(v)));const D=super.subscribe({next:d,error:g,complete:v});return t instanceof ye.w0&&t.add(D),D}};function cT(){return this._results[sa()]()}class dp{constructor(t=!1){this._emitDistinctChangesOnly=t,this.dirty=!0,this._results=[],this._changesDetected=!1,this._changes=null,this.length=0,this.first=void 0,this.last=void 0;const n=sa(),r=dp.prototype;r[n]||(r[n]=cT)}get changes(){return this._changes||(this._changes=new $o)}get(t){return this._results[t]}map(t){return this._results.map(t)}filter(t){return this._results.filter(t)}find(t){return this._results.find(t)}reduce(t,n){return this._results.reduce(t,n)}forEach(t){this._results.forEach(t)}some(t){return this._results.some(t)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(t,n){const r=this;r.dirty=!1;const s=xr(t);(this._changesDetected=!function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r0)r.push(c[d/2]);else{const v=l[d+1],D=t[-g];for(let I=10;I{class e{constructor(n){this.appInits=n,this.resolve=ep,this.reject=ep,this.initialized=!1,this.done=!1,this.donePromise=new Promise((r,s)=>{this.resolve=r,this.reject=s})}runInitializers(){if(this.initialized)return;const n=[],r=()=>{this.done=!0,this.resolve()};if(this.appInits)for(let s=0;s{l.subscribe({complete:d,error:g})});n.push(c)}}Promise.all(n).then(()=>{r()}).catch(s=>{this.reject(s)}),0===n.length&&r(),this.initialized=!0}}return e.\u0275fac=function(n){return new(n||e)(ln(w_,8))},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();const sw=new Zt("AppId"),zT={provide:sw,useFactory:function(){return`${E_()}${E_()}${E_()}`},deps:[]};function E_(){return String.fromCharCode(97+Math.floor(25*Math.random()))}const aw=new Zt("Platform Initializer"),lw=new Zt("Platform ID"),uw=new Zt("appBootstrapListener");let cw=(()=>{class e{log(n){console.log(n)}warn(n){console.warn(n)}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();const pp=new Zt("LocaleId"),dw=new Zt("DefaultCurrencyCode");class YT{constructor(t,n){this.ngModuleFactory=t,this.componentFactories=n}}const D_=function(e){return new c_(e)},KT=D_,JT=function(e){return Promise.resolve(D_(e))},fw=function(e){const t=D_(e),r=vi(pn(e).declarations).reduce((s,l)=>{const c=Wt(l);return c&&s.push(new Db(c)),s},[]);return new YT(t,r)},QT=fw,ZT=function(e){return Promise.resolve(fw(e))};let rf=(()=>{class e{constructor(){this.compileModuleSync=KT,this.compileModuleAsync=JT,this.compileModuleAndAllComponentsSync=QT,this.compileModuleAndAllComponentsAsync=ZT}clearCache(){}clearCacheFor(n){}getModuleId(n){}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();const tA=(()=>Promise.resolve(0))();function S_(e){"undefined"==typeof Zone?tA.then(()=>{e&&e.apply(null,null)}):Zone.current.scheduleMicroTask("scheduleMicrotask",e)}class Qr{constructor({enableLongStackTrace:t=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new $o(!1),this.onMicrotaskEmpty=new $o(!1),this.onStable=new $o(!1),this.onError=new $o(!1),"undefined"==typeof Zone)throw new Error("In this configuration Angular requires Zone.js");Zone.assertZonePatched();const s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),t&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!r&&n,s.shouldCoalesceRunChangeDetection=r,s.lastRequestAnimationFrameId=-1,s.nativeRequestAnimationFrame=function(){let e=Ot.requestAnimationFrame,t=Ot.cancelAnimationFrame;if("undefined"!=typeof Zone&&e&&t){const n=e[Zone.__symbol__("OriginalDelegate")];n&&(e=n);const r=t[Zone.__symbol__("OriginalDelegate")];r&&(t=r)}return{nativeRequestAnimationFrame:e,nativeCancelAnimationFrame:t}}().nativeRequestAnimationFrame,function(e){const t=()=>{!function(e){e.isCheckStableRunning||-1!==e.lastRequestAnimationFrameId||(e.lastRequestAnimationFrameId=e.nativeRequestAnimationFrame.call(Ot,()=>{e.fakeTopEventTask||(e.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{e.lastRequestAnimationFrameId=-1,A_(e),e.isCheckStableRunning=!0,T_(e),e.isCheckStableRunning=!1},void 0,()=>{},()=>{})),e.fakeTopEventTask.invoke()}),A_(e))}(e)};e._inner=e._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(n,r,s,l,c,d)=>{try{return hw(e),n.invokeTask(s,l,c,d)}finally{(e.shouldCoalesceEventChangeDetection&&"eventTask"===l.type||e.shouldCoalesceRunChangeDetection)&&t(),pw(e)}},onInvoke:(n,r,s,l,c,d,g)=>{try{return hw(e),n.invoke(s,l,c,d,g)}finally{e.shouldCoalesceRunChangeDetection&&t(),pw(e)}},onHasTask:(n,r,s,l)=>{n.hasTask(s,l),r===s&&("microTask"==l.change?(e._hasPendingMicrotasks=l.microTask,A_(e),T_(e)):"macroTask"==l.change&&(e.hasPendingMacrotasks=l.macroTask))},onHandleError:(n,r,s,l)=>(n.handleError(s,l),e.runOutsideAngular(()=>e.onError.emit(l)),!1)})}(s)}static isInAngularZone(){return!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!Qr.isInAngularZone())throw new Error("Expected to be in Angular Zone, but it is not!")}static assertNotInAngularZone(){if(Qr.isInAngularZone())throw new Error("Expected to not be in Angular Zone, but it is!")}run(t,n,r){return this._inner.run(t,n,r)}runTask(t,n,r,s){const l=this._inner,c=l.scheduleEventTask("NgZoneEvent: "+s,t,rA,ep,ep);try{return l.runTask(c,n,r)}finally{l.cancelTask(c)}}runGuarded(t,n,r){return this._inner.runGuarded(t,n,r)}runOutsideAngular(t){return this._outer.run(t)}}const rA={};function T_(e){if(0==e._nesting&&!e.hasPendingMicrotasks&&!e.isStable)try{e._nesting++,e.onMicrotaskEmpty.emit(null)}finally{if(e._nesting--,!e.hasPendingMicrotasks)try{e.runOutsideAngular(()=>e.onStable.emit(null))}finally{e.isStable=!0}}}function A_(e){e.hasPendingMicrotasks=!!(e._hasPendingMicrotasks||(e.shouldCoalesceEventChangeDetection||e.shouldCoalesceRunChangeDetection)&&-1!==e.lastRequestAnimationFrameId)}function hw(e){e._nesting++,e.isStable&&(e.isStable=!1,e.onUnstable.emit(null))}function pw(e){e._nesting--,T_(e)}class sA{constructor(){this.hasPendingMicrotasks=!1,this.hasPendingMacrotasks=!1,this.isStable=!0,this.onUnstable=new $o,this.onMicrotaskEmpty=new $o,this.onStable=new $o,this.onError=new $o}run(t,n,r){return t.apply(n,r)}runGuarded(t,n,r){return t.apply(n,r)}runOutsideAngular(t){return t()}runTask(t,n,r,s){return t.apply(n,r)}}let gw=(()=>{class e{constructor(n){this._ngZone=n,this._pendingCount=0,this._isZoneStable=!0,this._didWork=!1,this._callbacks=[],this.taskTrackingZone=null,this._watchAngularEvents(),n.run(()=>{this.taskTrackingZone="undefined"==typeof Zone?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){this._ngZone.onUnstable.subscribe({next:()=>{this._didWork=!0,this._isZoneStable=!1}}),this._ngZone.runOutsideAngular(()=>{this._ngZone.onStable.subscribe({next:()=>{Qr.assertNotInAngularZone(),S_(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}})})}increasePendingRequestCount(){return this._pendingCount+=1,this._didWork=!0,this._pendingCount}decreasePendingRequestCount(){if(this._pendingCount-=1,this._pendingCount<0)throw new Error("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount}isStable(){return this._isZoneStable&&0===this._pendingCount&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())S_(()=>{for(;0!==this._callbacks.length;){let n=this._callbacks.pop();clearTimeout(n.timeoutId),n.doneCb(this._didWork)}this._didWork=!1});else{let n=this.getPendingTasks();this._callbacks=this._callbacks.filter(r=>!r.updateCb||!r.updateCb(n)||(clearTimeout(r.timeoutId),!1)),this._didWork=!0}}getPendingTasks(){return this.taskTrackingZone?this.taskTrackingZone.macroTasks.map(n=>({source:n.source,creationLocation:n.creationLocation,data:n.data})):[]}addCallback(n,r,s){let l=-1;r&&r>0&&(l=setTimeout(()=>{this._callbacks=this._callbacks.filter(c=>c.timeoutId!==l),n(this._didWork,this.getPendingTasks())},r)),this._callbacks.push({doneCb:n,timeoutId:l,updateCb:s})}whenStable(n,r,s){if(s&&!this.taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(n,r,s),this._runCallbacksIfReady()}getPendingRequestCount(){return this._pendingCount}findProviders(n,r,s){return[]}}return e.\u0275fac=function(n){return new(n||e)(ln(Qr))},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})(),mw=(()=>{class e{constructor(){this._applications=new Map,I_.addToWindow(this)}registerApplication(n,r){this._applications.set(n,r)}unregisterApplication(n){this._applications.delete(n)}unregisterAllApplications(){this._applications.clear()}getTestability(n){return this._applications.get(n)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(n,r=!0){return I_.findTestabilityInTree(this,n,r)}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();class aA{addToWindow(t){}findTestabilityInTree(t,n,r){return null}}function lA(e){I_=e}let I_=new aA,_w=!0,yw=!1;function uA(){if(yw)throw new Error("Cannot enable prod mode after platform setup.");_w=!1}let io;const Cw=new Zt("AllowMultipleToken");class mA{constructor(t,n){this.name=t,this.token=n}}function bw(e,t,n=[]){const r=`Platform: ${t}`,s=new Zt(r);return(l=[])=>{let c=ww();if(!c||c.injector.get(Cw,!1))if(e)e(n.concat(l).concat({provide:s,useValue:!0}));else{const d=n.concat(l).concat({provide:s,useValue:!0},{provide:hs,useValue:"platform"});!function(e){if(io&&!io.destroyed&&!io.injector.get(Cw,!1))throw new Error("There can be only one platform. Destroy the previous one to create a new one.");io=e.get(Ew);const t=e.get(aw,null);t&&t.forEach(n=>n())}(Jt.create({providers:d,name:r}))}return function(e){const t=ww();if(!t)throw new Error("No platform exists!");if(!t.injector.get(e,null))throw new Error("A platform with a different configuration has been created. Please destroy it first.");return t}(s)}}function ww(){return io&&!io.destroyed?io:null}let Ew=(()=>{class e{constructor(n){this._injector=n,this._modules=[],this._destroyListeners=[],this._destroyed=!1}bootstrapModuleFactory(n,r){const d=function(e,t){let n;return n="noop"===e?new sA:("zone.js"===e?void 0:e)||new Qr({enableLongStackTrace:(yw=!0,_w),shouldCoalesceEventChangeDetection:!!(null==t?void 0:t.ngZoneEventCoalescing),shouldCoalesceRunChangeDetection:!!(null==t?void 0:t.ngZoneRunCoalescing)}),n}(r?r.ngZone:void 0,{ngZoneEventCoalescing:r&&r.ngZoneEventCoalescing||!1,ngZoneRunCoalescing:r&&r.ngZoneRunCoalescing||!1}),g=[{provide:Qr,useValue:d}];return d.run(()=>{const v=Jt.create({providers:g,parent:this.injector,name:n.moduleType.name}),D=n.create(v),I=D.injector.get(us,null);if(!I)throw new Error("No ErrorHandler. Is platform module (BrowserModule) included?");return d.runOutsideAngular(()=>{const R=d.onError.subscribe({next:k=>{I.handleError(k)}});D.onDestroy(()=>{M_(this._modules,D),R.unsubscribe()})}),function(e,t,n){try{const r=n();return Rm(r)?r.catch(s=>{throw t.runOutsideAngular(()=>e.handleError(s)),s}):r}catch(r){throw t.runOutsideAngular(()=>e.handleError(r)),r}}(I,d,()=>{const R=D.injector.get(Ku);return R.runInitializers(),R.donePromise.then(()=>(Hm(D.injector.get(pp,Kh)||Kh),this._moduleDoBootstrap(D),D))})})}bootstrapModule(n,r=[]){const s=Dw({},r);return function(e,t,n){const r=new c_(n);return Promise.resolve(r)}(0,0,n).then(l=>this.bootstrapModuleFactory(l,s))}_moduleDoBootstrap(n){const r=n.injector.get(of);if(n._bootstrapComponents.length>0)n._bootstrapComponents.forEach(s=>r.bootstrap(s));else{if(!n.instance.ngDoBootstrap)throw new Error(`The module ${ue(n.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);n.instance.ngDoBootstrap(r)}this._modules.push(n)}onDestroy(n){this._destroyListeners.push(n)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new Error("The platform has already been destroyed!");this._modules.slice().forEach(n=>n.destroy()),this._destroyListeners.forEach(n=>n()),this._destroyed=!0}get destroyed(){return this._destroyed}}return e.\u0275fac=function(n){return new(n||e)(ln(Jt))},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();function Dw(e,t){return Array.isArray(t)?t.reduce(Dw,e):Object.assign(Object.assign({},e),t)}let of=(()=>{class e{constructor(n,r,s,l,c){this._zone=n,this._injector=r,this._exceptionHandler=s,this._componentFactoryResolver=l,this._initStatus=c,this._bootstrapListeners=[],this._views=[],this._runningTick=!1,this._stable=!0,this.componentTypes=[],this.components=[],this._onMicrotaskEmptySubscription=this._zone.onMicrotaskEmpty.subscribe({next:()=>{this._zone.run(()=>{this.tick()})}});const d=new pe.y(v=>{this._stable=this._zone.isStable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks,this._zone.runOutsideAngular(()=>{v.next(this._stable),v.complete()})}),g=new pe.y(v=>{let D;this._zone.runOutsideAngular(()=>{D=this._zone.onStable.subscribe(()=>{Qr.assertNotInAngularZone(),S_(()=>{!this._stable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks&&(this._stable=!0,v.next(!0))})})});const I=this._zone.onUnstable.subscribe(()=>{Qr.assertInAngularZone(),this._stable&&(this._stable=!1,this._zone.runOutsideAngular(()=>{v.next(!1)}))});return()=>{D.unsubscribe(),I.unsubscribe()}});this.isStable=function(...e){const t=(0,Q.yG)(e),n=(0,Q._6)(e,1/0),r=e;return r.length?1===r.length?(0,m.Xf)(r[0]):(0,x.J)(n)((0,ee.D)(r,t)):ce.E}(d,g.pipe(function(e={}){const{connector:t=(()=>new Z.x),resetOnError:n=!0,resetOnComplete:r=!0,resetOnRefCountZero:s=!0}=e;return l=>{let c,d,g,v=0,D=!1,I=!1;const R=()=>{null==d||d.unsubscribe(),d=void 0},k=()=>{R(),c=g=void 0,D=I=!1},U=()=>{const W=c;k(),null==W||W.unsubscribe()};return(0,Y.e)((W,B)=>{v++,!I&&!D&&R();const me=g=null!=g?g:t();B.add(()=>{v--,0===v&&!I&&!D&&(d=xe(U,s))}),me.subscribe(B),!c&&v>0&&(c=new re.Hp({next:X=>me.next(X),error:X=>{I=!0,R(),d=xe(k,n,X),me.error(X)},complete:()=>{D=!0,R(),d=xe(k,r),me.complete()}}),(0,m.Xf)(W).subscribe(c))})(l)}}()))}bootstrap(n,r){if(!this._initStatus.done)throw new Error("Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.");let s;s=n instanceof BC?n:this._componentFactoryResolver.resolveComponentFactory(n),this.componentTypes.push(s.componentType);const l=function(e){return e.isBoundToModule}(s)?void 0:this._injector.get(gl),d=s.create(Jt.NULL,[],r||s.selector,l),g=d.location.nativeElement,v=d.injector.get(gw,null),D=v&&d.injector.get(mw);return v&&D&&D.registerApplication(g,v),d.onDestroy(()=>{this.detachView(d.hostView),M_(this.components,d),D&&D.unregisterApplication(g)}),this._loadComponent(d),d}tick(){if(this._runningTick)throw new Error("ApplicationRef.tick is called recursively");try{this._runningTick=!0;for(let n of this._views)n.detectChanges()}catch(n){this._zone.runOutsideAngular(()=>this._exceptionHandler.handleError(n))}finally{this._runningTick=!1}}attachView(n){const r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){const r=n;M_(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n),this._injector.get(uw,[]).concat(this._bootstrapListeners).forEach(s=>s(n))}ngOnDestroy(){this._views.slice().forEach(n=>n.destroy()),this._onMicrotaskEmptySubscription.unsubscribe()}get viewCount(){return this._views.length}}return e.\u0275fac=function(n){return new(n||e)(ln(Qr),ln(Jt),ln(us),ln(Bu),ln(Ku))},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();function M_(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class wA{}class DA{}const SA={factoryPathPrefix:"",factoryPathSuffix:".ngfactory"};let TA=(()=>{class e{constructor(n,r){this._compiler=n,this._config=r||SA}load(n){return this.loadAndCompile(n)}loadAndCompile(n){let[r,s]=n.split("#");return void 0===s&&(s="default"),O(9647)(r).then(l=>l[s]).then(l=>Iw(l,r,s)).then(l=>this._compiler.compileModuleAsync(l))}loadFactory(n){let[r,s]=n.split("#"),l="NgFactory";return void 0===s&&(s="default",l=""),O(9647)(this._config.factoryPathPrefix+r+this._config.factoryPathSuffix).then(c=>c[s+l]).then(c=>Iw(c,r,s))}}return e.\u0275fac=function(n){return new(n||e)(ln(rf),ln(DA,8))},e.\u0275prov=bt({token:e,factory:e.\u0275fac}),e})();function Iw(e,t,n){if(!e)throw new Error(`Cannot find '${n}' in '${t}'`);return e}const NA=function(e){return null},kA=bw(null,"core",[{provide:lw,useValue:"unknown"},{provide:Ew,deps:[Jt]},{provide:mw,deps:[]},{provide:cw,deps:[]}]),BA=[{provide:of,useClass:of,deps:[Qr,Jt,us,Bu,Ku]},{provide:BS,deps:[Qr],useFactory:function(e){let t=[];return e.onStable.subscribe(()=>{for(;t.length;)t.pop()()}),function(n){t.push(n)}}},{provide:Ku,useClass:Ku,deps:[[new gi,w_]]},{provide:rf,useClass:rf,deps:[]},zT,{provide:np,useFactory:function(){return FD},deps:[]},{provide:rp,useFactory:function(){return kD},deps:[]},{provide:pp,useFactory:function(e){return Hm(e=e||"undefined"!=typeof $localize&&$localize.locale||Kh),e},deps:[[new zs(pp),new gi,new Mo]]},{provide:dw,useValue:"USD"}];let $A=(()=>{class e{constructor(n){}}return e.\u0275fac=function(n){return new(n||e)(ln(of))},e.\u0275mod=ur({type:e}),e.\u0275inj=wn({providers:BA}),e})()},8967:(Ie,ne,O)=>{"use strict";O.d(ne,{gz:()=>gn,F0:()=>yn,rH:()=>$i,Bz:()=>xa,lC:()=>Us});var x=O(8583),m=O(7525),ce=O(9359);class Q extends ce.x{constructor(p){super(),this._value=p}get value(){return this.getValue()}_subscribe(p){const f=super._subscribe(p);return!f.closed&&p.next(this._value),f}getValue(){const{hasError:p,thrownError:f,_value:y}=this;if(p)throw f;return this._throwIfClosed(),y}next(p){super.next(this._value=p)}}var ee=O(7980),Ae=O(447),Z=O(9517),ye=O(8330),pe=O(2692),re=O(8007),Y=O(9299),_e=O(8499),xe=O(6903);function ue(_,p,f){_?(0,xe.f)(f,_,p):p()}const te=(0,O(5776).d)(_=>function(){_(this),this.name="EmptyError",this.message="no elements in sequence"});var ge=O(549);function de(..._){return(0,ge.J)(1)((0,Z.D)(_,(0,re.yG)(_)))}var he=O(5955);function be(_){return new ee.y(p=>{(0,he.Xf)(_()).subscribe(p)})}var at=O(9593),Se=O(2085);function ae(){return(0,Se.e)((_,p)=>{let f=null;_._refCount++;const y=(0,_e.x)(p,void 0,void 0,void 0,()=>{if(!_||_._refCount<=0||0<--_._refCount)return void(f=null);const E=_._connection,A=f;f=null,E&&(!A||E===A)&&E.unsubscribe(),p.unsubscribe()});_.subscribe(y),y.closed||(f=_.connect())})}class Le extends ee.y{constructor(p,f){super(),this.source=p,this.subjectFactory=f,this._subject=null,this._refCount=0,this._connection=null,(0,Se.A)(p)&&(this.lift=p.lift)}_subscribe(p){return this.getSubject().subscribe(p)}getSubject(){const p=this._subject;return(!p||p.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;const{_connection:p}=this;this._subject=this._connection=null,null==p||p.unsubscribe()}connect(){let p=this._connection;if(!p){p=this._connection=new at.w0;const f=this.getSubject();p.add(this.source.subscribe((0,_e.x)(f,void 0,()=>{this._teardown(),f.complete()},y=>{this._teardown(),f.error(y)},()=>this._teardown()))),p.closed&&(this._connection=null,p=at.w0.EMPTY)}return p}refCount(){return ae()(this)}}var ve=O(4945),Qe=O(9018);function pt(_,p,f,y,E){return(A,N)=>{let L=f,$=p,we=0;A.subscribe((0,_e.x)(N,ot=>{const Be=we++;$=L?_($,ot,Be):(L=!0,ot),y&&N.next($)},E&&(()=>{L&&N.next($),N.complete()})))}}function Me(_,p){return(0,Se.e)(pt(_,p,arguments.length>=2,!0))}var Nn=O(4970);function Zr(_){return _<=0?()=>Qe.E:(0,Se.e)((p,f)=>{let y=[];p.subscribe((0,_e.x)(f,E=>{y.push(E),_{for(const E of y)f.next(E);f.complete()},void 0,()=>{y=null}))})}function ao(_=G){return(0,Se.e)((p,f)=>{let y=!1;p.subscribe((0,_e.x)(f,E=>{y=!0,f.next(E)},()=>y?f.complete():f.error(_())))})}function G(){return new te}function q(_){return(0,Se.e)((p,f)=>{let y=!1;p.subscribe((0,_e.x)(f,E=>{y=!0,f.next(E)},()=>{y||f.next(_),f.complete()}))})}var ie=O(5598);function De(_,p){const f=arguments.length>=2;return y=>y.pipe(_?(0,Nn.h)((E,A)=>_(E,A,y)):ye.y,(0,ie.q)(1),f?q(p):ao(()=>new te))}var Ce=O(5975);function Ne(_,p,f){const y=(0,Ce.m)(_)||p||f?{next:_,error:p,complete:f}:_;return y?(0,Se.e)((E,A)=>{var N;null===(N=y.subscribe)||void 0===N||N.call(y);let L=!0;E.subscribe((0,_e.x)(A,$=>{var we;null===(we=y.next)||void 0===we||we.call(y,$),A.next($)},()=>{var $;L=!1,null===($=y.complete)||void 0===$||$.call(y),A.complete()},$=>{var we;L=!1,null===(we=y.error)||void 0===we||we.call(y,$),A.error($)},()=>{var $,we;L&&(null===($=y.unsubscribe)||void 0===$||$.call(y)),null===(we=y.finalize)||void 0===we||we.call(y)}))}):ye.y}var qe=O(7969),Pe=O(1528),Ue=O(3568),Lt=O(4551),_t=O(3159);class Kt{constructor(p,f){this.id=p,this.url=f}}class bt extends Kt{constructor(p,f,y="imperative",E=null){super(p,f),this.navigationTrigger=y,this.restoredState=E}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}}class bn extends Kt{constructor(p,f,y){super(p,f),this.urlAfterRedirects=y}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}}class wn extends Kt{constructor(p,f,y){super(p,f),this.reason=y}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}}class fn extends Kt{constructor(p,f,y){super(p,f),this.error=y}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}}class da extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class En extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class lo extends Kt{constructor(p,f,y,E,A){super(p,f),this.urlAfterRedirects=y,this.state=E,this.shouldActivate=A}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}}class ys extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class uo extends Kt{constructor(p,f,y,E){super(p,f),this.urlAfterRedirects=y,this.state=E}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class co{constructor(p){this.route=p}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}}class vs{constructor(p){this.route=p}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}}class Oi{constructor(p){this.snapshot=p}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class Ge{constructor(p){this.snapshot=p}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class Vt{constructor(p){this.snapshot=p}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class We{constructor(p){this.snapshot=p}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class ze{constructor(p,f,y){this.routerEvent=p,this.position=f,this.anchor=y}toString(){return`Scroll(anchor: '${this.anchor}', position: '${this.position?`${this.position[0]}, ${this.position[1]}`:null}')`}}const tt="primary";class Cs{constructor(p){this.params=p||{}}has(p){return Object.prototype.hasOwnProperty.call(this.params,p)}get(p){if(this.has(p)){const f=this.params[p];return Array.isArray(f)?f[0]:f}return null}getAll(p){if(this.has(p)){const f=this.params[p];return Array.isArray(f)?f:[f]}return[]}get keys(){return Object.keys(this.params)}}function Gt(_){return new Cs(_)}const hn="ngNavigationCancelingError";function Gn(_){const p=Error("NavigationCancelingError: "+_);return p[hn]=!0,p}function ct(_,p,f){const y=f.path.split("/");if(y.length>_.length||"full"===f.pathMatch&&(p.hasChildren()||y.length<_.length))return null;const E={};for(let A=0;Ay[A]===E)}return _===p}function Xr(_){return Array.prototype.concat.apply([],_)}function Ot(_){return _.length>0?_[_.length-1]:null}function on(_,p){for(const f in _)_.hasOwnProperty(f)&&p(_[f],f)}function sn(_){return(0,m.CqO)(_)?_:(0,m.QGY)(_)?(0,Z.D)(Promise.resolve(_)):(0,ve.of)(_)}const ei={exact:function Es(_,p,f){if(!ur(_.segments,p.segments)||!ti(_.segments,p.segments,f)||_.numberOfChildren!==p.numberOfChildren)return!1;for(const y in p.children)if(!_.children[y]||!Es(_.children[y],p.children[y],f))return!1;return!0},subset:Fi},Ni={exact:function(_,p){return dt(_,p)},subset:function(_,p){return Object.keys(p).length<=Object.keys(_).length&&Object.keys(p).every(f=>bs(_[f],p[f]))},ignored:()=>!0};function fo(_,p,f){return ei[f.paths](_.root,p.root,f.matrixParams)&&Ni[f.queryParams](_.queryParams,p.queryParams)&&!("exact"===f.fragment&&_.fragment!==p.fragment)}function Fi(_,p,f){return Ds(_,p,p.segments,f)}function Ds(_,p,f,y){if(_.segments.length>f.length){const E=_.segments.slice(0,f.length);return!(!ur(E,f)||p.hasChildren()||!ti(E,f,y))}if(_.segments.length===f.length){if(!ur(_.segments,f)||!ti(_.segments,f,y))return!1;for(const E in p.children)if(!_.children[E]||!Fi(_.children[E],p.children[E],y))return!1;return!0}{const E=f.slice(0,_.segments.length),A=f.slice(_.segments.length);return!!(ur(_.segments,E)&&ti(_.segments,E,y)&&_.children[tt])&&Ds(_.children[tt],p,A,y)}}function ti(_,p,f){return p.every((y,E)=>Ni[f](_[E].parameters,y.parameters))}class ni{constructor(p,f,y){this.root=p,this.queryParams=f,this.fragment=y}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=Gt(this.queryParams)),this._queryParamMap}toString(){return ha.serialize(this)}}class lt{constructor(p,f){this.segments=p,this.children=f,this.parent=null,on(f,(y,E)=>y.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return Wt(this)}}class an{constructor(p,f){this.path=p,this.parameters=f}get parameterMap(){return this._parameterMap||(this._parameterMap=Gt(this.parameters)),this._parameterMap}toString(){return Tt(this)}}function ur(_,p){return _.length===p.length&&_.every((f,y)=>f.path===p[y].path)}class Vr{}class Wo{parse(p){const f=new Nt(p);return new ni(f.parseRootSegment(),f.parseQueryParams(),f.parseFragment())}serialize(p){const f=`/${Fn(p.root,!0)}`,y=function(_){const p=Object.keys(_).map(f=>{const y=_[f];return Array.isArray(y)?y.map(E=>`${pn(f)}=${pn(E)}`).join("&"):`${pn(f)}=${pn(y)}`}).filter(f=>!!f);return p.length?`?${p.join("&")}`:""}(p.queryParams);var _;return`${f}${y}${"string"==typeof p.fragment?`#${_=p.fragment,encodeURI(_)}`:""}`}}const ha=new Wo;function Wt(_){return _.segments.map(p=>Tt(p)).join("/")}function Fn(_,p){if(!_.hasChildren())return Wt(_);if(p){const f=_.children[tt]?Fn(_.children[tt],!1):"",y=[];return on(_.children,(E,A)=>{A!==tt&&y.push(`${A}:${Fn(E,!1)}`)}),y.length>0?`${f}(${y.join("//")})`:f}{const f=function(_,p){let f=[];return on(_.children,(y,E)=>{E===tt&&(f=f.concat(p(y,E)))}),on(_.children,(y,E)=>{E!==tt&&(f=f.concat(p(y,E)))}),f}(_,(y,E)=>E===tt?[Fn(_.children[tt],!1)]:[`${E}:${Fn(y,!1)}`]);return 1===Object.keys(_.children).length&&null!=_.children[tt]?`${Wt(_)}/${f[0]}`:`${Wt(_)}/(${f.join("//")})`}}function Ur(_){return encodeURIComponent(_).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function pn(_){return Ur(_).replace(/%3B/gi,";")}function Tn(_){return Ur(_).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function Te(_){return decodeURIComponent(_)}function it(_){return Te(_.replace(/\+/g,"%20"))}function Tt(_){return`${Tn(_.path)}${function(_){return Object.keys(_).map(p=>`;${Tn(p)}=${Tn(_[p])}`).join("")}(_.parameters)}`}const zt=/^[^\/()?;=#]+/;function Kn(_){const p=_.match(zt);return p?p[0]:""}const Ut=/^[^=?&#]+/,ii=/^[^?&#]+/;class Nt{constructor(p){this.url=p,this.remaining=p}parseRootSegment(){return this.consumeOptional("/"),""===this.remaining||this.peekStartsWith("?")||this.peekStartsWith("#")?new lt([],{}):new lt([],this.parseChildren())}parseQueryParams(){const p={};if(this.consumeOptional("?"))do{this.parseQueryParam(p)}while(this.consumeOptional("&"));return p}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(""===this.remaining)return{};this.consumeOptional("/");const p=[];for(this.peekStartsWith("(")||p.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),p.push(this.parseSegment());let f={};this.peekStartsWith("/(")&&(this.capture("/"),f=this.parseParens(!0));let y={};return this.peekStartsWith("(")&&(y=this.parseParens(!1)),(p.length>0||Object.keys(f).length>0)&&(y[tt]=new lt(p,f)),y}parseSegment(){const p=Kn(this.remaining);if(""===p&&this.peekStartsWith(";"))throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);return this.capture(p),new an(Te(p),this.parseMatrixParams())}parseMatrixParams(){const p={};for(;this.consumeOptional(";");)this.parseParam(p);return p}parseParam(p){const f=Kn(this.remaining);if(!f)return;this.capture(f);let y="";if(this.consumeOptional("=")){const E=Kn(this.remaining);E&&(y=E,this.capture(y))}p[Te(f)]=Te(y)}parseQueryParam(p){const f=function(_){const p=_.match(Ut);return p?p[0]:""}(this.remaining);if(!f)return;this.capture(f);let y="";if(this.consumeOptional("=")){const N=function(_){const p=_.match(ii);return p?p[0]:""}(this.remaining);N&&(y=N,this.capture(y))}const E=it(f),A=it(y);if(p.hasOwnProperty(E)){let N=p[E];Array.isArray(N)||(N=[N],p[E]=N),N.push(A)}else p[E]=A}parseParens(p){const f={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){const y=Kn(this.remaining),E=this.remaining[y.length];if("/"!==E&&")"!==E&&";"!==E)throw new Error(`Cannot parse url '${this.url}'`);let A;y.indexOf(":")>-1?(A=y.substr(0,y.indexOf(":")),this.capture(A),this.capture(":")):p&&(A=tt);const N=this.parseChildren();f[A]=1===Object.keys(N).length?N[tt]:new lt([],N),this.consumeOptional("//")}return f}peekStartsWith(p){return this.remaining.startsWith(p)}consumeOptional(p){return!!this.peekStartsWith(p)&&(this.remaining=this.remaining.substring(p.length),!0)}capture(p){if(!this.consumeOptional(p))throw new Error(`Expected "${p}".`)}}class Er{constructor(p){this._root=p}get root(){return this._root.value}parent(p){const f=this.pathFromRoot(p);return f.length>1?f[f.length-2]:null}children(p){const f=oi(p,this._root);return f?f.children.map(y=>y.value):[]}firstChild(p){const f=oi(p,this._root);return f&&f.children.length>0?f.children[0].value:null}siblings(p){const f=An(p,this._root);return f.length<2?[]:f[f.length-2].children.map(E=>E.value).filter(E=>E!==p)}pathFromRoot(p){return An(p,this._root).map(f=>f.value)}}function oi(_,p){if(_===p.value)return p;for(const f of p.children){const y=oi(_,f);if(y)return y}return null}function An(_,p){if(_===p.value)return[p];for(const f of p.children){const y=An(_,f);if(y.length)return y.unshift(p),y}return[]}class Ft{constructor(p,f){this.value=p,this.children=f}toString(){return`TreeNode(${this.value})`}}function Jn(_){const p={};return _&&_.children.forEach(f=>p[f.value.outlet]=f),p}class Qn extends Er{constructor(p,f){super(p),this.snapshot=f,ai(this,p)}toString(){return this.snapshot.toString()}}function Ht(_,p){const f=function(_,p){const N=new si([],{},{},"",{},tt,p,null,_.root,-1,{});return new cr("",new Ft(N,[]))}(_,p),y=new Q([new an("",{})]),E=new Q({}),A=new Q({}),N=new Q({}),L=new Q(""),$=new gn(y,E,N,L,A,tt,p,f.root);return $.snapshot=f.root,new Qn(new Ft($,[]),f)}class gn{constructor(p,f,y,E,A,N,L,$){this.url=p,this.params=f,this.queryParams=y,this.fragment=E,this.data=A,this.outlet=N,this.component=L,this._futureSnapshot=$}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap||(this._paramMap=this.params.pipe((0,qe.U)(p=>Gt(p)))),this._paramMap}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=this.queryParams.pipe((0,qe.U)(p=>Gt(p)))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}}function pa(_,p="emptyOnly"){const f=_.pathFromRoot;let y=0;if("always"!==p)for(y=f.length-1;y>=1;){const E=f[y],A=f[y-1];if(E.routeConfig&&""===E.routeConfig.path)y--;else{if(A.component)break;y--}}return function(_){return _.reduce((p,f)=>({params:Object.assign(Object.assign({},p.params),f.params),data:Object.assign(Object.assign({},p.data),f.data),resolve:Object.assign(Object.assign({},p.resolve),f._resolvedData)}),{params:{},data:{},resolve:{}})}(f.slice(y))}class si{constructor(p,f,y,E,A,N,L,$,we,ot,Be){this.url=p,this.params=f,this.queryParams=y,this.fragment=E,this.data=A,this.outlet=N,this.component=L,this.routeConfig=$,this._urlSegment=we,this._lastPathIndex=ot,this._resolve=Be}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap||(this._paramMap=Gt(this.params)),this._paramMap}get queryParamMap(){return this._queryParamMap||(this._queryParamMap=Gt(this.queryParams)),this._queryParamMap}toString(){return`Route(url:'${this.url.map(y=>y.toString()).join("/")}', path:'${this.routeConfig?this.routeConfig.path:""}')`}}class cr extends Er{constructor(p,f){super(f),this.url=p,ai(this,f)}toString(){return Zn(this._root)}}function ai(_,p){p.value._routerState=_,p.children.forEach(f=>ai(_,f))}function Zn(_){const p=_.children.length>0?` { ${_.children.map(Zn).join(", ")} } `:"";return`${_.value}${p}`}function Et(_){if(_.snapshot){const p=_.snapshot,f=_._futureSnapshot;_.snapshot=f,dt(p.queryParams,f.queryParams)||_.queryParams.next(f.queryParams),p.fragment!==f.fragment&&_.fragment.next(f.fragment),dt(p.params,f.params)||_.params.next(f.params),function(_,p){if(_.length!==p.length)return!1;for(let f=0;f<_.length;++f)if(!dt(_[f],p[f]))return!1;return!0}(p.url,f.url)||_.url.next(f.url),dt(p.data,f.data)||_.data.next(f.data)}else _.snapshot=_._futureSnapshot,_.data.next(_._futureSnapshot.data)}function zo(_,p){const f=dt(_.params,p.params)&&function(_,p){return ur(_,p)&&_.every((f,y)=>dt(f.parameters,p[y].parameters))}(_.url,p.url);return f&&!(!_.parent!=!p.parent)&&(!_.parent||zo(_.parent,p.parent))}function Dn(_,p,f){if(f&&_.shouldReuseRoute(p.value,f.value.snapshot)){const y=f.value;y._futureSnapshot=p.value;const E=function(_,p,f){return p.children.map(y=>{for(const E of f.children)if(_.shouldReuseRoute(y.value,E.value.snapshot))return Dn(_,y,E);return Dn(_,y)})}(_,p,f);return new Ft(y,E)}{if(_.shouldAttach(p.value)){const A=_.retrieve(p.value);if(null!==A){const N=A.route;return po(p,N),N}}const y=function(_){return new gn(new Q(_.url),new Q(_.params),new Q(_.queryParams),new Q(_.fragment),new Q(_.data),_.outlet,_.component,_)}(p.value),E=p.children.map(A=>Dn(_,A));return new Ft(y,E)}}function po(_,p){if(_.value.routeConfig!==p.value.routeConfig)throw new Error("Cannot reattach ActivatedRouteSnapshot created from a different route");if(_.children.length!==p.children.length)throw new Error("Cannot reattach ActivatedRouteSnapshot with a different number of children");p.value._futureSnapshot=_.value;for(let f=0;f<_.children.length;++f)po(_.children[f],p.children[f])}function mo(_){return"object"==typeof _&&null!=_&&!_.outlets&&!_.segmentPath}function _o(_){return"object"==typeof _&&null!=_&&_.outlets}function Dr(_,p,f,y,E){let A={};return y&&on(y,(N,L)=>{A[L]=Array.isArray(N)?N.map($=>`${$}`):`${N}`}),new ni(f.root===_?p:Vi(f.root,_,p),A,E)}function Vi(_,p,f){const y={};return on(_.children,(E,A)=>{y[A]=E===p?f:Vi(E,p,f)}),new lt(_.segments,y)}class ga{constructor(p,f,y){if(this.isAbsolute=p,this.numberOfDoubleDots=f,this.commands=y,p&&y.length>0&&mo(y[0]))throw new Error("Root segment cannot have matrix parameters");const E=y.find(_o);if(E&&E!==Ot(y))throw new Error("{outlets:{}} has to be the last command")}toRoot(){return this.isAbsolute&&1===this.commands.length&&"/"==this.commands[0]}}class Ts{constructor(p,f,y){this.segmentGroup=p,this.processChildren=f,this.index=y}}function _a(_,p,f){if(_||(_=new lt([],{})),0===_.segments.length&&_.hasChildren())return qo(_,p,f);const y=function(_,p,f){let y=0,E=p;const A={match:!1,pathIndex:0,commandIndex:0};for(;E<_.segments.length;){if(y>=f.length)return A;const N=_.segments[E],L=f[y];if(_o(L))break;const $=`${L}`,we=y0&&void 0===$)break;if($&&we&&"object"==typeof we&&void 0===we.outlets){if(!ji($,we,N))return A;y+=2}else{if(!ji($,{},N))return A;y++}E++}return{match:!0,pathIndex:E,commandIndex:y}}(_,p,f),E=f.slice(y.commandIndex);if(y.match&&y.pathIndex<_.segments.length){const A=new lt(_.segments.slice(0,y.pathIndex),{});return A.children[tt]=new lt(_.segments.slice(y.pathIndex),_.children),qo(A,0,E)}return y.match&&0===E.length?new lt(_.segments,{}):y.match&&!_.hasChildren()?Ui(_,p,f):y.match?qo(_,0,E):Ui(_,p,f)}function qo(_,p,f){if(0===f.length)return new lt(_.segments,{});{const y=function(_){return _o(_[0])?_[0].outlets:{[tt]:_}}(f),E={};return on(y,(A,N)=>{"string"==typeof A&&(A=[A]),null!==A&&(E[N]=_a(_.children[N],p,A))}),on(_.children,(A,N)=>{void 0===y[N]&&(E[N]=A)}),new lt(_.segments,E)}}function Ui(_,p,f){const y=_.segments.slice(0,p);let E=0;for(;E{"string"==typeof f&&(f=[f]),null!==f&&(p[y]=Ui(new lt([],{}),0,f))}),p}function ya(_){const p={};return on(_,(f,y)=>p[y]=`${f}`),p}function ji(_,p,f){return _==f.path&&dt(p,f.parameters)}class li{constructor(p,f,y,E){this.routeReuseStrategy=p,this.futureState=f,this.currState=y,this.forwardEvent=E}activate(p){const f=this.futureState._root,y=this.currState?this.currState._root:null;this.deactivateChildRoutes(f,y,p),Et(this.futureState.root),this.activateChildRoutes(f,y,p)}deactivateChildRoutes(p,f,y){const E=Jn(f);p.children.forEach(A=>{const N=A.value.outlet;this.deactivateRoutes(A,E[N],y),delete E[N]}),on(E,(A,N)=>{this.deactivateRouteAndItsChildren(A,y)})}deactivateRoutes(p,f,y){const E=p.value,A=f?f.value:null;if(E===A)if(E.component){const N=y.getContext(E.outlet);N&&this.deactivateChildRoutes(p,f,N.children)}else this.deactivateChildRoutes(p,f,y);else A&&this.deactivateRouteAndItsChildren(f,y)}deactivateRouteAndItsChildren(p,f){this.routeReuseStrategy.shouldDetach(p.value.snapshot)?this.detachAndStoreRouteSubtree(p,f):this.deactivateRouteAndOutlet(p,f)}detachAndStoreRouteSubtree(p,f){const y=f.getContext(p.value.outlet);if(y&&y.outlet){const E=y.outlet.detach(),A=y.children.onOutletDeactivated();this.routeReuseStrategy.store(p.value.snapshot,{componentRef:E,route:p,contexts:A})}}deactivateRouteAndOutlet(p,f){const y=f.getContext(p.value.outlet),E=y&&p.value.component?y.children:f,A=Jn(p);for(const N of Object.keys(A))this.deactivateRouteAndItsChildren(A[N],E);y&&y.outlet&&(y.outlet.deactivate(),y.children.onOutletDeactivated(),y.attachRef=null,y.resolver=null,y.route=null)}activateChildRoutes(p,f,y){const E=Jn(f);p.children.forEach(A=>{this.activateRoutes(A,E[A.value.outlet],y),this.forwardEvent(new We(A.value.snapshot))}),p.children.length&&this.forwardEvent(new Ge(p.value.snapshot))}activateRoutes(p,f,y){const E=p.value,A=f?f.value:null;if(Et(E),E===A)if(E.component){const N=y.getOrCreateContext(E.outlet);this.activateChildRoutes(p,f,N.children)}else this.activateChildRoutes(p,f,y);else if(E.component){const N=y.getOrCreateContext(E.outlet);if(this.routeReuseStrategy.shouldAttach(E.snapshot)){const L=this.routeReuseStrategy.retrieve(E.snapshot);this.routeReuseStrategy.store(E.snapshot,null),N.children.onOutletReAttached(L.contexts),N.attachRef=L.componentRef,N.route=L.route.value,N.outlet&&N.outlet.attach(L.componentRef,L.route.value),Bi(L.route)}else{const L=function(_){for(let p=_.parent;p;p=p.parent){const f=p.routeConfig;if(f&&f._loadedConfig)return f._loadedConfig;if(f&&f.component)return null}return null}(E.snapshot),$=L?L.module.componentFactoryResolver:null;N.attachRef=null,N.route=E,N.resolver=$,N.outlet&&N.outlet.activateWith(E,$),this.activateChildRoutes(p,null,N.children)}}else this.activateChildRoutes(p,null,y)}}function Bi(_){Et(_.value),_.children.forEach(Bi)}class Is{constructor(p,f){this.routes=p,this.module=f}}function er(_){return"function"==typeof _}function jr(_){return _ instanceof ni}const Br=Symbol("INITIAL_VALUE");function ci(){return(0,Pe.w)(_=>function(..._){const p=(0,re.yG)(_),f=(0,re.jO)(_),{args:y,keys:E}=(0,Ae.D)(_);if(0===y.length)return(0,Z.D)([],p);const A=new ee.y(function(_,p,f=ye.y){return y=>{ue(p,()=>{const{length:E}=_,A=new Array(E);let N=E,L=E;for(let $=0;${const we=(0,Z.D)(_[$],p);let ot=!1;we.subscribe((0,_e.x)(y,Be=>{A[$]=Be,ot||(ot=!0,L--),L||y.next(f(A.slice()))},()=>{--N||y.complete()}))},y)},y)}}(y,p,E?N=>(0,Y.n)(E,N):ye.y));return f?A.pipe((0,pe.Z)(f)):A}(_.map(p=>p.pipe((0,ie.q)(1),function(..._){const p=(0,re.yG)(_);return(0,Se.e)((f,y)=>{(p?de(_,f,p):de(_,f)).subscribe(y)})}(Br)))).pipe(Me((p,f)=>{let y=!1;return f.reduce((E,A,N)=>E!==Br?E:(A===Br&&(y=!0),y||!1!==A&&N!==f.length-1&&!jr(A)?E:A),p)},Br),(0,Nn.h)(p=>p!==Br),(0,qe.U)(p=>jr(p)?p:!0===p),(0,ie.q)(1)))}let xs=(()=>{class _{}return _.\u0275fac=function(f){return new(f||_)},_.\u0275cmp=m.Xpm({type:_,selectors:[["ng-component"]],decls:1,vars:0,template:function(f,y){1&f&&m._UZ(0,"router-outlet")},directives:function(){return[Us]},encapsulation:2}),_})();function yo(_,p=""){for(let f=0;f<_.length;f++){const y=_[f];C(y,S(p,y))}}function C(_,p){_.children&&yo(_.children,p)}function S(_,p){return p?_||p.path?_&&!p.path?`${_}/`:!_&&p.path?p.path:`${_}/${p.path}`:"":_}function b(_){const p=_.children&&_.children.map(b),f=p?Object.assign(Object.assign({},_),{children:p}):Object.assign({},_);return!f.component&&(p||f.loadChildren)&&f.outlet&&f.outlet!==tt&&(f.component=xs),f}function M(_){return _.outlet||tt}function V(_,p){const f=_.filter(y=>M(y)===p);return f.push(..._.filter(y=>M(y)!==p)),f}const K={matched:!1,consumedSegments:[],lastChild:0,parameters:{},positionalParamSegments:{}};function fe(_,p,f){var y;if(""===p.path)return"full"===p.pathMatch&&(_.hasChildren()||f.length>0)?Object.assign({},K):{matched:!0,consumedSegments:[],lastChild:0,parameters:{},positionalParamSegments:{}};const A=(p.matcher||ct)(f,_,p);if(!A)return Object.assign({},K);const N={};on(A.posParams,($,we)=>{N[we]=$.path});const L=A.consumed.length>0?Object.assign(Object.assign({},N),A.consumed[A.consumed.length-1].parameters):N;return{matched:!0,consumedSegments:A.consumed,lastChild:A.consumed.length,parameters:L,positionalParamSegments:null!==(y=A.posParams)&&void 0!==y?y:{}}}function Ve(_,p,f,y,E="corrected"){if(f.length>0&&function(_,p,f){return f.some(y=>ut(_,p,y)&&M(y)!==tt)}(_,f,y)){const N=new lt(p,function(_,p,f,y){const E={};E[tt]=y,y._sourceSegment=_,y._segmentIndexShift=p.length;for(const A of f)if(""===A.path&&M(A)!==tt){const N=new lt([],{});N._sourceSegment=_,N._segmentIndexShift=p.length,E[M(A)]=N}return E}(_,p,y,new lt(f,_.children)));return N._sourceSegment=_,N._segmentIndexShift=p.length,{segmentGroup:N,slicedSegments:[]}}if(0===f.length&&function(_,p,f){return f.some(y=>ut(_,p,y))}(_,f,y)){const N=new lt(_.segments,function(_,p,f,y,E,A){const N={};for(const L of y)if(ut(_,f,L)&&!E[M(L)]){const $=new lt([],{});$._sourceSegment=_,$._segmentIndexShift="legacy"===A?_.segments.length:p.length,N[M(L)]=$}return Object.assign(Object.assign({},E),N)}(_,p,f,y,_.children,E));return N._sourceSegment=_,N._segmentIndexShift=p.length,{segmentGroup:N,slicedSegments:f}}const A=new lt(_.segments,_.children);return A._sourceSegment=_,A._segmentIndexShift=p.length,{segmentGroup:A,slicedSegments:f}}function ut(_,p,f){return(!(_.hasChildren()||p.length>0)||"full"!==f.pathMatch)&&""===f.path}function It(_,p,f,y){return!!(M(_)===y||y!==tt&&ut(p,f,_))&&("**"===_.path||fe(p,_,f).matched)}function mn(_,p,f){return 0===p.length&&!_.children[f]}class kn{constructor(p){this.segmentGroup=p||null}}class qt{constructor(p){this.urlTree=p}}function Hr(_){return new ee.y(p=>p.error(new kn(_)))}function dr(_){return new ee.y(p=>p.error(new qt(_)))}function $r(_){return new ee.y(p=>p.error(new Error(`Only absolute redirects can have named outlets. redirectTo: '${_}'`)))}class wa{constructor(p,f,y,E,A){this.configLoader=f,this.urlSerializer=y,this.urlTree=E,this.config=A,this.allowRedirects=!0,this.ngModule=p.get(m.h0i)}apply(){const p=Ve(this.urlTree.root,[],[],this.config).segmentGroup,f=new lt(p.segments,p.children);return this.expandSegmentGroup(this.ngModule,this.config,f,tt).pipe((0,qe.U)(A=>this.createUrlTree(Sr(A),this.urlTree.queryParams,this.urlTree.fragment))).pipe((0,Ue.K)(A=>{if(A instanceof qt)return this.allowRedirects=!1,this.match(A.urlTree);throw A instanceof kn?this.noMatchError(A):A}))}match(p){return this.expandSegmentGroup(this.ngModule,this.config,p.root,tt).pipe((0,qe.U)(E=>this.createUrlTree(Sr(E),p.queryParams,p.fragment))).pipe((0,Ue.K)(E=>{throw E instanceof kn?this.noMatchError(E):E}))}noMatchError(p){return new Error(`Cannot match any routes. URL Segment: '${p.segmentGroup}'`)}createUrlTree(p,f,y){const E=p.segments.length>0?new lt([],{[tt]:p}):p;return new ni(E,f,y)}expandSegmentGroup(p,f,y,E){return 0===y.segments.length&&y.hasChildren()?this.expandChildren(p,f,y).pipe((0,qe.U)(A=>new lt([],A))):this.expandSegment(p,y,f,y.segments,E,!0)}expandChildren(p,f,y){const E=[];for(const A of Object.keys(y.children))"primary"===A?E.unshift(A):E.push(A);return(0,Z.D)(E).pipe((0,Lt.b)(A=>{const N=y.children[A],L=V(f,A);return this.expandSegmentGroup(p,L,N,A).pipe((0,qe.U)($=>({segment:$,outlet:A})))}),Me((A,N)=>(A[N.outlet]=N.segment,A),{}),function(_,p){const f=arguments.length>=2;return y=>y.pipe(_?(0,Nn.h)((E,A)=>_(E,A,y)):ye.y,Zr(1),f?q(p):ao(()=>new te))}())}expandSegment(p,f,y,E,A,N){return(0,Z.D)(y).pipe((0,Lt.b)(L=>this.expandSegmentAgainstRoute(p,f,y,L,E,A,N).pipe((0,Ue.K)(we=>{if(we instanceof kn)return(0,ve.of)(null);throw we}))),De(L=>!!L),(0,Ue.K)((L,$)=>{if(L instanceof te||"EmptyError"===L.name){if(mn(f,E,A))return(0,ve.of)(new lt([],{}));throw new kn(f)}throw L}))}expandSegmentAgainstRoute(p,f,y,E,A,N,L){return It(E,f,A,N)?void 0===E.redirectTo?this.matchSegmentAgainstRoute(p,f,E,A,N):L&&this.allowRedirects?this.expandSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N):Hr(f):Hr(f)}expandSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N){return"**"===E.path?this.expandWildCardWithParamsAgainstRouteUsingRedirect(p,y,E,N):this.expandRegularSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N)}expandWildCardWithParamsAgainstRouteUsingRedirect(p,f,y,E){const A=this.applyRedirectCommands([],y.redirectTo,{});return y.redirectTo.startsWith("/")?dr(A):this.lineralizeSegments(y,A).pipe((0,_t.z)(N=>{const L=new lt(N,{});return this.expandSegment(p,L,f,N,E,!1)}))}expandRegularSegmentAgainstRouteUsingRedirect(p,f,y,E,A,N){const{matched:L,consumedSegments:$,lastChild:we,positionalParamSegments:ot}=fe(f,E,A);if(!L)return Hr(f);const Be=this.applyRedirectCommands($,E.redirectTo,ot);return E.redirectTo.startsWith("/")?dr(Be):this.lineralizeSegments(E,Be).pipe((0,_t.z)(St=>this.expandSegment(p,f,y,St.concat(A.slice(we)),N,!1)))}matchSegmentAgainstRoute(p,f,y,E,A){if("**"===y.path)return y.loadChildren?(y._loadedConfig?(0,ve.of)(y._loadedConfig):this.configLoader.load(p.injector,y)).pipe((0,qe.U)(St=>(y._loadedConfig=St,new lt(E,{})))):(0,ve.of)(new lt(E,{}));const{matched:N,consumedSegments:L,lastChild:$}=fe(f,y,E);if(!N)return Hr(f);const we=E.slice($);return this.getChildConfig(p,y,E).pipe((0,_t.z)(Be=>{const St=Be.module,ft=Be.routes,{segmentGroup:hi,slicedSegments:nr}=Ve(f,L,we,ft),fr=new lt(hi.segments,hi.children);if(0===nr.length&&fr.hasChildren())return this.expandChildren(St,ft,fr).pipe((0,qe.U)(To=>new lt(L,To)));if(0===ft.length&&0===nr.length)return(0,ve.of)(new lt(L,{}));const Ir=M(y)===A;return this.expandSegment(St,fr,ft,nr,Ir?tt:A,!0).pipe((0,qe.U)(Mr=>new lt(L.concat(Mr.segments),Mr.children)))}))}getChildConfig(p,f,y){return f.children?(0,ve.of)(new Is(f.children,p)):f.loadChildren?void 0!==f._loadedConfig?(0,ve.of)(f._loadedConfig):this.runCanLoadGuards(p.injector,f,y).pipe((0,_t.z)(E=>{return E?this.configLoader.load(p.injector,f).pipe((0,qe.U)(A=>(f._loadedConfig=A,A))):(_=f,new ee.y(p=>p.error(Gn(`Cannot load children because the guard of the route "path: '${_.path}'" returned false`))));var _})):(0,ve.of)(new Is([],p))}runCanLoadGuards(p,f,y){const E=f.canLoad;if(!E||0===E.length)return(0,ve.of)(!0);const A=E.map(N=>{const L=p.get(N);let $;if((_=L)&&er(_.canLoad))$=L.canLoad(f,y);else{if(!er(L))throw new Error("Invalid CanLoad guard");$=L(f,y)}var _;return sn($)});return(0,ve.of)(A).pipe(ci(),Ne(N=>{if(!jr(N))return;const L=Gn(`Redirecting to "${this.urlSerializer.serialize(N)}"`);throw L.url=N,L}),(0,qe.U)(N=>!0===N))}lineralizeSegments(p,f){let y=[],E=f.root;for(;;){if(y=y.concat(E.segments),0===E.numberOfChildren)return(0,ve.of)(y);if(E.numberOfChildren>1||!E.children[tt])return $r(p.redirectTo);E=E.children[tt]}}applyRedirectCommands(p,f,y){return this.applyRedirectCreatreUrlTree(f,this.urlSerializer.parse(f),p,y)}applyRedirectCreatreUrlTree(p,f,y,E){const A=this.createSegmentGroup(p,f.root,y,E);return new ni(A,this.createQueryParams(f.queryParams,this.urlTree.queryParams),f.fragment)}createQueryParams(p,f){const y={};return on(p,(E,A)=>{if("string"==typeof E&&E.startsWith(":")){const L=E.substring(1);y[A]=f[L]}else y[A]=E}),y}createSegmentGroup(p,f,y,E){const A=this.createSegments(p,f.segments,y,E);let N={};return on(f.children,(L,$)=>{N[$]=this.createSegmentGroup(p,L,y,E)}),new lt(A,N)}createSegments(p,f,y,E){return f.map(A=>A.path.startsWith(":")?this.findPosParam(p,A,E):this.findOrReturn(A,y))}findPosParam(p,f,y){const E=y[f.path.substring(1)];if(!E)throw new Error(`Cannot redirect to '${p}'. Cannot find '${f.path}'.`);return E}findOrReturn(p,f){let y=0;for(const E of f){if(E.path===p.path)return f.splice(y),E;y++}return p}}function Sr(_){const p={};for(const y of Object.keys(_.children)){const A=Sr(_.children[y]);(A.segments.length>0||A.hasChildren())&&(p[y]=A)}return function(_){if(1===_.numberOfChildren&&_.children[tt]){const p=_.children[tt];return new lt(_.segments.concat(p.segments),p.children)}return _}(new lt(_.segments,p))}class Rs{constructor(p){this.path=p,this.route=this.path[this.path.length-1]}}class Ye{constructor(p,f){this.component=p,this.route=f}}function df(_,p,f){const y=_._root;return Hi(y,p?p._root:null,f,[y.value])}function vo(_,p,f){const y=function(_){if(!_)return null;for(let p=_.parent;p;p=p.parent){const f=p.routeConfig;if(f&&f._loadedConfig)return f._loadedConfig}return null}(p);return(y?y.module.injector:f).get(_)}function Hi(_,p,f,y,E={canDeactivateChecks:[],canActivateChecks:[]}){const A=Jn(p);return _.children.forEach(N=>{(function(_,p,f,y,E={canDeactivateChecks:[],canActivateChecks:[]}){const A=_.value,N=p?p.value:null,L=f?f.getContext(_.value.outlet):null;if(N&&A.routeConfig===N.routeConfig){const $=function(_,p,f){if("function"==typeof f)return f(_,p);switch(f){case"pathParamsChange":return!ur(_.url,p.url);case"pathParamsOrQueryParamsChange":return!ur(_.url,p.url)||!dt(_.queryParams,p.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!zo(_,p)||!dt(_.queryParams,p.queryParams);default:return!zo(_,p)}}(N,A,A.routeConfig.runGuardsAndResolvers);$?E.canActivateChecks.push(new Rs(y)):(A.data=N.data,A._resolvedData=N._resolvedData),Hi(_,p,A.component?L?L.children:null:f,y,E),$&&L&&L.outlet&&L.outlet.isActivated&&E.canDeactivateChecks.push(new Ye(L.outlet.component,N))}else N&&le(p,L,E),E.canActivateChecks.push(new Rs(y)),Hi(_,null,A.component?L?L.children:null:f,y,E)})(N,A[N.value.outlet],f,y.concat([N.value]),E),delete A[N.value.outlet]}),on(A,(N,L)=>le(N,f.getContext(L),E)),E}function le(_,p,f){const y=Jn(_),E=_.value;on(y,(A,N)=>{le(A,E.component?p?p.children.getContext(N):null:p,f)}),f.canDeactivateChecks.push(new Ye(E.component&&p&&p.outlet&&p.outlet.isActivated?p.outlet.component:null,E))}class ff{}function xl(_){return new ee.y(p=>p.error(_))}class Os{constructor(p,f,y,E,A,N){this.rootComponentType=p,this.config=f,this.urlTree=y,this.url=E,this.paramsInheritanceStrategy=A,this.relativeLinkResolution=N}recognize(){const p=Ve(this.urlTree.root,[],[],this.config.filter(N=>void 0===N.redirectTo),this.relativeLinkResolution).segmentGroup,f=this.processSegmentGroup(this.config,p,tt);if(null===f)return null;const y=new si([],Object.freeze({}),Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,{},tt,this.rootComponentType,null,this.urlTree.root,-1,{}),E=new Ft(y,f),A=new cr(this.url,E);return this.inheritParamsAndData(A._root),A}inheritParamsAndData(p){const f=p.value,y=pa(f,this.paramsInheritanceStrategy);f.params=Object.freeze(y.params),f.data=Object.freeze(y.data),p.children.forEach(E=>this.inheritParamsAndData(E))}processSegmentGroup(p,f,y){return 0===f.segments.length&&f.hasChildren()?this.processChildren(p,f):this.processSegment(p,f,f.segments,y)}processChildren(p,f){const y=[];for(const A of Object.keys(f.children)){const N=f.children[A],L=V(p,A),$=this.processSegmentGroup(L,N,A);if(null===$)return null;y.push(...$)}const E=tr(y);return E.sort((p,f)=>p.value.outlet===tt?-1:f.value.outlet===tt?1:p.value.outlet.localeCompare(f.value.outlet)),E}processSegment(p,f,y,E){for(const A of p){const N=this.processSegmentAgainstRoute(A,f,y,E);if(null!==N)return N}return mn(f,y,E)?[]:null}processSegmentAgainstRoute(p,f,y,E){if(p.redirectTo||!It(p,f,y,E))return null;let A,N=[],L=[];if("**"===p.path){const ft=y.length>0?Ot(y).parameters:{};A=new si(y,ft,Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,Ol(p),M(p),p.component,p,Pl(f),Sa(f)+y.length,Nl(p))}else{const ft=fe(f,p,y);if(!ft.matched)return null;N=ft.consumedSegments,L=y.slice(ft.lastChild),A=new si(N,ft.parameters,Object.freeze(Object.assign({},this.urlTree.queryParams)),this.urlTree.fragment,Ol(p),M(p),p.component,p,Pl(f),Sa(f)+N.length,Nl(p))}const $=(_=p).children?_.children:_.loadChildren?_._loadedConfig.routes:[],{segmentGroup:we,slicedSegments:ot}=Ve(f,N,L,$.filter(ft=>void 0===ft.redirectTo),this.relativeLinkResolution);var _;if(0===ot.length&&we.hasChildren()){const ft=this.processChildren($,we);return null===ft?null:[new Ft(A,ft)]}if(0===$.length&&0===ot.length)return[new Ft(A,[])];const Be=M(p)===E,St=this.processSegment($,we,ot,Be?tt:E);return null===St?null:[new Ft(A,St)]}}function Rl(_){const p=_.value.routeConfig;return p&&""===p.path&&void 0===p.redirectTo}function tr(_){const p=[],f=new Set;for(const y of _){if(!Rl(y)){p.push(y);continue}const E=p.find(A=>y.value.routeConfig===A.value.routeConfig);void 0!==E?(E.children.push(...y.children),f.add(E)):p.push(y)}for(const y of f){const E=tr(y.children);p.push(new Ft(y.value,E))}return p.filter(y=>!f.has(y))}function Pl(_){let p=_;for(;p._sourceSegment;)p=p._sourceSegment;return p}function Sa(_){let p=_,f=p._segmentIndexShift?p._segmentIndexShift:0;for(;p._sourceSegment;)p=p._sourceSegment,f+=p._segmentIndexShift?p._segmentIndexShift:0;return f-1}function Ol(_){return _.data||{}}function Nl(_){return _.resolve||{}}function Ns(_){return(0,Pe.w)(p=>{const f=_(p);return f?(0,Z.D)(f).pipe((0,qe.U)(()=>p)):(0,ve.of)(p)})}class Ll extends class{shouldDetach(p){return!1}store(p,f){}shouldAttach(p){return!1}retrieve(p){return null}shouldReuseRoute(p,f){return p.routeConfig===f.routeConfig}}{}const ks=new m.OlP("ROUTES");class di{constructor(p,f,y,E){this.loader=p,this.compiler=f,this.onLoadStartListener=y,this.onLoadEndListener=E}load(p,f){if(f._loader$)return f._loader$;this.onLoadStartListener&&this.onLoadStartListener(f);const E=this.loadModuleFactory(f.loadChildren).pipe((0,qe.U)(A=>{this.onLoadEndListener&&this.onLoadEndListener(f);const N=A.create(p);return new Is(Xr(N.injector.get(ks,void 0,m.XFs.Self|m.XFs.Optional)).map(b),N)}),(0,Ue.K)(A=>{throw f._loader$=void 0,A}));return f._loader$=new Le(E,()=>new ce.x).pipe(ae()),f._loader$}loadModuleFactory(p){return"string"==typeof p?(0,Z.D)(this.loader.load(p)):sn(p()).pipe((0,_t.z)(f=>f instanceof m.YKP?(0,ve.of)(f):(0,Z.D)(this.compiler.compileModuleAsync(f))))}}class Ls{constructor(){this.outlet=null,this.route=null,this.resolver=null,this.children=new bo,this.attachRef=null}}class bo{constructor(){this.contexts=new Map}onChildOutletCreated(p,f){const y=this.getOrCreateContext(p);y.outlet=f,this.contexts.set(p,y)}onChildOutletDestroyed(p){const f=this.getContext(p);f&&(f.outlet=null,f.attachRef=null)}onOutletDeactivated(){const p=this.contexts;return this.contexts=new Map,p}onOutletReAttached(p){this.contexts=p}getOrCreateContext(p){let f=this.getContext(p);return f||(f=new Ls,this.contexts.set(p,f)),f}getContext(p){return this.contexts.get(p)||null}}class Mn{shouldProcessUrl(p){return!0}extract(p){return p}merge(p,f){return p}}function zn(_){throw _}function $t(_,p,f){return p.parse("/")}function Vl(_,p){return(0,ve.of)(null)}const Vs={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},ac={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};let yn=(()=>{class _{constructor(f,y,E,A,N,L,$,we){this.rootComponentType=f,this.urlSerializer=y,this.rootContexts=E,this.location=A,this.config=we,this.lastSuccessfulNavigation=null,this.currentNavigation=null,this.disposed=!1,this.lastLocationChangeInfo=null,this.navigationId=0,this.currentPageId=0,this.isNgZoneEnabled=!1,this.events=new ce.x,this.errorHandler=zn,this.malformedUriErrorHandler=$t,this.navigated=!1,this.lastSuccessfulId=-1,this.hooks={beforePreactivation:Vl,afterPreactivation:Vl},this.urlHandlingStrategy=new Mn,this.routeReuseStrategy=new Ll,this.onSameUrlNavigation="ignore",this.paramsInheritanceStrategy="emptyOnly",this.urlUpdateStrategy="deferred",this.relativeLinkResolution="corrected",this.canceledNavigationResolution="replace",this.ngModule=N.get(m.h0i),this.console=N.get(m.c2e);const St=N.get(m.R0b);this.isNgZoneEnabled=St instanceof m.R0b&&m.R0b.isInAngularZone(),this.resetConfig(we),this.currentUrlTree=new ni(new lt([],{}),{},null),this.rawUrlTree=this.currentUrlTree,this.browserUrlTree=this.currentUrlTree,this.configLoader=new di(L,$,ft=>this.triggerEvent(new co(ft)),ft=>this.triggerEvent(new vs(ft))),this.routerState=Ht(this.currentUrlTree,this.rootComponentType),this.transitions=new Q({id:0,targetPageId:0,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,extractedUrl:this.urlHandlingStrategy.extract(this.currentUrlTree),urlAfterRedirects:this.urlHandlingStrategy.extract(this.currentUrlTree),rawUrl:this.currentUrlTree,extras:{},resolve:null,reject:null,promise:Promise.resolve(!0),source:"imperative",restoredState:null,currentSnapshot:this.routerState.snapshot,targetSnapshot:null,currentRouterState:this.routerState,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.navigations=this.setupNavigations(this.transitions),this.processNavigations()}get browserPageId(){var f;return null===(f=this.location.getState())||void 0===f?void 0:f.\u0275routerPageId}setupNavigations(f){const y=this.events;return f.pipe((0,Nn.h)(E=>0!==E.id),(0,qe.U)(E=>Object.assign(Object.assign({},E),{extractedUrl:this.urlHandlingStrategy.extract(E.rawUrl)})),(0,Pe.w)(E=>{let A=!1,N=!1;return(0,ve.of)(E).pipe(Ne(L=>{this.currentNavigation={id:L.id,initialUrl:L.currentRawUrl,extractedUrl:L.extractedUrl,trigger:L.source,extras:L.extras,previousNavigation:this.lastSuccessfulNavigation?Object.assign(Object.assign({},this.lastSuccessfulNavigation),{previousNavigation:null}):null}}),(0,Pe.w)(L=>{const $=this.browserUrlTree.toString(),we=!this.navigated||L.extractedUrl.toString()!==$||$!==this.currentUrlTree.toString();if(("reload"===this.onSameUrlNavigation||we)&&this.urlHandlingStrategy.shouldProcessUrl(L.rawUrl))return wo(L.source)&&(this.browserUrlTree=L.extractedUrl),(0,ve.of)(L).pipe((0,Pe.w)(Be=>{const St=this.transitions.getValue();return y.next(new bt(Be.id,this.serializeUrl(Be.extractedUrl),Be.source,Be.restoredState)),St!==this.transitions.getValue()?Qe.E:Promise.resolve(Be)}),function(_,p,f,y){return(0,Pe.w)(E=>function(_,p,f,y,E){return new wa(_,p,f,y,E).apply()}(_,p,f,E.extractedUrl,y).pipe((0,qe.U)(A=>Object.assign(Object.assign({},E),{urlAfterRedirects:A}))))}(this.ngModule.injector,this.configLoader,this.urlSerializer,this.config),Ne(Be=>{this.currentNavigation=Object.assign(Object.assign({},this.currentNavigation),{finalUrl:Be.urlAfterRedirects})}),function(_,p,f,y,E){return(0,_t.z)(A=>function(_,p,f,y,E="emptyOnly",A="legacy"){try{const N=new Os(_,p,f,y,E,A).recognize();return null===N?xl(new ff):(0,ve.of)(N)}catch(N){return xl(N)}}(_,p,A.urlAfterRedirects,f(A.urlAfterRedirects),y,E).pipe((0,qe.U)(N=>Object.assign(Object.assign({},A),{targetSnapshot:N}))))}(this.rootComponentType,this.config,Be=>this.serializeUrl(Be),this.paramsInheritanceStrategy,this.relativeLinkResolution),Ne(Be=>{"eager"===this.urlUpdateStrategy&&(Be.extras.skipLocationChange||this.setBrowserUrl(Be.urlAfterRedirects,Be),this.browserUrlTree=Be.urlAfterRedirects);const St=new da(Be.id,this.serializeUrl(Be.extractedUrl),this.serializeUrl(Be.urlAfterRedirects),Be.targetSnapshot);y.next(St)}));if(we&&this.rawUrlTree&&this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree)){const{id:St,extractedUrl:ft,source:hi,restoredState:nr,extras:fr}=L,Ir=new bt(St,this.serializeUrl(ft),hi,nr);y.next(Ir);const zr=Ht(ft,this.rootComponentType).snapshot;return(0,ve.of)(Object.assign(Object.assign({},L),{targetSnapshot:zr,urlAfterRedirects:ft,extras:Object.assign(Object.assign({},fr),{skipLocationChange:!1,replaceUrl:!1})}))}return this.rawUrlTree=L.rawUrl,this.browserUrlTree=L.urlAfterRedirects,L.resolve(null),Qe.E}),Ns(L=>{const{targetSnapshot:$,id:we,extractedUrl:ot,rawUrl:Be,extras:{skipLocationChange:St,replaceUrl:ft}}=L;return this.hooks.beforePreactivation($,{navigationId:we,appliedUrlTree:ot,rawUrlTree:Be,skipLocationChange:!!St,replaceUrl:!!ft})}),Ne(L=>{const $=new En(L.id,this.serializeUrl(L.extractedUrl),this.serializeUrl(L.urlAfterRedirects),L.targetSnapshot);this.triggerEvent($)}),(0,qe.U)(L=>Object.assign(Object.assign({},L),{guards:df(L.targetSnapshot,L.currentSnapshot,this.rootContexts)})),function(_,p){return(0,_t.z)(f=>{const{targetSnapshot:y,currentSnapshot:E,guards:{canActivateChecks:A,canDeactivateChecks:N}}=f;return 0===N.length&&0===A.length?(0,ve.of)(Object.assign(Object.assign({},f),{guardsResult:!0})):function(_,p,f,y){return(0,Z.D)(_).pipe((0,_t.z)(E=>function(_,p,f,y,E){const A=p&&p.routeConfig?p.routeConfig.canDeactivate:null;if(!A||0===A.length)return(0,ve.of)(!0);const N=A.map(L=>{const $=vo(L,p,E);let we;if(function(_){return _&&er(_.canDeactivate)}($))we=sn($.canDeactivate(_,p,f,y));else{if(!er($))throw new Error("Invalid CanDeactivate guard");we=sn($(_,p,f,y))}return we.pipe(De())});return(0,ve.of)(N).pipe(ci())}(E.component,E.route,f,p,y)),De(E=>!0!==E,!0))}(N,y,E,_).pipe((0,_t.z)(L=>L&&function(_){return"boolean"==typeof _}(L)?function(_,p,f,y){return(0,Z.D)(p).pipe((0,Lt.b)(E=>de(function(_,p){return null!==_&&p&&p(new Oi(_)),(0,ve.of)(!0)}(E.route.parent,y),function(_,p){return null!==_&&p&&p(new Vt(_)),(0,ve.of)(!0)}(E.route,y),function(_,p,f){const y=p[p.length-1],A=p.slice(0,p.length-1).reverse().map(N=>function(_){const p=_.routeConfig?_.routeConfig.canActivateChild:null;return p&&0!==p.length?{node:_,guards:p}:null}(N)).filter(N=>null!==N).map(N=>be(()=>{const L=N.guards.map($=>{const we=vo($,N.node,f);let ot;if(function(_){return _&&er(_.canActivateChild)}(we))ot=sn(we.canActivateChild(y,_));else{if(!er(we))throw new Error("Invalid CanActivateChild guard");ot=sn(we(y,_))}return ot.pipe(De())});return(0,ve.of)(L).pipe(ci())}));return(0,ve.of)(A).pipe(ci())}(_,E.path,f),function(_,p,f){const y=p.routeConfig?p.routeConfig.canActivate:null;if(!y||0===y.length)return(0,ve.of)(!0);const E=y.map(A=>be(()=>{const N=vo(A,p,f);let L;if(function(_){return _&&er(_.canActivate)}(N))L=sn(N.canActivate(p,_));else{if(!er(N))throw new Error("Invalid CanActivate guard");L=sn(N(p,_))}return L.pipe(De())}));return(0,ve.of)(E).pipe(ci())}(_,E.route,f))),De(E=>!0!==E,!0))}(y,A,_,p):(0,ve.of)(L)),(0,qe.U)(L=>Object.assign(Object.assign({},f),{guardsResult:L})))})}(this.ngModule.injector,L=>this.triggerEvent(L)),Ne(L=>{if(jr(L.guardsResult)){const we=Gn(`Redirecting to "${this.serializeUrl(L.guardsResult)}"`);throw we.url=L.guardsResult,we}const $=new lo(L.id,this.serializeUrl(L.extractedUrl),this.serializeUrl(L.urlAfterRedirects),L.targetSnapshot,!!L.guardsResult);this.triggerEvent($)}),(0,Nn.h)(L=>!!L.guardsResult||(this.restoreHistory(L),this.cancelNavigationTransition(L,""),!1)),Ns(L=>{if(L.guards.canActivateChecks.length)return(0,ve.of)(L).pipe(Ne($=>{const we=new ys($.id,this.serializeUrl($.extractedUrl),this.serializeUrl($.urlAfterRedirects),$.targetSnapshot);this.triggerEvent(we)}),(0,Pe.w)($=>{let we=!1;return(0,ve.of)($).pipe(function(_,p){return(0,_t.z)(f=>{const{targetSnapshot:y,guards:{canActivateChecks:E}}=f;if(!E.length)return(0,ve.of)(f);let A=0;return(0,Z.D)(E).pipe((0,Lt.b)(N=>function(_,p,f,y){return function(_,p,f,y){const E=Object.keys(_);if(0===E.length)return(0,ve.of)({});const A={};return(0,Z.D)(E).pipe((0,_t.z)(N=>function(_,p,f,y){const E=vo(_,p,y);return sn(E.resolve?E.resolve(p,f):E(p,f))}(_[N],p,f,y).pipe(Ne(L=>{A[N]=L}))),Zr(1),(0,_t.z)(()=>Object.keys(A).length===E.length?(0,ve.of)(A):Qe.E))}(_._resolve,_,p,y).pipe((0,qe.U)(A=>(_._resolvedData=A,_.data=Object.assign(Object.assign({},_.data),pa(_,f).resolve),null)))}(N.route,y,_,p)),Ne(()=>A++),Zr(1),(0,_t.z)(N=>A===E.length?(0,ve.of)(f):Qe.E))})}(this.paramsInheritanceStrategy,this.ngModule.injector),Ne({next:()=>we=!0,complete:()=>{we||(this.restoreHistory($),this.cancelNavigationTransition($,"At least one route resolver didn't emit any value."))}}))}),Ne($=>{const we=new uo($.id,this.serializeUrl($.extractedUrl),this.serializeUrl($.urlAfterRedirects),$.targetSnapshot);this.triggerEvent(we)}))}),Ns(L=>{const{targetSnapshot:$,id:we,extractedUrl:ot,rawUrl:Be,extras:{skipLocationChange:St,replaceUrl:ft}}=L;return this.hooks.afterPreactivation($,{navigationId:we,appliedUrlTree:ot,rawUrlTree:Be,skipLocationChange:!!St,replaceUrl:!!ft})}),(0,qe.U)(L=>{const $=function(_,p,f){const y=Dn(_,p._root,f?f._root:void 0);return new Qn(y,p)}(this.routeReuseStrategy,L.targetSnapshot,L.currentRouterState);return Object.assign(Object.assign({},L),{targetRouterState:$})}),Ne(L=>{this.currentUrlTree=L.urlAfterRedirects,this.rawUrlTree=this.urlHandlingStrategy.merge(L.urlAfterRedirects,L.rawUrl),this.routerState=L.targetRouterState,"deferred"===this.urlUpdateStrategy&&(L.extras.skipLocationChange||this.setBrowserUrl(this.rawUrlTree,L),this.browserUrlTree=L.urlAfterRedirects)}),((_,p,f)=>(0,qe.U)(y=>(new li(p,y.targetRouterState,y.currentRouterState,f).activate(_),y)))(this.rootContexts,this.routeReuseStrategy,L=>this.triggerEvent(L)),Ne({next(){A=!0},complete(){A=!0}}),function(_){return(0,Se.e)((p,f)=>{try{p.subscribe(f)}finally{f.add(_)}})}(()=>{var L;if(!A&&!N){const $=`Navigation ID ${E.id} is not equal to the current navigation id ${this.navigationId}`;"replace"===this.canceledNavigationResolution?(this.restoreHistory(E),this.cancelNavigationTransition(E,$)):this.cancelNavigationTransition(E,$)}(null===(L=this.currentNavigation)||void 0===L?void 0:L.id)===E.id&&(this.currentNavigation=null)}),(0,Ue.K)(L=>{if(N=!0,function(_){return _&&_[hn]}(L)){const $=jr(L.url);$||(this.navigated=!0,this.restoreHistory(E,!0));const we=new wn(E.id,this.serializeUrl(E.extractedUrl),L.message);y.next(we),$?setTimeout(()=>{const ot=this.urlHandlingStrategy.merge(L.url,this.rawUrlTree),Be={skipLocationChange:E.extras.skipLocationChange,replaceUrl:"eager"===this.urlUpdateStrategy||wo(E.source)};this.scheduleNavigation(ot,"imperative",null,Be,{resolve:E.resolve,reject:E.reject,promise:E.promise})},0):E.resolve(!1)}else{this.restoreHistory(E,!0);const $=new fn(E.id,this.serializeUrl(E.extractedUrl),L);y.next($);try{E.resolve(this.errorHandler(L))}catch(we){E.reject(we)}}return Qe.E}))}))}resetRootComponentType(f){this.rootComponentType=f,this.routerState.root.component=this.rootComponentType}getTransition(){const f=this.transitions.value;return f.urlAfterRedirects=this.browserUrlTree,f}setTransition(f){this.transitions.next(Object.assign(Object.assign({},this.getTransition()),f))}initialNavigation(){this.setUpLocationChangeListener(),0===this.navigationId&&this.navigateByUrl(this.location.path(!0),{replaceUrl:!0})}setUpLocationChangeListener(){this.locationSubscription||(this.locationSubscription=this.location.subscribe(f=>{const y=this.extractLocationChangeInfoFromEvent(f);this.shouldScheduleNavigation(this.lastLocationChangeInfo,y)&&setTimeout(()=>{const{source:E,state:A,urlTree:N}=y,L={replaceUrl:!0};if(A){const $=Object.assign({},A);delete $.navigationId,delete $.\u0275routerPageId,0!==Object.keys($).length&&(L.state=$)}this.scheduleNavigation(N,E,A,L)},0),this.lastLocationChangeInfo=y}))}extractLocationChangeInfoFromEvent(f){var y;return{source:"popstate"===f.type?"popstate":"hashchange",urlTree:this.parseUrl(f.url),state:(null===(y=f.state)||void 0===y?void 0:y.navigationId)?f.state:null,transitionId:this.getTransition().id}}shouldScheduleNavigation(f,y){if(!f)return!0;const E=y.urlTree.toString()===f.urlTree.toString();return y.transitionId!==f.transitionId||!E||!("hashchange"===y.source&&"popstate"===f.source||"popstate"===y.source&&"hashchange"===f.source)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.currentNavigation}triggerEvent(f){this.events.next(f)}resetConfig(f){yo(f),this.config=f.map(b),this.navigated=!1,this.lastSuccessfulId=-1}ngOnDestroy(){this.dispose()}dispose(){this.transitions.complete(),this.locationSubscription&&(this.locationSubscription.unsubscribe(),this.locationSubscription=void 0),this.disposed=!0}createUrlTree(f,y={}){const{relativeTo:E,queryParams:A,fragment:N,queryParamsHandling:L,preserveFragment:$}=y,we=E||this.routerState.root,ot=$?this.currentUrlTree.fragment:N;let Be=null;switch(L){case"merge":Be=Object.assign(Object.assign({},this.currentUrlTree.queryParams),A);break;case"preserve":Be=this.currentUrlTree.queryParams;break;default:Be=A||null}return null!==Be&&(Be=this.removeEmptyProps(Be)),function(_,p,f,y,E){if(0===f.length)return Dr(p.root,p.root,p,y,E);const A=function(_){if("string"==typeof _[0]&&1===_.length&&"/"===_[0])return new ga(!0,0,_);let p=0,f=!1;const y=_.reduce((E,A,N)=>{if("object"==typeof A&&null!=A){if(A.outlets){const L={};return on(A.outlets,($,we)=>{L[we]="string"==typeof $?$.split("/"):$}),[...E,{outlets:L}]}if(A.segmentPath)return[...E,A.segmentPath]}return"string"!=typeof A?[...E,A]:0===N?(A.split("/").forEach((L,$)=>{0==$&&"."===L||(0==$&&""===L?f=!0:".."===L?p++:""!=L&&E.push(L))}),E):[...E,A]},[]);return new ga(f,p,y)}(f);if(A.toRoot())return Dr(p.root,new lt([],{}),p,y,E);const N=function(_,p,f){if(_.isAbsolute)return new Ts(p.root,!0,0);if(-1===f.snapshot._lastPathIndex){const A=f.snapshot._urlSegment;return new Ts(A,A===p.root,0)}const y=mo(_.commands[0])?0:1;return function(_,p,f){let y=_,E=p,A=f;for(;A>E;){if(A-=E,y=y.parent,!y)throw new Error("Invalid number of '../'");E=y.segments.length}return new Ts(y,!1,E-A)}(f.snapshot._urlSegment,f.snapshot._lastPathIndex+y,_.numberOfDoubleDots)}(A,p,_),L=N.processChildren?qo(N.segmentGroup,N.index,A.commands):_a(N.segmentGroup,N.index,A.commands);return Dr(N.segmentGroup,L,p,y,E)}(we,this.currentUrlTree,f,Be,null!=ot?ot:null)}navigateByUrl(f,y={skipLocationChange:!1}){const E=jr(f)?f:this.parseUrl(f),A=this.urlHandlingStrategy.merge(E,this.rawUrlTree);return this.scheduleNavigation(A,"imperative",null,y)}navigate(f,y={skipLocationChange:!1}){return function(_){for(let p=0;p<_.length;p++){const f=_[p];if(null==f)throw new Error(`The requested path contains ${f} segment at index ${p}`)}}(f),this.navigateByUrl(this.createUrlTree(f,y),y)}serializeUrl(f){return this.urlSerializer.serialize(f)}parseUrl(f){let y;try{y=this.urlSerializer.parse(f)}catch(E){y=this.malformedUriErrorHandler(E,this.urlSerializer,f)}return y}isActive(f,y){let E;if(E=!0===y?Object.assign({},Vs):!1===y?Object.assign({},ac):y,jr(f))return fo(this.currentUrlTree,f,E);const A=this.parseUrl(f);return fo(this.currentUrlTree,A,E)}removeEmptyProps(f){return Object.keys(f).reduce((y,E)=>{const A=f[E];return null!=A&&(y[E]=A),y},{})}processNavigations(){this.navigations.subscribe(f=>{this.navigated=!0,this.lastSuccessfulId=f.id,this.currentPageId=f.targetPageId,this.events.next(new bn(f.id,this.serializeUrl(f.extractedUrl),this.serializeUrl(this.currentUrlTree))),this.lastSuccessfulNavigation=this.currentNavigation,f.resolve(!0)},f=>{this.console.warn(`Unhandled Navigation Error: ${f}`)})}scheduleNavigation(f,y,E,A,N){var L,$;if(this.disposed)return Promise.resolve(!1);const we=this.getTransition(),ot=wo(y)&&we&&!wo(we.source),ft=(this.lastSuccessfulId===we.id||this.currentNavigation?we.rawUrl:we.urlAfterRedirects).toString()===f.toString();if(ot&&ft)return Promise.resolve(!0);let hi,nr,fr;N?(hi=N.resolve,nr=N.reject,fr=N.promise):fr=new Promise((Mr,To)=>{hi=Mr,nr=To});const Ir=++this.navigationId;let zr;return"computed"===this.canceledNavigationResolution?(0===this.currentPageId&&(E=this.location.getState()),zr=E&&E.\u0275routerPageId?E.\u0275routerPageId:A.replaceUrl||A.skipLocationChange?null!==(L=this.browserPageId)&&void 0!==L?L:0:(null!==($=this.browserPageId)&&void 0!==$?$:0)+1):zr=0,this.setTransition({id:Ir,targetPageId:zr,source:y,restoredState:E,currentUrlTree:this.currentUrlTree,currentRawUrl:this.rawUrlTree,rawUrl:f,extras:A,resolve:hi,reject:nr,promise:fr,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),fr.catch(Mr=>Promise.reject(Mr))}setBrowserUrl(f,y){const E=this.urlSerializer.serialize(f),A=Object.assign(Object.assign({},y.extras.state),this.generateNgRouterState(y.id,y.targetPageId));this.location.isCurrentPathEqualTo(E)||y.extras.replaceUrl?this.location.replaceState(E,"",A):this.location.go(E,"",A)}restoreHistory(f,y=!1){var E,A;if("computed"===this.canceledNavigationResolution){const N=this.currentPageId-f.targetPageId;"popstate"!==f.source&&"eager"!==this.urlUpdateStrategy&&this.currentUrlTree!==(null===(E=this.currentNavigation)||void 0===E?void 0:E.finalUrl)||0===N?this.currentUrlTree===(null===(A=this.currentNavigation)||void 0===A?void 0:A.finalUrl)&&0===N&&(this.resetState(f),this.browserUrlTree=f.currentUrlTree,this.resetUrlToCurrentUrlTree()):this.location.historyGo(N)}else"replace"===this.canceledNavigationResolution&&(y&&this.resetState(f),this.resetUrlToCurrentUrlTree())}resetState(f){this.routerState=f.currentRouterState,this.currentUrlTree=f.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,f.rawUrl)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}cancelNavigationTransition(f,y){const E=new wn(f.id,this.serializeUrl(f.extractedUrl),y);this.triggerEvent(E),f.resolve(!1)}generateNgRouterState(f,y){return"computed"===this.canceledNavigationResolution?{navigationId:f,\u0275routerPageId:y}:{navigationId:f}}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(m.DyG),m.LFG(Vr),m.LFG(bo),m.LFG(x.Ye),m.LFG(m.zs3),m.LFG(m.v3s),m.LFG(m.Sil),m.LFG(void 0))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();function wo(_){return"imperative"!==_}let $i=(()=>{class _{constructor(f,y,E,A,N){this.router=f,this.route=y,this.commands=[],this.onChanges=new ce.x,null==E&&A.setAttribute(N.nativeElement,"tabindex","0")}ngOnChanges(f){this.onChanges.next(this)}set routerLink(f){this.commands=null!=f?Array.isArray(f)?f:[f]:[]}onClick(){const f={skipLocationChange:Wr(this.skipLocationChange),replaceUrl:Wr(this.replaceUrl),state:this.state};return this.router.navigateByUrl(this.urlTree,f),!0}get urlTree(){return this.router.createUrlTree(this.commands,{relativeTo:void 0!==this.relativeTo?this.relativeTo:this.route,queryParams:this.queryParams,fragment:this.fragment,queryParamsHandling:this.queryParamsHandling,preserveFragment:Wr(this.preserveFragment)})}}return _.\u0275fac=function(f){return new(f||_)(m.Y36(yn),m.Y36(gn),m.$8M("tabindex"),m.Y36(m.Qsj),m.Y36(m.SBq))},_.\u0275dir=m.lG2({type:_,selectors:[["","routerLink","",5,"a",5,"area"]],hostBindings:function(f,y){1&f&&m.NdJ("click",function(){return y.onClick()})},inputs:{routerLink:"routerLink",queryParams:"queryParams",fragment:"fragment",queryParamsHandling:"queryParamsHandling",preserveFragment:"preserveFragment",skipLocationChange:"skipLocationChange",replaceUrl:"replaceUrl",state:"state",relativeTo:"relativeTo"},features:[m.TTD]}),_})();function Wr(_){return""===_||!!_}let Us=(()=>{class _{constructor(f,y,E,A,N){this.parentContexts=f,this.location=y,this.resolver=E,this.changeDetector=N,this.activated=null,this._activatedRoute=null,this.activateEvents=new m.vpe,this.deactivateEvents=new m.vpe,this.name=A||tt,f.onChildOutletCreated(this.name,this)}ngOnDestroy(){this.parentContexts.onChildOutletDestroyed(this.name)}ngOnInit(){if(!this.activated){const f=this.parentContexts.getContext(this.name);f&&f.route&&(f.attachRef?this.attach(f.attachRef,f.route):this.activateWith(f.route,f.resolver||null))}}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new Error("Outlet is not activated");return this.activated.instance}get activatedRoute(){if(!this.activated)throw new Error("Outlet is not activated");return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new Error("Outlet is not activated");this.location.detach();const f=this.activated;return this.activated=null,this._activatedRoute=null,f}attach(f,y){this.activated=f,this._activatedRoute=y,this.location.insert(f.hostView)}deactivate(){if(this.activated){const f=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(f)}}activateWith(f,y){if(this.isActivated)throw new Error("Cannot activate an already activated outlet");this._activatedRoute=f;const N=(y=y||this.resolver).resolveComponentFactory(f._futureSnapshot.routeConfig.component),L=this.parentContexts.getOrCreateContext(this.name).children,$=new fi(f,L,this.location.injector);this.activated=this.location.createComponent(N,this.location.length,$),this.changeDetector.markForCheck(),this.activateEvents.emit(this.activated.instance)}}return _.\u0275fac=function(f){return new(f||_)(m.Y36(bo),m.Y36(m.s_b),m.Y36(m._Vd),m.$8M("name"),m.Y36(m.sBO))},_.\u0275dir=m.lG2({type:_,selectors:[["router-outlet"]],outputs:{activateEvents:"activate",deactivateEvents:"deactivate"},exportAs:["outlet"]}),_})();class fi{constructor(p,f,y){this.route=p,this.childContexts=f,this.parent=y}get(p,f){return p===gn?this.route:p===bo?this.childContexts:this.parent.get(p,f)}}class Gi{}class jl{preload(p,f){return(0,ve.of)(null)}}let Eo=(()=>{class _{constructor(f,y,E,A,N){this.router=f,this.injector=A,this.preloadingStrategy=N,this.loader=new di(y,E,we=>f.triggerEvent(new co(we)),we=>f.triggerEvent(new vs(we)))}setUpPreloading(){this.subscription=this.router.events.pipe((0,Nn.h)(f=>f instanceof bn),(0,Lt.b)(()=>this.preload())).subscribe(()=>{})}preload(){const f=this.injector.get(m.h0i);return this.processRoutes(f,this.router.config)}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}processRoutes(f,y){const E=[];for(const A of y)if(A.loadChildren&&!A.canLoad&&A._loadedConfig){const N=A._loadedConfig;E.push(this.processRoutes(N.module,N.routes))}else A.loadChildren&&!A.canLoad?E.push(this.preloadConfig(f,A)):A.children&&E.push(this.processRoutes(f,A.children));return(0,Z.D)(E).pipe((0,ge.J)(),(0,qe.U)(A=>{}))}preloadConfig(f,y){return this.preloadingStrategy.preload(y,()=>(y._loadedConfig?(0,ve.of)(y._loadedConfig):this.loader.load(f.injector,y)).pipe((0,_t.z)(A=>(y._loadedConfig=A,this.processRoutes(A.module,A.routes)))))}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(yn),m.LFG(m.v3s),m.LFG(m.Sil),m.LFG(m.zs3),m.LFG(Gi))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})(),Zo=(()=>{class _{constructor(f,y,E={}){this.router=f,this.viewportScroller=y,this.options=E,this.lastId=0,this.lastSource="imperative",this.restoredId=0,this.store={},E.scrollPositionRestoration=E.scrollPositionRestoration||"disabled",E.anchorScrolling=E.anchorScrolling||"disabled"}init(){"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents()}createScrollEvents(){return this.router.events.subscribe(f=>{f instanceof bt?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=f.navigationTrigger,this.restoredId=f.restoredState?f.restoredState.navigationId:0):f instanceof bn&&(this.lastId=f.id,this.scheduleScrollEvent(f,this.router.parseUrl(f.urlAfterRedirects).fragment))})}consumeScrollEvents(){return this.router.events.subscribe(f=>{f instanceof ze&&(f.position?"top"===this.options.scrollPositionRestoration?this.viewportScroller.scrollToPosition([0,0]):"enabled"===this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition(f.position):f.anchor&&"enabled"===this.options.anchorScrolling?this.viewportScroller.scrollToAnchor(f.anchor):"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition([0,0]))})}scheduleScrollEvent(f,y){this.router.triggerEvent(new ze(f,"popstate"===this.lastSource?this.store[this.restoredId]:null,y))}ngOnDestroy(){this.routerEventsSubscription&&this.routerEventsSubscription.unsubscribe(),this.scrollEventsSubscription&&this.scrollEventsSubscription.unsubscribe()}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(yn),m.LFG(x.EM),m.LFG(void 0))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();const Wi=new m.OlP("ROUTER_CONFIGURATION"),cc=new m.OlP("ROUTER_FORROOT_GUARD"),js=[x.Ye,{provide:Vr,useClass:Wo},{provide:yn,useFactory:function(_,p,f,y,E,A,N,L={},$,we){const ot=new yn(null,_,p,f,y,E,A,Xr(N));return $&&(ot.urlHandlingStrategy=$),we&&(ot.routeReuseStrategy=we),function(_,p){_.errorHandler&&(p.errorHandler=_.errorHandler),_.malformedUriErrorHandler&&(p.malformedUriErrorHandler=_.malformedUriErrorHandler),_.onSameUrlNavigation&&(p.onSameUrlNavigation=_.onSameUrlNavigation),_.paramsInheritanceStrategy&&(p.paramsInheritanceStrategy=_.paramsInheritanceStrategy),_.relativeLinkResolution&&(p.relativeLinkResolution=_.relativeLinkResolution),_.urlUpdateStrategy&&(p.urlUpdateStrategy=_.urlUpdateStrategy)}(L,ot),L.enableTracing&&ot.events.subscribe(Be=>{var St,ft;null===(St=console.group)||void 0===St||St.call(console,`Router Event: ${Be.constructor.name}`),console.log(Be.toString()),console.log(Be),null===(ft=console.groupEnd)||void 0===ft||ft.call(console)}),ot},deps:[Vr,bo,x.Ye,m.zs3,m.v3s,m.Sil,ks,Wi,[class{},new m.FiY],[class{},new m.FiY]]},bo,{provide:gn,useFactory:function(_){return _.routerState.root},deps:[yn]},{provide:m.v3s,useClass:m.EAV},Eo,jl,class{preload(p,f){return f().pipe((0,Ue.K)(()=>(0,ve.of)(null)))}},{provide:Wi,useValue:{enableTracing:!1}}];function Bl(){return new m.PXZ("Router",yn)}let xa=(()=>{class _{constructor(f,y){}static forRoot(f,y){return{ngModule:_,providers:[js,zi(f),{provide:cc,useFactory:$l,deps:[[yn,new m.FiY,new m.tp0]]},{provide:Wi,useValue:y||{}},{provide:x.S$,useFactory:Hl,deps:[x.lw,[new m.tBr(x.mr),new m.FiY],Wi]},{provide:Zo,useFactory:Xo,deps:[yn,x.EM,Wi]},{provide:Gi,useExisting:y&&y.preloadingStrategy?y.preloadingStrategy:jl},{provide:m.PXZ,multi:!0,useFactory:Bl},[So,{provide:m.ip1,multi:!0,useFactory:gf,deps:[So]},{provide:Pa,useFactory:Ra,deps:[So]},{provide:m.tb,multi:!0,useExisting:Pa}]]}}static forChild(f){return{ngModule:_,providers:[zi(f)]}}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(cc,8),m.LFG(yn,8))},_.\u0275mod=m.oAB({type:_}),_.\u0275inj=m.cJS({}),_})();function Xo(_,p,f){return f.scrollOffset&&p.setOffset(f.scrollOffset),new Zo(_,p,f)}function Hl(_,p,f={}){return f.useHash?new x.Do(_,p):new x.b0(_,p)}function $l(_){return"guarded"}function zi(_){return[{provide:m.deG,multi:!0,useValue:_},{provide:ks,multi:!0,useValue:_}]}let So=(()=>{class _{constructor(f){this.injector=f,this.initNavigation=!1,this.destroyed=!1,this.resultOfPreactivationDone=new ce.x}appInitializer(){return this.injector.get(x.V_,Promise.resolve(null)).then(()=>{if(this.destroyed)return Promise.resolve(!0);let y=null;const E=new Promise(L=>y=L),A=this.injector.get(yn),N=this.injector.get(Wi);return"disabled"===N.initialNavigation?(A.setUpLocationChangeListener(),y(!0)):"enabled"===N.initialNavigation||"enabledBlocking"===N.initialNavigation?(A.hooks.afterPreactivation=()=>this.initNavigation?(0,ve.of)(null):(this.initNavigation=!0,y(!0),this.resultOfPreactivationDone),A.initialNavigation()):y(!0),E})}bootstrapListener(f){const y=this.injector.get(Wi),E=this.injector.get(Eo),A=this.injector.get(Zo),N=this.injector.get(yn),L=this.injector.get(m.z2F);f===L.components[0]&&(("enabledNonBlocking"===y.initialNavigation||void 0===y.initialNavigation)&&N.initialNavigation(),E.setUpPreloading(),A.init(),N.resetRootComponentType(L.componentTypes[0]),this.resultOfPreactivationDone.next(null),this.resultOfPreactivationDone.complete())}ngOnDestroy(){this.destroyed=!0}}return _.\u0275fac=function(f){return new(f||_)(m.LFG(m.zs3))},_.\u0275prov=m.Yz7({token:_,factory:_.\u0275fac}),_})();function gf(_){return _.appInitializer.bind(_)}function Ra(_){return _.bootstrapListener.bind(_)}const Pa=new m.OlP("Router Initializer")},1823:function(Ie,ne,O){var x;Ie.exports=(x=x||function(m,ce){var Q;if("undefined"!=typeof window&&window.crypto&&(Q=window.crypto),"undefined"!=typeof self&&self.crypto&&(Q=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(Q=globalThis.crypto),!Q&&"undefined"!=typeof window&&window.msCrypto&&(Q=window.msCrypto),!Q&&"undefined"!=typeof global&&global.crypto&&(Q=global.crypto),!Q)try{Q=O(2480)}catch(te){}var ee=function(){if(Q){if("function"==typeof Q.getRandomValues)try{return Q.getRandomValues(new Uint32Array(1))[0]}catch(te){}if("function"==typeof Q.randomBytes)try{return Q.randomBytes(4).readInt32LE()}catch(te){}}throw new Error("Native crypto module could not be used to get secure random number.")},Ae=Object.create||function(){function te(){}return function(ge){var se;return te.prototype=ge,se=new te,te.prototype=null,se}}(),Z={},ye=Z.lib={},pe=ye.Base={extend:function(te){var ge=Ae(this);return te&&ge.mixIn(te),(!ge.hasOwnProperty("init")||this.init===ge.init)&&(ge.init=function(){ge.$super.init.apply(this,arguments)}),ge.init.prototype=ge,ge.$super=this,ge},create:function(){var te=this.extend();return te.init.apply(te,arguments),te},init:function(){},mixIn:function(te){for(var ge in te)te.hasOwnProperty(ge)&&(this[ge]=te[ge]);te.hasOwnProperty("toString")&&(this.toString=te.toString)},clone:function(){return this.init.prototype.extend(this)}},re=ye.WordArray=pe.extend({init:function(te,ge){te=this.words=te||[],this.sigBytes=null!=ge?ge:4*te.length},toString:function(te){return(te||_e).stringify(this)},concat:function(te){var ge=this.words,se=te.words,de=this.sigBytes,he=te.sigBytes;if(this.clamp(),de%4)for(var be=0;be>>2]|=(se[be>>>2]>>>24-be%4*8&255)<<24-(de+be)%4*8;else for(var Se=0;Se>>2]=se[Se>>>2];return this.sigBytes+=he,this},clamp:function(){var te=this.words,ge=this.sigBytes;te[ge>>>2]&=4294967295<<32-ge%4*8,te.length=m.ceil(ge/4)},clone:function(){var te=pe.clone.call(this);return te.words=this.words.slice(0),te},random:function(te){for(var ge=[],se=0;se>>2]>>>24-he%4*8&255;de.push((be>>>4).toString(16)),de.push((15&be).toString(16))}return de.join("")},parse:function(te){for(var ge=te.length,se=[],de=0;de>>3]|=parseInt(te.substr(de,2),16)<<24-de%8*4;return new re.init(se,ge/2)}},xe=Y.Latin1={stringify:function(te){for(var ge=te.words,se=te.sigBytes,de=[],he=0;he>>2]>>>24-he%4*8&255));return de.join("")},parse:function(te){for(var ge=te.length,se=[],de=0;de>>2]|=(255&te.charCodeAt(de))<<24-de%4*8;return new re.init(se,ge)}},z=Y.Utf8={stringify:function(te){try{return decodeURIComponent(escape(xe.stringify(te)))}catch(ge){throw new Error("Malformed UTF-8 data")}},parse:function(te){return xe.parse(unescape(encodeURIComponent(te)))}},Oe=ye.BufferedBlockAlgorithm=pe.extend({reset:function(){this._data=new re.init,this._nDataBytes=0},_append:function(te){"string"==typeof te&&(te=z.parse(te)),this._data.concat(te),this._nDataBytes+=te.sigBytes},_process:function(te){var ge,se=this._data,de=se.words,he=se.sigBytes,be=this.blockSize,Se=he/(4*be),ae=(Se=te?m.ceil(Se):m.max((0|Se)-this._minBufferSize,0))*be,Le=m.min(4*ae,he);if(ae){for(var ve=0;ve>>2]>>>24-xe%4*8&255)<<16|(pe[xe+1>>>2]>>>24-(xe+1)%4*8&255)<<8|pe[xe+2>>>2]>>>24-(xe+2)%4*8&255,te=0;te<4&&xe+.75*te>>6*(3-te)&63));var ge=Y.charAt(64);if(ge)for(;_e.length%4;)_e.push(ge);return _e.join("")},parse:function(ye){var pe=ye.length,re=this._map,Y=this._reverseMap;if(!Y){Y=this._reverseMap=[];for(var _e=0;_e>>6-xe%4*2;Y[_e>>>2]|=(z|Oe)<<24-_e%4*8,_e++}return Q.create(Y,_e)}(ye,pe,Y)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},x.enc.Base64)},9706:function(Ie,ne,O){Ie.exports=O(1823).enc.Utf8},6946:function(Ie,ne,O){var x;Ie.exports=(x=O(1823),function(m){var ce=x,Q=ce.lib,ee=Q.WordArray,Ae=Q.Hasher,Z=ce.algo,ye=[],pe=[];!function(){function _e(ue){for(var je=m.sqrt(ue),te=2;te<=je;te++)if(!(ue%te))return!1;return!0}function xe(ue){return 4294967296*(ue-(0|ue))|0}for(var z=2,Oe=0;Oe<64;)_e(z)&&(Oe<8&&(ye[Oe]=xe(m.pow(z,.5))),pe[Oe]=xe(m.pow(z,1/3)),Oe++),z++}();var re=[],Y=Z.SHA256=Ae.extend({_doReset:function(){this._hash=new ee.init(ye.slice(0))},_doProcessBlock:function(_e,xe){for(var z=this._hash.words,Oe=z[0],ue=z[1],je=z[2],te=z[3],ge=z[4],se=z[5],de=z[6],he=z[7],be=0;be<64;be++){if(be<16)re[be]=0|_e[xe+be];else{var at=re[be-15],ae=re[be-2];re[be]=((at<<25|at>>>7)^(at<<14|at>>>18)^at>>>3)+re[be-7]+((ae<<15|ae>>>17)^(ae<<13|ae>>>19)^ae>>>10)+re[be-16]}var Qe=Oe&ue^Oe&je^ue&je,Me=he+((ge<<26|ge>>>6)^(ge<<21|ge>>>11)^(ge<<7|ge>>>25))+(ge&se^~ge&de)+pe[be]+re[be];he=de,de=se,se=ge,ge=te+Me|0,te=je,je=ue,ue=Oe,Oe=Me+(((Oe<<30|Oe>>>2)^(Oe<<19|Oe>>>13)^(Oe<<10|Oe>>>22))+Qe)|0}z[0]=z[0]+Oe|0,z[1]=z[1]+ue|0,z[2]=z[2]+je|0,z[3]=z[3]+te|0,z[4]=z[4]+ge|0,z[5]=z[5]+se|0,z[6]=z[6]+de|0,z[7]=z[7]+he|0},_doFinalize:function(){var _e=this._data,xe=_e.words,z=8*this._nDataBytes,Oe=8*_e.sigBytes;return xe[Oe>>>5]|=128<<24-Oe%32,xe[14+(Oe+64>>>9<<4)]=m.floor(z/4294967296),xe[15+(Oe+64>>>9<<4)]=z,_e.sigBytes=4*xe.length,this._process(),this._hash},clone:function(){var _e=Ae.clone.call(this);return _e._hash=this._hash.clone(),_e}});ce.SHA256=Ae._createHelper(Y),ce.HmacSHA256=Ae._createHmacHelper(Y)}(Math),x.SHA256)},7980:(Ie,ne,O)=>{"use strict";O.d(ne,{y:()=>re});var x=O(817),m=O(9593),ce=O(3122),Q=O(8330);var Z=O(2046),ye=O(5975),pe=O(1519);let re=(()=>{class z{constructor(ue){ue&&(this._subscribe=ue)}lift(ue){const je=new z;return je.source=this,je.operator=ue,je}subscribe(ue,je,te){const ge=function(z){return z&&z instanceof x.Lv||function(z){return z&&(0,ye.m)(z.next)&&(0,ye.m)(z.error)&&(0,ye.m)(z.complete)}(z)&&(0,m.Nn)(z)}(ue)?ue:new x.Hp(ue,je,te);return(0,pe.x)(()=>{const{operator:se,source:de}=this;ge.add(se?se.call(ge,de):de?this._subscribe(ge):this._trySubscribe(ge))}),ge}_trySubscribe(ue){try{return this._subscribe(ue)}catch(je){ue.error(je)}}forEach(ue,je){return new(je=Y(je))((te,ge)=>{const se=new x.Hp({next:de=>{try{ue(de)}catch(he){ge(he),se.unsubscribe()}},error:ge,complete:te});this.subscribe(se)})}_subscribe(ue){var je;return null===(je=this.source)||void 0===je?void 0:je.subscribe(ue)}[ce.L](){return this}pipe(...ue){return function(z){return 0===z.length?Q.y:1===z.length?z[0]:function(ue){return z.reduce((je,te)=>te(je),ue)}}(ue)(this)}toPromise(ue){return new(ue=Y(ue))((je,te)=>{let ge;this.subscribe(se=>ge=se,se=>te(se),()=>je(ge))})}}return z.create=Oe=>new z(Oe),z})();function Y(z){var Oe;return null!==(Oe=null!=z?z:Z.v.Promise)&&void 0!==Oe?Oe:Promise}},9359:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>Z});var x=O(7980),m=O(9593);const Q=(0,O(5776).d)(pe=>function(){pe(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var ee=O(8308),Ae=O(1519);let Z=(()=>{class pe extends x.y{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(Y){const _e=new ye(this,this);return _e.operator=Y,_e}_throwIfClosed(){if(this.closed)throw new Q}next(Y){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const _e of this.currentObservers)_e.next(Y)}})}error(Y){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=Y;const{observers:_e}=this;for(;_e.length;)_e.shift().error(Y)}})}complete(){(0,Ae.x)(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:Y}=this;for(;Y.length;)Y.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var Y;return(null===(Y=this.observers)||void 0===Y?void 0:Y.length)>0}_trySubscribe(Y){return this._throwIfClosed(),super._trySubscribe(Y)}_subscribe(Y){return this._throwIfClosed(),this._checkFinalizedStatuses(Y),this._innerSubscribe(Y)}_innerSubscribe(Y){const{hasError:_e,isStopped:xe,observers:z}=this;return _e||xe?m.Lc:(this.currentObservers=null,z.push(Y),new m.w0(()=>{this.currentObservers=null,(0,ee.P)(z,Y)}))}_checkFinalizedStatuses(Y){const{hasError:_e,thrownError:xe,isStopped:z}=this;_e?Y.error(xe):z&&Y.complete()}asObservable(){const Y=new x.y;return Y.source=this,Y}}return pe.create=(re,Y)=>new ye(re,Y),pe})();class ye extends Z{constructor(re,Y){super(),this.destination=re,this.source=Y}next(re){var Y,_e;null===(_e=null===(Y=this.destination)||void 0===Y?void 0:Y.next)||void 0===_e||_e.call(Y,re)}error(re){var Y,_e;null===(_e=null===(Y=this.destination)||void 0===Y?void 0:Y.error)||void 0===_e||_e.call(Y,re)}complete(){var re,Y;null===(Y=null===(re=this.destination)||void 0===re?void 0:re.complete)||void 0===Y||Y.call(re)}_subscribe(re){var Y,_e;return null!==(_e=null===(Y=this.source)||void 0===Y?void 0:Y.subscribe(re))&&void 0!==_e?_e:m.Lc}}},817:(Ie,ne,O)=>{"use strict";O.d(ne,{Hp:()=>ue,Lv:()=>_e});var x=O(5975),m=O(9593),ce=O(2046),Q=O(4922);function ee(){}const Ae=pe("C",void 0,void 0);function pe(de,he,be){return{kind:de,value:he,error:be}}var re=O(4146),Y=O(1519);class _e extends m.w0{constructor(he){super(),this.isStopped=!1,he?(this.destination=he,(0,m.Nn)(he)&&he.add(this)):this.destination=se}static create(he,be,at){return new ue(he,be,at)}next(he){this.isStopped?ge(pe("N",he,void 0),this):this._next(he)}error(he){this.isStopped?ge(pe("E",void 0,he),this):(this.isStopped=!0,this._error(he))}complete(){this.isStopped?ge(Ae,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(he){this.destination.next(he)}_error(he){try{this.destination.error(he)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const xe=Function.prototype.bind;function z(de,he){return xe.call(de,he)}class Oe{constructor(he){this.partialObserver=he}next(he){const{partialObserver:be}=this;if(be.next)try{be.next(he)}catch(at){je(at)}}error(he){const{partialObserver:be}=this;if(be.error)try{be.error(he)}catch(at){je(at)}else je(he)}complete(){const{partialObserver:he}=this;if(he.complete)try{he.complete()}catch(be){je(be)}}}class ue extends _e{constructor(he,be,at){let Se;if(super(),(0,x.m)(he)||!he)Se={next:null!=he?he:void 0,error:null!=be?be:void 0,complete:null!=at?at:void 0};else{let ae;this&&ce.v.useDeprecatedNextContext?(ae=Object.create(he),ae.unsubscribe=()=>this.unsubscribe(),Se={next:he.next&&z(he.next,ae),error:he.error&&z(he.error,ae),complete:he.complete&&z(he.complete,ae)}):Se=he}this.destination=new Oe(Se)}}function je(de){ce.v.useDeprecatedSynchronousErrorHandling?(0,Y.O)(de):(0,Q.h)(de)}function ge(de,he){const{onStoppedNotification:be}=ce.v;be&&re.z.setTimeout(()=>be(de,he))}const se={closed:!0,next:ee,error:function(de){throw de},complete:ee}},9593:(Ie,ne,O)=>{"use strict";O.d(ne,{Lc:()=>Ae,w0:()=>ee,Nn:()=>Z});var x=O(5975);const ce=(0,O(5776).d)(pe=>function(Y){pe(this),this.message=Y?`${Y.length} errors occurred during unsubscription:\n${Y.map((_e,xe)=>`${xe+1}) ${_e.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=Y});var Q=O(8308);class ee{constructor(re){this.initialTeardown=re,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let re;if(!this.closed){this.closed=!0;const{_parentage:Y}=this;if(Y)if(this._parentage=null,Array.isArray(Y))for(const z of Y)z.remove(this);else Y.remove(this);const{initialTeardown:_e}=this;if((0,x.m)(_e))try{_e()}catch(z){re=z instanceof ce?z.errors:[z]}const{_finalizers:xe}=this;if(xe){this._finalizers=null;for(const z of xe)try{ye(z)}catch(Oe){re=null!=re?re:[],Oe instanceof ce?re=[...re,...Oe.errors]:re.push(Oe)}}if(re)throw new ce(re)}}add(re){var Y;if(re&&re!==this)if(this.closed)ye(re);else{if(re instanceof ee){if(re.closed||re._hasParent(this))return;re._addParent(this)}(this._finalizers=null!==(Y=this._finalizers)&&void 0!==Y?Y:[]).push(re)}}_hasParent(re){const{_parentage:Y}=this;return Y===re||Array.isArray(Y)&&Y.includes(re)}_addParent(re){const{_parentage:Y}=this;this._parentage=Array.isArray(Y)?(Y.push(re),Y):Y?[Y,re]:re}_removeParent(re){const{_parentage:Y}=this;Y===re?this._parentage=null:Array.isArray(Y)&&(0,Q.P)(Y,re)}remove(re){const{_finalizers:Y}=this;Y&&(0,Q.P)(Y,re),re instanceof ee&&re._removeParent(this)}}ee.EMPTY=(()=>{const pe=new ee;return pe.closed=!0,pe})();const Ae=ee.EMPTY;function Z(pe){return pe instanceof ee||pe&&"closed"in pe&&(0,x.m)(pe.remove)&&(0,x.m)(pe.add)&&(0,x.m)(pe.unsubscribe)}function ye(pe){(0,x.m)(pe)?pe():pe.unsubscribe()}},2046:(Ie,ne,O)=>{"use strict";O.d(ne,{v:()=>x});const x={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},9018:(Ie,ne,O)=>{"use strict";O.d(ne,{E:()=>m});const m=new(O(7980).y)(ee=>ee.complete())},9517:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>at});var x=O(5955),m=O(6903),ce=O(2085),Q=O(8499);function ee(Se,ae=0){return(0,ce.e)((Le,ve)=>{Le.subscribe((0,Q.x)(ve,Qe=>(0,m.f)(ve,Se,()=>ve.next(Qe),ae),()=>(0,m.f)(ve,Se,()=>ve.complete(),ae),Qe=>(0,m.f)(ve,Se,()=>ve.error(Qe),ae)))})}function Ae(Se,ae=0){return(0,ce.e)((Le,ve)=>{ve.add(Se.schedule(()=>Le.subscribe(ve),ae))})}var pe=O(7980),Y=O(4565),_e=O(5975);function z(Se,ae){if(!Se)throw new Error("Iterable cannot be null");return new pe.y(Le=>{(0,m.f)(Le,ae,()=>{const ve=Se[Symbol.asyncIterator]();(0,m.f)(Le,ae,()=>{ve.next().then(Qe=>{Qe.done?Le.complete():Le.next(Qe.value)})},0,!0)})})}var Oe=O(2021),ue=O(9450),je=O(6602),te=O(6920),ge=O(2604),se=O(5626),de=O(1559);function at(Se,ae){return ae?function(Se,ae){if(null!=Se){if((0,Oe.c)(Se))return function(Se,ae){return(0,x.Xf)(Se).pipe(Ae(ae),ee(ae))}(Se,ae);if((0,je.z)(Se))return function(Se,ae){return new pe.y(Le=>{let ve=0;return ae.schedule(function(){ve===Se.length?Le.complete():(Le.next(Se[ve++]),Le.closed||this.schedule())})})}(Se,ae);if((0,ue.t)(Se))return function(Se,ae){return(0,x.Xf)(Se).pipe(Ae(ae),ee(ae))}(Se,ae);if((0,ge.D)(Se))return z(Se,ae);if((0,te.T)(Se))return function(Se,ae){return new pe.y(Le=>{let ve;return(0,m.f)(Le,ae,()=>{ve=Se[Y.h](),(0,m.f)(Le,ae,()=>{let Qe,Ke;try{({value:Qe,done:Ke}=ve.next())}catch(pt){return void Le.error(pt)}Ke?Le.complete():Le.next(Qe)},0,!0)}),()=>(0,_e.m)(null==ve?void 0:ve.return)&&ve.return()})}(Se,ae);if((0,de.L)(Se))return function(Se,ae){return z((0,de.Q)(Se),ae)}(Se,ae)}throw(0,se.z)(Se)}(Se,ae):(0,x.Xf)(Se)}},5955:(Ie,ne,O)=>{"use strict";O.d(ne,{Xf:()=>xe});var x=O(7582),m=O(6602),ce=O(9450),Q=O(7980),ee=O(2021),Ae=O(2604),Z=O(5626),ye=O(6920),pe=O(1559),re=O(5975),Y=O(4922),_e=O(3122);function xe(de){if(de instanceof Q.y)return de;if(null!=de){if((0,ee.c)(de))return function(de){return new Q.y(he=>{const be=de[_e.L]();if((0,re.m)(be.subscribe))return be.subscribe(he);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(de);if((0,m.z)(de))return function(de){return new Q.y(he=>{for(let be=0;be{de.then(be=>{he.closed||(he.next(be),he.complete())},be=>he.error(be)).then(null,Y.h)})}(de);if((0,Ae.D)(de))return te(de);if((0,ye.T)(de))return function(de){return new Q.y(he=>{for(const be of de)if(he.next(be),he.closed)return;he.complete()})}(de);if((0,pe.L)(de))return function(de){return te((0,pe.Q)(de))}(de)}throw(0,Z.z)(de)}function te(de){return new Q.y(he=>{(function(de,he){var be,at,Se,ae;return(0,x.mG)(this,void 0,void 0,function*(){try{for(be=(0,x.KL)(de);!(at=yield be.next()).done;)if(he.next(at.value),he.closed)return}catch(Le){Se={error:Le}}finally{try{at&&!at.done&&(ae=be.return)&&(yield ae.call(be))}finally{if(Se)throw Se.error}}he.complete()})})(de,he).catch(be=>he.error(be))})}},4945:(Ie,ne,O)=>{"use strict";O.d(ne,{of:()=>ce});var x=O(8007),m=O(9517);function ce(...Q){const ee=(0,x.yG)(Q);return(0,m.D)(Q,ee)}},8499:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>m});var x=O(817);function m(Q,ee,Ae,Z,ye){return new ce(Q,ee,Ae,Z,ye)}class ce extends x.Lv{constructor(ee,Ae,Z,ye,pe,re){super(ee),this.onFinalize=pe,this.shouldUnsubscribe=re,this._next=Ae?function(Y){try{Ae(Y)}catch(_e){ee.error(_e)}}:super._next,this._error=ye?function(Y){try{ye(Y)}catch(_e){ee.error(_e)}finally{this.unsubscribe()}}:super._error,this._complete=Z?function(){try{Z()}catch(Y){ee.error(Y)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var ee;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:Ae}=this;super.unsubscribe(),!Ae&&(null===(ee=this.onFinalize)||void 0===ee||ee.call(this))}}}},3568:(Ie,ne,O)=>{"use strict";O.d(ne,{K:()=>Q});var x=O(5955),m=O(8499),ce=O(2085);function Q(ee){return(0,ce.e)((Ae,Z)=>{let re,ye=null,pe=!1;ye=Ae.subscribe((0,m.x)(Z,void 0,void 0,Y=>{re=(0,x.Xf)(ee(Y,Q(ee)(Ae))),ye?(ye.unsubscribe(),ye=null,re.subscribe(Z)):pe=!0})),pe&&(ye.unsubscribe(),ye=null,re.subscribe(Z))})}},4551:(Ie,ne,O)=>{"use strict";O.d(ne,{b:()=>ce});var x=O(3159),m=O(5975);function ce(Q,ee){return(0,m.m)(ee)?(0,x.z)(Q,ee,1):(0,x.z)(Q,1)}},4970:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>ce});var x=O(2085),m=O(8499);function ce(Q,ee){return(0,x.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,m.x)(Z,pe=>Q.call(ee,pe,ye++)&&Z.next(pe)))})}},7969:(Ie,ne,O)=>{"use strict";O.d(ne,{U:()=>ce});var x=O(2085),m=O(8499);function ce(Q,ee){return(0,x.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,m.x)(Z,pe=>{Z.next(Q.call(ee,pe,ye++))}))})}},549:(Ie,ne,O)=>{"use strict";O.d(ne,{J:()=>ce});var x=O(3159),m=O(8330);function ce(Q=1/0){return(0,x.z)(m.y,Q)}},3159:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>ye});var x=O(7969),m=O(5955),ce=O(2085),ee=(O(6903),O(8499)),Z=O(5975);function ye(pe,re,Y=1/0){return(0,Z.m)(re)?ye((_e,xe)=>(0,x.U)((z,Oe)=>re(_e,z,xe,Oe))((0,m.Xf)(pe(_e,xe))),Y):("number"==typeof re&&(Y=re),(0,ce.e)((_e,xe)=>function(pe,re,Y,_e,xe,z,Oe,ue){const je=[];let te=0,ge=0,se=!1;const de=()=>{se&&!je.length&&!te&&re.complete()},he=at=>te<_e?be(at):je.push(at),be=at=>{te++;let Se=!1;(0,m.Xf)(Y(at,ge++)).subscribe((0,ee.x)(re,ae=>{re.next(ae)},()=>{Se=!0},void 0,()=>{if(Se)try{for(te--;je.length&&te<_e;){const ae=je.shift();be(ae)}de()}catch(ae){re.error(ae)}}))};return pe.subscribe((0,ee.x)(re,he,()=>{se=!0,de()})),()=>{}}(_e,xe,pe,Y)))}},1528:(Ie,ne,O)=>{"use strict";O.d(ne,{w:()=>Q});var x=O(5955),m=O(2085),ce=O(8499);function Q(ee,Ae){return(0,m.e)((Z,ye)=>{let pe=null,re=0,Y=!1;const _e=()=>Y&&!pe&&ye.complete();Z.subscribe((0,ce.x)(ye,xe=>{null==pe||pe.unsubscribe();let z=0;const Oe=re++;(0,x.Xf)(ee(xe,Oe)).subscribe(pe=(0,ce.x)(ye,ue=>ye.next(Ae?Ae(xe,ue,Oe,z++):ue),()=>{pe=null,_e()}))},()=>{Y=!0,_e()}))})}},5598:(Ie,ne,O)=>{"use strict";O.d(ne,{q:()=>Q});var x=O(9018),m=O(2085),ce=O(8499);function Q(ee){return ee<=0?()=>x.E:(0,m.e)((Ae,Z)=>{let ye=0;Ae.subscribe((0,ce.x)(Z,pe=>{++ye<=ee&&(Z.next(pe),ee<=ye&&Z.complete())}))})}},4146:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>x});const x={setTimeout(m,ce,...Q){const{delegate:ee}=x;return(null==ee?void 0:ee.setTimeout)?ee.setTimeout(m,ce,...Q):setTimeout(m,ce,...Q)},clearTimeout(m){const{delegate:ce}=x;return((null==ce?void 0:ce.clearTimeout)||clearTimeout)(m)},delegate:void 0}},4565:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>m});const m="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},3122:(Ie,ne,O)=>{"use strict";O.d(ne,{L:()=>x});const x="function"==typeof Symbol&&Symbol.observable||"@@observable"},8007:(Ie,ne,O)=>{"use strict";O.d(ne,{_6:()=>Ae,jO:()=>Q,yG:()=>ee});var x=O(5975);function ce(Z){return Z[Z.length-1]}function Q(Z){return(0,x.m)(ce(Z))?Z.pop():void 0}function ee(Z){return function(Z){return Z&&(0,x.m)(Z.schedule)}(ce(Z))?Z.pop():void 0}function Ae(Z,ye){return"number"==typeof ce(Z)?Z.pop():ye}},447:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>ee});const{isArray:x}=Array,{getPrototypeOf:m,prototype:ce,keys:Q}=Object;function ee(Z){if(1===Z.length){const ye=Z[0];if(x(ye))return{args:ye,keys:null};if(function(Z){return Z&&"object"==typeof Z&&m(Z)===ce}(ye)){const pe=Q(ye);return{args:pe.map(re=>ye[re]),keys:pe}}}return{args:Z,keys:null}}},8308:(Ie,ne,O)=>{"use strict";function x(m,ce){if(m){const Q=m.indexOf(ce);0<=Q&&m.splice(Q,1)}}O.d(ne,{P:()=>x})},5776:(Ie,ne,O)=>{"use strict";function x(m){const Q=m(ee=>{Error.call(ee),ee.stack=(new Error).stack});return Q.prototype=Object.create(Error.prototype),Q.prototype.constructor=Q,Q}O.d(ne,{d:()=>x})},9299:(Ie,ne,O)=>{"use strict";function x(m,ce){return m.reduce((Q,ee,Ae)=>(Q[ee]=ce[Ae],Q),{})}O.d(ne,{n:()=>x})},1519:(Ie,ne,O)=>{"use strict";O.d(ne,{x:()=>ce,O:()=>Q});var x=O(2046);let m=null;function ce(ee){if(x.v.useDeprecatedSynchronousErrorHandling){const Ae=!m;if(Ae&&(m={errorThrown:!1,error:null}),ee(),Ae){const{errorThrown:Z,error:ye}=m;if(m=null,Z)throw ye}}else ee()}function Q(ee){x.v.useDeprecatedSynchronousErrorHandling&&m&&(m.errorThrown=!0,m.error=ee)}},6903:(Ie,ne,O)=>{"use strict";function x(m,ce,Q,ee=0,Ae=!1){const Z=ce.schedule(function(){Q(),Ae?m.add(this.schedule(null,ee)):this.unsubscribe()},ee);if(m.add(Z),!Ae)return Z}O.d(ne,{f:()=>x})},8330:(Ie,ne,O)=>{"use strict";function x(m){return m}O.d(ne,{y:()=>x})},6602:(Ie,ne,O)=>{"use strict";O.d(ne,{z:()=>x});const x=m=>m&&"number"==typeof m.length&&"function"!=typeof m},2604:(Ie,ne,O)=>{"use strict";O.d(ne,{D:()=>m});var x=O(5975);function m(ce){return Symbol.asyncIterator&&(0,x.m)(null==ce?void 0:ce[Symbol.asyncIterator])}},5975:(Ie,ne,O)=>{"use strict";function x(m){return"function"==typeof m}O.d(ne,{m:()=>x})},2021:(Ie,ne,O)=>{"use strict";O.d(ne,{c:()=>ce});var x=O(3122),m=O(5975);function ce(Q){return(0,m.m)(Q[x.L])}},6920:(Ie,ne,O)=>{"use strict";O.d(ne,{T:()=>ce});var x=O(4565),m=O(5975);function ce(Q){return(0,m.m)(null==Q?void 0:Q[x.h])}},9450:(Ie,ne,O)=>{"use strict";O.d(ne,{t:()=>m});var x=O(5975);function m(ce){return(0,x.m)(null==ce?void 0:ce.then)}},1559:(Ie,ne,O)=>{"use strict";O.d(ne,{Q:()=>ce,L:()=>Q});var x=O(7582),m=O(5975);function ce(ee){return(0,x.FC)(this,arguments,function*(){const Z=ee.getReader();try{for(;;){const{value:ye,done:pe}=yield(0,x.qq)(Z.read());if(pe)return yield(0,x.qq)(void 0);yield yield(0,x.qq)(ye)}}finally{Z.releaseLock()}})}function Q(ee){return(0,m.m)(null==ee?void 0:ee.getReader)}},2085:(Ie,ne,O)=>{"use strict";O.d(ne,{A:()=>m,e:()=>ce});var x=O(5975);function m(Q){return(0,x.m)(null==Q?void 0:Q.lift)}function ce(Q){return ee=>{if(m(ee))return ee.lift(function(Ae){try{return Q(Ae,this)}catch(Z){this.error(Z)}});throw new TypeError("Unable to lift unknown Observable type")}}},2692:(Ie,ne,O)=>{"use strict";O.d(ne,{Z:()=>Q});var x=O(7969);const{isArray:m}=Array;function Q(ee){return(0,x.U)(Ae=>function(ee,Ae){return m(Ae)?ee(...Ae):ee(Ae)}(ee,Ae))}},4922:(Ie,ne,O)=>{"use strict";O.d(ne,{h:()=>ce});var x=O(2046),m=O(4146);function ce(Q){m.z.setTimeout(()=>{const{onUnhandledError:ee}=x.v;if(!ee)throw Q;ee(Q)})}},5626:(Ie,ne,O)=>{"use strict";function x(m){return new TypeError(`You provided ${null!==m&&"object"==typeof m?"an invalid object":`'${m}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}O.d(ne,{z:()=>x})},2462:(Ie,ne,O)=>{"use strict";O.r(ne),O.d(ne,{PageModule:()=>Ae});var x=O(8967),m=O(7525);const Q=[{path:"",component:(()=>{class Z{constructor(pe){this.route=pe,this.title=""}ngOnInit(){this.title=this.route.snapshot.data.title}}return Z.\u0275fac=function(pe){return new(pe||Z)(m.Y36(x.gz))},Z.\u0275cmp=m.Xpm({type:Z,selectors:[["app-page"]],decls:2,vars:1,template:function(pe,re){1&pe&&(m.TgZ(0,"h2"),m._uU(1),m.qZA()),2&pe&&(m.xp6(1),m.Oqu(re.title))},styles:["[_nghost-%COMP%]{display:flex;justify-content:center;align-items:center;height:100%;color:#bdbdbd}"]}),Z})()}];let ee=(()=>{class Z{}return Z.\u0275fac=function(pe){return new(pe||Z)},Z.\u0275mod=m.oAB({type:Z}),Z.\u0275inj=m.cJS({imports:[[x.Bz.forChild(Q)],x.Bz]}),Z})(),Ae=(()=>{class Z{}return Z.\u0275fac=function(pe){return new(pe||Z)},Z.\u0275mod=m.oAB({type:Z}),Z.\u0275inj=m.cJS({imports:[[ee]]}),Z})()},4159:(Ie,ne,O)=>{"use strict";var x=O(8583),m=O(7525);class ce extends x.w_{constructor(){super(...arguments),this.supportsDOMEvents=!0}}class Q extends ce{static makeCurrent(){(0,x.HT)(new Q)}onAndCancel(i,o,u){return i.addEventListener(o,u,!1),()=>{i.removeEventListener(o,u,!1)}}dispatchEvent(i,o){i.dispatchEvent(o)}remove(i){i.parentNode&&i.parentNode.removeChild(i)}createElement(i,o){return(o=o||this.getDefaultDocument()).createElement(i)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(i){return i.nodeType===Node.ELEMENT_NODE}isShadowRoot(i){return i instanceof DocumentFragment}getGlobalEventTarget(i,o){return"window"===o?window:"document"===o?i:"body"===o?i.body:null}getBaseHref(i){const o=(ee=ee||document.querySelector("base"),ee?ee.getAttribute("href"):null);return null==o?null:function(a){Z=Z||document.createElement("a"),Z.setAttribute("href",a);const i=Z.pathname;return"/"===i.charAt(0)?i:`/${i}`}(o)}resetBaseElement(){ee=null}getUserAgent(){return window.navigator.userAgent}getCookie(i){return(0,x.Mx)(document.cookie,i)}}let Z,ee=null;const pe=new m.OlP("TRANSITION_ID"),Y=[{provide:m.ip1,useFactory:function(a,i,o){return()=>{o.get(m.CZH).donePromise.then(()=>{const u=(0,x.q)(),h=i.querySelectorAll(`style[ng-transition="${a}"]`);for(let w=0;w{const w=i.findTestabilityInTree(u,h);if(null==w)throw new Error("Could not find testability for element.");return w},m.dqk.getAllAngularTestabilities=()=>i.getAllTestabilities(),m.dqk.getAllAngularRootElements=()=>i.getAllRootElements(),m.dqk.frameworkStabilizers||(m.dqk.frameworkStabilizers=[]),m.dqk.frameworkStabilizers.push(u=>{const h=m.dqk.getAllAngularTestabilities();let w=h.length,T=!1;const P=function(F){T=T||F,w--,0==w&&u(T)};h.forEach(function(F){F.whenStable(P)})})}findTestabilityInTree(i,o,u){if(null==o)return null;const h=i.getTestability(o);return null!=h?h:u?(0,x.q)().isShadowRoot(o)?this.findTestabilityInTree(i,o.host,!0):this.findTestabilityInTree(i,o.parentElement,!0):null}}let xe=(()=>{class a{build(){return new XMLHttpRequest}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Qe=new m.OlP("EventManagerPlugins");let Ke=(()=>{class a{constructor(o,u){this._zone=u,this._eventNameToPlugin=new Map,o.forEach(h=>h.manager=this),this._plugins=o.slice().reverse()}addEventListener(o,u,h){return this._findPluginFor(u).addEventListener(o,u,h)}addGlobalEventListener(o,u,h){return this._findPluginFor(u).addGlobalEventListener(o,u,h)}getZone(){return this._zone}_findPluginFor(o){const u=this._eventNameToPlugin.get(o);if(u)return u;const h=this._plugins;for(let w=0;w{class a{constructor(){this._stylesSet=new Set}addStyles(o){const u=new Set;o.forEach(h=>{this._stylesSet.has(h)||(this._stylesSet.add(h),u.add(h))}),this.onStylesAdded(u)}onStylesAdded(o){}getAllStyles(){return Array.from(this._stylesSet)}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Nn=(()=>{class a extends Me{constructor(o){super(),this._doc=o,this._hostNodes=new Map,this._hostNodes.set(o.head,[])}_addStylesToHost(o,u,h){o.forEach(w=>{const T=this._doc.createElement("style");T.textContent=w,h.push(u.appendChild(T))})}addHost(o){const u=[];this._addStylesToHost(this._stylesSet,o,u),this._hostNodes.set(o,u)}removeHost(o){const u=this._hostNodes.get(o);u&&u.forEach(Zr),this._hostNodes.delete(o)}onStylesAdded(o){this._hostNodes.forEach((u,h)=>{this._addStylesToHost(o,h,u)})}ngOnDestroy(){this._hostNodes.forEach(o=>o.forEach(Zr))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();function Zr(a){(0,x.q)().remove(a)}const ao={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},G=/%COMP%/g;function ht(a,i,o){for(let u=0;u{if("__ngUnwrap__"===i)return a;!1===a(i)&&(i.preventDefault(),i.returnValue=!1)}}let Ue=(()=>{class a{constructor(o,u,h){this.eventManager=o,this.sharedStylesHost=u,this.appId=h,this.rendererByCompId=new Map,this.defaultRenderer=new Lt(o)}createRenderer(o,u){if(!o||!u)return this.defaultRenderer;switch(u.encapsulation){case m.ifc.Emulated:{let h=this.rendererByCompId.get(u.id);return h||(h=new bn(this.eventManager,this.sharedStylesHost,u,this.appId),this.rendererByCompId.set(u.id,h)),h.applyToHost(o),h}case 1:case m.ifc.ShadowDom:return new wn(this.eventManager,this.sharedStylesHost,o,u);default:if(!this.rendererByCompId.has(u.id)){const h=ht(u.id,u.styles,[]);this.sharedStylesHost.addStyles(h),this.rendererByCompId.set(u.id,this.defaultRenderer)}return this.defaultRenderer}}begin(){}end(){}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(Ke),m.LFG(Nn),m.LFG(m.AFp))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();class Lt{constructor(i){this.eventManager=i,this.data=Object.create(null)}destroy(){}createElement(i,o){return o?document.createElementNS(ao[o]||o,i):document.createElement(i)}createComment(i){return document.createComment(i)}createText(i){return document.createTextNode(i)}appendChild(i,o){i.appendChild(o)}insertBefore(i,o,u){i&&i.insertBefore(o,u)}removeChild(i,o){i&&i.removeChild(o)}selectRootElement(i,o){let u="string"==typeof i?document.querySelector(i):i;if(!u)throw new Error(`The selector "${i}" did not match any elements`);return o||(u.textContent=""),u}parentNode(i){return i.parentNode}nextSibling(i){return i.nextSibling}setAttribute(i,o,u,h){if(h){o=h+":"+o;const w=ao[h];w?i.setAttributeNS(w,o,u):i.setAttribute(o,u)}else i.setAttribute(o,u)}removeAttribute(i,o,u){if(u){const h=ao[u];h?i.removeAttributeNS(h,o):i.removeAttribute(`${u}:${o}`)}else i.removeAttribute(o)}addClass(i,o){i.classList.add(o)}removeClass(i,o){i.classList.remove(o)}setStyle(i,o,u,h){h&(m.JOm.DashCase|m.JOm.Important)?i.style.setProperty(o,u,h&m.JOm.Important?"important":""):i.style[o]=u}removeStyle(i,o,u){u&m.JOm.DashCase?i.style.removeProperty(o):i.style[o]=""}setProperty(i,o,u){i[o]=u}setValue(i,o){i.nodeValue=o}listen(i,o,u){return"string"==typeof i?this.eventManager.addGlobalEventListener(i,o,qe(u)):this.eventManager.addEventListener(i,o,qe(u))}}class bn extends Lt{constructor(i,o,u,h){super(i),this.component=u;const w=ht(h+"-"+u.id,u.styles,[]);o.addStyles(w),this.contentAttr="_ngcontent-%COMP%".replace(G,h+"-"+u.id),this.hostAttr=function(a){return"_nghost-%COMP%".replace(G,a)}(h+"-"+u.id)}applyToHost(i){super.setAttribute(i,this.hostAttr,"")}createElement(i,o){const u=super.createElement(i,o);return super.setAttribute(u,this.contentAttr,""),u}}class wn extends Lt{constructor(i,o,u,h){super(i),this.sharedStylesHost=o,this.hostEl=u,this.shadowRoot=u.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const w=ht(h.id,h.styles,[]);for(let T=0;T{class a extends pt{constructor(o){super(o)}supports(o){return!0}addEventListener(o,u,h){return o.addEventListener(u,h,!1),()=>this.removeEventListener(o,u,h)}removeEventListener(o,u,h){return o.removeEventListener(u,h)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Vt=["alt","control","meta","shift"],ze={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},tt={A:"1",B:"2",C:"3",D:"4",E:"5",F:"6",G:"7",H:"8",I:"9",J:"*",K:"+",M:"-",N:".",O:"/","`":"0","\x90":"NumLock"},Cl={alt:a=>a.altKey,control:a=>a.ctrlKey,meta:a=>a.metaKey,shift:a=>a.shiftKey};let ct=(()=>{class a extends pt{constructor(o){super(o)}supports(o){return null!=a.parseEventName(o)}addEventListener(o,u,h){const w=a.parseEventName(u),T=a.eventCallback(w.fullKey,h,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>(0,x.q)().onAndCancel(o,w.domEventName,T))}static parseEventName(o){const u=o.toLowerCase().split("."),h=u.shift();if(0===u.length||"keydown"!==h&&"keyup"!==h)return null;const w=a._normalizeKey(u.pop());let T="";if(Vt.forEach(F=>{const j=u.indexOf(F);j>-1&&(u.splice(j,1),T+=F+".")}),T+=w,0!=u.length||0===w.length)return null;const P={};return P.domEventName=h,P.fullKey=T,P}static getEventFullKey(o){let u="",h=function(a){let i=a.key;if(null==i){if(i=a.keyIdentifier,null==i)return"Unidentified";i.startsWith("U+")&&(i=String.fromCharCode(parseInt(i.substring(2),16)),3===a.location&&tt.hasOwnProperty(i)&&(i=tt[i]))}return ze[i]||i}(o);return h=h.toLowerCase()," "===h?h="space":"."===h&&(h="dot"),Vt.forEach(w=>{w!=h&&Cl[w](o)&&(u+=w+".")}),u+=h,u}static eventCallback(o,u,h){return w=>{a.getEventFullKey(w)===o&&h.runGuarded(()=>u(w))}}static _normalizeKey(o){return"esc"===o?"escape":o}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Go=(0,m.eFA)(m._c5,"browser",[{provide:m.Lbi,useValue:x.bD},{provide:m.g9A,useValue:function(){Q.makeCurrent(),_e.init()},multi:!0},{provide:x.K0,useFactory:function(){return(0,m.RDi)(document),document},deps:[]}]),Es=[[],{provide:m.zSh,useValue:"root"},{provide:m.qLn,useFactory:function(){return new m.qLn},deps:[]},{provide:Qe,useClass:fn,multi:!0,deps:[x.K0,m.R0b,m.Lbi]},{provide:Qe,useClass:ct,multi:!0,deps:[x.K0]},[],{provide:Ue,useClass:Ue,deps:[Ke,Nn,m.AFp]},{provide:m.FYo,useExisting:Ue},{provide:Me,useExisting:Nn},{provide:Nn,useClass:Nn,deps:[x.K0]},{provide:m.dDg,useClass:m.dDg,deps:[m.R0b]},{provide:Ke,useClass:Ke,deps:[Qe,m.R0b]},{provide:x.JF,useClass:xe,deps:[]},[]];let lr=(()=>{class a{constructor(o){if(o)throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.")}static withServerTransition(o){return{ngModule:a,providers:[{provide:m.AFp,useValue:o.appId},{provide:pe,useExisting:m.AFp},Y]}}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(a,12))},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:Es,imports:[x.ez,m.hGG]}),a})();function en(a,i,o,u,h,w,T){try{var P=a[w](T),F=P.value}catch(j){return void o(j)}P.done?i(F):Promise.resolve(F).then(u,h)}function H(a){return function(){var i=this,o=arguments;return new Promise(function(u,h){var w=a.apply(i,o);function T(F){en(w,u,h,T,P,"next",F)}function P(F){en(w,u,h,T,P,"throw",F)}T(void 0)})}}function zt(a){this.message=a}"undefined"!=typeof window&&window,(zt.prototype=new Error).name="InvalidCharacterError";var Kn="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(a){var i=String(a).replace(/=+$/,"");if(i.length%4==1)throw new zt("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,u,h=0,w=0,T="";u=i.charAt(w++);~u&&(o=h%4?64*o+u:u,h++%4)?T+=String.fromCharCode(255&o>>(-2*h&6)):0)u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(u);return T};function wr(a){this.message=a}(wr.prototype=new Error).name="InvalidTokenError";const Ze=function(a,i){if("string"!=typeof a)throw new wr("Invalid token specified");var o=!0===(i=i||{}).header?0:1;try{return JSON.parse(function(a){var i=a.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!"}try{return decodeURIComponent(Kn(i).replace(/(.)/g,function(u,h){var w=h.charCodeAt(0).toString(16).toUpperCase();return w.length<2&&(w="0"+w),"%"+w}))}catch(o){return Kn(i)}}(a.split(".")[o]))}catch(u){throw new wr("Invalid token specified: "+u.message)}};let Nt=(()=>{class a{}return a.isCordova=()=>!!(window.cordova||window.phonegap||window.PhoneGap),a.isCapacitor=()=>{var i;return!!(null===(i=window.Capacitor)||void 0===i?void 0:i.isNativePlatform())},a.isNativeMobile=()=>a.isCapacitor()||a.isCordova(),a.decodeJwt=i=>{try{return i&&Ze(i)}catch(o){return console.warn("[@badisi/auth-js] Access token was not decoded as it is not a valid JWT."),i}},a.isUrlMatching=(i,o)=>{if(void 0!==o){const u=new URL(i,"http://test"),h=new URL(o,"http://test");if(""!==h.pathname&&"/"!==h.pathname&&!u.pathname.includes(h.pathname)||"http://test"!==h.origin&&(u.protocol!==h.protocol||u.origin!==h.origin||!`${u.origin}${u.pathname}}`.includes(`${h.origin}${h.pathname}`)))return!1;let w=!0;return h.searchParams.forEach((T,P)=>{u.searchParams.getAll(P).includes(T)||(w=!1)}),w}return!1},a.getBaseUrl=()=>{var i;const o=document.baseURI||(null===(i=document.querySelector("base"))||void 0===i?void 0:i.href)||location.origin;return o.endsWith("/")?o:`${o}/`},a.stringToURL=i=>{try{return new URL(i)}catch(o){const u=i.startsWith("/")?i.substring(1,i.length):i;return new URL(`${a.getBaseUrl()}${u}`)}},a})();var Er=O(9359);const oi={now:()=>(oi.delegate||Date).now(),delegate:void 0};class An extends Er.x{constructor(i=1/0,o=1/0,u=oi){super(),this._bufferSize=i,this._windowTime=o,this._timestampProvider=u,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=o===1/0,this._bufferSize=Math.max(1,i),this._windowTime=Math.max(1,o)}next(i){const{isStopped:o,_buffer:u,_infiniteTimeWindow:h,_timestampProvider:w,_windowTime:T}=this;o||(u.push(i),!h&&u.push(w.now()+T)),this._trimBuffer(),super.next(i)}_subscribe(i){this._throwIfClosed(),this._trimBuffer();const o=this._innerSubscribe(i),{_infiniteTimeWindow:u,_buffer:h}=this,w=h.slice();for(let T=0;T{let h,w=!0;o.subscribe((0,Qn.x)(u,T=>{const P=i(T);(w||!a(h,P))&&(w=!1,h=P,u.next(T))}))})}function At(a,i){return a===i}var gn=O(7969);const cr=function(a,i){return a===i||a!=a&&i!=i},Zn=function(a,i){for(var o=a.length;o--;)if(cr(a[o][0],i))return o;return-1};var zo=Array.prototype.splice;function Dr(a){var i=-1,o=null==a?0:a.length;for(this.clear();++i-1},Dr.prototype.set=function(a,i){var o=this.__data__,u=Zn(o,a);return u<0?(++this.size,o.push([a,i])):o[u][1]=i,this};const Vi=Dr,Ui="object"==typeof global&&global&&global.Object===Object&&global;var As="object"==typeof self&&self&&self.Object===Object&&self;const ji=Ui||As||Function("return this")();var Sl=ji.Symbol,Bi=Object.prototype,Tl=Bi.hasOwnProperty,Is=Bi.toString,er=Sl?Sl.toStringTag:void 0;var va=Object.prototype.toString;var xs=Sl?Sl.toStringTag:void 0;const C=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":xs&&xs in Object(a)?function(a){var i=Tl.call(a,er),o=a[er];try{a[er]=void 0;var u=!0}catch(w){}var h=Is.call(a);return u&&(i?a[er]=o:delete a[er]),h}(a):function(a){return va.call(a)}(a)},b=function(a){var i=typeof a;return null!=a&&("object"==i||"function"==i)},$e=function(a){if(!b(a))return!1;var i=C(a);return"[object Function]"==i||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i};var a,kt=ji["__core-js_shared__"],gt=(a=/[^.]+$/.exec(kt&&kt.keys&&kt.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";var kn=Function.prototype.toString;var $r=/^\[object .+?Constructor\]$/,Sr=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Rs=function(a){return!(!b(a)||function(a){return!!gt&> in a}(a))&&($e(a)?Sr:$r).test(function(a){if(null!=a){try{return kn.call(a)}catch(i){}try{return a+""}catch(i){}}return""}(a))},vo=function(a,i){var o=function(a,i){return null==a?void 0:a[i]}(a,i);return Rs(o)?o:void 0},Hi=vo(ji,"Map"),Ko=vo(Object,"create");var Tr=Object.prototype.hasOwnProperty;var xl=Object.prototype.hasOwnProperty;function tr(a){var i=-1,o=null==a?0:a.length;for(this.clear();++i-1&&a%1==0&&a<=9007199254740991},nr=function(a){return null!=a&&ft(a.length)&&!$e(a)};var To="object"==typeof exports&&exports&&!exports.nodeType&&exports,es=To&&"object"==typeof module&&module&&!module.nodeType&&module,ts=es&&es.exports===To?ji.Buffer:void 0;const Ao=(ts?ts.isBuffer:void 0)||function(){return!1};var Ip=Function.prototype.toString,Mp=Object.prototype.hasOwnProperty,Zt=Ip.call(Object);var Yt={};Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object Boolean]"]=Yt["[object DataView]"]=Yt["[object Date]"]=Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object WeakMap]"]=!1;var rs="object"==typeof exports&&exports&&!exports.nodeType&&exports,ql=rs&&"object"==typeof module&&module&&!module.nodeType&&module,pc=ql&&ql.exports===rs&&Ui.process,Np=function(){try{return ql&&ql.require&&ql.require("util").types||pc&&pc.binding&&pc.binding("util")}catch(i){}}(),wf=Np&&Np.isTypedArray;const $s=wf?function(a){return function(i){return a(i)}}(wf):function(a){return _(a)&&ft(a.length)&&!!Yt[C(a)]},Gs=function(a,i){if(("constructor"!==i||"function"!=typeof a[i])&&"__proto__"!=i)return a[i]};var Fa=Object.prototype.hasOwnProperty;const Ws=function(a,i,o){var u=a[i];(!Fa.call(a,i)||!cr(u,o)||void 0===o&&!(i in a))&&yn(a,i,o)};var yc=/^(?:0|[1-9]\d*)$/;const is=function(a,i){var o=typeof a;return!!(i=null==i?9007199254740991:i)&&("number"==o||"symbol"!=o&&yc.test(a))&&a>-1&&a%1==0&&a0){if(++i>=800)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}(py);const Jp=Kp,Ql=function(a,i){return Jp(function(a,i,o){return i=Ys(void 0===i?a.length-1:i,0),function(){for(var u=arguments,h=-1,w=Ys(u.length-i,0),T=Array(w);++h1?o[h-1]:void 0,T=h>2?o[2]:void 0;for(w=a.length>3&&"function"==typeof w?(h--,w):void 0,T&&function(a,i,o){if(!b(o))return!1;var u=typeof i;return!!("number"==u?nr(o)&&is(i,o.length):"string"==u&&i in o)&&cr(o[i],a)}(o[0],o[1],T)&&(w=h<3?void 0:w,h=1),i=Object(i);++u{},info:()=>{},warn:()=>{},error:()=>{}},xn=(a=>(a[a.NONE=0]="NONE",a[a.ERROR=1]="ERROR",a[a.WARN=2]="WARN",a[a.INFO=3]="INFO",a[a.DEBUG=4]="DEBUG",a))(xn||{});(a=>{a.reset=function(){qr=3,mi=eg},a.setLevel=function(h){if(!(0<=h&&h<=4))throw new Error("Invalid log level");qr=h},a.setLogger=function(h){mi=h}})(xn||(xn={}));var et=class{constructor(a){this._name=a}debug(...a){qr>=4&&mi.debug(et._format(this._name,this._method),...a)}info(...a){qr>=3&&mi.info(et._format(this._name,this._method),...a)}warn(...a){qr>=2&&mi.warn(et._format(this._name,this._method),...a)}error(...a){qr>=1&&mi.error(et._format(this._name,this._method),...a)}throw(a){throw this.error(a),a}create(a){const i=Object.create(this);return i._method=a,i.debug("begin"),i}static createStatic(a,i){const o=new et(`${a}.${i}`);return o.debug("begin"),o}static _format(a,i){const o=`[${a}]`;return i?`${o} ${i}:`:o}static debug(a,...i){qr>=4&&mi.debug(et._format(a),...i)}static info(a,...i){qr>=3&&mi.info(et._format(a),...i)}static warn(a,...i){qr>=2&&mi.warn(et._format(a),...i)}static error(a,...i){qr>=1&&mi.error(et._format(a),...i)}};xn.reset();var Js,Ga,au,lu,uu,Ki,Rr=class{static _randomWord(){return Cc.lib.WordArray.random(1).words[0]}static generateUUIDv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^Rr._randomWord()&15>>+i/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return Rr.generateUUIDv4()+Rr.generateUUIDv4()+Rr.generateUUIDv4()}static generateCodeChallenge(a){try{const i=Xp(a);return Rf.stringify(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(i){throw et.error("CryptoUtils.generateCodeChallenge",i),i}}static generateBasicAuth(a,i){const o=Pf.parse([a,i].join(":"));return Rf.stringify(o)}},_i=class{constructor(a){this._name=a,this._logger=new et(`Event('${this._name}')`),this._callbacks=[]}addHandler(a){return this._callbacks.push(a),()=>this.removeHandler(a)}removeHandler(a){const i=this._callbacks.lastIndexOf(a);i>=0&&this._callbacks.splice(i,1)}raise(...a){this._logger.debug("raise:",...a);for(const i of this._callbacks)i(...a)}},bc=class{static decode(a){try{return Ze(a)}catch(i){throw et.error("JwtUtils.decode",i),i}}},wc=class{static center(i){var o,a=Lr(i,[]);return null==a.width&&(a.width=null!=(o=[800,720,600,480].find(w=>w<=window.outerWidth/1.618))?o:360),null!=a.left||(a.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-a.width)/2))),null!=a.height&&(null!=a.top||(a.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-a.height)/2)))),a}static serialize(a){return Object.entries(a).filter(([,i])=>null!=i).map(([i,o])=>`${i}=${"boolean"!=typeof o?o:o?"yes":"no"}`).join(",")}},Vn=class extends _i{constructor(){super(...arguments),this._logger=new et(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const a=this._expiration-Vn.getEpochTime();this._logger.debug("timer completes in",a),this._expiration<=Vn.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(a){const i=this._logger.create("init");a=Math.max(Math.floor(a),1);const o=Vn.getEpochTime()+a;if(this.expiration===o&&this._timerHandle)return void i.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),i.debug("using duration",a),this._expiration=o;const u=Math.min(a,5);this._timerHandle=setInterval(this._callback,1e3*u)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Zl=class{static readParams(a,i="query"){if(!a)throw new TypeError("Invalid URL");const u=new URL(a,"http://127.0.0.1")["fragment"===i?"hash":"search"];return new URLSearchParams(u.slice(1))}},Yi=class extends Error{constructor(a,i){var o,u,h;if(super(a.error_description||a.error||""),this.form=i,this.name="ErrorResponse",!a.error)throw et.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=a.error,this.error_description=null!=(o=a.error_description)?o:null,this.error_uri=null!=(u=a.error_uri)?u:null,this.state=a.userState,this.session_state=null!=(h=a.session_state)?h:null,this.url_state=a.url_state}},Va=class extends Error{constructor(a){super(a),this.name="ErrorTimeout"}},xo=class{constructor(){this._logger=new et("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(a){return this._logger.create(`getItem('${a}')`),this._data[a]}setItem(a,i){this._logger.create(`setItem('${a}')`),this._data[a]=i}removeItem(a){this._logger.create(`removeItem('${a}')`),delete this._data[a]}get length(){return Object.getOwnPropertyNames(this._data).length}key(a){return Object.getOwnPropertyNames(this._data)[a]}},Ua=class{constructor(a=[],i=null,o={}){this._jwtHandler=i,this._extraHeaders=o,this._logger=new et("JsonService"),this._contentTypes=[],this._contentTypes.push(...a,"application/json"),i&&this._contentTypes.push("application/jwt")}fetchWithTimeout(a,i={}){return H(function*(){const T=i,{timeoutInSeconds:o}=T,u=Lr(T,["timeoutInSeconds"]);if(!o)return yield fetch(a,u);const h=new AbortController,w=setTimeout(()=>h.abort(),1e3*o);try{return yield fetch(a,Tp(dn({},i),{signal:h.signal}))}catch(P){throw P instanceof DOMException&&"AbortError"===P.name?new Va("Network timed out"):P}finally{clearTimeout(w)}})()}getJson(a,{token:i,credentials:o}={}){var u=this;return H(function*(){const h=u._logger.create("getJson"),w={Accept:u._contentTypes.join(", ")};let T;i&&(h.debug("token passed, setting Authorization header"),w.Authorization="Bearer "+i),u.appendExtraHeaders(w);try{h.debug("url:",a),T=yield u.fetchWithTimeout(a,{method:"GET",headers:w,credentials:o})}catch(j){throw h.error("Network Error"),j}h.debug("HTTP response received, status",T.status);const P=T.headers.get("Content-Type");if(P&&!u._contentTypes.find(j=>P.startsWith(j))&&h.throw(new Error(`Invalid response Content-Type: ${null!=P?P:"undefined"}, from URL: ${a}`)),T.ok&&u._jwtHandler&&(null==P?void 0:P.startsWith("application/jwt")))return yield u._jwtHandler(yield T.text());let F;try{F=yield T.json()}catch(j){throw h.error("Error parsing JSON response",j),T.ok?j:new Error(`${T.statusText} (${T.status})`)}if(!T.ok)throw h.error("Error from server:",F),F.error?new Yi(F):new Error(`${T.statusText} (${T.status}): ${JSON.stringify(F)}`);return F})()}postForm(a,{body:i,basicAuth:o,timeoutInSeconds:u,initCredentials:h}){var w=this;return H(function*(){const T=w._logger.create("postForm"),P={Accept:w._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let F;void 0!==o&&(P.Authorization="Basic "+o),w.appendExtraHeaders(P);try{T.debug("url:",a),F=yield w.fetchWithTimeout(a,{method:"POST",headers:P,body:i,timeoutInSeconds:u,credentials:h})}catch(Re){throw T.error("Network error"),Re}T.debug("HTTP response received, status",F.status);const j=F.headers.get("Content-Type");if(j&&!w._contentTypes.find(Re=>j.startsWith(Re)))throw new Error(`Invalid response Content-Type: ${null!=j?j:"undefined"}, from URL: ${a}`);const J=yield F.text();let Ee={};if(J)try{Ee=JSON.parse(J)}catch(Re){throw T.error("Error parsing JSON response",Re),F.ok?Re:new Error(`${F.statusText} (${F.status})`)}if(!F.ok)throw T.error("Error from server:",Ee),Ee.error?new Yi(Ee,i):new Error(`${F.statusText} (${F.status}): ${JSON.stringify(Ee)}`);return Ee})()}appendExtraHeaders(a){const i=this._logger.create("appendExtraHeaders"),o=Object.keys(this._extraHeaders),u=["authorization","accept","content-type"];0!==o.length&&o.forEach(h=>{if(u.includes(h.toLocaleLowerCase()))return void i.warn("Protected header could not be overridden",h,u);const w="function"==typeof this._extraHeaders[h]?this._extraHeaders[h]():this._extraHeaders[h];w&&""!==w&&(a[h]=w)})}},Ec=class{constructor({prefix:a="oidc.",store:i=localStorage}={}){this._logger=new et("WebStorageStateStore"),this._store=i,this._prefix=a}set(a,i){var o=this;return H(function*(){o._logger.create(`set('${a}')`),a=o._prefix+a,yield o._store.setItem(a,i)})()}get(a){var i=this;return H(function*(){return i._logger.create(`get('${a}')`),a=i._prefix+a,yield i._store.getItem(a)})()}remove(a){var i=this;return H(function*(){i._logger.create(`remove('${a}')`),a=i._prefix+a;const o=yield i._store.getItem(a);return yield i._store.removeItem(a),o})()}getAllKeys(){var a=this;return H(function*(){a._logger.create("getAllKeys");const i=yield a._store.length,o=[];for(let u=0;uj.append(Fe,Ct)):null!=ke&&j.set(Fe,ke);let J;switch(P._settings.client_authentication){case"client_secret_basic":if(!o)throw F.throw(new Error("A client_secret is required")),null;J=Rr.generateBasicAuth(i,o);break;case"client_secret_post":j.append("client_id",i),o&&j.append("client_secret",o)}const Ee=yield P._metadataService.getTokenEndpoint(!1);F.debug("got token endpoint");const Re=yield P._jsonService.postForm(Ee,{body:j,basicAuth:J,timeoutInSeconds:u,initCredentials:P._settings.fetchRequestCredentials});return F.debug("got response"),Re})()}revoke(a){var i=this;return H(function*(){var o;const u=i._logger.create("revoke");a.token||u.throw(new Error("A token is required"));const h=yield i._metadataService.getRevocationEndpoint(!1);u.debug(`got revocation endpoint, revoking ${null!=(o=a.token_type_hint)?o:"default token type"}`);const w=new URLSearchParams;for(const[T,P]of Object.entries(a))null!=P&&w.set(T,P);w.set("client_id",i._settings.client_id),i._settings.client_secret&&w.set("client_secret",i._settings.client_secret),yield i._jsonService.postForm(h,{body:w}),u.debug("got response")})()}},Ro=class{constructor(a){this.id=a.id||Rr.generateUUIDv4(),this.data=a.data,this.created=a.created&&a.created>0?a.created:Vn.getEpochTime(),this.request_type=a.request_type,this.url_state=a.url_state}toStorageString(){return new et("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(a){return et.createStatic("State","fromStorageString"),new Ro(JSON.parse(a))}static clearStaleState(a,i){return H(function*(){const o=et.createStatic("State","clearStaleState"),u=Vn.getEpochTime()-i,h=yield a.getAllKeys();o.debug("got keys",h);for(let w=0;w1&&(this.url_state=i.slice(1).join(";"))}this.error=a.get("error"),this.error_description=a.get("error_description"),this.error_uri=a.get("error_uri"),this.code=a.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Vn.getEpochTime()}set expires_in(a){"string"==typeof a&&(a=Number(a)),void 0!==a&&a>=0&&(this.expires_at=Math.floor(a)+Vn.getEpochTime())}get isOpenId(){var a;return(null==(a=this.scope)?void 0:a.split(" ").includes("openid"))||!!this.id_token}},Uf=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],lg=["sub","iss","aud","exp","iat"],ja=class{constructor(a){var i;this.id_token=a.id_token,this.session_state=null!=(i=a.session_state)?i:null,this.access_token=a.access_token,this.refresh_token=a.refresh_token,this.token_type=a.token_type,this.scope=a.scope,this.profile=a.profile,this.expires_at=a.expires_at,this.state=a.userState,this.url_state=a.url_state}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-Vn.getEpochTime()}set expires_in(a){void 0!==a&&(this.expires_at=Math.floor(a)+Vn.getEpochTime())}get expired(){const a=this.expires_in;if(void 0!==a)return a<=0}get scopes(){var a,i;return null!=(i=null==(a=this.scope)?void 0:a.split(" "))?i:[]}toStorageString(){return new et("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(a){return et.createStatic("User","fromStorageString"),new ja(JSON.parse(a))}},Ac="oidc-client",ru=class{constructor(){this._abort=new _i("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}navigate(a){var i=this;return H(function*(){const o=i._logger.create("navigate");if(!i._window)throw new Error("Attempted to navigate on a disposed window");o.debug("setting URL in window"),i._window.location.replace(a.url);const{url:u,keepOpen:h}=yield new Promise((w,T)=>{const P=F=>{var j;const J=F.data,Ee=null!=(j=a.scriptOrigin)?j:window.location.origin;if(F.origin===Ee&&(null==J?void 0:J.source)===Ac){try{const Re=Zl.readParams(J.url,a.response_mode).get("state");if(Re||o.warn("no state found in response url"),F.source!==i._window&&Re!==a.state)return}catch(Re){i._dispose(),T(new Error("Invalid response from window"))}w(J)}};window.addEventListener("message",P,!1),i._disposeHandlers.add(()=>window.removeEventListener("message",P,!1)),i._disposeHandlers.add(i._abort.addHandler(F=>{i._dispose(),T(F)}))});return o.debug("got response from window"),i._dispose(),h||i.close(),{url:u}})()}_dispose(){this._logger.create("_dispose");for(const a of this._disposeHandlers)a();this._disposeHandlers.clear()}static _notifyParent(a,i,o=!1,u=window.location.origin){a.postMessage({source:Ac,url:i,keepOpen:o},u)}},Ic={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Ba="_blank",iu=60,Bf=2,ou=10,Mc=class extends Sc{constructor(a){const{popup_redirect_uri:i=a.redirect_uri,popup_post_logout_redirect_uri:o=a.post_logout_redirect_uri,popupWindowFeatures:u=Ic,popupWindowTarget:h=Ba,redirectMethod:w="assign",redirectTarget:T="self",iframeNotifyParentOrigin:P=a.iframeNotifyParentOrigin,iframeScriptOrigin:F=a.iframeScriptOrigin,silent_redirect_uri:j=a.redirect_uri,silentRequestTimeoutInSeconds:J=ou,automaticSilentRenew:Ee=!0,validateSubOnSilentRenew:Re=!0,includeIdTokenInSilentRenew:Fe=!1,monitorSession:ke=!1,monitorAnonymousSession:Ct=!1,checkSessionIntervalInSeconds:Mt=Bf,query_status_response_type:xt="code",stopCheckSessionOnError:jn=!0,revokeTokenTypes:Cn=["access_token","refresh_token"],revokeTokensOnSignout:Rt=!1,includeIdTokenInSilentSignout:Qt=!1,accessTokenExpiringNotificationTimeInSeconds:Ai=iu,userStore:wt}=a;if(super(a),this.popup_redirect_uri=i,this.popup_post_logout_redirect_uri=o,this.popupWindowFeatures=u,this.popupWindowTarget=h,this.redirectMethod=w,this.redirectTarget=T,this.iframeNotifyParentOrigin=P,this.iframeScriptOrigin=F,this.silent_redirect_uri=j,this.silentRequestTimeoutInSeconds=J,this.automaticSilentRenew=Ee,this.validateSubOnSilentRenew=Re,this.includeIdTokenInSilentRenew=Fe,this.monitorSession=ke,this.monitorAnonymousSession=Ct,this.checkSessionIntervalInSeconds=Mt,this.stopCheckSessionOnError=jn,this.query_status_response_type=xt,this.revokeTokenTypes=Cn,this.revokeTokensOnSignout=Rt,this.includeIdTokenInSilentSignout=Qt,this.accessTokenExpiringNotificationTimeInSeconds=Ai,wt)this.userStore=wt;else{const Bt="undefined"!=typeof window?window.sessionStorage:new xo;this.userStore=new Ec({store:Bt})}}},Ha=class extends ru{constructor({silentRequestTimeoutInSeconds:a=ou}){super(),this._logger=new et("IFrameWindow"),this._timeoutInSeconds=a,this._frame=Ha.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const a=window.document.createElement("iframe");return a.style.visibility="hidden",a.style.position="fixed",a.style.left="-1000px",a.style.top="0",a.width="0",a.height="0",window.document.body.appendChild(a),a}navigate(a){var i=()=>super.navigate,o=this;return H(function*(){o._logger.debug("navigate: Using timeout of:",o._timeoutInSeconds);const u=setTimeout(()=>o._abort.raise(new Va("IFrame timed out without a response")),1e3*o._timeoutInSeconds);return o._disposeHandlers.add(()=>clearTimeout(u)),yield i().call(o,a)})()}close(){var a;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",i=>{var o;const u=i.target;null==(o=u.parentNode)||o.removeChild(u),this._abort.raise(new Error("IFrame removed from DOM"))},!0),null==(a=this._frame.contentWindow)||a.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(a,i){return super._notifyParent(window.parent,a,!1,i)}},$f=class extends ru{constructor({popupWindowTarget:a=Ba,popupWindowFeatures:i={}}){super(),this._logger=new et("PopupWindow");const o=wc.center(dn(dn({},Ic),i));this._window=window.open(void 0,a,wc.serialize(o)),i.closePopupWindowAfterInSeconds&&i.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{this._window&&"boolean"==typeof this._window.closed&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))},1e3*i.closePopupWindowAfterInSeconds)}navigate(a){var i=()=>super.navigate,o=this;return H(function*(){var u;null==(u=o._window)||u.focus();const h=setInterval(()=>{(!o._window||o._window.closed)&&o._abort.raise(new Error("Popup closed by user"))},500);return o._disposeHandlers.add(()=>clearInterval(h)),yield i().call(o,a)})()}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(a,i){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,a,i)}};class ls{constructor(){this.subscribers=[]}add(i){return this.subscribers.push(i),this.lastNotifiedValue&&i(...this.lastNotifiedValue),{unsubscribe:()=>this.unsubscribe(i)}}notify(...i){this.lastNotifiedValue=i,this.subscribers.forEach(o=>{o(...i)})}unsubscribe(i){if(i){const o=this.subscribers.indexOf(i);-1!==o&&this.subscribers.splice(o,1)}else this.subscribers=[]}}const Qs=window.localStorage,pr=null===(Ga=null===(Js=window.Capacitor)||void 0===Js?void 0:Js.Plugins)||void 0===Ga?void 0:Ga.Storage,gr=null===(lu=null===(au=window.Capacitor)||void 0===au?void 0:au.Plugins)||void 0===lu?void 0:lu.Preferences,rr=null===(Ki=null===(uu=window.Capacitor)||void 0===uu?void 0:uu.Plugins)||void 0===Ki?void 0:Ki.SecureStoragePlugin;class fg{constructor(){if(this._logger=new et("MobileStorage"),!rr){let i="[@badisi/auth-js] This application is currently using an unsafe storage.\n\n";i+="\u24d8 Please follow the recommended guide and use `capacitor-secure-storage-plugin` instead.",console.warn(i)}this._logger.debug(rr?"Using `capacitor-secure-storage-plugin` implementation":gr?"Using `@capacitor/preferences` implementation":pr?"Using `@capacitor/storage` implementation":"Using `localStorage` implementation")}get length(){return H(function*(){return rr?(yield rr.keys()).value.length:gr?(yield gr.keys()).keys.length:pr?(yield pr.keys()).keys.length:Qs.length})()}key(i){return H(function*(){return rr?(yield rr.keys()).value[i]:gr?(yield gr.keys()).keys[i]:pr?(yield pr.keys()).keys[i]:Qs.key(i)})()}clear(){var i=this;return H(function*(){i._logger.create("clear"),rr?yield rr.clear():gr?yield gr.clear():pr?yield pr.clear():Qs.clear()})()}getItem(i){var o=this;return H(function*(){if(o._logger.create(`getItem('${i}')`),!rr)return gr?(yield gr.get({key:i})).value:pr?(yield pr.get({key:i})).value:Qs.getItem(i);try{return(yield rr.get({key:i})).value}catch(u){return null}})()}setItem(i,o){var u=this;return H(function*(){u._logger.create(`setItem('${i}')`),rr?yield rr.set({key:i,value:o}):gr?yield gr.set({key:i,value:o}):pr?yield pr.set({key:i,value:o}):Qs.setItem(i,o)})()}removeItem(i){var o=this;return H(function*(){if(o._logger.create(`removeItem('${i}')`),rr)try{yield rr.remove({key:i})}catch(u){}else gr?yield gr.remove({key:i}):pr?yield pr.remove({key:i}):Qs.removeItem(i)})()}}var Xt=(()=>(function(a){a.REDIRECT="REDIRECT",a.POPUP="POPUP"}(Xt||(Xt={})),Xt))();class Po{constructor(){this.expired=void 0,this.expires_in=void 0,this.expires_at=void 0}static deserialize(i){const o=new Po,u=Object.keys(o);for(const h of u)o[h]=i[h];return o}}var Oc,Nc,Fc,kc,Pc=O(7582);const Wa=null===(Nc=null===(Oc=window.Capacitor)||void 0===Oc?void 0:Oc.Plugins)||void 0===Nc?void 0:Nc.App,Pr=null===(kc=null===(Fc=window.Capacitor)||void 0===Fc?void 0:Fc.Plugins)||void 0===kc?void 0:kc.Browser;class pg{constructor(i,o){if(this.redirectUrl=i,this.params=o,this._logger=new et("MobileWindow"),this.originalHandleOpenURL=window.handleOpenURL,this._isClosed=!0,this._receivedResult=!1,!Nt.isCapacitor()&&!Nt.isCordova()){let u="[@badisi/auth-js] Required core dependency not found.\n\n";u+="\u24d8 Please follow the recommended guide and install either `Capacitor` or `Cordova` dependency.",console.error(u)}if(!Pr){let u="[@badisi/auth-js] Required plugin not found.\n\n";u+="\u24d8 Please follow the recommended guide and install either `@badisi/capacitor-browsertab` or `@capacitor/browser` plugin.",console.error(u)}Pr&&this._logger.debug("Using `@capacitor/browser` implementation")}navigate(i){var o=this;return H(function*(){return o.navigateLogger=o._logger.create("navigate"),o.navigateLogger.debug("url",i.url),o._isClosed=!1,o._receivedResult=!1,new Promise((u,h)=>{o._resolve=u,o._reject=h,o.installCustomUrlSchemeHandler().then(()=>{Pr&&o.useCapacitorBrowser(i)})})})()}close(){var i=this;return H(function*(){const o=i._logger.create("close");i._isClosed||(yield null==Pr?void 0:Pr.close().catch(u=>o.error(u))),o.debug("success")})()}cleanup(){var i=this;return H(function*(){var o,u;const h=i._logger.create("cleanup");window.handleOpenURL=i.originalHandleOpenURL,yield null===(o=i.capacitorBrowserFinishedHandle)||void 0===o?void 0:o.remove(),yield null===(u=i.capacitorAppUrlOpenHandle)||void 0===u?void 0:u.remove(),clearTimeout(i.timer),h.debug("success")})()}onError(i){var o=this;return H(function*(){var u,h;null===(u=o.navigateLogger)||void 0===u||u.error("error response:",i),yield o.close(),yield o.cleanup(),null===(h=o._reject)||void 0===h||h.call(o,new Error(i)),o._receivedResult=!0})()}onSuccess(i){var o=this;return H(function*(){var u,h;null===(u=o.navigateLogger)||void 0===u||u.debug("successful response:",i),yield o.close(),yield o.cleanup(),null===(h=o._resolve)||void 0===h||h.call(o,{url:i}),o._receivedResult=!0})()}useCapacitorBrowser(i){var o=this;return H(function*(){o.capacitorBrowserFinishedHandle=yield null==Pr?void 0:Pr.addListener("browserFinished",()=>{o._isClosed=!0,setTimeout(()=>{var u;o._receivedResult||(o.cleanup(),null===(u=o._reject)||void 0===u||u.call(o,"Capacitor browser closed by user"))},1e3)}),yield null==Pr?void 0:Pr.open({url:i.url,toolbarColor:o.params.mobileWindowToolbarColor,presentationStyle:o.params.mobileWindowPresentationStyle,width:o.params.mobileWindowWidth,height:o.params.mobileWindowWidth})})()}useBrowserTab(i){return H(function*(){})()}installCustomUrlSchemeHandler(){var i=this;return H(function*(){var o;const u=i._logger.create("installCustomUrlSchemeHandler");i.timer=setTimeout(()=>{i.onError("Installing custom url scheme handler, timed out without a response")},1e4),yield i.cleanup(),Nt.isCapacitor()?(u.debug("listening to Capacitor `appUrlOpen` event"),i.capacitorAppUrlOpenHandle=yield null===(o=null==Wa?void 0:Wa.addListener)||void 0===o?void 0:o.call(Wa,"appUrlOpen",({url:h})=>{Nt.isUrlMatching(h,i.redirectUrl)&&i.onSuccess(h)})):Nt.isCordova()&&(u.debug("waiting for Cordova `handleOpenURL` callback"),window.handleOpenURL=h=>{var w;null===(w=i.originalHandleOpenURL)||void 0===w||w.call(i,h),Nt.isUrlMatching(h,i.redirectUrl)&&i.onSuccess(h)}),u.debug("success")})()}}class gg{constructor(){this._logger=new et("MobileNavigator")}prepare(i,o){return this._logger.create("prepare"),new pg(i,o)}}class Cy extends class{constructor(a,i,o,u){this._logger=new et("UserManager"),this.settings=new Mc(a),this._client=new class{constructor(a,i){this._logger=new et("OidcClient"),this.settings=a instanceof Sc?a:new Sc(a),this.metadataService=null!=i?i:new class{constructor(a){this._settings=a,this._logger=new et("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Ua(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}getMetadata(){var a=this;return H(function*(){const i=a._logger.create("getMetadata");if(a._metadata)return i.debug("using cached values"),a._metadata;if(!a._metadataUrl)throw i.throw(new Error("No authority or metadataUrl configured on settings")),null;i.debug("getting metadata from",a._metadataUrl);const o=yield a._jsonService.getJson(a._metadataUrl,{credentials:a._fetchRequestCredentials});return i.debug("merging remote JSON with seed metadata"),a._metadata=Object.assign({},a._settings.metadataSeed,o),a._metadata})()}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(a=!0){return this._getMetadataProperty("token_endpoint",a)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(a=!0){return this._getMetadataProperty("revocation_endpoint",a)}getKeysEndpoint(a=!0){return this._getMetadataProperty("jwks_uri",a)}_getMetadataProperty(a,i=!1){var o=this;return H(function*(){const u=o._logger.create(`_getMetadataProperty('${a}')`),h=yield o.getMetadata();if(u.debug("resolved"),void 0===h[a]){if(!0===i)return void u.warn("Metadata does not contain optional property");u.throw(new Error("Metadata does not contain property "+a))}return h[a]})()}getSigningKeys(){var a=this;return H(function*(){const i=a._logger.create("getSigningKeys");if(a._signingKeys)return i.debug("returning signingKeys from cache"),a._signingKeys;const o=yield a.getKeysEndpoint(!1);i.debug("got jwks_uri",o);const u=yield a._jsonService.getJson(o);if(i.debug("got key set",u),!Array.isArray(u.keys))throw i.throw(new Error("Missing keys on keyset")),null;return a._signingKeys=u.keys,a._signingKeys})()}}(this.settings),this._claimsService=new class{constructor(a){this._settings=a,this._logger=new et("ClaimsService")}filterProtocolClaims(a){const i=dn({},a);if(this._settings.filterProtocolClaims){let o;o=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:Uf;for(const u of o)lg.includes(u)||delete i[u]}return i}mergeClaims(a,i){const o=dn({},a);for(const[u,h]of Object.entries(i))for(const w of Array.isArray(h)?h:[h]){const T=o[u];void 0===T?o[u]=w:Array.isArray(T)?T.includes(w)||T.push(w):o[u]!==w&&(o[u]="object"==typeof w&&this._settings.mergeClaims?this.mergeClaims(T,w):[T,w])}return o}}(this.settings),this._validator=new class{constructor(a,i,o){this._settings=a,this._metadataService=i,this._claimsService=o,this._logger=new et("ResponseValidator"),this._userInfoService=new class{constructor(a,i){var o=this;this._settings=a,this._metadataService=i,this._logger=new et("UserInfoService"),this._getClaimsFromJwt=function(){var u=H(function*(h){const w=o._logger.create("_getClaimsFromJwt");try{const T=bc.decode(h);return w.debug("JWT decoding successful"),T}catch(T){throw w.error("Error parsing JWT response"),T}});return function(h){return u.apply(this,arguments)}}(),this._jsonService=new Ua(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}getClaims(a){var i=this;return H(function*(){const o=i._logger.create("getClaims");a||i._logger.throw(new Error("No token passed"));const u=yield i._metadataService.getUserInfoEndpoint();o.debug("got userinfo url",u);const h=yield i._jsonService.getJson(u,{token:a,credentials:i._settings.fetchRequestCredentials});return o.debug("got claims",h),h})()}}(this._settings,this._metadataService),this._tokenClient=new eu(this._settings,this._metadataService)}validateSigninResponse(a,i){var o=this;return H(function*(){const u=o._logger.create("validateSigninResponse");o._processSigninState(a,i),u.debug("state processed"),yield o._processCode(a,i),u.debug("code processed"),a.isOpenId&&o._validateIdTokenAttributes(a),u.debug("tokens validated"),yield o._processClaims(a,null==i?void 0:i.skipUserInfo,a.isOpenId),u.debug("claims processed")})()}validateCredentialsResponse(a,i){var o=this;return H(function*(){const u=o._logger.create("validateCredentialsResponse");a.isOpenId&&!!a.id_token&&o._validateIdTokenAttributes(a),u.debug("tokens validated"),yield o._processClaims(a,i,a.isOpenId),u.debug("claims processed")})()}validateRefreshResponse(a,i){var o=this;return H(function*(){const w=o._logger.create("validateRefreshResponse");a.userState=i.data,null!=a.session_state||(a.session_state=i.session_state),null!=a.scope||(a.scope=i.scope),a.isOpenId&&!!a.id_token&&(o._validateIdTokenAttributes(a,i.id_token),w.debug("ID Token validated")),a.id_token||(a.id_token=i.id_token,a.profile=i.profile);const T=a.isOpenId&&!!a.id_token;yield o._processClaims(a,!1,T),w.debug("claims processed")})()}validateSignoutResponse(a,i){const o=this._logger.create("validateSignoutResponse");if(i.id!==a.state&&o.throw(new Error("State does not match")),o.debug("state validated"),a.userState=i.data,a.error)throw o.warn("Response was error",a.error),new Yi(a)}_processSigninState(a,i){const u=this._logger.create("_processSigninState");if(i.id!==a.state&&u.throw(new Error("State does not match")),i.client_id||u.throw(new Error("No client_id on state")),i.authority||u.throw(new Error("No authority on state")),this._settings.authority!==i.authority&&u.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==i.client_id&&u.throw(new Error("client_id mismatch on settings vs. signin state")),u.debug("state validated"),a.userState=i.data,a.url_state=i.url_state,null!=a.scope||(a.scope=i.scope),a.error)throw u.warn("Response was error",a.error),new Yi(a);i.code_verifier&&!a.code&&u.throw(new Error("Expected code in response"))}_processClaims(a,i=!1,o=!0){var u=this;return H(function*(){const h=u._logger.create("_processClaims");if(a.profile=u._claimsService.filterProtocolClaims(a.profile),i||!u._settings.loadUserInfo||!a.access_token)return void h.debug("not loading user info");h.debug("loading user info");const w=yield u._userInfoService.getClaims(a.access_token);h.debug("user info claims received from user info endpoint"),o&&w.sub!==a.profile.sub&&h.throw(new Error("subject from UserInfo response does not match subject in ID Token")),a.profile=u._claimsService.mergeClaims(a.profile,u._claimsService.filterProtocolClaims(w)),h.debug("user info claims received, updated profile:",a.profile)})()}_processCode(a,i){var o=this;return H(function*(){const u=o._logger.create("_processCode");if(a.code){u.debug("Validating code");const h=yield o._tokenClient.exchangeCode(dn({client_id:i.client_id,client_secret:i.client_secret,code:a.code,redirect_uri:i.redirect_uri,code_verifier:i.code_verifier},i.extraTokenParams));Object.assign(a,h)}else u.debug("No code to process")})()}_validateIdTokenAttributes(a,i){var o;const u=this._logger.create("_validateIdTokenAttributes");u.debug("decoding ID Token JWT");const h=bc.decode(null!=(o=a.id_token)?o:"");if(h.sub||u.throw(new Error("ID Token is missing a subject claim")),i){const w=bc.decode(i);h.sub!==w.sub&&u.throw(new Error("sub in id_token does not match current sub")),h.auth_time&&h.auth_time!==w.auth_time&&u.throw(new Error("auth_time in id_token does not match original auth_time")),h.azp&&h.azp!==w.azp&&u.throw(new Error("azp in id_token does not match original azp")),!h.azp&&w.azp&&u.throw(new Error("azp not in id_token, but present in original id_token"))}a.profile=h}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new eu(this.settings,this.metadataService)}createSigninRequest({state:a,request:i,request_uri:o,request_type:u,id_token_hint:h,login_hint:w,skipUserInfo:T,nonce:P,url_state:F,response_type:j=this.settings.response_type,scope:J=this.settings.scope,redirect_uri:Ee=this.settings.redirect_uri,prompt:Re=this.settings.prompt,display:Fe=this.settings.display,max_age:ke=this.settings.max_age,ui_locales:Ct=this.settings.ui_locales,acr_values:Mt=this.settings.acr_values,resource:xt=this.settings.resource,response_mode:jn=this.settings.response_mode,extraQueryParams:Cn=this.settings.extraQueryParams,extraTokenParams:Rt=this.settings.extraTokenParams}){var Qt=this;return H(function*(){const Ai=Qt._logger.create("createSigninRequest");if("code"!==j)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const wt=yield Qt.metadataService.getAuthorizationEndpoint();Ai.debug("Received authorization endpoint",wt);const Bt=new class{constructor(jn){var Cn=jn,{url:a,authority:i,client_id:o,redirect_uri:u,response_type:h,scope:w,state_data:T,response_mode:P,request_type:F,client_secret:j,nonce:J,url_state:Ee,resource:Re,skipUserInfo:Fe,extraQueryParams:ke,extraTokenParams:Ct,disablePKCE:Mt}=Cn,xt=Lr(Cn,["url","authority","client_id","redirect_uri","response_type","scope","state_data","response_mode","request_type","client_secret","nonce","url_state","resource","skipUserInfo","extraQueryParams","extraTokenParams","disablePKCE"]);if(this._logger=new et("SigninRequest"),!a)throw this._logger.error("ctor: No url passed"),new Error("url");if(!o)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!u)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!h)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!w)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!i)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new Tc({data:T,request_type:F,url_state:Ee,code_verifier:!Mt,client_id:o,authority:i,redirect_uri:u,response_mode:P,client_secret:j,scope:w,extraTokenParams:Ct,skipUserInfo:Fe});const Rt=new URL(a);Rt.searchParams.append("client_id",o),Rt.searchParams.append("redirect_uri",u),Rt.searchParams.append("response_type",h),Rt.searchParams.append("scope",w),J&&Rt.searchParams.append("nonce",J);let Qt=this.state.id;Ee&&(Qt=`${Qt};${Ee}`),Rt.searchParams.append("state",Qt),this.state.code_challenge&&(Rt.searchParams.append("code_challenge",this.state.code_challenge),Rt.searchParams.append("code_challenge_method","S256")),Re&&(Array.isArray(Re)?Re:[Re]).forEach(wt=>Rt.searchParams.append("resource",wt));for(const[Ai,wt]of Object.entries(dn(dn({response_mode:P},xt),ke)))null!=wt&&Rt.searchParams.append(Ai,wt.toString());this.url=Rt.href}}({url:wt,authority:Qt.settings.authority,client_id:Qt.settings.client_id,redirect_uri:Ee,response_type:j,scope:J,state_data:a,url_state:F,prompt:Re,display:Fe,max_age:ke,ui_locales:Ct,id_token_hint:h,login_hint:w,acr_values:Mt,resource:xt,request:i,request_uri:o,extraQueryParams:Cn,extraTokenParams:Rt,request_type:u,response_mode:jn,client_secret:Qt.settings.client_secret,skipUserInfo:T,nonce:P,disablePKCE:Qt.settings.disablePKCE});yield Qt.clearStaleState();const kr=Bt.state;return yield Qt.settings.stateStore.set(kr.id,kr.toStorageString()),Bt})()}readSigninResponseState(a,i=!1){var o=this;return H(function*(){const u=o._logger.create("readSigninResponseState"),h=new tu(Zl.readParams(a,o.settings.response_mode));if(!h.state)throw u.throw(new Error("No state in response")),null;const w=yield o.settings.stateStore[i?"remove":"get"](h.state);if(!w)throw u.throw(new Error("No matching state found in storage")),null;return{state:Tc.fromStorageString(w),response:h}})()}processSigninResponse(a){var i=this;return H(function*(){const o=i._logger.create("processSigninResponse"),{state:u,response:h}=yield i.readSigninResponseState(a,!0);return o.debug("received state from storage; validating response"),yield i._validator.validateSigninResponse(h,u),h})()}processResourceOwnerPasswordCredentials({username:a,password:i,skipUserInfo:o=!1,extraTokenParams:u={}}){var h=this;return H(function*(){const w=yield h._tokenClient.exchangeCredentials(dn({username:a,password:i},u)),T=new tu(new URLSearchParams);return Object.assign(T,w),yield h._validator.validateCredentialsResponse(T,o),T})()}useRefreshToken({state:a,timeoutInSeconds:i}){var o=this;return H(function*(){var u;const h=o._logger.create("useRefreshToken");let w;if(void 0===o.settings.refreshTokenAllowedScope)w=a.scope;else{const F=o.settings.refreshTokenAllowedScope.split(" ");w=((null==(u=a.scope)?void 0:u.split(" "))||[]).filter(J=>F.includes(J)).join(" ")}const T=yield o._tokenClient.exchangeRefreshToken({refresh_token:a.refresh_token,resource:a.resource,scope:w,timeoutInSeconds:i}),P=new tu(new URLSearchParams);return Object.assign(P,T),h.debug("validating response",P),yield o._validator.validateRefreshResponse(P,Tp(dn({},a),{scope:w})),P})()}createSignoutRequest({state:a,id_token_hint:i,client_id:o,request_type:u,post_logout_redirect_uri:h=this.settings.post_logout_redirect_uri,extraQueryParams:w=this.settings.extraQueryParams}={}){var T=this;return H(function*(){const P=T._logger.create("createSignoutRequest"),F=yield T.metadataService.getEndSessionEndpoint();if(!F)throw P.throw(new Error("No end session endpoint")),null;P.debug("Received end session endpoint",F),!o&&h&&!i&&(o=T.settings.client_id);const j=new class{constructor({url:a,state_data:i,id_token_hint:o,post_logout_redirect_uri:u,extraQueryParams:h,request_type:w,client_id:T}){if(this._logger=new et("SignoutRequest"),!a)throw this._logger.error("ctor: No url passed"),new Error("url");const P=new URL(a);o&&P.searchParams.append("id_token_hint",o),T&&P.searchParams.append("client_id",T),u&&(P.searchParams.append("post_logout_redirect_uri",u),i&&(this.state=new Ro({data:i,request_type:w}),P.searchParams.append("state",this.state.id)));for(const[F,j]of Object.entries(dn({},h)))null!=j&&P.searchParams.append(F,j.toString());this.url=P.href}}({url:F,id_token_hint:i,client_id:o,post_logout_redirect_uri:h,state_data:a,extraQueryParams:w,request_type:u});yield T.clearStaleState();const J=j.state;return J&&(P.debug("Signout request has state to persist"),yield T.settings.stateStore.set(J.id,J.toStorageString())),j})()}readSignoutResponseState(a,i=!1){var o=this;return H(function*(){const u=o._logger.create("readSignoutResponseState"),h=new class{constructor(a){this.state=a.get("state"),this.error=a.get("error"),this.error_description=a.get("error_description"),this.error_uri=a.get("error_uri")}}(Zl.readParams(a,o.settings.response_mode));if(!h.state){if(u.debug("No state in response"),h.error)throw u.warn("Response was error:",h.error),new Yi(h);return{state:void 0,response:h}}const w=yield o.settings.stateStore[i?"remove":"get"](h.state);if(!w)throw u.throw(new Error("No matching state found in storage")),null;return{state:Ro.fromStorageString(w),response:h}})()}processSignoutResponse(a){var i=this;return H(function*(){const o=i._logger.create("processSignoutResponse"),{state:u,response:h}=yield i.readSignoutResponseState(a,!0);return u?(o.debug("Received state from storage; validating response"),i._validator.validateSignoutResponse(h,u)):o.debug("No state from storage; skipping response validation"),h})()}clearStaleState(){return this._logger.create("clearStaleState"),Ro.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}revokeToken(a,i){var o=this;return H(function*(){return o._logger.create("revokeToken"),yield o._tokenClient.revoke({token:a,token_type_hint:i})})()}}(a),this._redirectNavigator=null!=i?i:new class{constructor(a){this._settings=a,this._logger=new et("RedirectNavigator")}prepare({redirectMethod:a=this._settings.redirectMethod,redirectTarget:i=this._settings.redirectTarget}){var o=this;return H(function*(){var u;o._logger.create("prepare");let h=window.self;"top"===i&&(h=null!=(u=window.top)?u:window.self);const w=h.location[a].bind(h.location);let T;return{navigate:(P=H(function*(F){o._logger.create("navigate");const j=new Promise((J,Ee)=>{T=Ee});return w(F.url),yield j}),function(j){return P.apply(this,arguments)}),close:()=>{o._logger.create("close"),null==T||T(new Error("Redirect aborted")),h.stop()}};var P})()}callback(){return H(function*(){})()}}(this.settings),this._popupNavigator=null!=o?o:new class{constructor(a){this._settings=a,this._logger=new et("PopupNavigator")}prepare({popupWindowFeatures:a=this._settings.popupWindowFeatures,popupWindowTarget:i=this._settings.popupWindowTarget}){return H(function*(){return new $f({popupWindowFeatures:a,popupWindowTarget:i})})()}callback(a,{keepOpen:i=!1}){var o=this;return H(function*(){o._logger.create("callback"),$f.notifyOpener(a,i)})()}}(this.settings),this._iframeNavigator=null!=u?u:new class{constructor(a){this._settings=a,this._logger=new et("IFrameNavigator")}prepare({silentRequestTimeoutInSeconds:a=this._settings.silentRequestTimeoutInSeconds}){return H(function*(){return new Ha({silentRequestTimeoutInSeconds:a})})()}callback(a){var i=this;return H(function*(){i._logger.create("callback"),Ha.notifyParent(a,i._settings.iframeNotifyParentOrigin)})()}}(this.settings),this._events=new class extends class{constructor(a){this._logger=new et("AccessTokenEvents"),this._expiringTimer=new Vn("Access token expiring"),this._expiredTimer=new Vn("Access token expired"),this._expiringNotificationTimeInSeconds=a.expiringNotificationTimeInSeconds}load(a){const i=this._logger.create("load");if(a.access_token&&void 0!==a.expires_in){const o=a.expires_in;if(i.debug("access token present, remaining duration:",o),o>0){let h=o-this._expiringNotificationTimeInSeconds;h<=0&&(h=1),i.debug("registering expiring timer, raising in",h,"seconds"),this._expiringTimer.init(h)}else i.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const u=o+1;i.debug("registering expired timer, raising in",u,"seconds"),this._expiredTimer.init(u)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(a){return this._expiringTimer.addHandler(a)}removeAccessTokenExpiring(a){this._expiringTimer.removeHandler(a)}addAccessTokenExpired(a){return this._expiredTimer.addHandler(a)}removeAccessTokenExpired(a){this._expiredTimer.removeHandler(a)}}{constructor(a){super({expiringNotificationTimeInSeconds:a.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new et("UserManagerEvents"),this._userLoaded=new _i("User loaded"),this._userUnloaded=new _i("User unloaded"),this._silentRenewError=new _i("Silent renew error"),this._userSignedIn=new _i("User signed in"),this._userSignedOut=new _i("User signed out"),this._userSessionChanged=new _i("User session changed")}load(a,i=!0){super.load(a),i&&this._userLoaded.raise(a)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(a){return this._userLoaded.addHandler(a)}removeUserLoaded(a){return this._userLoaded.removeHandler(a)}addUserUnloaded(a){return this._userUnloaded.addHandler(a)}removeUserUnloaded(a){return this._userUnloaded.removeHandler(a)}addSilentRenewError(a){return this._silentRenewError.addHandler(a)}removeSilentRenewError(a){return this._silentRenewError.removeHandler(a)}_raiseSilentRenewError(a){this._silentRenewError.raise(a)}addUserSignedIn(a){return this._userSignedIn.addHandler(a)}removeUserSignedIn(a){this._userSignedIn.removeHandler(a)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(a){return this._userSignedOut.addHandler(a)}removeUserSignedOut(a){this._userSignedOut.removeHandler(a)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(a){return this._userSessionChanged.addHandler(a)}removeUserSessionChanged(a){this._userSessionChanged.removeHandler(a)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}}(this.settings),this._silentRenewService=new class{constructor(a){var i=this;this._userManager=a,this._logger=new et("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Vn("Retry Silent Renew"),this._tokenExpiring=H(function*(){const o=i._logger.create("_tokenExpiring");try{yield i._userManager.signinSilent(),o.debug("silent token renewal successful")}catch(u){if(u instanceof Va)return o.warn("ErrorTimeout from signinSilent:",u,"retry in 5s"),void i._retryTimer.init(5);o.error("Error from signinSilent:",u),i._userManager.events._raiseSilentRenewError(u)}})}start(){var a=this;return H(function*(){const i=a._logger.create("start");if(!a._isStarted){a._isStarted=!0,a._userManager.events.addAccessTokenExpiring(a._tokenExpiring),a._retryTimer.addHandler(a._tokenExpiring);try{yield a._userManager.getUser()}catch(o){i.error("getUser error",o)}}})()}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(a){var i=this;this._userManager=a,this._logger=new et("SessionMonitor"),this._start=function(){var o=H(function*(u){const h=u.session_state;if(!h)return;const w=i._logger.create("_start");if(u.profile?(i._sub=u.profile.sub,i._sid=u.profile.sid,w.debug("session_state",h,", sub",i._sub)):(i._sub=void 0,i._sid=void 0,w.debug("session_state",h,", anonymous user")),i._checkSessionIFrame)i._checkSessionIFrame.start(h);else try{const T=yield i._userManager.metadataService.getCheckSessionIframe();if(T){w.debug("initializing check session iframe");const P=i._userManager.settings.client_id,F=i._userManager.settings.checkSessionIntervalInSeconds,j=i._userManager.settings.stopCheckSessionOnError,J=new class{constructor(a,i,o,u,h){this._callback=a,this._client_id=i,this._intervalInSeconds=u,this._stopOnError=h,this._logger=new et("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=T=>{T.origin===this._frame_origin&&T.source===this._frame.contentWindow&&("error"===T.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===T.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(T.data+" message from check session op iframe"))};const w=new URL(o);this._frame_origin=w.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=w.href}load(){return new Promise(a=>{this._frame.onload=()=>{a()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(a){if(this._session_state===a)return;this._logger.create("start"),this.stop(),this._session_state=a;const i=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};i(),this._timer=setInterval(i,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(i._callback,P,T,F,j);yield J.load(),i._checkSessionIFrame=J,J.start(h)}else w.warn("no check session iframe found in the metadata")}catch(T){w.error("Error from getCheckSessionIframe:",T instanceof Error?T.message:T)}});return function(u){return o.apply(this,arguments)}}(),this._stop=()=>{const o=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const u=setInterval(H(function*(){clearInterval(u);try{const h=yield i._userManager.querySessionStatus();h&&i._start({session_state:h.session_state,profile:h.sub&&h.sid?{sub:h.sub,sid:h.sid}:null})}catch(h){o.error("error from querySessionStatus",h instanceof Error?h.message:h)}}),1e3)}},this._callback=H(function*(){const o=i._logger.create("_callback");try{const u=yield i._userManager.querySessionStatus();let h=!0;u&&i._checkSessionIFrame?u.sub===i._sub?(h=!1,i._checkSessionIFrame.start(u.session_state),u.sid===i._sid?o.debug("same sub still logged in at OP, restarting check session iframe; session_state",u.session_state):(o.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",u.session_state),i._userManager.events._raiseUserSessionChanged())):o.debug("different subject signed into OP",u.sub):o.debug("subject no longer signed into OP"),h?i._sub?i._userManager.events._raiseUserSignedOut():i._userManager.events._raiseUserSignedIn():o.debug("no change in session detected, no event to raise")}catch(u){i._sub&&(o.debug("Error calling queryCurrentSigninSession; raising signed out event",u),i._userManager.events._raiseUserSignedOut())}}),a||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(o=>{this._logger.error(o)})}_init(){var a=this;return H(function*(){a._logger.create("_init");const i=yield a._userManager.getUser();if(i)a._start(i);else if(a._userManager.settings.monitorAnonymousSession){const o=yield a._userManager.querySessionStatus();o&&a._start({session_state:o.session_state,profile:o.sub&&o.sid?{sub:o.sub,sid:o.sid}:null})}})()}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}getUser(){var a=this;return H(function*(){const i=a._logger.create("getUser"),o=yield a._loadUser();return o?(i.info("user loaded"),a._events.load(o,!1),o):(i.info("user not found in storage"),null)})()}removeUser(){var a=this;return H(function*(){const i=a._logger.create("removeUser");yield a.storeUser(null),i.info("user removed from storage"),a._events.unload()})()}signinRedirect(a={}){var i=this;return H(function*(){i._logger.create("signinRedirect");const w=a,{redirectMethod:o}=w,u=Lr(w,["redirectMethod"]),h=yield i._redirectNavigator.prepare({redirectMethod:o});yield i._signinStart(dn({request_type:"si:r"},u),h)})()}signinRedirectCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signinRedirectCallback"),u=yield i._signinEnd(a);return u.profile&&u.profile.sub?o.info("success, signed in subject",u.profile.sub):o.info("no subject"),u})()}signinResourceOwnerCredentials({username:a,password:i,skipUserInfo:o=!1}){var u=this;return H(function*(){const h=u._logger.create("signinResourceOwnerCredential"),w=yield u._client.processResourceOwnerPasswordCredentials({username:a,password:i,skipUserInfo:o,extraTokenParams:u.settings.extraTokenParams});h.debug("got signin response");const T=yield u._buildUser(w);return T.profile&&T.profile.sub?h.info("success, signed in subject",T.profile.sub):h.info("no subject"),T})()}signinPopup(a={}){var i=this;return H(function*(){const o=i._logger.create("signinPopup"),j=a,{popupWindowFeatures:u,popupWindowTarget:h}=j,w=Lr(j,["popupWindowFeatures","popupWindowTarget"]),T=i.settings.popup_redirect_uri;T||o.throw(new Error("No popup_redirect_uri configured"));const P=yield i._popupNavigator.prepare({popupWindowFeatures:u,popupWindowTarget:h}),F=yield i._signin(dn({request_type:"si:p",redirect_uri:T,display:"popup"},w),P);return F&&(F.profile&&F.profile.sub?o.info("success, signed in subject",F.profile.sub):o.info("no subject")),F})()}signinPopupCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const u=o._logger.create("signinPopupCallback");yield o._popupNavigator.callback(a,{keepOpen:i}),u.info("success")})()}signinSilent(a={}){var i=this;return H(function*(){var o;const u=i._logger.create("signinSilent"),Ee=a,{silentRequestTimeoutInSeconds:h,resource:w}=Ee,T=Lr(Ee,["silentRequestTimeoutInSeconds","resource"]);let P=yield i._loadUser();if(null==P?void 0:P.refresh_token){u.debug("using refresh token");const Re=new class{constructor(a,i){this.refresh_token=a.refresh_token,this.id_token=a.id_token,this.session_state=a.session_state,this.scope=a.scope,this.profile=a.profile,this.resource=i,this.data=a.state}}(P,w);return yield i._useRefreshToken(Re)}const F=i.settings.silent_redirect_uri;let j;F||u.throw(new Error("No silent_redirect_uri configured")),P&&i.settings.validateSubOnSilentRenew&&(u.debug("subject prior to silent renew:",P.profile.sub),j=P.profile.sub);const J=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:h});return P=yield i._signin(dn({request_type:"si:s",redirect_uri:F,prompt:"none",id_token_hint:i.settings.includeIdTokenInSilentRenew?null==P?void 0:P.id_token:void 0},T),J,j),P&&((null==(o=P.profile)?void 0:o.sub)?u.info("success, signed in subject",P.profile.sub):u.info("no subject")),P})()}_useRefreshToken(a){var i=this;return H(function*(){const o=yield i._client.useRefreshToken({state:a,timeoutInSeconds:i.settings.silentRequestTimeoutInSeconds}),u=new ja(dn(dn({},a),o));return yield i.storeUser(u),i._events.load(u),u})()}signinSilentCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signinSilentCallback");yield i._iframeNavigator.callback(a),o.info("success")})()}signinCallback(a=window.location.href){var i=this;return H(function*(){const{state:o}=yield i._client.readSigninResponseState(a);switch(o.request_type){case"si:r":return yield i.signinRedirectCallback(a);case"si:p":return yield i.signinPopupCallback(a);case"si:s":return yield i.signinSilentCallback(a);default:throw new Error("invalid response_type in state")}})()}signoutCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const{state:u}=yield o._client.readSignoutResponseState(a);if(u)switch(u.request_type){case"so:r":yield o.signoutRedirectCallback(a);break;case"so:p":yield o.signoutPopupCallback(a,i);break;case"so:s":yield o.signoutSilentCallback(a);break;default:throw new Error("invalid response_type in state")}})()}querySessionStatus(a={}){var i=this;return H(function*(){const o=i._logger.create("querySessionStatus"),j=a,{silentRequestTimeoutInSeconds:u}=j,h=Lr(j,["silentRequestTimeoutInSeconds"]),w=i.settings.silent_redirect_uri;w||o.throw(new Error("No silent_redirect_uri configured"));const T=yield i._loadUser(),P=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:u}),F=yield i._signinStart(dn({request_type:"si:s",redirect_uri:w,prompt:"none",id_token_hint:i.settings.includeIdTokenInSilentRenew?null==T?void 0:T.id_token:void 0,response_type:i.settings.query_status_response_type,scope:"openid",skipUserInfo:!0},h),P);try{const J=yield i._client.processSigninResponse(F.url);return o.debug("got signin response"),J.session_state&&J.profile.sub?(o.info("success for subject",J.profile.sub),{session_state:J.session_state,sub:J.profile.sub,sid:J.profile.sid}):(o.info("success, user not authenticated"),null)}catch(J){if(i.settings.monitorAnonymousSession&&J instanceof Yi)switch(J.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return o.info("success for anonymous user"),{session_state:J.session_state}}throw J}})()}_signin(a,i,o){var u=this;return H(function*(){const h=yield u._signinStart(a,i);return yield u._signinEnd(h.url,o)})()}_signinStart(a,i){var o=this;return H(function*(){const u=o._logger.create("_signinStart");try{const h=yield o._client.createSigninRequest(a);return u.debug("got signin request"),yield i.navigate({url:h.url,state:h.state.id,response_mode:h.state.response_mode,scriptOrigin:o.settings.iframeScriptOrigin})}catch(h){throw u.debug("error after preparing navigator, closing navigator window"),i.close(),h}})()}_signinEnd(a,i){var o=this;return H(function*(){const u=o._logger.create("_signinEnd"),h=yield o._client.processSigninResponse(a);return u.debug("got signin response"),yield o._buildUser(h,i)})()}_buildUser(a,i){var o=this;return H(function*(){const u=o._logger.create("_buildUser"),h=new ja(a);if(i){if(i!==h.profile.sub)throw u.debug("current user does not match user returned from signin. sub from signin:",h.profile.sub),new Yi(Tp(dn({},a),{error:"login_required"}));u.debug("current user matches user returned from signin")}return yield o.storeUser(h),u.debug("user stored"),o._events.load(h),h})()}signoutRedirect(a={}){var i=this;return H(function*(){const o=i._logger.create("signoutRedirect"),T=a,{redirectMethod:u}=T,h=Lr(T,["redirectMethod"]),w=yield i._redirectNavigator.prepare({redirectMethod:u});yield i._signoutStart(dn({request_type:"so:r",post_logout_redirect_uri:i.settings.post_logout_redirect_uri},h),w),o.info("success")})()}signoutRedirectCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signoutRedirectCallback"),u=yield i._signoutEnd(a);return o.info("success"),u})()}signoutPopup(a={}){var i=this;return H(function*(){const o=i._logger.create("signoutPopup"),F=a,{popupWindowFeatures:u,popupWindowTarget:h}=F,w=Lr(F,["popupWindowFeatures","popupWindowTarget"]),T=i.settings.popup_post_logout_redirect_uri,P=yield i._popupNavigator.prepare({popupWindowFeatures:u,popupWindowTarget:h});yield i._signout(dn({request_type:"so:p",post_logout_redirect_uri:T,state:null==T?void 0:{}},w),P),o.info("success")})()}signoutPopupCallback(a=window.location.href,i=!1){var o=this;return H(function*(){const u=o._logger.create("signoutPopupCallback");yield o._popupNavigator.callback(a,{keepOpen:i}),u.info("success")})()}_signout(a,i){var o=this;return H(function*(){const u=yield o._signoutStart(a,i);return yield o._signoutEnd(u.url)})()}_signoutStart(a={},i){var o=this;return H(function*(){var u;const h=o._logger.create("_signoutStart");try{const w=yield o._loadUser();h.debug("loaded current user from storage"),o.settings.revokeTokensOnSignout&&(yield o._revokeInternal(w));const T=a.id_token_hint||w&&w.id_token;T&&(h.debug("setting id_token_hint in signout request"),a.id_token_hint=T),yield o.removeUser(),h.debug("user removed, creating signout request");const P=yield o._client.createSignoutRequest(a);return h.debug("got signout request"),yield i.navigate({url:P.url,state:null==(u=P.state)?void 0:u.id,scriptOrigin:o.settings.iframeScriptOrigin})}catch(w){throw h.debug("error after preparing navigator, closing navigator window"),i.close(),w}})()}_signoutEnd(a){var i=this;return H(function*(){const o=i._logger.create("_signoutEnd"),u=yield i._client.processSignoutResponse(a);return o.debug("got signout response"),u})()}signoutSilent(a={}){var i=this;return H(function*(){var o;const u=i._logger.create("signoutSilent"),j=a,{silentRequestTimeoutInSeconds:h}=j,w=Lr(j,["silentRequestTimeoutInSeconds"]),T=i.settings.includeIdTokenInSilentSignout?null==(o=yield i._loadUser())?void 0:o.id_token:void 0,P=i.settings.popup_post_logout_redirect_uri,F=yield i._iframeNavigator.prepare({silentRequestTimeoutInSeconds:h});yield i._signout(dn({request_type:"so:s",post_logout_redirect_uri:P,id_token_hint:T},w),F),u.info("success")})()}signoutSilentCallback(a=window.location.href){var i=this;return H(function*(){const o=i._logger.create("signoutSilentCallback");yield i._iframeNavigator.callback(a),o.info("success")})()}revokeTokens(a){var i=this;return H(function*(){const o=yield i._loadUser();yield i._revokeInternal(o,a)})()}_revokeInternal(a,i=this.settings.revokeTokenTypes){var o=this;return H(function*(){const u=o._logger.create("_revokeInternal");if(!a)return;const h=i.filter(w=>"string"==typeof a[w]);if(h.length){for(const w of h)yield o._client.revokeToken(a[w],w),u.info(`${w} revoked successfully`),"access_token"!==w&&(a[w]=null);yield o.storeUser(a),u.debug("user stored"),o._events.load(a)}else u.debug("no need to revoke due to no token(s)")})()}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}_loadUser(){var a=this;return H(function*(){const i=a._logger.create("_loadUser"),o=yield a.settings.userStore.get(a._userStoreKey);return o?(i.debug("user storageString loaded"),ja.fromStorageString(o)):(i.debug("no user storageString"),null)})()}storeUser(a){var i=this;return H(function*(){const o=i._logger.create("storeUser");if(a){o.debug("storing user");const u=a.toStorageString();yield i.settings.userStore.set(i._userStoreKey,u)}else i._logger.debug("removing user"),yield i.settings.userStore.remove(i._userStoreKey)})()}clearStaleState(){var a=this;return H(function*(){yield a._client.clearStaleState()})()}}{constructor(i){super(Object.assign({authority:i.authorityUrl,client_id:i.clientId,scope:i.scope,loadUserInfo:i.loadUserInfo,automaticSilentRenew:i.automaticSilentRenew},i.internal)),this.libSettings=i,this._mobileNavigator=new gg}signoutMobile(i={}){var o=this;return H(function*(){var u,h,w,T;const P=o._logger.create("signout"),{mobileWindowToolbarColor:F,mobileWindowPresentationStyle:j,mobileWindowWidth:J,mobileWindowHeight:Ee}=i,Re=(0,Pc._T)(i,["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"]),Fe={mobileWindowToolbarColor:null!=F?F:null===(u=o.libSettings.internal)||void 0===u?void 0:u.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=j?j:null===(h=o.libSettings.internal)||void 0===h?void 0:h.mobileWindowPresentationStyle,mobileWindowWidth:null!=J?J:null===(w=o.libSettings.internal)||void 0===w?void 0:w.mobileWindowWidth,mobileWindowHeight:null!=Ee?Ee:null===(T=o.libSettings.internal)||void 0===T?void 0:T.mobileWindowHeight},ke=o._mobileNavigator.prepare(o.settings.post_logout_redirect_uri,Fe);try{yield o._signout(Object.assign({request_type:"so:m",post_logout_redirect_uri:o.settings.post_logout_redirect_uri},Re),ke),P.info("success")}catch(Ct){P.error(Ct)}})()}signinMobile(i={}){var o=this;return H(function*(){var u,h,w,T,P;const F=o._logger.create("signin"),{mobileWindowToolbarColor:j,mobileWindowPresentationStyle:J,mobileWindowWidth:Ee,mobileWindowHeight:Re}=i,Fe=(0,Pc._T)(i,["mobileWindowToolbarColor","mobileWindowPresentationStyle","mobileWindowWidth","mobileWindowHeight"]),ke={mobileWindowToolbarColor:null!=j?j:null===(u=o.libSettings.internal)||void 0===u?void 0:u.mobileWindowToolbarColor,mobileWindowPresentationStyle:null!=J?J:null===(h=o.libSettings.internal)||void 0===h?void 0:h.mobileWindowPresentationStyle,mobileWindowWidth:null!=Ee?Ee:null===(w=o.libSettings.internal)||void 0===w?void 0:w.mobileWindowWidth,mobileWindowHeight:null!=Re?Re:null===(T=o.libSettings.internal)||void 0===T?void 0:T.mobileWindowHeight},Ct=o._mobileNavigator.prepare(o.settings.redirect_uri,ke);try{const Mt=yield o._signin(Object.assign({request_type:"si:m",redirect_uri:o.settings.redirect_uri},Fe),Ct);(null===(P=null==Mt?void 0:Mt.profile)||void 0===P?void 0:P.sub)?F.info("success, signed in subject",Mt.profile.sub):F.info("no subject")}catch(Mt){F.error(Mt)}})()}}const Zs="auth-js:oidc_manager:redirect_url",Or={loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!1,automaticSilentRenew:!0,desktopNavigationType:Xt.REDIRECT,scope:"openid profile email phone",logLevel:xn.NONE,internal:{response_type:"code",redirect_uri:"?oidc-callback=login",post_logout_redirect_uri:"?oidc-callback=logout",popup_redirect_uri:"oidc/callback/popup_redirect.html",popup_post_logout_redirect_uri:"oidc/callback/popup_redirect.html",silent_redirect_uri:"oidc/callback/silent_redirect.html",mobileWindowPresentationStyle:"popover"}};class Vc extends class{}{constructor(){super(...arguments),this.idTokenSubs=new ls,this.accessTokenSubs=new ls,this.userProfileSubs=new ls,this.userSessionSubs=new ls,this.authenticatedSubs=new ls,this.renewingSubs=new ls,this.redirectSubs=new ls,this.userManagerSubs=[],this._isAuthenticated=!1,this._isRenewing=!1,this.settings=Or}set user(i){this._user!==i&&(this._user=i,this._idToken=i?i.id_token:void 0,this._accessToken=i?i.access_token:void 0,this._userProfile=(null==i?void 0:i.profile)?i.profile:void 0,this._userSession=i?Po.deserialize(i):void 0,this._isAuthenticated=!(!i||i.expired),this.idTokenSubs.notify(this._idToken),this.accessTokenSubs.notify(this._accessToken),this.userProfileSubs.notify(this._userProfile),this.userSessionSubs.notify(this._userSession),this.authenticatedSubs.notify(this._isAuthenticated))}init(i){var o=this;return H(function*(){var u,h,w,T,P,F,j,J,Ee,Re;xn.setLevel(null!==(h=null!==(u=i.logLevel)&&void 0!==u?u:Or.logLevel)&&void 0!==h?h:xn.NONE),xn.setLogger(console);const Fe=Nt.isNativeMobile(),ke=Fe?`${i.mobileScheme}://localhost/`:Nt.getBaseUrl();if(o.settings=Ks({},Or,{internal:{userStore:new Ec({store:Fe?new fg:new xo}),redirect_uri:`${ke}${null===(w=Or.internal)||void 0===w?void 0:w.redirect_uri}`,post_logout_redirect_uri:`${ke}${null===(T=Or.internal)||void 0===T?void 0:T.post_logout_redirect_uri}`,popup_redirect_uri:`${ke}${null===(P=Or.internal)||void 0===P?void 0:P.popup_redirect_uri}`,popup_post_logout_redirect_uri:`${ke}${null===(F=Or.internal)||void 0===F?void 0:F.popup_post_logout_redirect_uri}`,silent_redirect_uri:`${ke}${null===(j=Or.internal)||void 0===j?void 0:j.silent_redirect_uri}`}},i),o.patchAuth0Logout(),o.userManager=new Cy(o.settings),o.userManagerSubs.push(o.userManager.events.addUserLoaded(Ct=>{o.user=Ct}),o.userManager.events.addUserUnloaded(()=>{o.user&&(o.user=null,o.settings.loginRequired&&location.reload())}),o.userManager.events.addSilentRenewError(H(function*(){yield o.removeUser()}))),o.assertNotInInceptionLoop(),Nt.isUrlMatching(location.href,null===(J=o.settings.internal)||void 0===J?void 0:J.redirect_uri))yield o.runSyncOrAsync(H(function*(){const Ct=sessionStorage.getItem(Zs);yield o.callSignin(()=>o.userManager.signinRedirectCallback(location.href),Ct),sessionStorage.removeItem(Zs)}));else if(Nt.isUrlMatching(location.href,null===(Ee=o.settings.internal)||void 0===Ee?void 0:Ee.post_logout_redirect_uri))yield o.runSyncOrAsync(H(function*(){const Ct=sessionStorage.getItem(Zs);yield o.callSignout(()=>o.userManager.signoutRedirectCallback(location.href),Ct),sessionStorage.removeItem(Zs)}));else if(o.settings.retrieveUserSession||o.settings.loginRequired){const Ct=function(){var xt=H(function*(){yield o.runSyncOrAsync(()=>o.signinSilent().catch(function(){var jn=H(function*(Cn){const{error:Rt,message:Qt}=Cn;if(o.settings.loginRequired&&((null==Rt?void 0:Rt.includes("_required"))||(null==Qt?void 0:Qt.includes("_required"))))yield o.login();else if(console.error("[OIDCAuthManager] User's session cannot be retrieved:",Cn.message),o.authenticatedSubs.notify(!1),o.settings.loginRequired)throw Cn});return function(Cn){return jn.apply(this,arguments)}}()))});return function(){return xt.apply(this,arguments)}}(),Mt=yield null===(Re=o.userManager)||void 0===Re?void 0:Re.getUser();!Mt||Mt.expired?!Fe&&o.settings.retrieveUserSession?yield Ct():o.settings.loginRequired?yield o.login():o.user=null:o.user=Mt}else o.user=null})()}logout(i){var o=this;return H(function*(){var u,h,w;const T=null!==(u=null==i?void 0:i.redirectUrl)&&void 0!==u?u:location.href;Nt.isNativeMobile()?yield o.callSignout(()=>o.userManager.signoutMobile(i),T):(null!==(h=null==i?void 0:i.desktopNavigationType)&&void 0!==h?h:o.settings.desktopNavigationType)===Xt.POPUP?yield o.callSignout(()=>o.userManager.signoutPopup(i),T):(sessionStorage.setItem(Zs,T),yield null===(w=o.userManager)||void 0===w?void 0:w.signoutRedirect(i))})()}login(i){var o=this;return H(function*(){var u,h,w;const T=null!==(u=null==i?void 0:i.redirectUrl)&&void 0!==u?u:location.href;return Nt.isNativeMobile()?yield o.callSignin(()=>o.userManager.signinMobile(i),T):(null!==(h=null==i?void 0:i.desktopNavigationType)&&void 0!==h?h:o.settings.desktopNavigationType)===Xt.POPUP?yield o.callSignin(()=>o.userManager.signinPopup(i),T):(sessionStorage.setItem(Zs,T),yield null===(w=o.userManager)||void 0===w?void 0:w.signinRedirect(i)),o._isAuthenticated})()}renew(i){var o=this;return H(function*(){return o.signinSilent(i).catch(u=>console.error(u))})()}getSettings(){return this.settings}isRenewing(){return this._isRenewing}isAuthenticated(){var i=this;return H(function*(){return yield i.waitForRenew("isAuthenticated()"),i._isAuthenticated})()}getUserProfile(){var i=this;return H(function*(){return yield i.waitForRenew("getUserProfile()"),i._userProfile})()}getUserSession(){var i=this;return H(function*(){return yield i.waitForRenew("getUserSession()"),i._userSession})()}getIdToken(){var i=this;return H(function*(){return yield i.waitForRenew("getIdToken()"),i._idToken})()}getIdTokenDecoded(){var i=this;return H(function*(){return yield i.waitForRenew("getIdTokenDecoded()"),Nt.decodeJwt(i._idToken)})()}getAccessToken(){var i=this;return H(function*(){return yield i.waitForRenew("getAccessToken()"),i._accessToken})()}getAccessTokenDecoded(){var i=this;return H(function*(){return yield i.waitForRenew("getAccessTokenDecoded()"),Nt.decodeJwt(i._accessToken)})()}destroy(){this.idTokenSubs.unsubscribe(),this.accessTokenSubs.unsubscribe(),this.userProfileSubs.unsubscribe(),this.userSessionSubs.unsubscribe(),this.authenticatedSubs.unsubscribe(),this.renewingSubs.unsubscribe(),this.redirectSubs.unsubscribe(),this.userManagerSubs.forEach(i=>i())}onIdTokenChanged(i){return this.idTokenSubs.add(i)}onAccessTokenChanged(i){return this.accessTokenSubs.add(i)}onUserProfileChanged(i){return this.userProfileSubs.add(i)}onUserSessionChanged(i){return this.userSessionSubs.add(i)}onAuthenticatedChanged(i){return this.authenticatedSubs.add(i)}onRenewingChanged(i){return this.renewingSubs.add(i)}onRedirect(i){return this.redirectSubs.add(i)}assertNotInInceptionLoop(){var i,o;[null===(i=this.settings.internal)||void 0===i?void 0:i.silent_redirect_uri,null===(o=this.settings.internal)||void 0===o?void 0:o.popup_redirect_uri].forEach(u=>{var h;const w=null===(h=new RegExp(/^.*\/(.*).html$/gm).exec(null!=u?u:""))||void 0===h?void 0:h[1],T=new Error(`[OIDCAuthManager] ${null!=u?u:"redirect uri"} was not found.`);if(T.stack=void 0,Nt.isUrlMatching(location.href,u))throw T.message+="\n\n\u24d8 This usually means you forgot to include the redirect html files in your application assets.",T;if(location.href.includes(`/${w}.html`))throw T.message+="\n\n\u24d8 This usually means your redirect urls are misconfigured.",T})}waitForRenew(i){var o=this;return H(function*(){const u=Date.now();for(;o._isRenewing;){if(Date.now()>u+5e3){console.warn("[@badisi/auth-js]",`\`${i}\``,"timed out waiting for renew to finish.");break}yield new Promise(h=>setTimeout(h,100))}})()}postLogoutVerification(i){const o=Nt.stringToURL(null!=i?i:"/");this.settings.loginRequired&&location.origin===o.origin&&location.reload()}notifyRenew(i){this._isRenewing=i,this.renewingSubs.notify(i)}runSyncOrAsync(i){var o=this;return H(function*(){o.settings.loginRequired?yield i():i()})()}redirect(i,o){var u=this;return H(function*(){o&&(console.error(o),yield u.removeUser());const h=Nt.stringToURL(null!=i?i:"/");location.origin===h.origin?(history.replaceState(history.state,"",h.href),u.redirectSubs.notify(h)):location.href=h.href})()}removeUser(){var i=this;return H(function*(){var o,u;i.user=null,yield Promise.all([null===(o=i.userManager)||void 0===o?void 0:o.clearStaleState(),null===(u=i.userManager)||void 0===u?void 0:u.removeUser()])})()}signinSilent(i){var o=this;return H(function*(){var u;o.notifyRenew(!0);try{yield null===(u=o.userManager)||void 0===u?void 0:u.signinSilent(i)}catch(h){throw yield o.removeUser(),h}finally{o.notifyRenew(!1)}})()}callSignin(i,o){var u=this;return H(function*(){try{u.notifyRenew(!0),yield i().catch(h=>{throw"Attempted to navigate on a disposed window"===(null==h?void 0:h.message)&&((h=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,h.message+="\n\n\u24d8 This may be due to an ad blocker."),h}),yield u.redirect(o)}catch(h){yield u.redirect("/",h)}finally{u.notifyRenew(!1)}})()}callSignout(i,o){var u=this;return H(function*(){try{yield i().catch(h=>{throw"Attempted to navigate on a disposed window"===(null==h?void 0:h.message)&&((h=new Error("[OIDCAuthManager] Attempted to navigate on a disposed window.")).stack=void 0,h.message+="\n\n\u24d8 This may be due to an ad blocker."),h}),yield u.redirect(o),yield u.removeUser()}catch(h){o="/",yield u.redirect(o,h)}finally{u.postLogoutVerification(o)}})()}patchAuth0Logout(){var i,o;if(this.settings.authorityUrl.endsWith("auth0.com")){const{authorityUrl:u,clientId:h,desktopNavigationType:w}=this.settings,T=w===Xt.POPUP?null===(i=this.settings.internal)||void 0===i?void 0:i.popup_post_logout_redirect_uri:null===(o=this.settings.internal)||void 0===o?void 0:o.post_logout_redirect_uri;this.settings.internal=Ks({},{metadataSeed:{end_session_endpoint:`${u}/v2/logout?client_id=${h}&returnTo=${T}`}},this.settings.internal)}}}var nn=O(8967);let yi=(()=>{class a{constructor(o,u,h){this.manager=o,this.ngZone=u,this.router=h,this._idToken$=new An(1),this._accessToken$=new An(1),this._userProfile$=new An(1),this._userSession$=new An(1),this._isAuthenticated$=new An(1),this._isRenewing$=new An(1),this.authManagerSubs=[],this.isRenewing$=this._isRenewing$.asObservable().pipe(Ht()),this.isAuthenticated$=this._isAuthenticated$.asObservable().pipe(Ht()),this.userProfile$=this._userProfile$.asObservable().pipe(Ht()),this.userSession$=this._userSession$.asObservable().pipe(Ht()),this.idToken$=this._idToken$.asObservable().pipe(Ht()),this.idTokenDecoded$=this._idToken$.asObservable().pipe(Ht(),(0,gn.U)(w=>Nt.decodeJwt(w))),this.accessToken$=this._accessToken$.asObservable().pipe(Ht()),this.accessTokenDecoded$=this._accessToken$.asObservable().pipe(Ht(),(0,gn.U)(w=>Nt.decodeJwt(w))),this.listenForManagerChanges()}ngOnDestroy(){this.authManagerSubs.forEach(o=>o.unsubscribe())}login(o){var u=this;return H(function*(){return u.manager.login(o)})()}logout(o){var u=this;return H(function*(){return u.manager.logout(o)})()}renew(o){var u=this;return H(function*(){return u.manager.renew(o)})()}getSettings(){return this.manager.getSettings()}isRenewing(){return this.manager.isRenewing()}isAuthenticated(){var o=this;return H(function*(){return o.manager.isAuthenticated()})()}getUserProfile(){var o=this;return H(function*(){return o.manager.getUserProfile()})()}getUserSession(){var o=this;return H(function*(){return o.manager.getUserSession()})()}getIdToken(){var o=this;return H(function*(){return o.manager.getIdToken()})()}getIdTokenDecoded(){var o=this;return H(function*(){return o.manager.getIdTokenDecoded()})()}getAccessToken(){var o=this;return H(function*(){return o.manager.getAccessToken()})()}getAccessTokenDecoded(){var o=this;return H(function*(){return o.manager.getAccessTokenDecoded()})()}listenForManagerChanges(){this.authManagerSubs.push(this.manager.onIdTokenChanged(o=>this.ngZone.run(()=>this._idToken$.next(o))),this.manager.onAccessTokenChanged(o=>this.ngZone.run(()=>this._accessToken$.next(o))),this.manager.onUserProfileChanged(o=>this.ngZone.run(()=>this._userProfile$.next(o))),this.manager.onUserSessionChanged(o=>this.ngZone.run(()=>this._userSession$.next(o))),this.manager.onAuthenticatedChanged(o=>this.ngZone.run(()=>this._isAuthenticated$.next(o))),this.manager.onRenewingChanged(o=>this.ngZone.run(()=>this._isRenewing$.next(o))),this.manager.onRedirect(o=>{this.router.getCurrentNavigation()||this.ngZone.run(()=>{const u=o.href.replace(Nt.getBaseUrl(),"");this.router.navigateByUrl(u)})}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(Vc),m.LFG(m.R0b),m.LFG(nn.F0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();var Oo=O(4945),za=O(7980),Wf=O(4551),by=O(4970);class mg{}class _g{}class mr{constructor(i){this.normalizedNames=new Map,this.lazyUpdate=null,i?this.lazyInit="string"==typeof i?()=>{this.headers=new Map,i.split("\n").forEach(o=>{const u=o.indexOf(":");if(u>0){const h=o.slice(0,u),w=h.toLowerCase(),T=o.slice(u+1).trim();this.maybeSetNormalizedName(h,w),this.headers.has(w)?this.headers.get(w).push(T):this.headers.set(w,[T])}})}:()=>{this.headers=new Map,Object.keys(i).forEach(o=>{let u=i[o];const h=o.toLowerCase();"string"==typeof u&&(u=[u]),u.length>0&&(this.headers.set(h,u),this.maybeSetNormalizedName(o,h))})}:this.headers=new Map}has(i){return this.init(),this.headers.has(i.toLowerCase())}get(i){this.init();const o=this.headers.get(i.toLowerCase());return o&&o.length>0?o[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(i){return this.init(),this.headers.get(i.toLowerCase())||null}append(i,o){return this.clone({name:i,value:o,op:"a"})}set(i,o){return this.clone({name:i,value:o,op:"s"})}delete(i,o){return this.clone({name:i,value:o,op:"d"})}maybeSetNormalizedName(i,o){this.normalizedNames.has(o)||this.normalizedNames.set(o,i)}init(){this.lazyInit&&(this.lazyInit instanceof mr?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(i=>this.applyUpdate(i)),this.lazyUpdate=null))}copyFrom(i){i.init(),Array.from(i.headers.keys()).forEach(o=>{this.headers.set(o,i.headers.get(o)),this.normalizedNames.set(o,i.normalizedNames.get(o))})}clone(i){const o=new mr;return o.lazyInit=this.lazyInit&&this.lazyInit instanceof mr?this.lazyInit:this,o.lazyUpdate=(this.lazyUpdate||[]).concat([i]),o}applyUpdate(i){const o=i.name.toLowerCase();switch(i.op){case"a":case"s":let u=i.value;if("string"==typeof u&&(u=[u]),0===u.length)return;this.maybeSetNormalizedName(i.name,o);const h=("a"===i.op?this.headers.get(o):void 0)||[];h.push(...u),this.headers.set(o,h);break;case"d":const w=i.value;if(w){let T=this.headers.get(o);if(!T)return;T=T.filter(P=>-1===w.indexOf(P)),0===T.length?(this.headers.delete(o),this.normalizedNames.delete(o)):this.headers.set(o,T)}else this.headers.delete(o),this.normalizedNames.delete(o)}}forEach(i){this.init(),Array.from(this.normalizedNames.keys()).forEach(o=>i(this.normalizedNames.get(o),this.headers.get(o)))}}class Uc{encodeKey(i){return Bc(i)}encodeValue(i){return Bc(i)}decodeKey(i){return decodeURIComponent(i)}decodeValue(i){return decodeURIComponent(i)}}const wy=/%(\d[a-f0-9])/gi,Ey={40:"@","3A":":",24:"$","2C":",","3B":";","2B":"+","3D":"=","3F":"?","2F":"/"};function Bc(a){return encodeURIComponent(a).replace(wy,(i,o)=>{var u;return null!==(u=Ey[o])&&void 0!==u?u:i})}function zf(a){return`${a}`}class No{constructor(i={}){if(this.updates=null,this.cloneFrom=null,this.encoder=i.encoder||new Uc,i.fromString){if(i.fromObject)throw new Error("Cannot specify both fromString and fromObject.");this.map=function(a,i){const o=new Map;return a.length>0&&a.replace(/^\?/,"").split("&").forEach(h=>{const w=h.indexOf("="),[T,P]=-1==w?[i.decodeKey(h),""]:[i.decodeKey(h.slice(0,w)),i.decodeValue(h.slice(w+1))],F=o.get(T)||[];F.push(P),o.set(T,F)}),o}(i.fromString,this.encoder)}else i.fromObject?(this.map=new Map,Object.keys(i.fromObject).forEach(o=>{const u=i.fromObject[o];this.map.set(o,Array.isArray(u)?u:[u])})):this.map=null}has(i){return this.init(),this.map.has(i)}get(i){this.init();const o=this.map.get(i);return o?o[0]:null}getAll(i){return this.init(),this.map.get(i)||null}keys(){return this.init(),Array.from(this.map.keys())}append(i,o){return this.clone({param:i,value:o,op:"a"})}appendAll(i){const o=[];return Object.keys(i).forEach(u=>{const h=i[u];Array.isArray(h)?h.forEach(w=>{o.push({param:u,value:w,op:"a"})}):o.push({param:u,value:h,op:"a"})}),this.clone(o)}set(i,o){return this.clone({param:i,value:o,op:"s"})}delete(i,o){return this.clone({param:i,value:o,op:"d"})}toString(){return this.init(),this.keys().map(i=>{const o=this.encoder.encodeKey(i);return this.map.get(i).map(u=>o+"="+this.encoder.encodeValue(u)).join("&")}).filter(i=>""!==i).join("&")}clone(i){const o=new No({encoder:this.encoder});return o.cloneFrom=this.cloneFrom||this,o.updates=(this.updates||[]).concat(i),o}init(){null===this.map&&(this.map=new Map),null!==this.cloneFrom&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(i=>this.map.set(i,this.cloneFrom.map.get(i))),this.updates.forEach(i=>{switch(i.op){case"a":case"s":const o=("a"===i.op?this.map.get(i.param):void 0)||[];o.push(zf(i.value)),this.map.set(i.param,o);break;case"d":if(void 0===i.value){this.map.delete(i.param);break}{let u=this.map.get(i.param)||[];const h=u.indexOf(zf(i.value));-1!==h&&u.splice(h,1),u.length>0?this.map.set(i.param,u):this.map.delete(i.param)}}}),this.cloneFrom=this.updates=null)}}class yg{constructor(){this.map=new Map}set(i,o){return this.map.set(i,o),this}get(i){return this.map.has(i)||this.map.set(i,i.defaultValue()),this.map.get(i)}delete(i){return this.map.delete(i),this}keys(){return this.map.keys()}}function qa(a){return"undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer}function Hc(a){return"undefined"!=typeof Blob&&a instanceof Blob}function cu(a){return"undefined"!=typeof FormData&&a instanceof FormData}class jt{constructor(i,o,u,h){let w;if(this.url=o,this.body=null,this.reportProgress=!1,this.withCredentials=!1,this.responseType="json",this.method=i.toUpperCase(),function(a){switch(a){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}(this.method)||h?(this.body=void 0!==u?u:null,w=h):w=u,w&&(this.reportProgress=!!w.reportProgress,this.withCredentials=!!w.withCredentials,w.responseType&&(this.responseType=w.responseType),w.headers&&(this.headers=w.headers),w.context&&(this.context=w.context),w.params&&(this.params=w.params)),this.headers||(this.headers=new mr),this.context||(this.context=new yg),this.params){const T=this.params.toString();if(0===T.length)this.urlWithParams=o;else{const P=o.indexOf("?");this.urlWithParams=o+(-1===P?"?":PRe.set(Fe,i.setHeaders[Fe]),j)),i.setParams&&(J=Object.keys(i.setParams).reduce((Re,Fe)=>Re.set(Fe,i.setParams[Fe]),J)),new jt(u,h,T,{params:J,headers:j,context:Ee,reportProgress:F,responseType:w,withCredentials:P})}}var un=(()=>((un=un||{})[un.Sent=0]="Sent",un[un.UploadProgress=1]="UploadProgress",un[un.ResponseHeader=2]="ResponseHeader",un[un.DownloadProgress=3]="DownloadProgress",un[un.Response=4]="Response",un[un.User=5]="User",un))();class $c{constructor(i,o=200,u="OK"){this.headers=i.headers||new mr,this.status=void 0!==i.status?i.status:o,this.statusText=i.statusText||u,this.url=i.url||null,this.ok=this.status>=200&&this.status<300}}class Ya extends $c{constructor(i={}){super(i),this.type=un.ResponseHeader}clone(i={}){return new Ya({headers:i.headers||this.headers,status:void 0!==i.status?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}}class Ka extends $c{constructor(i={}){super(i),this.type=un.Response,this.body=void 0!==i.body?i.body:null}clone(i={}){return new Ka({body:void 0!==i.body?i.body:this.body,headers:i.headers||this.headers,status:void 0!==i.status?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}}class Yf extends $c{constructor(i){super(i,0,"Unknown Error"),this.name="HttpErrorResponse",this.ok=!1,this.message=this.status>=200&&this.status<300?`Http failure during parsing for ${i.url||"(unknown url)"}`:`Http failure response for ${i.url||"(unknown url)"}: ${i.status} ${i.statusText}`,this.error=i.error||null}}function Gc(a,i){return{body:i,headers:a.headers,context:a.context,observe:a.observe,params:a.params,reportProgress:a.reportProgress,responseType:a.responseType,withCredentials:a.withCredentials}}let Kf=(()=>{class a{constructor(o){this.handler=o}request(o,u,h={}){let w;if(o instanceof jt)w=o;else{let F,j;F=h.headers instanceof mr?h.headers:new mr(h.headers),h.params&&(j=h.params instanceof No?h.params:new No({fromObject:h.params})),w=new jt(o,u,void 0!==h.body?h.body:null,{headers:F,context:h.context,params:j,reportProgress:h.reportProgress,responseType:h.responseType||"json",withCredentials:h.withCredentials})}const T=(0,Oo.of)(w).pipe((0,Wf.b)(F=>this.handler.handle(F)));if(o instanceof jt||"events"===h.observe)return T;const P=T.pipe((0,by.h)(F=>F instanceof Ka));switch(h.observe||"body"){case"body":switch(w.responseType){case"arraybuffer":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&!(F.body instanceof ArrayBuffer))throw new Error("Response is not an ArrayBuffer.");return F.body}));case"blob":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&!(F.body instanceof Blob))throw new Error("Response is not a Blob.");return F.body}));case"text":return P.pipe((0,gn.U)(F=>{if(null!==F.body&&"string"!=typeof F.body)throw new Error("Response is not a string.");return F.body}));default:return P.pipe((0,gn.U)(F=>F.body))}case"response":return P;default:throw new Error(`Unreachable: unhandled observe type ${h.observe}}`)}}delete(o,u={}){return this.request("DELETE",o,u)}get(o,u={}){return this.request("GET",o,u)}head(o,u={}){return this.request("HEAD",o,u)}jsonp(o,u){return this.request("JSONP",o,{params:(new No).append(u,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(o,u={}){return this.request("OPTIONS",o,u)}patch(o,u,h={}){return this.request("PATCH",o,Gc(h,u))}post(o,u,h={}){return this.request("POST",o,Gc(h,u))}put(o,u,h={}){return this.request("PUT",o,Gc(h,u))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(mg))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();class Jf{constructor(i,o){this.next=i,this.interceptor=o}handle(i){return this.interceptor.intercept(i,this.next)}}const Wc=new m.OlP("HTTP_INTERCEPTORS");let Sy=(()=>{class a{intercept(o,u){return u.handle(o)}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Iy=/^\)\]\}',?\n/;let Ja=(()=>{class a{constructor(o){this.xhrFactory=o}handle(o){if("JSONP"===o.method)throw new Error("Attempted to construct Jsonp request without HttpClientJsonpModule installed.");return new za.y(u=>{const h=this.xhrFactory.build();if(h.open(o.method,o.urlWithParams),o.withCredentials&&(h.withCredentials=!0),o.headers.forEach((Fe,ke)=>h.setRequestHeader(Fe,ke.join(","))),o.headers.has("Accept")||h.setRequestHeader("Accept","application/json, text/plain, */*"),!o.headers.has("Content-Type")){const Fe=o.detectContentTypeHeader();null!==Fe&&h.setRequestHeader("Content-Type",Fe)}if(o.responseType){const Fe=o.responseType.toLowerCase();h.responseType="json"!==Fe?Fe:"text"}const w=o.serializeBody();let T=null;const P=()=>{if(null!==T)return T;const Fe=1223===h.status?204:h.status,ke=h.statusText||"OK",Ct=new mr(h.getAllResponseHeaders()),Mt=function(a){return"responseURL"in a&&a.responseURL?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):null}(h)||o.url;return T=new Ya({headers:Ct,status:Fe,statusText:ke,url:Mt}),T},F=()=>{let{headers:Fe,status:ke,statusText:Ct,url:Mt}=P(),xt=null;204!==ke&&(xt=void 0===h.response?h.responseText:h.response),0===ke&&(ke=xt?200:0);let jn=ke>=200&&ke<300;if("json"===o.responseType&&"string"==typeof xt){const Cn=xt;xt=xt.replace(Iy,"");try{xt=""!==xt?JSON.parse(xt):null}catch(Rt){xt=Cn,jn&&(jn=!1,xt={error:Rt,text:xt})}}jn?(u.next(new Ka({body:xt,headers:Fe,status:ke,statusText:Ct,url:Mt||void 0})),u.complete()):u.error(new Yf({error:xt,headers:Fe,status:ke,statusText:Ct,url:Mt||void 0}))},j=Fe=>{const{url:ke}=P(),Ct=new Yf({error:Fe,status:h.status||0,statusText:h.statusText||"Unknown Error",url:ke||void 0});u.error(Ct)};let J=!1;const Ee=Fe=>{J||(u.next(P()),J=!0);let ke={type:un.DownloadProgress,loaded:Fe.loaded};Fe.lengthComputable&&(ke.total=Fe.total),"text"===o.responseType&&!!h.responseText&&(ke.partialText=h.responseText),u.next(ke)},Re=Fe=>{let ke={type:un.UploadProgress,loaded:Fe.loaded};Fe.lengthComputable&&(ke.total=Fe.total),u.next(ke)};return h.addEventListener("load",F),h.addEventListener("error",j),h.addEventListener("timeout",j),h.addEventListener("abort",j),o.reportProgress&&(h.addEventListener("progress",Ee),null!==w&&h.upload&&h.upload.addEventListener("progress",Re)),h.send(w),u.next({type:un.Sent}),()=>{h.removeEventListener("error",j),h.removeEventListener("abort",j),h.removeEventListener("load",F),h.removeEventListener("timeout",j),o.reportProgress&&(h.removeEventListener("progress",Ee),null!==w&&h.upload&&h.upload.removeEventListener("progress",Re)),h.readyState!==h.DONE&&h.abort()}})}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.JF))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const zc=new m.OlP("XSRF_COOKIE_NAME"),qc=new m.OlP("XSRF_HEADER_NAME");class us{}let wg=(()=>{class a{constructor(o,u,h){this.doc=o,this.platform=u,this.cookieName=h,this.lastCookieString="",this.lastToken=null,this.parseCount=0}getToken(){if("server"===this.platform)return null;const o=this.doc.cookie||"";return o!==this.lastCookieString&&(this.parseCount++,this.lastToken=(0,x.Mx)(o,this.cookieName),this.lastCookieString=o),this.lastToken}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(x.K0),m.LFG(m.Lbi),m.LFG(zc))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Yc=(()=>{class a{constructor(o,u){this.tokenService=o,this.headerName=u}intercept(o,u){const h=o.url.toLowerCase();if("GET"===o.method||"HEAD"===o.method||h.startsWith("http://")||h.startsWith("https://"))return u.handle(o);const w=this.tokenService.getToken();return null!==w&&!o.headers.has(this.headerName)&&(o=o.clone({headers:o.headers.set(this.headerName,w)})),u.handle(o)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(us),m.LFG(qc))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Nr=(()=>{class a{constructor(o,u){this.backend=o,this.injector=u,this.chain=null}handle(o){if(null===this.chain){const u=this.injector.get(Wc,[]);this.chain=u.reduceRight((h,w)=>new Jf(h,w),this.backend)}return this.chain.handle(o)}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(_g),m.LFG(m.zs3))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Dg=(()=>{class a{static disable(){return{ngModule:a,providers:[{provide:Yc,useClass:Sy}]}}static withOptions(o={}){return{ngModule:a,providers:[o.cookieName?{provide:zc,useValue:o.cookieName}:[],o.headerName?{provide:qc,useValue:o.headerName}:[]]}}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[Yc,{provide:Wc,useExisting:Yc,multi:!0},{provide:us,useClass:wg},{provide:zc,useValue:"XSRF-TOKEN"},{provide:qc,useValue:"X-XSRF-TOKEN"}]}),a})(),Xf=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[Kf,{provide:mg,useClass:Nr},Ja,{provide:_g,useExisting:Ja}],imports:[[Dg.withOptions({cookieName:"XSRF-TOKEN",headerName:"X-XSRF-TOKEN"})]]}),a})();var Kc=O(5975),Jc=O(9517),Xs=O(447),vi=O(5955),xy=O(8007),Ry=O(2692),eh=O(9299);function Ag(...a){const i=(0,xy.jO)(a),{args:o,keys:u}=(0,Xs.D)(a),h=new za.y(w=>{const{length:T}=o;if(!T)return void w.complete();const P=new Array(T);let F=T,j=T;for(let J=0;J{Ee||(Ee=!0,j--),P[J]=Re},()=>F--,void 0,()=>{(!F||!Ee)&&(j||w.next(u?(0,eh.n)(u,P):P),w.complete())}))}});return i?h.pipe((0,Ry.Z)(i)):h}var Qa=O(5598),Qc=O(1528),Zc=O(3568);let cs=(()=>{class a{constructor(o,u){this.authService=o,this.router=u}canLoad(o){var u,h;const w=null===(h=null===(u=this.router.getCurrentNavigation())||void 0===u?void 0:u.extractedUrl)||void 0===h?void 0:h.toString();return this.isAllowed(o.data,w)}canActivate(o,u){return this.isAllowed(o.data,u.url)}canActivateChild(o,u){return this.isAllowed(o.data,u.url)}isAuthorized(){return!0}isPromise(o){return Boolean((null==o?void 0:o.then)&&"function"==typeof o.then)}isAuthorized$(o){const u=w=>"boolean"==typeof w?(0,Oo.of)(w):function(a){return!!a&&(a instanceof za.y||(0,Kc.m)(a.lift)&&(0,Kc.m)(a.subscribe))}(w)?w:this.isPromise(w)?(0,Jc.D)(w):(0,Oo.of)(!1),h=null==o?void 0:o.authGuardValidator;return"function"==typeof h?Ag({userProfile:this.authService.userProfile$.pipe((0,Qa.q)(1)),accessToken:this.authService.accessTokenDecoded$.pipe((0,Qa.q)(1))}).pipe((0,Qc.w)(({userProfile:w,accessToken:T})=>u(h(w,T)))):h?(console.error("authGuardValidator must be a function"),(0,Oo.of)(!1)):u(this.isAuthorized())}isAuthenticated$(o=location.href){return this.authService.isAuthenticated$.pipe((0,Qa.q)(1),(0,Qc.w)(u=>u?(0,Oo.of)(u):(0,Jc.D)(this.authService.login({redirectUrl:o})).pipe((0,Zc.K)(()=>(0,Oo.of)(!1)))))}isAllowed(o,u=location.href){return this.isAuthenticated$(u).pipe((0,Qc.w)(h=>h?this.isAuthorized$(o):(0,Oo.of)(!1)),(0,gn.U)(h=>{var w;if(!h){const T=(null==o?void 0:o.authGuardRedirectUrl)||(null===(w=this.authService.getSettings())||void 0===w?void 0:w.authGuardRedirectUrl);return this.router.parseUrl(T||this.router.url)}return!0}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(yi),m.LFG(nn.F0))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})(),Ig=(()=>{class a{constructor(o){this.authService=o,this.injectToken=!1,this.loginOn401=!1;const u=o.getSettings();u&&(this.injectToken=u.automaticInjectToken,this.loginOn401=u.automaticLoginOn401)}intercept(o,u){return this.injectAuthTokenIfNeeded$(o).pipe((0,Qc.w)(h=>u.handle(h)),(0,Zc.K)(h=>(this.loginOn401&&401===h.status&&this.authService.login(),function(a,i){const o=(0,Kc.m)(a)?a:()=>a,u=h=>h.error(o());return new za.y(u)}(()=>h))))}getCompleteUrl(o){try{return new URL(o).href}catch(u){return new URL(`${location.origin}${o.startsWith("/")?"":"/"}${o}`).href}}isMatching(o,u){const h=this.getCompleteUrl(o);if("function"==typeof u)return u(h);if("string"==typeof u){const w=u.replace(/\//g,"\\/").replace(/\./g,"\\.").replace(/\*\*/g,"*").replace(/\*/g,".*");return null!==new RegExp(w).exec(h)}return null!==u.exec(h)}isAllowedRequest(o){var u;let h=!1;if("boolean"==typeof this.injectToken)h=this.injectToken;else{const{include:w,exclude:T}=null!==(u=this.injectToken)&&void 0!==u?u:{};Array.isArray(w)?h=w.some(P=>this.isMatching(o.url,P)):w&&(h=this.isMatching(o.url,w)),Array.isArray(T)?T.some(P=>this.isMatching(o.url,P))&&(h=!1):T&&this.isMatching(o.url,T)&&(h=!1)}return h}injectAuthTokenIfNeeded$(o){return this.authService.accessToken$.pipe((0,Qa.q)(1),(0,gn.U)(u=>{if(!1!==this.injectToken&&u&&this.isAllowedRequest(o)){const h=o.headers?o.headers:new mr;return o.clone({headers:h.append("Authorization",`Bearer ${u}`)})}return o}))}}return a.\u0275fac=function(o){return new(o||a)(m.LFG(yi))},a.\u0275prov=m.Yz7({token:a,factory:a.\u0275fac}),a})();const Mg=function(){var a=H(function*(i,o){const u=new o;return yield u.init(i),u});return function(o,u){return a.apply(this,arguments)}}(),Yr=function(){var a=H(function*(i){return yield Mg(i,Vc)});return function(o){return a.apply(this,arguments)}}(),xg={automaticLoginOn401:!0,automaticInjectToken:{include:a=>{const i=new URL(a,"http://default-base");return i.hostname.startsWith("api")||i.pathname.startsWith("/api")||!1}}},Xc=new m.OlP("AUTH_MANAGER"),Rg=function(){var a=H(function*(i){return{provide:Xc,useValue:yield Yr(Object.assign(Object.assign({},xg),i)),multi:!1}});return function(o){return a.apply(this,arguments)}}();let Pg=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({providers:[cs,nn.Bz,{provide:yi,useFactory:(i,o,u)=>new yi(i,o,u),deps:[Xc,m.R0b,nn.F0]},{provide:Wc,useClass:Ig,deps:[yi],multi:!0}]}),a})(),Og=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=m.Xpm({type:a,selectors:[["app-root"]],decls:1,vars:0,template:function(o,u){1&o&&m._UZ(0,"router-outlet")},directives:[nn.lC],encapsulation:2}),a})();const Ng=[{path:"**",pathMatch:"full",redirectTo:""}];let nh=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[nn.Bz.forRoot(Ng,{onSameUrlNavigation:"reload",enableTracing:!1})],nn.Bz]}),a})();"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global&&global;var Ci=(()=>(function(a){a.Unimplemented="UNIMPLEMENTED",a.Unavailable="UNAVAILABLE"}(Ci||(Ci={})),Ci))();class _r extends Error{constructor(i,o,u){super(i),this.message=i,this.code=o,this.data=u}}const Lg=a=>{var i,o,u,h,w;const T=a.CapacitorCustomPlatform||null,P=a.Capacitor||{},F=P.Plugins=P.Plugins||{},j=a.CapacitorPlatforms,Ee=(null===(i=null==j?void 0:j.currentPlatform)||void 0===i?void 0:i.getPlatform)||(()=>null!==T?T.name:(a=>{var i,o;return(null==a?void 0:a.androidBridge)?"android":(null===(o=null===(i=null==a?void 0:a.webkit)||void 0===i?void 0:i.messageHandlers)||void 0===o?void 0:o.bridge)?"ios":"web"})(a)),Fe=(null===(o=null==j?void 0:j.currentPlatform)||void 0===o?void 0:o.isNativePlatform)||(()=>"web"!==Ee()),Ct=(null===(u=null==j?void 0:j.currentPlatform)||void 0===u?void 0:u.isPluginAvailable)||(wt=>{const Bt=Rt.get(wt);return!(!(null==Bt?void 0:Bt.platforms.has(Ee()))&&!xt(wt))}),xt=(null===(h=null==j?void 0:j.currentPlatform)||void 0===h?void 0:h.getPluginHeader)||(wt=>{var Bt;return null===(Bt=P.PluginHeaders)||void 0===Bt?void 0:Bt.find(kr=>kr.name===wt)}),Rt=new Map,Ai=(null===(w=null==j?void 0:j.currentPlatform)||void 0===w?void 0:w.registerPlugin)||((wt,Bt={})=>{const kr=Rt.get(wt);if(kr)return console.warn(`Capacitor plugin "${wt}" already registered. Cannot register plugins twice.`),kr.proxy;const Kr=Ee(),Ii=xt(wt);let Mi;const dl=function(){var Sn=H(function*(){return!Mi&&Kr in Bt?Mi=Mi="function"==typeof Bt[Kr]?yield Bt[Kr]():Bt[Kr]:null!==T&&!Mi&&"web"in Bt&&(Mi=Mi="function"==typeof Bt.web?yield Bt.web():Bt.web),Mi});return function(){return Sn.apply(this,arguments)}}(),fl=Sn=>{let Bn;const Xi=(...gs)=>{const ms=dl().then(Jr=>{const la=((Sn,Bn)=>{var Xi,gs;if(!Ii){if(Sn)return null===(gs=Sn[Bn])||void 0===gs?void 0:gs.bind(Sn);throw new _r(`"${wt}" plugin is not implemented on ${Kr}`,Ci.Unimplemented)}{const ms=null==Ii?void 0:Ii.methods.find(Jr=>Bn===Jr.name);if(ms)return"promise"===ms.rtype?Jr=>P.nativePromise(wt,Bn.toString(),Jr):(Jr,la)=>P.nativeCallback(wt,Bn.toString(),Jr,la);if(Sn)return null===(Xi=Sn[Bn])||void 0===Xi?void 0:Xi.bind(Sn)}})(Jr,Sn);if(la){const ku=la(...gs);return Bn=null==ku?void 0:ku.remove,ku}throw new _r(`"${wt}.${Sn}()" is not implemented on ${Kr}`,Ci.Unimplemented)});return"addListener"===Sn&&(ms.remove=H(function*(){return Bn()})),ms};return Xi.toString=()=>`${Sn.toString()}() { [capacitor code] }`,Object.defineProperty(Xi,"name",{value:Sn,writable:!1,configurable:!1}),Xi},hl=fl("addListener"),Fu=fl("removeListener"),Ld=(Sn,Bn)=>{const Xi=hl({eventName:Sn},Bn),gs=function(){var Jr=H(function*(){const la=yield Xi;Fu({eventName:Sn,callbackId:la},Bn)});return function(){return Jr.apply(this,arguments)}}(),ms=new Promise(Jr=>Xi.then(()=>Jr({remove:gs})));return ms.remove=H(function*(){console.warn("Using addListener() without 'await' is deprecated."),yield gs()}),ms},zh=new Proxy({},{get(Sn,Bn){switch(Bn){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return Ii?Ld:hl;case"removeListener":return Fu;default:return fl(Bn)}}});return F[wt]=zh,Rt.set(wt,{name:wt,proxy:zh,platforms:new Set([...Object.keys(Bt),...Ii?[Kr]:[]])}),zh});return P.convertFileSrc||(P.convertFileSrc=wt=>wt),P.getPlatform=Ee,P.handleError=wt=>a.console.error(wt),P.isNativePlatform=Fe,P.isPluginAvailable=Ct,P.pluginMethodNoop=(wt,Bt,kr)=>Promise.reject(`${kr} does not have an implementation of "${Bt}".`),P.registerPlugin=Ai,P.Exception=_r,P.DEBUG=!!P.DEBUG,P.isLoggingEnabled=!!P.isLoggingEnabled,P.platform=P.getPlatform(),P.isNative=P.isNativePlatform(),P},yr=(a=>a.Capacitor=Lg(a))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),fu=yr.registerPlugin;class Ug{constructor(i){this.listeners={},this.windowListeners={},i&&(console.warn(`Capacitor WebPlugin "${i.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=i)}addListener(i,o){var u=this;this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(o);const w=this.windowListeners[i];w&&!w.registered&&this.addWindowListener(w);const T=function(){var F=H(function*(){return u.removeListener(i,o)});return function(){return F.apply(this,arguments)}}(),P=Promise.resolve({remove:T});return Object.defineProperty(P,"remove",{value:(F=H(function*(){console.warn("Using addListener() without 'await' is deprecated."),yield T()}),function(){return F.apply(this,arguments)})}),P;var F}removeAllListeners(){var i=this;return H(function*(){i.listeners={};for(const o in i.windowListeners)i.removeWindowListener(i.windowListeners[o]);i.windowListeners={}})()}notifyListeners(i,o){const u=this.listeners[i];u&&u.forEach(h=>h(o))}hasListeners(i){return!!this.listeners[i].length}registerWindowListener(i,o){this.windowListeners[o]={registered:!1,windowEventName:i,pluginEventName:o,handler:u=>{this.notifyListeners(o,u)}}}unimplemented(i="not implemented"){return new yr.Exception(i,Ci.Unimplemented)}unavailable(i="not available"){return new yr.Exception(i,Ci.Unavailable)}removeListener(i,o){var u=this;return H(function*(){const h=u.listeners[i];if(!h)return;const w=h.indexOf(o);u.listeners[i].splice(w,1),u.listeners[i].length||u.removeWindowListener(u.windowListeners[i])})()}addWindowListener(i){window.addEventListener(i.windowEventName,i.handler),i.registered=!0}removeWindowListener(i){!i||(window.removeEventListener(i.windowEventName,i.handler),i.registered=!1)}}const Bg=a=>encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),bi=a=>a.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class hu extends Ug{getCookies(){return H(function*(){const i=document.cookie,o={};return i.split(";").forEach(u=>{if(u.length<=0)return;let[h,w]=u.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");h=bi(h).trim(),w=bi(w).trim(),o[h]=w}),o})()}setCookie(i){return H(function*(){try{const o=Bg(i.key),u=Bg(i.value),h=`; expires=${(i.expires||"").replace("expires=","")}`,w=(i.path||"/").replace("path=",""),T=null!=i.url&&i.url.length>0?`domain=${i.url}`:"";document.cookie=`${o}=${u||""}${h}; path=${w}; ${T};`}catch(o){return Promise.reject(o)}})()}deleteCookie(i){return H(function*(){try{document.cookie=`${i.key}=; Max-Age=0`}catch(o){return Promise.reject(o)}})()}clearCookies(){return H(function*(){try{const i=document.cookie.split(";")||[];for(const o of i)document.cookie=o.replace(/^ +/,"").replace(/=.*/,`=;expires=${(new Date).toUTCString()};path=/`)}catch(i){return Promise.reject(i)}})()}clearAllCookies(){var i=this;return H(function*(){try{yield i.clearCookies()}catch(o){return Promise.reject(o)}})()}}fu("CapacitorCookies",{web:()=>new hu});const td=function(){var a=H(function*(i){return new Promise((o,u)=>{const h=new FileReader;h.onload=()=>{const w=h.result;o(w.indexOf(",")>=0?w.split(",")[1]:w)},h.onerror=w=>u(w),h.readAsDataURL(i)})});return function(o){return a.apply(this,arguments)}}();class Ny extends Ug{request(i){return H(function*(){const o=((a,i={})=>{const o=Object.assign({method:a.method||"GET",headers:a.headers},i),h=((a={})=>{const i=Object.keys(a);return Object.keys(a).map(h=>h.toLocaleLowerCase()).reduce((h,w,T)=>(h[w]=a[i[T]],h),{})})(a.headers)["content-type"]||"";if("string"==typeof a.data)o.body=a.data;else if(h.includes("application/x-www-form-urlencoded")){const w=new URLSearchParams;for(const[T,P]of Object.entries(a.data||{}))w.set(T,P);o.body=w.toString()}else if(h.includes("multipart/form-data")||a.data instanceof FormData){const w=new FormData;if(a.data instanceof FormData)a.data.forEach((P,F)=>{w.append(F,P)});else for(const P of Object.keys(a.data))w.append(P,a.data[P]);o.body=w;const T=new Headers(o.headers);T.delete("content-type"),o.headers=T}else(h.includes("application/json")||"object"==typeof a.data)&&(o.body=JSON.stringify(a.data));return o})(i,i.webFetchExtra),u=((a,i=!0)=>a?Object.entries(a).reduce((u,h)=>{const[w,T]=h;let P,F;return Array.isArray(T)?(F="",T.forEach(j=>{P=i?encodeURIComponent(j):j,F+=`${w}=${P}&`}),F.slice(0,-1)):(P=i?encodeURIComponent(T):T,F=`${w}=${P}`),`${u}&${F}`},"").substr(1):null)(i.params,i.shouldEncodeUrlParams),h=u?`${i.url}?${u}`:i.url,w=yield fetch(h,o),T=w.headers.get("content-type")||"";let F,j,{responseType:P="text"}=w.ok?i:{};switch(T.includes("application/json")&&(P="json"),P){case"arraybuffer":case"blob":j=yield w.blob(),F=yield td(j);break;case"json":F=yield w.json();break;default:F=yield w.text()}const J={};return w.headers.forEach((Ee,Re)=>{J[Re]=Ee}),{data:F,headers:J,status:w.status,url:w.url}})()}get(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"GET"}))})()}post(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"POST"}))})()}put(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"PUT"}))})()}patch(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"PATCH"}))})()}delete(i){var o=this;return H(function*(){return o.request(Object.assign(Object.assign({},i),{method:"DELETE"}))})()}}fu("CapacitorHttp",{web:()=>new Ny});const pu='\n .flex {\n flex: 1;\n }\n\n .hidden {\n display: none !important;\n }\n\n .row {\n display: flex;\n flex-direction: row;\n }\n\n .column {\n display: flex;\n flex-direction: column;\n }\n\n .card {\n border: 1px solid rgba(0, 0, 0, 0.12);\n border-radius: 4px;\n background-color: white;\n margin: 12px 6px;\n }\n\n .card .card-status {\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n margin-left: 8px;\n background-color: #f2f2f2;\n }\n .card .card-status.error {\n background-color: #ef5350;\n }\n .card .card-status.success {\n background-color: #66bb6a;\n }\n\n .card .card-title {\n padding: 16px;\n font-size: 20px;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.87);\n align-items: center;\n }\n\n .card .box {\n height: 200px;\n border-top: 1px solid lightgray;\n word-break: break-all;\n overflow: auto;\n background-color: #f2f2f2;\n padding: 12px;\n }\n .card .box pre {\n margin: 0;\n }\n\n .card .card-actions {\n padding: 0 14px 8px 14px;\n min-height: 50px;\n }\n .card .card-actions .input {\n display: flex;\n align-items: center;\n }\n .card .card-actions .input:not(:last-child) {\n margin-bottom: 8px;\n }\n .card .card-actions .input label {\n width: 125px;\n text-align: right;\n margin-right: 14px;\n }\n .card .card-actions .input input {\n padding: 4px;\n }\n\n .json-key {\n color: rgb(124, 77, 255);\n }\n\n .json-value {\n color: rgb(67, 122, 237);\n }\n\n .json-string {\n color: rgb(83, 160, 83);\n }\n\n .json-date {\n color: rgb(200, 56, 198);\n }\n\n input {\n color: #5e35b1;\n padding: 10px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n font-size: 14px;\n }\n\n input:invalid {\n border-color: #f44336;\n }\n\n input[type="checkbox"] {\n margin-right: 10px;\n }\n\n select {\n color: #5e35b1;\n padding: 8px 6px;\n border: 1px solid #0000001f;\n border-radius: 4px;\n }\n\n @media only screen and (max-width: 600px) {\n :host {\n padding: 0 !important;\n padding-bottom: 24px !important;\n }\n\n :host .card {\n border-left: 0;\n border-right: 0;\n border-radius: 0;\n margin: 0;\n margin-bottom: 6px;\n }\n }\n',ea=(a,i=[])=>a?JSON.stringify(a,null,2).replace(/&/g,"&").replace(/\\"/g,""").replace(//g,">").replace(/^( *)("[\w-]+": )?("[^"]*"|[\w.+-]*)?([,[{])?$/gm,(h,w,T,P,F)=>{let j=w||"";const J=T?T.replace(/[": ]/g,""):void 0;if(J&&(j+=`${J}: `),P&&(j+=`${P}`,J&&i.includes(J))){const Ee=new Date(1e3*Number(P)),Re=`${Ee.toDateString()}, ${Ee.toLocaleTimeString()}`;Re&&(j+=` (${Re})`)}return j+(F||"")}):"",nd=document.createElement("template");nd.innerHTML=`\n \n\n
\n
\n\n \n \n \n \n \n \n \n \n\n
\n \u{1f6e1}\ufe0fDemo app { }\n
\u{1f448} choose an implementation
\n
\n\n
\n\n
\n \n \n \n
\n
\n`;class $g extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(nd.content,!0)),this.implSelectEl=this.shadowRoot.querySelector("#implementation-select"),this.statusEl=this.shadowRoot.querySelector(".status"),this.versionEl=this.shadowRoot.querySelector(".version"),this.loginButtonEl=this.shadowRoot.querySelector("#login-button"),this.logoutButtonEl=this.shadowRoot.querySelector("#logout-button"),this.silentRenewButtonEl=this.shadowRoot.querySelector("#silent-renew-button")}set isRenewing(i){this.statusEl&&this.statusEl.classList[i?"add":"remove"]("loading")}set isAuthenticated(i){this.statusEl&&null!==i&&(this.statusEl.classList.remove("loading"),this.statusEl.title=i?"Authenticated":"Not authenticated",this.statusEl.classList[i?"add":"remove"]("authenticated"),this.statusEl.classList[i?"remove":"add"]("not-authenticated"))}connectedCallback(){if(window.location.href.includes("localhost")){const o=document.createElement("option");o.textContent="localhost",this.implSelectEl.appendChild(o)}else{window.appSettings.getImplementations().forEach(u=>{const h=document.createElement("option");h.value=String(u.label),h.textContent=u.label,this.implSelectEl.appendChild(h)});const o=()=>{window.location.href=window.appSettings.getImplementations()[this.implSelectEl.selectedIndex].demoUrl};this.implSelectEl.addEventListener("change",o),this.listeners.push(()=>this.implSelectEl.removeEventListener("change",o))}const i=()=>{var o,u;null===(u=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector("header .title .tip"))||void 0===u||u.remove(),window.appSettings.setShowTip(!1)};window.appSettings.get().showTip?(this.implSelectEl.addEventListener("click",i,{once:!0}),this.listeners.push(()=>this.implSelectEl.removeEventListener("click",i))):i(),this.refreshImplementation(),this.addEventListeners()}disconnectedCallback(){this.listeners.forEach(i=>i())}addEventListeners(){var i,o,u;const h=()=>this.dispatchEvent(new Event("login",{bubbles:!0,composed:!0}));null===(i=this.loginButtonEl)||void 0===i||i.addEventListener("click",h);const w=()=>this.dispatchEvent(new Event("logout",{bubbles:!0,composed:!0}));null===(o=this.logoutButtonEl)||void 0===o||o.addEventListener("click",w);const T=()=>this.dispatchEvent(new Event("silentRenew",{bubbles:!0,composed:!0}));null===(u=this.silentRenewButtonEl)||void 0===u||u.addEventListener("click",T),this.listeners.push(()=>{var P;return null===(P=this.loginButtonEl)||void 0===P?void 0:P.removeEventListener("click",h)},()=>{var P;return null===(P=this.logoutButtonEl)||void 0===P?void 0:P.removeEventListener("click",w)},()=>{var P;return null===(P=this.silentRenewButtonEl)||void 0===P?void 0:P.removeEventListener("click",T)})}refreshImplementation(){const i=window.appSettings.getImplementations();if(window.location.href.includes("localhost"))this.implSelectEl.selectedIndex=0,this.versionEl.innerHTML="@localhost";else{const o=i.findIndex(h=>window.location.href.includes(h.demoUrl)),u=-1!==o?i[o]:i[0];this.implSelectEl.selectedIndex=-1!==o?o:0,this.versionEl.innerHTML=u.version}}}window.customElements.define("demo-app-header",$g);const gu=document.createElement("template");gu.innerHTML=`\n \n\n \n \n
\n \n
\n`;class ky extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.tabs=[],this.views=[],this.currentTabIndex=-1,this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(gu.content,!0)),this.tabsContentEl=this.shadowRoot.querySelector(".tabs-content"),this.demoAppHeaderEl=this.shadowRoot.querySelector("demo-app-header")}set isRenewing(i){this.demoAppHeaderEl.isRenewing=i}set isAuthenticated(i){this.demoAppHeaderEl.isAuthenticated=i}connectedCallback(){this.drawTabs(),this.showView(window.appSettings?window.appSettings.get().currentTabIndex:0)}disconnectedCallback(){this.listeners.forEach(i=>i())}drawTabs(){const i=this.shadowRoot.querySelector("#views"),o=this.shadowRoot.querySelector("#tabs");i&&o&&(this.views=i.assignedElements(),this.views.forEach((u,h)=>{u.style.display="none";const w=document.createElement("a");w.textContent=u.getAttribute("tabLabel")||"?";const T=()=>this.showView(h);w.addEventListener("click",T),this.listeners.push(()=>w.removeEventListener("click",T)),o.appendChild(w),this.tabs.push(w)}))}showView(i){var o;this.currentTabIndex!==i&&(this.currentTabIndex=i,this.tabs.forEach((u,h)=>{u.classList[h!==i?"remove":"add"]("selected")}),this.views.forEach((u,h)=>{u.style.display=h!==i?"none":"flex"}),null===(o=this.tabsContentEl)||void 0===o||o.scrollTo(0,0),window.appSettings.setCurrentTabIndex(i))}}window.customElements.define("demo-app-main",ky);const Gg=document.createElement("template");Gg.innerHTML=`\n \n\n
\n
\n APIs access\n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n \n
\n            
\n
\n
\n\n \n`;class Ly extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(Gg.content,!0)),this.apiStatusEl=this.shadowRoot.querySelector("#api-status"),this.apiResponseEl=this.shadowRoot.querySelector("#api-response"),this.apiUrlEl=this.shadowRoot.querySelector("#api-url-input"),this.apiHeadersEl=this.shadowRoot.querySelector("#api-headers-input")}connectedCallback(){var i,o,u;const h=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("#api-get-button"),w=()=>{const j=new CustomEvent("api",{bubbles:!0,composed:!0,detail:{url:this.apiUrlEl.value,headers:this.apiHeadersEl.value}});return this.dispatchEvent(j)};null==h||h.addEventListener("click",w);const T=()=>this.saveSettings({privateApiUrl:this.apiUrlEl.value});null===(o=this.apiUrlEl)||void 0===o||o.addEventListener("input",T);const P=()=>this.saveSettings({privateApiHeaders:this.apiHeadersEl.value});null===(u=this.apiHeadersEl)||void 0===u||u.addEventListener("input",P),this.listeners.push(()=>null==h?void 0:h.removeEventListener("click",w),()=>{var j;return null===(j=this.apiUrlEl)||void 0===j?void 0:j.removeEventListener("input",T)},()=>{var j;return null===(j=this.apiHeadersEl)||void 0===j?void 0:j.removeEventListener("input",P)});const{otherSettings:F}=window.appSettings.getCurrentUserSettings();this.apiUrlEl.value=null==F?void 0:F.privateApiUrl,this.apiHeadersEl.value=null==F?void 0:F.privateApiHeaders}disconnectedCallback(){this.listeners.forEach(i=>i())}setApiStatus(i,o){this.apiStatusEl.classList.remove(o?"success":"error"),this.apiStatusEl.classList.add(o?"error":"success"),this.apiResponseEl.innerHTML=ea(i)}saveSettings(i){const o=window.appSettings.getCurrentUserSettings();o.otherSettings=Object.assign(Object.assign({},o.otherSettings),i),window.appSettings.addOrUpdateUserSettings(o)}}window.customElements.define("demo-app-playground",Ly);const Wg=document.createElement("template");Wg.innerHTML=`\n \n\n
\n
\n
Authenticated
\n \n
\n            
\n
\n\n
\n
User session
\n \n
\n            
\n
\n\n
\n
Access token
\n \n
\n                
\n            
\n
\n\n
\n
Id token
\n \n
\n                
\n            
\n
\n\n
\n
User profile
\n \n
\n            
\n
\n
\n`;class Vy extends HTMLElement{constructor(){var i;super(),this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(Wg.content,!0)),this.isAuthenticated=!1,this.userSession=void 0,this.accessToken=void 0,this.accessTokenDecoded=void 0,this.idToken=void 0,this.idTokenDecoded=void 0,this.userProfile=void 0}set isAuthenticated(i){null!==i&&this.update("#isAuthenticated",i)}set userSession(i){this.update("#userSession",ea(i,["expires_at"]))}set accessToken(i){this.update("#accessToken",i)}set accessTokenDecoded(i){const o="string"!=typeof i?ea(i,["exp","iat","auth_time"]):"(no decoded info as it is not a JWT token)";this.update("#accessTokenDecoded",o)}set idToken(i){this.update("#idToken",i)}set idTokenDecoded(i){this.update("#idTokenDecoded",ea(i,["exp","iat","auth_time"]))}set userProfile(i){this.update("#userProfile",ea(i))}update(i,o){var u,h,w;const T=null===(u=this.shadowRoot)||void 0===u?void 0:u.querySelector(i);T&&(null==o||""===o?null===(h=T.closest(".info"))||void 0===h||h.classList.add("hidden"):(null===(w=T.closest(".info"))||void 0===w||w.classList.remove("hidden"),T.innerHTML=String(o)))}}window.customElements.define("demo-app-debug",Vy);const zg=document.createElement("template");zg.innerHTML=`\n \n\n
\n \n
\n \n
\n
\n\n \n\n
\n
\n DELETE\n
\n
\n \n \n
\n
\n
\n`;class Uy extends HTMLElement{constructor(){var i;super(),this.listeners=[],this.formIsDirty=!1,this.formIsNew=!1,this.attachShadow({mode:"open"}),null===(i=this.shadowRoot)||void 0===i||i.appendChild(document.importNode(zg.content,!0))}connectedCallback(){var i,o,u,h,w;this.formEl=this.shadowRoot.querySelector("form"),this.formContentEl=this.shadowRoot.querySelector(".form-content"),this.selectEl=this.shadowRoot.querySelector("#settings-select"),this.settingsNameEl=this.shadowRoot.querySelector("#settingsName");const T=Mt=>{!this.formIsDirty&&"settings-select"!==Mt.target.id&&(this.formIsDirty=!0,this.classList.add("dirty"))};this.formEl.addEventListener("input",T),this.listeners.push(()=>this.formEl.removeEventListener("input",T)),this.refreshSelect();const P=()=>this.loadSettings(this.selectEl.value);null===(i=this.selectEl)||void 0===i||i.addEventListener("change",P),this.listeners.push(()=>this.selectEl.removeEventListener("change",P));const F=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector("#add-settings-button"),j=()=>this.add();null==F||F.addEventListener("click",j),this.listeners.push(()=>null==F?void 0:F.removeEventListener("click",j));const J=null===(u=this.shadowRoot)||void 0===u?void 0:u.querySelector("#delete-settings-button"),Ee=()=>this.delete();null==J||J.addEventListener("click",Ee),this.listeners.push(()=>null==J?void 0:J.removeEventListener("click",Ee));const Re=null===(h=this.shadowRoot)||void 0===h?void 0:h.querySelector("#save-settings-button"),Fe=()=>this.saveAndReload();null==Re||Re.addEventListener("click",Fe),this.listeners.push(()=>null==Re?void 0:Re.removeEventListener("click",Fe));const ke=null===(w=this.shadowRoot)||void 0===w?void 0:w.querySelector("#cancel-settings-button"),Ct=()=>this.cancel();null==ke||ke.addEventListener("click",Ct),this.listeners.push(()=>null==ke?void 0:ke.removeEventListener("click",Ct)),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}disconnectedCallback(){this.listeners.forEach(i=>i())}loadSettings(i){window.appSettings.setCurrentUserSettings(i),location.reload()}add(){const i="New settings",o=document.createElement("option");o.selected=!0,o.value=i,o.textContent=i,this.selectEl.appendChild(o),this.formIsNew=!0,this.formIsDirty=!0,this.classList.add("dirty"),this.refreshFormContent({name:i,librarySettings:{}})}delete(){window.appSettings.deleteCurrentUserSettings(),location.reload()}cancel(){this.formIsNew=!1,this.formIsDirty=!1,this.classList.remove("dirty"),this.refreshSelect(),this.refreshFormContent(window.appSettings.getCurrentUserSettings())}setPathValue(i,o,u){const h=o.split(".");h.reduce((w,T,P)=>(P===h.length-1?w[T]=u:Object.prototype.hasOwnProperty.call(w,T)||(w[T]={}),w[T]),i)}getPathValue(i,o){return o.split(".").reduce((u,h)=>u&&u[h],i)}refreshSelect(){this.selectEl.innerHTML="";const{userSettings:i,currentUserSettingsId:o}=window.appSettings.get();i.sort((u,h)=>u.name.localeCompare(h.name)).forEach(u=>{const h=document.createElement("option");h.selected=u.name===o,h.value=String(u.name),h.textContent=u.name,this.selectEl.appendChild(h)})}refreshFormContent(i){this.formContentEl.innerHTML="";const{librarySettingsDefinition:o}=window.appSettings.get(),{name:u,librarySettings:h}=i;this.settingsNameEl.value=u,o.sort((w,T)=>(T._sortIndex||0)-(w._sortIndex||0)).forEach(w=>{var T;const P=document.createElement("div");this.formContentEl.prepend(P);const F=document.createElement("label");F.htmlFor=w.name.replace(".",""),F.textContent=`${w.label}${w.required?" *":""}`;const j=document.createElement("list"===w.type?"select":"input");switch(j.id=w.name.replace(".",""),j.name=w.name.replace(".",""),j.required=!0===w.required,w.type){case"boolean":j.checked=this.getPathValue(h,w.name),j.type="checkbox",P.appendChild(j),P.appendChild(F);break;case"list":null===(T=w.values)||void 0===T||T.forEach(J=>{const Ee=document.createElement("option");Ee.value=String(J.value),Ee.textContent=J.label,j.appendChild(Ee)}),j.value=this.getPathValue(h,w.name),j.classList.add("flex"),P.classList.add("input","column"),P.appendChild(F),P.appendChild(j);break;default:{const J=this.getPathValue(h,w.name);j.value="json"===w.type?J?JSON.stringify(J):"":null!=J?J:"",P.classList.add("input","column"),P.appendChild(F),P.appendChild(j);break}}})}saveAndReload(){if(this.formEl.reportValidity()){const{librarySettingsDefinition:i}=window.appSettings.get(),o=this.formIsNew?{name:"",librarySettings:{}}:window.appSettings.getCurrentUserSettings();o.name=this.settingsNameEl.value,i.forEach(u=>{var h;const w=null===(h=this.shadowRoot)||void 0===h?void 0:h.querySelector(`#${u.name.replace(".","")}`);let T;switch(u.type){case"boolean":T=w.checked;break;case"list":default:T=w.value;break;case"json":try{const P=w.value;P&&""!==P.trim()&&(T=JSON.parse(P))}catch(P){console.error(P)}}this.setPathValue(o.librarySettings,u.name,T)}),window.appSettings.addOrUpdateUserSettings(o),this.formIsNew&&window.appSettings.setCurrentUserSettings(o.name),location.reload()}}}window.customElements.define("demo-app-settings",Uy);const qg=JSON.parse('{"u2":"@badisi/auth-js","Xh":"https://github.com/Badisi/auth-js/tree/main/projects/auth-js"}'),uh=JSON.parse('{"u2":"@badisi/ngx-auth","i8":"0.0.0-semantically-released","Xh":"https://github.com/Badisi/auth-js/tree/main/projects/ngx-auth"}'),Ji=[{name:"authorityUrl",label:"Authority url",type:"string",required:!0},{name:"clientId",label:"Client id",type:"string",required:!0},{name:"mobileScheme",label:"Custom mobile scheme name",type:"string"},{name:"scope",label:"Scope",type:"string"},{name:"internal.extraQueryParams",label:"Extra query params",type:"json"},{name:"desktopNavigationType",label:"Desktop navigation type",type:"list",values:[{label:"REDIRECT",value:Xt.REDIRECT},{label:"POPUP",value:Xt.POPUP}]},{name:"logLevel",label:"Log level",type:"list",values:[{label:"NONE",value:xn.NONE},{label:"ERROR",value:xn.ERROR},{label:"WARN",value:xn.WARN},{label:"INFO",value:xn.INFO},{label:"DEBUG",value:xn.DEBUG}]},{name:"loginRequired",label:"Login required",type:"boolean"},{name:"retrieveUserSession",label:"Retrieve user's session",type:"boolean"},{name:"loadUserInfo",label:"Load user's info",type:"boolean"},{name:"automaticSilentRenew",label:"Automatic silent renew",type:"boolean"},{name:"automaticLoginOn401",label:"Automatic login on 401",type:"boolean"},{name:"automaticInjectToken",label:"Automatic inject token",type:"boolean"}];Ji.splice(3,0,{name:"authGuardRedirectUrl",label:"AuthGuard redirect url",type:"string"});const rd=Ji;let mu=(()=>{class a{constructor(o,u){this._renderer=o,this._elementRef=u,this.onChange=h=>{},this.onTouched=()=>{}}setProperty(o,u){this._renderer.setProperty(this._elementRef.nativeElement,o,u)}registerOnTouched(o){this.onTouched=o}registerOnChange(o){this.onChange=o}setDisabledState(o){this.setProperty("disabled",o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(m.Qsj),m.Y36(m.SBq))},a.\u0275dir=m.lG2({type:a}),a})(),Fo=(()=>{class a extends mu{}return a.\u0275fac=function(){let i;return function(u){return(i||(i=m.n5z(a)))(u||a)}}(),a.\u0275dir=m.lG2({type:a,features:[m.qOj]}),a})();const Fr=new m.OlP("NgValueAccessor"),dh={provide:Fr,useExisting:(0,m.Gpc)(()=>ta),multi:!0},By=new m.OlP("CompositionEventMode");let ta=(()=>{class a extends mu{constructor(o,u,h){super(o,u),this._compositionMode=h,this._composing=!1,null==this._compositionMode&&(this._compositionMode=!function(){const a=(0,x.q)()?(0,x.q)().getUserAgent():"";return/android (\d+)/.test(a.toLowerCase())}())}writeValue(o){this.setProperty("value",null==o?"":o)}_handleInput(o){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(o)}_compositionStart(){this._composing=!0}_compositionEnd(o){this._composing=!1,this._compositionMode&&this.onChange(o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(m.Qsj),m.Y36(m.SBq),m.Y36(By,8))},a.\u0275dir=m.lG2({type:a,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(o,u){1&o&&m.NdJ("input",function(w){return u._handleInput(w.target.value)})("blur",function(){return u.onTouched()})("compositionstart",function(){return u._compositionStart()})("compositionend",function(w){return u._compositionEnd(w.target.value)})},features:[m._Bn([dh]),m.qOj]}),a})();const Un=new m.OlP("NgValidators"),Lo=new m.OlP("NgAsyncValidators");function ad(a){return null!=a}function el(a){const i=(0,m.QGY)(a)?(0,Jc.D)(a):a;return(0,m.CqO)(i),i}function hh(a){let i={};return a.forEach(o=>{i=null!=o?Object.assign(Object.assign({},i),o):i}),0===Object.keys(i).length?null:i}function ld(a,i){return i.map(o=>o(a))}function ud(a){return a.map(i=>function(a){return!a.validate}(i)?i:o=>i.validate(o))}function dd(a){return null!=a?function(a){if(!a)return null;const i=a.filter(ad);return 0==i.length?null:function(o){return hh(ld(o,i))}}(ud(a)):null}function hd(a){return null!=a?function(a){if(!a)return null;const i=a.filter(ad);return 0==i.length?null:function(o){return Ag(ld(o,i).map(el)).pipe((0,gn.U)(hh))}}(ud(a)):null}function ph(a,i){return null===a?[i]:Array.isArray(a)?[...a,i]:[a,i]}function pd(a){return a?Array.isArray(a)?a:[a]:[]}function gd(a,i){return Array.isArray(a)?a.includes(i):a===i}function Qg(a,i){const o=pd(i);return pd(a).forEach(h=>{gd(o,h)||o.push(h)}),o}function md(a,i){return pd(i).filter(o=>!gd(a,o))}let Zg=(()=>{class a{constructor(){this._rawValidators=[],this._rawAsyncValidators=[],this._onDestroyCallbacks=[]}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(o){this._rawValidators=o||[],this._composedValidatorFn=dd(this._rawValidators)}_setAsyncValidators(o){this._rawAsyncValidators=o||[],this._composedAsyncValidatorFn=hd(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(o){this._onDestroyCallbacks.push(o)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(o=>o()),this._onDestroyCallbacks=[]}reset(o){this.control&&this.control.reset(o)}hasError(o,u){return!!this.control&&this.control.hasError(o,u)}getError(o,u){return this.control?this.control.getError(o,u):null}}return a.\u0275fac=function(o){return new(o||a)},a.\u0275dir=m.lG2({type:a}),a})(),Yn=(()=>{class a extends Zg{get formDirective(){return null}get path(){return null}}return a.\u0275fac=function(){let i;return function(u){return(i||(i=m.n5z(a)))(u||a)}}(),a.\u0275dir=m.lG2({type:a,features:[m.qOj]}),a})();class Ei extends Zg{constructor(){super(...arguments),this._parent=null,this.name=null,this.valueAccessor=null}}let mh=(()=>{class a extends class{constructor(i){this._cd=i}is(i){var o,u,h;return"submitted"===i?!!(null===(o=this._cd)||void 0===o?void 0:o.submitted):!!(null===(h=null===(u=this._cd)||void 0===u?void 0:u.control)||void 0===h?void 0:h[i])}}{constructor(o){super(o)}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(Ei,2))},a.\u0275dir=m.lG2({type:a,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(o,u){2&o&&m.ekj("ng-untouched",u.is("untouched"))("ng-touched",u.is("touched"))("ng-pristine",u.is("pristine"))("ng-dirty",u.is("dirty"))("ng-valid",u.is("valid"))("ng-invalid",u.is("invalid"))("ng-pending",u.is("pending"))},features:[m.qOj]}),a})();function rl(a,i){(function(a,i){const o=function(a){return a._rawValidators}(a);null!==i.validator?a.setValidators(ph(o,i.validator)):"function"==typeof o&&a.setValidators([o]);const u=function(a){return a._rawAsyncValidators}(a);null!==i.asyncValidator?a.setAsyncValidators(ph(u,i.asyncValidator)):"function"==typeof u&&a.setAsyncValidators([u]);const h=()=>a.updateValueAndValidity();Cu(i._rawValidators,h),Cu(i._rawAsyncValidators,h)})(a,i),i.valueAccessor.writeValue(a.value),function(a,i){i.valueAccessor.registerOnChange(o=>{a._pendingValue=o,a._pendingChange=!0,a._pendingDirty=!0,"change"===a.updateOn&&Ch(a,i)})}(a,i),function(a,i){const o=(u,h)=>{i.valueAccessor.writeValue(u),h&&i.viewToModelUpdate(u)};a.registerOnChange(o),i._registerOnDestroy(()=>{a._unregisterOnChange(o)})}(a,i),function(a,i){i.valueAccessor.registerOnTouched(()=>{a._pendingTouched=!0,"blur"===a.updateOn&&a._pendingChange&&Ch(a,i),"submit"!==a.updateOn&&a.markAsTouched()})}(a,i),function(a,i){if(i.valueAccessor.setDisabledState){const o=u=>{i.valueAccessor.setDisabledState(u)};a.registerOnDisabledChange(o),i._registerOnDestroy(()=>{a._unregisterOnDisabledChange(o)})}}(a,i)}function Cu(a,i){a.forEach(o=>{o.registerOnValidatorChange&&o.registerOnValidatorChange(i)})}function Ch(a,i){a._pendingDirty&&a.markAsDirty(),a.setValue(a._pendingValue,{emitModelToViewChange:!1}),i.viewToModelUpdate(a._pendingValue),a._pendingChange=!1}function ol(a,i){const o=a.indexOf(i);o>-1&&a.splice(o,1)}const ra="VALID",sl="INVALID",or="PENDING",Vo="DISABLED";function Dd(a){return(hs(a)?a.validators:a)||null}function im(a){return Array.isArray(a)?dd(a):a||null}function Uo(a,i){return(hs(i)?i.asyncValidators:a)||null}function Sd(a){return Array.isArray(a)?hd(a):a||null}function hs(a){return null!=a&&!Array.isArray(a)&&"object"==typeof a}class ps{constructor(i,o){this._hasOwnPendingAsyncValidator=!1,this._onCollectionChange=()=>{},this._parent=null,this.pristine=!0,this.touched=!1,this._onDisabledChange=[],this._rawValidators=i,this._rawAsyncValidators=o,this._composedValidatorFn=im(this._rawValidators),this._composedAsyncValidatorFn=Sd(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn}set validator(i){this._rawValidators=this._composedValidatorFn=i}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(i){this._rawAsyncValidators=this._composedAsyncValidatorFn=i}get parent(){return this._parent}get valid(){return this.status===ra}get invalid(){return this.status===sl}get pending(){return this.status==or}get disabled(){return this.status===Vo}get enabled(){return this.status!==Vo}get dirty(){return!this.pristine}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(i){this._rawValidators=i,this._composedValidatorFn=im(i)}setAsyncValidators(i){this._rawAsyncValidators=i,this._composedAsyncValidatorFn=Sd(i)}addValidators(i){this.setValidators(Qg(i,this._rawValidators))}addAsyncValidators(i){this.setAsyncValidators(Qg(i,this._rawAsyncValidators))}removeValidators(i){this.setValidators(md(i,this._rawValidators))}removeAsyncValidators(i){this.setAsyncValidators(md(i,this._rawAsyncValidators))}hasValidator(i){return gd(this._rawValidators,i)}hasAsyncValidator(i){return gd(this._rawAsyncValidators,i)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(i={}){this.touched=!0,this._parent&&!i.onlySelf&&this._parent.markAsTouched(i)}markAllAsTouched(){this.markAsTouched({onlySelf:!0}),this._forEachChild(i=>i.markAllAsTouched())}markAsUntouched(i={}){this.touched=!1,this._pendingTouched=!1,this._forEachChild(o=>{o.markAsUntouched({onlySelf:!0})}),this._parent&&!i.onlySelf&&this._parent._updateTouched(i)}markAsDirty(i={}){this.pristine=!1,this._parent&&!i.onlySelf&&this._parent.markAsDirty(i)}markAsPristine(i={}){this.pristine=!0,this._pendingDirty=!1,this._forEachChild(o=>{o.markAsPristine({onlySelf:!0})}),this._parent&&!i.onlySelf&&this._parent._updatePristine(i)}markAsPending(i={}){this.status=or,!1!==i.emitEvent&&this.statusChanges.emit(this.status),this._parent&&!i.onlySelf&&this._parent.markAsPending(i)}disable(i={}){const o=this._parentMarkedDirty(i.onlySelf);this.status=Vo,this.errors=null,this._forEachChild(u=>{u.disable(Object.assign(Object.assign({},i),{onlySelf:!0}))}),this._updateValue(),!1!==i.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(Object.assign(Object.assign({},i),{skipPristineCheck:o})),this._onDisabledChange.forEach(u=>u(!0))}enable(i={}){const o=this._parentMarkedDirty(i.onlySelf);this.status=ra,this._forEachChild(u=>{u.enable(Object.assign(Object.assign({},i),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:i.emitEvent}),this._updateAncestors(Object.assign(Object.assign({},i),{skipPristineCheck:o})),this._onDisabledChange.forEach(u=>u(!1))}_updateAncestors(i){this._parent&&!i.onlySelf&&(this._parent.updateValueAndValidity(i),i.skipPristineCheck||this._parent._updatePristine(),this._parent._updateTouched())}setParent(i){this._parent=i}updateValueAndValidity(i={}){this._setInitialStatus(),this._updateValue(),this.enabled&&(this._cancelExistingSubscription(),this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===ra||this.status===or)&&this._runAsyncValidator(i.emitEvent)),!1!==i.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!i.onlySelf&&this._parent.updateValueAndValidity(i)}_updateTreeValidity(i={emitEvent:!0}){this._forEachChild(o=>o._updateTreeValidity(i)),this.updateValueAndValidity({onlySelf:!0,emitEvent:i.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?Vo:ra}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(i){if(this.asyncValidator){this.status=or,this._hasOwnPendingAsyncValidator=!0;const o=el(this.asyncValidator(this));this._asyncValidationSubscription=o.subscribe(u=>{this._hasOwnPendingAsyncValidator=!1,this.setErrors(u,{emitEvent:i})})}}_cancelExistingSubscription(){this._asyncValidationSubscription&&(this._asyncValidationSubscription.unsubscribe(),this._hasOwnPendingAsyncValidator=!1)}setErrors(i,o={}){this.errors=i,this._updateControlsErrors(!1!==o.emitEvent)}get(i){return function(a,i,o){if(null==i||(Array.isArray(i)||(i=i.split(".")),Array.isArray(i)&&0===i.length))return null;let u=a;return i.forEach(h=>{u=u instanceof al?u.controls.hasOwnProperty(h)?u.controls[h]:null:u instanceof Eh&&u.at(h)||null}),u}(this,i)}getError(i,o){const u=o?this.get(o):this;return u&&u.errors?u.errors[i]:null}hasError(i,o){return!!this.getError(i,o)}get root(){let i=this;for(;i._parent;)i=i._parent;return i}_updateControlsErrors(i){this.status=this._calculateStatus(),i&&this.statusChanges.emit(this.status),this._parent&&this._parent._updateControlsErrors(i)}_initObservables(){this.valueChanges=new m.vpe,this.statusChanges=new m.vpe}_calculateStatus(){return this._allControlsDisabled()?Vo:this.errors?sl:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(or)?or:this._anyControlsHaveStatus(sl)?sl:ra}_anyControlsHaveStatus(i){return this._anyControls(o=>o.status===i)}_anyControlsDirty(){return this._anyControls(i=>i.dirty)}_anyControlsTouched(){return this._anyControls(i=>i.touched)}_updatePristine(i={}){this.pristine=!this._anyControlsDirty(),this._parent&&!i.onlySelf&&this._parent._updatePristine(i)}_updateTouched(i={}){this.touched=this._anyControlsTouched(),this._parent&&!i.onlySelf&&this._parent._updateTouched(i)}_isBoxedValue(i){return"object"==typeof i&&null!==i&&2===Object.keys(i).length&&"value"in i&&"disabled"in i}_registerOnCollectionChange(i){this._onCollectionChange=i}_setUpdateStrategy(i){hs(i)&&null!=i.updateOn&&(this._updateOn=i.updateOn)}_parentMarkedDirty(i){return!i&&!(!this._parent||!this._parent.dirty)&&!this._parent._anyControlsDirty()}}class Su extends ps{constructor(i=null,o,u){super(Dd(o),Uo(u,o)),this._onChange=[],this._applyFormState(i),this._setUpdateStrategy(o),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}setValue(i,o={}){this.value=this._pendingValue=i,this._onChange.length&&!1!==o.emitModelToViewChange&&this._onChange.forEach(u=>u(this.value,!1!==o.emitViewToModelChange)),this.updateValueAndValidity(o)}patchValue(i,o={}){this.setValue(i,o)}reset(i=null,o={}){this._applyFormState(i),this.markAsPristine(o),this.markAsUntouched(o),this.setValue(this.value,o),this._pendingChange=!1}_updateValue(){}_anyControls(i){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(i){this._onChange.push(i)}_unregisterOnChange(i){ol(this._onChange,i)}registerOnDisabledChange(i){this._onDisabledChange.push(i)}_unregisterOnDisabledChange(i){ol(this._onDisabledChange,i)}_forEachChild(i){}_syncPendingControls(){return!("submit"!==this.updateOn||(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),!this._pendingChange)||(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),0))}_applyFormState(i){this._isBoxedValue(i)?(this.value=this._pendingValue=i.value,i.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=i}}class al extends ps{constructor(i,o,u){super(Dd(o),Uo(u,o)),this.controls=i,this._initObservables(),this._setUpdateStrategy(o),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}registerControl(i,o){return this.controls[i]?this.controls[i]:(this.controls[i]=o,o.setParent(this),o._registerOnCollectionChange(this._onCollectionChange),o)}addControl(i,o,u={}){this.registerControl(i,o),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}removeControl(i,o={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),delete this.controls[i],this.updateValueAndValidity({emitEvent:o.emitEvent}),this._onCollectionChange()}setControl(i,o,u={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),delete this.controls[i],o&&this.registerControl(i,o),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}contains(i){return this.controls.hasOwnProperty(i)&&this.controls[i].enabled}setValue(i,o={}){this._checkAllValuesPresent(i),Object.keys(i).forEach(u=>{this._throwIfControlMissing(u),this.controls[u].setValue(i[u],{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o)}patchValue(i,o={}){null!=i&&(Object.keys(i).forEach(u=>{this.controls[u]&&this.controls[u].patchValue(i[u],{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o))}reset(i={},o={}){this._forEachChild((u,h)=>{u.reset(i[h],{onlySelf:!0,emitEvent:o.emitEvent})}),this._updatePristine(o),this._updateTouched(o),this.updateValueAndValidity(o)}getRawValue(){return this._reduceChildren({},(i,o,u)=>(i[u]=o instanceof Su?o.value:o.getRawValue(),i))}_syncPendingControls(){let i=this._reduceChildren(!1,(o,u)=>!!u._syncPendingControls()||o);return i&&this.updateValueAndValidity({onlySelf:!0}),i}_throwIfControlMissing(i){if(!Object.keys(this.controls).length)throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.controls[i])throw new Error(`Cannot find form control with name: ${i}.`)}_forEachChild(i){Object.keys(this.controls).forEach(o=>{const u=this.controls[o];u&&i(u,o)})}_setUpControls(){this._forEachChild(i=>{i.setParent(this),i._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(i){for(const o of Object.keys(this.controls)){const u=this.controls[o];if(this.contains(o)&&i(u))return!0}return!1}_reduceValue(){return this._reduceChildren({},(i,o,u)=>((o.enabled||this.disabled)&&(i[u]=o.value),i))}_reduceChildren(i,o){let u=i;return this._forEachChild((h,w)=>{u=o(u,h,w)}),u}_allControlsDisabled(){for(const i of Object.keys(this.controls))if(this.controls[i].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_checkAllValuesPresent(i){this._forEachChild((o,u)=>{if(void 0===i[u])throw new Error(`Must supply a value for form control with name: '${u}'.`)})}}class Eh extends ps{constructor(i,o,u){super(Dd(o),Uo(u,o)),this.controls=i,this._initObservables(),this._setUpdateStrategy(o),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}at(i){return this.controls[i]}push(i,o={}){this.controls.push(i),this._registerControl(i),this.updateValueAndValidity({emitEvent:o.emitEvent}),this._onCollectionChange()}insert(i,o,u={}){this.controls.splice(i,0,o),this._registerControl(o),this.updateValueAndValidity({emitEvent:u.emitEvent})}removeAt(i,o={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),this.controls.splice(i,1),this.updateValueAndValidity({emitEvent:o.emitEvent})}setControl(i,o,u={}){this.controls[i]&&this.controls[i]._registerOnCollectionChange(()=>{}),this.controls.splice(i,1),o&&(this.controls.splice(i,0,o),this._registerControl(o)),this.updateValueAndValidity({emitEvent:u.emitEvent}),this._onCollectionChange()}get length(){return this.controls.length}setValue(i,o={}){this._checkAllValuesPresent(i),i.forEach((u,h)=>{this._throwIfControlMissing(h),this.at(h).setValue(u,{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o)}patchValue(i,o={}){null!=i&&(i.forEach((u,h)=>{this.at(h)&&this.at(h).patchValue(u,{onlySelf:!0,emitEvent:o.emitEvent})}),this.updateValueAndValidity(o))}reset(i=[],o={}){this._forEachChild((u,h)=>{u.reset(i[h],{onlySelf:!0,emitEvent:o.emitEvent})}),this._updatePristine(o),this._updateTouched(o),this.updateValueAndValidity(o)}getRawValue(){return this.controls.map(i=>i instanceof Su?i.value:i.getRawValue())}clear(i={}){this.controls.length<1||(this._forEachChild(o=>o._registerOnCollectionChange(()=>{})),this.controls.splice(0),this.updateValueAndValidity({emitEvent:i.emitEvent}))}_syncPendingControls(){let i=this.controls.reduce((o,u)=>!!u._syncPendingControls()||o,!1);return i&&this.updateValueAndValidity({onlySelf:!0}),i}_throwIfControlMissing(i){if(!this.controls.length)throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.at(i))throw new Error(`Cannot find form control at index ${i}`)}_forEachChild(i){this.controls.forEach((o,u)=>{i(o,u)})}_updateValue(){this.value=this.controls.filter(i=>i.enabled||this.disabled).map(i=>i.value)}_anyControls(i){return this.controls.some(o=>o.enabled&&i(o))}_setUpControls(){this._forEachChild(i=>this._registerControl(i))}_checkAllValuesPresent(i){this._forEachChild((o,u)=>{if(void 0===i[u])throw new Error(`Must supply a value for form control at index: ${u}.`)})}_allControlsDisabled(){for(const i of this.controls)if(i.enabled)return!1;return this.controls.length>0||this.disabled}_registerControl(i){i.setParent(this),i._registerOnCollectionChange(this._onCollectionChange)}}const ia={provide:Ei,useExisting:(0,m.Gpc)(()=>Td)},Th=(()=>Promise.resolve(null))();let Td=(()=>{class a extends Ei{constructor(o,u,h,w){super(),this.control=new Su,this._registered=!1,this.update=new m.vpe,this._parent=o,this._setValidators(u),this._setAsyncValidators(h),this.valueAccessor=function(a,i){if(!i)return null;let o,u,h;return Array.isArray(i),i.forEach(w=>{w.constructor===ta?o=w:function(a){return Object.getPrototypeOf(a.constructor)===Fo}(w)?u=w:h=w}),h||u||o||null}(0,w)}ngOnChanges(o){this._checkForErrors(),this._registered||this._setUpControl(),"isDisabled"in o&&this._updateDisabled(o),function(a,i){if(!a.hasOwnProperty("model"))return!1;const o=a.model;return!!o.isFirstChange()||!Object.is(i,o.currentValue)}(o,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._parent?function(a,i){return[...i.path,a]}(this.name,this._parent):[this.name]}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(o){this.viewModel=o,this.update.emit(o)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&null!=this.options.updateOn&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!(!this.options||!this.options.standalone)}_setUpStandalone(){rl(this.control,this),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),this._isStandalone()}_updateValue(o){Th.then(()=>{this.control.setValue(o,{emitViewToModelChange:!1})})}_updateDisabled(o){const u=o.isDisabled.currentValue,h=""===u||u&&"false"!==u;Th.then(()=>{h&&!this.control.disabled?this.control.disable():!h&&this.control.disabled&&this.control.enable()})}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(Yn,9),m.Y36(Un,10),m.Y36(Lo,10),m.Y36(Fr,10))},a.\u0275dir=m.lG2({type:a,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:["disabled","isDisabled"],model:["ngModel","model"],options:["ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],features:[m._Bn([ia]),m.qOj,m.TTD]}),a})(),Tu=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({}),a})(),Gh=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[Tu]]}),a})(),Cm=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[Gh]}),a})();var Pu=O(2462);const sa=["demoAppPlayground"],Wh=["queryParamsInput"],bm=[{path:"",component:(()=>{class a{constructor(o,u,h){this.router=o,this.authService=u,this.httpClient=h}ngAfterViewInit(){setTimeout(()=>{const o=window.appSettings.getCurrentUserSettings().otherSettings;if(this.roles=null==o?void 0:o.roles,this.queryParams=null==o?void 0:o.queryParams,this.queryParams){let u="";Object.entries(this.queryParams).forEach(([h,w],T)=>{T>0&&(u+="&"),u+=`${h}=${w}`}),this.queryParamsInputEl.nativeElement.value=u}})}callPrivateApi(o){var u;const{url:h,headers:w}=o.detail;if(h){let T=new mr;null==w||w.split(";").forEach(F=>{var j,J;if(F){const Ee=F.split(":");T=T.append(null===(j=Ee[0])||void 0===j?void 0:j.trim(),(null===(J=Ee[1])||void 0===J?void 0:J.trim())||"")}});const P=null===(u=this.demoAppPlaygroundEl)||void 0===u?void 0:u.nativeElement;this.httpClient.get(h,w?{headers:T}:{}).subscribe({next:F=>null==P?void 0:P.setApiStatus(F,!1),error:F=>null==P?void 0:P.setApiStatus(F,!0)})}}saveSettings(){var o;(null===(o=this.demoAppPlaygroundEl)||void 0===o?void 0:o.nativeElement).saveSettings({roles:this.roles,queryParams:this.queryParams})}onQueryParamsInputChange(o){const u={};null==o||o.split("&").forEach(h=>{const w=h.split("=");2===w.length&&(u[w[0]]=w[1])}),this.queryParams=u,this.saveSettings()}}return a.\u0275fac=function(o){return new(o||a)(m.Y36(nn.F0),m.Y36(yi),m.Y36(Kf))},a.\u0275cmp=m.Xpm({type:a,selectors:[["app-demo"]],viewQuery:function(o,u){if(1&o&&(m.Gf(sa,5),m.Gf(Wh,5)),2&o){let h;m.iGM(h=m.CRH())&&(u.demoAppPlaygroundEl=h.first),m.iGM(h=m.CRH())&&(u.queryParamsInputEl=h.first)}},decls:48,vars:32,consts:[[3,"isRenewing","isAuthenticated","login","logout","silentRenew"],["tabLabel","Playground",3,"api"],["demoAppPlayground",""],[1,"card","routes"],[1,"card-title"],[1,"card-actions","column"],[1,"route","query-params"],[1,"info"],["placeholder","param1=one¶m2=two",3,"input"],["queryParamsInput",""],[1,"route"],["routerLink","/",3,"queryParams"],["routerLink","/public",3,"queryParams"],["routerLink","/private",3,"queryParams"],["routerLink","/protected",3,"queryParams"],["id","roles-input",3,"ngModel","input","keydown.enter","ngModelChange"],[1,"box"],["tabLabel","Debug",3,"isAuthenticated","userProfile","userSession","idToken","idTokenDecoded","accessToken","accessTokenDecoded"],["tabLabel","Settings"]],template:function(o,u){if(1&o){const h=m.EpF();m.TgZ(0,"demo-app-main",0),m.NdJ("login",function(){return u.authService.login()})("logout",function(){return u.authService.logout({redirectUrl:"/"})})("silentRenew",function(){return u.authService.renew()}),m.ALo(1,"async"),m.ALo(2,"async"),m.TgZ(3,"demo-app-playground",1,2),m.NdJ("api",function(T){return u.callPrivateApi(T)}),m.TgZ(5,"div",3),m.TgZ(6,"div",4),m._uU(7,"Routes access"),m.qZA(),m.TgZ(8,"div",5),m.TgZ(9,"div",6),m.TgZ(10,"div",7),m.TgZ(11,"label"),m._uU(12,"Query params"),m.qZA(),m.TgZ(13,"input",8,9),m.NdJ("input",function(){m.CHM(h);const T=m.MAs(14);return u.onQueryParamsInputChange(T.value)}),m.qZA(),m.qZA(),m.qZA(),m.TgZ(15,"div",10),m.TgZ(16,"button",11),m._uU(17,"HOME"),m.qZA(),m.TgZ(18,"div",7),m._uU(19,"Home page"),m.qZA(),m.qZA(),m.TgZ(20,"div",10),m.TgZ(21,"button",12),m._uU(22,"PUBLIC"),m.qZA(),m.TgZ(23,"div",7),m._uU(24,"Public content (no login required)"),m.qZA(),m.qZA(),m.TgZ(25,"div",10),m.TgZ(26,"button",13),m._uU(27,"PRIVATE"),m.qZA(),m.TgZ(28,"div",7),m._uU(29,"Private content (login required)"),m.qZA(),m.qZA(),m.TgZ(30,"div",10),m.TgZ(31,"button",14),m._uU(32,"PROTECTED"),m.qZA(),m.TgZ(33,"div",7),m._uU(34,"Protected content (login required + role(s): "),m.TgZ(35,"input",15),m.NdJ("input",function(){return u.saveSettings()})("keydown.enter",function(){return u.router.navigateByUrl("/protected")})("ngModelChange",function(T){return u.roles=T}),m.qZA(),m._uU(36,") "),m.qZA(),m.qZA(),m.qZA(),m.TgZ(37,"div",16),m._UZ(38,"router-outlet"),m.qZA(),m.qZA(),m.qZA(),m._UZ(39,"demo-app-debug",17),m.ALo(40,"async"),m.ALo(41,"async"),m.ALo(42,"async"),m.ALo(43,"async"),m.ALo(44,"async"),m.ALo(45,"async"),m.ALo(46,"async"),m._UZ(47,"demo-app-settings",18),m.qZA()}2&o&&(m.Q6J("isRenewing",m.lcZ(1,14,u.authService.isRenewing$))("isAuthenticated",m.lcZ(2,16,u.authService.isAuthenticated$)),m.xp6(16),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(5),m.Q6J("queryParams",u.queryParams),m.xp6(4),m.Q6J("ngModel",u.roles),m.xp6(4),m.Q6J("isAuthenticated",m.lcZ(40,18,u.authService.isAuthenticated$))("userProfile",m.lcZ(41,20,u.authService.userProfile$))("userSession",m.lcZ(42,22,u.authService.userSession$))("idToken",m.lcZ(43,24,u.authService.idToken$))("idTokenDecoded",m.lcZ(44,26,u.authService.idTokenDecoded$))("accessToken",m.lcZ(45,28,u.authService.accessToken$))("accessTokenDecoded",m.lcZ(46,30,u.authService.accessTokenDecoded$)))},directives:[nn.rH,ta,mh,Td,nn.lC],pipes:[x.Ov],styles:[":host .card.routes{margin-top:20px}:host .card.routes .route{display:flex;align-items:center}:host .card.routes .route.query-params{margin:0 0 10px 10px}:host .card.routes .route.query-params label{font-size:16px;color:#000;margin-right:12px}:host .card.routes .route.query-params input{width:500px}:host .card.routes .route button{padding:2px 10px;min-width:104px;margin:8px 12px 8px 8px}:host .card.routes .route input{margin:0 2px;padding:4px}:host .card.routes .route .info{padding-bottom:2px;font-size:14px;line-height:22px;text-align:left;color:#0000008a}:host .card.routes .box{height:100px}@media only screen and (max-width: 600px){:host .card.routes{margin-top:12px}:host .card.routes .route{margin-left:3px!important}:host .card.routes .route.query-params .info{display:flex;flex-direction:column;flex:1;grid-gap:8px;gap:8px}:host .card.routes .route.query-params .info input{margin:0;width:inherit;align-self:normal}:host .card.routes .route #roles-input{width:90%}:host .card.routes .route button{margin-left:3px}}\n",".flex{flex:1}.hidden{display:none!important}.row{display:flex;flex-direction:row}.column{display:flex;flex-direction:column}.card{border:1px solid rgba(0,0,0,.12);border-radius:4px;background-color:#fff;margin:12px 6px}.card .card-status{display:block;width:10px;height:10px;border-radius:50%;margin-left:8px;background-color:#f2f2f2}.card .card-status.error{background-color:#ef5350}.card .card-status.success{background-color:#66bb6a}.card .card-title{padding:16px;font-size:20px;font-weight:500;color:#000000de;align-items:center}.card .box{height:200px;border-top:1px solid lightgray;word-break:break-all;overflow:auto;background-color:#f2f2f2;padding:12px}.card .box pre{margin:0}.card .card-actions{padding:0 14px 8px;min-height:50px}.card .card-actions .input{display:flex;align-items:center}.card .card-actions .input:not(:last-child){margin-bottom:8px}.card .card-actions .input label{width:125px;text-align:right;margin-right:14px}.card .card-actions .input input{padding:4px}.json-key{color:#7c4dff}.json-value{color:#437aed}.json-string{color:#53a053}.json-date{color:#c838c6}input{color:#5e35b1;padding:10px;border:1px solid #0000001f;border-radius:4px;font-size:14px}input:invalid{border-color:#f44336}input[type=checkbox]{margin-right:10px}select{color:#5e35b1;padding:8px 6px;border:1px solid #0000001f;border-radius:4px}@media only screen and (max-width: 600px){:host{padding:0 0 24px!important}:host .card{border-left:0;border-right:0;border-radius:0;margin:0 0 6px}}\n"],encapsulation:3}),a})(),children:[{path:"public",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",data:{title:"PUBLIC CONTENT"}},{path:"private",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",canLoad:[cs],canActivate:[cs],canActivateChild:[cs],data:{title:"PRIVATE CONTENT"}},{path:"forbidden",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",data:{title:"ACCESS FORBIDDEN"}},{path:"protected",loadChildren:()=>Promise.resolve().then(O.bind(O,2462)).then(a=>a.PageModule),runGuardsAndResolvers:"always",canLoad:[cs],canActivate:[cs],canActivateChild:[cs],data:{title:"PROTECTED CONTENT",authGuardValidator:(a,i)=>{var o,u,h,w,T;const{otherSettings:P,librarySettings:F}=window.appSettings.getCurrentUserSettings(),j=P&&(null===(o=P.roles)||void 0===o?void 0:o.split(","))||[];let J;if(F.authorityUrl.includes("auth0"))J=null===(u=i)||void 0===u?void 0:u["http://ngx-auth.com/roles"];else if(F.authorityUrl.includes("zitadel")){const Ee=null===(h=i)||void 0===h?void 0:h["urn:zitadel:iam:org:project:roles"];J=Object.keys(null!=Ee?Ee:{})}else J=null===(T=null===(w=i.resource_access)||void 0===w?void 0:w.account)||void 0===T?void 0:T.roles;return j.every(Ee=>(null!=J?J:[]).includes(Ee))}}}]}];let wm=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[nn.Bz.forChild(bm)],nn.Bz]}),a})(),kd=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a}),a.\u0275inj=m.cJS({imports:[[x.ez,wm,Cm,Xf,Pu.PageModule]]}),a})(),Ti=(()=>{class a{}return a.\u0275fac=function(o){return new(o||a)},a.\u0275mod=m.oAB({type:a,bootstrap:[Og]}),a.\u0275inj=m.cJS({imports:[[Pg,lr,x.ez,kd,nh]]}),a})();const Rn=new class{constructor(i,o){this.storageKey=i,this.defaultAppSettings=o,this.implementations=[{label:"VanillaJS",demoUrl:"https://badisi.github.io/auth-js/demo-app/auth-js",version:`${qg.u2}@main`},{label:"Angular",demoUrl:"https://badisi.github.io/auth-js/demo-app/ngx-auth",version:`${uh.u2}@main`}],this.defaultAppSettings.librarySettingsDefinition.forEach((u,h)=>u._sortIndex=h)}getImplementations(){return this.implementations}setShowTip(i){const o=this.get();o.showTip=i,this.saveAppSettings(o)}setCurrentTabIndex(i){const o=this.get();o.currentTabIndex=i,this.saveAppSettings(o)}addOrUpdateUserSettings(i){const o=this.get(),u=o.userSettings.findIndex(h=>h.name===i.name);-1!==u?o.userSettings[u]=i:o.userSettings.push(i),this.saveAppSettings(o)}deleteCurrentUserSettings(){const i=this.get(),{name:o}=this.getCurrentUserSettings(),u=i.userSettings.findIndex(h=>h.name===o);-1!==u&&(i.userSettings.splice(u,1),delete i.currentUserSettingsId,this.saveAppSettings(i))}setCurrentUserSettings(i){const o=this.get();-1!==o.userSettings.findIndex(h=>h.name===i)&&(o.currentUserSettingsId=i,this.saveAppSettings(o))}getCurrentUserSettings(){const i=this.get(),o=i.userSettings.findIndex(u=>u.name===i.currentUserSettingsId);return-1!==o?i.userSettings[o]:i.userSettings.sort((u,h)=>u.name.localeCompare(h.name))[0]}get(){const i=sessionStorage.getItem(this.storageKey);if(i){const o=Object.assign(Object.assign({},this.defaultAppSettings),JSON.parse(i));return this.defaultAppSettings.userSettings.forEach(u=>{o.userSettings.find(h=>h.name===u.name)||o.userSettings.push(u)}),o}return Object.assign({},this.defaultAppSettings)}saveAppSettings(i){delete i.librarySettingsDefinition,sessionStorage.setItem(this.storageKey,JSON.stringify(i))}}(`ngx-auth:${uh.i8}:demo-app:settings`,{showTip:!0,currentTabIndex:0,userSettings:((a=!1)=>{const i=((a=!1)=>{const i=[{name:"Auth0",otherSettings:{privateApiUrl:"https://dev-fijd1e9x.us.auth0.com/api/v2/users/auth0|631b171682c639d40cb84d5c",privateApiHeaders:""},librarySettings:{authorityUrl:"https://dev-fijd1e9x.us.auth0.com",clientId:"kRVVEnAWKMpxxpcodl0TqLXfIHgQvmmt",mobileScheme:"demo-app",scope:"openid profile email phone offline_access read:current_user",internal:{extraQueryParams:{audience:"https://dev-fijd1e9x.us.auth0.com/api/v2/"}},desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}},{name:"Zitadel",otherSettings:{privateApiUrl:"",privateApiHeaders:""},librarySettings:{authorityUrl:"https://auth-js-0pdipf.zitadel.cloud",clientId:"178200751804317953@demo-app",mobileScheme:"demo-app",scope:"openid profile email phone offline_access",desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}];return a||i.push({name:"Keycloak (local)",otherSettings:{privateApiUrl:"/api/my-api",privateApiHeaders:""},librarySettings:{authorityUrl:"http://localhost:8080/auth/realms/demo",clientId:"demo-app",mobileScheme:"demo-app",scope:"openid profile email phone",desktopNavigationType:Xt.REDIRECT,logLevel:xn.NONE,loginRequired:!1,retrieveUserSession:!0,loadUserInfo:!0,automaticSilentRenew:!0}}),i})(a),o=[{name:"Auth0",otherSettings:Object.assign(Object.assign({},i[0].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[0].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})},{name:"Zitadel",otherSettings:Object.assign(Object.assign({},i[1].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[1].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})}];return a||o.push({name:"Keycloak (local)",otherSettings:Object.assign(Object.assign({},i[i.length-1].otherSettings),{roles:"view-profile"}),librarySettings:Object.assign(Object.assign({},i[i.length-1].librarySettings),{authGuardRedirectUrl:"/forbidden",automaticLoginOn401:!0,automaticInjectToken:!0})}),o})(true),librarySettingsDefinition:rd});(0,m.G48)(),(()=>{window.appSettings=Rn;const a=document.createElement("div");a.innerHTML="Loading...",document.body.appendChild(a),Rg(Rn.getCurrentUserSettings().librarySettings).then(i=>{a.replaceWith(document.createElement("app-root")),Go([i]).bootstrapModule(Ti).catch(o=>console.error(o))}).catch(i=>{var o;a.innerHTML=`${i.message}
`,null===(o=document.body.querySelector("#loginButton"))||void 0===o||o.addEventListener("click",()=>location.reload(),{once:!0})})})()},9647:Ie=>{function ne(O){return Promise.resolve().then(()=>{var x=new Error("Cannot find module '"+O+"'");throw x.code="MODULE_NOT_FOUND",x})}ne.keys=()=>[],ne.resolve=ne,ne.id=9647,Ie.exports=ne},2480:()=>{},7582:(Ie,ne,O)=>{"use strict";function Q(G,q){var oe={};for(var ie in G)Object.prototype.hasOwnProperty.call(G,ie)&&q.indexOf(ie)<0&&(oe[ie]=G[ie]);if(null!=G&&"function"==typeof Object.getOwnPropertySymbols){var De=0;for(ie=Object.getOwnPropertySymbols(G);De1||ht(_t,Kt)})})}function ht(_t,Kt){try{!function(_t){_t.value instanceof de?Promise.resolve(_t.value.v).then(Pe,Ue):Lt(Ce[0][2],_t)}(ie[_t](Kt))}catch(bt){Lt(Ce[0][3],bt)}}function Pe(_t){ht("next",_t)}function Ue(_t){ht("throw",_t)}function Lt(_t,Kt){_t(Kt),Ce.shift(),Ce.length&&ht(Ce[0][0],Ce[0][1])}}function at(G){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var oe,q=G[Symbol.asyncIterator];return q?q.call(G):(G=function(G){var q="function"==typeof Symbol&&Symbol.iterator,oe=q&&G[q],ie=0;if(oe)return oe.call(G);if(G&&"number"==typeof G.length)return{next:function(){return G&&ie>=G.length&&(G=void 0),{value:G&&G[ie++],done:!G}}};throw new TypeError(q?"Object is not iterable.":"Symbol.iterator is not defined.")}(G),oe={},ie("next"),ie("throw"),ie("return"),oe[Symbol.asyncIterator]=function(){return this},oe);function ie(Ce){oe[Ce]=G[Ce]&&function(Ne){return new Promise(function(ht,qe){!function(Ce,Ne,ht,qe){Promise.resolve(qe).then(function(Pe){Ce({value:Pe,done:ht})},Ne)}(ht,qe,(Ne=G[Ce](Ne)).done,Ne.value)})}}}O.d(ne,{_T:()=>Q,mG:()=>_e,qq:()=>de,FC:()=>he,KL:()=>at}),"function"==typeof SuppressedError&&SuppressedError}},Ie=>{Ie(Ie.s=4159)}]); \ No newline at end of file