@axa-fr/oidc-client 7.22.25-beta.1555 → 7.22.26

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
@@ -1,6 +1,6 @@
1
- class H {
2
- open(n) {
3
- window.location.href = n;
1
+ class q {
2
+ open(s) {
3
+ window.location.href = s;
4
4
  }
5
5
  reload() {
6
6
  window.location.reload();
@@ -9,8 +9,8 @@ class H {
9
9
  return window.location.href;
10
10
  }
11
11
  getPath() {
12
- const n = window.location;
13
- return n.pathname + (n.search || "") + (n.hash || "");
12
+ const s = window.location;
13
+ return s.pathname + (s.search || "") + (s.hash || "");
14
14
  }
15
15
  getOrigin() {
16
16
  return window.origin;
@@ -18,30 +18,30 @@ class H {
18
18
  }
19
19
  const ae = 2e3, D = console;
20
20
  class Pe {
21
- constructor(n, s, t, o = ae, i = !0) {
22
- this._callback = n, this._client_id = s, this._url = t, this._interval = o || ae, this._stopOnError = i;
21
+ constructor(s, n, t, o = ae, i = !0) {
22
+ this._callback = s, this._client_id = n, this._url = t, this._interval = o || ae, this._stopOnError = i;
23
23
  const r = t.indexOf("/", t.indexOf("//") + 2);
24
24
  this._frame_origin = t.substring(0, r), this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "absolute", this._frame.style.display = "none", this._frame.width = 0, this._frame.height = 0, this._frame.src = t;
25
25
  }
26
26
  load() {
27
- return new Promise((n) => {
27
+ return new Promise((s) => {
28
28
  this._frame.onload = () => {
29
- n();
29
+ s();
30
30
  }, window.document.body.appendChild(this._frame), this._boundMessageEvent = this._message.bind(this), window.addEventListener("message", this._boundMessageEvent, !1);
31
31
  });
32
32
  }
33
- _message(n) {
34
- n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (D.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? (D.debug(n), D.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : D.debug("CheckSessionIFrame: " + n.data + " message from check session op iframe"));
33
+ _message(s) {
34
+ s.origin === this._frame_origin && s.source === this._frame.contentWindow && (s.data === "error" ? (D.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : s.data === "changed" ? (D.debug(s), D.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : D.debug("CheckSessionIFrame: " + s.data + " message from check session op iframe"));
35
35
  }
36
- start(n) {
37
- D.debug("CheckSessionIFrame.start :" + n), this.stop();
38
- const s = () => {
36
+ start(s) {
37
+ D.debug("CheckSessionIFrame.start :" + s), this.stop();
38
+ const n = () => {
39
39
  this._frame.contentWindow.postMessage(
40
- this._client_id + " " + n,
40
+ this._client_id + " " + s,
41
41
  this._frame_origin
42
42
  );
43
43
  };
44
- s(), this._timer = window.setInterval(s, this._interval);
44
+ n(), this._timer = window.setInterval(n, this._interval);
45
45
  }
46
46
  stop() {
47
47
  this._timer && (D.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
@@ -76,102 +76,102 @@ const m = {
76
76
  syncTokensAsync_end: "syncTokensAsync_end",
77
77
  syncTokensAsync_error: "syncTokensAsync_error",
78
78
  tokensInvalidAndWaitingActionsToRefresh: "tokensInvalidAndWaitingActionsToRefresh"
79
- }, P = (e, n = sessionStorage) => {
80
- const s = (h) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: h }), Promise.resolve()), t = async () => {
81
- if (!n[`oidc.${e}`])
82
- return n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
83
- const h = JSON.parse(n[`oidc.${e}`]);
79
+ }, P = (e, s = sessionStorage) => {
80
+ const n = (h) => (s[`oidc.${e}`] = JSON.stringify({ tokens: null, status: h }), Promise.resolve()), t = async () => {
81
+ if (!s[`oidc.${e}`])
82
+ return s[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
83
+ const h = JSON.parse(s[`oidc.${e}`]);
84
84
  return Promise.resolve({ tokens: h.tokens, status: h.status });
85
85
  }, o = (h) => {
86
- n[`oidc.${e}`] = JSON.stringify({ tokens: h });
86
+ s[`oidc.${e}`] = JSON.stringify({ tokens: h });
87
87
  }, i = async (h) => {
88
- n[`oidc.session_state.${e}`] = h;
89
- }, r = async () => n[`oidc.session_state.${e}`], a = (h) => {
90
- n[`oidc.nonce.${e}`] = h.nonce;
91
- }, u = (h) => {
92
- n[`oidc.jwk.${e}`] = JSON.stringify(h);
93
- }, f = () => JSON.parse(n[`oidc.jwk.${e}`]), l = async () => ({ nonce: n[`oidc.nonce.${e}`] }), c = async (h) => {
94
- n[`oidc.dpop_nonce.${e}`] = h;
95
- }, _ = () => n[`oidc.dpop_nonce.${e}`], d = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, y = {};
88
+ s[`oidc.session_state.${e}`] = h;
89
+ }, r = async () => s[`oidc.session_state.${e}`], a = (h) => {
90
+ s[`oidc.nonce.${e}`] = h.nonce;
91
+ }, l = (h) => {
92
+ s[`oidc.jwk.${e}`] = JSON.stringify(h);
93
+ }, f = () => JSON.parse(s[`oidc.jwk.${e}`]), u = async () => ({ nonce: s[`oidc.nonce.${e}`] }), c = async (h) => {
94
+ s[`oidc.dpop_nonce.${e}`] = h;
95
+ }, _ = () => s[`oidc.dpop_nonce.${e}`], d = () => s[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(s[`oidc.${e}`]).tokens }) : null, y = {};
96
96
  return {
97
- clearAsync: s,
97
+ clearAsync: n,
98
98
  initAsync: t,
99
99
  setTokens: o,
100
100
  getTokens: d,
101
101
  setSessionStateAsync: i,
102
102
  getSessionStateAsync: r,
103
103
  setNonceAsync: a,
104
- getNonceAsync: l,
104
+ getNonceAsync: u,
105
105
  setLoginParams: (h) => {
106
- y[e] = h, n[`oidc.login.${e}`] = JSON.stringify(h);
106
+ y[e] = h, s[`oidc.login.${e}`] = JSON.stringify(h);
107
107
  },
108
108
  getLoginParams: () => {
109
- const h = n[`oidc.login.${e}`];
109
+ const h = s[`oidc.login.${e}`];
110
110
  return h ? (y[e] || (y[e] = JSON.parse(h)), y[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
- getStateAsync: async () => n[`oidc.state.${e}`],
114
+ getStateAsync: async () => s[`oidc.state.${e}`],
115
115
  setStateAsync: async (h) => {
116
- n[`oidc.state.${e}`] = h;
116
+ s[`oidc.state.${e}`] = h;
117
117
  },
118
- getCodeVerifierAsync: async () => n[`oidc.code_verifier.${e}`],
118
+ getCodeVerifierAsync: async () => s[`oidc.code_verifier.${e}`],
119
119
  setCodeVerifierAsync: async (h) => {
120
- n[`oidc.code_verifier.${e}`] = h;
120
+ s[`oidc.code_verifier.${e}`] = h;
121
121
  },
122
122
  setDemonstratingProofOfPossessionNonce: c,
123
123
  getDemonstratingProofOfPossessionNonce: _,
124
- setDemonstratingProofOfPossessionJwkAsync: u,
124
+ setDemonstratingProofOfPossessionJwkAsync: l,
125
125
  getDemonstratingProofOfPossessionJwkAsync: f
126
126
  };
127
127
  };
128
- var V = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(V || {});
128
+ var J = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(J || {});
129
129
  const Ie = (e) => decodeURIComponent(
130
- Array.prototype.map.call(atob(e), (n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")
130
+ Array.prototype.map.call(atob(e), (s) => "%" + ("00" + s.charCodeAt(0).toString(16)).slice(-2)).join("")
131
131
  ), Ce = (e) => JSON.parse(Ie(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), ce = (e) => {
132
132
  try {
133
133
  return e && Ne(e, ".") === 2 ? Ce(e.split(".")[1]) : null;
134
- } catch (n) {
135
- console.warn(n);
134
+ } catch (s) {
135
+ console.warn(s);
136
136
  }
137
137
  return null;
138
- }, Ne = (e, n) => e.split(n).length - 1, Z = {
138
+ }, Ne = (e, s) => e.split(s).length - 1, Q = {
139
139
  access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
140
140
  access_token_invalid: "access_token_invalid",
141
141
  id_token_invalid: "id_token_invalid"
142
142
  };
143
- function xe(e, n, s) {
143
+ function xe(e, s, n) {
144
144
  if (e.issuedAt) {
145
145
  if (typeof e.issuedAt == "string")
146
146
  return parseInt(e.issuedAt, 10);
147
- } else return n && n.iat ? n.iat : s && s.iat ? s.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
147
+ } else return s && s.iat ? s.iat : n && n.iat ? n.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
148
148
  return e.issuedAt;
149
149
  }
150
- const X = (e, n = null, s) => {
150
+ const te = (e, s = null, n) => {
151
151
  if (!e)
152
152
  return null;
153
153
  let t;
154
154
  const o = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
155
155
  e.accessTokenPayload !== void 0 ? t = e.accessTokenPayload : t = ce(e.accessToken);
156
156
  let i;
157
- n != null && "idToken" in n && !("idToken" in e) ? i = n.idToken : i = e.idToken;
158
- const r = e.idTokenPayload ? e.idTokenPayload : ce(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, u = t && t.exp ? t.exp : e.issuedAt + o;
157
+ s != null && "idToken" in s && !("idToken" in e) ? i = s.idToken : i = e.idToken;
158
+ const r = e.idTokenPayload ? e.idTokenPayload : ce(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, l = t && t.exp ? t.exp : e.issuedAt + o;
159
159
  e.issuedAt = xe(e, t, r);
160
160
  let f;
161
- e.expiresAt ? f = e.expiresAt : s === Z.access_token_invalid ? f = u : s === Z.id_token_invalid ? f = a : f = a < u ? a : u;
162
- const l = {
161
+ e.expiresAt ? f = e.expiresAt : n === Q.access_token_invalid ? f = l : n === Q.id_token_invalid ? f = a : f = a < l ? a : l;
162
+ const u = {
163
163
  ...e,
164
164
  idTokenPayload: r,
165
165
  accessTokenPayload: t,
166
166
  expiresAt: f,
167
167
  idToken: i
168
168
  };
169
- if (n != null && "refreshToken" in n && !("refreshToken" in e)) {
170
- const c = n.refreshToken;
171
- return { ...l, refreshToken: c };
169
+ if (s != null && "refreshToken" in s && !("refreshToken" in e)) {
170
+ const c = s.refreshToken;
171
+ return { ...u, refreshToken: c };
172
172
  }
173
- return l;
174
- }, oe = (e, n, s) => {
173
+ return u;
174
+ }, oe = (e, s, n) => {
175
175
  if (!e)
176
176
  return null;
177
177
  if (!e.issued_at) {
@@ -186,34 +186,34 @@ const X = (e, n = null, s) => {
186
186
  tokenType: e.token_type,
187
187
  issuedAt: e.issued_at
188
188
  };
189
- return "refresh_token" in e && (t.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (t.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (t.idTokenPayload = e.idTokenPayload), X(t, n, s);
190
- }, K = (e, n) => {
191
- const s = (/* @__PURE__ */ new Date()).getTime() / 1e3, t = n - s;
189
+ return "refresh_token" in e && (t.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (t.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (t.idTokenPayload = e.idTokenPayload), te(t, s, n);
190
+ }, F = (e, s) => {
191
+ const n = (/* @__PURE__ */ new Date()).getTime() / 1e3, t = s - n;
192
192
  return Math.round(t - e);
193
- }, le = (e) => e ? K(0, e.expiresAt) > 0 : !1, ke = async (e, n = 200, s = 50) => {
194
- let t = s;
193
+ }, le = (e) => e ? F(0, e.expiresAt) > 0 : !1, ke = async (e, s = 200, n = 50) => {
194
+ let t = n;
195
195
  if (!e.tokens)
196
196
  return null;
197
197
  for (; !le(e.tokens) && t > 0; ) {
198
- if (e.configuration.token_automatic_renew_mode == V.AutomaticOnlyWhenFetchExecuted) {
198
+ if (e.configuration.token_automatic_renew_mode == J.AutomaticOnlyWhenFetchExecuted) {
199
199
  await e.renewTokensAsync({});
200
200
  break;
201
201
  } else
202
- await z({ milliseconds: n });
202
+ await X({ milliseconds: s });
203
203
  t = t - 1;
204
204
  }
205
205
  return {
206
206
  isTokensValid: le(e.tokens),
207
207
  tokens: e.tokens,
208
- numberWaited: t - s
208
+ numberWaited: t - n
209
209
  };
210
- }, me = (e, n, s) => {
210
+ }, me = (e, s, n) => {
211
211
  if (e.idTokenPayload) {
212
212
  const t = e.idTokenPayload;
213
- if (s.issuer !== t.iss)
213
+ if (n.issuer !== t.iss)
214
214
  return {
215
215
  isValid: !1,
216
- reason: `Issuer does not match (oidcServerConfiguration issuer) ${s.issuer} !== (idTokenPayload issuer) ${t.iss}`
216
+ reason: `Issuer does not match (oidcServerConfiguration issuer) ${n.issuer} !== (idTokenPayload issuer) ${t.iss}`
217
217
  };
218
218
  const o = (/* @__PURE__ */ new Date()).getTime() / 1e3;
219
219
  if (t.exp && t.exp < o)
@@ -227,14 +227,14 @@ const X = (e, n = null, s) => {
227
227
  isValid: !1,
228
228
  reason: `Token is used from too long time (idTokenPayload iat + timeInSevenDays) ${t.iat + i} < (currentTimeUnixSecond) ${o}`
229
229
  };
230
- if (t.nonce && t.nonce !== n)
230
+ if (t.nonce && t.nonce !== s)
231
231
  return {
232
232
  isValid: !1,
233
- reason: `Nonce does not match (idTokenPayload nonce) ${t.nonce} !== (nonce) ${n}`
233
+ reason: `Nonce does not match (idTokenPayload nonce) ${t.nonce} !== (nonce) ${s}`
234
234
  };
235
235
  }
236
236
  return { isValid: !0, reason: "" };
237
- }, J = function() {
237
+ }, K = function() {
238
238
  const e = typeof window > "u" ? global : window;
239
239
  return {
240
240
  setTimeout: setTimeout.bind(e),
@@ -242,18 +242,18 @@ const X = (e, n = null, s) => {
242
242
  setInterval: setInterval.bind(e),
243
243
  clearInterval: clearInterval.bind(e)
244
244
  };
245
- }(), ue = "7.22.25-beta.1555";
245
+ }(), ue = "7.22.26";
246
246
  let _e = null, j;
247
- const z = ({ milliseconds: e }) => new Promise((n) => J.setTimeout(n, e)), pe = (e = "/") => {
247
+ const X = ({ milliseconds: e }) => new Promise((s) => K.setTimeout(s, e)), pe = (e = "/") => {
248
248
  try {
249
249
  j = new AbortController(), fetch(
250
250
  `${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`,
251
251
  { signal: j.signal }
252
252
  ).catch((t) => {
253
253
  console.log(t);
254
- }), z({ milliseconds: 150 * 1e3 }).then(pe);
255
- } catch (n) {
256
- console.log(n);
254
+ }), X({ milliseconds: 150 * 1e3 }).then(pe);
255
+ } catch (s) {
256
+ console.log(s);
257
257
  }
258
258
  }, We = () => {
259
259
  j && j.abort();
@@ -261,31 +261,37 @@ const z = ({ milliseconds: e }) => new Promise((n) => J.setTimeout(n, e)), pe =
261
261
  headers: {
262
262
  "oidc-vanilla": "true"
263
263
  }
264
- }).then((n) => n.statusText === "oidc-service-worker").catch((n) => {
265
- console.log(n);
266
- }), De = (e) => async (n, s) => {
267
- s(), await n.update();
268
- const t = await n.unregister();
269
- console.log(`Service worker unregistration ${t ? "successful" : "failed"}`), await z({ milliseconds: 2e3 }), e.reload();
270
- }, Re = (e) => sessionStorage.getItem(`oidc.tabId.${e}`), O = (e) => (n) => new Promise(function(s, t) {
264
+ }).then((s) => s.statusText === "oidc-service-worker").catch((s) => {
265
+ console.log(s);
266
+ }), De = (e) => async (s, n) => {
267
+ n(), await s.update();
268
+ const t = await s.unregister();
269
+ console.log(`Service worker unregistration ${t ? "successful" : "failed"}`), await X({ milliseconds: 2e3 }), e.reload();
270
+ }, Re = (e) => {
271
+ const s = sessionStorage.getItem(`oidc.tabId.${e}`);
272
+ if (s)
273
+ return s;
274
+ const n = globalThis.crypto.randomUUID();
275
+ return sessionStorage.setItem(`oidc.tabId.${e}`, n), n;
276
+ }, O = (e) => (s) => new Promise(function(n, t) {
271
277
  const o = new MessageChannel();
272
278
  o.port1.onmessage = function(i) {
273
- i != null && i.data.error ? t(i.data.error) : s(i.data), o.port1.close(), o.port2.close();
274
- }, e.active.postMessage({ ...n, tabId: Re(n.configurationName) }, [
279
+ i != null && i.data.error ? t(i.data.error) : n(i.data), o.port1.close(), o.port2.close();
280
+ }, e.active.postMessage({ ...s, tabId: Re(s.configurationName) }, [
275
281
  o.port2
276
282
  ]);
277
- }), I = async (e, n) => {
278
- const s = e.service_worker_relative_url;
279
- if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !s || e.service_worker_activate() === !1)
283
+ }), I = async (e, s) => {
284
+ const n = e.service_worker_relative_url;
285
+ if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !n || e.service_worker_activate() === !1)
280
286
  return null;
281
287
  let t = null;
282
- e.service_worker_register ? t = await e.service_worker_register(s) : t = await navigator.serviceWorker.register(s);
288
+ e.service_worker_register ? t = await e.service_worker_register(n) : t = await navigator.serviceWorker.register(n);
283
289
  try {
284
290
  await navigator.serviceWorker.ready, navigator.serviceWorker.controller || await O(t)({ type: "claim" });
285
291
  } catch {
286
292
  return null;
287
293
  }
288
- const o = async (g) => O(t)({ type: "clear", data: { status: g }, configurationName: n }), i = async (g, A, S) => {
294
+ const o = async (g) => O(t)({ type: "clear", data: { status: g }, configurationName: s }), i = async (g, A, S) => {
289
295
  const W = await O(t)({
290
296
  type: "init",
291
297
  data: {
@@ -296,7 +302,7 @@ const z = ({ milliseconds: e }) => new Promise((n) => J.setTimeout(n, e)), pe =
296
302
  service_worker_convert_all_requests_to_cors: S.service_worker_convert_all_requests_to_cors
297
303
  }
298
304
  },
299
- configurationName: n
305
+ configurationName: s
300
306
  }), L = W.version;
301
307
  return L !== ue && (console.warn(
302
308
  `Service worker ${L} version mismatch with js client version ${ue}, unregistering and reloading`
@@ -309,22 +315,22 @@ const z = ({ milliseconds: e }) => new Promise((n) => J.setTimeout(n, e)), pe =
309
315
  }, a = (g) => O(t)({
310
316
  type: "setSessionState",
311
317
  data: { sessionState: g },
312
- configurationName: n
313
- }), u = async () => (await O(t)({
318
+ configurationName: s
319
+ }), l = async () => (await O(t)({
314
320
  type: "getSessionState",
315
321
  data: null,
316
- configurationName: n
317
- })).sessionState, f = (g) => (sessionStorage[`oidc.nonce.${n}`] = g.nonce, O(t)({
322
+ configurationName: s
323
+ })).sessionState, f = (g) => (sessionStorage[`oidc.nonce.${s}`] = g.nonce, O(t)({
318
324
  type: "setNonce",
319
325
  data: { nonce: g },
320
- configurationName: n
321
- })), l = async () => {
326
+ configurationName: s
327
+ })), u = async () => {
322
328
  let A = (await O(t)({
323
329
  type: "getNonce",
324
330
  data: null,
325
- configurationName: n
331
+ configurationName: s
326
332
  })).nonce;
327
- return A || (A = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage")), { nonce: A };
333
+ return A || (A = sessionStorage[`oidc.nonce.${s}`], console.warn("nonce not found in service worker, using sessionStorage")), { nonce: A };
328
334
  }, c = {};
329
335
  return {
330
336
  clearAsync: o,
@@ -332,81 +338,81 @@ const z = ({ milliseconds: e }) => new Promise((n) => J.setTimeout(n, e)), pe =
332
338
  startKeepAliveServiceWorker: () => r(e.service_worker_keep_alive_path),
333
339
  isServiceWorkerProxyActiveAsync: () => Le(e.service_worker_keep_alive_path),
334
340
  setSessionStateAsync: a,
335
- getSessionStateAsync: u,
341
+ getSessionStateAsync: l,
336
342
  setNonceAsync: f,
337
- getNonceAsync: l,
343
+ getNonceAsync: u,
338
344
  setLoginParams: (g) => {
339
- c[n] = g, localStorage[`oidc.login.${n}`] = JSON.stringify(g);
345
+ c[s] = g, localStorage[`oidc.login.${s}`] = JSON.stringify(g);
340
346
  },
341
347
  getLoginParams: () => {
342
- const g = localStorage[`oidc.login.${n}`];
343
- return c[n] || (c[n] = JSON.parse(g)), c[n];
348
+ const g = localStorage[`oidc.login.${s}`];
349
+ return c[s] || (c[s] = JSON.parse(g)), c[s];
344
350
  },
345
351
  getStateAsync: async () => {
346
352
  let A = (await O(t)({
347
353
  type: "getState",
348
354
  data: null,
349
- configurationName: n
355
+ configurationName: s
350
356
  })).state;
351
- return A || (A = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage")), A;
357
+ return A || (A = sessionStorage[`oidc.state.${s}`], console.warn("state not found in service worker, using sessionStorage")), A;
352
358
  },
353
- setStateAsync: async (g) => (sessionStorage[`oidc.state.${n}`] = g, O(t)({
359
+ setStateAsync: async (g) => (sessionStorage[`oidc.state.${s}`] = g, O(t)({
354
360
  type: "setState",
355
361
  data: { state: g },
356
- configurationName: n
362
+ configurationName: s
357
363
  })),
358
364
  getCodeVerifierAsync: async () => {
359
365
  let A = (await O(t)({
360
366
  type: "getCodeVerifier",
361
367
  data: null,
362
- configurationName: n
368
+ configurationName: s
363
369
  })).codeVerifier;
364
- return A || (A = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage")), A;
370
+ return A || (A = sessionStorage[`oidc.code_verifier.${s}`], console.warn("codeVerifier not found in service worker, using sessionStorage")), A;
365
371
  },
366
- setCodeVerifierAsync: async (g) => (sessionStorage[`oidc.code_verifier.${n}`] = g, O(t)({
372
+ setCodeVerifierAsync: async (g) => (sessionStorage[`oidc.code_verifier.${s}`] = g, O(t)({
367
373
  type: "setCodeVerifier",
368
374
  data: { codeVerifier: g },
369
- configurationName: n
375
+ configurationName: s
370
376
  })),
371
377
  setDemonstratingProofOfPossessionNonce: async (g) => {
372
378
  await O(t)({
373
379
  type: "setDemonstratingProofOfPossessionNonce",
374
380
  data: { demonstratingProofOfPossessionNonce: g },
375
- configurationName: n
381
+ configurationName: s
376
382
  });
377
383
  },
378
384
  getDemonstratingProofOfPossessionNonce: async () => (await O(t)({
379
385
  type: "getDemonstratingProofOfPossessionNonce",
380
386
  data: null,
381
- configurationName: n
387
+ configurationName: s
382
388
  })).demonstratingProofOfPossessionNonce,
383
389
  setDemonstratingProofOfPossessionJwkAsync: async (g) => {
384
390
  const A = JSON.stringify(g);
385
391
  await O(t)({
386
392
  type: "setDemonstratingProofOfPossessionJwk",
387
393
  data: { demonstratingProofOfPossessionJwkJson: A },
388
- configurationName: n
394
+ configurationName: s
389
395
  });
390
396
  },
391
397
  getDemonstratingProofOfPossessionJwkAsync: async () => {
392
398
  const g = await O(t)({
393
399
  type: "getDemonstratingProofOfPossessionJwk",
394
400
  data: null,
395
- configurationName: n
401
+ configurationName: s
396
402
  });
397
403
  return g.demonstratingProofOfPossessionJwkJson ? JSON.parse(g.demonstratingProofOfPossessionJwkJson) : null;
398
404
  }
399
405
  };
400
- }, R = {}, $e = (e, n = window.sessionStorage, s) => {
401
- if (!R[e] && n) {
402
- const o = n.getItem(e);
406
+ }, R = {}, $e = (e, s = window.sessionStorage, n) => {
407
+ if (!R[e] && s) {
408
+ const o = s.getItem(e);
403
409
  o && (R[e] = JSON.parse(o));
404
410
  }
405
- const t = 1e3 * s;
411
+ const t = 1e3 * n;
406
412
  return R[e] && R[e].timestamp + t > Date.now() ? R[e].result : null;
407
- }, Ue = (e, n, s = window.sessionStorage) => {
413
+ }, Ke = (e, s, n = window.sessionStorage) => {
408
414
  const t = Date.now();
409
- R[e] = { result: n, timestamp: t }, s && s.setItem(e, JSON.stringify({ result: n, timestamp: t }));
415
+ R[e] = { result: s, timestamp: t }, n && n.setItem(e, JSON.stringify({ result: s, timestamp: t }));
410
416
  };
411
417
  function we(e) {
412
418
  return new TextEncoder().encode(e);
@@ -414,19 +420,19 @@ function we(e) {
414
420
  function Ae(e) {
415
421
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+/g, "");
416
422
  }
417
- function Ke(e) {
418
- return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(s, t) {
423
+ function Ue(e) {
424
+ return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(n, t) {
419
425
  return String.fromCharCode(parseInt(t, 16));
420
426
  });
421
427
  }
422
428
  const ie = (e) => {
423
- let n = "";
424
- return e.forEach(function(s) {
425
- n += String.fromCharCode(s);
426
- }), Ae(n);
429
+ let s = "";
430
+ return e.forEach(function(n) {
431
+ s += String.fromCharCode(n);
432
+ }), Ae(s);
427
433
  };
428
434
  function fe(e) {
429
- return Ae(Ke(e));
435
+ return Ae(Ue(e));
430
436
  }
431
437
  const Fe = {
432
438
  importKeyAlgorithm: {
@@ -441,13 +447,13 @@ const Fe = {
441
447
  },
442
448
  digestAlgorithm: { name: "SHA-256" },
443
449
  jwtHeaderAlgorithm: "ES256"
444
- }, Ve = (e) => async (n, s, t, o, i = "dpop+jwt") => {
445
- switch (n = Object.assign({}, n), s.typ = i, s.alg = o.jwtHeaderAlgorithm, s.alg) {
450
+ }, Ve = (e) => async (s, n, t, o, i = "dpop+jwt") => {
451
+ switch (s = Object.assign({}, s), n.typ = i, n.alg = o.jwtHeaderAlgorithm, n.alg) {
446
452
  case "ES256":
447
- s.jwk = { kty: n.kty, crv: n.crv, x: n.x, y: n.y };
453
+ n.jwk = { kty: s.kty, crv: s.crv, x: s.x, y: s.y };
448
454
  break;
449
455
  case "RS256":
450
- s.jwk = { kty: n.kty, n: n.n, e: n.e, kid: s.kid };
456
+ n.jwk = { kty: s.kty, n: s.n, e: s.e, kid: n.kid };
451
457
  break;
452
458
  default:
453
459
  throw new Error("Unknown or not implemented JWS algorithm");
@@ -455,36 +461,36 @@ const Fe = {
455
461
  const r = {
456
462
  // @ts-ignore
457
463
  // JWT "headers" really means JWS "protected headers"
458
- protected: fe(JSON.stringify(s)),
464
+ protected: fe(JSON.stringify(n)),
459
465
  // @ts-ignore
460
466
  // JWT "claims" are really a JSON-defined JWS "payload"
461
467
  payload: fe(JSON.stringify(t))
462
- }, a = o.importKeyAlgorithm, u = !0, f = ["sign"], l = await e.crypto.subtle.importKey("jwk", n, a, u, f), c = we(`${r.protected}.${r.payload}`), _ = o.signAlgorithm, d = await e.crypto.subtle.sign(_, l, c);
468
+ }, a = o.importKeyAlgorithm, l = !0, f = ["sign"], u = await e.crypto.subtle.importKey("jwk", s, a, l, f), c = we(`${r.protected}.${r.payload}`), _ = o.signAlgorithm, d = await e.crypto.subtle.sign(_, u, c);
463
469
  return r.signature = ie(new Uint8Array(d)), `${r.protected}.${r.payload}.${r.signature}`;
464
- }, Me = { sign: Ve }, Je = (e) => async (n) => {
465
- const s = n, t = !0, o = ["sign", "verify"], i = await e.crypto.subtle.generateKey(s, t, o);
470
+ }, Je = { sign: Ve }, Me = (e) => async (s) => {
471
+ const n = s, t = !0, o = ["sign", "verify"], i = await e.crypto.subtle.generateKey(n, t, o);
466
472
  return await e.crypto.subtle.exportKey("jwk", i.privateKey);
467
- }, qe = (e) => {
468
- const n = Object.assign({}, e);
469
- return delete n.d, n.key_ops = ["verify"], n;
470
- }, Be = {
471
- generate: Je,
472
- neuter: qe
473
- }, He = (e) => async (n, s) => {
473
+ }, Be = (e) => {
474
+ const s = Object.assign({}, e);
475
+ return delete s.d, s.key_ops = ["verify"], s;
476
+ }, He = {
477
+ generate: Me,
478
+ neuter: Be
479
+ }, qe = (e) => async (s, n) => {
474
480
  let t;
475
- switch (n.kty) {
481
+ switch (s.kty) {
476
482
  case "EC":
477
- t = '{"crv":"CRV","kty":"EC","x":"X","y":"Y"}'.replace("CRV", n.crv).replace("X", n.x).replace("Y", n.y);
483
+ t = '{"crv":"CRV","kty":"EC","x":"X","y":"Y"}'.replace("CRV", s.crv).replace("X", s.x).replace("Y", s.y);
478
484
  break;
479
485
  case "RSA":
480
- t = '{"e":"E","kty":"RSA","n":"N"}'.replace("E", n.e).replace("N", n.n);
486
+ t = '{"e":"E","kty":"RSA","n":"N"}'.replace("E", s.e).replace("N", s.n);
481
487
  break;
482
488
  default:
483
489
  throw new Error("Unknown or not implemented JWK type");
484
490
  }
485
- const o = await e.crypto.subtle.digest(s, we(t));
491
+ const o = await e.crypto.subtle.digest(n, we(t));
486
492
  return ie(new Uint8Array(o));
487
- }, je = { thumbprint: He }, Ge = (e) => async (n) => await Be.generate(e)(n), Se = (e) => (n) => async (s, t = "POST", o, i = {}) => {
493
+ }, je = { thumbprint: qe }, Ge = (e) => async (s) => await He.generate(e)(s), Se = (e) => (s) => async (n, t = "POST", o, i = {}) => {
488
494
  const r = {
489
495
  // https://www.rfc-editor.org/rfc/rfc9449.html#name-concept
490
496
  jti: btoa(Ye()),
@@ -493,77 +499,77 @@ const Fe = {
493
499
  iat: Math.round(Date.now() / 1e3),
494
500
  ...i
495
501
  }, a = await je.thumbprint(e)(
496
- s,
497
- n.digestAlgorithm
502
+ n,
503
+ s.digestAlgorithm
498
504
  );
499
- return await Me.sign(e)(
500
- s,
505
+ return await Je.sign(e)(
506
+ n,
501
507
  { kid: a },
502
508
  r,
503
- n
509
+ s
504
510
  );
505
511
  }, Ye = () => {
506
- const e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", n = "0123456789abcdef";
507
- let s = 0, t = "";
512
+ const e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", s = "0123456789abcdef";
513
+ let n = 0, t = "";
508
514
  for (let o = 0; o < 36; o++)
509
- e[o] !== "-" && e[o] !== "4" && (s = Math.random() * 16 | 0), e[o] === "x" ? t += n[s] : e[o] === "y" ? (s &= 3, s |= 8, t += n[s]) : t += e[o];
515
+ e[o] !== "-" && e[o] !== "4" && (n = Math.random() * 16 | 0), e[o] === "x" ? t += s[n] : e[o] === "y" ? (n &= 3, n |= 8, t += s[n]) : t += e[o];
510
516
  return t;
511
- }, Te = () => {
512
- const e = typeof window < "u" && !!window.crypto, n = e && !!window.crypto.subtle;
513
- return { hasCrypto: e, hasSubtleCrypto: n };
514
- }, ee = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", Xe = (e) => {
515
- const n = [];
516
- for (let s = 0; s < e.byteLength; s += 1) {
517
- const t = e[s] % ee.length;
518
- n.push(ee[t]);
519
- }
520
- return n.join("");
521
- }, ne = (e) => {
522
- const n = new Uint8Array(e), { hasCrypto: s } = Te();
523
- if (s)
524
- window.crypto.getRandomValues(n);
517
+ }, ve = () => {
518
+ const e = typeof window < "u" && !!window.crypto, s = e && !!window.crypto.subtle;
519
+ return { hasCrypto: e, hasSubtleCrypto: s };
520
+ }, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", Xe = (e) => {
521
+ const s = [];
522
+ for (let n = 0; n < e.byteLength; n += 1) {
523
+ const t = e[n] % Z.length;
524
+ s.push(Z[t]);
525
+ }
526
+ return s.join("");
527
+ }, ee = (e) => {
528
+ const s = new Uint8Array(e), { hasCrypto: n } = ve();
529
+ if (n)
530
+ window.crypto.getRandomValues(s);
525
531
  else
526
532
  for (let t = 0; t < e; t += 1)
527
- n[t] = Math.random() * ee.length | 0;
528
- return Xe(n);
533
+ s[t] = Math.random() * Z.length | 0;
534
+ return Xe(s);
529
535
  };
530
536
  function ze(e) {
531
- const n = new ArrayBuffer(e.length), s = new Uint8Array(n);
537
+ const s = new ArrayBuffer(e.length), n = new Uint8Array(s);
532
538
  for (let t = 0; t < e.length; t++)
533
- s[t] = e.charCodeAt(t);
534
- return s;
539
+ n[t] = e.charCodeAt(t);
540
+ return n;
535
541
  }
536
- function ve(e) {
537
- return new Promise((n, s) => {
542
+ function Te(e) {
543
+ return new Promise((s, n) => {
538
544
  crypto.subtle.digest("SHA-256", ze(e)).then(
539
- (t) => n(ie(new Uint8Array(t))),
540
- (t) => s(t)
545
+ (t) => s(ie(new Uint8Array(t))),
546
+ (t) => n(t)
541
547
  );
542
548
  });
543
549
  }
544
550
  const Qe = (e) => {
545
551
  if (e.length < 43 || e.length > 128)
546
552
  return Promise.reject(new Error("Invalid code length."));
547
- const { hasSubtleCrypto: n } = Te();
548
- return n ? ve(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
549
- }, Ze = 60 * 60, en = (e) => async (n, s = Ze, t = window.sessionStorage, o = 1e4) => {
550
- const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a = $e(r, t, s);
553
+ const { hasSubtleCrypto: s } = ve();
554
+ return s ? Te(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
555
+ }, Ze = 60 * 60, es = (e) => async (s, n = Ze, t = window.sessionStorage, o = 1e4) => {
556
+ const i = `${s}/.well-known/openid-configuration`, r = `oidc.server:${s}`, a = $e(r, t, n);
551
557
  if (a)
552
- return new te(a);
553
- const u = await q(e)(i, {}, o);
554
- if (u.status !== 200)
558
+ return new ne(a);
559
+ const l = await B(e)(i, {}, o);
560
+ if (l.status !== 200)
555
561
  return null;
556
- const f = await u.json();
557
- return Ue(r, f, t), new te(f);
558
- }, q = (e) => async (n, s = {}, t = 1e4, o = 0) => {
562
+ const f = await l.json();
563
+ return Ke(r, f, t), new ne(f);
564
+ }, B = (e) => async (s, n = {}, t = 1e4, o = 0) => {
559
565
  let i;
560
566
  try {
561
567
  const r = new AbortController();
562
- setTimeout(() => r.abort(), t), i = await e(n, { ...s, signal: r.signal });
568
+ setTimeout(() => r.abort(), t), i = await e(s, { ...n, signal: r.signal });
563
569
  } catch (r) {
564
570
  if (r.name === "AbortError" || r.message === "Network request failed") {
565
571
  if (o <= 1)
566
- return await q(e)(n, s, t, o + 1);
572
+ return await B(e)(s, n, t, o + 1);
567
573
  throw r;
568
574
  } else
569
575
  throw console.error(r.message), r;
@@ -572,22 +578,22 @@ const Qe = (e) => {
572
578
  }, se = {
573
579
  refresh_token: "refresh_token",
574
580
  access_token: "access_token"
575
- }, de = (e) => async (n, s, t = se.refresh_token, o, i = {}, r = 1e4) => {
581
+ }, de = (e) => async (s, n, t = se.refresh_token, o, i = {}, r = 1e4) => {
576
582
  const a = {
577
- token: s,
583
+ token: n,
578
584
  token_type_hint: t,
579
585
  client_id: o
580
586
  };
581
587
  for (const [c, _] of Object.entries(i))
582
588
  a[c] === void 0 && (a[c] = _);
583
- const u = [];
589
+ const l = [];
584
590
  for (const c in a) {
585
591
  const _ = encodeURIComponent(c), d = encodeURIComponent(a[c]);
586
- u.push(`${_}=${d}`);
592
+ l.push(`${_}=${d}`);
587
593
  }
588
- const f = u.join("&");
589
- return (await q(e)(
590
- n,
594
+ const f = l.join("&");
595
+ return (await B(e)(
596
+ s,
591
597
  {
592
598
  method: "POST",
593
599
  headers: {
@@ -599,16 +605,16 @@ const Qe = (e) => {
599
605
  )).status !== 200 ? { success: !1 } : {
600
606
  success: !0
601
607
  };
602
- }, nn = (e) => async (n, s, t, o, i = {}, r, a = 1e4) => {
608
+ }, ss = (e) => async (s, n, t, o, i = {}, r, a = 1e4) => {
603
609
  for (const [d, y] of Object.entries(t))
604
- s[d] === void 0 && (s[d] = y);
605
- const u = [];
606
- for (const d in s) {
607
- const y = encodeURIComponent(d), p = encodeURIComponent(s[d]);
608
- u.push(`${y}=${p}`);
610
+ n[d] === void 0 && (n[d] = y);
611
+ const l = [];
612
+ for (const d in n) {
613
+ const y = encodeURIComponent(d), p = encodeURIComponent(n[d]);
614
+ l.push(`${y}=${p}`);
609
615
  }
610
- const f = u.join("&"), l = await q(e)(
611
- n,
616
+ const f = l.join("&"), u = await B(e)(
617
+ s,
612
618
  {
613
619
  method: "POST",
614
620
  headers: {
@@ -619,40 +625,40 @@ const Qe = (e) => {
619
625
  },
620
626
  a
621
627
  );
622
- if (l.status !== 200)
628
+ if (u.status !== 200)
623
629
  return {
624
630
  success: !1,
625
- status: l.status,
631
+ status: u.status,
626
632
  demonstratingProofOfPossessionNonce: null
627
633
  };
628
- const c = await l.json();
634
+ const c = await u.json();
629
635
  let _ = null;
630
- return l.headers.has(G) && (_ = l.headers.get(
636
+ return u.headers.has(G) && (_ = u.headers.get(
631
637
  G
632
638
  )), {
633
639
  success: !0,
634
- status: l.status,
640
+ status: u.status,
635
641
  data: oe(c, o, r),
636
642
  demonstratingProofOfPossessionNonce: _
637
643
  };
638
- }, sn = (e, n) => async (s, t) => {
644
+ }, ns = (e, s) => async (n, t) => {
639
645
  t = t ? { ...t } : {};
640
- const o = ne(128), i = await Qe(o);
646
+ const o = ee(128), i = await Qe(o);
641
647
  await e.setCodeVerifierAsync(o), await e.setStateAsync(t.state), t.code_challenge = i, t.code_challenge_method = "S256";
642
648
  let r = "";
643
649
  if (t)
644
- for (const [a, u] of Object.entries(t))
645
- r === "" ? r += "?" : r += "&", r += `${a}=${encodeURIComponent(u)}`;
646
- n.open(`${s}${r}`);
647
- }, G = "DPoP-Nonce", tn = (e) => async (n, s, t, o, i = 1e4) => {
648
- s = s ? { ...s } : {}, s.code_verifier = await e.getCodeVerifierAsync();
650
+ for (const [a, l] of Object.entries(t))
651
+ r === "" ? r += "?" : r += "&", r += `${a}=${encodeURIComponent(l)}`;
652
+ s.open(`${n}${r}`);
653
+ }, G = "DPoP-Nonce", ts = (e) => async (s, n, t, o, i = 1e4) => {
654
+ n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
649
655
  const r = [];
650
- for (const c in s) {
651
- const _ = encodeURIComponent(c), d = encodeURIComponent(s[c]);
656
+ for (const c in n) {
657
+ const _ = encodeURIComponent(c), d = encodeURIComponent(n[c]);
652
658
  r.push(`${_}=${d}`);
653
659
  }
654
- const a = r.join("&"), u = await q(fetch)(
655
- n,
660
+ const a = r.join("&"), l = await B(fetch)(
661
+ s,
656
662
  {
657
663
  method: "POST",
658
664
  headers: {
@@ -663,66 +669,58 @@ const Qe = (e) => {
663
669
  },
664
670
  i
665
671
  );
666
- if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), u.status !== 200)
667
- return { success: !1, status: u.status };
672
+ if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), l.status !== 200)
673
+ return { success: !1, status: l.status };
668
674
  let f = null;
669
- u.headers.has(G) && (f = u.headers.get(
675
+ l.headers.has(G) && (f = l.headers.get(
670
676
  G
671
677
  ));
672
- const l = await u.json();
678
+ const u = await l.json();
673
679
  return {
674
680
  success: !0,
675
681
  data: {
676
- state: s.state,
677
- tokens: oe(l, null, o),
682
+ state: n.state,
683
+ tokens: oe(u, null, o),
678
684
  demonstratingProofOfPossessionNonce: f
679
685
  }
680
686
  };
681
687
  };
682
- async function he(e, n, s) {
688
+ async function he(e, s, n) {
683
689
  const t = (a) => {
684
690
  e.tokens = a;
685
- }, { tokens: o, status: i } = await B(e)(
691
+ }, { tokens: o, status: i } = await H(e)(
686
692
  t,
687
693
  0,
688
- n,
689
- s
694
+ s,
695
+ n
690
696
  );
691
- return await e.ensureUniqueTabId(), await I(e.configuration, e.configurationName) || await P(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? o : (await e.destroyAsync(i), null);
697
+ return await I(e.configuration, e.configurationName) || await P(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? o : (await e.destroyAsync(i), null);
692
698
  }
693
- const on = async (e, n) => {
694
- await e.ensureUniqueTabId();
695
- const s = await I(n, e.configurationName);
696
- if (s) {
697
- const t = await e.initAsync(
698
- n.authority,
699
- n.authority_configuration
700
- ), { tokens: o } = await s.initAsync(
701
- t,
702
- "tryKeepExistingSessionAsync",
703
- n
704
- );
705
- return o;
706
- } else {
707
- const t = P(e.configurationName, n.storage ?? sessionStorage);
708
- let { tokens: o } = await t.initAsync();
709
- return o = X(o, e.tokens, n.token_renew_mode), o;
710
- }
711
- };
712
- async function be(e, n = !1, s = null) {
699
+ async function be(e, s = !1, n = null) {
713
700
  const t = e.configuration, o = `${t.client_id}_${e.configurationName}_${t.authority}`;
714
701
  let i;
715
- await e.ensureUniqueTabId();
716
702
  const r = await I(e.configuration, e.configurationName);
717
- return (t == null ? void 0 : t.storage) === (window == null ? void 0 : window.sessionStorage) && !r ? i = await he(e, n, s) : i = await navigator.locks.request(o, { ifAvailable: !0 }, async (a) => a ? await he(e, n, s) : (e.publishEvent(C.eventNames.syncTokensAsync_lock_not_available, {
718
- lock: "lock not available"
719
- }), await on(e, t))), i ? (e.timeoutId && (e.timeoutId = M(e, e.tokens.expiresAt, s)), e.tokens) : null;
703
+ if ((t == null ? void 0 : t.storage) === (window == null ? void 0 : window.sessionStorage) && !r)
704
+ i = await he(e, s, n);
705
+ else {
706
+ let a = "retry";
707
+ for (; a === "retry"; )
708
+ a = await navigator.locks.request(
709
+ o,
710
+ { ifAvailable: !0 },
711
+ async (l) => l ? await he(e, s, n) : (e.publishEvent(C.eventNames.syncTokensAsync_lock_not_available, {
712
+ lock: "lock not available"
713
+ }), "retry")
714
+ );
715
+ i = a;
716
+ }
717
+ return i ? (e.timeoutId && (e.timeoutId = M(e, e.tokens.expiresAt, n)), e.tokens) : null;
720
718
  }
721
- const M = (e, n, s = null) => {
719
+ const M = (e, s, n = null) => {
722
720
  const t = e.configuration.refresh_time_before_tokens_expiration_in_second;
723
- return J.setTimeout(async () => {
724
- const i = { timeLeft: K(t, n) };
725
- e.publishEvent(C.eventNames.token_timer, i), await be(e, !1, s);
721
+ return e.timeoutId && K.clearTimeout(e.timeoutId), K.setTimeout(async () => {
722
+ const i = { timeLeft: F(t, s) };
723
+ e.publishEvent(C.eventNames.token_timer, i), await be(e, !1, n);
726
724
  }, 1e3);
727
725
  }, N = {
728
726
  FORCE_REFRESH: "FORCE_REFRESH",
@@ -732,22 +730,20 @@ const M = (e, n, s = null) => {
732
730
  TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID",
733
731
  LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
734
732
  REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS"
735
- }, rn = (e) => async (n, s, t, o = !1) => {
733
+ }, os = (e) => async (s, n, t, o = !1) => {
736
734
  const i = { nonce: null };
737
735
  if (!t)
738
736
  return { tokens: null, status: "NOT_CONNECTED", nonce: i };
739
737
  let r = i;
740
738
  const a = await e.initAsync(
741
- n.authority,
742
- n.authority_configuration
743
- );
744
- await e.ensureUniqueTabId();
745
- const u = await I(n, s);
746
- if (u) {
747
- const { status: c, tokens: _ } = await u.initAsync(
739
+ s.authority,
740
+ s.authority_configuration
741
+ ), l = await I(s, n);
742
+ if (l) {
743
+ const { status: c, tokens: _ } = await l.initAsync(
748
744
  a,
749
745
  "syncTokensAsync",
750
- n
746
+ s
751
747
  );
752
748
  if (c === "LOGGED_OUT")
753
749
  return { tokens: null, status: "LOGOUT_FROM_ANOTHER_TAB", nonce: i };
@@ -756,23 +752,23 @@ const M = (e, n, s = null) => {
756
752
  if (!c || !_)
757
753
  return { tokens: null, status: "REQUIRE_SYNC_TOKENS", nonce: i };
758
754
  if (_.issuedAt !== t.issuedAt) {
759
- const y = K(
760
- n.refresh_time_before_tokens_expiration_in_second,
755
+ const y = F(
756
+ s.refresh_time_before_tokens_expiration_in_second,
761
757
  _.expiresAt
762
- ) > 0 ? "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" : "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID", p = await u.getNonceAsync();
758
+ ) > 0 ? "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" : "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID", p = await l.getNonceAsync();
763
759
  return { tokens: _, status: y, nonce: p };
764
760
  }
765
- r = await u.getNonceAsync();
761
+ r = await l.getNonceAsync();
766
762
  } else {
767
- const c = P(s, n.storage ?? sessionStorage), _ = await c.initAsync();
763
+ const c = P(n, s.storage ?? sessionStorage), _ = await c.initAsync();
768
764
  let { tokens: d } = _;
769
765
  const { status: y } = _;
770
- if (d && (d = X(d, e.tokens, n.token_renew_mode)), d) {
766
+ if (d && (d = te(d, e.tokens, s.token_renew_mode)), d) {
771
767
  if (y === "SESSIONS_LOST")
772
768
  return { tokens: null, status: "SESSIONS_LOST", nonce: i };
773
769
  if (d.issuedAt !== t.issuedAt) {
774
- const k = K(
775
- n.refresh_time_before_tokens_expiration_in_second,
770
+ const k = F(
771
+ s.refresh_time_before_tokens_expiration_in_second,
776
772
  d.expiresAt
777
773
  ) > 0 ? "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" : "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID", b = await c.getNonceAsync();
778
774
  return { tokens: d, status: k, nonce: b };
@@ -780,102 +776,101 @@ const M = (e, n, s = null) => {
780
776
  } else return { tokens: null, status: "LOGOUT_FROM_ANOTHER_TAB", nonce: i };
781
777
  r = await c.getNonceAsync();
782
778
  }
783
- const l = K(
784
- n.refresh_time_before_tokens_expiration_in_second,
779
+ const u = F(
780
+ s.refresh_time_before_tokens_expiration_in_second,
785
781
  t.expiresAt
786
782
  ) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
787
- return o ? { tokens: t, status: "FORCE_REFRESH", nonce: r } : { tokens: t, status: l, nonce: r };
788
- }, B = (e) => async (n, s = 0, t = !1, o = null) => {
783
+ return o ? { tokens: t, status: "FORCE_REFRESH", nonce: r } : { tokens: t, status: u, nonce: r };
784
+ }, H = (e) => async (s, n = 0, t = !1, o = null) => {
789
785
  if (!navigator.onLine && document.hidden)
790
786
  return { tokens: e.tokens, status: "GIVE_UP" };
791
787
  let i = 6;
792
788
  for (; !navigator.onLine && i > 0; )
793
- await z({ milliseconds: 1e3 }), i--, e.publishEvent(m.refreshTokensAsync, {
789
+ await X({ milliseconds: 1e3 }), i--, e.publishEvent(m.refreshTokensAsync, {
794
790
  message: `wait because navigator is offline try ${i}`
795
791
  });
796
- const r = s + 1;
792
+ const r = n + 1;
797
793
  o || (o = {});
798
- const a = e.configuration, u = (l, c = null, _ = null) => re(
794
+ const a = e.configuration, l = (u, c = null, _ = null) => re(
799
795
  e.configurationName,
800
796
  e.configuration,
801
797
  e.publishEvent.bind(e)
802
- )(l, c, _), f = async () => {
798
+ )(u, c, _), f = async () => {
803
799
  try {
804
- let l;
805
- await e.ensureUniqueTabId();
800
+ let u;
806
801
  const c = await I(a, e.configurationName);
807
- c ? l = c.getLoginParams() : l = P(e.configurationName, a.storage).getLoginParams();
808
- const _ = await u({
809
- ...l.extras,
802
+ c ? u = c.getLoginParams() : u = P(e.configurationName, a.storage).getLoginParams();
803
+ const _ = await l({
804
+ ...u.extras,
810
805
  ...o,
811
806
  prompt: "none"
812
807
  });
813
- return _ ? _.error ? (n(null), e.publishEvent(m.refreshTokensAsync_error, {
808
+ return _ ? _.error ? (s(null), e.publishEvent(m.refreshTokensAsync_error, {
814
809
  message: "refresh token silent"
815
- }), { tokens: null, status: "SESSION_LOST" }) : (n(_.tokens), e.publishEvent(C.eventNames.token_renewed, {}), { tokens: _.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(m.refreshTokensAsync_error, {
810
+ }), { tokens: null, status: "SESSION_LOST" }) : (s(_.tokens), e.publishEvent(C.eventNames.token_renewed, {}), { tokens: _.tokens, status: "LOGGED" }) : (s(null), e.publishEvent(m.refreshTokensAsync_error, {
816
811
  message: "refresh token silent not active"
817
812
  }), { tokens: null, status: "SESSION_LOST" });
818
- } catch (l) {
819
- return console.error(l), e.publishEvent(m.refreshTokensAsync_silent_error, {
813
+ } catch (u) {
814
+ return console.error(u), e.publishEvent(m.refreshTokensAsync_silent_error, {
820
815
  message: "exceptionSilent",
821
- exception: l.message
822
- }), await B(e)(n, r, t, o);
816
+ exception: u.message
817
+ }), await H(e)(s, r, t, o);
823
818
  }
824
819
  };
825
820
  try {
826
- const { status: l, tokens: c, nonce: _ } = await rn(e)(
821
+ const { status: u, tokens: c, nonce: _ } = await os(e)(
827
822
  a,
828
823
  e.configurationName,
829
824
  e.tokens,
830
825
  t
831
826
  );
832
- switch (l) {
827
+ switch (u) {
833
828
  case N.SESSION_LOST:
834
- return n(null), e.publishEvent(m.refreshTokensAsync_error, {
829
+ return s(null), e.publishEvent(m.refreshTokensAsync_error, {
835
830
  message: "refresh token session lost"
836
831
  }), { tokens: null, status: "SESSION_LOST" };
837
832
  case N.NOT_CONNECTED:
838
- return n(null), { tokens: null, status: null };
833
+ return s(null), { tokens: null, status: null };
839
834
  case N.TOKENS_VALID:
840
- return n(c), { tokens: c, status: "LOGGED_IN" };
835
+ return s(c), { tokens: c, status: "LOGGED_IN" };
841
836
  case N.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
842
- return n(c), e.publishEvent(C.eventNames.token_renewed, {
837
+ return s(c), e.publishEvent(C.eventNames.token_renewed, {
843
838
  reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"
844
839
  }), { tokens: c, status: "LOGGED_IN" };
845
840
  case N.LOGOUT_FROM_ANOTHER_TAB:
846
- return n(null), e.publishEvent(m.logout_from_another_tab, {
841
+ return s(null), e.publishEvent(m.logout_from_another_tab, {
847
842
  status: "session syncTokensAsync"
848
843
  }), { tokens: null, status: "LOGGED_OUT" };
849
844
  case N.REQUIRE_SYNC_TOKENS:
850
- return a.token_automatic_renew_mode == V.AutomaticOnlyWhenFetchExecuted && N.FORCE_REFRESH !== l ? (e.publishEvent(m.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(m.refreshTokensAsync_begin, { tryNumber: s }), await f());
845
+ return a.token_automatic_renew_mode == J.AutomaticOnlyWhenFetchExecuted && N.FORCE_REFRESH !== u ? (e.publishEvent(m.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(m.refreshTokensAsync_begin, { tryNumber: n }), await f());
851
846
  default: {
852
- if (a.token_automatic_renew_mode == V.AutomaticOnlyWhenFetchExecuted && N.FORCE_REFRESH !== l)
847
+ if (a.token_automatic_renew_mode == J.AutomaticOnlyWhenFetchExecuted && N.FORCE_REFRESH !== u)
853
848
  return e.publishEvent(m.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
854
849
  if (e.publishEvent(m.refreshTokensAsync_begin, {
855
850
  refreshToken: c.refreshToken,
856
- status: l,
857
- tryNumber: s
851
+ status: u,
852
+ tryNumber: n
858
853
  }), !c.refreshToken)
859
854
  return await f();
860
855
  const d = a.client_id, y = a.redirect_uri, p = a.authority, b = { ...a.token_request_extras ? a.token_request_extras : {} };
861
- for (const [w, T] of Object.entries(o))
862
- w.endsWith(":token_request") && (b[w.replace(":token_request", "")] = T);
856
+ for (const [w, v] of Object.entries(o))
857
+ w.endsWith(":token_request") && (b[w.replace(":token_request", "")] = v);
863
858
  return await (async () => {
864
859
  const w = {
865
860
  client_id: d,
866
861
  redirect_uri: y,
867
862
  grant_type: "refresh_token",
868
863
  refresh_token: c.refreshToken
869
- }, T = await e.initAsync(
864
+ }, v = await e.initAsync(
870
865
  p,
871
866
  a.authority_configuration
872
- ), h = document.hidden ? 1e4 : 3e4 * 10, g = T.tokenEndpoint, A = {};
867
+ ), h = document.hidden ? 1e4 : 3e4 * 10, g = v.tokenEndpoint, A = {};
873
868
  a.demonstrating_proof_of_possession && (A.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
874
869
  c.accessToken,
875
870
  g,
876
871
  "POST"
877
872
  ));
878
- const S = await nn(e.getFetch())(
873
+ const S = await ss(e.getFetch())(
879
874
  g,
880
875
  w,
881
876
  b,
@@ -888,16 +883,15 @@ const M = (e, n, s = null) => {
888
883
  const { isValid: W, reason: L } = me(
889
884
  S.data,
890
885
  _.nonce,
891
- T
886
+ v
892
887
  );
893
888
  if (!W)
894
- return n(null), e.publishEvent(m.refreshTokensAsync_error, {
889
+ return s(null), e.publishEvent(m.refreshTokensAsync_error, {
895
890
  message: `refresh token return not valid tokens, reason: ${L}`
896
891
  }), { tokens: null, status: "SESSION_LOST" };
897
- if (n(S.data), S.demonstratingProofOfPossessionNonce) {
898
- await e.ensureUniqueTabId();
899
- const v = await I(a, e.configurationName);
900
- v ? await v.setDemonstratingProofOfPossessionNonce(
892
+ if (s(S.data), S.demonstratingProofOfPossessionNonce) {
893
+ const T = await I(a, e.configurationName);
894
+ T ? await T.setDemonstratingProofOfPossessionNonce(
901
895
  S.demonstratingProofOfPossessionNonce
902
896
  ) : await P(e.configurationName, a.storage).setDemonstratingProofOfPossessionNonce(
903
897
  S.demonstratingProofOfPossessionNonce
@@ -910,10 +904,10 @@ const M = (e, n, s = null) => {
910
904
  return e.publishEvent(m.refreshTokensAsync_silent_error, {
911
905
  message: "bad request",
912
906
  tokenResponse: S
913
- }), S.status >= 400 && S.status < 500 ? (n(null), e.publishEvent(m.refreshTokensAsync_error, {
907
+ }), S.status >= 400 && S.status < 500 ? (s(null), e.publishEvent(m.refreshTokensAsync_error, {
914
908
  message: `session lost: ${S.status}`
915
- }), { tokens: null, status: "SESSION_LOST" }) : await B(e)(
916
- n,
909
+ }), { tokens: null, status: "SESSION_LOST" }) : await H(e)(
910
+ s,
917
911
  r,
918
912
  t,
919
913
  o
@@ -921,75 +915,75 @@ const M = (e, n, s = null) => {
921
915
  })();
922
916
  }
923
917
  }
924
- } catch (l) {
925
- return console.error(l), e.publishEvent(m.refreshTokensAsync_silent_error, {
918
+ } catch (u) {
919
+ return console.error(u), e.publishEvent(m.refreshTokensAsync_silent_error, {
926
920
  message: "exception",
927
- exception: l.message
921
+ exception: u.message
928
922
  }), new Promise((c, _) => {
929
923
  setTimeout(() => {
930
- B(e)(n, r, t, o).then(c).catch(_);
924
+ H(e)(s, r, t, o).then(c).catch(_);
931
925
  }, 1e3);
932
926
  });
933
927
  }
934
- }, re = (e, n, s) => (t = null, o = null, i = null) => {
935
- if (!n.silent_redirect_uri || !n.silent_login_uri)
928
+ }, re = (e, s, n) => (t = null, o = null, i = null) => {
929
+ if (!s.silent_redirect_uri || !s.silent_login_uri)
936
930
  return Promise.resolve(null);
937
931
  try {
938
- s(m.silentLoginAsync_begin, {});
932
+ n(m.silentLoginAsync_begin, {});
939
933
  let r = "";
940
934
  if (o && (t == null && (t = {}), t.state = o), i && (t == null && (t = {}), t.scope = i), t != null)
941
935
  for (const [c, _] of Object.entries(t))
942
936
  r === "" ? r = `?${encodeURIComponent(c)}=${encodeURIComponent(_)}` : r += `&${encodeURIComponent(c)}=${encodeURIComponent(_)}`;
943
- const a = n.silent_login_uri + r, u = a.indexOf("/", a.indexOf("//") + 2), f = a.substring(0, u), l = document.createElement("iframe");
944
- return l.width = "0px", l.height = "0px", l.id = `${e}_oidc_iframe`, l.setAttribute("src", a), document.body.appendChild(l), new Promise((c, _) => {
937
+ const a = s.silent_login_uri + r, l = a.indexOf("/", a.indexOf("//") + 2), f = a.substring(0, l), u = document.createElement("iframe");
938
+ return u.width = "0px", u.height = "0px", u.id = `${e}_oidc_iframe`, u.setAttribute("src", a), document.body.appendChild(u), new Promise((c, _) => {
945
939
  let d = !1;
946
940
  const y = () => {
947
- window.removeEventListener("message", p), l.remove(), d = !0;
941
+ window.removeEventListener("message", p), u.remove(), d = !0;
948
942
  }, p = (k) => {
949
- if (k.origin === f && k.source === l.contentWindow) {
950
- const b = `${e}_oidc_tokens:`, E = `${e}_oidc_error:`, w = `${e}_oidc_exception:`, T = k.data;
951
- if (T && typeof T == "string" && !d) {
952
- if (T.startsWith(b)) {
943
+ if (k.origin === f && k.source === u.contentWindow) {
944
+ const b = `${e}_oidc_tokens:`, E = `${e}_oidc_error:`, w = `${e}_oidc_exception:`, v = k.data;
945
+ if (v && typeof v == "string" && !d) {
946
+ if (v.startsWith(b)) {
953
947
  const h = JSON.parse(k.data.replace(b, ""));
954
- s(m.silentLoginAsync_end, {}), c(h), y();
955
- } else if (T.startsWith(E)) {
948
+ n(m.silentLoginAsync_end, {}), c(h), y();
949
+ } else if (v.startsWith(E)) {
956
950
  const h = JSON.parse(k.data.replace(E, ""));
957
- s(m.silentLoginAsync_error, h), c({ error: "oidc_" + h.error, tokens: null, sessionState: null }), y();
958
- } else if (T.startsWith(w)) {
951
+ n(m.silentLoginAsync_error, h), c({ error: "oidc_" + h.error, tokens: null, sessionState: null }), y();
952
+ } else if (v.startsWith(w)) {
959
953
  const h = JSON.parse(k.data.replace(w, ""));
960
- s(m.silentLoginAsync_error, h), _(new Error(h.error)), y();
954
+ n(m.silentLoginAsync_error, h), _(new Error(h.error)), y();
961
955
  }
962
956
  }
963
957
  }
964
958
  };
965
959
  try {
966
960
  window.addEventListener("message", p);
967
- const k = n.silent_login_timeout;
961
+ const k = s.silent_login_timeout;
968
962
  setTimeout(() => {
969
- d || (y(), s(m.silentLoginAsync_error, { reason: "timeout" }), _(new Error("timeout")));
963
+ d || (y(), n(m.silentLoginAsync_error, { reason: "timeout" }), _(new Error("timeout")));
970
964
  }, k);
971
965
  } catch (k) {
972
- y(), s(m.silentLoginAsync_error, k), _(k);
966
+ y(), n(m.silentLoginAsync_error, k), _(k);
973
967
  }
974
968
  });
975
969
  } catch (r) {
976
- throw s(m.silentLoginAsync_error, r), r;
970
+ throw n(m.silentLoginAsync_error, r), r;
977
971
  }
978
- }, an = (e, n, s, t, o) => (i = null, r = void 0) => {
972
+ }, is = (e, s, n, t, o) => (i = null, r = void 0) => {
979
973
  i = { ...i };
980
- const a = (f, l, c) => re(n, s, t.bind(o))(
974
+ const a = (f, u, c) => re(s, n, t.bind(o))(
981
975
  f,
982
- l,
976
+ u,
983
977
  c
984
978
  );
985
979
  return (async () => {
986
- o.timeoutId && J.clearTimeout(o.timeoutId);
980
+ o.timeoutId && K.clearTimeout(o.timeoutId);
987
981
  let f;
988
982
  i && "state" in i && (f = i.state, delete i.state);
989
983
  try {
990
- const l = s.extras ? { ...s.extras, ...i } : i, c = await a(
984
+ const u = n.extras ? { ...n.extras, ...i } : i, c = await a(
991
985
  {
992
- ...l,
986
+ ...u,
993
987
  prompt: "none"
994
988
  },
995
989
  f,
@@ -997,19 +991,19 @@ const M = (e, n, s = null) => {
997
991
  );
998
992
  if (c)
999
993
  return o.tokens = c.tokens, t(m.token_acquired, {}), o.timeoutId = M(o, o.tokens.expiresAt, i), {};
1000
- } catch (l) {
1001
- return l;
994
+ } catch (u) {
995
+ return u;
1002
996
  }
1003
997
  })();
1004
- }, cn = (e, n, s) => (t, o, i, r = !1) => {
1005
- const a = (u, f = void 0, l = void 0) => re(e.configurationName, s, e.publishEvent.bind(e))(
1006
- u,
998
+ }, rs = (e, s, n) => (t, o, i, r = !1) => {
999
+ const a = (l, f = void 0, u = void 0) => re(e.configurationName, n, e.publishEvent.bind(e))(
1000
+ l,
1007
1001
  f,
1008
- l
1002
+ u
1009
1003
  );
1010
- return new Promise((u, f) => {
1011
- if (s.silent_login_uri && s.silent_redirect_uri && s.monitor_session && t && i && !r) {
1012
- const l = () => {
1004
+ return new Promise((l, f) => {
1005
+ if (n.silent_login_uri && n.silent_redirect_uri && n.monitor_session && t && i && !r) {
1006
+ const u = () => {
1013
1007
  e.checkSessionIFrame.stop();
1014
1008
  const c = e.tokens;
1015
1009
  if (c === null)
@@ -1018,7 +1012,7 @@ const M = (e, n, s = null) => {
1018
1012
  return a({
1019
1013
  prompt: "none",
1020
1014
  id_token_hint: _,
1021
- scope: s.scope || "openid"
1015
+ scope: n.scope || "openid"
1022
1016
  }).then((y) => {
1023
1017
  if (y.error)
1024
1018
  throw new Error(y.error);
@@ -1042,24 +1036,24 @@ const M = (e, n, s = null) => {
1042
1036
  "SessionMonitor._callback: Silent login failed, logging out other tabs:",
1043
1037
  y
1044
1038
  );
1045
- for (const [, p] of Object.entries(n))
1046
- await p.logoutOtherTabAsync(s.client_id, d.sub);
1039
+ for (const [, p] of Object.entries(s))
1040
+ await p.logoutOtherTabAsync(n.client_id, d.sub);
1047
1041
  });
1048
1042
  };
1049
1043
  e.checkSessionIFrame = new Pe(
1050
- l,
1044
+ u,
1051
1045
  o,
1052
1046
  t
1053
1047
  ), e.checkSessionIFrame.load().then(() => {
1054
- e.checkSessionIFrame.start(i), u(e.checkSessionIFrame);
1048
+ e.checkSessionIFrame.start(i), l(e.checkSessionIFrame);
1055
1049
  }).catch((c) => {
1056
1050
  f(c);
1057
1051
  });
1058
1052
  } else
1059
- u(null);
1053
+ l(null);
1060
1054
  });
1061
- }, ln = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), un = (e) => {
1062
- const n = e.appVersion, s = e.userAgent, t = "-";
1055
+ }, as = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), cs = (e) => {
1056
+ const s = e.appVersion, n = e.userAgent, t = "-";
1063
1057
  let o = t;
1064
1058
  const i = [
1065
1059
  { s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0)/ },
@@ -1094,9 +1088,9 @@ const M = (e, n, s = null) => {
1094
1088
  }
1095
1089
  ];
1096
1090
  for (const a in i) {
1097
- const u = i[a];
1098
- if (u.r.test(s)) {
1099
- o = u.s;
1091
+ const l = i[a];
1092
+ if (l.r.test(n)) {
1093
+ o = l.s;
1100
1094
  break;
1101
1095
  }
1102
1096
  }
@@ -1105,10 +1099,10 @@ const M = (e, n, s = null) => {
1105
1099
  case "Mac OS":
1106
1100
  case "Mac OS X":
1107
1101
  case "Android":
1108
- r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(s)[1];
1102
+ r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(n)[1];
1109
1103
  break;
1110
1104
  case "iOS": {
1111
- const a = /OS (\d+)_(\d+)_?(\d+)?/.exec(n);
1105
+ const a = /OS (\d+)_(\d+)_?(\d+)?/.exec(s);
1112
1106
  a != null && a.length > 2 && (r = a[1] + "." + a[2] + "." + (parseInt(a[3]) | 0));
1113
1107
  break;
1114
1108
  }
@@ -1118,56 +1112,56 @@ const M = (e, n, s = null) => {
1118
1112
  osVersion: r
1119
1113
  };
1120
1114
  };
1121
- function _n() {
1115
+ function ls() {
1122
1116
  const e = navigator.userAgent;
1123
- let n, s = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
1124
- if (/trident/i.test(s[1]))
1125
- return n = /\brv[ :]+(\d+)/g.exec(e) || [], { name: "ie", version: n[1] || "" };
1126
- if (s[1] === "Chrome" && (n = e.match(/\bOPR|Edge\/(\d+)/), n != null)) {
1127
- let t = n[1];
1117
+ let s, n = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
1118
+ if (/trident/i.test(n[1]))
1119
+ return s = /\brv[ :]+(\d+)/g.exec(e) || [], { name: "ie", version: s[1] || "" };
1120
+ if (n[1] === "Chrome" && (s = e.match(/\bOPR|Edge\/(\d+)/), s != null)) {
1121
+ let t = s[1];
1128
1122
  if (!t) {
1129
- const o = e.split(n[0] + "/");
1123
+ const o = e.split(s[0] + "/");
1130
1124
  o.length > 1 && (t = o[1]);
1131
1125
  }
1132
1126
  return { name: "opera", version: t };
1133
1127
  }
1134
- return s = s[2] ? [s[1], s[2]] : [navigator.appName, navigator.appVersion, "-?"], (n = e.match(/version\/(\d+)/i)) != null && s.splice(1, 1, n[1]), {
1135
- name: s[0].toLowerCase(),
1136
- version: s[1]
1128
+ return n = n[2] ? [n[1], n[2]] : [navigator.appName, navigator.appVersion, "-?"], (s = e.match(/version\/(\d+)/i)) != null && n.splice(1, 1, s[1]), {
1129
+ name: n[0].toLowerCase(),
1130
+ version: n[1]
1137
1131
  };
1138
1132
  }
1139
- const fn = () => {
1140
- const { name: e, version: n } = _n();
1141
- if (e === "chrome" && parseInt(n) <= 70 || e === "opera" && (!n || parseInt(n.split(".")[0]) < 80) || e === "ie")
1133
+ const us = () => {
1134
+ const { name: e, version: s } = ls();
1135
+ if (e === "chrome" && parseInt(s) <= 70 || e === "opera" && (!s || parseInt(s.split(".")[0]) < 80) || e === "ie")
1142
1136
  return !1;
1143
- const s = un(navigator);
1144
- return !ln(s);
1145
- }, dn = async (e) => {
1146
- let n;
1137
+ const n = cs(navigator);
1138
+ return !as(n);
1139
+ }, _s = async (e) => {
1140
+ let s;
1147
1141
  if (e.tokens != null)
1148
1142
  return !1;
1149
1143
  e.publishEvent(m.tryKeepExistingSessionAsync_begin, {});
1150
1144
  try {
1151
- const s = e.configuration, t = await e.initAsync(
1152
- s.authority,
1153
- s.authority_configuration
1145
+ const n = e.configuration, t = await e.initAsync(
1146
+ n.authority,
1147
+ n.authority_configuration
1154
1148
  );
1155
- if (await e.ensureUniqueTabId(), n = await I(s, e.configurationName), n) {
1156
- const { tokens: o } = await n.initAsync(
1149
+ if (s = await I(n, e.configurationName), s) {
1150
+ const { tokens: o } = await s.initAsync(
1157
1151
  t,
1158
1152
  "tryKeepExistingSessionAsync",
1159
- s
1153
+ n
1160
1154
  );
1161
1155
  if (o) {
1162
- n.startKeepAliveServiceWorker(), e.tokens = o;
1163
- const i = n.getLoginParams(e.configurationName);
1156
+ s.startKeepAliveServiceWorker(), e.tokens = o;
1157
+ const i = s.getLoginParams(e.configurationName);
1164
1158
  e.timeoutId = M(e, e.tokens.expiresAt, i.extras);
1165
- const r = await n.getSessionStateAsync();
1159
+ const r = await s.getSessionStateAsync();
1166
1160
  return await e.startCheckSessionAsync(
1167
1161
  t.check_session_iframe,
1168
- s.client_id,
1162
+ n.client_id,
1169
1163
  r
1170
- ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1164
+ ), n.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1171
1165
  success: !0,
1172
1166
  message: "tokens inside ServiceWorker are valid"
1173
1167
  }), !0;
@@ -1177,20 +1171,20 @@ const fn = () => {
1177
1171
  message: "no exiting session found"
1178
1172
  });
1179
1173
  } else {
1180
- s.service_worker_relative_url && e.publishEvent(m.service_worker_not_supported_by_browser, {
1174
+ n.service_worker_relative_url && e.publishEvent(m.service_worker_not_supported_by_browser, {
1181
1175
  message: "service worker is not supported by this browser"
1182
1176
  });
1183
- const o = P(e.configurationName, s.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1177
+ const o = P(e.configurationName, n.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
1184
1178
  if (i) {
1185
- e.tokens = X(i, null, s.token_renew_mode);
1179
+ e.tokens = te(i, null, n.token_renew_mode);
1186
1180
  const r = o.getLoginParams();
1187
1181
  e.timeoutId = M(e, e.tokens.expiresAt, r.extras);
1188
1182
  const a = await o.getSessionStateAsync();
1189
1183
  return await e.startCheckSessionAsync(
1190
1184
  t.check_session_iframe,
1191
- s.client_id,
1185
+ n.client_id,
1192
1186
  a
1193
- ), s.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1187
+ ), n.preload_user_info && await e.userInfoAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1194
1188
  success: !0,
1195
1189
  message: "tokens inside storage are valid"
1196
1190
  }), !0;
@@ -1198,110 +1192,108 @@ const fn = () => {
1198
1192
  }
1199
1193
  return e.publishEvent(m.tryKeepExistingSessionAsync_end, {
1200
1194
  success: !1,
1201
- message: n ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
1195
+ message: s ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
1202
1196
  }), !1;
1203
- } catch (s) {
1204
- return console.error(s), n && await n.clearAsync(), e.publishEvent(
1197
+ } catch (n) {
1198
+ return console.error(n), s && await s.clearAsync(), e.publishEvent(
1205
1199
  m.tryKeepExistingSessionAsync_error,
1206
1200
  "tokens inside ServiceWorker are invalid"
1207
1201
  ), !1;
1208
1202
  }
1209
1203
  }, Ee = (e) => {
1210
- const n = e.match(
1204
+ const s = e.match(
1211
1205
  // eslint-disable-next-line no-useless-escape
1212
1206
  /^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
1213
1207
  );
1214
- if (!n)
1208
+ if (!s)
1215
1209
  throw new Error("Invalid URL");
1216
- let s = n[6], t = n[7];
1210
+ let n = s[6], t = s[7];
1217
1211
  if (t) {
1218
1212
  const o = t.split("?");
1219
- o.length === 2 && (t = o[0], s = o[1]);
1213
+ o.length === 2 && (t = o[0], n = o[1]);
1220
1214
  }
1221
- return s.startsWith("?") && (s = s.slice(1)), n && {
1215
+ return n.startsWith("?") && (n = n.slice(1)), s && {
1222
1216
  href: e,
1223
- protocol: n[1],
1224
- host: n[2],
1225
- hostname: n[3],
1226
- port: n[4],
1227
- path: n[5],
1228
- search: s,
1217
+ protocol: s[1],
1218
+ host: s[2],
1219
+ hostname: s[3],
1220
+ port: s[4],
1221
+ path: s[5],
1222
+ search: n,
1229
1223
  hash: t
1230
1224
  };
1231
- }, bn = (e) => {
1232
- const n = Ee(e);
1233
- let { path: s } = n;
1234
- s.endsWith("/") && (s = s.slice(0, -1));
1235
- let { hash: t } = n;
1236
- return t === "#_=_" && (t = ""), t && (s += t), s;
1225
+ }, vs = (e) => {
1226
+ const s = Ee(e);
1227
+ let { path: n } = s;
1228
+ n.endsWith("/") && (n = n.slice(0, -1));
1229
+ let { hash: t } = s;
1230
+ return t === "#_=_" && (t = ""), t && (n += t), n;
1237
1231
  }, Y = (e) => {
1238
- const n = Ee(e), { search: s } = n;
1239
- return hn(s);
1240
- }, hn = (e) => {
1241
- const n = {};
1242
- let s, t, o;
1232
+ const s = Ee(e), { search: n } = s;
1233
+ return fs(n);
1234
+ }, fs = (e) => {
1235
+ const s = {};
1236
+ let n, t, o;
1243
1237
  const i = e.split("&");
1244
1238
  for (t = 0, o = i.length; t < o; t++)
1245
- s = i[t].split("="), n[decodeURIComponent(s[0])] = decodeURIComponent(s[1]);
1246
- return n;
1247
- }, yn = (e, n, s, t, o) => (i = void 0, r = null, a = !1, u = void 0) => {
1239
+ n = i[t].split("="), s[decodeURIComponent(n[0])] = decodeURIComponent(n[1]);
1240
+ return s;
1241
+ }, ds = (e, s, n, t, o) => (i = void 0, r = null, a = !1, l = void 0) => {
1248
1242
  const f = r;
1249
1243
  return r = { ...r }, (async () => {
1250
1244
  const c = i || o.getPath();
1251
- if ("state" in r || (r.state = ne(16)), s(m.loginAsync_begin, {}), r)
1245
+ if ("state" in r || (r.state = ee(16)), n(m.loginAsync_begin, {}), r)
1252
1246
  for (const _ of Object.keys(r))
1253
1247
  _.endsWith(":token_request") && delete r[_];
1254
1248
  try {
1255
- const _ = a ? n.silent_redirect_uri : n.redirect_uri;
1256
- u || (u = n.scope);
1257
- const d = n.extras ? { ...n.extras, ...r } : r;
1258
- d.nonce || (d.nonce = ne(12));
1259
- const y = { nonce: d.nonce }, p = await I(n, e), k = await t(
1260
- n.authority,
1261
- n.authority_configuration
1249
+ const _ = a ? s.silent_redirect_uri : s.redirect_uri;
1250
+ l || (l = s.scope);
1251
+ const d = s.extras ? { ...s.extras, ...r } : r;
1252
+ d.nonce || (d.nonce = ee(12));
1253
+ const y = { nonce: d.nonce }, p = await I(s, e), k = await t(
1254
+ s.authority,
1255
+ s.authority_configuration
1262
1256
  );
1263
1257
  let b;
1264
1258
  if (p)
1265
- p.setLoginParams({ callbackPath: c, extras: f }), await p.initAsync(k, "loginAsync", n), await p.setNonceAsync(y), p.startKeepAliveServiceWorker(), b = p;
1259
+ p.setLoginParams({ callbackPath: c, extras: f }), await p.initAsync(k, "loginAsync", s), await p.setNonceAsync(y), p.startKeepAliveServiceWorker(), b = p;
1266
1260
  else {
1267
- const w = P(e, n.storage ?? sessionStorage);
1261
+ const w = P(e, s.storage ?? sessionStorage);
1268
1262
  w.setLoginParams({ callbackPath: c, extras: f }), await w.setNonceAsync(y), b = w;
1269
1263
  }
1270
1264
  const E = {
1271
- client_id: n.client_id,
1265
+ client_id: s.client_id,
1272
1266
  redirect_uri: _,
1273
- scope: u,
1267
+ scope: l,
1274
1268
  response_type: "code",
1275
1269
  ...d
1276
1270
  };
1277
- await sn(b, o)(
1271
+ await ns(b, o)(
1278
1272
  k.authorizationEndpoint,
1279
1273
  E
1280
1274
  );
1281
1275
  } catch (_) {
1282
- throw s(m.loginAsync_error, _), _;
1276
+ throw n(m.loginAsync_error, _), _;
1283
1277
  }
1284
1278
  })();
1285
- }, gn = (e) => async (n = !1) => {
1279
+ }, hs = (e) => async (s = !1) => {
1286
1280
  try {
1287
1281
  e.publishEvent(m.loginCallbackAsync_begin, {});
1288
- 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(
1282
+ const n = e.configuration, t = n.client_id, o = s ? n.silent_redirect_uri : n.redirect_uri, i = n.authority, r = n.token_request_timeout, a = await e.initAsync(
1289
1283
  i,
1290
- s.authority_configuration
1291
- ), u = e.location.getCurrentHref(), l = Y(u).session_state;
1292
- await e.ensureUniqueTabId();
1293
- const c = await I(s, e.configurationName);
1284
+ n.authority_configuration
1285
+ ), l = e.location.getCurrentHref(), u = Y(l).session_state, c = await I(n, e.configurationName);
1294
1286
  let _, d, y, p;
1295
1287
  if (c)
1296
- await c.initAsync(a, "loginCallbackAsync", s), await c.setSessionStateAsync(l), d = await c.getNonceAsync(), y = c.getLoginParams(), p = await c.getStateAsync(), c.startKeepAliveServiceWorker(), _ = c;
1288
+ await c.initAsync(a, "loginCallbackAsync", n), await c.setSessionStateAsync(u), d = await c.getNonceAsync(), y = c.getLoginParams(), p = await c.getStateAsync(), c.startKeepAliveServiceWorker(), _ = c;
1297
1289
  else {
1298
- const v = P(
1290
+ const T = P(
1299
1291
  e.configurationName,
1300
- s.storage ?? sessionStorage
1292
+ n.storage ?? sessionStorage
1301
1293
  );
1302
- await v.setSessionStateAsync(l), d = await v.getNonceAsync(), y = v.getLoginParams(), p = await v.getStateAsync(), _ = v;
1294
+ await T.setSessionStateAsync(u), d = await T.getNonceAsync(), y = T.getLoginParams(), p = await T.getStateAsync(), _ = T;
1303
1295
  }
1304
- const k = Y(u);
1296
+ const k = Y(l);
1305
1297
  if (k.error || k.error_description)
1306
1298
  throw new Error(`Error from OIDC server: ${k.error} - ${k.error_description}`);
1307
1299
  if (k.iss && k.iss !== a.issuer)
@@ -1313,31 +1305,31 @@ const fn = () => {
1313
1305
  const b = {
1314
1306
  code: k.code,
1315
1307
  grant_type: "authorization_code",
1316
- client_id: s.client_id,
1308
+ client_id: n.client_id,
1317
1309
  redirect_uri: o
1318
1310
  }, E = {};
1319
- if (s.token_request_extras)
1320
- for (const [v, U] of Object.entries(s.token_request_extras))
1321
- E[v] = U;
1311
+ if (n.token_request_extras)
1312
+ for (const [T, U] of Object.entries(n.token_request_extras))
1313
+ E[T] = U;
1322
1314
  if (y != null && y.extras)
1323
- for (const [v, U] of Object.entries(y.extras))
1324
- v.endsWith(":token_request") && (E[v.replace(":token_request", "")] = U);
1325
- const w = a.tokenEndpoint, T = {};
1326
- if (s.demonstrating_proof_of_possession)
1315
+ for (const [T, U] of Object.entries(y.extras))
1316
+ T.endsWith(":token_request") && (E[T.replace(":token_request", "")] = U);
1317
+ const w = a.tokenEndpoint, v = {};
1318
+ if (n.demonstrating_proof_of_possession)
1327
1319
  if (c)
1328
- T.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1320
+ v.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
1329
1321
  else {
1330
- const v = await Ge(window)(
1331
- s.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
1322
+ const T = await Ge(window)(
1323
+ n.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
1332
1324
  );
1333
- await P(e.configurationName, s.storage).setDemonstratingProofOfPossessionJwkAsync(v), T.DPoP = await Se(window)(
1334
- s.demonstrating_proof_of_possession_configuration
1335
- )(v, "POST", w);
1325
+ await P(e.configurationName, n.storage).setDemonstratingProofOfPossessionJwkAsync(T), v.DPoP = await Se(window)(
1326
+ n.demonstrating_proof_of_possession_configuration
1327
+ )(T, "POST", w);
1336
1328
  }
1337
- const h = await tn(_)(
1329
+ const h = await ts(_)(
1338
1330
  w,
1339
1331
  { ...b, ...E },
1340
- T,
1332
+ v,
1341
1333
  e.configuration.token_renew_mode,
1342
1334
  r
1343
1335
  );
@@ -1363,89 +1355,89 @@ const fn = () => {
1363
1355
  );
1364
1356
  }
1365
1357
  if (c)
1366
- await c.initAsync(a, "syncTokensAsync", s), g = c.getLoginParams(), S && await c.setDemonstratingProofOfPossessionNonce(
1358
+ await c.initAsync(a, "syncTokensAsync", n), g = c.getLoginParams(), S && await c.setDemonstratingProofOfPossessionNonce(
1367
1359
  S
1368
1360
  );
1369
1361
  else {
1370
- const v = P(e.configurationName, s.storage);
1371
- g = v.getLoginParams(), S && await v.setDemonstratingProofOfPossessionNonce(S);
1362
+ const T = P(e.configurationName, n.storage);
1363
+ g = T.getLoginParams(), S && await T.setDemonstratingProofOfPossessionNonce(S);
1372
1364
  }
1373
1365
  return await e.startCheckSessionAsync(
1374
1366
  a.checkSessionIframe,
1375
1367
  t,
1376
- l,
1377
- n
1368
+ u,
1369
+ s
1378
1370
  ), e.publishEvent(m.loginCallbackAsync_end, {}), {
1379
1371
  tokens: A,
1380
1372
  state: "request.state",
1381
1373
  callbackPath: g.callbackPath
1382
1374
  };
1383
- } catch (s) {
1384
- throw console.error(s), e.publishEvent(m.loginCallbackAsync_error, s), s;
1375
+ } catch (n) {
1376
+ throw console.error(n), e.publishEvent(m.loginCallbackAsync_error, n), n;
1385
1377
  }
1386
1378
  }, ye = {
1387
1379
  access_token: "access_token",
1388
1380
  refresh_token: "refresh_token"
1389
- }, Q = (e, n) => {
1390
- const s = {};
1381
+ }, z = (e, s) => {
1382
+ const n = {};
1391
1383
  if (e) {
1392
1384
  for (const [t, o] of Object.entries(e))
1393
- if (t.endsWith(n)) {
1394
- const i = t.replace(n, "");
1395
- s[i] = o;
1385
+ if (t.endsWith(s)) {
1386
+ const i = t.replace(s, "");
1387
+ n[i] = o;
1396
1388
  }
1397
- return s;
1398
- }
1399
- return s;
1400
- }, kn = (e) => {
1401
- const n = {};
1402
- if (e) {
1403
- for (const [s, t] of Object.entries(e))
1404
- s.includes(":") || (n[s] = t);
1405
1389
  return n;
1406
1390
  }
1407
1391
  return n;
1408
- }, mn = (e) => async (n) => {
1409
- J.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop(), await e.ensureUniqueTabId();
1410
- const s = await I(e.configuration, e.configurationName);
1411
- s ? await s.clearAsync(n) : await P(e.configurationName, e.configuration.storage).clearAsync(n), e.tokens = null, e.userInfo = null;
1412
- }, pn = (e, n, s, t, o) => async (i = void 0, r = null) => {
1392
+ }, ys = (e) => {
1393
+ const s = {};
1394
+ if (e) {
1395
+ for (const [n, t] of Object.entries(e))
1396
+ n.includes(":") || (s[n] = t);
1397
+ return s;
1398
+ }
1399
+ return s;
1400
+ }, gs = (e) => async (s) => {
1401
+ K.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
1402
+ const n = await I(e.configuration, e.configurationName);
1403
+ n ? await n.clearAsync(s) : await P(e.configurationName, e.configuration.storage).clearAsync(s), e.tokens = null, e.userInfo = null;
1404
+ }, ks = (e, s, n, t, o) => async (i = void 0, r = null) => {
1413
1405
  var b, E;
1414
- const a = e.configuration, u = await e.initAsync(
1406
+ const a = e.configuration, l = await e.initAsync(
1415
1407
  a.authority,
1416
1408
  a.authority_configuration
1417
1409
  );
1418
1410
  i && typeof i != "string" && (i = void 0, t.warn("callbackPathOrUrl path is not a string"));
1419
1411
  const f = i ?? o.getPath();
1420
- let l = !1;
1421
- i && (l = i.includes("https://") || i.includes("http://"));
1422
- const c = l ? i : o.getOrigin() + f, _ = e.tokens ? e.tokens.idToken : "";
1412
+ let u = !1;
1413
+ i && (u = i.includes("https://") || i.includes("http://"));
1414
+ const c = u ? i : o.getOrigin() + f, _ = e.tokens ? e.tokens.idToken : "";
1423
1415
  try {
1424
- const w = u.revocationEndpoint;
1416
+ const w = l.revocationEndpoint;
1425
1417
  if (w) {
1426
- const T = [], h = e.tokens ? e.tokens.accessToken : null;
1418
+ const v = [], h = e.tokens ? e.tokens.accessToken : null;
1427
1419
  if (h && a.logout_tokens_to_invalidate.includes(ye.access_token)) {
1428
- const A = Q(r, ":revoke_access_token"), S = de(s)(
1420
+ const A = z(r, ":revoke_access_token"), S = de(n)(
1429
1421
  w,
1430
1422
  h,
1431
1423
  se.access_token,
1432
1424
  a.client_id,
1433
1425
  A
1434
1426
  );
1435
- T.push(S);
1427
+ v.push(S);
1436
1428
  }
1437
1429
  const g = e.tokens ? e.tokens.refreshToken : null;
1438
1430
  if (g && a.logout_tokens_to_invalidate.includes(ye.refresh_token)) {
1439
- const A = Q(r, ":revoke_refresh_token"), S = de(s)(
1431
+ const A = z(r, ":revoke_refresh_token"), S = de(n)(
1440
1432
  w,
1441
1433
  g,
1442
1434
  se.refresh_token,
1443
1435
  a.client_id,
1444
1436
  A
1445
1437
  );
1446
- T.push(S);
1438
+ v.push(S);
1447
1439
  }
1448
- T.length > 0 && await Promise.all(T);
1440
+ v.length > 0 && await Promise.all(v);
1449
1441
  }
1450
1442
  } catch (w) {
1451
1443
  t.warn(
@@ -1454,179 +1446,157 @@ const fn = () => {
1454
1446
  }
1455
1447
  const d = ((E = (b = e.tokens) == null ? void 0 : b.idTokenPayload) == null ? void 0 : E.sub) ?? null;
1456
1448
  await e.destroyAsync("LOGGED_OUT");
1457
- for (const [, w] of Object.entries(n))
1449
+ for (const [, w] of Object.entries(s))
1458
1450
  w !== e ? await e.logoutSameTabAsync(e.configuration.client_id, d) : e.publishEvent(m.logout_from_same_tab, {});
1459
- const y = Q(r, ":oidc");
1451
+ const y = z(r, ":oidc");
1460
1452
  if (y && y.no_reload === "true")
1461
1453
  return;
1462
- const k = kn(r);
1463
- if (u.endSessionEndpoint) {
1454
+ const k = ys(r);
1455
+ if (l.endSessionEndpoint) {
1464
1456
  "id_token_hint" in k || (k.id_token_hint = _), !("post_logout_redirect_uri" in k) && i !== null && (k.post_logout_redirect_uri = c);
1465
1457
  let w = "";
1466
- for (const [T, h] of Object.entries(k))
1467
- h != null && (w === "" ? w += "?" : w += "&", w += `${T}=${encodeURIComponent(h)}`);
1468
- o.open(`${u.endSessionEndpoint}${w}`);
1458
+ for (const [v, h] of Object.entries(k))
1459
+ h != null && (w === "" ? w += "?" : w += "&", w += `${v}=${encodeURIComponent(h)}`);
1460
+ o.open(`${l.endSessionEndpoint}${w}`);
1469
1461
  } else
1470
1462
  o.reload();
1471
- }, Oe = (e, n, s = !1) => async (...t) => {
1463
+ }, Oe = (e, s, n = !1) => async (...t) => {
1472
1464
  var d;
1473
1465
  const [o, i, ...r] = t, a = i ? { ...i } : { method: "GET" };
1474
- let u = new Headers();
1475
- a.headers && (u = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
1466
+ let l = new Headers();
1467
+ a.headers && (l = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
1476
1468
  const f = {
1477
- tokens: n.tokens,
1478
- configuration: { token_automatic_renew_mode: n.configuration.token_automatic_renew_mode },
1479
- renewTokensAsync: n.renewTokensAsync.bind(n)
1480
- }, l = await ke(f), c = (d = l == null ? void 0 : l.tokens) == null ? void 0 : d.accessToken;
1481
- if (u.has("Accept") || u.set("Accept", "application/json"), c) {
1482
- if (n.configuration.demonstrating_proof_of_possession && s) {
1483
- const y = await n.generateDemonstrationOfProofOfPossessionAsync(
1469
+ tokens: s.tokens,
1470
+ configuration: { token_automatic_renew_mode: s.configuration.token_automatic_renew_mode },
1471
+ renewTokensAsync: s.renewTokensAsync.bind(s)
1472
+ }, u = await ke(f), c = (d = u == null ? void 0 : u.tokens) == null ? void 0 : d.accessToken;
1473
+ if (l.has("Accept") || l.set("Accept", "application/json"), c) {
1474
+ if (s.configuration.demonstrating_proof_of_possession && n) {
1475
+ const y = await s.generateDemonstrationOfProofOfPossessionAsync(
1484
1476
  c,
1485
1477
  o.toString(),
1486
1478
  a.method
1487
1479
  );
1488
- u.set("Authorization", `PoP ${c}`), u.set("DPoP", y);
1480
+ l.set("Authorization", `PoP ${c}`), l.set("DPoP", y);
1489
1481
  } else
1490
- u.set("Authorization", `Bearer ${c}`);
1482
+ l.set("Authorization", `Bearer ${c}`);
1491
1483
  a.credentials || (a.credentials = "same-origin");
1492
1484
  }
1493
- const _ = { ...a, headers: u };
1485
+ const _ = { ...a, headers: l };
1494
1486
  return await e(o, _, ...r);
1495
- }, wn = (e) => async (n = !1, s = !1) => {
1496
- if (e.userInfo != null && !n)
1487
+ }, ms = (e) => async (s = !1, n = !1) => {
1488
+ if (e.userInfo != null && !s)
1497
1489
  return e.userInfo;
1498
1490
  const t = e.configuration, i = (await e.initAsync(
1499
1491
  t.authority,
1500
1492
  t.authority_configuration
1501
1493
  )).userInfoEndpoint, a = await (async () => {
1502
- const f = await Oe(fetch, e, s)(i);
1494
+ const f = await Oe(fetch, e, n)(i);
1503
1495
  return f.status !== 200 ? null : f.json();
1504
1496
  })();
1505
1497
  return e.userInfo = a, a;
1506
- }, An = () => fetch;
1507
- class te {
1508
- constructor(n) {
1509
- 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;
1498
+ }, ps = () => fetch;
1499
+ class ne {
1500
+ constructor(s) {
1501
+ this.authorizationEndpoint = s.authorization_endpoint, this.tokenEndpoint = s.token_endpoint, this.revocationEndpoint = s.revocation_endpoint, this.userInfoEndpoint = s.userinfo_endpoint, this.checkSessionIframe = s.check_session_iframe, this.issuer = s.issuer, this.endSessionEndpoint = s.end_session_endpoint;
1510
1502
  }
1511
1503
  }
1512
- const x = {}, Sn = (e, n = new H()) => (s, t = "default") => (x[t] || (x[t] = new C(s, t, e, n)), x[t]), Tn = async (e) => {
1513
- const { parsedTokens: n, callbackPath: s } = await e.loginCallbackAsync();
1514
- return e.timeoutId = M(e, n.expiresAt), { callbackPath: s };
1515
- }, vn = (e) => Math.floor(Math.random() * e), F = class F {
1516
- constructor(n, s = "default", t, o = new H()) {
1504
+ const x = {}, ws = (e, s = new q()) => (n, t = "default") => (x[t] || (x[t] = new C(n, t, e, s)), x[t]), As = async (e) => {
1505
+ const { parsedTokens: s, callbackPath: n } = await e.loginCallbackAsync();
1506
+ return e.timeoutId = M(e, s.expiresAt), { callbackPath: n };
1507
+ }, Ss = (e) => Math.floor(Math.random() * e), V = class V {
1508
+ constructor(s, n = "default", t, o = new q()) {
1517
1509
  this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.logoutPromise = null;
1518
- let i = n.silent_login_uri;
1519
- n.silent_redirect_uri && !n.silent_login_uri && (i = `${n.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
1520
- let r = n.refresh_time_before_tokens_expiration_in_second ?? 120;
1521
- r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new H();
1522
- const a = n.service_worker_update_require_callback ?? De(this.location);
1510
+ let i = s.silent_login_uri;
1511
+ s.silent_redirect_uri && !s.silent_login_uri && (i = `${s.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
1512
+ let r = s.refresh_time_before_tokens_expiration_in_second ?? 120;
1513
+ r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new q();
1514
+ const a = s.service_worker_update_require_callback ?? De(this.location);
1523
1515
  this.configuration = {
1524
- ...n,
1516
+ ...s,
1525
1517
  silent_login_uri: i,
1526
- token_automatic_renew_mode: n.token_automatic_renew_mode ?? V.AutomaticBeforeTokenExpiration,
1527
- monitor_session: n.monitor_session ?? !1,
1518
+ token_automatic_renew_mode: s.token_automatic_renew_mode ?? J.AutomaticBeforeTokenExpiration,
1519
+ monitor_session: s.monitor_session ?? !1,
1528
1520
  refresh_time_before_tokens_expiration_in_second: r,
1529
- silent_login_timeout: n.silent_login_timeout ?? 12e3,
1530
- token_renew_mode: n.token_renew_mode ?? Z.access_token_or_id_token_invalid,
1531
- demonstrating_proof_of_possession: n.demonstrating_proof_of_possession ?? !1,
1532
- authority_timeout_wellknowurl_in_millisecond: n.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
1533
- logout_tokens_to_invalidate: n.logout_tokens_to_invalidate ?? [
1521
+ silent_login_timeout: s.silent_login_timeout ?? 12e3,
1522
+ token_renew_mode: s.token_renew_mode ?? Q.access_token_or_id_token_invalid,
1523
+ demonstrating_proof_of_possession: s.demonstrating_proof_of_possession ?? !1,
1524
+ authority_timeout_wellknowurl_in_millisecond: s.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
1525
+ logout_tokens_to_invalidate: s.logout_tokens_to_invalidate ?? [
1534
1526
  "access_token",
1535
1527
  "refresh_token"
1536
1528
  ],
1537
1529
  service_worker_update_require_callback: a,
1538
- service_worker_activate: n.service_worker_activate ?? fn,
1539
- demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? Fe,
1540
- preload_user_info: n.preload_user_info ?? !1
1541
- }, this.getFetch = t ?? An, this.configurationName = s, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.ensureUniqueTabId.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1542
- }
1543
- async ensureUniqueTabId() {
1544
- const n = () => {
1545
- const t = globalThis.crypto.randomUUID();
1546
- sessionStorage.setItem(`oidc.tabId.${this.configurationName}`, t), this.tabId = t;
1547
- };
1548
- this.channel || (this.channel = new BroadcastChannel(`oidc.broadcast-channel.${this.configurationName}`), this.channel.onmessage = (t) => {
1549
- var r, a;
1550
- const o = (r = t == null ? void 0 : t.data) == null ? void 0 : r.type, i = (a = t == null ? void 0 : t.data) == null ? void 0 : a.tabId;
1551
- i === this.tabId && (o === "SEARCH" ? this.channel.postMessage({ type: "FOUND", tabId: i }) : o === "FOUND" && n());
1552
- });
1553
- const s = sessionStorage.getItem(`oidc.tabId.${this.configurationName}`);
1554
- if (!s) {
1555
- n();
1556
- return;
1557
- }
1558
- this.channel.postMessage({ type: "SEARCH", tabId: s }), await new Promise(
1559
- (t) => setTimeout(() => {
1560
- this.tabId || (this.tabId = s), t();
1561
- }, 500)
1562
- );
1530
+ service_worker_activate: s.service_worker_activate ?? us,
1531
+ demonstrating_proof_of_possession_configuration: s.demonstrating_proof_of_possession_configuration ?? Fe,
1532
+ preload_user_info: s.preload_user_info ?? !1
1533
+ }, this.getFetch = t ?? ps, this.configurationName = n, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
1563
1534
  }
1564
- subscribeEvents(n) {
1565
- const s = vn(9999999999999).toString();
1566
- return this.events.push({ id: s, func: n }), s;
1535
+ subscribeEvents(s) {
1536
+ const n = Ss(9999999999999).toString();
1537
+ return this.events.push({ id: n, func: s }), n;
1567
1538
  }
1568
- removeEventSubscription(n) {
1569
- const s = this.events.filter((t) => t.id !== n);
1570
- this.events = s;
1539
+ removeEventSubscription(s) {
1540
+ const n = this.events.filter((t) => t.id !== s);
1541
+ this.events = n;
1571
1542
  }
1572
- publishEvent(n, s) {
1543
+ publishEvent(s, n) {
1573
1544
  this.events.forEach((t) => {
1574
- t.func(n, s);
1545
+ t.func(s, n);
1575
1546
  });
1576
1547
  }
1577
- static get(n = "default") {
1578
- const s = typeof process > "u";
1579
- if (!Object.prototype.hasOwnProperty.call(x, n) && s)
1548
+ static get(s = "default") {
1549
+ const n = typeof process > "u";
1550
+ if (!Object.prototype.hasOwnProperty.call(x, s) && n)
1580
1551
  throw Error(`OIDC library does seem initialized.
1581
- Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${n}"></OidcProvider> component.`);
1582
- return x[n];
1552
+ Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${s}"></OidcProvider> component.`);
1553
+ return x[s];
1583
1554
  }
1584
1555
  _silentLoginCallbackFromIFrame() {
1585
1556
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1586
- const n = this.location, s = Y(n.getCurrentHref());
1557
+ const s = this.location, n = Y(s.getCurrentHref());
1587
1558
  window.parent.postMessage(
1588
- `${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: s.session_state })}`,
1589
- n.getOrigin()
1559
+ `${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: n.session_state })}`,
1560
+ s.getOrigin()
1590
1561
  );
1591
1562
  }
1592
1563
  }
1593
- _silentLoginErrorCallbackFromIFrame(n = null) {
1564
+ _silentLoginErrorCallbackFromIFrame(s = null) {
1594
1565
  if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
1595
- const s = this.location, t = Y(s.getCurrentHref());
1566
+ const n = this.location, t = Y(n.getCurrentHref());
1596
1567
  t.error ? window.parent.postMessage(
1597
1568
  `${this.configurationName}_oidc_error:${JSON.stringify({ error: t.error })}`,
1598
- s.getOrigin()
1569
+ n.getOrigin()
1599
1570
  ) : window.parent.postMessage(
1600
- `${this.configurationName}_oidc_exception:${JSON.stringify({ error: n == null ? "" : n.toString() })}`,
1601
- s.getOrigin()
1571
+ `${this.configurationName}_oidc_exception:${JSON.stringify({ error: s == null ? "" : s.toString() })}`,
1572
+ n.getOrigin()
1602
1573
  );
1603
1574
  }
1604
1575
  }
1605
1576
  async silentLoginCallbackAsync() {
1606
1577
  try {
1607
1578
  await this.loginCallbackAsync(!0), this._silentLoginCallbackFromIFrame();
1608
- } catch (n) {
1609
- console.error(n), this._silentLoginErrorCallbackFromIFrame(n);
1579
+ } catch (s) {
1580
+ console.error(s), this._silentLoginErrorCallbackFromIFrame(s);
1610
1581
  }
1611
1582
  }
1612
- async initAsync(n, s) {
1583
+ async initAsync(s, n) {
1613
1584
  if (this.initPromise !== null)
1614
1585
  return this.initPromise;
1615
1586
  const t = async () => {
1616
- if (s != null)
1617
- return new te({
1618
- authorization_endpoint: s.authorization_endpoint,
1619
- end_session_endpoint: s.end_session_endpoint,
1620
- revocation_endpoint: s.revocation_endpoint,
1621
- token_endpoint: s.token_endpoint,
1622
- userinfo_endpoint: s.userinfo_endpoint,
1623
- check_session_iframe: s.check_session_iframe,
1624
- issuer: s.issuer
1587
+ if (n != null)
1588
+ return new ne({
1589
+ authorization_endpoint: n.authorization_endpoint,
1590
+ end_session_endpoint: n.end_session_endpoint,
1591
+ revocation_endpoint: n.revocation_endpoint,
1592
+ token_endpoint: n.token_endpoint,
1593
+ userinfo_endpoint: n.userinfo_endpoint,
1594
+ check_session_iframe: n.check_session_iframe,
1595
+ issuer: n.issuer
1625
1596
  });
1626
- await this.ensureUniqueTabId();
1627
1597
  const i = await I(this.configuration, this.configurationName) ? window.localStorage : null;
1628
- return await en(this.getFetch())(
1629
- n,
1598
+ return await es(this.getFetch())(
1599
+ s,
1630
1600
  this.configuration.authority_time_cache_wellknowurl_in_second ?? 60 * 60,
1631
1601
  i,
1632
1602
  this.configuration.authority_timeout_wellknowurl_in_millisecond
@@ -1637,129 +1607,129 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
1637
1607
  });
1638
1608
  }
1639
1609
  async tryKeepExistingSessionAsync() {
1640
- return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = dn(this), this.tryKeepExistingSessionPromise.finally(() => {
1610
+ return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = _s(this), this.tryKeepExistingSessionPromise.finally(() => {
1641
1611
  this.tryKeepExistingSessionPromise = null;
1642
1612
  }));
1643
1613
  }
1644
- async startCheckSessionAsync(n, s, t, o = !1) {
1645
- await cn(this, x, this.configuration)(
1646
- n,
1614
+ async startCheckSessionAsync(s, n, t, o = !1) {
1615
+ await rs(this, x, this.configuration)(
1647
1616
  s,
1617
+ n,
1648
1618
  t,
1649
1619
  o
1650
1620
  );
1651
1621
  }
1652
- async loginAsync(n = void 0, s = null, t = !1, o = void 0, i = !1) {
1653
- return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : i ? an(
1622
+ async loginAsync(s = void 0, n = null, t = !1, o = void 0, i = !1) {
1623
+ return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : i ? is(
1654
1624
  window,
1655
1625
  this.configurationName,
1656
1626
  this.configuration,
1657
1627
  this.publishEvent.bind(this),
1658
1628
  this
1659
- )(s, o) : (await this.ensureUniqueTabId(), this.loginPromise = yn(
1629
+ )(n, o) : (this.loginPromise = ds(
1660
1630
  this.configurationName,
1661
1631
  this.configuration,
1662
1632
  this.publishEvent.bind(this),
1663
1633
  this.initAsync.bind(this),
1664
1634
  this.location
1665
- )(n, s, t, o), this.loginPromise.finally(() => {
1635
+ )(s, n, t, o), this.loginPromise.finally(() => {
1666
1636
  this.loginPromise = null;
1667
1637
  }));
1668
1638
  }
1669
- async loginCallbackAsync(n = !1) {
1639
+ async loginCallbackAsync(s = !1) {
1670
1640
  if (this.loginCallbackPromise !== null)
1671
1641
  return this.loginCallbackPromise;
1672
- const s = async () => {
1673
- const t = await gn(this)(n), o = t.tokens;
1674
- return this.tokens = o, await I(this.configuration, this.configurationName) || P(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(F.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), { parsedTokens: o, state: t.state, callbackPath: t.callbackPath };
1642
+ const n = async () => {
1643
+ const t = await hs(this)(s), o = t.tokens;
1644
+ return this.tokens = o, await I(this.configuration, this.configurationName) || P(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(V.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), { parsedTokens: o, state: t.state, callbackPath: t.callbackPath };
1675
1645
  };
1676
- return this.loginCallbackPromise = s(), this.loginCallbackPromise.finally(() => {
1646
+ return this.loginCallbackPromise = n(), this.loginCallbackPromise.finally(() => {
1677
1647
  this.loginCallbackPromise = null;
1678
1648
  });
1679
1649
  }
1680
- async generateDemonstrationOfProofOfPossessionAsync(n, s, t, o = {}) {
1650
+ async generateDemonstrationOfProofOfPossessionAsync(s, n, t, o = {}) {
1681
1651
  const i = this.configuration, r = {
1682
- ath: await ve(n),
1652
+ ath: await Te(s),
1683
1653
  ...o
1684
1654
  };
1685
1655
  if (await I(i, this.configurationName))
1686
1656
  return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}`;
1687
- const u = P(this.configurationName, i.storage), f = await u.getDemonstratingProofOfPossessionJwkAsync(), l = u.getDemonstratingProofOfPossessionNonce();
1688
- return l && (r.nonce = l), await Se(window)(
1657
+ const l = P(this.configurationName, i.storage), f = await l.getDemonstratingProofOfPossessionJwkAsync(), u = l.getDemonstratingProofOfPossessionNonce();
1658
+ return u && (r.nonce = u), await Se(window)(
1689
1659
  i.demonstrating_proof_of_possession_configuration
1690
- )(f, t, s, r);
1660
+ )(f, t, n, r);
1691
1661
  }
1692
1662
  loginCallbackWithAutoTokensRenewAsync() {
1693
- return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = Tn(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1663
+ return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = As(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
1694
1664
  this.loginCallbackWithAutoTokensRenewPromise = null;
1695
1665
  }));
1696
1666
  }
1697
- userInfoAsync(n = !1, s = !1) {
1698
- return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = wn(this)(n, s), this.userInfoPromise.finally(() => {
1667
+ userInfoAsync(s = !1, n = !1) {
1668
+ return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = ms(this)(s, n), this.userInfoPromise.finally(() => {
1699
1669
  this.userInfoPromise = null;
1700
1670
  }));
1701
1671
  }
1702
- async renewTokensAsync(n = null) {
1672
+ async renewTokensAsync(s = null) {
1703
1673
  if (this.renewTokensPromise !== null)
1704
1674
  return this.renewTokensPromise;
1705
1675
  if (this.timeoutId)
1706
- return J.clearTimeout(this.timeoutId), this.renewTokensPromise = be(this, !0, n), this.renewTokensPromise.finally(() => {
1676
+ return K.clearTimeout(this.timeoutId), this.renewTokensPromise = be(this, !0, s), this.renewTokensPromise.finally(() => {
1707
1677
  this.renewTokensPromise = null;
1708
1678
  });
1709
1679
  }
1710
- async destroyAsync(n) {
1711
- return await mn(this)(n);
1680
+ async destroyAsync(s) {
1681
+ return await gs(this)(s);
1712
1682
  }
1713
- async logoutSameTabAsync(n, s) {
1714
- 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 }));
1683
+ async logoutSameTabAsync(s, n) {
1684
+ this.configuration.monitor_session && this.configuration.client_id === s && n && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === n && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(m.logout_from_same_tab, { mmessage: "SessionMonitor", sub: n }));
1715
1685
  }
1716
- async logoutOtherTabAsync(n, s) {
1717
- 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 }));
1686
+ async logoutOtherTabAsync(s, n) {
1687
+ this.configuration.monitor_session && this.configuration.client_id === s && n && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === n && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(m.logout_from_another_tab, { message: "SessionMonitor", sub: n }));
1718
1688
  }
1719
- async logoutAsync(n = void 0, s = null) {
1720
- return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = pn(
1689
+ async logoutAsync(s = void 0, n = null) {
1690
+ return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = ks(
1721
1691
  this,
1722
1692
  x,
1723
1693
  this.getFetch(),
1724
1694
  console,
1725
1695
  this.location
1726
- )(n, s), this.logoutPromise.finally(() => {
1696
+ )(s, n), this.logoutPromise.finally(() => {
1727
1697
  this.logoutPromise = null;
1728
1698
  }));
1729
1699
  }
1730
1700
  };
1731
- F.getOrCreate = (n, s) => (t, o = "default") => Sn(n, s)(t, o), F.eventNames = m;
1732
- let C = F;
1701
+ V.getOrCreate = (s, n) => (t, o = "default") => ws(s, n)(t, o), V.eventNames = m;
1702
+ let C = V;
1733
1703
  const $ = class $ {
1734
- constructor(n) {
1735
- this._oidc = n;
1704
+ constructor(s) {
1705
+ this._oidc = s;
1736
1706
  }
1737
- subscribeEvents(n) {
1738
- return this._oidc.subscribeEvents(n);
1707
+ subscribeEvents(s) {
1708
+ return this._oidc.subscribeEvents(s);
1739
1709
  }
1740
- removeEventSubscription(n) {
1741
- this._oidc.removeEventSubscription(n);
1710
+ removeEventSubscription(s) {
1711
+ this._oidc.removeEventSubscription(s);
1742
1712
  }
1743
- publishEvent(n, s) {
1744
- this._oidc.publishEvent(n, s);
1713
+ publishEvent(s, n) {
1714
+ this._oidc.publishEvent(s, n);
1745
1715
  }
1746
- static get(n = "default") {
1747
- return new $(C.get(n));
1716
+ static get(s = "default") {
1717
+ return new $(C.get(s));
1748
1718
  }
1749
1719
  tryKeepExistingSessionAsync() {
1750
1720
  return this._oidc.tryKeepExistingSessionAsync();
1751
1721
  }
1752
- loginAsync(n = void 0, s = null, t = !1, o = void 0, i = !1) {
1753
- return this._oidc.loginAsync(n, s, t, o, i);
1722
+ loginAsync(s = void 0, n = null, t = !1, o = void 0, i = !1) {
1723
+ return this._oidc.loginAsync(s, n, t, o, i);
1754
1724
  }
1755
- logoutAsync(n = void 0, s = null) {
1756
- return this._oidc.logoutAsync(n, s);
1725
+ logoutAsync(s = void 0, n = null) {
1726
+ return this._oidc.logoutAsync(s, n);
1757
1727
  }
1758
1728
  silentLoginCallbackAsync() {
1759
1729
  return this._oidc.silentLoginCallbackAsync();
1760
1730
  }
1761
- renewTokensAsync(n = null) {
1762
- return this._oidc.renewTokensAsync(n);
1731
+ renewTokensAsync(s = null) {
1732
+ return this._oidc.renewTokensAsync(s);
1763
1733
  }
1764
1734
  loginCallbackAsync() {
1765
1735
  return this._oidc.loginCallbackWithAutoTokensRenewAsync();
@@ -1770,35 +1740,35 @@ const $ = class $ {
1770
1740
  get configuration() {
1771
1741
  return this._oidc.configuration;
1772
1742
  }
1773
- async generateDemonstrationOfProofOfPossessionAsync(n, s, t, o = {}) {
1743
+ async generateDemonstrationOfProofOfPossessionAsync(s, n, t, o = {}) {
1774
1744
  return this._oidc.generateDemonstrationOfProofOfPossessionAsync(
1775
- n,
1776
1745
  s,
1746
+ n,
1777
1747
  t,
1778
1748
  o
1779
1749
  );
1780
1750
  }
1781
- async getValidTokenAsync(n = 200, s = 50) {
1782
- return ke(this._oidc, n, s);
1751
+ async getValidTokenAsync(s = 200, n = 50) {
1752
+ return ke(this._oidc, s, n);
1783
1753
  }
1784
- fetchWithTokens(n, s = !1) {
1785
- return Oe(n, this._oidc, s);
1754
+ fetchWithTokens(s, n = !1) {
1755
+ return Oe(s, this._oidc, n);
1786
1756
  }
1787
- async userInfoAsync(n = !1, s = !1) {
1788
- return this._oidc.userInfoAsync(n, s);
1757
+ async userInfoAsync(s = !1, n = !1) {
1758
+ return this._oidc.userInfoAsync(s, n);
1789
1759
  }
1790
1760
  userInfo() {
1791
1761
  return this._oidc.userInfo;
1792
1762
  }
1793
1763
  };
1794
- $.getOrCreate = (n, s = new H()) => (t, o = "default") => new $(C.getOrCreate(n, s)(t, o)), $.eventNames = C.eventNames;
1764
+ $.getOrCreate = (s, n = new q()) => (t, o = "default") => new $(C.getOrCreate(s, n)(t, o)), $.eventNames = C.eventNames;
1795
1765
  let ge = $;
1796
1766
  export {
1797
1767
  ge as OidcClient,
1798
- H as OidcLocation,
1799
- V as TokenAutomaticRenewMode,
1800
- Z as TokenRenewMode,
1801
- An as getFetchDefault,
1768
+ q as OidcLocation,
1769
+ J as TokenAutomaticRenewMode,
1770
+ Q as TokenRenewMode,
1771
+ ps as getFetchDefault,
1802
1772
  Y as getParseQueryStringFromLocation,
1803
- bn as getPath
1773
+ vs as getPath
1804
1774
  };