@axa-fr/oidc-client 7.26.0 → 7.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ class De {
47
47
  this._timer && (R.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
48
48
  }
49
49
  }
50
- const m = {
50
+ const p = {
51
51
  service_worker_not_supported_by_browser: "service_worker_not_supported_by_browser",
52
52
  token_acquired: "token_acquired",
53
53
  logout_from_another_tab: "logout_from_another_tab",
@@ -76,53 +76,53 @@ const m = {
76
76
  syncTokensAsync_end: "syncTokensAsync_end",
77
77
  syncTokensAsync_error: "syncTokensAsync_error",
78
78
  tokensInvalidAndWaitingActionsToRefresh: "tokensInvalidAndWaitingActionsToRefresh"
79
- }, C = (e, n = sessionStorage) => {
80
- const s = (y) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: y }), delete n[`oidc.${e}.userInfo`], Promise.resolve()), t = async () => {
79
+ }, N = (e, n = sessionStorage) => {
80
+ const s = (g) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: g }), delete n[`oidc.${e}.userInfo`], Promise.resolve()), t = async () => {
81
81
  if (!n[`oidc.${e}`])
82
82
  return n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
83
- const y = JSON.parse(n[`oidc.${e}`]);
84
- return Promise.resolve({ tokens: y.tokens, status: y.status });
85
- }, o = (y) => {
86
- n[`oidc.${e}`] = JSON.stringify({ tokens: y });
87
- }, i = async (y) => {
88
- n[`oidc.session_state.${e}`] = y;
89
- }, r = async () => n[`oidc.session_state.${e}`], a = (y) => {
90
- n[`oidc.nonce.${e}`] = y.nonce;
91
- }, c = (y) => {
92
- n[`oidc.jwk.${e}`] = JSON.stringify(y);
93
- }, u = () => JSON.parse(n[`oidc.jwk.${e}`]), f = async () => ({ nonce: n[`oidc.nonce.${e}`] }), l = async (y) => {
94
- n[`oidc.dpop_nonce.${e}`] = y;
95
- }, d = () => n[`oidc.dpop_nonce.${e}`], _ = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, k = {};
83
+ const g = JSON.parse(n[`oidc.${e}`]);
84
+ return Promise.resolve({ tokens: g.tokens, status: g.status });
85
+ }, o = (g) => {
86
+ n[`oidc.${e}`] = JSON.stringify({ tokens: g });
87
+ }, i = async (g) => {
88
+ n[`oidc.session_state.${e}`] = g;
89
+ }, r = async () => n[`oidc.session_state.${e}`], a = (g) => {
90
+ n[`oidc.nonce.${e}`] = g.nonce;
91
+ }, c = (g) => {
92
+ n[`oidc.jwk.${e}`] = JSON.stringify(g);
93
+ }, _ = () => JSON.parse(n[`oidc.jwk.${e}`]), f = async () => ({ nonce: n[`oidc.nonce.${e}`] }), l = async (g) => {
94
+ n[`oidc.dpop_nonce.${e}`] = g;
95
+ }, d = () => n[`oidc.dpop_nonce.${e}`], u = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, m = {};
96
96
  return {
97
97
  clearAsync: s,
98
98
  initAsync: t,
99
99
  setTokens: o,
100
- getTokens: _,
100
+ getTokens: u,
101
101
  setSessionStateAsync: i,
102
102
  getSessionStateAsync: r,
103
103
  setNonceAsync: a,
104
104
  getNonceAsync: f,
105
- setLoginParams: (y) => {
106
- k[e] = y, n[`oidc.login.${e}`] = JSON.stringify(y);
105
+ setLoginParams: (g) => {
106
+ m[e] = g, n[`oidc.login.${e}`] = JSON.stringify(g);
107
107
  },
108
108
  getLoginParams: () => {
109
- const y = n[`oidc.login.${e}`];
110
- return y ? (k[e] || (k[e] = JSON.parse(y)), k[e]) : (console.warn(
109
+ const g = n[`oidc.login.${e}`];
110
+ return g ? (m[e] || (m[e] = JSON.parse(g)), m[e]) : (console.warn(
111
111
  `storage[oidc.login.${e}] is empty, you should have an bad OIDC or code configuration somewhere.`
112
112
  ), null);
113
113
  },
114
114
  getStateAsync: async () => n[`oidc.state.${e}`],
115
- setStateAsync: async (y) => {
116
- n[`oidc.state.${e}`] = y;
115
+ setStateAsync: async (g) => {
116
+ n[`oidc.state.${e}`] = g;
117
117
  },
118
118
  getCodeVerifierAsync: async () => n[`oidc.code_verifier.${e}`],
119
- setCodeVerifierAsync: async (y) => {
120
- n[`oidc.code_verifier.${e}`] = y;
119
+ setCodeVerifierAsync: async (g) => {
120
+ n[`oidc.code_verifier.${e}`] = g;
121
121
  },
122
122
  setDemonstratingProofOfPossessionNonce: l,
123
123
  getDemonstratingProofOfPossessionNonce: d,
124
124
  setDemonstratingProofOfPossessionJwkAsync: c,
125
- getDemonstratingProofOfPossessionJwkAsync: u
125
+ getDemonstratingProofOfPossessionJwkAsync: _
126
126
  };
127
127
  };
128
128
  var B = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(B || {});
@@ -157,13 +157,13 @@ const oe = (e, n = null, s) => {
157
157
  n != null && "idToken" in n && !("idToken" in e) ? i = n.idToken : i = e.idToken;
158
158
  const r = e.idTokenPayload ? e.idTokenPayload : he(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, c = t && t.exp ? t.exp : e.issuedAt + o;
159
159
  e.issuedAt = Ue(e, t, r);
160
- let u;
161
- e.expiresAt ? u = e.expiresAt : s === Q.access_token_invalid ? u = c : s === Q.id_token_invalid ? u = a : u = a < c ? a : c;
160
+ let _;
161
+ e.expiresAt ? _ = e.expiresAt : s === Q.access_token_invalid ? _ = c : s === Q.id_token_invalid ? _ = a : _ = a < c ? a : c;
162
162
  const f = {
163
163
  ...e,
164
164
  idTokenPayload: r,
165
165
  accessTokenPayload: t,
166
- expiresAt: u,
166
+ expiresAt: _,
167
167
  idToken: i
168
168
  };
169
169
  if (n != null && "refreshToken" in n && !("refreshToken" in e)) {
@@ -223,7 +223,7 @@ const oe = (e, n = null, s) => {
223
223
  isValid: !1,
224
224
  reason: `Token expired (idTokenPayload exp) ${t.exp} < (currentTimeUnixSecond) ${o}`
225
225
  };
226
- const i = 60 * 60 * 24 * 7;
226
+ const i = 3600 * 24 * 7;
227
227
  if (t.iat && t.iat + i < o)
228
228
  return {
229
229
  isValid: !1,
@@ -236,7 +236,7 @@ const oe = (e, n = null, s) => {
236
236
  };
237
237
  }
238
238
  return { isValid: !0, reason: "" };
239
- }, U = function() {
239
+ }, U = (function() {
240
240
  const e = typeof window > "u" ? global : window;
241
241
  return {
242
242
  setTimeout: setTimeout.bind(e),
@@ -244,8 +244,8 @@ const oe = (e, n = null, s) => {
244
244
  setInterval: setInterval.bind(e),
245
245
  clearInterval: clearInterval.bind(e)
246
246
  };
247
- }(), Y = "7.26.0";
248
- let ye = null, G;
247
+ })(), Y = "7.26.3";
248
+ let ge = null, G;
249
249
  const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te = (e = "/") => {
250
250
  try {
251
251
  G = new AbortController(), fetch(
@@ -268,11 +268,11 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
268
268
  }, b = (e) => (n) => new Promise(function(s, t) {
269
269
  const o = new MessageChannel();
270
270
  o.port1.onmessage = function(i) {
271
- i != null && i.data.error ? t(i.data.error) : s(i.data), o.port1.close(), o.port2.close();
271
+ i?.data.error ? t(i.data.error) : s(i.data), o.port1.close(), o.port2.close();
272
272
  }, e.active.postMessage({ ...n, tabId: ve(n.configurationName) }, [
273
273
  o.port2
274
274
  ]);
275
- }), x = async (e, n) => {
275
+ }), C = async (e, n) => {
276
276
  const s = e.service_worker_relative_url;
277
277
  if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !s || e.service_worker_activate() === !1)
278
278
  return null;
@@ -282,7 +282,7 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
282
282
  updateViaCache: "none"
283
283
  }), o.addEventListener("updatefound", () => {
284
284
  const h = o.installing;
285
- X(), h == null || h.addEventListener("statechange", () => {
285
+ X(), h?.addEventListener("statechange", () => {
286
286
  h.state === "installed" && navigator.serviceWorker.controller && (X(), console.log("New SW waiting – skipWaiting()"), h.postMessage({ type: "SKIP_WAITING" }));
287
287
  });
288
288
  }), navigator.serviceWorker.addEventListener("controllerchange", () => {
@@ -293,12 +293,12 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
293
293
  } catch (h) {
294
294
  return console.warn(`Failed init ServiceWorker ${h.toString()}`), null;
295
295
  }
296
- const i = async (h) => b(o)({ type: "clear", data: { status: h }, configurationName: n }), r = async (h, I, T) => {
296
+ const i = async (h) => b(o)({ type: "clear", data: { status: h }, configurationName: n }), r = async (h, L, T) => {
297
297
  const v = await b(o)({
298
298
  type: "init",
299
299
  data: {
300
300
  oidcServerConfiguration: h,
301
- where: I,
301
+ where: L,
302
302
  oidcConfiguration: {
303
303
  token_renew_mode: T.token_renew_mode,
304
304
  service_worker_convert_all_requests_to_cors: T.service_worker_convert_all_requests_to_cors
@@ -313,12 +313,12 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
313
313
  status: v.status
314
314
  };
315
315
  }, a = (h = "/") => {
316
- ye == null && (ye = "not_null", Te(h));
316
+ ge == null && (ge = "not_null", Te(h));
317
317
  }, c = (h) => b(o)({
318
318
  type: "setSessionState",
319
319
  data: { sessionState: h },
320
320
  configurationName: n
321
- }), u = async () => (await b(o)({
321
+ }), _ = async () => (await b(o)({
322
322
  type: "getSessionState",
323
323
  data: null,
324
324
  configurationName: n
@@ -333,53 +333,53 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
333
333
  configurationName: n
334
334
  })).nonce;
335
335
  return T || (T = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), h && (await f(T), T = (await l(!1)).nonce)), { nonce: T };
336
- }, d = {}, _ = (h) => {
336
+ }, d = {}, u = (h) => {
337
337
  d[n] = h, localStorage[`oidc.login.${n}`] = JSON.stringify(h);
338
- }, k = () => {
338
+ }, m = () => {
339
339
  const h = localStorage[`oidc.login.${n}`];
340
340
  return d[n] || (d[n] = JSON.parse(h)), d[n];
341
- }, A = async (h) => {
341
+ }, w = async (h) => {
342
342
  await b(o)({
343
343
  type: "setDemonstratingProofOfPossessionNonce",
344
344
  data: { demonstratingProofOfPossessionNonce: h },
345
345
  configurationName: n
346
346
  });
347
- }, g = async () => (await b(o)({
347
+ }, y = async () => (await b(o)({
348
348
  type: "getDemonstratingProofOfPossessionNonce",
349
349
  data: null,
350
350
  configurationName: n
351
- })).demonstratingProofOfPossessionNonce, p = async (h) => {
352
- const I = JSON.stringify(h);
351
+ })).demonstratingProofOfPossessionNonce, k = async (h) => {
352
+ const L = JSON.stringify(h);
353
353
  await b(o)({
354
354
  type: "setDemonstratingProofOfPossessionJwk",
355
- data: { demonstratingProofOfPossessionJwkJson: I },
355
+ data: { demonstratingProofOfPossessionJwkJson: L },
356
356
  configurationName: n
357
357
  });
358
- }, E = async () => {
358
+ }, A = async () => {
359
359
  const h = await b(o)({
360
360
  type: "getDemonstratingProofOfPossessionJwk",
361
361
  data: null,
362
362
  configurationName: n
363
363
  });
364
364
  return h.demonstratingProofOfPossessionJwkJson ? JSON.parse(h.demonstratingProofOfPossessionJwkJson) : null;
365
- }, w = async (h = !0) => {
365
+ }, S = async (h = !0) => {
366
366
  let T = (await b(o)({
367
367
  type: "getState",
368
368
  data: null,
369
369
  configurationName: n
370
370
  })).state;
371
- return T || (T = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), h && (await S(T), T = await w(!1))), T;
372
- }, S = async (h) => (sessionStorage[`oidc.state.${n}`] = h, b(o)({
371
+ return T || (T = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), h && (await E(T), T = await S(!1))), T;
372
+ }, E = async (h) => (sessionStorage[`oidc.state.${n}`] = h, b(o)({
373
373
  type: "setState",
374
374
  data: { state: h },
375
375
  configurationName: n
376
- })), y = async (h = !0) => {
376
+ })), g = async (h = !0) => {
377
377
  let T = (await b(o)({
378
378
  type: "getCodeVerifier",
379
379
  data: null,
380
380
  configurationName: n
381
381
  })).codeVerifier;
382
- return T || (T = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), h && (await P(T), T = await y(!1))), T;
382
+ return T || (T = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), h && (await P(T), T = await g(!1))), T;
383
383
  }, P = async (h) => (sessionStorage[`oidc.code_verifier.${n}`] = h, b(o)({
384
384
  type: "setCodeVerifier",
385
385
  data: { codeVerifier: h },
@@ -390,19 +390,19 @@ const re = ({ milliseconds: e }) => new Promise((n) => U.setTimeout(n, e)), Te =
390
390
  initAsync: r,
391
391
  startKeepAliveServiceWorker: () => a(e.service_worker_keep_alive_path),
392
392
  setSessionStateAsync: c,
393
- getSessionStateAsync: u,
393
+ getSessionStateAsync: _,
394
394
  setNonceAsync: f,
395
395
  getNonceAsync: l,
396
- setLoginParams: _,
397
- getLoginParams: k,
398
- getStateAsync: w,
399
- setStateAsync: S,
400
- getCodeVerifierAsync: y,
396
+ setLoginParams: u,
397
+ getLoginParams: m,
398
+ getStateAsync: S,
399
+ setStateAsync: E,
400
+ getCodeVerifierAsync: g,
401
401
  setCodeVerifierAsync: P,
402
- setDemonstratingProofOfPossessionNonce: A,
403
- getDemonstratingProofOfPossessionNonce: g,
404
- setDemonstratingProofOfPossessionJwkAsync: p,
405
- getDemonstratingProofOfPossessionJwkAsync: E
402
+ setDemonstratingProofOfPossessionNonce: w,
403
+ getDemonstratingProofOfPossessionNonce: y,
404
+ setDemonstratingProofOfPossessionJwkAsync: k,
405
+ getDemonstratingProofOfPossessionJwkAsync: A
406
406
  };
407
407
  }, $ = {}, Fe = (e, n = window.sessionStorage, s) => {
408
408
  if (!$[e] && n) {
@@ -432,7 +432,7 @@ const ae = (e) => {
432
432
  n += String.fromCharCode(s);
433
433
  }), Oe(n);
434
434
  };
435
- function ge(e) {
435
+ function ye(e) {
436
436
  return Oe(Me(e));
437
437
  }
438
438
  const Je = {
@@ -462,12 +462,12 @@ const Je = {
462
462
  const r = {
463
463
  // @ts-ignore
464
464
  // JWT "headers" really means JWS "protected headers"
465
- protected: ge(JSON.stringify(s)),
465
+ protected: ye(JSON.stringify(s)),
466
466
  // @ts-ignore
467
467
  // JWT "claims" are really a JSON-defined JWS "payload"
468
- payload: ge(JSON.stringify(t))
469
- }, a = o.importKeyAlgorithm, c = !0, u = ["sign"], f = await e.crypto.subtle.importKey("jwk", n, a, c, u), l = Ee(`${r.protected}.${r.payload}`), d = o.signAlgorithm, _ = await e.crypto.subtle.sign(d, f, l);
470
- return r.signature = ae(new Uint8Array(_)), `${r.protected}.${r.payload}.${r.signature}`;
468
+ payload: ye(JSON.stringify(t))
469
+ }, a = o.importKeyAlgorithm, c = !0, _ = ["sign"], f = await e.crypto.subtle.importKey("jwk", n, a, c, _), l = Ee(`${r.protected}.${r.payload}`), d = o.signAlgorithm, u = await e.crypto.subtle.sign(d, f, l);
470
+ return r.signature = ae(new Uint8Array(u)), `${r.protected}.${r.payload}.${r.signature}`;
471
471
  }, je = { sign: He }, Ge = (e) => async (n) => {
472
472
  const s = n, t = !0, o = ["sign", "verify"], i = await e.crypto.subtle.generateKey(s, t, o);
473
473
  return await e.crypto.subtle.exportKey("jwk", i.privateKey);
@@ -553,15 +553,15 @@ const sn = (e) => {
553
553
  return Promise.reject(new Error("Invalid code length."));
554
554
  const { hasSubtleCrypto: n } = Pe();
555
555
  return n ? Ie(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
556
- }, tn = 60 * 60, on = (e) => async (n, s = tn, t = window.sessionStorage, o = 1e4) => {
556
+ }, tn = 3600, on = (e) => async (n, s = tn, t = window.sessionStorage, o = 1e4) => {
557
557
  const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a = Fe(r, t, s);
558
558
  if (a)
559
559
  return new te(a);
560
560
  const c = await J(e)(i, {}, o);
561
561
  if (c.status !== 200)
562
562
  return null;
563
- const u = await c.json();
564
- return Be(r, u, t), new te(u);
563
+ const _ = await c.json();
564
+ return Be(r, _, t), new te(_);
565
565
  }, J = (e) => async (n, s = {}, t = 1e4, o = 0) => {
566
566
  let i;
567
567
  try {
@@ -589,10 +589,10 @@ const sn = (e) => {
589
589
  a[l] === void 0 && (a[l] = d);
590
590
  const c = [];
591
591
  for (const l in a) {
592
- const d = encodeURIComponent(l), _ = encodeURIComponent(a[l]);
593
- c.push(`${d}=${_}`);
592
+ const d = encodeURIComponent(l), u = encodeURIComponent(a[l]);
593
+ c.push(`${d}=${u}`);
594
594
  }
595
- const u = c.join("&");
595
+ const _ = c.join("&");
596
596
  return (await J(e)(
597
597
  n,
598
598
  {
@@ -600,21 +600,21 @@ const sn = (e) => {
600
600
  headers: {
601
601
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
602
602
  },
603
- body: u
603
+ body: _
604
604
  },
605
605
  r
606
606
  )).status !== 200 ? { success: !1 } : {
607
607
  success: !0
608
608
  };
609
609
  }, rn = (e) => async (n, s, t, o, i = {}, r, a = 1e4) => {
610
- for (const [_, k] of Object.entries(t))
611
- s[_] === void 0 && (s[_] = k);
610
+ for (const [u, m] of Object.entries(t))
611
+ s[u] === void 0 && (s[u] = m);
612
612
  const c = [];
613
- for (const _ in s) {
614
- const k = encodeURIComponent(_), A = encodeURIComponent(s[_]);
615
- c.push(`${k}=${A}`);
613
+ for (const u in s) {
614
+ const m = encodeURIComponent(u), w = encodeURIComponent(s[u]);
615
+ c.push(`${m}=${w}`);
616
616
  }
617
- const u = c.join("&"), f = await J(e)(
617
+ const _ = c.join("&"), f = await J(e)(
618
618
  n,
619
619
  {
620
620
  method: "POST",
@@ -622,7 +622,7 @@ const sn = (e) => {
622
622
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
623
623
  ...i
624
624
  },
625
- body: u
625
+ body: _
626
626
  },
627
627
  a
628
628
  );
@@ -655,8 +655,8 @@ const sn = (e) => {
655
655
  s = s ? { ...s } : {}, s.code_verifier = await e.getCodeVerifierAsync();
656
656
  const r = [];
657
657
  for (const l in s) {
658
- const d = encodeURIComponent(l), _ = encodeURIComponent(s[l]);
659
- r.push(`${d}=${_}`);
658
+ const d = encodeURIComponent(l), u = encodeURIComponent(s[l]);
659
+ r.push(`${d}=${u}`);
660
660
  }
661
661
  const a = r.join("&"), c = await J(fetch)(
662
662
  n,
@@ -672,8 +672,8 @@ const sn = (e) => {
672
672
  );
673
673
  if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), c.status !== 200)
674
674
  return { success: !1, status: c.status };
675
- let u = null;
676
- c.headers.has(q) && (u = c.headers.get(
675
+ let _ = null;
676
+ c.headers.has(q) && (_ = c.headers.get(
677
677
  q
678
678
  ));
679
679
  const f = await c.json();
@@ -682,7 +682,7 @@ const sn = (e) => {
682
682
  data: {
683
683
  state: s.state,
684
684
  tokens: ie(f, null, o),
685
- demonstratingProofOfPossessionNonce: u
685
+ demonstratingProofOfPossessionNonce: _
686
686
  }
687
687
  };
688
688
  };
@@ -697,13 +697,13 @@ async function me(e, n, s, t = null) {
697
697
  s,
698
698
  t
699
699
  );
700
- return await x(e.configuration, e.configurationName) || C(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
700
+ return await C(e.configuration, e.configurationName) || N(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
701
701
  }
702
702
  async function Ne(e, n = !1, s = null, t = null) {
703
703
  const o = e.configuration, i = `${o.client_id}_${e.configurationName}_${o.authority}`;
704
704
  let r;
705
- const a = await x(e.configuration, e.configurationName);
706
- if ((o == null ? void 0 : o.storage) === (window == null ? void 0 : window.sessionStorage) && !a || !navigator.locks)
705
+ const a = await C(e.configuration, e.configurationName);
706
+ if (o?.storage === window?.sessionStorage && !a || !navigator.locks)
707
707
  r = await me(e, n, s, t);
708
708
  else {
709
709
  let c = "retry";
@@ -711,7 +711,7 @@ async function Ne(e, n = !1, s = null, t = null) {
711
711
  c = await navigator.locks.request(
712
712
  i,
713
713
  { ifAvailable: !0 },
714
- async (u) => u ? await me(e, n, s, t) : (e.publishEvent(L.eventNames.syncTokensAsync_lock_not_available, {
714
+ async (_) => _ ? await me(e, n, s, t) : (e.publishEvent(x.eventNames.syncTokensAsync_lock_not_available, {
715
715
  lock: "lock not available"
716
716
  }), "retry")
717
717
  );
@@ -723,7 +723,7 @@ const M = (e, n, s = null, t = null) => {
723
723
  const o = e.configuration.refresh_time_before_tokens_expiration_in_second;
724
724
  return e.timeoutId && U.clearTimeout(e.timeoutId), U.setTimeout(async () => {
725
725
  const r = { timeLeft: V(o, n) };
726
- e.publishEvent(L.eventNames.token_timer, r), await Ne(e, !1, s, t);
726
+ e.publishEvent(x.eventNames.token_timer, r), await Ne(e, !1, s, t);
727
727
  }, 1e3);
728
728
  }, O = {
729
729
  FORCE_REFRESH: "FORCE_REFRESH",
@@ -743,7 +743,7 @@ const M = (e, n, s = null, t = null) => {
743
743
  const a = await e.initAsync(
744
744
  n.authority,
745
745
  n.authority_configuration
746
- ), c = await x(n, s);
746
+ ), c = await C(n, s);
747
747
  if (c) {
748
748
  const { status: l, tokens: d } = await c.initAsync(
749
749
  a,
@@ -765,26 +765,26 @@ const M = (e, n, s = null, t = null) => {
765
765
  nonce: i
766
766
  };
767
767
  if (d.issuedAt !== t.issuedAt) {
768
- const k = V(
768
+ const m = V(
769
769
  n.refresh_time_before_tokens_expiration_in_second,
770
770
  d.expiresAt
771
- ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, A = await c.getNonceAsync();
772
- return { tokens: d, status: k, nonce: A };
771
+ ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, w = await c.getNonceAsync();
772
+ return { tokens: d, status: m, nonce: w };
773
773
  }
774
774
  r = await c.getNonceAsync();
775
775
  } else {
776
- const l = C(s, n.storage ?? sessionStorage), d = await l.initAsync();
777
- let { tokens: _ } = d;
778
- const { status: k } = d;
779
- if (_ && (_ = oe(_, e.tokens, n.token_renew_mode)), _) {
780
- if (k === "SESSIONS_LOST")
776
+ const l = N(s, n.storage ?? sessionStorage), d = await l.initAsync();
777
+ let { tokens: u } = d;
778
+ const { status: m } = d;
779
+ if (u && (u = oe(u, e.tokens, n.token_renew_mode)), u) {
780
+ if (m === "SESSIONS_LOST")
781
781
  return { tokens: null, status: O.SESSION_LOST, nonce: i };
782
- if (_.issuedAt !== t.issuedAt) {
783
- const g = V(
782
+ if (u.issuedAt !== t.issuedAt) {
783
+ const y = V(
784
784
  n.refresh_time_before_tokens_expiration_in_second,
785
- _.expiresAt
786
- ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, p = await l.getNonceAsync();
787
- return { tokens: _, status: g, nonce: p };
785
+ u.expiresAt
786
+ ) > 0 ? O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, k = await l.getNonceAsync();
787
+ return { tokens: u, status: y, nonce: k };
788
788
  }
789
789
  } else return {
790
790
  tokens: null,
@@ -802,42 +802,42 @@ const M = (e, n, s = null, t = null) => {
802
802
  if (!navigator.onLine && document.hidden)
803
803
  return { tokens: e.tokens, status: "GIVE_UP" };
804
804
  let a = 6;
805
- const c = o ? 2 : 5, u = 5;
805
+ const c = o ? 2 : 5, _ = 5;
806
806
  for (; !navigator.onLine && a > 0; )
807
- await re({ milliseconds: 1e3 }), a--, e.publishEvent(m.refreshTokensAsync, {
807
+ await re({ milliseconds: 1e3 }), a--, e.publishEvent(p.refreshTokensAsync, {
808
808
  message: `wait because navigator is offline try ${a}`
809
809
  });
810
810
  const f = document.hidden, l = f ? s : s + 1, d = f ? t + 1 : t;
811
- if (s >= c || t >= u)
812
- return n(null), e.publishEvent(m.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
811
+ if (s >= c || t >= _)
812
+ return n(null), e.publishEvent(p.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
813
813
  i || (i = {});
814
- const _ = e.configuration, k = (g, p = null, E = null) => le(
814
+ const u = e.configuration, m = (y, k = null, A = null) => le(
815
815
  e.configurationName,
816
816
  e.configuration,
817
817
  e.publishEvent.bind(e)
818
- )(g, p, E), A = async () => {
818
+ )(y, k, A), w = async () => {
819
819
  try {
820
- let g;
821
- const p = await x(_, e.configurationName);
822
- p ? g = p.getLoginParams() : g = C(e.configurationName, _.storage).getLoginParams();
823
- const E = {};
824
- if (g && g.extras)
825
- for (const [S, y] of Object.entries(g.extras))
826
- E[S] = y;
820
+ let y;
821
+ const k = await C(u, e.configurationName);
822
+ k ? y = k.getLoginParams() : y = N(e.configurationName, u.storage).getLoginParams();
823
+ const A = {};
824
+ if (y && y.extras)
825
+ for (const [E, g] of Object.entries(y.extras))
826
+ A[E] = g;
827
827
  if (i)
828
- for (const [S, y] of Object.entries(i))
829
- E[S] = y;
830
- E.prompt = "none", r && (E.scope = r);
831
- const w = await k(E);
832
- return w ? w.error ? (n(null), e.publishEvent(m.refreshTokensAsync_error, {
828
+ for (const [E, g] of Object.entries(i))
829
+ A[E] = g;
830
+ A.prompt = "none", r && (A.scope = r);
831
+ const S = await m(A);
832
+ return S ? S.error ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
833
833
  message: "refresh token silent"
834
- }), { tokens: null, status: "SESSION_LOST" }) : (n(w.tokens), e.publishEvent(L.eventNames.token_renewed, {}), { tokens: w.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(m.refreshTokensAsync_error, {
834
+ }), { tokens: null, status: "SESSION_LOST" }) : (n(S.tokens), e.publishEvent(x.eventNames.token_renewed, {}), { tokens: S.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(p.refreshTokensAsync_error, {
835
835
  message: "refresh token silent not active"
836
836
  }), { tokens: null, status: "SESSION_LOST" });
837
- } catch (g) {
838
- return console.error(g), e.publishEvent(m.refreshTokensAsync_silent_error, {
837
+ } catch (y) {
838
+ return console.error(y), e.publishEvent(p.refreshTokensAsync_silent_error, {
839
839
  message: "exceptionSilent",
840
- exception: g.message
840
+ exception: y.message
841
841
  }), await H(e)(
842
842
  n,
843
843
  l,
@@ -849,95 +849,95 @@ const M = (e, n, s = null, t = null) => {
849
849
  }
850
850
  };
851
851
  try {
852
- const { status: g, tokens: p, nonce: E } = await ce(e)(
853
- _,
852
+ const { status: y, tokens: k, nonce: A } = await ce(e)(
853
+ u,
854
854
  e.configurationName,
855
855
  e.tokens,
856
856
  o
857
857
  );
858
- switch (g) {
858
+ switch (y) {
859
859
  case O.SESSION_LOST:
860
- return n(null), e.publishEvent(m.refreshTokensAsync_error, {
860
+ return n(null), e.publishEvent(p.refreshTokensAsync_error, {
861
861
  message: "refresh token session lost"
862
862
  }), { tokens: null, status: "SESSION_LOST" };
863
863
  case O.NOT_CONNECTED:
864
864
  return n(null), { tokens: null, status: null };
865
865
  case O.TOKENS_VALID:
866
- return n(p), { tokens: p, status: "LOGGED_IN" };
866
+ return n(k), { tokens: k, status: "LOGGED_IN" };
867
867
  case O.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
868
- return n(p), e.publishEvent(L.eventNames.token_renewed, {
868
+ return n(k), e.publishEvent(x.eventNames.token_renewed, {
869
869
  reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"
870
- }), { tokens: p, status: "LOGGED_IN" };
870
+ }), { tokens: k, status: "LOGGED_IN" };
871
871
  case O.LOGOUT_FROM_ANOTHER_TAB:
872
- return n(null), e.publishEvent(m.logout_from_another_tab, {
872
+ return n(null), e.publishEvent(p.logout_from_another_tab, {
873
873
  status: "session syncTokensAsync"
874
874
  }), { tokens: null, status: "LOGGED_OUT" };
875
875
  case O.REQUIRE_SYNC_TOKENS:
876
- return _.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(m.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(m.refreshTokensAsync_begin, { tryNumber: s }), await A());
876
+ return u.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(p.refreshTokensAsync_begin, { tryNumber: s }), await w());
877
877
  default: {
878
- if (_.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && O.FORCE_REFRESH !== g)
879
- return e.publishEvent(m.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
880
- if (e.publishEvent(m.refreshTokensAsync_begin, {
881
- refreshToken: p.refreshToken,
882
- status: g,
878
+ if (u.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && O.FORCE_REFRESH !== y)
879
+ return e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
880
+ if (e.publishEvent(p.refreshTokensAsync_begin, {
881
+ refreshToken: k.refreshToken,
882
+ status: y,
883
883
  tryNumber: s,
884
884
  backgroundTry: t
885
- }), !p.refreshToken)
886
- return await A();
887
- const w = _.client_id, S = _.redirect_uri, y = _.authority, h = { ..._.token_request_extras ? _.token_request_extras : {} };
885
+ }), !k.refreshToken)
886
+ return await w();
887
+ const S = u.client_id, E = u.redirect_uri, g = u.authority, h = { ...u.token_request_extras ? u.token_request_extras : {} };
888
888
  for (const [T, v] of Object.entries(i))
889
889
  T.endsWith(":token_request") && (h[T.replace(":token_request", "")] = v);
890
890
  return await (async () => {
891
891
  const T = {
892
- client_id: w,
893
- redirect_uri: S,
892
+ client_id: S,
893
+ redirect_uri: E,
894
894
  grant_type: "refresh_token",
895
- refresh_token: p.refreshToken
895
+ refresh_token: k.refreshToken
896
896
  }, v = await e.initAsync(
897
- y,
898
- _.authority_configuration
897
+ g,
898
+ u.authority_configuration
899
899
  ), W = document.hidden ? 1e4 : 3e4 * 10, ue = v.tokenEndpoint, _e = {};
900
- _.demonstrating_proof_of_possession && (_e.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
901
- p.accessToken,
900
+ u.demonstrating_proof_of_possession && (_e.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
901
+ k.accessToken,
902
902
  ue,
903
903
  "POST"
904
904
  ));
905
- const N = await rn(e.getFetch())(
905
+ const I = await rn(e.getFetch())(
906
906
  ue,
907
907
  T,
908
908
  h,
909
- p,
909
+ k,
910
910
  _e,
911
- _.token_renew_mode,
911
+ u.token_renew_mode,
912
912
  W
913
913
  );
914
- if (N.success) {
914
+ if (I.success) {
915
915
  const { isValid: Le, reason: We } = Se(
916
- N.data,
917
- E.nonce,
916
+ I.data,
917
+ A.nonce,
918
918
  v
919
919
  );
920
920
  if (!Le)
921
- return n(null), e.publishEvent(m.refreshTokensAsync_error, {
921
+ return n(null), e.publishEvent(p.refreshTokensAsync_error, {
922
922
  message: `refresh token return not valid tokens, reason: ${We}`
923
923
  }), { tokens: null, status: "SESSION_LOST" };
924
- if (n(N.data), N.demonstratingProofOfPossessionNonce) {
925
- const fe = await x(_, e.configurationName);
924
+ if (n(I.data), I.demonstratingProofOfPossessionNonce) {
925
+ const fe = await C(u, e.configurationName);
926
926
  fe ? await fe.setDemonstratingProofOfPossessionNonce(
927
- N.demonstratingProofOfPossessionNonce
928
- ) : await C(e.configurationName, _.storage).setDemonstratingProofOfPossessionNonce(
929
- N.demonstratingProofOfPossessionNonce
927
+ I.demonstratingProofOfPossessionNonce
928
+ ) : await N(e.configurationName, u.storage).setDemonstratingProofOfPossessionNonce(
929
+ I.demonstratingProofOfPossessionNonce
930
930
  );
931
931
  }
932
- return e.publishEvent(m.refreshTokensAsync_end, {
933
- success: N.success
934
- }), e.publishEvent(L.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: N.data, status: "LOGGED_IN" };
932
+ return e.publishEvent(p.refreshTokensAsync_end, {
933
+ success: I.success
934
+ }), e.publishEvent(x.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: I.data, status: "LOGGED_IN" };
935
935
  } else
936
- return e.publishEvent(m.refreshTokensAsync_silent_error, {
936
+ return e.publishEvent(p.refreshTokensAsync_silent_error, {
937
937
  message: "bad request",
938
- tokenResponse: N
939
- }), N.status >= 400 && N.status < 500 ? (n(null), e.publishEvent(m.refreshTokensAsync_error, {
940
- message: `session lost: ${N.status}`
938
+ tokenResponse: I
939
+ }), I.status >= 400 && I.status < 500 ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
940
+ message: `session lost: ${I.status}`
941
941
  }), { tokens: null, status: "SESSION_LOST" }) : await H(e)(
942
942
  n,
943
943
  l,
@@ -949,11 +949,11 @@ const M = (e, n, s = null, t = null) => {
949
949
  })();
950
950
  }
951
951
  }
952
- } catch (g) {
953
- return console.error(g), e.publishEvent(m.refreshTokensAsync_silent_error, {
952
+ } catch (y) {
953
+ return console.error(y), e.publishEvent(p.refreshTokensAsync_silent_error, {
954
954
  message: "exception",
955
- exception: g.message
956
- }), new Promise((p, E) => {
955
+ exception: y.message
956
+ }), new Promise((k, A) => {
957
957
  setTimeout(() => {
958
958
  H(e)(
959
959
  n,
@@ -962,7 +962,7 @@ const M = (e, n, s = null, t = null) => {
962
962
  o,
963
963
  i,
964
964
  r
965
- ).then(p).catch(E);
965
+ ).then(k).catch(A);
966
966
  }, 1e3);
967
967
  });
968
968
  }
@@ -970,115 +970,115 @@ const M = (e, n, s = null, t = null) => {
970
970
  if (!n.silent_redirect_uri || !n.silent_login_uri)
971
971
  return Promise.resolve(null);
972
972
  try {
973
- s(m.silentLoginAsync_begin, {});
973
+ s(p.silentLoginAsync_begin, {});
974
974
  let r = "";
975
975
  if (o && (t == null && (t = {}), t.state = o), i != null && (t == null && (t = {}), t.scope = i), t != null)
976
976
  for (const [l, d] of Object.entries(t))
977
977
  r === "" ? r = `?${encodeURIComponent(l)}=${encodeURIComponent(d)}` : r += `&${encodeURIComponent(l)}=${encodeURIComponent(d)}`;
978
- const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2), u = a.substring(0, c), f = document.createElement("iframe");
978
+ const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2), _ = a.substring(0, c), f = document.createElement("iframe");
979
979
  return f.width = "0px", f.height = "0px", f.id = `${e}_oidc_iframe`, f.setAttribute("src", a), f.style.display = "none", document.body.appendChild(f), new Promise((l, d) => {
980
- let _ = !1;
981
- const k = () => {
982
- window.removeEventListener("message", A), f.remove(), _ = !0;
983
- }, A = (g) => {
984
- if (g.origin === u && g.source === f.contentWindow) {
985
- const p = `${e}_oidc_tokens:`, E = `${e}_oidc_error:`, w = `${e}_oidc_exception:`, S = g.data;
986
- if (S && typeof S == "string" && !_) {
987
- if (S.startsWith(p)) {
988
- const y = JSON.parse(g.data.replace(p, ""));
989
- s(m.silentLoginAsync_end, {}), l(y), k();
990
- } else if (S.startsWith(E)) {
991
- const y = JSON.parse(g.data.replace(E, ""));
992
- s(m.silentLoginAsync_error, y), l({ error: "oidc_" + y.error, tokens: null, sessionState: null }), k();
993
- } else if (S.startsWith(w)) {
994
- const y = JSON.parse(g.data.replace(w, ""));
995
- s(m.silentLoginAsync_error, y), d(new Error(y.error)), k();
980
+ let u = !1;
981
+ const m = () => {
982
+ window.removeEventListener("message", w), f.remove(), u = !0;
983
+ }, w = (y) => {
984
+ if (y.origin === _ && y.source === f.contentWindow) {
985
+ const k = `${e}_oidc_tokens:`, A = `${e}_oidc_error:`, S = `${e}_oidc_exception:`, E = y.data;
986
+ if (E && typeof E == "string" && !u) {
987
+ if (E.startsWith(k)) {
988
+ const g = JSON.parse(y.data.replace(k, ""));
989
+ s(p.silentLoginAsync_end, {}), l(g), m();
990
+ } else if (E.startsWith(A)) {
991
+ const g = JSON.parse(y.data.replace(A, ""));
992
+ s(p.silentLoginAsync_error, g), l({ error: "oidc_" + g.error, tokens: null, sessionState: null }), m();
993
+ } else if (E.startsWith(S)) {
994
+ const g = JSON.parse(y.data.replace(S, ""));
995
+ s(p.silentLoginAsync_error, g), d(new Error(g.error)), m();
996
996
  }
997
997
  }
998
998
  }
999
999
  };
1000
1000
  try {
1001
- window.addEventListener("message", A);
1002
- const g = n.silent_login_timeout;
1001
+ window.addEventListener("message", w);
1002
+ const y = n.silent_login_timeout;
1003
1003
  setTimeout(() => {
1004
- _ || (k(), s(m.silentLoginAsync_error, { reason: "timeout" }), d(new Error("timeout")));
1005
- }, g);
1006
- } catch (g) {
1007
- k(), s(m.silentLoginAsync_error, g), d(g);
1004
+ u || (m(), s(p.silentLoginAsync_error, { reason: "timeout" }), d(new Error("timeout")));
1005
+ }, y);
1006
+ } catch (y) {
1007
+ m(), s(p.silentLoginAsync_error, y), d(y);
1008
1008
  }
1009
1009
  });
1010
1010
  } catch (r) {
1011
- throw s(m.silentLoginAsync_error, r), r;
1011
+ throw s(p.silentLoginAsync_error, r), r;
1012
1012
  }
1013
1013
  }, ln = (e, n, s, t, o) => (i = null, r = void 0) => {
1014
1014
  i = { ...i };
1015
- const a = (u, f, l) => le(n, s, t.bind(o))(
1016
- u,
1015
+ const a = (_, f, l) => le(n, s, t.bind(o))(
1016
+ _,
1017
1017
  f,
1018
1018
  l
1019
1019
  );
1020
1020
  return (async () => {
1021
1021
  o.timeoutId && U.clearTimeout(o.timeoutId);
1022
- let u;
1023
- i && "state" in i && (u = i.state, delete i.state);
1022
+ let _;
1023
+ i && "state" in i && (_ = i.state, delete i.state);
1024
1024
  try {
1025
1025
  const f = s.extras ? { ...s.extras, ...i } : i, l = await a(
1026
1026
  {
1027
1027
  ...f,
1028
1028
  prompt: "none"
1029
1029
  },
1030
- u,
1030
+ _,
1031
1031
  r
1032
1032
  );
1033
1033
  if (l)
1034
- return o.tokens = l.tokens, t(m.token_acquired, {}), o.timeoutId = M(o, o.tokens.expiresAt, i, r), {};
1034
+ return o.tokens = l.tokens, t(p.token_acquired, {}), o.timeoutId = M(o, o.tokens.expiresAt, i, r), {};
1035
1035
  } catch (f) {
1036
1036
  return f;
1037
1037
  }
1038
1038
  })();
1039
1039
  }, un = (e, n, s) => (t, o, i, r = !1) => {
1040
- const a = (c, u = void 0, f = void 0) => le(e.configurationName, s, e.publishEvent.bind(e))(
1040
+ const a = (c, _ = void 0, f = void 0) => le(e.configurationName, s, e.publishEvent.bind(e))(
1041
1041
  c,
1042
- u,
1042
+ _,
1043
1043
  f
1044
1044
  );
1045
- return new Promise((c, u) => {
1045
+ return new Promise((c, _) => {
1046
1046
  if (s.silent_login_uri && s.silent_redirect_uri && s.monitor_session && t && i && !r) {
1047
1047
  const f = () => {
1048
1048
  e.checkSessionIFrame.stop();
1049
1049
  const l = e.tokens;
1050
1050
  if (l === null)
1051
1051
  return;
1052
- const d = l.idToken, _ = l.idTokenPayload;
1052
+ const d = l.idToken, u = l.idTokenPayload;
1053
1053
  return a({
1054
1054
  prompt: "none",
1055
1055
  id_token_hint: d,
1056
1056
  scope: s.scope || "openid"
1057
- }).then((k) => {
1058
- if (k.error)
1059
- throw new Error(k.error);
1060
- const A = k.tokens.idTokenPayload;
1061
- if (_.sub === A.sub) {
1062
- const g = k.sessionState;
1063
- e.checkSessionIFrame.start(k.sessionState), _.sid === A.sid ? console.debug(
1057
+ }).then((m) => {
1058
+ if (m.error)
1059
+ throw new Error(m.error);
1060
+ const w = m.tokens.idTokenPayload;
1061
+ if (u.sub === w.sub) {
1062
+ const y = m.sessionState;
1063
+ e.checkSessionIFrame.start(m.sessionState), u.sid === w.sid ? console.debug(
1064
1064
  "SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",
1065
- g
1065
+ y
1066
1066
  ) : console.debug(
1067
1067
  "SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",
1068
- g
1068
+ y
1069
1069
  );
1070
1070
  } else
1071
1071
  console.debug(
1072
1072
  "SessionMonitor._callback: Different subject signed into OP:",
1073
- A.sub
1073
+ w.sub
1074
1074
  );
1075
- }).catch(async (k) => {
1075
+ }).catch(async (m) => {
1076
1076
  console.warn(
1077
1077
  "SessionMonitor._callback: Silent login failed, logging out other tabs:",
1078
- k
1078
+ m
1079
1079
  );
1080
- for (const [, A] of Object.entries(n))
1081
- await A.logoutOtherTabAsync(s.client_id, _.sub);
1080
+ for (const [, w] of Object.entries(n))
1081
+ await w.logoutOtherTabAsync(s.client_id, u.sub);
1082
1082
  });
1083
1083
  };
1084
1084
  e.checkSessionIFrame = new De(
@@ -1088,7 +1088,7 @@ const M = (e, n, s = null, t = null) => {
1088
1088
  ), e.checkSessionIFrame.load().then(() => {
1089
1089
  e.checkSessionIFrame.start(i), c(e.checkSessionIFrame);
1090
1090
  }).catch((l) => {
1091
- u(l);
1091
+ _(l);
1092
1092
  });
1093
1093
  } else
1094
1094
  c(null);
@@ -1177,17 +1177,17 @@ const hn = () => {
1177
1177
  return !1;
1178
1178
  const s = fn(navigator);
1179
1179
  return !_n(s);
1180
- }, yn = async (e) => {
1180
+ }, gn = async (e) => {
1181
1181
  let n;
1182
1182
  if (e.tokens != null)
1183
1183
  return !1;
1184
- e.publishEvent(m.tryKeepExistingSessionAsync_begin, {});
1184
+ e.publishEvent(p.tryKeepExistingSessionAsync_begin, {});
1185
1185
  try {
1186
1186
  const s = e.configuration, t = await e.initAsync(
1187
1187
  s.authority,
1188
1188
  s.authority_configuration
1189
1189
  );
1190
- if (n = await x(s, e.configurationName), n) {
1190
+ if (n = await C(s, e.configurationName), n) {
1191
1191
  const { tokens: o } = await n.initAsync(
1192
1192
  t,
1193
1193
  "tryKeepExistingSessionAsync",
@@ -1207,20 +1207,20 @@ const hn = () => {
1207
1207
  t.checkSessionIframe,
1208
1208
  s.client_id,
1209
1209
  r
1210
- ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1210
+ ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1211
1211
  success: !0,
1212
1212
  message: "tokens inside ServiceWorker are valid"
1213
1213
  }), !0;
1214
1214
  }
1215
- e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1215
+ e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1216
1216
  success: !1,
1217
1217
  message: "no exiting session found"
1218
1218
  });
1219
1219
  } else {
1220
- s.service_worker_relative_url && e.publishEvent(m.service_worker_not_supported_by_browser, {
1220
+ s.service_worker_relative_url && e.publishEvent(p.service_worker_not_supported_by_browser, {
1221
1221
  message: "service worker is not supported by this browser"
1222
1222
  });
1223
- const o = C(e.configurationName, s.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1223
+ const o = N(e.configurationName, s.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1224
1224
  if (i) {
1225
1225
  e.tokens = oe(i, null, s.token_renew_mode);
1226
1226
  const r = o.getLoginParams();
@@ -1235,19 +1235,19 @@ const hn = () => {
1235
1235
  t.checkSessionIframe,
1236
1236
  s.client_id,
1237
1237
  a
1238
- ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1238
+ ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1239
1239
  success: !0,
1240
1240
  message: "tokens inside storage are valid"
1241
1241
  }), !0;
1242
1242
  }
1243
1243
  }
1244
- return e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1244
+ return e.publishEvent(p.tryKeepExistingSessionAsync_end, {
1245
1245
  success: !1,
1246
1246
  message: n ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
1247
1247
  }), !1;
1248
1248
  } catch (s) {
1249
1249
  return console.error(s), n && await n.clearAsync(), e.publishEvent(
1250
- m.tryKeepExistingSessionAsync_error,
1250
+ p.tryKeepExistingSessionAsync_error,
1251
1251
  "tokens inside ServiceWorker are invalid"
1252
1252
  ), !1;
1253
1253
  }
@@ -1281,8 +1281,8 @@ const hn = () => {
1281
1281
  return t === "#_=_" && (t = ""), t && (s += t), s;
1282
1282
  }, se = (e) => {
1283
1283
  const n = Ce(e), { search: s } = n;
1284
- return gn(s);
1285
- }, gn = (e) => {
1284
+ return yn(s);
1285
+ }, yn = (e) => {
1286
1286
  const n = {};
1287
1287
  let s, t, o;
1288
1288
  const i = e.split("&");
@@ -1290,144 +1290,144 @@ const hn = () => {
1290
1290
  s = i[t].split("="), n[decodeURIComponent(s[0])] = decodeURIComponent(s[1]);
1291
1291
  return n;
1292
1292
  }, kn = (e, n, s, t, o) => (i = void 0, r = null, a = !1, c = void 0) => {
1293
- const u = r;
1293
+ const _ = r;
1294
1294
  return r = { ...r }, (async () => {
1295
1295
  const l = i || o.getPath();
1296
- if ("state" in r || (r.state = ee(16)), s(m.loginAsync_begin, {}), r)
1296
+ if ("state" in r || (r.state = ee(16)), s(p.loginAsync_begin, {}), r)
1297
1297
  for (const d of Object.keys(r))
1298
1298
  d.endsWith(":token_request") && delete r[d];
1299
1299
  try {
1300
1300
  const d = a ? n.silent_redirect_uri : n.redirect_uri;
1301
1301
  c || (c = n.scope);
1302
- const _ = n.extras ? { ...n.extras, ...r } : r;
1303
- _.nonce || (_.nonce = ee(12));
1304
- const k = { nonce: _.nonce }, A = await x(n, e), g = await t(
1302
+ const u = n.extras ? { ...n.extras, ...r } : r;
1303
+ u.nonce || (u.nonce = ee(12));
1304
+ const m = { nonce: u.nonce }, w = await C(n, e), y = await t(
1305
1305
  n.authority,
1306
1306
  n.authority_configuration
1307
1307
  );
1308
- let p;
1309
- if (A)
1310
- A.setLoginParams({ callbackPath: l, extras: u, scope: c }), await A.initAsync(g, "loginAsync", n), await A.setNonceAsync(k), A.startKeepAliveServiceWorker(), p = A;
1308
+ let k;
1309
+ if (w)
1310
+ w.setLoginParams({ callbackPath: l, extras: _, scope: c }), await w.initAsync(y, "loginAsync", n), await w.setNonceAsync(m), w.startKeepAliveServiceWorker(), k = w;
1311
1311
  else {
1312
- const w = C(e, n.storage ?? sessionStorage);
1313
- w.setLoginParams({ callbackPath: l, extras: u, scope: c }), await w.setNonceAsync(k), p = w;
1312
+ const S = N(e, n.storage ?? sessionStorage);
1313
+ S.setLoginParams({ callbackPath: l, extras: _, scope: c }), await S.setNonceAsync(m), k = S;
1314
1314
  }
1315
- const E = {
1315
+ const A = {
1316
1316
  client_id: n.client_id,
1317
1317
  redirect_uri: d,
1318
1318
  scope: c,
1319
1319
  response_type: "code",
1320
- ..._
1320
+ ...u
1321
1321
  };
1322
- await an(p, o)(
1323
- g.authorizationEndpoint,
1324
- E
1322
+ await an(k, o)(
1323
+ y.authorizationEndpoint,
1324
+ A
1325
1325
  );
1326
1326
  } catch (d) {
1327
- throw s(m.loginAsync_error, d), d;
1327
+ throw s(p.loginAsync_error, d), d;
1328
1328
  }
1329
1329
  })();
1330
1330
  }, mn = (e) => async (n = !1) => {
1331
1331
  try {
1332
- e.publishEvent(m.loginCallbackAsync_begin, {});
1332
+ e.publishEvent(p.loginCallbackAsync_begin, {});
1333
1333
  const s = e.configuration, t = s.client_id, o = n ? s.silent_redirect_uri : s.redirect_uri, i = s.authority, r = s.token_request_timeout, a = await e.initAsync(
1334
1334
  i,
1335
1335
  s.authority_configuration
1336
- ), c = e.location.getCurrentHref(), u = se(c), f = u.session_state, l = await x(s, e.configurationName);
1337
- let d, _, k, A;
1336
+ ), c = e.location.getCurrentHref(), _ = se(c), f = _.session_state, l = await C(s, e.configurationName);
1337
+ let d, u, m, w;
1338
1338
  if (l)
1339
- await l.initAsync(a, "loginCallbackAsync", s), await l.setSessionStateAsync(f), _ = await l.getNonceAsync(), k = l.getLoginParams(), A = await l.getStateAsync(), l.startKeepAliveServiceWorker(), d = l;
1339
+ await l.initAsync(a, "loginCallbackAsync", s), await l.setSessionStateAsync(f), u = await l.getNonceAsync(), m = l.getLoginParams(), w = await l.getStateAsync(), l.startKeepAliveServiceWorker(), d = l;
1340
1340
  else {
1341
- const v = C(
1341
+ const v = N(
1342
1342
  e.configurationName,
1343
1343
  s.storage ?? sessionStorage
1344
1344
  );
1345
- await v.setSessionStateAsync(f), _ = await v.getNonceAsync(), k = v.getLoginParams(), A = await v.getStateAsync(), d = v;
1345
+ await v.setSessionStateAsync(f), u = await v.getNonceAsync(), m = v.getLoginParams(), w = await v.getStateAsync(), d = v;
1346
1346
  }
1347
- if (u.error || u.error_description)
1347
+ if (_.error || _.error_description)
1348
1348
  throw new Error(
1349
- `Error from OIDC server: ${u.error} - ${u.error_description}`
1349
+ `Error from OIDC server: ${_.error} - ${_.error_description}`
1350
1350
  );
1351
- if (u.iss && u.iss !== a.issuer)
1351
+ if (_.iss && _.iss !== a.issuer)
1352
1352
  throw console.error(), new Error(
1353
- `Issuer not valid (expected: ${a.issuer}, received: ${u.iss})`
1353
+ `Issuer not valid (expected: ${a.issuer}, received: ${_.iss})`
1354
1354
  );
1355
- if (u.state && u.state !== A)
1356
- throw new Error(`State not valid (expected: ${A}, received: ${u.state})`);
1357
- const g = {
1358
- code: u.code,
1355
+ if (_.state && _.state !== w)
1356
+ throw new Error(`State not valid (expected: ${w}, received: ${_.state})`);
1357
+ const y = {
1358
+ code: _.code,
1359
1359
  grant_type: "authorization_code",
1360
1360
  client_id: s.client_id,
1361
1361
  redirect_uri: o
1362
- }, p = {};
1362
+ }, k = {};
1363
1363
  if (s.token_request_extras)
1364
1364
  for (const [v, W] of Object.entries(s.token_request_extras))
1365
- p[v] = W;
1366
- if (k != null && k.extras)
1367
- for (const [v, W] of Object.entries(k.extras))
1368
- v.endsWith(":token_request") && (p[v.replace(":token_request", "")] = W);
1369
- const E = a.tokenEndpoint, w = {};
1365
+ k[v] = W;
1366
+ if (m?.extras)
1367
+ for (const [v, W] of Object.entries(m.extras))
1368
+ v.endsWith(":token_request") && (k[v.replace(":token_request", "")] = W);
1369
+ const A = a.tokenEndpoint, S = {};
1370
1370
  if (s.demonstrating_proof_of_possession)
1371
1371
  if (l)
1372
- w.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1372
+ S.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1373
1373
  else {
1374
1374
  const v = await Qe(window)(
1375
1375
  s.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
1376
1376
  );
1377
- await C(e.configurationName, s.storage).setDemonstratingProofOfPossessionJwkAsync(v), w.DPoP = await be(window)(
1377
+ await N(e.configurationName, s.storage).setDemonstratingProofOfPossessionJwkAsync(v), S.DPoP = await be(window)(
1378
1378
  s.demonstrating_proof_of_possession_configuration
1379
- )(v, "POST", E);
1379
+ )(v, "POST", A);
1380
1380
  }
1381
- const S = await cn(d)(
1382
- E,
1383
- { ...g, ...p },
1384
- w,
1381
+ const E = await cn(d)(
1382
+ A,
1383
+ { ...y, ...k },
1384
+ S,
1385
1385
  e.configuration.token_renew_mode,
1386
1386
  r
1387
1387
  );
1388
- if (!S.success)
1388
+ if (!E.success)
1389
1389
  throw new Error("Token request failed");
1390
- let y;
1391
- const P = S.data.tokens, h = S.data.demonstratingProofOfPossessionNonce;
1392
- if (S.data.state !== p.state)
1390
+ let g;
1391
+ const P = E.data.tokens, h = E.data.demonstratingProofOfPossessionNonce;
1392
+ if (E.data.state !== k.state)
1393
1393
  throw new Error("state is not valid");
1394
- const { isValid: I, reason: T } = Se(
1394
+ const { isValid: L, reason: T } = Se(
1395
1395
  P,
1396
- _.nonce,
1396
+ u.nonce,
1397
1397
  a
1398
1398
  );
1399
- if (!I)
1399
+ if (!L)
1400
1400
  throw new Error(`Tokens are not OpenID valid, reason: ${T}`);
1401
1401
  if (l) {
1402
1402
  if (P.refreshToken && !P.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1403
1403
  throw new Error("Refresh token should be hidden by service worker");
1404
- if (h && (P != null && P.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")))
1404
+ if (h && P?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
1405
1405
  throw new Error(
1406
1406
  "Demonstration of proof of possession require Access token not hidden by service worker"
1407
1407
  );
1408
1408
  }
1409
1409
  if (l)
1410
- await l.initAsync(a, "syncTokensAsync", s), y = l.getLoginParams(), h && await l.setDemonstratingProofOfPossessionNonce(
1410
+ await l.initAsync(a, "syncTokensAsync", s), g = l.getLoginParams(), h && await l.setDemonstratingProofOfPossessionNonce(
1411
1411
  h
1412
1412
  );
1413
1413
  else {
1414
- const v = C(e.configurationName, s.storage);
1415
- y = v.getLoginParams(), h && await v.setDemonstratingProofOfPossessionNonce(h);
1414
+ const v = N(e.configurationName, s.storage);
1415
+ g = v.getLoginParams(), h && await v.setDemonstratingProofOfPossessionNonce(h);
1416
1416
  }
1417
1417
  return await e.startCheckSessionAsync(
1418
1418
  a.checkSessionIframe,
1419
1419
  t,
1420
1420
  f,
1421
1421
  n
1422
- ), e.publishEvent(m.loginCallbackAsync_end, {}), {
1422
+ ), e.publishEvent(p.loginCallbackAsync_end, {}), {
1423
1423
  tokens: P,
1424
1424
  state: "request.state",
1425
- callbackPath: y.callbackPath,
1426
- scope: u.scope,
1427
- extras: y.extras
1425
+ callbackPath: g.callbackPath,
1426
+ scope: _.scope,
1427
+ extras: g.extras
1428
1428
  };
1429
1429
  } catch (s) {
1430
- throw console.error(s), e.publishEvent(m.loginCallbackAsync_error, s), s;
1430
+ throw console.error(s), e.publishEvent(p.loginCallbackAsync_error, s), s;
1431
1431
  }
1432
1432
  }, pe = {
1433
1433
  access_token: "access_token",
@@ -1453,97 +1453,95 @@ const hn = () => {
1453
1453
  return n;
1454
1454
  }, wn = (e) => async (n) => {
1455
1455
  U.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1456
- const s = await x(e.configuration, e.configurationName);
1457
- s ? await s.clearAsync(n) : await C(e.configurationName, e.configuration.storage).clearAsync(n), e.tokens = null, e.userInfo = null;
1456
+ const s = await C(e.configuration, e.configurationName);
1457
+ s ? await s.clearAsync(n) : await N(e.configurationName, e.configuration.storage).clearAsync(n), e.tokens = null, e.userInfo = null;
1458
1458
  }, An = (e, n, s, t, o) => async (i = void 0, r = null) => {
1459
- var p, E;
1460
1459
  const a = e.configuration, c = await e.initAsync(
1461
1460
  a.authority,
1462
1461
  a.authority_configuration
1463
1462
  );
1464
1463
  i && typeof i != "string" && (i = void 0, t.warn("callbackPathOrUrl path is not a string"));
1465
- const u = i ?? o.getPath();
1464
+ const _ = i ?? o.getPath();
1466
1465
  let f = !1;
1467
1466
  i && (f = i.includes("https://") || i.includes("http://"));
1468
- const l = f ? i : o.getOrigin() + u, d = e.tokens ? e.tokens.idToken : "";
1467
+ const l = f ? i : o.getOrigin() + _, d = e.tokens ? e.tokens.idToken : "";
1469
1468
  try {
1470
- const w = c.revocationEndpoint;
1471
- if (w) {
1472
- const S = [], y = e.tokens ? e.tokens.accessToken : null;
1473
- if (y && a.logout_tokens_to_invalidate.includes(pe.access_token)) {
1474
- const h = z(r, ":revoke_access_token"), I = ke(s)(
1475
- w,
1476
- y,
1469
+ const k = c.revocationEndpoint;
1470
+ if (k) {
1471
+ const A = [], S = e.tokens ? e.tokens.accessToken : null;
1472
+ if (S && a.logout_tokens_to_invalidate.includes(pe.access_token)) {
1473
+ const g = z(r, ":revoke_access_token"), P = ke(s)(
1474
+ k,
1475
+ S,
1477
1476
  ne.access_token,
1478
1477
  a.client_id,
1479
- h
1478
+ g
1480
1479
  );
1481
- S.push(I);
1480
+ A.push(P);
1482
1481
  }
1483
- const P = e.tokens ? e.tokens.refreshToken : null;
1484
- if (P && a.logout_tokens_to_invalidate.includes(pe.refresh_token)) {
1485
- const h = z(r, ":revoke_refresh_token"), I = ke(s)(
1486
- w,
1487
- P,
1482
+ const E = e.tokens ? e.tokens.refreshToken : null;
1483
+ if (E && a.logout_tokens_to_invalidate.includes(pe.refresh_token)) {
1484
+ const g = z(r, ":revoke_refresh_token"), P = ke(s)(
1485
+ k,
1486
+ E,
1488
1487
  ne.refresh_token,
1489
1488
  a.client_id,
1490
- h
1489
+ g
1491
1490
  );
1492
- S.push(I);
1491
+ A.push(P);
1493
1492
  }
1494
- S.length > 0 && await Promise.all(S);
1493
+ A.length > 0 && await Promise.all(A);
1495
1494
  }
1496
- } catch (w) {
1495
+ } catch (k) {
1497
1496
  t.warn(
1498
1497
  "logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"
1499
- ), t.warn(w);
1498
+ ), t.warn(k);
1500
1499
  }
1501
- const _ = ((E = (p = e.tokens) == null ? void 0 : p.idTokenPayload) == null ? void 0 : E.sub) ?? null;
1500
+ const u = e.tokens?.idTokenPayload?.sub ?? null;
1502
1501
  await e.destroyAsync("LOGGED_OUT");
1503
- for (const [, w] of Object.entries(n))
1504
- w !== e ? await e.logoutSameTabAsync(e.configuration.client_id, _) : e.publishEvent(m.logout_from_same_tab, {});
1505
- const k = z(r, ":oidc");
1506
- if (k && k.no_reload === "true")
1502
+ for (const [, k] of Object.entries(n))
1503
+ k !== e ? await e.logoutSameTabAsync(e.configuration.client_id, u) : e.publishEvent(p.logout_from_same_tab, {});
1504
+ const m = z(r, ":oidc");
1505
+ if (m && m.no_reload === "true")
1507
1506
  return;
1508
- const g = pn(r);
1507
+ const y = pn(r);
1509
1508
  if (c.endSessionEndpoint) {
1510
- "id_token_hint" in g || (g.id_token_hint = d), !("post_logout_redirect_uri" in g) && i !== null && (g.post_logout_redirect_uri = l);
1511
- let w = "";
1512
- for (const [S, y] of Object.entries(g))
1513
- y != null && (w === "" ? w += "?" : w += "&", w += `${S}=${encodeURIComponent(y)}`);
1514
- o.open(`${c.endSessionEndpoint}${w}`);
1509
+ "id_token_hint" in y || (y.id_token_hint = d), !("post_logout_redirect_uri" in y) && i !== null && (y.post_logout_redirect_uri = l);
1510
+ let k = "";
1511
+ for (const [A, S] of Object.entries(y))
1512
+ S != null && (k === "" ? k += "?" : k += "&", k += `${A}=${encodeURIComponent(S)}`);
1513
+ o.open(`${c.endSessionEndpoint}${k}`);
1515
1514
  } else
1516
1515
  o.reload();
1517
1516
  }, xe = (e, n, s = !1) => async (...t) => {
1518
- var _;
1519
1517
  const [o, i, ...r] = t, a = i ? { ...i } : { method: "GET" };
1520
1518
  let c = new Headers();
1521
1519
  a.headers && (c = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
1522
- const u = {
1520
+ const _ = {
1523
1521
  getTokens: () => n.tokens,
1524
1522
  configuration: {
1525
1523
  token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
1526
1524
  refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
1527
1525
  },
1528
1526
  syncTokensInfoAsync: async () => {
1529
- const { status: k } = await ce(n)(
1527
+ const { status: u } = await ce(n)(
1530
1528
  n.configuration,
1531
1529
  n.configurationName,
1532
1530
  n.tokens,
1533
1531
  !1
1534
1532
  );
1535
- return k;
1533
+ return u;
1536
1534
  },
1537
1535
  renewTokensAsync: n.renewTokensAsync.bind(n)
1538
- }, f = await Ae(u), l = (_ = f == null ? void 0 : f.tokens) == null ? void 0 : _.accessToken;
1536
+ }, l = (await Ae(_))?.tokens?.accessToken;
1539
1537
  if (c.has("Accept") || c.set("Accept", "application/json"), l) {
1540
1538
  if (n.configuration.demonstrating_proof_of_possession && s) {
1541
- const k = await n.generateDemonstrationOfProofOfPossessionAsync(
1539
+ const u = await n.generateDemonstrationOfProofOfPossessionAsync(
1542
1540
  l,
1543
1541
  o.toString(),
1544
1542
  a.method
1545
1543
  );
1546
- c.set("Authorization", `DPoP ${l}`), c.set("DPoP", k);
1544
+ c.set("Authorization", `DPoP ${l}`), c.set("DPoP", u);
1547
1545
  } else
1548
1546
  c.set("Authorization", `Bearer ${l}`);
1549
1547
  a.credentials || (a.credentials = "same-origin");
@@ -1551,30 +1549,29 @@ const hn = () => {
1551
1549
  const d = { ...a, headers: c };
1552
1550
  return await e(o, d, ...r);
1553
1551
  }, Sn = (e) => async (n = !1, s = !1) => {
1554
- var u, f;
1555
1552
  if (e.userInfo != null && !n)
1556
1553
  return e.userInfo;
1557
- const t = !n && ((u = e.configuration.storage) == null ? void 0 : u.getItem(`oidc.${e.configurationName}.userInfo`));
1554
+ const t = !n && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
1558
1555
  if (t)
1559
1556
  return e.userInfo = JSON.parse(t), e.userInfo;
1560
1557
  const o = e.configuration, r = (await e.initAsync(
1561
1558
  o.authority,
1562
1559
  o.authority_configuration
1563
1560
  )).userInfoEndpoint, c = await (async () => {
1564
- const d = await xe(fetch, e, s)(r);
1565
- return d.status !== 200 ? null : d.json();
1561
+ const f = await xe(fetch, e, s)(r);
1562
+ return f.status !== 200 ? null : f.json();
1566
1563
  })();
1567
- return e.userInfo = c, c && ((f = e.configuration.storage) == null || f.setItem(
1564
+ return e.userInfo = c, c && e.configuration.storage?.setItem(
1568
1565
  `oidc.${e.configurationName}.userInfo`,
1569
1566
  JSON.stringify(c)
1570
- )), c;
1567
+ ), c;
1571
1568
  }, Tn = () => fetch;
1572
1569
  class te {
1573
1570
  constructor(n) {
1574
1571
  this.authorizationEndpoint = n.authorization_endpoint, this.tokenEndpoint = n.token_endpoint, this.revocationEndpoint = n.revocation_endpoint, this.userInfoEndpoint = n.userinfo_endpoint, this.checkSessionIframe = n.check_session_iframe, this.issuer = n.issuer, this.endSessionEndpoint = n.end_session_endpoint;
1575
1572
  }
1576
1573
  }
1577
- const D = {}, vn = (e, n = new j()) => (s, t = "default") => (D[t] || (D[t] = new L(s, t, e, n)), D[t]), En = async (e) => {
1574
+ const D = {}, vn = (e, n = new j()) => (s, t = "default") => (D[t] || (D[t] = new x(s, t, e, n)), D[t]), En = async (e) => {
1578
1575
  const { parsedTokens: n, callbackPath: s, extras: t, scope: o } = await e.loginCallbackAsync();
1579
1576
  return e.timeoutId = M(e, n.expiresAt, t, o), { callbackPath: s };
1580
1577
  }, On = (e) => Math.floor(Math.random() * e), F = class F {
@@ -1664,10 +1661,10 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1664
1661
  check_session_iframe: s.check_session_iframe,
1665
1662
  issuer: s.issuer
1666
1663
  });
1667
- const i = await x(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1664
+ const i = await C(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
1668
1665
  return await on(this.getFetch())(
1669
1666
  n,
1670
- this.configuration.authority_time_cache_wellknowurl_in_second ?? 60 * 60,
1667
+ this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600,
1671
1668
  i,
1672
1669
  this.configuration.authority_timeout_wellknowurl_in_millisecond
1673
1670
  );
@@ -1677,7 +1674,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1677
1674
  });
1678
1675
  }
1679
1676
  async tryKeepExistingSessionAsync() {
1680
- return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = yn(this), this.tryKeepExistingSessionPromise.finally(() => {
1677
+ return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = gn(this), this.tryKeepExistingSessionPromise.finally(() => {
1681
1678
  this.tryKeepExistingSessionPromise = null;
1682
1679
  }));
1683
1680
  }
@@ -1711,7 +1708,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1711
1708
  return this.loginCallbackPromise;
1712
1709
  const s = async () => {
1713
1710
  const t = await mn(this)(n), o = t.tokens;
1714
- return this.tokens = o, await x(this.configuration, this.configurationName) || C(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(F.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1711
+ return this.tokens = o, await C(this.configuration, this.configurationName) || N(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(F.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
1715
1712
  parsedTokens: o,
1716
1713
  state: t.state,
1717
1714
  callbackPath: t.callbackPath,
@@ -1728,12 +1725,12 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1728
1725
  ath: await Ie(n),
1729
1726
  ...o
1730
1727
  };
1731
- if (await x(i, this.configurationName))
1728
+ if (await C(i, this.configurationName))
1732
1729
  return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${ve(this.configurationName)}`;
1733
- const c = C(this.configurationName, i.storage), u = await c.getDemonstratingProofOfPossessionJwkAsync(), f = c.getDemonstratingProofOfPossessionNonce();
1730
+ const c = N(this.configurationName, i.storage), _ = await c.getDemonstratingProofOfPossessionJwkAsync(), f = c.getDemonstratingProofOfPossessionNonce();
1734
1731
  return f && (r.nonce = f), await be(window)(
1735
1732
  i.demonstrating_proof_of_possession_configuration
1736
- )(u, t, s, r);
1733
+ )(_, t, s, r);
1737
1734
  }
1738
1735
  loginCallbackWithAutoTokensRenewAsync() {
1739
1736
  return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = En(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
@@ -1757,10 +1754,10 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1757
1754
  return await wn(this)(n);
1758
1755
  }
1759
1756
  async logoutSameTabAsync(n, s) {
1760
- this.configuration.monitor_session && this.configuration.client_id === n && s && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === s && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(m.logout_from_same_tab, { mmessage: "SessionMonitor", sub: s }));
1757
+ this.configuration.monitor_session && this.configuration.client_id === n && s && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === s && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_same_tab, { mmessage: "SessionMonitor", sub: s }));
1761
1758
  }
1762
1759
  async logoutOtherTabAsync(n, s) {
1763
- this.configuration.monitor_session && this.configuration.client_id === n && s && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === s && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(m.logout_from_another_tab, { message: "SessionMonitor", sub: s }));
1760
+ this.configuration.monitor_session && this.configuration.client_id === n && s && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === s && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_another_tab, { message: "SessionMonitor", sub: s }));
1764
1761
  }
1765
1762
  async logoutAsync(n = void 0, s = null) {
1766
1763
  return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = An(
@@ -1774,8 +1771,8 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1774
1771
  }));
1775
1772
  }
1776
1773
  };
1777
- F.getOrCreate = (n, s) => (t, o = "default") => vn(n, s)(t, o), F.eventNames = m;
1778
- let L = F;
1774
+ F.getOrCreate = (n, s) => (t, o = "default") => vn(n, s)(t, o), F.eventNames = p;
1775
+ let x = F;
1779
1776
  const K = class K {
1780
1777
  constructor(n) {
1781
1778
  this._oidc = n;
@@ -1790,7 +1787,7 @@ const K = class K {
1790
1787
  this._oidc.publishEvent(n, s);
1791
1788
  }
1792
1789
  static get(n = "default") {
1793
- return new K(L.get(n));
1790
+ return new K(x.get(n));
1794
1791
  }
1795
1792
  tryKeepExistingSessionAsync() {
1796
1793
  return this._oidc.tryKeepExistingSessionAsync();
@@ -1854,7 +1851,7 @@ const K = class K {
1854
1851
  return this._oidc.userInfo;
1855
1852
  }
1856
1853
  };
1857
- K.getOrCreate = (n, s = new j()) => (t, o = "default") => new K(L.getOrCreate(n, s)(t, o)), K.eventNames = L.eventNames;
1854
+ K.getOrCreate = (n, s = new j()) => (t, o = "default") => new K(x.getOrCreate(n, s)(t, o)), K.eventNames = x.eventNames;
1858
1855
  let we = K;
1859
1856
  export {
1860
1857
  we as OidcClient,