PageSourceSearch

https://ici.radio-canada.ca/v5/dotca/dist/assets/login-DCxSPE8L-B9qRYZAO.js

js radio-canada.ca collected 2026-09-24 08:25:47 UTC 140,122 bytes, 3,448 lines download raw bytes

1var __defProp = Object.defineProperty;
2var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4import { importShared as bt, __tla as __tla_0 } from "./__federation_fn_import-DF7fSgpK.js";
5import { q as Nt, r as Ft, t as xt, u as Bt, c as Kt, s as Lt, L as Ht, w as Jt, S as qt, x as Mt, y as jt, z as Wt, A as Vt, __tla as __tla_1 } from "./unique-id-BY1ioZxq-BxRHFHEZ.js";
6import { a as $t, c as ye, g as Be } from "./_commonjsHelpers-DiKz65UP.js";
7import { _ as Gt } from "./__vite-browser-external-CfyHAoLP.js";
8let rr, nr, or;
9let __tla = Promise.all([
10  (() => {
11    try {
12      return __tla_0;
13    } catch (e) {
14    }
15  })(),
16  (() => {
17    try {
18      return __tla_1;
19    } catch (e) {
20    }
21  })()
22]).then(async () => {
23  var _a;
24  const fe = crypto, Et = (t) => t instanceof CryptoKey, he = new TextEncoder(), Ke = new TextDecoder(), le = (t) => {
25    let e = t;
26    e instanceof Uint8Array && (e = Ke.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
27    try {
28      return ((n) => {
29        const r = atob(n), o = new Uint8Array(r.length);
30        for (let i = 0; i < r.length; i++) o[i] = r.charCodeAt(i);
31        return o;
32      })(e);
33    } catch (e2) {
34      throw new TypeError("The input to be decoded is not correctly encoded.");
35    }
36  };
37  class Le extends Error {
38    static get code() {
39      return "ERR_JOSE_GENERIC";
40    }
41    constructor(e) {
42      var n;
43      super(e), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) === null || n === void 0 || n.call(Error, this, this.constructor);
44    }
45  }
46  class W extends Le {
47    constructor() {
48      super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
49    }
50    static get code() {
51      return "ERR_JOSE_NOT_SUPPORTED";
52    }
53  }
54  class D extends Le {
55    constructor() {
56      super(...arguments), this.code = "ERR_JWS_INVALID";
57    }
58    static get code() {
59      return "ERR_JWS_INVALID";
60    }
61  }
62  class zt extends Le {
63    constructor() {
64      super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
65    }
66    static get code() {
67      return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
68    }
69  }
70  function $(t, e = "algorithm.name") {
71    return new TypeError("CryptoKey does not support this operation, its ".concat(e, " must be ").concat(t));
72  }
73  function ue(t, e) {
74    return t.name === e;
75  }
76  function me(t) {
77    return parseInt(t.name.slice(4), 10);
78  }
79  function Qt(t, e, ...n) {
80    switch (e) {
81      case "HS256":
82      case "HS384":
83      case "HS512": {
84        if (!ue(t.algorithm, "HMAC")) throw $("HMAC");
85        const r = parseInt(e.slice(2), 10);
86        if (me(t.algorithm.hash) !== r) throw $("SHA-".concat(r), "algorithm.hash");
87        break;
88      }
89      case "RS256":
90      case "RS384":
91      case "RS512": {
92        if (!ue(t.algorithm, "RSASSA-PKCS1-v1_5")) throw $("RSASSA-PKCS1-v1_5");
93        const r = parseInt(e.slice(2), 10);
94        if (me(t.algorithm.hash) !== r) throw $("SHA-".concat(r), "algorithm.hash");
95        break;
96      }
97      case "PS256":
98      case "PS384":
99      case "PS512": {
100        if (!ue(t.algorithm, "RSA-PSS")) throw $("RSA-PSS");
101        const r = parseInt(e.slice(2), 10);
102        if (me(t.algorithm.hash) !== r) throw $("SHA-".concat(r), "algorithm.hash");
103        break;
104      }
105      case "EdDSA":
106        if (t.algorithm.name !== "Ed25519" && t.algorithm.name !== "Ed448") throw $("Ed25519 or Ed448");
107        break;
108      case "ES256":
109      case "ES384":
110      case "ES512": {
111        if (!ue(t.algorithm, "ECDSA")) throw $("ECDSA");
112        const r = (function(o) {
113          switch (o) {
114            case "ES256":
115              return "P-256";
116            case "ES384":
117              return "P-384";
118            case "ES512":
119              return "P-521";
120            default:
121              throw new Error("unreachable");
122          }
123        })(e);
124        if (t.algorithm.namedCurve !== r) throw $(r, "algorithm.namedCurve");
125        break;
126      }
127      default:
128        throw new TypeError("CryptoKey does not support this operation");
129    }
130    (function(r, o) {
131      if (o.length && !o.some((i) => r.usages.includes(i))) {
132        let i = "CryptoKey does not support this operation, its usages must include ";
133        if (o.length > 2) {
134          const s = o.pop();
135          i += "one of ".concat(o.join(", "), ", or ").concat(s, ".");
136        } else o.length === 2 ? i += "one of ".concat(o[0], " or ").concat(o[1], ".") : i += "".concat(o[0], ".");
137        throw new TypeError(i);
138      }
139    })(t, n);
140  }
141  function St(t, e, ...n) {
142    if (n.length > 2) {
143      const r = n.pop();
144      t += "one of type ".concat(n.join(", "), ", or ").concat(r, ".");
145    } else n.length === 2 ? t += "one of type ".concat(n[0], " or ").concat(n[1], ".") : t += "of type ".concat(n[0], ".");
146    return e == null ? t += " Received ".concat(e) : typeof e == "function" && e.name ? t += " Received function ".concat(e.name) : typeof e == "object" && e != null && e.constructor && e.constructor.name && (t += " Received an instance of ".concat(e.constructor.name)), t;
147  }
148  const qe = (t, ...e) => St("Key must be ", t, ...e);
149  function Me(t, e, ...n) {
150    return St("Key for the ".concat(t, " algorithm must be "), e, ...n);
151  }
152  const je = (t) => Et(t), Z = [
153    "CryptoKey"
154  ];
155  function Re(t) {
156    if (typeof (e = t) != "object" || e === null || Object.prototype.toString.call(t) !== "[object Object]") return false;
157    var e;
158    if (Object.getPrototypeOf(t) === null) return true;
159    let n = t;
160    for (; Object.getPrototypeOf(n) !== null; ) n = Object.getPrototypeOf(n);
161    return Object.getPrototypeOf(t) === n;
162  }
163  const We = async (t) => {
164    var e, n;
165    if (!t.alg) throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
166    const { algorithm: r, keyUsages: o } = (function(l) {
167      let c, d;
168      switch (l.kty) {
169        case "oct":
170          switch (l.alg) {
171            case "HS256":
172            case "HS384":
173            case "HS512":
174              c = {
175                name: "HMAC",
176                hash: "SHA-".concat(l.alg.slice(-3))
177              }, d = [
178                "sign",
179                "verify"
180              ];
181              break;
182            case "A128CBC-HS256":
183            case "A192CBC-HS384":
184            case "A256CBC-HS512":
185              throw new W("".concat(l.alg, " keys cannot be imported as CryptoKey instances"));
186            case "A128GCM":
187            case "A192GCM":
188            case "A256GCM":
189            case "A128GCMKW":
190            case "A192GCMKW":
191            case "A256GCMKW":
192              c = {
193                name: "AES-GCM"
194              }, d = [
195                "encrypt",
196                "decrypt"
197              ];
198              break;
199            case "A128KW":
200            case "A192KW":
201            case "A256KW":
202              c = {
203                name: "AES-KW"
204              }, d = [
205                "wrapKey",
206                "unwrapKey"
207              ];
208              break;
209            case "PBES2-HS256+A128KW":
210            case "PBES2-HS384+A192KW":
211            case "PBES2-HS512+A256KW":
212              c = {
213                name: "PBKDF2"
214              }, d = [
215                "deriveBits"
216              ];
217              break;
218            default:
219              throw new W('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
220          }
221          break;
222        case "RSA":
223          switch (l.alg) {
224            case "PS256":
225            case "PS384":
226            case "PS512":
227              c = {
228                name: "RSA-PSS",
229                hash: "SHA-".concat(l.alg.slice(-3))
230              }, d = l.d ? [
231                "sign"
232              ] : [
233                "verify"
234              ];
235              break;
236            case "RS256":
237            case "RS384":
238            case "RS512":
239              c = {
240                name: "RSASSA-PKCS1-v1_5",
241                hash: "SHA-".concat(l.alg.slice(-3))
242              }, d = l.d ? [
243                "sign"
244              ] : [
245                "verify"
246              ];
247              break;
248            case "RSA-OAEP":
249            case "RSA-OAEP-256":
250            case "RSA-OAEP-384":
251            case "RSA-OAEP-512":
252              c = {
253                name: "RSA-OAEP",
254                hash: "SHA-".concat(parseInt(l.alg.slice(-3), 10) || 1)
255              }, d = l.d ? [
256                "decrypt",
257                "unwrapKey"
258              ] : [
259                "encrypt",
260                "wrapKey"
261              ];
262              break;
263            default:
264              throw new W('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
265          }
266          break;
267        case "EC":
268          switch (l.alg) {
269            case "ES256":
270              c = {
271                name: "ECDSA",
272                namedCurve: "P-256"
273              }, d = l.d ? [
274                "sign"
275              ] : [
276                "verify"
277              ];
278              break;
279            case "ES384":
280              c = {
281                name: "ECDSA",
282                namedCurve: "P-384"
283              }, d = l.d ? [
284                "sign"
285              ] : [
286                "verify"
287              ];
288              break;
289            case "ES512":
290              c = {
291                name: "ECDSA",
292                namedCurve: "P-521"
293              }, d = l.d ? [
294                "sign"
295              ] : [
296                "verify"
297              ];
298              break;
299            case "ECDH-ES":
300            case "ECDH-ES+A128KW":
301            case "ECDH-ES+A192KW":
302            case "ECDH-ES+A256KW":
303              c = {
304                name: "ECDH",
305                namedCurve: l.crv
306              }, d = l.d ? [
307                "deriveBits"
308              ] : [];
309              break;
310            default:
311              throw new W('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
312          }
313          break;
314        case "OKP":
315          switch (l.alg) {
316            case "EdDSA":
317              c = {
318                name: l.crv
319              }, d = l.d ? [
320                "sign"
321              ] : [
322                "verify"
323              ];
324              break;
325            case "ECDH-ES":
326            case "ECDH-ES+A128KW":
327            case "ECDH-ES+A192KW":
328            case "ECDH-ES+A256KW":
329              c = {
330                name: l.crv
331              }, d = l.d ? [
332                "deriveBits"
333              ] : [];
334              break;
335            default:
336              throw new W('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
337          }
338          break;
339        default:
340          throw new W('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
341      }
342      return {
343        algorithm: c,
344        keyUsages: d
345      };
346    })(t), i = [
347      r,
348      (e = t.ext) !== null && e !== void 0 && e,
349      (n = t.key_ops) !== null && n !== void 0 ? n : o
350    ];
351    if (r.name === "PBKDF2") return fe.subtle.importKey("raw", le(t.k), ...i);
352    const s = {
353      ...t
354    };
355    return delete s.alg, delete s.use, fe.subtle.importKey("jwk", s, ...i);
356  };
357  async function Xt(t, e, n) {
358    var r;
359    if (!Re(t)) throw new TypeError("JWK must be an object");
360    switch (e || (e = t.alg), t.kty) {
361      case "oct":
362        if (typeof t.k != "string" || !t.k) throw new TypeError('missing "k" (Key Value) Parameter value');
363        return n != null || (n = t.ext !== true), n ? We({
364          ...t,
365          alg: e,
366          ext: (r = t.ext) !== null && r !== void 0 && r
367        }) : le(t.k);
368      case "RSA":
369        if (t.oth !== void 0) throw new W('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
370      case "EC":
371      case "OKP":
372        return We({
373          ...t,
374          alg: e
375        });
376      default:
377        throw new W('Unsupported "kty" (Key Type) Parameter value');
378    }
379  }
380  const Zt = (t, e, n) => {
381    t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? ((r, o) => {
382      if (!(o instanceof Uint8Array)) {
383        if (!je(o)) throw new TypeError(Me(r, o, ...Z, "Uint8Array"));
384        if (o.type !== "secret") throw new TypeError("".concat(Z.join(" or "), ' instances for symmetric algorithms must be of type "secret"'));
385      }
386    })(t, e) : ((r, o, i) => {
387      if (!je(o)) throw new TypeError(Me(r, o, ...Z));
388      if (o.type === "secret") throw new TypeError("".concat(Z.join(" or "), ' instances for asymmetric algorithms must not be of type "secret"'));
389      if (o.algorithm && i === "verify" && o.type === "private") throw new TypeError("".concat(Z.join(" or "), ' instances for asymmetric algorithm verifying must be of type "public"'));
390      o.algorithm;
391    })(t, e, n);
392  }, Yt = async (t, e, n, r) => {
393    const o = await (function(s, l, c) {
394      if (Et(l)) return Qt(l, s, c), l;
395      if (l instanceof Uint8Array) {
396        if (!s.startsWith("HS")) throw new TypeError(qe(l, ...Z));
397        return fe.subtle.importKey("raw", l, {
398          hash: "SHA-".concat(s.slice(-3)),
399          name: "HMAC"
400        }, false, [
401          c
402        ]);
403      }
404      throw new TypeError(qe(l, ...Z, "Uint8Array"));
405    })(t, e, "verify");
406    ((s, l) => {
407      if (s.startsWith("RS") || s.startsWith("PS")) {
408        const { modulusLength: c } = l.algorithm;
409        if (typeof c != "number" || c < 2048) throw new TypeError("".concat(s, " requires key modulusLength to be 2048 bits or larger"));
410      }
411    })(t, o);
412    const i = (function(s, l) {
413      const c = "SHA-".concat(s.slice(-3));
414      switch (s) {
415        case "HS256":
416        case "HS384":
417        case "HS512":
418          return {
419            hash: c,
420            name: "HMAC"
421          };
422        case "PS256":
423        case "PS384":
424        case "PS512":
425          return {
426            hash: c,
427            name: "RSA-PSS",
428            saltLength: s.slice(-3) >> 3
429          };
430        case "RS256":
431        case "RS384":
432        case "RS512":
433          return {
434            hash: c,
435            name: "RSASSA-PKCS1-v1_5"
436          };
437        case "ES256":
438        case "ES384":
439        case "ES512":
440          return {
441            hash: c,
442            name: "ECDSA",
443            namedCurve: l.namedCurve
444          };
445        case "EdDSA":
446          return {
447            name: l.name
448          };
449        default:
450          throw new W("alg ".concat(s, " is not supported either by JOSE or your javascript runtime"));
451      }
452    })(t, o.algorithm);
453    try {
454      return await fe.subtle.verify(i, o, n, r);
455    } catch (e2) {
456      return false;
457    }
458  };
459  async function en(t, e, n) {
460    var r;
461    if (!Re(t)) throw new D("Flattened JWS must be an object");
462    if (t.protected === void 0 && t.header === void 0) throw new D('Flattened JWS must have either of the "protected" or "header" members');
463    if (t.protected !== void 0 && typeof t.protected != "string") throw new D("JWS Protected Header incorrect type");
464    if (t.payload === void 0) throw new D("JWS Payload missing");
465    if (typeof t.signature != "string") throw new D("JWS Signature missing or incorrect type");
466    if (t.header !== void 0 && !Re(t.header)) throw new D("JWS Unprotected Header incorrect type");
467    let o = {};
468    if (t.protected) try {
469      const y = le(t.protected);
470      o = JSON.parse(Ke.decode(y));
471    } catch (e2) {
472      throw new D("JWS Protected Header is invalid");
473    }
474    if (!((...y) => {
475      const v = y.filter(Boolean);
476      if (v.length === 0 || v.length === 1) return true;
477      let h;
478      for (const g of v) {
479        const m = Object.keys(g);
480        if (h && h.size !== 0) for (const w of m) {
481          if (h.has(w)) return false;
482          h.add(w);
483        }
484        else h = new Set(m);
485      }
486      return true;
487    })(o, t.header)) throw new D("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
488    const i = {
489      ...o,
490      ...t.header
491    }, s = (function(y, v, h, g, m) {
492      if (m.crit !== void 0 && g.crit === void 0) throw new y('"crit" (Critical) Header Parameter MUST be integrity protected');
493      if (!g || g.crit === void 0) return /* @__PURE__ */ new Set();
494      if (!Array.isArray(g.crit) || g.crit.length === 0 || g.crit.some((E) => typeof E != "string" || E.length === 0)) throw new y('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
495      let w;
496      w = v;
497      for (const E of g.crit) {
498        if (!w.has(E)) throw new W('Extension Header Parameter "'.concat(E, '" is not recognized'));
499        if (m[E] === void 0) throw new y('Extension Header Parameter "'.concat(E, '" is missing'));
500        if (w.get(E) && g[E] === void 0) throw new y('Extension Header Parameter "'.concat(E, '" MUST be integrity protected'));
501      }
502      return new Set(g.crit);
503    }
503)(D, /* @__PURE__ */ new Map([
504      [
505        "b64",
506        true
507      ]
508    ]), 0, o, i);
509    let l = true;
510    if (s.has("b64") && (l = o.b64, typeof l != "boolean")) throw new D('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
511    const { alg: c } = i;
512    if (typeof c != "string" || !c) throw new D('JWS "alg" (Algorithm) Header Parameter missing or invalid');
513    if (l) {
514      if (typeof t.payload != "string") throw new D("JWS Payload must be a string");
515    } else if (typeof t.payload != "string" && !(t.payload instanceof Uint8Array)) throw new D("JWS Payload must be a string or an Uint8Array instance");
516    let d = false;
517    typeof e == "function" && (e = await e(o, t), d = true), Zt(c, e, "verify");
518    const a = (function(...y) {
519      const v = y.reduce((m, { length: w }) => m + w, 0), h = new Uint8Array(v);
520      let g = 0;
521      return y.forEach((m) => {
522        h.set(m, g), g += m.length;
523      }), h;
524    })(he.encode((r = t.protected) !== null && r !== void 0 ? r : ""), he.encode("."), typeof t.payload == "string" ? he.encode(t.payload) : t.payload);
525    let p;
526    try {
527      p = le(t.signature);
528    } catch (e2) {
529      throw new D("Failed to base64url decode the signature");
530    }
531    if (!await Yt(c, e, p, a)) throw new zt();
532    let f;
533    if (l) try {
534      f = le(t.payload);
535    } catch (e2) {
536      throw new D("Failed to base64url decode the payload");
537    }
538    else f = typeof t.payload == "string" ? he.encode(t.payload) : t.payload;
539    const u = {
540      payload: f
541    };
542    return t.protected !== void 0 && (u.protectedHeader = o), t.header !== void 0 && (u.unprotectedHeader = t.header), d ? {
543      ...u,
544      key: e
545    } : u;
546  }
547  async function tn(t, e, n) {
548    if (t instanceof Uint8Array && (t = Ke.decode(t)), typeof t != "string") throw new D("Compact JWS must be a string or Uint8Array");
549    const { 0: r, 1: o, 2: i, length: s } = t.split(".");
550    if (s !== 3) throw new D("Invalid Compact JWS");
551    const l = await en({
552      payload: o,
553      protected: r,
554      signature: i
555    }, e), c = {
556      payload: l.payload,
557      protectedHeader: l.protectedHeader
558    };
559    return typeof e == "function" ? {
560      ...c,
561      key: l.key
562    } : c;
563  }
564  var ve, nn = new Uint8Array(16);
565  function rn() {
566    if (!ve && !(ve = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto))) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
567    return ve(nn);
568  }
569  const on = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
570  for (var O = [], we = 0; we < 256; ++we) O.push((we + 256).toString(16).substr(1));
571  function sn(t) {
572    var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = (O[t[e + 0]] + O[t[e + 1]] + O[t[e + 2]] + O[t[e + 3]] + "-" + O[t[e + 4]] + O[t[e + 5]] + "-" + O[t[e + 6]] + O[t[e + 7]] + "-" + O[t[e + 8]] + O[t[e + 9]] + "-" + O[t[e + 10]] + O[t[e + 11]] + O[t[e + 12]] + O[t[e + 13]] + O[t[e + 14]] + O[t[e + 15]]).toLowerCase();
573    if (!(function(r) {
574      return typeof r == "string" && on.test(r);
575    })(n)) throw TypeError("Stringified UUID is invalid");
576    return n;
577  }
578  function Ve(t, e, n) {
579    var r = (t = t || {}).random || (t.rng || rn)();
580    return r[6] = 15 & r[6] | 64, r[8] = 63 & r[8] | 128, sn(r);
581  }
582  var $e = {
583    exports: {}
584  }, Ge = {
585    exports: {}
586  };
587  const an = $t(Gt);
588  var ze;
589  function He() {
590    return ze || (ze = 1, Ge.exports = (t = t || (function(e, n) {
591      var r;
592      if (typeof window < "u" && window.crypto && (r = window.crypto), typeof self < "u" && self.crypto && (r = self.crypto), typeof globalThis < "u" && globalThis.crypto && (r = globalThis.crypto), !r && typeof window < "u" && window.msCrypto && (r = window.msCrypto), !r && ye !== void 0 && ye.crypto && (r = ye.crypto), !r) try {
593        r = an;
594      } catch (e2) {
595      }
596      var o = function() {
597        if (r) {
598          if (typeof r.getRandomValues == "function") try {
599            return r.getRandomValues(new Uint32Array(1))[0];
600          } catch (e2) {
601          }
602          if (typeof r.randomBytes == "function") try {
603            return r.randomBytes(4).readInt32LE();
604          } catch (e2) {
605          }
606        }
607        throw new Error("Native crypto module could not be used to get secure random number.");
608      }
608, i = Object.create || /* @__PURE__ */ (function() {
609        function h() {
610        }
611        return function(g) {
612          var m;
613          return h.prototype = g, m = new h(), h.prototype = null, m;
614        };
615      })(), s = {}, l = s.lib = {}, c = l.Base = {
616        extend: function(h) {
617          var g = i(this);
618          return h && g.mixIn(h), g.hasOwnProperty("init") && this.init !== g.init || (g.init = function() {
619            g.$super.init.apply(this, arguments);
620          }), g.init.prototype = g, g.$super = this, g;
621        },
622        create: function() {
623          var h = this.extend();
624          return h.init.apply(h, arguments), h;
625        },
626        init: function() {
627        },
628        mixIn: function(h) {
629          for (var g in h) h.hasOwnProperty(g) && (this[g] = h[g]);
630          h.hasOwnProperty("toString") && (this.toString = h.toString);
631        },
632        clone: function() {
633          return this.init.prototype.extend(this);
634        }
635      }, d = l.WordArray = c.extend({
636        init: function(h, g) {
637          h = this.words = h || [], this.sigBytes = g != n ? g : 4 * h.length;
638        },
639        toString: function(h) {
640          return (h || p).stringify(this);
641        },
642        concat: function(h) {
643          var g = this.words, m = h.words, w = this.sigBytes, E = h.sigBytes;
644          if (this.clamp(), w % 4) for (var S = 0; S < E; S++) {
645            var k = m[S >>> 2] >>> 24 - S % 4 * 8 & 255;
646            g[w + S >>> 2] |= k << 24 - (w + S) % 4 * 8;
647          }
648          else for (var R = 0; R < E; R += 4) g[w + R >>> 2] = m[R >>> 2];
649          return this.sigBytes += E, this;
650        },
651        clamp: function() {
652          var h = this.words, g = this.sigBytes;
653          h[g >>> 2] &= 4294967295 << 32 - g % 4 * 8, h.length = e.ceil(g / 4);
654        },
655        clone: function() {
656          var h = c.clone.call(this);
657          return h.words = this.words.slice(0), h;
658        },
659        random: function(h) {
660          for (var g = [], m = 0; m < h; m += 4) g.push(o());
661          return new d.init(g, h);
662        }
663      }), a = s.enc = {}, p = a.Hex = {
664        stringify: function(h) {
665          for (var g = h.words, m = h.sigBytes, w = [], E = 0; E < m; E++) {
666            var S = g[E >>> 2] >>> 24 - E % 4 * 8 & 255;
667            w.push((S >>> 4).toString(16)), w.push((15 & S).toString(16));
668          }
669          return w.join("");
670        },
671        parse: function(h) {
672          for (var g = h.length, m = [], w = 0; w < g; w += 2) m[w >>> 3] |= parseInt(h.substr(w, 2), 16) << 24 - w % 8 * 4;
673          return new d.init(m, g / 2);
674        }
675      }, f = a.Latin1 = {
676        stringify: function(h) {
677          for (var g = h.words, m = h.sigBytes, w = [], E = 0; E < m; E++) {
678            var S = g[E >>> 2] >>> 24 - E % 4 * 8 & 255;
679            w.push(String.fromCharCode(S));
680          }
681          return w.join("");
682        },
683        parse: function(h) {
684          for (var g = h.length, m = [], w = 0; w < g; w++) m[w >>> 2] |= (255 & h.charCodeAt(w)) << 24 - w % 4 * 8;
685          return new d.init(m, g);
686        }
687      }, u = a.Utf8 = {
688        stringify: function(h) {
689          try {
690            return decodeURIComponent(escape(f.stringify(h)));
691          } catch (e2) {
692            throw new Error("Malformed UTF-8 data");
693          }
694        },
695        parse: function(h) {
696          return f.parse(unescape(encodeURIComponent(h)));
697        }
698      }, y = l.BufferedBlockAlgorithm = c.extend({
699        reset: function() {
700          this._data = new d.init(), this._nDataBytes = 0;
701        },
702        _append: function(h) {
703          typeof h == "string" && (h = u.parse(h)), this._data.concat(h), this._nDataBytes += h.sigBytes;
704        },
705        _process: function(h) {
706          var g, m = this._data, w = m.words, E = m.sigBytes, S = this.blockSize, k = E / (4 * S), R = (k = h ? e.ceil(k) : e.max((0 | k) - this._minBufferSize, 0)) * S, te = e.min(4 * R, E);
707          if (R) {
708            for (var H = 0; H < R; H += S) this._doProcessBlock(w, H);
709            g = w.splice(0, R), m.sigBytes -= te;
710          }
711          return new d.init(g, te);
712        },
713        clone: function() {
714          var h = c.clone.call(this);
715          return h._data = this._data.clone(), h;
716        },
717        _minBufferSize: 0
718      });
719      l.Hasher = y.extend({
720        cfg: c.extend(),
721        init: function(h) {
722          this.cfg = this.cfg.extend(h), this.reset();
723        },
724        reset: function() {
725          y.reset.call(this), this._doReset();
726        },
727        update: function(h) {
728          return this._append(h), this._process(), this;
729        },
730        finalize: function(h) {
731          return h && this._append(h), this._doFinalize();
732        },
733        blockSize: 16,
734        _createHelper: function(h) {
735          return function(g, m) {
736            return new h.init(m).finalize(g);
737          };
738        },
739        _createHmacHelper: function(h) {
740          return function(g, m) {
741            return new v.HMAC.init(h, m).finalize(g);
742          };
743        }
744      });
745      var v = s.algo = {};
746      return s;
747    })(Math), t)), Ge.exports;
748    var t;
749  }
750  var Qe, be, cn = (Qe || (Qe = 1, $e.exports = (be = He(), (function() {
751    if (typeof ArrayBuffer == "function") {
752      var t = be.lib.WordArray, e = t.init, n = t.init = function(r) {
753        if (r instanceof ArrayBuffer && (r = new Uint8Array(r)), (r instanceof Int8Array || typeof Uint8ClampedArray < "u" && r instanceof Uint8ClampedArray || r instanceof Int16Array || r instanceof Uint16Array || r instanceof Int32Array || r instanceof Uint32Array || r instanceof Float32Array || r instanceof Float64Array) && (r = new Uint8Array(r.buffer, r.byteOffset, r.byteLength)), r instanceof Uint8Array) {
754          for (var o = r.byteLength, i = [], s = 0; s < o; s++) i[s >>> 2] |= r[s] << 24 - s % 4 * 8;
755          e.call(this, i, o);
756        } else e.apply(this, arguments);
757      };
758      n.prototype = t;
759    }
760  })(), be.lib.WordArray)), $e.exports);
761  const ln = Be(cn);
762  var Xe, Ze = {
763    exports: {}
764  }, dn = (Xe || (Xe = 1, Ze.exports = (function(t) {
765    return (function(e) {
766      var n = t, r = n.lib, o = r.WordArray, i = r.Hasher, s = n.algo, l = [], c = [];
767      (function() {
768        function p(v) {
769          for (var h = e.sqrt(v), g = 2; g <= h; g++) if (!(v % g)) return false;
770          return true;
771        }
772        function f(v) {
773          return 4294967296 * (v - (0 | v)) | 0;
774        }
775        for (var u = 2, y = 0; y < 64; ) p(u) && (y < 8 && (l[y] = f(e.pow(u, 0.5))), c[y] = f(e.pow(u, 1 / 3)), y++), u++;
776      })();
777      var d = [], a = s.SHA256 = i.extend({
778        _doReset: function() {
779          this._hash = new o.init(l.slice(0));
780        },
781        _doProcessBlock: function(p, f) {
782          for (var u = this._hash.words, y = u[0], v = u[1], h = u[2], g = u[3], m = u[4], w = u[5], E = u[6], S = u[7], k = 0; k < 64; k++) {
783            if (k < 16) d[k] = 0 | p[f + k];
784            else {
785              var R = d[k - 15], te = (R << 25 | R >>> 7) ^ (R << 14 | R >>> 18) ^ R >>> 3, H = d[k - 2], Ot = (H << 15 | H >>> 17) ^ (H << 13 | H >>> 19) ^ H >>> 10;
786              d[k] = te + d[k - 7] + Ot + d[k - 16];
787            }
788            var Ut = y & v ^ y & h ^ v & h, Dt = (y << 30 | y >>> 2) ^ (y << 19 | y >>> 13) ^ (y << 10 | y >>> 22), Je = S + ((m << 26 | m >>> 6) ^ (m << 21 | m >>> 11) ^ (m << 7 | m >>> 25)) + (m & w ^ ~m & E) + c[k] + d[k];
789            S = E, E = w, w = m, m = g + Je | 0, g = h, h = v, v = y, y = Je + (Dt + Ut) | 0;
790          }
791          u[0] = u[0] + y | 0, u[1] = u[1] + v | 0, u[2] = u[2] + h | 0, u[3] = u[3] + g | 0, u[4] = u[4] + m | 0, u[5] = u[5] + w | 0, u[6] = u[6] + E | 0, u[7] = u[7] + S | 0;
792        },
793        _doFinalize: function() {
794          var p = this._data, f = p.words, u = 8 * this._nDataBytes, y = 8 * p.sigBytes;
795          return f[y >>> 5] |= 128 << 24 - y % 32, f[14 + (y + 64 >>> 9 << 4)] = e.floor(u / 4294967296), f[15 + (y + 64 >>> 9 << 4)] = u, p.sigBytes = 4 * f.length, this._process(), this._hash;
796        },
797        clone: function() {
798          var p = i.clone.call(this);
799          return p._hash = this._hash.clone(), p;
800        }
801      });
802      n.SHA256 = i._createHelper(a), n.HmacSHA256 = i._createHmacHelper(a);
803    })(Math), t.SHA256;
804  })(He())), Ze.exports);
805  const hn = Be(dn);
806  var Ye, et = {
807    exports: {}
808  }, un = (Ye || (Ye = 1, et.exports = (function(t) {
809    return (function() {
810      var e = t, n = e.lib.WordArray;
811      function r(o, i, s) {
812        for (var l = [], c = 0, d = 0; d < i; d++) if (d % 4) {
813          var a = s[o.charCodeAt(d - 1)] << d % 4 * 2 | s[o.charCodeAt(d)] >>> 6 - d % 4 * 2;
814          l[c >>> 2] |= a << 24 - c % 4 * 8, c++;
815        }
816        return n.create(l, c);
817      }
818      e.enc.Base64url = {
819        stringify: function(o, i) {
820          i === void 0 && (i = true);
821          var s = o.words, l = o.sigBytes, c = i ? this._safe_map : this._map;
822          o.clamp();
823          for (var d = [], a = 0; a < l; a += 3) for (var p = (s[a >>> 2] >>> 24 - a % 4 * 8 & 255) << 16 | (s[a + 1 >>> 2] >>> 24 - (a + 1) % 4 * 8 & 255) << 8 | s[a + 2 >>> 2] >>> 24 - (a + 2) % 4 * 8 & 255, f = 0; f < 4 && a + 0.75 * f < l; f++) d.push(c.charAt(p >>> 6 * (3 - f) & 63));
824          var u = c.charAt(64);
825          if (u) for (; d.length % 4; ) d.push(u);
826          return d.join("");
827        },
828        parse: function(o, i) {
829          i === void 0 && (i = true);
830          var s = o.length, l = i ? this._safe_map : this._map, c = this._reverseMap;
831          if (!c) {
832            c = this._reverseMap = [];
833            for (var d = 0; d < l.length; d++) c[l.charCodeAt(d)] = d;
834          }
835          var a = l.charAt(64);
836          if (a) {
837            var p = o.indexOf(a);
838            p !== -1 && (s = p);
839          }
840          return r(o, s, c);
841        },
842        _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
843        _safe_map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
844      };
845    })(), t.enc.Base64url;
846  })(He())), et.exports);
847  const pn = Be(un);
848  function fn(t) {
849    const e = ln.random(t), n = [];
850    return e.words.forEach((r) => {
851      const o = (function(s) {
852        const l = new ArrayBuffer(4);
853        return new DataView(l).setUint32(0, s, false), l;
854      })(r), i = new Uint8Array(o);
855      for (let s = 0; s < 4; s++) n.push(i[s]);
856    }), n;
857  }
858  function gn(t) {
859    return (function(e) {
860      const n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
861      let r = "";
862      const o = fn(e);
863      for (let i = 0; i < e; i++) r += n[o[i] % 66];
864      return r;
865    })(t);
866  }
867  function yn(t) {
868    if (t || (t = 43), t < 43 || t > 128) throw "Expected a length between 43 and 128. Received ".concat(t, ".");
869    const e = gn(t);
870    return {
871      code_verifier: e,
872      code_challenge: hn(e).toString(pn)
873    };
874  }
875  var pe, mn = (pe = function(t, e) {
876    return pe = Object.setPrototypeOf || {
877      __proto__: []
878    } instanceof Array && function(n, r) {
879      n.__proto__ = r;
880    } || function(n, r) {
881      for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (n[o] = r[o]);
882    }, pe(t, e);
883  }, function(t, e) {
884    if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
885    function n() {
886      this.constructor = t;
887    }
888    pe(t, e), t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
889  }), J = (function(t) {
890    function e(n, r, o) {
891      var i;
892      r === void 0 && (r = "unspecified"), o === void 0 && (o = "unspecified");
893      var s = t.call(this, n) || this;
894      return s.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", s.name = s.constructor.name, (i = Error.captureStackTrace) === null || i === void 0 || i.call(Error, s, s.constructor), s.claim = r, s.reason = o, s;
895    }
896    return mn(e, t), Object.defineProperty(e, "code", {
897      get: function() {
898        return "ERR_JWT_CLAIM_VALIDATION_FAILED";
899      },
900      enumerable: false,
901      configurable: true
902    }), e;
903  })(Error), vn = (function() {
904    function t() {
905      this.timeout = null;
906    }
907    return t.getInstance = function() {
908      return t.instance || (t.instance = new t()), t.instance;
909    }, t.prototype.clearTimeout = function() {
910      this.timeout && (clearTimeout(this.timeout), this.timeout = null);
911    }, t.prototype.setTimeout = function(e, n) {
912      for (var r = [], o = 2; o < arguments.length; o++) r[o - 2] = arguments[o];
913      this.timeout = setTimeout(e, n, r);
914    }, t;
915  })(), N = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof global < "u" && global || {}, tt = "URLSearchParams" in N, Tt = "Symbol" in N && "iterator" in Symbol, ce = "FileReader" in N && "Blob" in N && (function() {
916    try {
917      return new Blob(), true;
918    } catch (e) {
919      return false;
920    }
921  })(), nt = "FormData" in N, ge = "ArrayBuffer" in N;
922  if (ge) var wn = [
923    "[object Int8Array]",
924    "[object Uint8Array]",
925    "[object Uint8ClampedArray]",
926    "[object Int16Array]",
927    "[object Uint16Array]",
928    "[object Int32Array]",
929    "[object Uint32Array]",
930    "[object Float32Array]",
931    "[object Float64Array]"
932  ], bn = ArrayBuffer.isView || function(t) {
933    return t && wn.indexOf(Object.prototype.toString.call(t)) > -1;
934  };
935  function re(t) {
936    if (typeof t != "string" && (t = String(t)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t) || t === "") throw new TypeError('Invalid character in header field name: "' + t + '"');
937    return t.toLowerCase();
938  }
939  function Oe(t) {
940    return typeof t != "string" && (t = String(t)), t;
941  }
942  function Ee(t) {
943    var e = {
944      next: function() {
945        var n = t.shift();
946        return {
947          done: n === void 0,
948          value: n
949        };
950      }
951    };
952    return Tt && (e[Symbol.iterator] = function() {
953      return e;
954    }), e;
955  }
956  function P(t) {
957    this.map = {}, t instanceof P ? t.forEach(function(e, n) {
958      this.append(n, e);
959    }, this) : Array.isArray(t) ? t.forEach(function(e) {
960      if (e.length != 2) throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + e.length);
961      this.append(e[0], e[1]);
962    }, this) : t && Object.getOwnPropertyNames(t).forEach(function(e) {
963      this.append(e, t[e]);
964    }, this);
965  }
966  function Se(t) {
967    if (!t._noBody) return t.bodyUsed ? Promise.reject(new TypeError("Already read")) : void (t.bodyUsed = true);
968  }
969  function _t(t) {
970    return new Promise(function(e, n) {
971      t.onload = function() {
972        e(t.result);
973      }, t.onerror = function() {
974        n(t.error);
975      };
976    });
977  }
978  function En(t) {
979    var e = new FileReader(), n = _t(e);
980    return e.readAsArrayBuffer(t), n;
981  }
982  function rt(t) {
983    if (t.slice) return t.slice(0);
984    var e = new Uint8Array(t.byteLength);
985    return e.set(new Uint8Array(t)), e.buffer;
986  }
987  function ot() {
988    return this.bodyUsed = false, this._initBody = function(t) {
989      var e;
990      this.bodyUsed = this.bodyUsed, this._bodyInit = t, t ? typeof t == "string" ? this._bodyText = t : ce && Blob.prototype.isPrototypeOf(t) ? this._bodyBlob = t : nt && FormData.prototype.isPrototypeOf(t) ? this._bodyFormData = t : tt && URLSearchParams.prototype.isPrototypeOf(t) ? this._bodyText = t.toString() : ge && ce && (e = t) && DataView.prototype.isPrototypeOf(e) ? (this._bodyArrayBuffer = rt(t.buffer), this._bodyInit = new Blob([
991        this._bodyArrayBuffer
992      ])) : ge && (ArrayBuffer.prototype.isPrototypeOf(t) || bn(t)) ? this._bodyArrayBuffer = rt(t) : this._bodyText = t = Object.prototype.toString.call(t) : (this._noBody = true, this._bodyText = ""), this.headers.get("content-type") || (typeof t == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : tt && URLSearchParams.prototype.isPrototypeOf(t) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
993    }, ce && (this.blob = function() {
994      var t = Se(this);
995      if (t) return t;
996      if (this._bodyBlob) return Promise.resolve(this._bodyBlob);
997      if (this._bodyArrayBuffer) return Promise.resolve(new Blob([
998        this._bodyArrayBuffer
999      ]));
1000      if (this._bodyFormData) throw new Error("could not read FormData body as blob");
1001      return Promise.resolve(new Blob([
1002        this._bodyText
1003      ]));
1004    }), this.arrayBuffer = function() {
1005      if (this._bodyArrayBuffer) {
1006        var t = Se(this);
1007        return t || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset, this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength)) : Promise.resolve(this._bodyArrayBuffer));
1008      }
1009      if (ce) return this.blob().then(En);
1010      throw new Error("could not read as ArrayBuffer");
1011    }, this.text = function() {
1012      var t, e, n, r, o, i = Se(this);
1013      if (i) return i;
1014      if (this._bodyBlob) return t = this._bodyBlob, e = new FileReader(), n = _t(e), r = /charset=([A-Za-z0-9_-]+)/.exec(t.type), o = r ? r[1] : "utf-8", e.readAsText(t, o), n;
1015      if (this._bodyArrayBuffer) return Promise.resolve((function(s) {
1016        for (var l = new Uint8Array(s), c = new Array(l.length), d = 0; d < l.length; d++) c[d] = String.fromCharCode(l[d]);
1017        return c.join("");
1018      })(this._bodyArrayBuffer));
1019      if (this._bodyFormData) throw new Error("could not read FormData body as text");
1020      return Promise.resolve(this._bodyText);
1021    }, nt && (this.formData = function() {
1022      return this.text().then(Tn);
1023    }), this.json = function() {
1024      return this.text().then(JSON.parse);
1025    }, this;
1026  }
1027  P.prototype.append = function(t, e) {
1028    t = re(t), e = Oe(e);
1029    var n = this.map[t];
1030    this.map[t] = n ? n + ", " + e : e;
1031  }, P.prototype.delete = function(t) {
1032    delete this.map[re(t)];
1033  }, P.prototype.get = function(t) {
1034    return t = re(t), this.has(t) ? this.map[t] : null;
1035  }, P.prototype.has = function(t) {
1036    return this.map.hasOwnProperty(re(t));
1037  }, P.prototype.set = function(t, e) {
1038    this.map[re(t)] = Oe(e);
1039  }, P.prototype.forEach = function(t, e) {
1040    for (var n in this.map) this.map.hasOwnProperty(n) && t.call(e, this.map[n], n, this);
1041  }, P.prototype.keys = function() {
1042    var t = [];
1043    return this.forEach(function(e, n) {
1044      t.push(n);
1045    }), Ee(t);
1046  }, P.prototype.values = function() {
1047    var t = [];
1048    return this.forEach(function(e) {
1049      t.push(e);
1050    }), Ee(t);
1051  }, P.prototype.entries = function() {
1052    var t = [];
1053    return this.forEach(function(e, n) {
1054      t.push([
1055        n,
1056        e
1057      ]);
1058    }), Ee(t);
1059  }, Tt && (P.prototype[Symbol.iterator] = P.prototype.entries);
1060  var Sn = [
1061    "CONNECT",
1062    "DELETE",
1063    "GET",
1064    "HEAD",
1065    "OPTIONS",
1066    "PATCH",
1067    "POST",
1068    "PUT",
1069    "TRACE"
1070  ];
1071  function ee(t, e) {
1072    if (!(this instanceof ee)) throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
1073    var n, r, o = (e = e || {}).body;
1074    if (t instanceof ee) {
1075      if (t.bodyUsed) throw new TypeError("Already read");
1076      this.url = t.url, this.credentials = t.credentials, e.headers || (this.headers = new P(t.headers)), this.method = t.method, this.mode = t.mode, this.signal = t.signal, o || t._bodyInit == null || (o = t._bodyInit, t.bodyUsed = true);
1077    } else this.url = String(t);
1078    if (this.credentials = e.credentials || this.credentials || "same-origin", !e.headers && this.headers || (this.headers = new P(e.headers)), this.method = (n = e.method || this.method || "GET", r = n.toUpperCase(), Sn.indexOf(r) > -1 ? r : n), this.mode = e.mode || this.mode || null, this.signal = e.signal || this.signal || (function() {
1079      if ("AbortController" in N) return new AbortController().signal;
1080    })(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && o) throw new TypeError("Body not allowed for GET or HEAD requests");
1081    if (this._initBody(o), !(this.method !== "GET" && this.method !== "HEAD" || e.cache !== "no-store" && e.cache !== "no-cache")) {
1082      var i = /([?&])_=[^&]*/;
1083      i.test(this.url) ? this.url = this.url.replace(i, "$1_=" + (/* @__PURE__ */ new Date()).getTime()) : this.url += (/\?/.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
1084    }
1085  }
1086  function Tn(t) {
1087    var e = new FormData();
1088    return t.trim().split("&").forEach(function(n) {
1089      if (n) {
1090        var r = n.split("="), o = r.shift().replace(/\+/g, " "), i = r.join("=").replace(/\+/g, " ");
1091        e.append(decodeURIComponent(o), decodeURIComponent(i));
1092      }
1093    }), e;
1094  }
1095  function V(t, e) {
1096    if (!(this instanceof V)) throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
1097    if (e || (e = {}), this.type = "default", this.status = e.status === void 0 ? 200 : e.status, this.status < 200 || this.status > 599) throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
1098    this.ok = this.status >= 200 && this.status < 300, this.statusText = e.statusText === void 0 ? "" : "" + e.statusText, this.headers = new P(e.headers), this.url = e.url || "", this._initBody(t);
1099  }
1100  ee.prototype.clone = function() {
1101    return new ee(this, {
1102      body: this._bodyInit
1103    });
1104  }, ot.call(ee.prototype), ot.call(V.prototype), V.prototype.clone = function() {
1105    return new V(this._bodyInit, {
1106      status: this.status,
1107      statusText: this.statusText,
1108      headers: new P(this.headers),
1109      url: this.url
1110    });
1111  }, V.error = function() {
1112    var t = new V(null, {
1113      status: 200,
1114      statusText: ""
1115    });
1116    return t.ok = false, t.status = 0, t.type = "error", t;
1117  };
1118  var _n = [
1119    301,
1120    302,
1121    303,
1122    307,
1123    308
1124  ];
1125  V.redirect = function(t, e) {
1126    if (_n.indexOf(e) === -1) throw new RangeError("Invalid status code");
1127    return new V(null, {
1128      status: e,
1129      headers: {
1130        location: t
1131      }
1132    });
1133  };
1134  var x, A, b, de, Q, B, I, F, X, oe, M, Y = N.DOMException;
1135  try {
1136    new Y();
1137  } catch (e) {
1138    Y = function(e2, n) {
1139      this.message = e2, this.name = n;
1140      var r = Error(e2);
1141      this.stack = r.stack;
1142    }, Y.prototype = Object.create(Error.prototype), Y.prototype.constructor = Y;
1143  }
1144  function it(t, e) {
1145    return new Promise(function(n, r) {
1146      var o = new ee(t, e);
1147      if (o.signal && o.signal.aborted) return r(new Y("Aborted", "AbortError"));
1148      var i = new XMLHttpRequest();
1149      function s() {
1150        i.abort();
1151      }
1152      if (i.onload = function() {
1153        var c, d, a = {
1154          statusText: i.statusText,
1155          headers: (c = i.getAllResponseHeaders() || "", d = new P(), c.replace(/\r?\n[\t ]+/g, " ").split("\r").map(function(f) {
1156            return f.indexOf("\n") === 0 ? f.substr(1, f.length) : f;
1157          }
1157).forEach(function(f) {
1158            var u = f.split(":"), y = u.shift().trim();
1159            if (y) {
1160              var v = u.join(":").trim();
1161              try {
1162                d.append(y, v);
1163              } catch (h) {
1164                console.warn("Response " + h.message);
1165              }
1166            }
1167          }), d)
1168        };
1169        o.url.indexOf("file://") === 0 && (i.status < 200 || i.status > 599) ? a.status = 200 : a.status = i.status, a.url = "responseURL" in i ? i.responseURL : a.headers.get("X-Request-URL");
1170        var p = "response" in i ? i.response : i.responseText;
1171        setTimeout(function() {
1172          n(new V(p, a));
1173        }, 0);
1174      }, i.onerror = function() {
1175        setTimeout(function() {
1176          r(new TypeError("Network request failed"));
1177        }, 0);
1178      }, i.ontimeout = function() {
1179        setTimeout(function() {
1180          r(new TypeError("Network request timed out"));
1181        }, 0);
1182      }, i.onabort = function() {
1183        setTimeout(function() {
1184          r(new Y("Aborted", "AbortError"));
1185        }, 0);
1186      }, i.open(o.method, (function(c) {
1187        try {
1188          return c === "" && N.location.href ? N.location.href : c;
1189        } catch (e2) {
1190          return c;
1191        }
1192      })(o.url), true), o.credentials === "include" ? i.withCredentials = true : o.credentials === "omit" && (i.withCredentials = false), "responseType" in i && (ce ? i.responseType = "blob" : ge && (i.responseType = "arraybuffer")), e && typeof e.headers == "object" && !(e.headers instanceof P || N.Headers && e.headers instanceof N.Headers)) {
1193        var l = [];
1194        Object.getOwnPropertyNames(e.headers).forEach(function(c) {
1195          l.push(re(c)), i.setRequestHeader(c, Oe(e.headers[c]));
1196        }), o.headers.forEach(function(c, d) {
1197          l.indexOf(d) === -1 && i.setRequestHeader(d, c);
1198        });
1199      } else o.headers.forEach(function(c, d) {
1200        i.setRequestHeader(d, c);
1201      });
1202      o.signal && (o.signal.addEventListener("abort", s), i.onreadystatechange = function() {
1203        i.readyState === 4 && o.signal.removeEventListener("abort", s);
1204      }), i.send(o._bodyInit === void 0 ? null : o._bodyInit);
1205    });
1206  }
1207  it.polyfill = true, N.fetch || (N.fetch = it, N.Headers = P, N.Request = ee, N.Response = V), (function(t) {
1208    t.FRAGMENT = "fragment", t.QUERY = "query", t.FORM_POST = "form_post";
1209  })(x || (x = {})), (function(t) {
1210    t.STATE = "state", t.ERROR = "error", t.ERROR_DESCRIPTION = "error_description", t.ID_TOKEN = "id_token", t.ACCESS_TOKEN = "access_token", t.REFRESH_TOKEN = "refresh_token", t.EXPIRES_IN = "expires_in", t.TOKEN_TYPE = "token_type", t.SCOPE = "scope", t.AUTHORIZATION_CODE = "code";
1211  })(A || (A = {})), (function(t) {
1212    t.ACCESS_TOKEN = "at", t.LR_ACCESS_TOKEN = "lrat", t.USER_INFO = "ui", t.ID_TOKEN = "idt", t.NONCE = "nonce", t.STATE = "state", t.STATE_EXP = "stateexp", t.REFRESH_TOKEN = "refresh_token";
1213  })(b || (b = {})), (function(t) {
1214    t.DEV = "dev", t.DEV1 = "dev1", t.DEV2 = "dev2", t.AQ = "aq", t.AQ1 = "aq1", t.AQ2 = "aq2", t.AQ3 = "aq3", t.INT = "int", t.INT1 = "int1", t.STAGING = "staging", t.BETA = "beta", t.PROD = "prod";
1215  })(de || (de = {})), (function(t) {
1216    t.INTERNAL = "internal", t.LOGIN = "login", t.LOGIN_CBC = "login_cbc", t.RESET_PASSWORD = "reset", t.RESET_PASSWORD_FACEBOOK = "resetFacebook", t.SIGNUP = "signup", t.SIGNUP_CBC = "signup_cbc", t.IDPJWTAUTH = "idpJwtAuth";
1217  })(Q || (Q = {})), (function(t) {
1218    t.REDIRECT = "redirect", t.POPUP = "popup";
1219  })(B || (B = {})), (function(t) {
1220    t.IMPLICIT = "ImplicitFlow", t.IDPJWT = "IdpJwtFlow", t.PKCE = "PkceFlow";
1221  })(I || (I = {})), (function(t) {
1222    t.AUTHORIZATION_CODE = "Authorization_Code", t.ACCESS_TOKEN = "Access_Token", t.REFRESH_TOKEN = "Refresh_Token";
1223  })(F || (F = {})), (function(t) {
1224    t.SAVE_SUCCESS = "savesuccess", t.REFRESH_ERROR = "refresherror";
1225  })(X || (X = {})), (function(t) {
1226    t[t.OTHER = 0] = "OTHER", t[t.LOGIN = 1] = "LOGIN", t[t.SIGNUP = 2] = "SIGNUP", t[t.IDPJWTAUTH = 3] = "IDPJWTAUTH";
1227  })(oe || (oe = {})), (function(t) {
1228    t.FIREFOX = "Firefox", t.SAMSUNG = "Samsung Internet", t.OPERA = "Opera", t.TRIDENT = "Internet Explorer", t.EDGE_LEGACY = "Edge (Legacy)", t.EDGE_CHROMIUM = "Edge (Chromium)", t.CHROME = "Chrome", t.SAFARI = "Safari";
1229  })(M || (M = {}));
1230  var Ue = 6e5, ne = 50, Cn = {
1231    clientId: "",
1232    clientSecret: "",
1233    debug: false,
1234    locale: "fr",
1235    skipSignatureValidation: false,
1236    useLegacyDomain: false,
1237    msToRefresh: Ue,
1238    clockTolerance: 60
1239  }, Te = {
1240    env: de.PROD,
1241    renewalCallback: "/callback",
1242    responseType: "id_token token",
1243    responseMode: x.FRAGMENT,
1244    scope: "openid profile",
1245    refreshScope: "",
1246    frameTimeoutMs: 6e3,
1247    getSafariRefreshState: function() {
1248      return "";
1249    },
1250    usePopupForSafariRefresh: false
1251  }, De = [
1252    "B2C_1A_ExternalClient_FrontEnd_Login",
1253    "B2C_1A_ExternalClient_FrontEnd_Login_Short_AQ"
1254  ], Ne = [
1255    "B2C_1A_ExternalClient_FrontEnd_Login_CBC",
1256    "B2C_1A_ExternalClient_FrontEnd_Login_CBC_Short_AQ"
1257  ], Ct = [
1258    "B2C_1A_ExternalClient_FrontEnd_SignUp",
1259    "B2C_1A_ExternalClient_FrontEnd_SignUp_Short_AQ"
1260  ], kt = [
1261    "B2C_1A_ExternalClient_FrontEnd_SignUp_CBC",
1262    "B2C_1A_ExternalClient_FrontEnd_SignUp_CBC_Short_AQ"
1263  ], At = [
1264    "B2C_1A_ExternalClient_IdpJwt_Auth",
1265    "B2C_1A_ExternalClient_IdpJwt_Auth_Short_AQ"
1266  ], ie = {
1267    internal: "B2C_1A_InternalClient_SignIn",
1268    login: De[0],
1269    login_cbc: Ne[0],
1270    reset: "B2C_1A_ExternalClient_FrontEnd_ResetPassword",
1271    resetFacebook: "B2C_1A_ExternalClient_FrontEnd_ResetPasswordFacebook",
1272    signup: Ct[0],
1273    signup_cbc: kt[0],
1274    idpJwtAuth: At[0]
1275  }, _e = "B2C_1A_ExternalClient_FrontEnd_ResetPassword", Ce = "B2C_1A_ExternalClient_FrontEnd_Email_Validation", kn = "Client must be initiated before accessing this method.", An = "Unable to parse fragment for provided window object.", In = "Iframe timed out while waiting for a response.", Pn = "The received ID Token is invalid.", Rn = "The provided renewal URL is invalid.", G = "The provided policy is invalid. Policy is required and cannot be empty.", st = "No tokens to refresh.", On = "No popup was created.", at = "No state in callback response.", ct = "The received state is invalid", Un = "Fragment handling disabled in iframe or popup.", Dn = "Popup was closed before flow could complete.", Nn = "Popup timed out while waiting for a response.", ke = "Unable to refresh user tokens.", lt = "No redirect URI provided.", Fn = "No login following a password reset.", xn = "No login following an email validation.", Bn = "Please provide a valid login radius access token to login using the IdpJwt flow", Kn = "Cannot log in with IdpJwt auth because 'useLegacyDomain' is set to true in the client configuration.", Ln = "Cannot refresh tokens with IdpJwt auth because 'useLegacyDomain' is set to true in the client configuration.", dt = "Cannot log in with PKCE auth because 'useLegacyDomain' is set to true in the client configuration.", ht = "Cannot create an account with PKCE auth because 'useLegacyDomain' is set to true in the client configuration.", Hn = "Cannot refresh tokens with PKCE auth because 'useLegacyDomain' is set to true in the client configuration.", Jn = "No authorization code found, please try again", q = "https://pp-services.radio-canada.ca", qn = {
1276    dev: q,
1277    dev1: q,
1278    dev2: q,
1279    aq: q,
1280    aq1: q,
1281    aq2: q,
1282    aq3: q,
1283    int: q,
1284    int1: q,
1285    staging: q,
1286    beta: q,
1287    prod: "https://services.radio-canada.ca"
1288  }, T = {
1289    dev: "https://dev-login.cbc.radio-canada.ca/54ac59a6-6683-4125-b9bb-23b7343326a8",
1290    dev1: "https://dev1-login.cbc.radio-canada.ca/063e88c0-4031-486f-b641-2706121f1445",
1291    dev2: "https://dev2-login.cbc.radio-canada.ca/e829c91f-30a9-4775-ae9b-99bf2fc0ee36",
1292    aq: "https://aq-login.cbc.radio-canada.ca/b231e0ac-3b3a-4aa2-9c88-275a7b7a1176",
1293    aq1: "https://aq1-login.cbc.radio-canada.ca/cfef2869-b826-4052-872e-0d7d2e9a95d2",
1294    aq2: "https://aq2-login.cbc.radio-canada.ca/22890242-4c87-4c96-a9e4-b2f48aa38160",
1295    aq3: "https://aq3-login.cbc.radio-canada.ca/ba510e94-2093-42bd-9c6e-7a86d48cac1b",
1296    int: "https://int-login.cbc.radio-canada.ca/0aa1e8c2-5242-47a4-996a-6ed694ee7127",
1297    int1: "https://int1-login.cbc.radio-canada.ca/bd41deec-99b4-418a-a310-f3d734f4d385",
1298    staging: "https://staging-login.cbc.radio-canada.ca/54c6210c-07d5-4bb8-ac4a-ce4f9442a9d5",
1299    beta: "https://beta-login.cbc.radio-canada.ca/967fa3ec-cc75-42e6-abf7-7f219b2af22a",
1300    prod: "https://login.cbc.radio-canada.ca/bef1b538-1950-4283-9b27-b096cbc18070"
1301  }, Mn = {
1302    dev: T.dev + "/v2.0/",
1303    dev1: T.dev1 + "/v2.0/",
1304    dev2: T.dev2 + "/v2.0/",
1305    aq: T.aq + "/v2.0/",
1306    aq1: T.aq1 + "/v2.0/",
1307    aq2: T.aq2 + "/v2.0/",
1308    aq3: T.aq3 + "/v2.0/",
1309    int: T.int + "/v2.0/",
1310    int1: T.int1 + "/v2.0/",
1311    staging: T.staging + "/v2.0/",
1312    beta: T.beta + "/v2.0/",
1313    prod: T.prod + "/v2.0/"
1314  }, jn = {
1315    dev: T.dev + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1316    dev1: T.dev1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1317    dev2: T.dev2 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1318    aq: T.aq + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1319    aq1: T.aq1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1320    aq2: T.aq2 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1321    aq3: T.aq3 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1322    int: T.int + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1323    int1: T.int1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1324    staging: T.staging + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1325    beta: T.beta + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1326    prod: T.prod + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration"
1327  }, L = {
1328    dev: "https://rcmnb2cdev.b2clogin.com/rcmnb2cdev.onmicrosoft.com",
1329    dev1: "https://rcmnb2cdev1.b2clogin.com/rcmnb2cdev1.onmicrosoft.com",
1330    dev2: "https://rcmnb2cdev2.b2clogin.com/rcmnb2cdev2.onmicrosoft.com",
1331    aq: "https://rcmnb2caq.b2clogin.com/rcmnb2caq.onmicrosoft.com",
1332    aq1: "https://rcmnb2caq1.b2clogin.com/rcmnb2caq1.onmicrosoft.com",
1333    aq2: "https://rcmnb2caq2.b2clogin.com/rcmnb2caq2.onmicrosoft.com",
1334    aq3: "https://rcmnb2caq3.b2clogin.com/rcmnb2caq3.onmicrosoft.com",
1335    int: "https://rcmnb2cint.b2clogin.com/rcmnb2cint.onmicrosoft.com",
1336    int1: "https://rcmnb2cint1.b2clogin.com/rcmnb2cint1.onmicrosoft.com",
1337    staging: "https://rcmnb2cstaging.b2clogin.com/rcmnb2cstaging.onmicrosoft.com",
1338    beta: "https://rcmnb2cbeta.b2clogin.com/rcmnb2cbeta.onmicrosoft.com",
1339    prod: "https://rcmnb2cprod.b2clogin.com/rcmnb2cprod.onmicrosoft.com"
1340  }, Wn = {
1341    dev: "https://rcmnb2cdev.b2clogin.com/54ac59a6-6683-4125-b9bb-23b7343326a8/v2.0/",
1342    dev1: "https://rcmnb2cdev1.b2clogin.com/063e88c0-4031-486f-b641-2706121f1445/v2.0/",
1343    dev2: "https://rcmnb2cdev2.b2clogin.com/e829c91f-30a9-4775-ae9b-99bf2fc0ee36/v2.0/",
1344    aq: "https://rcmnb2caq.b2clogin.com/b231e0ac-3b3a-4aa2-9c88-275a7b7a1176/v2.0/",
1345    aq1: "https://rcmnb2caq1.b2clogin.com/cfef2869-b826-4052-872e-0d7d2e9a95d2/v2.0/",
1346    aq2: "https://rcmnb2caq2.b2clogin.com/22890242-4c87-4c96-a9e4-b2f48aa38160/v2.0/",
1347    aq3: "https://rcmnb2caq3.b2clogin.com/ba510e94-2093-42bd-9c6e-7a86d48cac1b/v2.0/",
1348    int: "https://rcmnb2cint.b2clogin.com/0aa1e8c2-5242-47a4-996a-6ed694ee7127/v2.0/",
1349    int1: "https://rcmnb2cint1.b2clogin.com/bd41deec-99b4-418a-a310-f3d734f4d385/v2.0/",
1350    staging: "https://rcmnb2cstaging.b2clogin.com/54c6210c-07d5-4bb8-ac4a-ce4f9442a9d5/v2.0/",
1351    beta: "https://rcmnb2cbeta.b2clogin.com/967fa3ec-cc75-42e6-abf7-7f219b2af22a/v2.0/",
1352    prod: "https://rcmnb2cprod.b2clogin.com/bef1b538-1950-4283-9b27-b096cbc18070/v2.0/"
1353  }, Vn = {
1354    dev: L.dev + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1355    dev1: L.dev1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1356    dev2: L.dev2 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1357    aq: L.aq + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1358    aq1: L.aq1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1359    aq2: L.aq2 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1360    aq3: L.aq3 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1361    int: L.int + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1362    int1: L.int1 + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1363    staging: L.staging + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1364    beta: L.beta + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration",
1365    prod: L.prod + "/B2C_1A_OidcDiscoveryEndpoint_Stub/v2.0/.well-known/openid-configuration"
1366  }, $n = [
1367    [
1368      M.FIREFOX,
1369      /Firefox|FxiOS/
1370    ],
1371    [
1372      M.SAMSUNG,
1373      /SamsungBrowser/
1374    ],
1375    [
1376      M.OPERA,
1377      /Opera|OPR/
1378    ],
1379    [
1380      M.TRIDENT,
1381      /Trident/
1382    ],
1383    [
1384      M.EDGE_LEGACY,
1385      /Edge/
1386    ],
1387    [
1388      M.EDGE_CHROMIUM,
1389      /Edg/
1390    ],
1391    [
1392      M.CHROME,
1393      /Chrome|CriOS/
1394    ],
1395    [
1396      M.SAFARI,
1397      /Safari/
1398    ]
1399  ], ut = "auth-js-iframe-", pt = "auth-js", Ae = "PkcePolicy", ft = "FlowTypeKey", Ie = "PkceChallengePair", It = (function() {
1400    function t(e) {
1401      var n = e === void 0 ? {} : e, r = n.forceCookieMode, o = r !== void 0 && r, i = n.cookieDomain, s = i === void 0 ? "" : i, l = n.cookieSameSite, c = l === void 0 ? "strict" : l;
1402      this.forceCookieMode = o || !this.isLocalStorageAvailable(), this.cookieDomain = s, this.cookieSameSite = c;
1403    }
1404    return t.prototype.get = function(e, n) {
1405      return n === void 0 && (n = false), this.forceCookieMode ? this.getCookie(e) : n ? sessionStorage.getItem(e) || "" : localStorage.getItem(e) || "";
1406    }, t.prototype.set = function(e, n, r, o) {
1407      r === void 0 && (r = false), this.forceCookieMode ? this.setCookie(e, n, o) : r ? sessionStorage.setItem(e, n) : localStorage.setItem(e, n);
1408    }, t.prototype.delete = function(e, n) {
1409      n === void 0 && (n = false), this.forceCookieMode && this.deleteCookie(e), n ? sessionStorage.removeItem(e) : localStorage.removeItem(e);
1410    }, t.prototype.size = function() {
1411      return localStorage.length;
1412    }, t.prototype.key = function(e) {
1413      return localStorage.key(e);
1414    }, t.prototype.getCookie = function(e) {
1415      var n, r = document.cookie.split(";").find(function(o) {
1416        return o.trim().startsWith(e + "=");
1417      });
1418      return decodeURIComponent((n = r == null ? void 0 : r.split("=")[1]) !== null && n !== void 0 ? n : "");
1419    }, t.prototype.setCookie = function(e, n, r) {
1420      var o = "";
1421      r && (o = " expires=" + new Date(Date.now() + r).toUTCString() + ";");
1422      var i = "";
1423      this.cookieDomain && (i = " domain=" + this.cookieDomain + ";");
1424      var s = "";
1425      this.cookieSameSite && (s = " samesite=" + this.cookieSameSite + ";");
1426      var l = e + "=" + encodeURIComponent(n) + ";" + o + i + " path=/; secure; " + s;
1427      window.document.cookie = l;
1428    }, t.prototype.deleteCookie = function(e) {
1429      var n = "";
1430      this.cookieDomain && (n = " domain=" + this.cookieDomain + ";");
1431      var r = "";
1432      this.cookieSameSite && (r = " samesite=" + this.cookieSameSite + ";");
1433      var o = e + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;" + n + " path=/; secure; " + r;
1434      window.document.cookie = o;
1435    }, t.prototype.isLocalStorageAvailable = function() {
1436      try {
1437        var e = (/* @__PURE__ */ new Date()).toTimeString();
1438        localStorage.setItem("uid", e);
1439        var n = localStorage.getItem("uid");
1440        return localStorage.removeItem("uid"), n === e;
1441      } catch (e2) {
1442        return false;
1443      }
1444    }, t;
1445  })();
1446  function Pe(t) {
1447    return Object.values(Q).includes(t);
1448  }
1449  var Fe = function() {
1450    return Fe = Object.assign || function(t) {
1451      for (var e, n = 1, r = arguments.length; n < r; n++) for (var o in e = arguments[n]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
1452      return t;
1453    }, Fe.apply(this, arguments);
1454  }, Pt = function(t, e, n, r) {
1455    return new (n || (n = Promise))(function(o, i) {
1456      function s(d) {
1457        try {
1458          c(r.next(d));
1459        } catch (a) {
1460          i(a);
1461        }
1462      }
1463      function l(d) {
1464        try {
1465          c(r.throw(d));
1466        } catch (a) {
1467          i(a);
1468        }
1469      }
1470      function c(d) {
1471        var a;
1472        d.done ? o(d.value) : (a = d.value, a instanceof n ? a : new n(function(p) {
1473          p(a);
1474        })).then(s, l);
1475      }
1476      c((r = r.apply(t, e || [])).next());
1477    });
1478  }, Rt = function(t, e) {
1479    var n, r, o, i, s = {
1480      label: 0,
1481      sent: function() {
1482        if (1 & o[0]) throw o[1];
1483        return o[1];
1484      },
1485      trys: [],
1486      ops: []
1487    };
1488    return i = {
1489      next: l(0),
1490      throw: l(1),
1491      return: l(2)
1492    }, typeof Symbol == "function" && (i[Symbol.iterator] = function() {
1493      return this;
1494    }), i;
1495    function l(c) {
1496      return function(d) {
1497        return (function(a) {
1498          if (n) throw new TypeError("Generator is already executing.");
1499          for (; s; ) try {
1500            if (n = 1, r && (o = 2 & a[0] ? r.return : a[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, a[1])).done) return o;
1501            switch (r = 0, o && (a = [
1502              2 & a[0],
1503              o.value
1504            ]), a[0]) {
1505              case 0:
1506              case 1:
1507                o = a;
1508                break;
1509              case 4:
1510                return s.label++, {
1511                  value: a[1],
1512                  done: false
1513                };
1514              case 5:
1515                s.label++, r = a[1], a = [
1516                  0
1517                ];
1518                continue;
1519              case 7:
1520                a = s.ops.pop(), s.trys.pop();
1521                continue;
1522              default:
1523                if (o = s.trys, !((o = o.length > 0 && o[o.length - 1]) || a[0] !== 6 && a[0] !== 2)) {
1524                  s = 0;
1525                  continue;
1526                }
1527                if (a[0] === 3 && (!o || a[1] > o[0] && a[1] < o[3])) {
1528                  s.label = a[1];
1529                  break;
1530                }
1531                if (a[0] === 6 && s.label < o[1]) {
1532                  s.label = o[1], o = a;
1533                  break;
1534                }
1535                if (o && s.label < o[2]) {
1536                  s.label = o[2], s.ops.push(a);
1537                  break;
1538                }
1539                o[2] && s.ops.pop(), s.trys.pop();
1540                continue;
1541            }
1542            a = e.call(t, s);
1543          } catch (p) {
1544            a = [
1545              6,
1546              p
1547            ], r = 0;
1548          } finally {
1549            n = o = 0;
1550          }
1551          if (5 & a[0]) throw a[1];
1552          return {
1553            value: a[0] ? a[1] : void 0,
1554            done: true
1555          };
1556        })([
1557          c,
1558          d
1559        ]);
1560      };
1561    }
1562  }, K = function(t) {
1563    return e = t.trim(), btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(n, r) {
1564      return String.fromCharCode(+("0x" + r));
1565    }));
1566    var e;
1567  }, U = function(t) {
1568    return (function(e) {
1569      try {
1570        var n = e.replace(/-/g, "+").replace(/_/g, "/");
1571        return decodeURIComponent(window.atob(n).split("").map(function(r) {
1572          return "%" + ("00" + r.charCodeAt(0).toString(16)).slice(-2);
1573        }).join(""));
1574      } catch (e2) {
1575        return atob(e);
1576      }
1577    })(t.trim());
1578  };
1579  function gt(t) {
1580    t.remove();
1581  }
1582  function se() {
1583    var t = (navigator == null ? void 0 : navigator.vendor.indexOf("Apple")) > -1, e = ($n.find(function(n) {
1584      return n[1].test(navigator.userAgent);
1585    }) || [])[0] === M.SAFARI;
1586    return t && e;
1587  }
1588  function yt(t, e, n, r) {
1589    return r === void 0 && (r = true), Pt(this, void 0, void 0, function() {
1590      return Rt(this, function(o) {
1591        return [
1592          2,
1593          Gn({
1594            method: "POST",
1595            url: t,
1596            headers: Fe({
1597              Accept: "application/json",
1598              "content-type": "application/json"
1599            }, e),
1600            body: n,
1601            sendResponseAsJSON: r
1602          })
1603        ];
1604      });
1605    });
1606  }
1607  function Gn(t) {
1608    return Pt(this, void 0, void 0, function() {
1609      var e, n, r, o;
1610      return Rt(this, function(i) {
1611        switch (i.label) {
1612          case 0:
1613            return e = new URLSearchParams(t.body).toString(), [
1614              4,
1615              fetch(t.url, {
1616                method: t.method,
1617                headers: new Headers(t.headers),
1618                body: e
1619              })
1620            ];
1621          case 1:
1622            return (n = i.sent()).ok ? [
1623              3,
1624              6
1625            ] : t.sendResponseAsJSON ? [
1626              4,
1627              n.json()
1628            ] : [
1629              3,
1630              3
1631            ];
1632          case 2:
1633            return o = i.sent(), [
1634              3,
1635              5
1636            ];
1637          case 3:
1638            return [
1639              4,
1640              n.text()
1641            ];
1642          case 4:
1643            o = i.sent(), i.label = 5;
1644          case 5:
1645            return [
1646              2,
1647              {
1648                error: (r = o).error_description || r.error || r
1649              }
1650            ];
1651          case 6:
1652            return t.sendResponseAsJSON ? [
1653              2,
1654              n.json()
1655            ] : [
1656              2,
1657              n.text()
1658            ];
1659        }
1660      });
1661    });
1662  }
1663  var zn = function(t, e) {
1664    if (!t) return null;
1665    var n = t.split(".");
1666    if (n.length !== 3 && n.length !== 2) return null;
1667    var r = -1;
1668    switch (e) {
1669      case "header":
1670        r = 0;
1671        break;
1672      case "payload":
1673        r = 1;
1674        break;
1675      default:
1676        return null;
1677    }
1678    var o = n[r];
1679    if (!o) return null;
1680    try {
1681      var i = U(o);
1682      return JSON.parse(i);
1683    } catch (e2) {
1684      return null;
1685    }
1686  }, mt = function(t, e) {
1687    return t in e;
1688  };
1689  function z(t) {
1690    return !t || !t.trim().length;
1691  }
1692  var j = function() {
1693    return j = Object.assign || function(t) {
1694      for (var e, n = 1, r = arguments.length; n < r; n++) for (var o in e = arguments[n]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
1695      return t;
1696    }, j.apply(this, arguments);
1697  }, _ = function(t, e, n, r) {
1698    return new (n || (n = Promise))(function(o, i) {
1699      function s(d) {
1700        try {
1701          c(r.next(d));
1702        } catch (a) {
1703          i(a);
1704        }
1705      }
1706      function l(d) {
1707        try {
1708          c(r.throw(d));
1709        } catch (a) {
1710          i(a);
1711        }
1712      }
1713      function c(d) {
1714        var a;
1715        d.done ? o(d.value) : (a = d.value, a instanceof n ? a : new n(function(p) {
1716          p(a);
1717        })).then(s, l);
1718      }
1719      c((r = r.apply(t, e || [])).next());
1720    });
1721  }, C = function(t, e) {
1722    var n, r, o, i, s = {
1723      label: 0,
1724      sent: function() {
1725        if (1 & o[0]) throw o[1];
1726        return o[1];
1727      },
1728      trys: [],
1729      ops: []
1730    };
1731    return i = {
1732      next: l(0),
1733      throw: l(1),
1734      return: l(2)
1735    }, typeof Symbol == "function" && (i[Symbol.iterator] = function() {
1736      return this;
1737    }), i;
1738    function l(c) {
1739      return function(d) {
1740        return (function(a) {
1741          if (n) throw new TypeError("Generator is already executing.");
1742          for (; s; ) try {
1743            if (n = 1, r && (o = 2 & a[0] ? r.return : a[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, a[1])).done) return o;
1744            switch (r = 0, o && (a = [
1745              2 & a[0],
1746              o.value
1747            ]), a[0]) {
1748              case 0:
1749              case 1:
1750                o = a;
1751                break;
1752              case 4:
1753                return s.label++, {
1754                  value: a[1],
1755                  done: false
1756                };
1757              case 5:
1758                s.label++, r = a[1], a = [
1759                  0
1760                ];
1761                continue;
1762              case 7:
1763                a = s.ops.pop(), s.trys.pop();
1764                continue;
1765              default:
1766                if (o = s.trys, !((o = o.length > 0 && o[o.length - 1]) || a[0] !== 6 && a[0] !== 2)) {
1767                  s = 0;
1768                  continue;
1769                }
1770                if (a[0] === 3 && (!o || a[1] > o[0] && a[1] < o[3])) {
1771                  s.label = a[1];
1772                  break;
1773                }
1774                if (a[0] === 6 && s.label < o[1]) {
1775                  s.label = o[1], o = a;
1776                  break;
1777                }
1778                if (o && s.label < o[2]) {
1779                  s.label = o[2], s.ops.push(a);
1780                  break;
1781                }
1782                o[2] && s.ops.pop(), s.trys.pop();
1783                continue;
1784            }
1785            a = e.call(t, s);
1786          } catch (p) {
1787            a = [
1788              6,
1789              p
1790            ], r = 0;
1791          } finally {
1792            n = o = 0;
1793          }
1794          if (5 & a[0]) throw a[1];
1795          return {
1796            value: a[0] ? a[1] : void 0,
1797            done: true
1798          };
1799        })([
1800          c,
1801          d
1802        ]);
1803      };
1804    }
1805  }, vt = function(t, e) {
1806    for (var n = 0, r = e.length, o = t.length; n < r; n++, o++) t[o] = e[n];
1807    return t;
1808  }, wt = (function() {
1809    function t(e) {
1810      if (e === void 0 && (e = new It()), this.initiated = false, this.keys = [], this.handlers = /* @__PURE__ */ new Map(), this.m_refreshTokenOnEnable = false, this.m_refreshRedirectionEnabled = false, !(e && e.get && e.set && e.delete)) throw new Error("Please provide a valid Persistence class that implements a set, get and delete.");
1811      this.persistence = e;
1812    }
1813    return Object.defineProperty(t.prototype, "refreshTokenOnEnable", {
1814      get: function() {
1815        return this.m_refreshTokenOnEnable;
1816      },
1817      enumerable: false,
1818      configurable: true
1819    }), Object.defineProperty(t.prototype, "refreshRedirectionEnabled", {
1820      get: function() {
1821        return this.m_refreshRedirectionEnabled;
1822      },
1823      enumerable: false,
1824      configurable: true
1825    }), t.prototype.init = function(e, n) {
1826      var r, o, i;
1827      if (this.log("init", e == null ? void 0 : e.debug), this.initiated) throw new Error("Client already initiated.");
1828      if (!(e == null ? void 0 : e.clientId) || !(!((r = e.clientId) === null || r === void 0) && r.trim().length)) throw new Error("Please provide a valid client id.");
1829      if (e.msToRefresh && e.msToRefresh < 0) throw new Error("Please provide a msToRefresh value that is greater than 0. A value of 0 will be ignored.");
1830      if (e.clockTolerance && e.clockTolerance < 0) throw new Error("Please provide a clockTolerance value that is greater than 0. A value of 0 will be ignored.");
1831      if (this.config = j(j({}, Cn), typeof e == "object" && e), this.callConfig = j(j({}, Te), typeof n == "object" && n), ((o = this.callConfig) === null || o === void 0 ? void 0 : o.responseMode) !== x.FRAGMENT && ((i = this.callConfig) === null || i === void 0 ? void 0 : i.responseMode) !== x.QUERY) throw new Error('Please provide a valid Response Mode value. Either "fragment" or "query".');
1832      this.initiated = true, this.checkCache();
1833    }, t.prototype.handleRedirect = function() {
1834      this.log("handleRedirect"), this.checkInitiated();
1835      var e, n = window.opener && window.opener !== window && window.name === pt;
1836      if (window.parent !== window && window.name.startsWith(ut) || n) return this.log("handleRedirect :: no redirect in iframe or poup"), Promise.reject({
1837        ok: false,
1838        error: Un,
1839        fromIframeOrPopup: true
1840      });
1841      try {
1842        e = this.parseFragment(window);
1843      } catch (o) {
1844        var r = o;
1845        return this.log("handleRedirect :: unable to parse fragment " + (r.message ? ":: " + r.message : "")), Promise.reject({
1846          ok: false,
1847          error: An
1848        });
1849      }
1850      return this.cleanupFragment(), this.handleFragment(e);
1851    }, t.prototype.getCachedToken = function(e) {
1852      this.log("getCachedToken");
1853      var n = this.getCacheKey(e, this.config.clientId), r = U(this.persistence.get(n));
1854      return (r == null ? void 0 : r.trim().length) ? JSON.parse(r) : null;
1855    }, t.prototype.getUnexpiredToken = function(e) {
1856      this.log("getUnexpiredToken");
1857      var n = this.getCachedToken(e);
1858      if (!n) return "";
1859      var r = Date.now();
1860      return new Date(n.expires).getTime() > r ? n.token : "";
1861    }, t.prototype.disableRefreshRedirect = function() {
1862      this.m_refreshRedirectionEnabled = false;
1863    }, t.prototype.enableRefreshRedirect = function() {
1864      this.m_refreshRedirectionEnabled = true, this.refreshTokenOnEnable && this.refreshTokens();
1865    }, t.prototype.cancelRefreshRedirect = function() {
1866      this.m_refreshTokenOnEnable = false;
1867    }, t.prototype.getAccessToken = function() {
1868      return this.log("getAccessToken"), this.checkInitiated(), this.getUnexpiredToken(b.ACCESS_TOKEN);
1869    }, t.prototype.getRefreshToken = function() {
1870      return this.log("getRefreshToken"), this.checkInitiated(), this.getUnexpiredToken(b.REFRESH_TOKEN);
1871    }, t.prototype.getIdToken = function() {
1872      return this.log("getIdToken"), this.checkInitiated(), this.getUnexpiredToken(b.ID_TOKEN);
1873    }, t.prototype.getLRAccessToken = function() {
1874      this.log("getLRAccessToken");
1875      var e = this.getIdToken();
1876      return e ? JSON.parse(U(e.split(".")[1])).lrat : "";
1877    }, t.prototype.login = function(e) {
1878      if (this.log("login"), this.checkInitiated(), z(e.policy)) throw new Error(G);
1879      var n = e.withPrompt, r = n !== void 0 && n, o = e.state, i = e.requestType, s = i === void 0 ? B.REDIRECT : i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(o), u = f.nonce, y = f.state, v = {
1880        nonce: u,
1881        state: y,
1882        withPrompt: r,
1883        scope: this.callConfig.scope,
1884        responseType: this.callConfig.responseType,
1885        responseMode: x.FRAGMENT,
1886        redirectUri: l,
1887        mcmId: d,
1888        mcaId: a,
1889        cbcVisitorId: p
1890      }, h = this.buildUrl(c, v);
1891      if (this.setFlowType(I.IMPLICIT), s === B.POPUP) return this.handlePopup(h, y);
1892      window.location.assign(h);
1893    }, t.prototype.loginPkce = function(e) {
1894      if (this.log("loginPkce"), this.checkInitiated(), z(e.policy)) throw new Error(G);
1895      if (this.config.useLegacyDomain === true) throw new Error(dt);
1896      var n = e.withPrompt, r = n !== void 0 && n, o = e.state, i = e.requestType, s = i === void 0 ? B.REDIRECT : i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(o), u = f.nonce, y = f.state, v = {
1897        nonce: u,
1898        state: y,
1899        withPrompt: r,
1900        scope: this.callConfig.scope,
1901        responseType: "code",
1902        responseMode: this.callConfig.responseMode,
1903        redirectUri: l,
1904        mcmId: d,
1905        mcaId: a,
1906        cbcVisitorId: p,
1907        pkceRequestState: F.AUTHORIZATION_CODE
1908      }, h = this.buildUrlPkce(c, v);
1909      if (this.setFlowType(I.PKCE), s === B.POPUP) return this.handlePopup(h, y);
1910      window.location.assign(h);
1911    }, t.prototype.resetPasswordFacebook = function(e) {
1912      if (this.log("resetPassword"), this.checkInitiated(), z(e.policy)) throw new Error(G);
1913      var n = e.withPrompt, r = n !== void 0 && n, o = e.state, i = e.requestType, s = i === void 0 ? B.REDIRECT : i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(o), u = f.nonce, y = f.state, v = {
1914        nonce: u,
1915        state: y,
1916        withPrompt: r,
1917        scope: this.callConfig.scope,
1918        responseType: this.callConfig.responseType,
1919        responseMode: x.FRAGMENT,
1920        redirectUri: l,
1921        mcmId: d,
1922        mcaId: a,
1923        cbcVisitorId: p
1924      }, h = this.buildUrl(c, v);
1925      if (this.setFlowType(I.IMPLICIT), s === B.POPUP) return this.handlePopup(h, y);
1926      window.location.assign(h);
1927    }, t.prototype.resetPasswordFacebookPkce = function(e) {
1928      if (this.log("resetPasswordPkce"), this.checkInitiated(), z(e.policy)) throw new Error(G);
1929      if (this.config.useLegacyDomain === true) throw new Error(dt);
1930      var n = e.withPrompt, r = n !== void 0 && n, o = e.state, i = e.requestType, s = i === void 0 ? B.REDIRECT : i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(o), u = f.nonce, y = f.state, v = {
1931        nonce: u,
1932        state: y,
1933        withPrompt: r,
1934        scope: this.callConfig.scope,
1935        responseType: "code",
1936        responseMode: this.callConfig.responseMode,
1937        redirectUri: l,
1938        mcmId: d,
1939        mcaId: a,
1940        cbcVisitorId: p,
1941        pkceRequestState: F.AUTHORIZATION_CODE
1942      }, h = this.buildUrlPkce(c, v);
1943      if (this.setFlowType(I.PKCE), s === B.POPUP) return this.handlePopup(h, y);
1944      window.location.assign(h);
1945    }, t.prototype.loginIdpJwt = function(e) {
1946      var n;
1947      return _(this, void 0, void 0, function() {
1948        var r, o, i, s, l, c, d, a, p, f, u, y, v, h, g, m, w, E;
1949        return C(this, function(S) {
1950          switch (S.label) {
1951            case 0:
1952              if (this.log("login IdpJwt"), this.checkInitiated(), !(!((n = e.idpJwtToken) === null || n === void 0) && n.trim().length)) throw new Error(Bn);
1953              if (this.config.useLegacyDomain === true) throw new Error(Kn);
1954              return r = e.state, o = e.policy, i = e.redirectUri, s = e.idpJwtToken, l = o || Q.IDPJWTAUTH, c = this.prepareAndStoreRequestValues(r), d = c.nonce, a = c.state, this.setFlowType(I.IDPJWT), p 
1954= {
1955                nonce: d,
1956                state: a,
1957                scope: this.callConfig.scope,
1958                responseType: this.callConfig.responseType,
1959                responseMode: x.FORM_POST,
1960                redirectUri: i,
1961                pkceRequestState: F.AUTHORIZATION_CODE
1962              }, f = this.getPkceChallengePair(), u = f.code_verifier, y = f.code_challenge, v = f.code_challenge_method, h = {
1963                client_id: this.config.clientId,
1964                response_type: "code",
1965                redirect_uri: i,
1966                scope: this.callConfig.scope,
1967                assertion: s,
1968                response_mode: x.FORM_POST,
1969                code_challenge_method: v,
1970                code_challenge: y,
1971                state: a
1972              }, [
1973                4,
1974                this.getIdpJwtAuthorizationCode(l, p, h)
1975              ];
1976            case 1:
1977              return (g = S.sent()) && (g == null ? void 0 : g.error) && (g == null ? void 0 : g.error_description) ? (this.log("loginIdpJwt :: failed getting authorization code :: " + (g == null ? void 0 : g.error_description)), [
1978                2,
1979                Promise.reject({
1980                  ok: false,
1981                  error: g == null ? void 0 : g.error_description,
1982                  state: U((g == null ? void 0 : g.state) || "").split("|")[1]
1983                })
1984              ]) : g && g.code ? g.state ? this.validateState(g == null ? void 0 : g.state) ? (p.pkceRequestState = F.ACCESS_TOKEN, m = {
1985                grant_type: "authorization_code",
1986                code_verifier: u,
1987                code: g.code
1988              }, [
1989                4,
1990                this.getIdpJwtAccessToken(l, p, m, g.state)
1991              ]) : (this.log("loginIdpJwt :: invalid state"), [
1992                2,
1993                Promise.reject({
1994                  ok: false,
1995                  error: ct
1996                })
1997              ]) : (this.log("loginIdpJwt :: no state in response"), [
1998                2,
1999                Promise.reject({
2000                  ok: false,
2001                  error: at
2002                })
2003              ]) : [
2004                3,
2005                3
2006              ];
2007            case 2:
2008              return (w = S.sent()) && w.error ? (this.log("loginIdpJwt :: failed getting access token :: " + (w == null ? void 0 : w.error)), [
2009                2,
2010                Promise.reject(w)
2011              ]) : (this.clearPkceChallengePair(), E = w, [
2012                2,
2013                this.validateAndSavePkceFlowTokens(E, a)
2014              ]);
2015            case 3:
2016              return [
2017                2,
2018                Promise.reject({
2019                  ok: false,
2020                  error: "loginIdpJwt :: failed getting authorization code ",
2021                  state: U((g == null ? void 0 : g.state) || "").split("|")[1]
2022                })
2023              ];
2024          }
2025        });
2026      });
2027    }, t.prototype.setPkcePolicy = function(e) {
2028      this.persistence.set(Ae, e);
2029    }, t.prototype.getPkcePolicy = function(e) {
2030      e === void 0 && (e = false);
2031      var n = this.persistence.get(Ae);
2032      return e && this.persistence.delete(Ae), n;
2033    }, t.prototype.getPkceChallengePair = function() {
2034      var e = this.persistence.get(Ie), n = e ? JSON.parse(e) : {};
2035      if (!n.code_challenge) {
2036        var r = yn();
2037        n = {
2038          code_verifier: r.code_verifier,
2039          code_challenge: r.code_challenge,
2040          code_challenge_method: "S256"
2041        }, this.persistence.set(Ie, JSON.stringify(n));
2042      }
2043      return n;
2044    }, t.prototype.clearPkceChallengePair = function() {
2045      this.persistence.delete(Ie);
2046    }, t.prototype.getIdpJwtAuthorizationCode = function(e, n, r) {
2047      return _(this, void 0, void 0, function() {
2048        var o;
2049        return C(this, function(i) {
2050          switch (i.label) {
2051            case 0:
2052              return [
2053                4,
2054                yt(this.buildUrlIdpJwt(e, n), {
2055                  "content-type": "application/x-www-form-urlencoded"
2056                }, r, false)
2057              ];
2058            case 1:
2059              return o = i.sent(), [
2060                2,
2061                (function(s) {
2062                  var l = {}, c = document.createElement("div");
2063                  c.innerHTML = s;
2064                  var d = c.querySelector("form");
2065                  return d && d.querySelectorAll("input").forEach(function(a) {
2066                    l[a.name] = a.value;
2067                  }), l;
2068                })(o)
2069              ];
2070          }
2071        });
2072      });
2073    }, t.prototype.getIdpJwtAccessToken = function(e, n, r, o) {
2074      return _(this, void 0, void 0, function() {
2075        var i;
2076        return C(this, function(s) {
2077          switch (s.label) {
2078            case 0:
2079              return i = this.buildUrlIdpJwt(e, n), [
2080                4,
2081                this.sendAccessTokenPkceRequest(i, r, o)
2082              ];
2083            case 1:
2084              return [
2085                2,
2086                s.sent()
2087              ];
2088          }
2089        });
2090      });
2091    }, t.prototype.getPkceAccessToken = function(e, n, r, o) {
2092      return _(this, void 0, void 0, function() {
2093        var i;
2094        return C(this, function(s) {
2095          switch (s.label) {
2096            case 0:
2097              return i = this.buildUrlPkce(e, n), [
2098                4,
2099                this.sendAccessTokenPkceRequest(i, r, o)
2100              ];
2101            case 1:
2102              return [
2103                2,
2104                s.sent()
2105              ];
2106          }
2107        });
2108      });
2109    }, t.prototype.sendAccessTokenPkceRequest = function(e, n, r) {
2110      return _(this, void 0, void 0, function() {
2111        var o, i;
2112        return C(this, function(s) {
2113          switch (s.label) {
2114            case 0:
2115              return o = null, [
2116                4,
2117                yt(e, {
2118                  "content-type": "application/x-www-form-urlencoded"
2119                }, n).catch(function(l) {
2120                  var c, d;
2121                  l.response && l.response.status && (o = {
2122                    ok: false,
2123                    error: "Status code: " + l.response.status + ". Message: " + ((d = (c = l.response) === null || c === void 0 ? void 0 : c.data) === null || d === void 0 ? void 0 : d.error_description),
2124                    state: r
2125                  });
2126                })
2127              ];
2128            case 1:
2129              return i = s.sent(), [
2130                2,
2131                o !== null ? o : i
2132              ];
2133          }
2134        });
2135      });
2136    }, t.prototype.validateAndSavePkceFlowTokens = function(e, n) {
2137      return _(this, void 0, void 0, function() {
2138        var r;
2139        return C(this, function(o) {
2140          switch (o.label) {
2141            case 0:
2142              return this.log("validateAndSavePkceFlowTokens"), [
2143                4,
2144                this.validateJWT(e.id_token, n)
2145              ];
2146            case 1:
2147              return (r = o.sent()) ? (this.saveTokensPkceFlow(e), [
2148                2,
2149                Promise.resolve({
2150                  ok: true,
2151                  state: U(n).split("|")[1],
2152                  authenticationType: this.getAuthenticationType(r.acr)
2153                })
2154              ]) : (this.log("validateAndSavePkceFlowTokens :: invalid id token"), [
2155                2,
2156                Promise.reject({
2157                  ok: false,
2158                  error: Pn,
2159                  state: U(n).split("|")[1]
2160                })
2161              ]);
2162          }
2163        });
2164      });
2165    }, t.prototype.createAccount = function(e) {
2166      if (this.log("createAccount"), this.checkInitiated(), z(e.policy)) throw new Error(G);
2167      var n = e.state, r = e.requestType, o = r === void 0 ? B.REDIRECT : r, i = e.withPrompt, s = i === void 0 || i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(n), u = f.nonce, y = f.state, v = {
2168        nonce: u,
2169        state: y,
2170        withPrompt: s,
2171        scope: this.callConfig.scope,
2172        responseType: this.callConfig.responseType,
2173        responseMode: x.FRAGMENT,
2174        redirectUri: l,
2175        mcmId: d,
2176        mcaId: a,
2177        cbcVisitorId: p
2178      }, h = this.buildUrl(c, v);
2179      if (this.setFlowType(I.IMPLICIT), o === B.POPUP) return this.handlePopup(h, y);
2180      window.location.assign(h);
2181    }, t.prototype.createAccountPkce = function(e) {
2182      if (this.log("createAccountPkce"), this.checkInitiated(), z(e.policy)) throw new Error(G);
2183      if (this.config.useLegacyDomain === true) throw new Error(ht);
2184      var n = e.state, r = e.requestType, o = r === void 0 ? B.REDIRECT : r, i = e.withPrompt, s = i === void 0 || i, l = e.redirectUri, c = e.policy, d = e.mcmId, a = e.mcaId, p = e.cbcVisitorId, f = this.prepareAndStoreRequestValues(n), u = f.nonce, y = f.state, v = {
2185        nonce: u,
2186        state: y,
2187        withPrompt: s,
2188        scope: this.callConfig.scope,
2189        responseType: "code",
2190        responseMode: this.callConfig.responseMode,
2191        redirectUri: l,
2192        mcmId: d,
2193        mcaId: a,
2194        cbcVisitorId: p,
2195        pkceRequestState: F.AUTHORIZATION_CODE
2196      }, h = this.buildUrlPkce(c, v);
2197      if (this.setFlowType(I.PKCE), o === B.POPUP) return this.handlePopup(h, y);
2198      window.location.assign(h);
2199    }, t.prototype.getPolicyForRefresh = function(e) {
2200      var n = e == null ? void 0 : e.includes("short_aq"), r = e == null ? void 0 : e.includes("cbc"), o = e == null ? void 0 : e.includes("internalclient"), i = o ? e || Q.INTERNAL : r ? Q.LOGIN_CBC : Q.LOGIN;
2201      return !o && n && (i = (r ? Ne : De)[1]), i;
2202    }, t.prototype.refreshTokens = function() {
2203      var e, n;
2204      return _(this, void 0, void 0, function() {
2205        var r, o, i, s, l, c, d, a, p, f, u, y;
2206        return C(this, function(v) {
2207          if (this.log("refreshToken"), this.checkInitiated(), r = this.getCachedToken(b.ID_TOKEN) || {}, o = r.token, i = r.policy, !o) return this.log("refreshToken :: no id token to refresh"), [
2208            2,
2209            Promise.reject({
2210              ok: false,
2211              error: st
2212            })
2213          ];
2214          if ((s = this.getFlowType()) === I.IDPJWT) return [
2215            2,
2216            this.refreshTokensIdpJwt()
2217          ];
2218          if (s === I.PKCE) return [
2219            2,
2220            this.refreshTokensPkce()
2221          ];
2222          try {
2223            l = this.getCompleteCallback(((e = this.callConfig) === null || e === void 0 ? void 0 : e.renew
2223alCallback) || "");
2224          } catch (e2) {
2225            return this.log("refreshToken :: invalid renewal url"), [
2226              2,
2227              Promise.reject({
2228                ok: false,
2229                error: Rn
2230              })
2231            ];
2232          }
2233          return !this.refreshRedirectionEnabled && se() ? (this.log("refreshToken :: redirect disabled, refresh will happen on next enable"), this.m_refreshTokenOnEnable = true, [
2234            2,
2235            {
2236              ok: true
2237            }
2238          ]) : (c = this.getPolicyForRefresh(i), d = this.prepareAndStoreRequestValues(this.getSafariRedirectState()), a = d.nonce, p = d.state, f = {
2239            nonce: a,
2240            state: p,
2241            scope: this.callConfig.scope,
2242            responseType: this.callConfig.responseType,
2243            responseMode: x.FRAGMENT,
2244            redirectUri: l,
2245            isRenewal: true,
2246            withPrompt: !se()
2247          }, u = this.buildUrl(c, f), (y = JSON.parse(U((n = o == null ? void 0 : o.split(".")[1]) !== null && n !== void 0 ? n : "{}")).email) && (u += "&login_hint=" + y), se() ? (this.m_refreshTokenOnEnable = false, this.callConfig.usePopupForSafariRefresh ? [
2248            2,
2249            this.handlePopup(u, p)
2250          ] : (window.location.assign(u), [
2251            2,
2252            {
2253              ok: true
2254            }
2255          ])) : [
2256            2,
2257            this.handleIframe(u, p)
2258          ]);
2259        });
2260      });
2261    }, t.prototype.silentLogin = function(e) {
2262      return _(this, void 0, void 0, function() {
2263        var n, r, o, i, s, l, c, d, a, p, f, u;
2264        return C(this, function(y) {
2265          if (this.log("silentLogin"), this.checkInitiated(), z(e.policy)) throw new Error(G);
2266          n = e.state, r = e.redirectUri, o = e.policy, i = e.mcmId, s = e.mcaId, l = e.cbcVisitorId, c = this.prepareAndStoreRequestValues(n), d = c.nonce, a = c.state, p = {
2267            nonce: d,
2268            state: a,
2269            isRenewal: true,
2270            withPrompt: false,
2271            scope: this.callConfig.scope,
2272            responseType: this.callConfig.responseType,
2273            responseMode: x.FRAGMENT,
2274            redirectUri: r,
2275            mcmId: i,
2276            mcaId: s,
2277            cbcVisitorId: l
2278          };
2279          try {
2280            return f = this.buildUrl(o, p), [
2281              2,
2282              this.handleSilentLogin(f, a, I.IMPLICIT)
2283            ];
2284          } catch (v) {
2285            return u = v, this.log("silentLoginPkce :: error occured during silent login: " + u.message), [
2286              2,
2287              Promise.reject({
2288                ok: false,
2289                error: u.message
2290              })
2291            ];
2292          }
2293          return [
2294            2
2295          ];
2296        });
2297      });
2298    }, t.prototype.silentLoginPkce = function(e) {
2299      return _(this, void 0, void 0, function() {
2300        var n, r, o, i, s, l, c, d, a, p, f, u;
2301        return C(this, function(y) {
2302          if (this.log("silentLoginPkce"), this.checkInitiated(), z(e.policy)) throw new Error(G);
2303          if (this.config.useLegacyDomain === true) throw new Error(ht);
2304          n = e.state, r = e.redirectUri, o = e.policy, i = e.mcmId, s = e.mcaId, l = e.cbcVisitorId, c = this.prepareAndStoreRequestValues(n), d = c.nonce, a = c.state, p = {
2305            nonce: d,
2306            state: a,
2307            isRenewal: true,
2308            withPrompt: false,
2309            scope: this.callConfig.scope,
2310            responseType: "code",
2311            responseMode: x.QUERY,
2312            redirectUri: r,
2313            mcmId: i,
2314            mcaId: s,
2315            cbcVisitorId: l,
2316            pkceRequestState: F.AUTHORIZATION_CODE
2317          };
2318          try {
2319            return f = this.buildUrlPkce(o, p), [
2320              2,
2321              this.handleSilentLogin(f, a, I.PKCE)
2322            ];
2323          } catch (v) {
2324            return u = v, this.log("silentLoginPkce :: error occured during silent login: " + u.message), [
2325              2,
2326              Promise.reject({
2327                ok: false,
2328                error: u.message
2329              })
2330            ];
2331          }
2332          return [
2333            2
2334          ];
2335        });
2336      });
2337    }, t.prototype.handleSilentLogin = function(e, n, r) {
2338      return _(this, void 0, void 0, function() {
2339        var o;
2340        return C(this, function(i) {
2341          this.log("handleSilentLogin"), this.checkInitiated(), this.setFlowType(r), se() && this.log("handleSilentLogin :: Safari detected");
2342          try {
2343            return [
2344              2,
2345              this.handleIframe(e, n)
2346            ];
2347          } catch (s) {
2348            return o = s, this.log("handleSilentLogin :: error occured during silent login: " + o.message), [
2349              2,
2350              Promise.reject({
2351                ok: false,
2352                error: o.message
2353              })
2354            ];
2355          }
2356          return [
2357            2
2358          ];
2359        });
2360      });
2361    }, t.prototype.refreshTokensIdpJwt = function() {
2362      return _(this, void 0, void 0, function() {
2363        return C(this, function(e) {
2364          return this.log("refreshTokensIdpJwt"), [
2365            2,
2366            this.refreshTokensPkce(I.IDPJWT)
2367          ];
2368        });
2369      });
2370    }, t.prototype.refreshTokensPkce = function(e) {
2371      var n, r, o;
2372      return e === void 0 && (e = I.PKCE), _(this, void 0, void 0, function() {
2373        var i, s, l, c, d, a, p, f, u;
2374        return C(this, function(y) {
2375          switch (y.label) {
2376            case 0:
2377              if (this.log("refreshTokensPkce :: flow type: " + e), !(i = this.getRefreshToken())) return this.log("refreshTokensPkce :: flow type: " + e + " :: no refresh token to refresh"), [
2378                2,
2379                Promise.reject({
2380                  ok: false,
2381                  error: st
2382                })
2383              ];
2384              if (this.config.useLegacyDomain === true) return [
2385                2,
2386                Promise.reject({
2387                  ok: false,
2388                  error: e === I.IDPJWT ? Ln : Hn
2389                })
2390              ];
2391              if (s = {
2392                nonce: "",
2393                state: "",
2394                redirectUri: "",
2395                scope: this.callConfig.scope,
2396                responseType: this.callConfig.responseType,
2397                responseMode: this.callConfig.responseMode,
2398                pkceRequestState: F.REFRESH_TOKEN
2399              }, l = {
2400                grant_type: "refresh_token",
2401                refresh_token: i,
2402                client_secret: (n = this.config) === null || n === void 0 ? void 0 : n.clientSecret
2403              }, !((o = (r = this.callConfig) === null || r === void 0 ? void 0 : r.refreshScope) === null || o === void 0) && o.trim() && (l.scope = this.callConfig.refreshScope), c = this.getPayloadFromIdToken() || {}, d = c.nonce, !(a = c.acr)) throw this.log("refreshTokensPkce :: flow type: " + e + " :: failed getting policy from id token :: " + ke), new Error(ke);
2404              return p = this.prepareAndStoreRequestValues("", d).state, f = null, e !== I.IDPJWT ? [
2405                3,
2406                2
2407              ] : [
2408                4,
2409                this.getIdpJwtAccessToken(a, s, l, p)
2410              ];
2411            case 1:
2412              return f = y.sent(), [
2413                3,
2414                4
2415              ];
2416            case 2:
2417              return [
2418                4,
2419                this.getPkceAccessToken(a, s, l, p)
2420              ];
2421            case 3:
2422              f = y.sent(), y.label = 4;
2423            case 4:
2424              return f && f.error ? (this.log("refreshTokensPkce :: flow type: " + e + " :: failed getting access token :: " + (f == null ? void 0 : f.error)), [
2425                2,
2426                Promise.resolve(f)
2427              ]) : (u = f, [
2428                2,
2429                this.validateAndSavePkceFlowTokens(u, p)
2430              ]);
2431          }
2432        });
2433      });
2434    }, t.prototype.getPayloadFromIdToken = function() {
2435      this.log("getPayloadFromIdToken");
2436      var e = (this.getCachedToken(b.ID_TOKEN) || {}).token;
2437      if (!e) return null;
2438      var n = zn(e, "payload");
2439      return n && mt("acr", n) && typeof n.acr == "string" ? {
2440        nonce: mt("nonce", n) && typeof n.nonce == "string" ? n.nonce : void 0,
2441        acr: n.acr
2442      } : null;
2443    }, t.prototype.getBaseURL = function() {
2444      return this.config.useLegacyDomain ? L[this.callConfig.env] : T[this.callConfig.env];
2445    }, t.prototype.getB2CDiscoveryEndpoint = function() {
2446      return this.config.useLegacyDomain ? Vn[this.callConfig.env] : jn[this.callConfig.env];
2447    }, t.prototype.logout = function(e) {
2448      this.log("logout"), this.checkInitiated();
2449      var n = e.redirectUri, r = e.skipEndpoint, o = this.getCacheKey(b.ID_TOKEN, this.config.clientId), i = this.getCacheKey(b.ACCESS_TOKEN, this.config.clientId), s = this.getCacheKey(b.REFRESH_TOKEN, this.config.clientId), l = this.getCacheKey(b.USER_INFO, this.config.clientId), c = this.getCachedToken(b.ID_TOKEN) || {}, d = c.policy, a = c.token;
2450      if (this.persistence.delete(o), this.persistence.delete(i), this.persistence.delete(s), this.persistence.delete(l), !r) {
2451        if (!n) throw new Error(lt);
2452        var p = d || ie[Q.LOGIN], f = this.getBaseURL() + "/" + p + "/oauth2/v2.0/logout?id_token_hint=" + a + "&post_logout_redirect_uri=" + encodeURIComponent(this.getCompleteCallback(n));
2453        window.location.assign(f);
2454      }
2455    }, t.prototype.getFlowType = function() {
2456      return this.persistence.get(ft);
2457    }, t.prototype.setFlowType = function(e) {
2458      this.persistence.set(ft, e);
2459    }, t.prototype.deleteAccount = function() {
2460      throw this.log("deleteAccount"), this.checkInitiated(), new Error("Not implemented in B2C yet.");
2461    }, t.prototype.getUserInfo = function() {
2462      var e;
2463      this.log("getUserInfo"), this.checkInitiated();
2464      var n = Date.now(), r = this.getCachedToken(b.ID_TOKEN) || {}, o = r.token, i = r.expires, s = r.policy;
2465      if (!o || !i || n > new Date(i).getTime()) return {};
2466      var l = JSON.parse(U(o.split(".")[1])), c = l.given_name, d = l.family_name, a = l.email, p = l.name, f = l.rcid, u = l.email_verified, y = l.lrat, v = l.employeeId, h = l.ldapUsername, g = {
2467        given_name: c,
2468        family_name: d,
2469        name: p,
2470        email: a
2471      };
2472      return !((e = s == null ? void 0 : s.toLowerCase()) === null || e === void 0) && e.includes("internalclient") || v ? j(j({}, g), {
2473        employeeId: v,
2474        ldapUsername: h
2475      }) : j(j({}, g), {
2476        rcid: f,
2477        email_verified: u,
2478        lrat: y
2479      });
2480    }, t.prototype.checkForTokens = function() {
2481      return _(this, void 0, void 0, function() {
2482        var e, n, r, o, i, s, l, c, d, a;
2483        return C(this, function(p) {
2484          switch (p.label) {
2485            case 0:
2486              if (this.log("checkForTokens"), this.checkInitiated(), e = Number.POSITIVE_INFINITY, n = (this.getCachedToken(b.ID_TOKEN) || {}).expires, r = n === void 0 ? e : n, o = (this.getCachedToken(b.ACCESS_TOKEN) || {}).expires, i = o === void 0 ? e : o, s = Math.min(r, i), l = this.config.msToRefresh || Ue, s === e) return [
2487                3,
2488                6
2489              ];
2490              if (c = Date.now(), !(s - c < l)) return [
2491                3,
2492                5
2493              ];
2494              p.label = 1;
2495            case 1:
2496              return p.trys.push([
2497                1,
2498                3,
2499                ,
2500                4
2501              ]), [
2502                4,
2503                this.refreshTokens()
2504              ];
2505            case 2:
2506              return p.sent(), [
2507                2,
2508                {
2509                  ok: true
2510                }
2511              ];
2512            case 3:
2513              return d = p.sent(), a = d, this.log("checkForTokens :: unable to refresh token " + (a.message ? ":: " + a.message : "")), this.broadcast(X.REFRESH_ERROR), [
2514                2,
2515                Promise.reject({
2516                  ok: false,
2517                  error: ke
2518                })
2519              ];
2520            case 4:
2521              return [
2522                3,
2523                6
2524              ];
2525            case 5:
2526              return this.registerRefresh(s), [
2527                2,
2528                {
2529                  ok: true
2530                }
2531              ];
2532            case 6:
2533              return [
2534                2,
2535                {
2536                  ok: true
2537                }
2538              ];
2539          }
2540        });
2541      });
2542    }, t.prototype.on = function(e, n) {
2543      var r = this.handlers.get(e) || /* @__PURE__ */ new Set();
2544      r.add(n), this.handlers.set(e, r);
2545    }, t.prototype.off = function(e, n) {
2546      var r = this.handlers.get(e);
2547      r && r.delete(n);
2548    }, t.prototype.getB2cUrlPolicy = function(e) {
2549      var n = e.state, r = e.redirectUri, o = "state", i = K(n ? o + "|" + n : o);
2550      return this.buildUrl(Ce, {
2551        state: i,
2552        scope: "openid",
2553        responseType: "id_token",
2554        responseMode: "fragment",
2555        redirectUri: r
2556      });
2557    }, t.prototype.sendConfirmationEmail = function(e) {
2558      var n = e.state, r = e.redirectUri;
2559      return _(this, void 0, void 0, function() {
2560        var o, i, s, l, c, d;
2561        return C(this, function(a) {
2562          switch (a.label) {
2563            case 0:
2564              if (this.log("sendConfirmationEmail"), this.checkInitiated(), !r) throw new Error(lt);
2565              return o = this.getAccessToken(), i = (this.getCachedToken(b.ID_TOKEN) || {}).token, o && i ? (s = JSON.parse(U(i.split(".")[1])).azpContext, l = qn[this.callConfig.env], c = encodeURIComponent(this.getB2cUrlPolicy({
2566                state: n,
2567                redirectUri: r
2568              })), [
2569                4,
2570                window.fetch(l + "/id/v3/accounts/me/send-confirmation-email?azpContext=" + s + "&b2CUrlPolicy=" + c, {
2571                  method: "post",
2572                  headers: {
2573                    Authorization: "Bearer " + o
2574                  }
2575                })
2576              ]) : (this.log("sendConfirmationEmail :: no logged in user"), [
2577                2,
2578                Promise.reject()
2579              ]);
2580            case 1:
2581              return (d = a.sent()).status < 200 || d.status >= 300 ? (this.log("sendConfirmationEmail :: error when requesting"), [
2582                2,
2583                Promise.reject()
2584              ]) : [
2585                2,
2586                Promise.resolve()
2587              ];
2588          }
2589        });
2590      });
2591    }, t.prototype.getStateFromUrl = function() {
2592      var e, n = window.location.hash;
2593      if (!n) throw new Error("No fragment present");
2594      var r = (e = n.substring(1).split("&").find(function(o) {
2595        return o.startsWith("state=");
2596      })) === null || e === void 0 ? void 0 : e.split("state=")[1];
2597      return U(decodeURIComponent(r || "")).split("|")[1];
2598    }, t.prototype.expireTokens = function() {
2599      var e = this.getCachedToken(b.ID_TOKEN), n = this.getCachedToken(b.ACCESS_TOKEN), r = Date.now();
2600      e && (e.expires = r, this.persistence.set(this.getCacheKey(b.ID_TOKEN, this.config.clientId), K(JSON.stringify(e)), false, 0)), n && (n.expires = r, this.persistence.set(this.getCacheKey(b.ACCESS_TOKEN, this.config.clientId), K(JSON.stringify(n)), false, 0));
2601    }, t.prototype.invalidateTokens = function() {
2602      var e = this.getCachedToken(b.ID_TOKEN), n = this.getCachedToken(b.ACCESS_TOKEN), r = this.getCachedToken(b.REFRESH_TOKEN);
2603      if (e) {
2604        var o = Date.now() - e.expires;
2605        e.token = this.obstructToken(e.token), this.persistence.set(this.getCacheKey(b.ID_TOKEN, this.config.clientId), K(JSON.stringify(e)), false, o);
2606      }
2607      n && (o = Date.now() - n.expires, n.token = this.obstructToken(n.token), this.persistence.set(this.getCacheKey(b.ACCESS_TOKEN, this.config.clientId), K(JSON.stringify(n)), false, o)), r && (o = Date.now() - r.expires, r.token = this.obstructToken(r.token), this.persistence.set(this.getCacheKey(b.REFRESH_TOKEN, this.config.clientId), K(JSON.stringify(r)), false, o));
2608    }, t.prototype.obstructToken = function(e) {
2609      var n = e.split("."), r = JSON.parse(U(n[1]));
2610      return r.lrat = "0000-0000000", r.extra = "data", n[1] = K(JSON.stringify(r)), n.join(".");
2611    }, t.prototype.getSafariRedirectState = function() {
2612      if (se() && typeof this.callConfig.getSafariRefreshState == "function") return this.callConfig.getSafariRefreshState();
2613    }, t.prototype.broadcast = function(e) {
2614      var n = this.handlers.get(e);
2615      n && n.forEach(function(r) {
2616        return setTimeout(function() {
2617          return r();
2618        });
2619      });
2620    }, t.prototype.cleanupFragment = function() {
2621      window.history.replaceState({}, document.title, "" + window.location.pathname + window.location.search);
2622    }, t.prototype.parseFragment = function(e) {
2623      e === void 0 && (e = window), this.log("parseFragment");
2624      var n = e.location.href, r = "";
2625      if (this.getFlowType() === I.IMPLICIT || this.callConfig.responseMode === x.FRAGMENT ? r = n.split("#")[1] : this.callConfig.responseMode === x.QUERY && (r = n.split("?")[1]), !r) throw new Error("No fragment present");
2626      return r.split("&").reduce(function(o, i) {
2627        var s = i.indexOf("="), l = i.substring(0, s), c = decodeURIComponent(i.substring(s + 1));
2628        return o[l] = c, o;
2629      }, {});
2630    }, t.prototype.getAuthenticationType = function(e) {
2631      var n = e.toLowerCase(), r = De.map(function(c) {
2632        return c.toLowerCase();
2633      }), o = Ne.map(function(c) {
2634        return c.toLowerCase();
2635      }), i = Ct.map(function(c) {
2636        return c.toLowerCase();
2637      }), s = kt.map(function(c) {
2638        return c.toLowerCase();
2639      }), l = At.map(function(c) {
2640        return c.toLowerCase();
2641      });
2642      return r.includes(n) || o.includes(n) ? oe.LOGIN : i.includes(n) || s.includes(n) ? oe.SIGNUP : l.includes(n) ? oe.IDPJWTAUTH : oe.OTHER;
2643    }, t.prototype.handleFragment = function(e) {
2644      var n;
2645      return _(this, void 0, void 0, function() {
2646        var r, o, i, s, l, c, d, a, p, f;
2647        return C(this, function(u) {
2648          switch (u.label) {
2649            case 0:
2650              if (this.log("handleFragment"), !(r = e[A.STATE])) return this.log("handleFragment :: no state in response"), [
2651                2,
2652                Promise.reject({
2653                  ok: false,
2654                  error: at
2655                })
2656              ];
2657              if (o = U(r).split("|")[1], e[A.ERROR]) return this.log("handleFragment :: " + e[A.ERROR] + " :: " + e[A.ERROR_DESCRIPTION]), [
2658                2,
2659                Promise.reject({
2660                  ok: false,
2661                  error: e[A.ERROR] + " :: " + e[A.ERROR_DESCRIPTION],
2662                  state: o
2663                })
2664              ];
2665              if (this.getFlowType() === I.PKCE) return [
2666                2,
2667                this.handleFragmentPkce(e, o)
2668              ];
2669              this.setFlowType(I.IMPLICIT), i = e[A.ID_TOKEN], u.label = 1;
2670            case 1:
2671              return u.trys.push([
2672                1,
2673                4,
2674                5,
2675                6
2676              ]), i ? [
2677                4,
2678                this.validateJWT(i, r)
2679              ] : [
2680                3,
2681                3
2682              ];
2683            case 2:
2684              s = u.sent(), this.log("handleFragment :: id_token validated"), u.label = 3;
2685            case 3:
2686              return this.shouldValidateNonceAndState((n = s == null ? void 0 : s.acr) !== null && n !== void 0 ? n : "") && (this.validateState(r), this.log("handleFragment :: state validated")), [
2687                3,
2688                6
2689              ];
2690            case 4:
2691              return l = u.sent(), c = l, this.log("handleFragment :: jwt validation failed " + (c.message ? ":: " + c.message : "")), [
2692                2,
2693                Promise.reject({
2694                  ok: false,
2695                  error: c.message,
2696                  state: o
2697                })
2698              ];
2699            case 5:
2700              return (s == null ? void 0 : s.acr.toLowerCase()) !== _e.toLowerCase() && this.clearCache(r), [
2701                7
2702              ];
2703            case 6:
2704              return d = (s || {}).acr, a = d === void 0 ? "" : d, this.shouldValidateNonceAndState(a) ? (this.saveTokens(e, s), [
2705                2,
2706                Promise.resolve({
2707                  ok: true,
2708                  state: o,
2709                  authenticationType: this.getAuthenticationType(a)
2710                })
2711              ]) : (p = (s == null ? void 0 : s.acr.toLowerCase()) === _e.toLowerCase(), f = (s == null ? void 0 : s.acr.toLowerCase()) === Ce.toLowerCase(), [
2712                2,
2713                Promise.reject({
2714                  ok: false,
2715                  error: p ? Fn : xn,
2716                  state: o,
2717                  emailVerified: f ? s == null ? void 0 : s.email_verified : void 0
2718                })
2719              ]);
2720          }
2721        });
2722      });
2723    }, t.prototype.handleFragmentPkce = function(e, n) {
2724      var r;
2725      return _(this, void 0, void 0, function() {
2726        var o, i, s, l, c, d, a, p, f;
2727        return C(this, function(u) {
2728          switch (u.label) {
2729            case 0:
2730              return this.log("handleFragmentPkce"), this.validateState(e == null ? void 0 : e.state) ? (o = e[A.AUTHORIZATION_CODE]) ? (i = {
2731                nonce: "",
2732                state: "",
2733                scope: "",
2734                responseType: "",
2735                redirectUri: "",
2736                pkceRequestState: F.ACCESS_TOKEN
2737              }, s = this.getPkceChallengePair().code_verifier, l = {
2738                grant_type: "authorization_code",
2739                code_verifier: s,
2740                code: o,
2741                client_secret: (r = this.config) === null || r === void 0 ? void 0 : r.clientSecret
2742              }, c = this.getPkcePolicy(true), d = false, [
2743                4,
2744                this.getPkceAccessToken(c, i, l, e[A.STATE])
2745              ]) : [
2746                2,
2747                Promise.reject({
2748                  ok: false,
2749                  error: "" + Jn,
2750                  state: n
2751                })
2752              ] : (this.log("handleFragmentPkce :: invalid state"), [
2753                2,
2754                Promise.reject({
2755                  ok: false,
2756                  error: ct
2757                })
2758              ]);
2759            case 1:
2760              return (a = u.sent()) && a.error ? (d = true, this.log("handleFragmentPkce :: failed getting access token :: " + (a == null ? void 0 : a.error)), a.error.indexOf("AADB2C90088") === -1 ? [
2761                3,
2762                3
2763              ] : (p = this.getExpectedPolicyFromErrorMessage(a.error)) ? (this.log("handleFragmentPkce :: invalid_grant error due to expected policy resulting from flow change from " + c + " to " + p + ". Retrying request with correct policy"), [
2764                4,
2765                this.getPkceAccessToken(p, i, l, e[A.STATE])
2766              ]) : [
2767                3,
2768                3
2769              ]) : [
2770                3,
2771                3
2772              ];
2773            case 2:
2774              (a = u.sent()) != null && a.access_token && (d = false), u.label = 3;
2775            case 3:
2776              return d ? [
2777                2,
2778                Promise.reject(a)
2779              ] : (this.clearPkceChallengePair(), f = a, [
2780                2,
2781                this.validateAndSavePkceFlowTokens(f, e[A.STATE])
2782              ]);
2783          }
2784        });
2785      });
2786    }, t.prototype.getExpectedPolicyFromErrorMessage = function(e) {
2787      var n = null;
2788      this.log("getExpectedPolicyFromErrorMessage");
2789      var r = e == null ? void 0 : e.match("Expected Value : (.*?)\\r");
2790      return r && r.length > 1 && (n = r[1]), n;
2791    }, t.prototype.handlePopup = function(e, n) {
2792      return _(this, void 0, void 0, function() {
2793        var r, o, i;
2794        return C(this, function(s) {
2795          switch (s.label) {
2796            case 0:
2797              this.log("handlePopup"), r = (function(l) {
2798                var c = window.screenLeft ? window.screenLeft : window.screenX, d = window.screenTop ? window.screenTop : window.screenY, a = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) / 2 - 241.5 + c, p = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) / 2 - 300 + d, f = window.open(l, pt, "left=" + a + ", top=" + p + ", width=483, height=600, scrollbars=yes}");
2799                return f == null ? void 0 : f.focus(), f;
2800              })(e), s.label = 1;
2801            case 1:
2802              return s.trys.push([
2803                1,
2804                3,
2805                ,
2806                4
2807              ]), [
2808                4,
2809                this.waitForPopupToComplete(r)
2810              ];
2811            case 2:
2812              return o = s.sent(), [
2813                2,
2814                this.handleFragment(o)
2815              ];
2816            case 3:
2817              return i = s.sent(), this.clearCache(n), this.log("handlePopup :: popup handling failed :: " + i), [
2818                2,
2819                Promise.reject({
2820                  ok: false,
2821                  error: i
2822                })
2823              ];
2824            case 4:
2825              return [
2826                2
2827              ];
2828          }
2829        });
2830      });
2831    }, t.prototype.handleIframe = function(e, n) {
2832      return _(this, void 0, void 0, function() {
2833        var r, o, i;
2834        return C(this, function(s) {
2835          switch (s.label) {
2836            case 0:
2837              this.log("handleIframe"), r = (function(l) {
2838                var c = document.createElement("iframe");
2839                return c.src = l, c.style.display = "none", c.width = "1px", c.height = "1px", c.name = "" + ut + Math.floor(1e4 * Math.random()), document.body.insertAdjacentElement("beforeend", c), c;
2840              })(e), s.label = 1;
2841            case 1:
2842              return s.trys.push([
2843                1,
2844                3,
2845                ,
2846                4
2847              ]), [
2848                4,
2849                this.waitForIframeToComplete(r)
2850              ];
2851            case 2:
2852              return o = s.sent(), [
2853                2,
2854                this.handleFragment(o)
2855              ];
2856            case 3:
2857              return i = s.sent(), this.clearCache(n), this.log("handleIframe :: iframe handling failed :: " + i), [
2858                2,
2859                Promise.reject({
2860                  ok: false,
2861                  error: i
2862                })
2863              ];
2864            case 4:
2865              return [
2866                2
2867              ];
2868          }
2869        });
2870      });
2871    }, t.prototype.getCacheKey = function(e, n) {
2872      return n ? e + "|" + n : e;
2873    }, t.prototype.getStateId = function(e) {
2874      return U(e).split("|")[0];
2875    }, t.prototype.clearCache = function(e) {
2876      var n = this.getStateId(e), r = this.getCacheKey(b.STATE, n), o = this.getCacheKey(b.STATE_EXP, n), i = this.getCacheKey(b.NONCE, n);
2877      this.persistence.delete(r, true), this.persistence.delete(i, true), this.persistence.delete(r), this.persistence.delete(i), this.persistence.delete(o);
2878    }, t.prototype.checkCache = function() {
2879      var e = this;
2880      this.log("checkCache");
2881      for (var n = [], r = 0; r < this.persistence.size(); r += 1) {
2882        var o = this.persistence.key(r);
2883        if (o == null ? void 0 : o.startsWith(b.STATE_EXP)) {
2884          var i = o.split("|")[1], s = this.getCacheKey(b.STATE, i), l = this.persistence.get(s), c = this.persistence.get(o);
2885          try {
2886            var d = new Date(c).getTime();
2887            if (d > Date.now()) {
2888              n.push([
2889                d,
2890                l
2891              ]);
2892              continue;
2893            }
2894          } catch (e2) {
2895          }
2896          this.log("checkCache :: removing state and nonce for stateId " + i), l && this.clearCache(l);
2897        }
2898      }
2899      n.sort(function(a, p) {
2900        return a[0] - p[0];
2901      }
2901).forEach(function(a, p, f) {
2902        var u = a[1];
2903        p < f.length - 3 && e.clearCache(u);
2904      });
2905    }, t.prototype.buildUrl = function(e, n) {
2906      this.log("buildUrl");
2907      var r = Pe(e) ? ie[e] : e, o = n.nonce, i = n.state, s = n.scope, l = n.responseType, c = n.responseMode, d = n.redirectUri, a = n.isRenewal, p = n.withPrompt, f = p !== void 0 && p, u = n.mcmId, y = n.mcaId, v = n.cbcVisitorId, h = this.getBaseURL() + "/" + r + "/oauth2/v2.0/authorize", g = "?client_id=" + this.config.clientId, m = "&redirect_uri=" + encodeURIComponent(this.getCompleteCallback(d)), w = o ? "&nonce=" + o : "", E = "&scope=" + encodeURIComponent(s), S = "&response_type=" + encodeURIComponent(l), k = "&response_mode=" + encodeURIComponent(c), R = "&response_mode_value=" + encodeURIComponent(c), te = this.getPromptValue(a, f), H = i ? encodeURIComponent(i) : "";
2908      return "" + h + g + w + m + E + S + k + R + te + (i ? "&state=" + H : "") + (i ? "&state_value=" + H : "") + ("&ui_locales=" + this.config.locale) + this.getVisitorId(u, y) + (v ? "&cv=" + v : "");
2909    }, t.prototype.buildUrlPkce = function(e, n) {
2910      switch (this.log("buildUrlPkce"), n.pkceRequestState) {
2911        case F.ACCESS_TOKEN:
2912        case F.REFRESH_TOKEN:
2913          return this.getBaseURL() + "/" + (Pe(e) ? ie[e] : e) + "/oauth2/v2.0/token";
2914        case F.AUTHORIZATION_CODE:
2915        default:
2916          var r = this.getPkceChallengePair(), o = r.code_challenge, i = r.code_challenge_method;
2917          return this.setPkcePolicy(e), this.buildUrl(e, n) + "&code_challenge=" + o + "&code_challenge_method=" + i;
2918      }
2919    }, t.prototype.buildUrlIdpJwt = function(e, n) {
2920      this.log("buildUrlIdpJwt");
2921      var r = Pe(e) ? ie[e] : e, o = this.getBaseURL();
2922      switch (n.pkceRequestState) {
2923        case F.ACCESS_TOKEN:
2924        case F.REFRESH_TOKEN:
2925          return o + "/" + r + "/oauth2/v2.0/token";
2926        case F.AUTHORIZATION_CODE:
2927        default:
2928          return o + "/" + r + "/oauth2/v2.0/authorize";
2929      }
2930    }, t.prototype.getPromptValue = function(e, n) {
2931      return e ? "&prompt=none" : n ? "&prompt=login" : "";
2932    }, t.prototype.getVisitorId = function(e, n) {
2933      var r = "", o = Math.floor(Date.now() / 1e3);
2934      return e && !n ? r = "MCMID=" + e : e && n && (r = "MCMID=" + e + "|MCAID=" + n), r ? "&adobe_mc=" + encodeURIComponent(r + "|MCORGID=55E654E45894AF350A495CFE@AdobeOrg|TS=" + o) : "";
2935    }, t.prototype.getCompleteCallback = function(e) {
2936      var n = e;
2937      return e.startsWith("/") && !e.startsWith("//") && (n = "" + window.location.origin + e), new URL(n).toString();
2938    }, t.prototype.prepareAndStoreRequestValues = function(e, n) {
2939      this.log("prepareAndStoreRequestValues");
2940      var r = n != null ? n : Ve(), o = Ve(), i = 2628e5, s = new Date(Date.now() + i).toISOString(), l = K(e ? o + "|" + e : o), c = this.getCacheKey(b.STATE, o), d = this.getCacheKey(b.NONCE, o), a = this.getCacheKey(b.STATE_EXP, o);
2941      return this.persistence.set(c, l, false, i), this.persistence.set(d, r, false, i), this.persistence.set(a, s, false, i), this.checkCache(), {
2942        nonce: r,
2943        state: l
2944      };
2945    }, t.prototype.saveTokens = function(e, n) {
2946      this.log("saveTokens");
2947      var r, o = e[A.ID_TOKEN], i = e[A.ACCESS_TOKEN], s = e[A.EXPIRES_IN], l = 7776e6;
2948      if (o && n) {
2949        var c = this.getCacheKey(b.ID_TOKEN, this.config.clientId), d = 1e3 * n.exp, a = {
2950          token: o,
2951          expires: d,
2952          policy: n.acr
2953        };
2954        this.persistence.set(c, K(JSON.stringify(a)), false, l), this.log("saveTokens :: saved id token"), r = d;
2955      }
2956      if (i && s) {
2957        var p = this.getCacheKey(b.ACCESS_TOKEN, this.config.clientId), f = 1e3 * Number(s), u = Date.now() + f;
2958        a = {
2959          token: i,
2960          expires: u
2961        }, this.persistence.set(p, K(JSON.stringify(a)), false, l), this.log("saveTokens :: saved access token"), (!r || r > u) && (r = u);
2962      }
2963      this.broadcast(X.SAVE_SUCCESS), r && this.registerRefresh(r);
2964    }, t.prototype.saveTokensPkceFlow = function(e) {
2965      this.log("saveTokensPkceFlow");
2966      var n = e[A.ID_TOKEN], r = e[A.ACCESS_TOKEN], o = e[A.REFRESH_TOKEN], i = e[A.EXPIRES_IN], s = Date.now();
2967      if (n) {
2968        var l = this.getCacheKey(b.ID_TOKEN, this.config.clientId), c = JSON.parse(U(n.split(".")[1])).acr, d = (p = 1e3 * e.id_token_expires_in) + s, a = {
2969          token: n,
2970          expires: p + s,
2971          policy: c
2972        };
2973        this.persistence.set(l, K(JSON.stringify(a)), false, d), this.log("saveTokensPkceFlow :: saved id token");
2974      }
2975      if (o) {
2976        var p;
2977        l = this.getCacheKey(b.REFRESH_TOKEN, this.config.clientId), d = (p = 1e3 * e.refresh_token_expires_in) + s, a = {
2978          token: o,
2979          expires: p + s
2980        }, this.persistence.set(l, K(JSON.stringify(a)), false, d), this.log("saveTokensPkceFlow :: saved refresh token");
2981      }
2982      if (r && i) {
2983        var f = this.getCacheKey(b.ACCESS_TOKEN, this.config.clientId), u = 1e3 * Number(i);
2984        a = {
2985          token: r,
2986          expires: s + u
2987        }, this.persistence.set(f, K(JSON.stringify(a)), false, u), this.log("saveTokensPkceFlow :: saved access token");
2988      }
2989      this.broadcast(X.SAVE_SUCCESS);
2990      var y = Math.min(e.expires_in, e.id_token_expires_in, e.refresh_token_expires_in);
2991      y && this.registerRefresh(1e3 * y + s);
2992    }, t.prototype.registerRefresh = function(e) {
2993      var n = this;
2994      this.log("registerRefresh");
2995      var r = e - Date.now() - (this.config.msToRefresh || Ue);
2996      this.timeoutInstance || (this.timeoutInstance = vn.getInstance()), this.timeoutInstance.clearTimeout(), this.timeoutInstance.setTimeout(function() {
2997        return _(n, void 0, void 0, function() {
2998          var o, i;
2999          return C(this, function(s) {
3000            switch (s.label) {
3001              case 0:
3002                return s.trys.push([
3003                  0,
3004                  2,
3005                  ,
3006                  3
3007                ]), [
3008                  4,
3009                  this.refreshTokens()
3010                ];
3011              case 1:
3012                return s.sent(), [
3013                  3,
3014                  3
3015                ];
3016              case 2:
3017                return o = s.sent(), i = o, this.log("registerRefresh :: refresh failed " + (i.message ? ":: " + i.message : "")), this.broadcast(X.REFRESH_ERROR), [
3018                  3,
3019                  3
3020                ];
3021              case 3:
3022                return [
3023                  2
3024                ];
3025            }
3026          });
3027        });
3028      }, r);
3029    }, t.prototype.getB2CKeys = function() {
3030      return _(this, void 0, void 0, function() {
3031        var e, n, r;
3032        return C(this, function(o) {
3033          switch (o.label) {
3034            case 0:
3035              return this.log("getB2CKeys"), e = this.getB2CDiscoveryEndpoint(), [
3036                4,
3037                window.fetch(e).then(function(i) {
3038                  return i.json();
3039                }).then(function(i) {
3040                  return i.jwks_uri;
3041                })
3042              ];
3043            case 1:
3044              return n = o.sent(), [
3045                4,
3046                window.fetch(n).then(function(i) {
3047                  return i.json();
3048                }).then(function(i) {
3049                  return i.keys;
3050                })
3051              ];
3052            case 2:
3053              if (r = o.sent(), this.keys = vt(vt([], this.keys), r), !this.keys.length) throw this.log("getB2CKeys :: unable to retrieve B2C keys"), new Error("Unable to retrieve B2C keys.");
3054              return [
3055                2,
3056                r
3057              ];
3058          }
3059        });
3060      });
3061    }, t.prototype.validateJWTSignature = function(e, n, r) {
3062      return _(this, void 0, void 0, function() {
3063        var o, i, s, l, c, d, a, p, f;
3064        return C(this, function(u) {
3065          switch (u.label) {
3066            case 0:
3067              return this.log("validateJWTSignature"), (o = !!this.keys.length) && !r ? [
3068                3,
3069                2
3070              ] : [
3071                4,
3072                this.getB2CKeys()
3073              ];
3074            case 1:
3075              u.sent(), u.label = 2;
3076            case 2:
3077              i = this.config.clockTolerance || 60, s = JSON.parse(U(e.split(".")[0])).alg, d = 0, u.label = 3;
3078            case 3:
3079              return d < this.keys.length ? [
3080                4,
3081                Xt(this.keys[d], s)
3082              ] : [
3083                3,
3084                9
3085              ];
3086            case 4:
3087              a = u.sent(), u.label = 5;
3088            case 5:
3089              return u.trys.push([
3090                5,
3091                7,
3092                ,
3093                8
3094              ]), [
3095                4,
3096                tn(e, a)
3097              ];
3098            case 6:
3099              return l = u.sent(), [
3100                3,
3101                9
3102              ];
3103            case 7:
3104              return p = u.sent(), c = p.message, f = e.split(".")[1], c += " - Token payload : " + f, c += " - Date.Now() + ClockTolerance : " + n + " + " + i, [
3105                3,
3106                8
3107              ];
3108            case 8:
3109              return d += 1, [
3110                3,
3111                3
3112              ];
3113            case 9:
3114              if (!r && o) return [
3115                2,
3116                this.validateJWTSignature(e, n, true)
3117              ];
3118              if (!l) throw this.log("validateJWTSignature :: unable to validate token -> " + c), new Error("Unable to validate token -> " + c);
3119              return [
3120                2
3121              ];
3122          }
3123        });
3124      });
3125    }, t.prototype.validateJWTPayload = function(e, n, r) {
3126      return _(this, void 0, void 0, function() {
3127        var o, i, s, l, c, d, a, p, f, u;
3128        return C(this, function(y) {
3129          if (this.log("validateJWTPayload"), o = this.config.clockTolerance || 60, i = r + o, s = JSON.parse(U(e.split(".")[1])), l = s.aud, c = s.acr, d = s.exp, a = s.iat, p = s.iss, f = s.nbf, u = s.nonce, this.shouldValidateNonceAndState(c) && this.validateNonce(u, n), typeof s.iat != "number") throw this.log('validateJWTPayload :: "iat" is not a number'), new J('"iat" claim must be a number', "iat", "invalid");
3130          if (typeof s.nbf != "number") throw this.log('validateJWTPayload :: "nbf" is not a number'), new J('"nbf" claim must be a number', "nbf", "invalid");
3131          if (typeof s.exp != "number") throw this.log('validateJWTPayload :: "exp" is not a number'), new J('"exp" claim must be a number', "exp", "invalid");
3132          if (r - o >
3132= d) throw this.log("validateJWTPayload :: invalid exp"), new J('"exp" claim timestamp check failed', "exp", "check_failed");
3133          if (i < a) throw this.log("validateJWTPayload :: invalid iat"), new J('"iat" claim timestamp check failed', "iat", "check_failed");
3134          if (i < f) throw this.log("validateJWTPayload :: invalid nbf"), new J('"nbf" claim timestamp check failed', "nbf", "check_failed");
3135          if (l !== this.config.clientId) throw this.log("validateJWTPayload :: invalid aud"), new J('unexpected "aud" claim value', "aud", "check_failed");
3136          if (p !== Mn[this.callConfig.env] && p !== Wn[this.callConfig.env]) throw this.log("validateJWTPayload :: invalid iss"), new J('unexpected "iss" claim value', "iss", "check_failed");
3137          return [
3138            2,
3139            s
3140          ];
3141        });
3142      });
3143    }, t.prototype.validateJWT = function(e, n) {
3144      return _(this, void 0, void 0, function() {
3145        var r;
3146        return C(this, function(o) {
3147          switch (o.label) {
3148            case 0:
3149              return this.log("validateJWT"), r = Math.floor(Date.now() / 1e3), this.config.skipSignatureValidation ? [
3150                3,
3151                2
3152              ] : [
3153                4,
3154                this.validateJWTSignature(e, r)
3155              ];
3156            case 1:
3157              o.sent(), o.label = 2;
3158            case 2:
3159              return [
3160                2,
3161                this.validateJWTPayload(e, n, r)
3162              ];
3163          }
3164        });
3165      });
3166    }, t.prototype.validateNonce = function(e, n) {
3167      if (this.log("validateNonce"), !e) throw this.log("validateNonce :: missing nonce"), new J('Missing "nonce"', "nonce", "missing");
3168      var r = this.getStateId(n), o = this.getCacheKey(b.NONCE, r);
3169      if (this.persistence.get(o) !== e) throw this.log("validateNonce :: invalid nonce"), new J('unexpected "nonce" claim value', "nonce", "check_failed");
3170    }, t.prototype.validateState = function(e) {
3171      this.log("validateState");
3172      var n = this.getStateId(e), r = this.getCacheKey(b.STATE, n);
3173      if (this.persistence.get(r) !== e) throw this.log("validateState :: invalid state"), new J('unexpected "state" claim value', "state", "check_failed");
3174      return true;
3175    }, t.prototype.waitForIframeToComplete = function(e) {
3176      var n, r, o = this;
3177      this.log("waitForIframeToComplete");
3178      var i = e.contentWindow, s = ((r = (n = this.callConfig) === null || n === void 0 ? void 0 : n.frameTimeoutMs) !== null && r !== void 0 ? r : Te.frameTimeoutMs) / ne, l = 0, c = function(d, a) {
3179        if (document.hidden || (l += 1), l > s) return o.log("waitForIframeToComplete :: timeout"), gt(e), void a(In);
3180        var p;
3181        try {
3182          p = i == null ? void 0 : i.location.href;
3183        } catch (e2) {
3184        }
3185        if (p && ((i == null ? void 0 : i.location.hash) || (i == null ? void 0 : i.location.search))) return d(o.parseFragment(i)), void gt(e);
3186        setTimeout(function() {
3187          return c(d, a);
3188        }, ne);
3189      };
3190      return new Promise(function(d, a) {
3191        setTimeout(function() {
3192          return c(d, a);
3193        }, ne);
3194      });
3195    }, t.prototype.waitForPopupToComplete = function(e) {
3196      var n, r, o = this;
3197      this.log("waitForPopupToComplete");
3198      var i = ((r = (n = this.callConfig) === null || n === void 0 ? void 0 : n.frameTimeoutMs) !== null && r !== void 0 ? r : Te.frameTimeoutMs) / ne, s = 0;
3199      if (!e) return this.log("waitForPopupToComplete :: no popup"), Promise.reject(On);
3200      var l = function(c, d) {
3201        if (e == null ? void 0 : e.closed) return o.log("waitForPopupToComplete :: popup already closed"), void d(Dn);
3202        var a;
3203        try {
3204          a = e == null ? void 0 : e.location.href;
3205        } catch (e2) {
3206        }
3207        return document.hidden || (s += 1), a && (a.indexOf("?") !== -1 || (e == null ? void 0 : e.location.hash)) ? (c(o.parseFragment(e)), void e.close()) : s > i ? (o.log("waitForPopupToComplete :: timeout"), d(Nn), void e.close()) : (s += 1, void setTimeout(function() {
3208          return l(c, d);
3209        }, ne));
3210      };
3211      return new Promise(function(c, d) {
3212        setTimeout(function() {
3213          return l(c, d);
3214        }, ne);
3215      });
3216    }, t.prototype.shouldValidateNonceAndState = function(e) {
3217      var n = e.toLowerCase();
3218      return n !== Ce.toLowerCase() && n !== _e.toLowerCase() && n !== ie.idpJwtAuth.toLowerCase();
3219    }, t.prototype.checkInitiated = function() {
3220      if (this.log("checkInitiated"), !this.initiated) throw new Error(kn);
3221    }, t.prototype.log = function(e, n) {
3222      var r;
3223      n === void 0 && (n = false), (n || !((r = this.config) === null || r === void 0) && r.debug) && console.log("\u{1F527}
3223 RCAuthClient Debug: " + e);
3224    }, t;
3225  })();
3226  const { useCallback: ae } = await bt("react"), { useDispatch: Qn } = await bt("react-redux");
3227  var Xn = (_a = class {
3228    constructor(e, n = () => {
3229    }) {
3230      __publicField(this, "client");
3231      __publicField(this, "connectedListeners");
3232      __publicField(this, "config");
3233      __publicField(this, "isInitiated");
3234      if (_a._instance) throw new Error("LoginApi is already initialized");
3235      this.connectedListeners = [], this.isInitiated = false, this.dispatchEvents(), this.config = e, this.client = (e == null ? void 0 : e.persistenceOptions) ? new wt(new It(e.persistenceOptions)) : new wt(), this.client.on(X.SAVE_SUCCESS, () => {
3236        n(this.client.getAccessToken());
3237      }), this.client.on(X.REFRESH_ERROR, () => {
3238        console.error("LoginAPI could not refresh the token.");
3239      }), _a._instance = this;
3240    }
3241    dispatchEvents() {
3242      if (this.connectedListeners.length > 0) {
3243        const e = this.client.getAccessToken();
3244        if (e && e !== "") {
3245          const n = this.client.getUserInfo();
3246          this.connectedListeners.forEach((r) => {
3247            r.cb(n);
3248          });
3249        } else this.connectedListeners.forEach((n) => {
3250          n.cb({
3251            connected: false
3252          });
3253        });
3254      }
3255    }
3256    async refreshTokens() {
3257      try {
3258        return await this.client.refreshTokens();
3259      } catch (e) {
3260        console.log(e);
3261      }
3262    }
3263    async checkForTokens() {
3264      try {
3265        return await this.client.checkForTokens();
3266      } catch (e) {
3267        console.log(e);
3268      }
3269    }
3270    async initContext() {
3271      this.client && !this.isInitiated && (this.setIsInitiated(), this.client.init({
3272        clientId: this.config.clientId,
3273        debug: this.config.isDeveloppementContext,
3274        locale: "fr",
3275        useLegacyDomain: false,
3276        msToRefresh: 36e5
3277      }, {
3278        env: this.config.isDeveloppementContext ? de.INT : de.PROD,
3279        renewalCallback: this.config.redirectUri,
3280        scope: this.config.scopes.join(" "),
3281        responseType: "id_token token"
3282      }), await this.checkForTokens());
3283    }
3284    async actOnCallback() {
3285      try {
3286        const e = await this.client.handleRedirect();
3287        return this.dispatchEvents(), e;
3288      } catch (e) {
3289        return (e == null ? void 0 : e.state) ? e : (console.error(e), null);
3290      }
3291    }
3292    getClientRequest(e) {
3293      const n = this.getVisitorInstance();
3294      return {
3295        redirectUri: this.config.redirectUri,
3296        requestType: B.REDIRECT,
3297        state: typeof e == "string" ? this.getEncodedState({
3298          redirect: e
3299        }) : this.getEncodedState(e),
3300        mcaId: (n == null ? void 0 : n.getAnalyticsVisitorID()) || "",
3301        mcmId: (n == null ? void 0 : n.getMarketingCloudVisitorID()) || "",
3302        policy: "".toLowerCase() === "true" ? Ht : Jt
3303      };
3304    }
3305    signIn(e) {
3306      this.client.loginPkce(this.getClientRequest(e));
3307    }
3308    async silentLogin(e) {
3309      return await this.client.silentLogin(this.getClientRequest(e));
3310    }
3311    signUp(e) {
3312      this.client.createAccountPkce({
3313        ...this.getClientRequest(e),
3314        policy: qt
3315      });
3316    }
3317    signOut() {
3318      return this.client.logout({
3319        redirectUri: document.location.href
3320      });
3321    }
3322    deleteAccount() {
3323      console.warn("'deleteAccount' n'est pas impl\xE9ment\xE9 dans B2C");
3324    }
3325    subscribeConnectionState(e) {
3326      const n = Mt("userListener");
3327      if (e && typeof e == "function") return e(this.client.getUserInfo()), this.connectedListeners.push({
3328        id: n,
3329        cb: e
3330      }), n;
3331      throw new Error("Must have a valid callback to subscribe to the connection state, passed callback:".concat(e));
3332    }
3333    unSubscribeConnectionState(e) {
3334      const n = this.connectedListeners.findIndex((r) => r.id === e);
3335      n > -1 && this.connectedListeners.splice(n, 1);
3336    }
3337    getVisitorInstance() {
3338      return typeof Visitor < "u" && typeof (Visitor == null ? void 0 : Visitor.getInstance) == "function" ? Visitor.getInstance(jt) : void 0;
3339    }
3340    getIsInitiated() {
3341      return this.isInitiated;
3342    }
3343    setIsInitiated() {
3344      this.isInitiated = true, window.v5Lib.getCurrentStore().dispatch(Wt());
3345    }
3346    getAccessToken() {
3347      return this.client.getAccessToken();
3348    }
3349    getLRAccessToken() {
3350      return this.client.getLRAccessToken();
3351    }
3352    getIdToken() {
3353      return this.client.getIdToken();
3354    }
3355    async getUser(e) {
3356      let n = this.client.getAccessToken(), r = false;
3357      n || await this.silentLogin(e || void 0).then((s) => {
3358        if (!(s == null ? void 0 : s.ok)) return null;
3359        n = this.client.getAccessToken(), r = true;
3360      });
3361      const o = this.client.getLRAccessToken(), i = this.client.getUserInfo();
3362      return {
3363        rcId: (i == null ? void 0 : i.rcid) || null,
3364        firstName: (i == null ? void 0 : i.given_name) || "",
3365        lastName: (i == null ? void 0 : i.family_name) || "",
3366        name: (i == null ? void 0 : i.name) || "",
3367        isEmailVerified: !!(i == null ? void 0 : i.email_verified),
3368        email: (i == null ? void 0 : i.email) || "",
3369        identityProviderUserId: (i == null ? void 0 : i.idpUserId) || "",
3370        token: n,
3371        lrToken: o,
3372        connected: false,
3373        isSilentLogin: r
3374      };
3375    }
3376    getState(e) {
3377      const n = (e == null ? void 0 : e.authenticationType) || 1;
3378      return {
3379        ...e.state ? JSON.parse(decodeURIComponent(e.state)) : {
3380          redirect: "https://".concat(window.document.location.hostname, "/")
3381        },
3382        authenticationType: n
3383      };
3384    }
3385    getEncodedState(e) {
3386      return encodeURIComponent(JSON.stringify(e ? Vt({
3387        redirect: document.location.href.split("?")[0]
3388      }, e) : {
3389        redirect: document.location.href.split("?")[0]
3390      }));
3391    }
3392    sendConfirmationEmail() {
3393      this.client.sendConfirmationEmail({
3394        redirectUri: this.config.redirectUri
3395      }).then(() => ({})).catch(() => ({}));
3396    }
3397  }, __publicField(_a, "_instance"), _a);
3398  nr = async function(t) {
3399    if (window.v5Lib.loginApi) return;
3400    const e = new Xn(t.getState().login.config, (n) => {
3401      t.dispatch(Nt(n));
3402    });
3403    window.v5Lib.loginApi = e, await e.initContext();
3404  };
3405  rr = () => window.v5Lib.loginApi;
3406  or = () => {
3407    const t = Qn();
3408    return {
3409      signIn: ae((e) => {
3410        t(Lt({
3411          redirect: document.location.href,
3412          ...e
3413        }));
3414      }, [
3415        t
3416      ]),
3417      signUp: ae((e) => {
3418        t(Kt({
3419          redirect: document.location.href,
3420          ...e
3421        }));
3422      }, [
3423        t
3424      ]),
3425      signOut: ae(() => {
3426        t(Bt());
3427      }, [
3428        t
3429      ]),
3430      sendConfirmationEmail: ae(() => {
3431        t(xt());
3432      }, [
3433        t
3434      ]),
3435      refreshAccessToken: ae(() => {
3436        t(Ft());
3437      }, [
3438        t
3439      ])
3440    };
3441  };
3442});
3443export {
3444  __tla,
3445  rr as g,
3446  nr as i,
3447  or as u
3448};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.