@sesamy/sesamy-js 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- var wr = Object.defineProperty;
2
- var br = (t, e, n) => e in t ? wr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var B = (t, e, n) => (br(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- function nt(t, e) {
1
+ var _r = Object.defineProperty;
2
+ var Er = (t, e, n) => e in t ? _r(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var B = (t, e, n) => (Er(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ function rt(t, e) {
5
5
  const n = new CustomEvent(t, {
6
6
  detail: e,
7
7
  bubbles: !0,
@@ -21,13 +21,13 @@ function Q(t, e) {
21
21
  return n;
22
22
  }
23
23
  var ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
24
- function Ot(t) {
24
+ function jt(t) {
25
25
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
26
26
  }
27
- function Tt(t, e) {
27
+ function xt(t, e) {
28
28
  return t(e = { exports: {} }, e.exports), e.exports;
29
29
  }
30
- var ae = Tt(function(t, e) {
30
+ var se = xt(function(t, e) {
31
31
  Object.defineProperty(e, "__esModule", { value: !0 });
32
32
  var n = function() {
33
33
  function r() {
@@ -58,33 +58,33 @@ var ae = Tt(function(t, e) {
58
58
  return n.getInstance();
59
59
  };
60
60
  });
61
- Ot(ae);
62
- var kr = Ot(Tt(function(t, e) {
63
- var n = ce && ce.__awaiter || function(u, c, h, d) {
64
- return new (h || (h = Promise))(function(w, k) {
65
- function v(y) {
61
+ jt(se);
62
+ var Or = jt(xt(function(t, e) {
63
+ var n = ce && ce.__awaiter || function(u, c, f, d) {
64
+ return new (f || (f = Promise))(function(w, k) {
65
+ function v(g) {
66
66
  try {
67
- S(d.next(y));
67
+ S(d.next(g));
68
68
  } catch (l) {
69
69
  k(l);
70
70
  }
71
71
  }
72
- function _(y) {
72
+ function _(g) {
73
73
  try {
74
- S(d.throw(y));
74
+ S(d.throw(g));
75
75
  } catch (l) {
76
76
  k(l);
77
77
  }
78
78
  }
79
- function S(y) {
80
- y.done ? w(y.value) : new h(function(l) {
81
- l(y.value);
79
+ function S(g) {
80
+ g.done ? w(g.value) : new f(function(l) {
81
+ l(g.value);
82
82
  }).then(v, _);
83
83
  }
84
84
  S((d = d.apply(u, c || [])).next());
85
85
  });
86
86
  }, r = ce && ce.__generator || function(u, c) {
87
- var h, d, w, k, v = { label: 0, sent: function() {
87
+ var f, d, w, k, v = { label: 0, sent: function() {
88
88
  if (1 & w[0])
89
89
  throw w[1];
90
90
  return w[1];
@@ -93,13 +93,13 @@ var kr = Ot(Tt(function(t, e) {
93
93
  return this;
94
94
  }), k;
95
95
  function _(S) {
96
- return function(y) {
96
+ return function(g) {
97
97
  return function(l) {
98
- if (h)
98
+ if (f)
99
99
  throw new TypeError("Generator is already executing.");
100
100
  for (; v; )
101
101
  try {
102
- if (h = 1, d && (w = 2 & l[0] ? d.return : l[0] ? d.throw || ((w = d.return) && w.call(d), 0) : d.next) && !(w = w.call(d, l[1])).done)
102
+ if (f = 1, d && (w = 2 & l[0] ? d.return : l[0] ? d.throw || ((w = d.return) && w.call(d), 0) : d.next) && !(w = w.call(d, l[1])).done)
103
103
  return w;
104
104
  switch (d = 0, w && (l = [2 & l[0], w.value]), l[0]) {
105
105
  case 0:
@@ -138,12 +138,12 @@ var kr = Ot(Tt(function(t, e) {
138
138
  } catch (b) {
139
139
  l = [6, b], d = 0;
140
140
  } finally {
141
- h = w = 0;
141
+ f = w = 0;
142
142
  }
143
143
  if (5 & l[0])
144
144
  throw l[1];
145
145
  return { value: l[0] ? l[1] : void 0, done: !0 };
146
- }([S, y]);
146
+ }([S, g]);
147
147
  };
148
148
  }
149
149
  }, i = ce;
@@ -174,7 +174,7 @@ var kr = Ot(Tt(function(t, e) {
174
174
  });
175
175
  }, setItem: function(u, c) {
176
176
  return n(i, void 0, void 0, function() {
177
- return r(this, function(h) {
177
+ return r(this, function(f) {
178
178
  throw new Error("Unsupported");
179
179
  });
180
180
  });
@@ -194,22 +194,22 @@ var kr = Ot(Tt(function(t, e) {
194
194
  return setTimeout(c, u);
195
195
  });
196
196
  }
197
- function p(u) {
198
- for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", h = "", d = 0; d < u; d++)
199
- h += c[Math.floor(Math.random() * c.length)];
200
- return h;
197
+ function h(u) {
198
+ for (var c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", f = "", d = 0; d < u; d++)
199
+ f += c[Math.floor(Math.random() * c.length)];
200
+ return f;
201
201
  }
202
- var f = function() {
202
+ var p = function() {
203
203
  function u(c) {
204
- this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() + p(15), this.acquireLock = this.acquireLock.bind(this), this.releaseLock = this.releaseLock.bind(this), this.releaseLock__private__ = this.releaseLock__private__.bind(this), this.waitForSomethingToChange = this.waitForSomethingToChange.bind(this), this.refreshLockWhileAcquired = this.refreshLockWhileAcquired.bind(this), this.storageHandler = c, u.waiters === void 0 && (u.waiters = []);
204
+ this.acquiredIatSet = /* @__PURE__ */ new Set(), this.storageHandler = void 0, this.id = Date.now().toString() + h(15), this.acquireLock = this.acquireLock.bind(this), this.releaseLock = this.releaseLock.bind(this), this.releaseLock__private__ = this.releaseLock__private__.bind(this), this.waitForSomethingToChange = this.waitForSomethingToChange.bind(this), this.refreshLockWhileAcquired = this.refreshLockWhileAcquired.bind(this), this.storageHandler = c, u.waiters === void 0 && (u.waiters = []);
205
205
  }
206
- return u.prototype.acquireLock = function(c, h) {
207
- return h === void 0 && (h = 5e3), n(this, void 0, void 0, function() {
208
- var d, w, k, v, _, S, y;
206
+ return u.prototype.acquireLock = function(c, f) {
207
+ return f === void 0 && (f = 5e3), n(this, void 0, void 0, function() {
208
+ var d, w, k, v, _, S, g;
209
209
  return r(this, function(l) {
210
210
  switch (l.label) {
211
211
  case 0:
212
- d = Date.now() + p(4), w = Date.now() + h, k = o + "-" + c, v = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
212
+ d = Date.now() + h(4), w = Date.now() + f, k = o + "-" + c, v = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
213
213
  case 1:
214
214
  return Date.now() < w ? [4, s(30)] : [3, 8];
215
215
  case 2:
@@ -217,19 +217,19 @@ var kr = Ot(Tt(function(t, e) {
217
217
  case 3:
218
218
  return l.sent(), v.setItemSync(k, JSON.stringify({ id: this.id, iat: d, timeoutKey: _, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, s(30)];
219
219
  case 4:
220
- return l.sent(), (S = v.getItemSync(k)) !== null && (y = JSON.parse(S)).id === this.id && y.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(k, d), [2, !0]) : [3, 7];
220
+ return l.sent(), (S = v.getItemSync(k)) !== null && (g = JSON.parse(S)).id === this.id && g.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(k, d), [2, !0]) : [3, 7];
221
221
  case 5:
222
222
  return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(w)];
223
223
  case 6:
224
224
  l.sent(), l.label = 7;
225
225
  case 7:
226
- return d = Date.now() + p(4), [3, 1];
226
+ return d = Date.now() + h(4), [3, 1];
227
227
  case 8:
228
228
  return [2, !1];
229
229
  }
230
230
  });
231
231
  });
232
- }, u.prototype.refreshLockWhileAcquired = function(c, h) {
232
+ }, u.prototype.refreshLockWhileAcquired = function(c, f) {
233
233
  return n(this, void 0, void 0, function() {
234
234
  var d = this;
235
235
  return r(this, function(w) {
@@ -239,9 +239,9 @@ var kr = Ot(Tt(function(t, e) {
239
239
  return r(this, function(S) {
240
240
  switch (S.label) {
241
241
  case 0:
242
- return [4, ae.default().lock(h)];
242
+ return [4, se.default().lock(f)];
243
243
  case 1:
244
- return S.sent(), this.acquiredIatSet.has(h) ? (k = this.storageHandler === void 0 ? a : this.storageHandler, (v = k.getItemSync(c)) === null ? (ae.default().unlock(h), [2]) : ((_ = JSON.parse(v)).timeRefreshed = Date.now(), k.setItemSync(c, JSON.stringify(_)), ae.default().unlock(h), this.refreshLockWhileAcquired(c, h), [2])) : (ae.default().unlock(h), [2]);
244
+ return S.sent(), this.acquiredIatSet.has(f) ? (k = this.storageHandler === void 0 ? a : this.storageHandler, (v = k.getItemSync(c)) === null ? (se.default().unlock(f), [2]) : ((_ = JSON.parse(v)).timeRefreshed = Date.now(), k.setItemSync(c, JSON.stringify(_)), se.default().unlock(f), this.refreshLockWhileAcquired(c, f), [2])) : (se.default().unlock(f), [2]);
245
245
  }
246
246
  });
247
247
  });
@@ -250,31 +250,31 @@ var kr = Ot(Tt(function(t, e) {
250
250
  });
251
251
  }, u.prototype.waitForSomethingToChange = function(c) {
252
252
  return n(this, void 0, void 0, function() {
253
- return r(this, function(h) {
254
- switch (h.label) {
253
+ return r(this, function(f) {
254
+ switch (f.label) {
255
255
  case 0:
256
256
  return [4, new Promise(function(d) {
257
257
  var w = !1, k = Date.now(), v = !1;
258
258
  function _() {
259
259
  if (v || (window.removeEventListener("storage", _), u.removeFromWaiting(_), clearTimeout(S), v = !0), !w) {
260
260
  w = !0;
261
- var y = 50 - (Date.now() - k);
262
- y > 0 ? setTimeout(d, y) : d(null);
261
+ var g = 50 - (Date.now() - k);
262
+ g > 0 ? setTimeout(d, g) : d(null);
263
263
  }
264
264
  }
265
265
  window.addEventListener("storage", _), u.addToWaiting(_);
266
266
  var S = setTimeout(_, Math.max(0, c - Date.now()));
267
267
  })];
268
268
  case 1:
269
- return h.sent(), [2];
269
+ return f.sent(), [2];
270
270
  }
271
271
  });
272
272
  });
273
273
  }, u.addToWaiting = function(c) {
274
274
  this.removeFromWaiting(c), u.waiters !== void 0 && u.waiters.push(c);
275
275
  }, u.removeFromWaiting = function(c) {
276
- u.waiters !== void 0 && (u.waiters = u.waiters.filter(function(h) {
277
- return h !== c;
276
+ u.waiters !== void 0 && (u.waiters = u.waiters.filter(function(f) {
277
+ return f !== c;
278
278
  }));
279
279
  }, u.notifyWaiters = function() {
280
280
  u.waiters !== void 0 && u.waiters.slice().forEach(function(c) {
@@ -282,143 +282,143 @@ var kr = Ot(Tt(function(t, e) {
282
282
  });
283
283
  }, u.prototype.releaseLock = function(c) {
284
284
  return n(this, void 0, void 0, function() {
285
- return r(this, function(h) {
286
- switch (h.label) {
285
+ return r(this, function(f) {
286
+ switch (f.label) {
287
287
  case 0:
288
288
  return [4, this.releaseLock__private__(c)];
289
289
  case 1:
290
- return [2, h.sent()];
290
+ return [2, f.sent()];
291
291
  }
292
292
  });
293
293
  });
294
294
  }, u.prototype.releaseLock__private__ = function(c) {
295
295
  return n(this, void 0, void 0, function() {
296
- var h, d, w, k;
296
+ var f, d, w, k;
297
297
  return r(this, function(v) {
298
298
  switch (v.label) {
299
299
  case 0:
300
- return h = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (w = h.getItemSync(d)) === null ? [2] : (k = JSON.parse(w)).id !== this.id ? [3, 2] : [4, ae.default().lock(k.iat)];
300
+ return f = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (w = f.getItemSync(d)) === null ? [2] : (k = JSON.parse(w)).id !== this.id ? [3, 2] : [4, se.default().lock(k.iat)];
301
301
  case 1:
302
- v.sent(), this.acquiredIatSet.delete(k.iat), h.removeItemSync(d), ae.default().unlock(k.iat), u.notifyWaiters(), v.label = 2;
302
+ v.sent(), this.acquiredIatSet.delete(k.iat), f.removeItemSync(d), se.default().unlock(k.iat), u.notifyWaiters(), v.label = 2;
303
303
  case 2:
304
304
  return [2];
305
305
  }
306
306
  });
307
307
  });
308
308
  }, u.lockCorrector = function(c) {
309
- for (var h = Date.now() - 5e3, d = c, w = [], k = 0; ; ) {
309
+ for (var f = Date.now() - 5e3, d = c, w = [], k = 0; ; ) {
310
310
  var v = d.keySync(k);
311
311
  if (v === null)
312
312
  break;
313
313
  w.push(v), k++;
314
314
  }
315
315
  for (var _ = !1, S = 0; S < w.length; S++) {
316
- var y = w[S];
317
- if (y.includes(o)) {
318
- var l = d.getItemSync(y);
316
+ var g = w[S];
317
+ if (g.includes(o)) {
318
+ var l = d.getItemSync(g);
319
319
  if (l !== null) {
320
320
  var b = JSON.parse(l);
321
- (b.timeRefreshed === void 0 && b.timeAcquired < h || b.timeRefreshed !== void 0 && b.timeRefreshed < h) && (d.removeItemSync(y), _ = !0);
321
+ (b.timeRefreshed === void 0 && b.timeAcquired < f || b.timeRefreshed !== void 0 && b.timeRefreshed < f) && (d.removeItemSync(g), _ = !0);
322
322
  }
323
323
  }
324
324
  }
325
325
  _ && u.notifyWaiters();
326
326
  }, u.waiters = void 0, u;
327
327
  }();
328
- e.default = f;
328
+ e.default = p;
329
329
  }));
330
- const Ir = { timeoutInSeconds: 60 }, Tn = { name: "auth0-spa-js", version: "2.1.3" }, Pn = () => Date.now();
331
- let H = class wt extends Error {
330
+ const Tr = { timeoutInSeconds: 60 }, An = { name: "auth0-spa-js", version: "2.1.3" }, $n = () => Date.now();
331
+ let Y = class bt extends Error {
332
332
  constructor(e, n) {
333
- super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this, wt.prototype);
333
+ super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this, bt.prototype);
334
334
  }
335
335
  static fromPayload({ error: e, error_description: n }) {
336
- return new wt(e, n);
336
+ return new bt(e, n);
337
337
  }
338
- }, _r = class jn extends H {
338
+ }, Pr = class zn extends Y {
339
339
  constructor(e, n, r, i = null) {
340
- super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this, jn.prototype);
340
+ super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this, zn.prototype);
341
341
  }
342
- }, bt = class xn extends H {
342
+ }, kt = class Nn extends Y {
343
343
  constructor() {
344
- super("timeout", "Timeout"), Object.setPrototypeOf(this, xn.prototype);
344
+ super("timeout", "Timeout"), Object.setPrototypeOf(this, Nn.prototype);
345
345
  }
346
- }, Sr = class Cn extends bt {
346
+ }, jr = class Dn extends kt {
347
347
  constructor(e) {
348
- super(), this.popup = e, Object.setPrototypeOf(this, Cn.prototype);
348
+ super(), this.popup = e, Object.setPrototypeOf(this, Dn.prototype);
349
349
  }
350
- }, Er = class An extends H {
350
+ }, xr = class Un extends Y {
351
351
  constructor(e) {
352
- super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, An.prototype);
352
+ super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, Un.prototype);
353
353
  }
354
- }, Or = class $n extends H {
354
+ }, Cr = class Ln extends Y {
355
355
  constructor(e, n, r) {
356
- super(e, n), this.mfa_token = r, Object.setPrototypeOf(this, $n.prototype);
356
+ super(e, n), this.mfa_token = r, Object.setPrototypeOf(this, Ln.prototype);
357
357
  }
358
- }, zn = class Nn extends H {
358
+ }, Rn = class Mn extends Y {
359
359
  constructor(e, n) {
360
- super("missing_refresh_token", `Missing Refresh Token (audience: '${Zt(e, ["default"])}', scope: '${Zt(n)}')`), this.audience = e, this.scope = n, Object.setPrototypeOf(this, Nn.prototype);
360
+ super("missing_refresh_token", `Missing Refresh Token (audience: '${Kt(e, ["default"])}', scope: '${Kt(n)}')`), this.audience = e, this.scope = n, Object.setPrototypeOf(this, Mn.prototype);
361
361
  }
362
362
  };
363
- function Zt(t, e = []) {
363
+ function Kt(t, e = []) {
364
364
  return t && !e.includes(t) ? t : "";
365
365
  }
366
- const Ge = () => window.crypto, ut = () => {
366
+ const Be = () => window.crypto, lt = () => {
367
367
  const t = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
368
368
  let e = "";
369
- return Array.from(Ge().getRandomValues(new Uint8Array(43))).forEach((n) => e += t[n % t.length]), e;
370
- }, Wt = (t) => btoa(t), kt = (t) => {
369
+ return Array.from(Be().getRandomValues(new Uint8Array(43))).forEach((n) => e += t[n % t.length]), e;
370
+ }, Ft = (t) => btoa(t), It = (t) => {
371
371
  var { clientId: e } = t, n = Q(t, ["clientId"]);
372
372
  return new URLSearchParams(((r) => Object.keys(r).filter((i) => r[i] !== void 0).reduce((i, o) => Object.assign(Object.assign({}, i), { [o]: r[o] }), {}))(Object.assign({ client_id: e }, n))).toString();
373
- }, Mt = (t) => ((e) => decodeURIComponent(atob(e).split("").map((n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g, "/").replace(/-/g, "+")), Tr = async (t, e) => {
373
+ }, Jt = (t) => ((e) => decodeURIComponent(atob(e).split("").map((n) => "%" + ("00" + n.charCodeAt(0).toString(16)).slice(-2)).join("")))(t.replace(/_/g, "/").replace(/-/g, "+")), Ar = async (t, e) => {
374
374
  const n = await fetch(t, e);
375
375
  return { ok: n.ok, json: await n.json() };
376
- }, Pr = async (t, e, n) => {
376
+ }, $r = async (t, e, n) => {
377
377
  const r = new AbortController();
378
378
  let i;
379
- return e.signal = r.signal, Promise.race([Tr(t, e), new Promise((o, a) => {
379
+ return e.signal = r.signal, Promise.race([Ar(t, e), new Promise((o, a) => {
380
380
  i = setTimeout(() => {
381
381
  r.abort(), a(new Error("Timeout when executing 'fetch'"));
382
382
  }, n);
383
383
  })]).finally(() => {
384
384
  clearTimeout(i);
385
385
  });
386
- }, jr = async (t, e, n, r, i, o, a) => {
387
- return s = { auth: { audience: e, scope: n }, timeout: i, fetchUrl: t, fetchOptions: r, useFormData: a }, p = o, new Promise(function(f, u) {
386
+ }, zr = async (t, e, n, r, i, o, a) => {
387
+ return s = { auth: { audience: e, scope: n }, timeout: i, fetchUrl: t, fetchOptions: r, useFormData: a }, h = o, new Promise(function(p, u) {
388
388
  const c = new MessageChannel();
389
- c.port1.onmessage = function(h) {
390
- h.data.error ? u(new Error(h.data.error)) : f(h.data), c.port1.close();
391
- }, p.postMessage(s, [c.port2]);
389
+ c.port1.onmessage = function(f) {
390
+ f.data.error ? u(new Error(f.data.error)) : p(f.data), c.port1.close();
391
+ }, h.postMessage(s, [c.port2]);
392
392
  });
393
- var s, p;
394
- }, xr = async (t, e, n, r, i, o, a = 1e4) => i ? jr(t, e, n, r, a, i, o) : Pr(t, r, a);
395
- async function Cr(t, e) {
396
- var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t, p = Q(t, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
397
- const f = s ? kt(p) : JSON.stringify(p);
398
- return await async function(u, c, h, d, w, k, v) {
393
+ var s, h;
394
+ }, Nr = async (t, e, n, r, i, o, a = 1e4) => i ? zr(t, e, n, r, a, i, o) : $r(t, r, a);
395
+ async function Dr(t, e) {
396
+ var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t, h = Q(t, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
397
+ const p = s ? It(h) : JSON.stringify(h);
398
+ return await async function(u, c, f, d, w, k, v) {
399
399
  let _, S = null;
400
- for (let A = 0; A < 3; A++)
400
+ for (let $ = 0; $ < 3; $++)
401
401
  try {
402
- _ = await xr(u, h, d, w, k, v, c), S = null;
402
+ _ = await Nr(u, f, d, w, k, v, c), S = null;
403
403
  break;
404
- } catch (Z) {
405
- S = Z;
404
+ } catch (L) {
405
+ S = L;
406
406
  }
407
407
  if (S)
408
408
  throw S;
409
- const y = _.json, { error: l, error_description: b } = y, C = Q(y, ["error", "error_description"]), { ok: O } = _;
410
- if (!O) {
411
- const A = b || `HTTP error. Unable to fetch ${u}`;
412
- throw l === "mfa_required" ? new Or(l, A, C.mfa_token) : l === "missing_refresh_token" ? new zn(h, d) : new H(l || "request_error", A);
409
+ const g = _.json, { error: l, error_description: b } = g, T = Q(g, ["error", "error_description"]), { ok: j } = _;
410
+ if (!j) {
411
+ const $ = b || `HTTP error. Unable to fetch ${u}`;
412
+ throw l === "mfa_required" ? new Cr(l, $, T.mfa_token) : l === "missing_refresh_token" ? new Rn(f, d) : new Y(l || "request_error", $);
413
413
  }
414
- return C;
415
- }(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: f, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || Tn)) } }, e, s);
414
+ return T;
415
+ }(`${n}/oauth/token`, r, i || "default", o, { method: "POST", body: p, headers: { "Content-Type": s ? "application/x-www-form-urlencoded" : "application/json", "Auth0-Client": btoa(JSON.stringify(a || An)) } }, e, s);
416
416
  }
417
417
  const Ke = (...t) => {
418
418
  return (e = t.filter(Boolean).join(" ").trim().split(/\s+/), Array.from(new Set(e))).join(" ");
419
419
  var e;
420
420
  };
421
- let le = class It {
421
+ let le = class St {
422
422
  constructor(e, n = "@@auth0spajs@@", r) {
423
423
  this.prefix = n, this.suffix = r, this.clientId = e.clientId, this.scope = e.scope, this.audience = e.audience;
424
424
  }
@@ -427,13 +427,13 @@ let le = class It {
427
427
  }
428
428
  static fromKey(e) {
429
429
  const [n, r, i, o] = e.split("::");
430
- return new It({ clientId: r, scope: o, audience: i }, n);
430
+ return new St({ clientId: r, scope: o, audience: i }, n);
431
431
  }
432
432
  static fromCacheEntry(e) {
433
433
  const { scope: n, audience: r, client_id: i } = e;
434
- return new It({ scope: n, audience: r, clientId: i });
434
+ return new St({ scope: n, audience: r, clientId: i });
435
435
  }
436
- }, Ar = class {
436
+ }, Ur = class {
437
437
  set(e, n) {
438
438
  localStorage.setItem(e, JSON.stringify(n));
439
439
  }
@@ -452,7 +452,7 @@ let le = class It {
452
452
  allKeys() {
453
453
  return Object.keys(window.localStorage).filter((e) => e.startsWith("@@auth0spajs@@"));
454
454
  }
455
- }, Dn = class {
455
+ }, Zn = class {
456
456
  constructor() {
457
457
  this.enclosedCache = /* @__PURE__ */ function() {
458
458
  let e = {};
@@ -467,9 +467,9 @@ let le = class It {
467
467
  }, allKeys: () => Object.keys(e) };
468
468
  }();
469
469
  }
470
- }, $r = class {
470
+ }, Lr = class {
471
471
  constructor(e, n, r) {
472
- this.cache = e, this.keyManifest = n, this.nowProvider = r || Pn;
472
+ this.cache = e, this.keyManifest = n, this.nowProvider = r || $n;
473
473
  }
474
474
  async setIdToken(e, n, r) {
475
475
  var i;
@@ -492,8 +492,8 @@ let le = class It {
492
492
  const s = await this.getCacheKeys();
493
493
  if (!s)
494
494
  return;
495
- const p = this.matchExistingCacheKey(e, s);
496
- p && (i = await this.cache.get(p));
495
+ const h = this.matchExistingCacheKey(e, s);
496
+ h && (i = await this.cache.get(h));
497
497
  }
498
498
  if (!i)
499
499
  return;
@@ -526,11 +526,11 @@ let le = class It {
526
526
  matchExistingCacheKey(e, n) {
527
527
  return n.filter((r) => {
528
528
  var i;
529
- const o = le.fromKey(r), a = new Set(o.scope && o.scope.split(" ")), s = ((i = e.scope) === null || i === void 0 ? void 0 : i.split(" ")) || [], p = o.scope && s.reduce((f, u) => f && a.has(u), !0);
530
- return o.prefix === "@@auth0spajs@@" && o.clientId === e.clientId && o.audience === e.audience && p;
529
+ const o = le.fromKey(r), a = new Set(o.scope && o.scope.split(" ")), s = ((i = e.scope) === null || i === void 0 ? void 0 : i.split(" ")) || [], h = o.scope && s.reduce((p, u) => p && a.has(u), !0);
530
+ return o.prefix === "@@auth0spajs@@" && o.clientId === e.clientId && o.audience === e.audience && h;
531
531
  })[0];
532
532
  }
533
- }, zr = class {
533
+ }, Rr = class {
534
534
  constructor(e, n, r) {
535
535
  this.storage = e, this.clientId = n, this.cookieDomain = r, this.storageKey = `a0.spajs.txs.${this.clientId}`;
536
536
  }
@@ -544,17 +544,17 @@ let le = class It {
544
544
  this.storage.remove(this.storageKey, { cookieDomain: this.cookieDomain });
545
545
  }
546
546
  };
547
- const $e = (t) => typeof t == "number", Nr = ["iss", "aud", "exp", "nbf", "iat", "jti", "azp", "nonce", "auth_time", "at_hash", "c_hash", "acr", "amr", "sub_jwk", "cnf", "sip_from_tag", "sip_date", "sip_callid", "sip_cseq_num", "sip_via_branch", "orig", "dest", "mky", "events", "toe", "txn", "rph", "sid", "vot", "vtm"], Dr = (t) => {
547
+ const $e = (t) => typeof t == "number", Mr = ["iss", "aud", "exp", "nbf", "iat", "jti", "azp", "nonce", "auth_time", "at_hash", "c_hash", "acr", "amr", "sub_jwk", "cnf", "sip_from_tag", "sip_date", "sip_callid", "sip_cseq_num", "sip_via_branch", "orig", "dest", "mky", "events", "toe", "txn", "rph", "sid", "vot", "vtm"], Zr = (t) => {
548
548
  if (!t.id_token)
549
549
  throw new Error("ID token is required but missing");
550
550
  const e = ((o) => {
551
- const a = o.split("."), [s, p, f] = a;
552
- if (a.length !== 3 || !s || !p || !f)
551
+ const a = o.split("."), [s, h, p] = a;
552
+ if (a.length !== 3 || !s || !h || !p)
553
553
  throw new Error("ID token could not be decoded");
554
- const u = JSON.parse(Mt(p)), c = { __raw: o }, h = {};
554
+ const u = JSON.parse(Jt(h)), c = { __raw: o }, f = {};
555
555
  return Object.keys(u).forEach((d) => {
556
- c[d] = u[d], Nr.includes(d) || (h[d] = u[d]);
557
- }), { encoded: { header: s, payload: p, signature: f }, header: JSON.parse(Mt(s)), claims: c, user: h };
556
+ c[d] = u[d], Mr.includes(d) || (f[d] = u[d]);
557
+ }), { encoded: { header: s, payload: h, signature: p }, header: JSON.parse(Jt(s)), claims: c, user: f };
558
558
  })(t.id_token);
559
559
  if (!e.claims.iss)
560
560
  throw new Error("Issuer (iss) claim must be a string present in the ID token");
@@ -620,74 +620,74 @@ const $e = (t) => typeof t == "number", Nr = ["iss", "aud", "exp", "nbf", "iat",
620
620
  }
621
621
  return e;
622
622
  };
623
- var de = Tt(function(t, e) {
623
+ var de = xt(function(t, e) {
624
624
  var n = ce && ce.__assign || function() {
625
- return n = Object.assign || function(p) {
626
- for (var f, u = 1, c = arguments.length; u < c; u++)
627
- for (var h in f = arguments[u])
628
- Object.prototype.hasOwnProperty.call(f, h) && (p[h] = f[h]);
629
- return p;
625
+ return n = Object.assign || function(h) {
626
+ for (var p, u = 1, c = arguments.length; u < c; u++)
627
+ for (var f in p = arguments[u])
628
+ Object.prototype.hasOwnProperty.call(p, f) && (h[f] = p[f]);
629
+ return h;
630
630
  }, n.apply(this, arguments);
631
631
  };
632
- function r(p, f) {
633
- if (!f)
632
+ function r(h, p) {
633
+ if (!p)
634
634
  return "";
635
- var u = "; " + p;
636
- return f === !0 ? u : u + "=" + f;
635
+ var u = "; " + h;
636
+ return p === !0 ? u : u + "=" + p;
637
637
  }
638
- function i(p, f, u) {
639
- return encodeURIComponent(p).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/\(/g, "%28").replace(/\)/g, "%29") + "=" + encodeURIComponent(f).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent) + function(c) {
638
+ function i(h, p, u) {
639
+ return encodeURIComponent(h).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/\(/g, "%28").replace(/\)/g, "%29") + "=" + encodeURIComponent(p).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent) + function(c) {
640
640
  if (typeof c.expires == "number") {
641
- var h = /* @__PURE__ */ new Date();
642
- h.setMilliseconds(h.getMilliseconds() + 864e5 * c.expires), c.expires = h;
641
+ var f = /* @__PURE__ */ new Date();
642
+ f.setMilliseconds(f.getMilliseconds() + 864e5 * c.expires), c.expires = f;
643
643
  }
644
644
  return r("Expires", c.expires ? c.expires.toUTCString() : "") + r("Domain", c.domain) + r("Path", c.path) + r("Secure", c.secure) + r("SameSite", c.sameSite);
645
645
  }(u);
646
646
  }
647
- function o(p) {
648
- for (var f = {}, u = p ? p.split("; ") : [], c = /(%[\dA-F]{2})+/gi, h = 0; h < u.length; h++) {
649
- var d = u[h].split("="), w = d.slice(1).join("=");
647
+ function o(h) {
648
+ for (var p = {}, u = h ? h.split("; ") : [], c = /(%[\dA-F]{2})+/gi, f = 0; f < u.length; f++) {
649
+ var d = u[f].split("="), w = d.slice(1).join("=");
650
650
  w.charAt(0) === '"' && (w = w.slice(1, -1));
651
651
  try {
652
- f[d[0].replace(c, decodeURIComponent)] = w.replace(c, decodeURIComponent);
652
+ p[d[0].replace(c, decodeURIComponent)] = w.replace(c, decodeURIComponent);
653
653
  } catch {
654
654
  }
655
655
  }
656
- return f;
656
+ return p;
657
657
  }
658
658
  function a() {
659
659
  return o(document.cookie);
660
660
  }
661
- function s(p, f, u) {
662
- document.cookie = i(p, f, n({ path: "/" }, u));
661
+ function s(h, p, u) {
662
+ document.cookie = i(h, p, n({ path: "/" }, u));
663
663
  }
664
- e.__esModule = !0, e.encode = i, e.parse = o, e.getAll = a, e.get = function(p) {
665
- return a()[p];
666
- }, e.set = s, e.remove = function(p, f) {
667
- s(p, "", n(n({}, f), { expires: -1 }));
664
+ e.__esModule = !0, e.encode = i, e.parse = o, e.getAll = a, e.get = function(h) {
665
+ return a()[h];
666
+ }, e.set = s, e.remove = function(h, p) {
667
+ s(h, "", n(n({}, p), { expires: -1 }));
668
668
  };
669
669
  });
670
- Ot(de), de.encode, de.parse, de.getAll;
671
- var Ur = de.get, Un = de.set, Ln = de.remove;
670
+ jt(de), de.encode, de.parse, de.getAll;
671
+ var Wr = de.get, Wn = de.set, Kn = de.remove;
672
672
  const we = { get(t) {
673
- const e = Ur(t);
673
+ const e = Wr(t);
674
674
  if (e !== void 0)
675
675
  return JSON.parse(e);
676
676
  }, save(t, e, n) {
677
677
  let r = {};
678
- window.location.protocol === "https:" && (r = { secure: !0, sameSite: "none" }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), Un(t, JSON.stringify(e), r);
678
+ window.location.protocol === "https:" && (r = { secure: !0, sameSite: "none" }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), Wn(t, JSON.stringify(e), r);
679
679
  }, remove(t, e) {
680
680
  let n = {};
681
- e != null && e.cookieDomain && (n.domain = e.cookieDomain), Ln(t, n);
682
- } }, Lr = { get(t) {
681
+ e != null && e.cookieDomain && (n.domain = e.cookieDomain), Kn(t, n);
682
+ } }, Kr = { get(t) {
683
683
  return we.get(t) || we.get(`_legacy_${t}`);
684
684
  }, save(t, e, n) {
685
685
  let r = {};
686
- window.location.protocol === "https:" && (r = { secure: !0 }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), Un(`_legacy_${t}`, JSON.stringify(e), r), we.save(t, e, n);
686
+ window.location.protocol === "https:" && (r = { secure: !0 }), n != null && n.daysUntilExpire && (r.expires = n.daysUntilExpire), n != null && n.cookieDomain && (r.domain = n.cookieDomain), Wn(`_legacy_${t}`, JSON.stringify(e), r), we.save(t, e, n);
687
687
  }, remove(t, e) {
688
688
  let n = {};
689
- e != null && e.cookieDomain && (n.domain = e.cookieDomain), Ln(t, n), we.remove(t, e), we.remove(`_legacy_${t}`, e);
690
- } }, Rr = { get(t) {
689
+ e != null && e.cookieDomain && (n.domain = e.cookieDomain), Kn(t, n), we.remove(t, e), we.remove(`_legacy_${t}`, e);
690
+ } }, Fr = { get(t) {
691
691
  if (typeof sessionStorage > "u")
692
692
  return;
693
693
  const e = sessionStorage.getItem(t);
@@ -697,12 +697,12 @@ const we = { get(t) {
697
697
  }, remove(t) {
698
698
  sessionStorage.removeItem(t);
699
699
  } };
700
- function Zr(t, e, n) {
701
- var r = e === void 0 ? null : e, i = function(p, f) {
702
- var u = atob(p);
703
- if (f) {
704
- for (var c = new Uint8Array(u.length), h = 0, d = u.length; h < d; ++h)
705
- c[h] = u.charCodeAt(h);
700
+ function Jr(t, e, n) {
701
+ var r = e === void 0 ? null : e, i = function(h, p) {
702
+ var u = atob(h);
703
+ if (p) {
704
+ for (var c = new Uint8Array(u.length), f = 0, d = u.length; f < d; ++f)
705
+ c[f] = u.charCodeAt(f);
706
706
  return String.fromCharCode.apply(null, new Uint16Array(c.buffer));
707
707
  }
708
708
  return u;
@@ -710,11 +710,11 @@ function Zr(t, e, n) {
710
710
  `, 10) + 1, a = i.substring(o) + (r ? "//# sourceMappingURL=" + r : ""), s = new Blob([a], { type: "application/javascript" });
711
711
  return URL.createObjectURL(s);
712
712
  }
713
- var Kt, Jt, Xt, lt, Wr = (Kt = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=", Jt = null, Xt = !1, function(t) {
714
- return lt = lt || Zr(Kt, Jt, Xt), new Worker(lt, t);
713
+ var Ht, Xt, Vt, dt, Hr = (Ht = "Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=", Xt = null, Vt = !1, function(t) {
714
+ return dt = dt || Jr(Ht, Xt, Vt), new Worker(dt, t);
715
715
  });
716
- const dt = {};
717
- let Mr = class {
716
+ const ht = {};
717
+ let Xr = class {
718
718
  constructor(e, n) {
719
719
  this.cache = e, this.clientId = n, this.manifestKey = this.createManifestKeyFrom(this.clientId);
720
720
  }
@@ -740,85 +740,85 @@ let Mr = class {
740
740
  return `@@auth0spajs@@::${e}`;
741
741
  }
742
742
  };
743
- const Kr = { memory: () => new Dn().enclosedCache, localstorage: () => new Ar() }, Ft = (t) => Kr[t], Ht = (t) => {
743
+ const Vr = { memory: () => new Zn().enclosedCache, localstorage: () => new Ur() }, Yt = (t) => Vr[t], Gt = (t) => {
744
744
  const { openUrl: e, onRedirect: n } = t, r = Q(t, ["openUrl", "onRedirect"]);
745
745
  return Object.assign(Object.assign({}, r), { openUrl: e === !1 || e ? e : n });
746
- }, ht = new kr();
747
- let Jr = class {
746
+ }, ft = new Or();
747
+ let Yr = class {
748
748
  constructor(e) {
749
749
  let n, r;
750
- if (this.userCache = new Dn().enclosedCache, this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
751
- await ht.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
750
+ if (this.userCache = new Zn().enclosedCache, this.defaultOptions = { authorizationParams: { scope: "openid profile email" }, useRefreshTokensFallback: !1, useFormData: !0 }, this._releaseLockOnPageHide = async () => {
751
+ await ft.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
752
752
  }, this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), e), { authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), e.authorizationParams) }), typeof window < "u" && (() => {
753
- if (!Ge())
753
+ if (!Be())
754
754
  throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");
755
- if (Ge().subtle === void 0)
755
+ if (Be().subtle === void 0)
756
756
  throw new Error(`
757
757
  auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
758
758
  `);
759
759
  })(), e.cache && e.cacheLocation && console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."), e.cache)
760
760
  r = e.cache;
761
761
  else {
762
- if (n = e.cacheLocation || "memory", !Ft(n))
762
+ if (n = e.cacheLocation || "memory", !Yt(n))
763
763
  throw new Error(`Invalid cache location "${n}"`);
764
- r = Ft(n)();
764
+ r = Yt(n)();
765
765
  }
766
- this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? we : Lr, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((a) => `auth0.${a}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
767
- const i = e.useCookiesForTransactions ? this.cookieStorage : Rr;
766
+ this.httpTimeoutMs = e.httpTimeoutInSeconds ? 1e3 * e.httpTimeoutInSeconds : 1e4, this.cookieStorage = e.legacySameSiteCookie === !1 ? we : Kr, this.orgHintCookieName = `auth0.${this.options.clientId}.organization_hint`, this.isAuthenticatedCookieName = ((a) => `auth0.${a}.is.authenticated`)(this.options.clientId), this.sessionCheckExpiryDays = e.sessionCheckExpiryDays || 1;
767
+ const i = e.useCookiesForTransactions ? this.cookieStorage : Fr;
768
768
  var o;
769
- this.scope = Ke("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new zr(i, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || Pn, this.cacheManager = new $r(r, r.allKeys ? void 0 : new Mr(r, this.options.clientId), this.nowProvider), this.domainUrl = (o = this.options.domain, /^https?:\/\//.test(o) ? o : `https://${o}`), this.tokenIssuer = ((a, s) => a ? a.startsWith("https://") ? a : `https://${a}/` : `${s}/`)(this.options.issuer, this.domainUrl), typeof window < "u" && window.Worker && this.options.useRefreshTokens && n === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new Wr());
769
+ this.scope = Ke("openid", this.options.authorizationParams.scope, this.options.useRefreshTokens ? "offline_access" : ""), this.transactionManager = new Rr(i, this.options.clientId, this.options.cookieDomain), this.nowProvider = this.options.nowProvider || $n, this.cacheManager = new Lr(r, r.allKeys ? void 0 : new Xr(r, this.options.clientId), this.nowProvider), this.domainUrl = (o = this.options.domain, /^https?:\/\//.test(o) ? o : `https://${o}`), this.tokenIssuer = ((a, s) => a ? a.startsWith("https://") ? a : `https://${a}/` : `${s}/`)(this.options.issuer, this.domainUrl), typeof window < "u" && window.Worker && this.options.useRefreshTokens && n === "memory" && (this.options.workerUrl ? this.worker = new Worker(this.options.workerUrl) : this.worker = new Hr());
770
770
  }
771
771
  _url(e) {
772
- const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || Tn)));
772
+ const n = encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client || An)));
773
773
  return `${this.domainUrl}${e}&auth0Client=${n}`;
774
774
  }
775
775
  _authorizeUrl(e) {
776
- return this._url(`/authorize?${kt(e)}`);
776
+ return this._url(`/authorize?${It(e)}`);
777
777
  }
778
778
  async _verifyIdToken(e, n, r) {
779
779
  const i = await this.nowProvider();
780
- return Dr({ iss: this.tokenIssuer, aud: this.options.clientId, id_token: e, nonce: n, organization: r, leeway: this.options.leeway, max_age: (o = this.options.authorizationParams.max_age, typeof o != "string" ? o : parseInt(o, 10) || void 0), now: i });
780
+ return Zr({ iss: this.tokenIssuer, aud: this.options.clientId, id_token: e, nonce: n, organization: r, leeway: this.options.leeway, max_age: (o = this.options.authorizationParams.max_age, typeof o != "string" ? o : parseInt(o, 10) || void 0), now: i });
781
781
  var o;
782
782
  }
783
783
  _processOrgHint(e) {
784
784
  e ? this.cookieStorage.save(this.orgHintCookieName, e, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }) : this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain });
785
785
  }
786
786
  async _prepareAuthorizeUrl(e, n, r) {
787
- const i = Wt(ut()), o = Wt(ut()), a = ut(), s = ((u) => {
787
+ const i = Ft(lt()), o = Ft(lt()), a = lt(), s = ((u) => {
788
788
  const c = new Uint8Array(u);
789
- return ((h) => {
789
+ return ((f) => {
790
790
  const d = { "+": "-", "/": "_", "=": "" };
791
- return h.replace(/[+/=]/g, (w) => d[w]);
791
+ return f.replace(/[+/=]/g, (w) => d[w]);
792
792
  })(window.btoa(String.fromCharCode(...Array.from(c))));
793
- })(await (async (u) => await Ge().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), p = ((u, c, h, d, w, k, v, _) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), h), { scope: Ke(c, h.scope), response_type: "code", response_mode: _ || "query", state: d, nonce: w, redirect_uri: v || u.authorizationParams.redirect_uri, code_challenge: k, code_challenge_method: "S256" }))(this.options, this.scope, e, i, o, s, e.redirect_uri || this.options.authorizationParams.redirect_uri || r, n == null ? void 0 : n.response_mode), f = this._authorizeUrl(p);
794
- return { nonce: o, code_verifier: a, scope: p.scope, audience: p.audience || "default", redirect_uri: p.redirect_uri, state: i, url: f };
793
+ })(await (async (u) => await Be().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), h = ((u, c, f, d, w, k, v, _) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), f), { scope: Ke(c, f.scope), response_type: "code", response_mode: _ || "query", state: d, nonce: w, redirect_uri: v || u.authorizationParams.redirect_uri, code_challenge: k, code_challenge_method: "S256" }))(this.options, this.scope, e, i, o, s, e.redirect_uri || this.options.authorizationParams.redirect_uri || r, n == null ? void 0 : n.response_mode), p = this._authorizeUrl(h);
794
+ return { nonce: o, code_verifier: a, scope: h.scope, audience: h.audience || "default", redirect_uri: h.redirect_uri, state: i, url: p };
795
795
  }
796
796
  async loginWithPopup(e, n) {
797
797
  var r;
798
798
  if (e = e || {}, !(n = n || {}).popup && (n.popup = ((s) => {
799
- const p = window.screenX + (window.innerWidth - 400) / 2, f = window.screenY + (window.innerHeight - 600) / 2;
800
- return window.open(s, "auth0:authorize:popup", `left=${p},top=${f},width=400,height=600,resizable,scrollbars=yes,status=1`);
799
+ const h = window.screenX + (window.innerWidth - 400) / 2, p = window.screenY + (window.innerHeight - 600) / 2;
800
+ return window.open(s, "auth0:authorize:popup", `left=${h},top=${p},width=400,height=600,resizable,scrollbars=yes,status=1`);
801
801
  })(""), !n.popup))
802
802
  throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");
803
803
  const i = await this._prepareAuthorizeUrl(e.authorizationParams || {}, { response_mode: "web_message" }, window.location.origin);
804
804
  n.popup.location.href = i.url;
805
- const o = await ((s) => new Promise((p, f) => {
805
+ const o = await ((s) => new Promise((h, p) => {
806
806
  let u;
807
807
  const c = setInterval(() => {
808
- s.popup && s.popup.closed && (clearInterval(c), clearTimeout(h), window.removeEventListener("message", u, !1), f(new Er(s.popup)));
809
- }, 1e3), h = setTimeout(() => {
810
- clearInterval(c), f(new Sr(s.popup)), window.removeEventListener("message", u, !1);
808
+ s.popup && s.popup.closed && (clearInterval(c), clearTimeout(f), window.removeEventListener("message", u, !1), p(new xr(s.popup)));
809
+ }, 1e3), f = setTimeout(() => {
810
+ clearInterval(c), p(new jr(s.popup)), window.removeEventListener("message", u, !1);
811
811
  }, 1e3 * (s.timeoutInSeconds || 60));
812
812
  u = function(d) {
813
813
  if (d.data && d.data.type === "authorization_response") {
814
- if (clearTimeout(h), clearInterval(c), window.removeEventListener("message", u, !1), s.popup.close(), d.data.response.error)
815
- return f(H.fromPayload(d.data.response));
816
- p(d.data.response);
814
+ if (clearTimeout(f), clearInterval(c), window.removeEventListener("message", u, !1), s.popup.close(), d.data.response.error)
815
+ return p(Y.fromPayload(d.data.response));
816
+ h(d.data.response);
817
817
  }
818
818
  }, window.addEventListener("message", u);
819
819
  }))(Object.assign(Object.assign({}, n), { timeoutInSeconds: n.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
820
820
  if (i.state !== o.state)
821
- throw new H("state_mismatch", "Invalid state");
821
+ throw new Y("state_mismatch", "Invalid state");
822
822
  const a = ((r = e.authorizationParams) === null || r === void 0 ? void 0 : r.organization) || this.options.authorizationParams.organization;
823
823
  await this._requestToken({ audience: i.audience, scope: i.scope, code_verifier: i.code_verifier, grant_type: "authorization_code", code: o.code, redirect_uri: i.redirect_uri }, { nonceIn: i.nonce, organization: a });
824
824
  }
@@ -834,10 +834,10 @@ let Jr = class {
834
834
  }
835
835
  async loginWithRedirect(e = {}) {
836
836
  var n;
837
- const r = Ht(e), { openUrl: i, fragment: o, appState: a } = r, s = Q(r, ["openUrl", "fragment", "appState"]), p = ((n = s.authorizationParams) === null || n === void 0 ? void 0 : n.organization) || this.options.authorizationParams.organization, f = await this._prepareAuthorizeUrl(s.authorizationParams || {}), { url: u } = f, c = Q(f, ["url"]);
838
- this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a }), p && { organization: p }));
839
- const h = o ? `${u}#${o}` : u;
840
- i ? await i(h) : window.location.assign(h);
837
+ const r = Gt(e), { openUrl: i, fragment: o, appState: a } = r, s = Q(r, ["openUrl", "fragment", "appState"]), h = ((n = s.authorizationParams) === null || n === void 0 ? void 0 : n.organization) || this.options.authorizationParams.organization, p = await this._prepareAuthorizeUrl(s.authorizationParams || {}), { url: u } = p, c = Q(p, ["url"]);
838
+ this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, c), { appState: a }), h && { organization: h }));
839
+ const f = o ? `${u}#${o}` : u;
840
+ i ? await i(f) : window.location.assign(f);
841
841
  }
842
842
  async handleRedirectCallback(e = window.location.href) {
843
843
  const n = e.split("?").slice(1);
@@ -845,17 +845,17 @@ let Jr = class {
845
845
  throw new Error("There are no query params available for parsing.");
846
846
  const { state: r, code: i, error: o, error_description: a } = ((c) => {
847
847
  c.indexOf("#") > -1 && (c = c.substring(0, c.indexOf("#")));
848
- const h = new URLSearchParams(c);
849
- return { state: h.get("state"), code: h.get("code") || void 0, error: h.get("error") || void 0, error_description: h.get("error_description") || void 0 };
848
+ const f = new URLSearchParams(c);
849
+ return { state: f.get("state"), code: f.get("code") || void 0, error: f.get("error") || void 0, error_description: f.get("error_description") || void 0 };
850
850
  })(n.join("")), s = this.transactionManager.get();
851
851
  if (!s)
852
- throw new H("missing_transaction", "Invalid state");
852
+ throw new Y("missing_transaction", "Invalid state");
853
853
  if (this.transactionManager.remove(), o)
854
- throw new _r(o, a || o, r, s.appState);
854
+ throw new Pr(o, a || o, r, s.appState);
855
855
  if (!s.code_verifier || s.state && s.state !== r)
856
- throw new H("state_mismatch", "Invalid state");
857
- const p = s.organization, f = s.nonce, u = s.redirect_uri;
858
- return await this._requestToken(Object.assign({ audience: s.audience, scope: s.scope, code_verifier: s.code_verifier, grant_type: "authorization_code", code: i }, u ? { redirect_uri: u } : {}), { nonceIn: f, organization: p }), { appState: s.appState };
856
+ throw new Y("state_mismatch", "Invalid state");
857
+ const h = s.organization, p = s.nonce, u = s.redirect_uri;
858
+ return await this._requestToken(Object.assign({ audience: s.audience, scope: s.scope, code_verifier: s.code_verifier, grant_type: "authorization_code", code: i }, u ? { redirect_uri: u } : {}), { nonceIn: p, organization: h }), { appState: s.appState };
859
859
  }
860
860
  async checkSession(e) {
861
861
  if (!this.cookieStorage.get(this.isAuthenticatedCookieName)) {
@@ -871,10 +871,10 @@ let Jr = class {
871
871
  async getTokenSilently(e = {}) {
872
872
  var n;
873
873
  const r = Object.assign(Object.assign({ cacheMode: "on" }, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Ke(this.scope, (n = e.authorizationParams) === null || n === void 0 ? void 0 : n.scope) }) }), i = await ((o, a) => {
874
- let s = dt[a];
874
+ let s = ht[a];
875
875
  return s || (s = o().finally(() => {
876
- delete dt[a], s = null;
877
- }), dt[a] = s), s;
876
+ delete ht[a], s = null;
877
+ }), ht[a] = s), s;
878
878
  })(() => this._getTokenSilently(r), `${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`);
879
879
  return e.detailedResponse ? i : i == null ? void 0 : i.access_token;
880
880
  }
@@ -891,25 +891,25 @@ let Jr = class {
891
891
  if (await i())
892
892
  return !0;
893
893
  return !1;
894
- })(() => ht.acquireLock("auth0.lock.getTokenSilently", 5e3), 10))
895
- throw new bt();
894
+ })(() => ft.acquireLock("auth0.lock.getTokenSilently", 5e3), 10))
895
+ throw new kt();
896
896
  try {
897
897
  if (window.addEventListener("pagehide", this._releaseLockOnPageHide), n !== "off") {
898
- const f = await this._getEntryFromCache({ scope: r.authorizationParams.scope, audience: r.authorizationParams.audience || "default", clientId: this.options.clientId });
899
- if (f)
900
- return f;
898
+ const p = await this._getEntryFromCache({ scope: r.authorizationParams.scope, audience: r.authorizationParams.audience || "default", clientId: this.options.clientId });
899
+ if (p)
900
+ return p;
901
901
  }
902
- const i = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(r) : await this._getTokenFromIFrame(r), { id_token: o, access_token: a, oauthTokenScope: s, expires_in: p } = i;
903
- return Object.assign(Object.assign({ id_token: o, access_token: a }, s ? { scope: s } : null), { expires_in: p });
902
+ const i = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(r) : await this._getTokenFromIFrame(r), { id_token: o, access_token: a, oauthTokenScope: s, expires_in: h } = i;
903
+ return Object.assign(Object.assign({ id_token: o, access_token: a }, s ? { scope: s } : null), { expires_in: h });
904
904
  } finally {
905
- await ht.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
905
+ await ft.releaseLock("auth0.lock.getTokenSilently"), window.removeEventListener("pagehide", this._releaseLockOnPageHide);
906
906
  }
907
907
  }
908
908
  }
909
909
  async getTokenWithPopup(e = {}, n = {}) {
910
910
  var r;
911
911
  const i = Object.assign(Object.assign({}, e), { authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), e.authorizationParams), { scope: Ke(this.scope, (r = e.authorizationParams) === null || r === void 0 ? void 0 : r.scope) }) });
912
- return n = Object.assign(Object.assign({}, Ir), n), await this.loginWithPopup(i, n), (await this.cacheManager.get(new le({ scope: i.authorizationParams.scope, audience: i.authorizationParams.audience || "default", clientId: this.options.clientId }))).access_token;
912
+ return n = Object.assign(Object.assign({}, Tr), n), await this.loginWithPopup(i, n), (await this.cacheManager.get(new le({ scope: i.authorizationParams.scope, audience: i.authorizationParams.audience || "default", clientId: this.options.clientId }))).access_token;
913
913
  }
914
914
  async isAuthenticated() {
915
915
  return !!await this.getUser();
@@ -917,10 +917,10 @@ let Jr = class {
917
917
  _buildLogoutUrl(e) {
918
918
  e.clientId !== null ? e.clientId = e.clientId || this.options.clientId : delete e.clientId;
919
919
  const n = e.logoutParams || {}, { federated: r } = n, i = Q(n, ["federated"]), o = r ? "&federated" : "";
920
- return this._url(`/v2/logout?${kt(Object.assign({ clientId: e.clientId }, i))}`) + o;
920
+ return this._url(`/v2/logout?${It(Object.assign({ clientId: e.clientId }, i))}`) + o;
921
921
  }
922
922
  async logout(e = {}) {
923
- const n = Ht(e), { openUrl: r } = n, i = Q(n, ["openUrl"]);
923
+ const n = Gt(e), { openUrl: r } = n, i = Q(n, ["openUrl"]);
924
924
  e.clientId === null ? await this.cacheManager.clear() : await this.cacheManager.clear(e.clientId || this.options.clientId), this.cookieStorage.remove(this.orgHintCookieName, { cookieDomain: this.options.cookieDomain }), this.cookieStorage.remove(this.isAuthenticatedCookieName, { cookieDomain: this.options.cookieDomain }), this.userCache.remove("@@user@@");
925
925
  const o = this._buildLogoutUrl(i);
926
926
  r ? await r(o) : r !== !1 && window.location.assign(o);
@@ -928,31 +928,31 @@ let Jr = class {
928
928
  async _getTokenFromIFrame(e) {
929
929
  const n = Object.assign(Object.assign({}, e.authorizationParams), { prompt: "none" }), r = this.cookieStorage.get(this.orgHintCookieName);
930
930
  r && !n.organization && (n.organization = r);
931
- const { url: i, state: o, nonce: a, code_verifier: s, redirect_uri: p, scope: f, audience: u } = await this._prepareAuthorizeUrl(n, { response_mode: "web_message" }, window.location.origin);
931
+ const { url: i, state: o, nonce: a, code_verifier: s, redirect_uri: h, scope: p, audience: u } = await this._prepareAuthorizeUrl(n, { response_mode: "web_message" }, window.location.origin);
932
932
  try {
933
933
  if (window.crossOriginIsolated)
934
- throw new H("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
935
- const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, h = await ((w, k, v = 60) => new Promise((_, S) => {
936
- const y = window.document.createElement("iframe");
937
- y.setAttribute("width", "0"), y.setAttribute("height", "0"), y.style.display = "none";
934
+ throw new Y("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
935
+ const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, f = await ((w, k, v = 60) => new Promise((_, S) => {
936
+ const g = window.document.createElement("iframe");
937
+ g.setAttribute("width", "0"), g.setAttribute("height", "0"), g.style.display = "none";
938
938
  const l = () => {
939
- window.document.body.contains(y) && (window.document.body.removeChild(y), window.removeEventListener("message", b, !1));
939
+ window.document.body.contains(g) && (window.document.body.removeChild(g), window.removeEventListener("message", b, !1));
940
940
  };
941
941
  let b;
942
- const C = setTimeout(() => {
943
- S(new bt()), l();
942
+ const T = setTimeout(() => {
943
+ S(new kt()), l();
944
944
  }, 1e3 * v);
945
- b = function(O) {
946
- if (O.origin != k || !O.data || O.data.type !== "authorization_response")
945
+ b = function(j) {
946
+ if (j.origin != k || !j.data || j.data.type !== "authorization_response")
947
947
  return;
948
- const A = O.source;
949
- A && A.close(), O.data.response.error ? S(H.fromPayload(O.data.response)) : _(O.data.response), clearTimeout(C), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
950
- }, window.addEventListener("message", b, !1), window.document.body.appendChild(y), y.setAttribute("src", w);
948
+ const $ = j.source;
949
+ $ && $.close(), j.data.response.error ? S(Y.fromPayload(j.data.response)) : _(j.data.response), clearTimeout(T), window.removeEventListener("message", b, !1), setTimeout(l, 2e3);
950
+ }, window.addEventListener("message", b, !1), window.document.body.appendChild(g), g.setAttribute("src", w);
951
951
  }))(i, this.domainUrl, c);
952
- if (o !== h.state)
953
- throw new H("state_mismatch", "Invalid state");
954
- const d = await this._requestToken(Object.assign(Object.assign({}, e.authorizationParams), { code_verifier: s, code: h.code, grant_type: "authorization_code", redirect_uri: p, timeout: e.authorizationParams.timeout || this.httpTimeoutMs }), { nonceIn: a, organization: n.organization });
955
- return Object.assign(Object.assign({}, d), { scope: f, oauthTokenScope: d.scope, audience: u });
952
+ if (o !== f.state)
953
+ throw new Y("state_mismatch", "Invalid state");
954
+ const d = await this._requestToken(Object.assign(Object.assign({}, e.authorizationParams), { code_verifier: s, code: f.code, grant_type: "authorization_code", redirect_uri: h, timeout: e.authorizationParams.timeout || this.httpTimeoutMs }), { nonceIn: a, organization: n.organization });
955
+ return Object.assign(Object.assign({}, d), { scope: p, oauthTokenScope: d.scope, audience: u });
956
956
  } catch (c) {
957
957
  throw c.error === "login_required" && this.logout({ openUrl: !1 }), c;
958
958
  }
@@ -962,7 +962,7 @@ let Jr = class {
962
962
  if (!(n && n.refresh_token || this.worker)) {
963
963
  if (this.options.useRefreshTokensFallback)
964
964
  return await this._getTokenFromIFrame(e);
965
- throw new zn(e.authorizationParams.audience || "default", e.authorizationParams.scope);
965
+ throw new Rn(e.authorizationParams.audience || "default", e.authorizationParams.scope);
966
966
  }
967
967
  const r = e.authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || window.location.origin, i = typeof e.timeoutInSeconds == "number" ? 1e3 * e.timeoutInSeconds : null;
968
968
  try {
@@ -985,92 +985,92 @@ let Jr = class {
985
985
  async _getEntryFromCache({ scope: e, audience: n, clientId: r }) {
986
986
  const i = await this.cacheManager.get(new le({ scope: e, audience: n, clientId: r }), 60);
987
987
  if (i && i.access_token) {
988
- const { access_token: o, oauthTokenScope: a, expires_in: s } = i, p = await this._getIdTokenFromCache();
989
- return p && Object.assign(Object.assign({ id_token: p.id_token, access_token: o }, a ? { scope: a } : null), { expires_in: s });
988
+ const { access_token: o, oauthTokenScope: a, expires_in: s } = i, h = await this._getIdTokenFromCache();
989
+ return h && Object.assign(Object.assign({ id_token: h.id_token, access_token: o }, a ? { scope: a } : null), { expires_in: s });
990
990
  }
991
991
  }
992
992
  async _requestToken(e, n) {
993
- const { nonceIn: r, organization: i } = n || {}, o = await Cr(Object.assign({ baseUrl: this.domainUrl, client_id: this.options.clientId, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData, timeout: this.httpTimeoutMs }, e), this.worker), a = await this._verifyIdToken(o.id_token, r, i);
993
+ const { nonceIn: r, organization: i } = n || {}, o = await Dr(Object.assign({ baseUrl: this.domainUrl, client_id: this.options.clientId, auth0Client: this.options.auth0Client, useFormData: this.options.useFormData, timeout: this.httpTimeoutMs }, e), this.worker), a = await this._verifyIdToken(o.id_token, r, i);
994
994
  return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, o), { decodedToken: a, scope: e.scope, audience: e.audience || "default" }), o.scope ? { oauthTokenScope: o.scope } : null), { client_id: this.options.clientId })), this.cookieStorage.save(this.isAuthenticatedCookieName, !0, { daysUntilExpire: this.sessionCheckExpiryDays, cookieDomain: this.options.cookieDomain }), this._processOrgHint(i || a.claims.org_id), Object.assign(Object.assign({}, o), { decodedToken: a });
995
995
  }
996
996
  };
997
- async function Xr(t) {
998
- const e = new Jr(t);
997
+ async function Gr(t) {
998
+ const e = new Yr(t);
999
999
  return await e.checkSession(), e;
1000
1000
  }
1001
- const Rn = "sesamy.com", Fr = "https://logs.sesamy.com/events";
1001
+ const Fn = "sesamy.com", Br = "https://logs.sesamy.com/events";
1002
1002
  var pe = /* @__PURE__ */ ((t) => (t.READY = "sesamyJsReady", t.AUTHENTICATED = "sesamyJsAuthenticated", t.LOGOUT = "sesamyJsLogout", t.SOFT_PAYWALL = "sesamyJsSoftPaywall", t))(pe || {});
1003
- let V;
1004
- const Pt = "sesamyAccessToken", jt = "sesamyExpires";
1005
- function xt() {
1006
- const t = localStorage.getItem(jt);
1003
+ let G;
1004
+ const Ct = "sesamyAccessToken", At = "sesamyExpires";
1005
+ function $t() {
1006
+ const t = localStorage.getItem(At);
1007
1007
  if (!(!t || parseInt(t, 10) < (/* @__PURE__ */ new Date()).getTime()))
1008
- return localStorage.getItem(Pt);
1008
+ return localStorage.getItem(Ct);
1009
1009
  }
1010
- async function Hr(t) {
1011
- if (t.enabled !== !1 && (V = await Xr({
1012
- domain: t.endpoint || `token.${Rn}`,
1010
+ async function qr(t) {
1011
+ if (t.enabled !== !1 && (G = await Gr({
1012
+ domain: t.endpoint || `token.${Fn}`,
1013
1013
  clientId: t.clientId
1014
1014
  }), window.location.search.includes("code=")))
1015
1015
  try {
1016
- await V.handleRedirectCallback();
1017
- const e = await V.getUser();
1018
- nt(pe.AUTHENTICATED, e);
1016
+ await G.handleRedirectCallback();
1017
+ const e = await G.getUser();
1018
+ rt(pe.AUTHENTICATED, e);
1019
1019
  const n = new URL(location.href), r = n.searchParams;
1020
1020
  r.delete("code"), r.delete("state"), n.search = r.toString(), window.history.replaceState({}, document.title, n.toString());
1021
1021
  } catch {
1022
1022
  }
1023
1023
  }
1024
- async function Vr() {
1025
- if (xt())
1024
+ async function Qr() {
1025
+ if ($t())
1026
1026
  return !0;
1027
- if (!V)
1027
+ if (!G)
1028
1028
  throw new Error("Auth0 client not initialized");
1029
- return V.isAuthenticated();
1029
+ return G.isAuthenticated();
1030
1030
  }
1031
- async function Yr() {
1032
- if (xt())
1031
+ async function ei() {
1032
+ if ($t())
1033
1033
  return {
1034
1034
  sub: "local",
1035
1035
  name: "Local User"
1036
1036
  };
1037
- if (!V)
1037
+ if (!G)
1038
1038
  throw new Error("Auth0 client not initialized");
1039
- return V.getUser();
1039
+ return G.getUser();
1040
1040
  }
1041
- function Gr() {
1042
- if (!V)
1041
+ function ti() {
1042
+ if (!G)
1043
1043
  throw new Error("Auth0 client not initialized");
1044
- return V.loginWithRedirect({
1044
+ return G.loginWithRedirect({
1045
1045
  authorizationParams: {
1046
1046
  redirect_uri: window.location.href
1047
1047
  }
1048
1048
  });
1049
1049
  }
1050
- async function Br(t = !0) {
1051
- const e = xt();
1050
+ async function ni(t = !0) {
1051
+ const e = $t();
1052
1052
  if (e)
1053
1053
  return e;
1054
1054
  try {
1055
- if (!V)
1055
+ if (!G)
1056
1056
  throw new Error("Auth0 client not initialized");
1057
- return await V.getTokenSilently();
1057
+ return await G.getTokenSilently();
1058
1058
  } catch (n) {
1059
1059
  if (t)
1060
1060
  throw n;
1061
1061
  return null;
1062
1062
  }
1063
1063
  }
1064
- async function qr() {
1065
- if (localStorage.removeItem(Pt), localStorage.removeItem(jt), !V)
1064
+ async function ri() {
1065
+ if (localStorage.removeItem(Ct), localStorage.removeItem(At), !G)
1066
1066
  throw new Error("Auth0 client not initialized");
1067
- return nt(pe.LOGOUT, {}), V.logout({
1067
+ return rt(pe.LOGOUT, {}), G.logout({
1068
1068
  logoutParams: {
1069
1069
  returnTo: window.location.href
1070
1070
  }
1071
1071
  });
1072
1072
  }
1073
- function Qr(t) {
1073
+ function ii(t) {
1074
1074
  const e = t.split(".");
1075
1075
  if (e.length !== 3)
1076
1076
  throw new Error("Invalid JWT token format.");
@@ -1081,12 +1081,12 @@ function Qr(t) {
1081
1081
  );
1082
1082
  return JSON.parse(i);
1083
1083
  }
1084
- async function Zn(t, e) {
1085
- localStorage.setItem(Pt, t), localStorage.setItem(jt, JSON.stringify(e * 1e3 + (/* @__PURE__ */ new Date()).getTime()));
1086
- const n = Qr(t);
1087
- nt(pe.AUTHENTICATED, n);
1084
+ async function Jn(t, e) {
1085
+ localStorage.setItem(Ct, t), localStorage.setItem(At, JSON.stringify(e * 1e3 + (/* @__PURE__ */ new Date()).getTime()));
1086
+ const n = ii(t);
1087
+ rt(pe.AUTHENTICATED, n);
1088
1088
  }
1089
- const ei = (t, e) => e.skipDedupe || e.method !== "GET", ti = (t, e) => e.method + "@" + t, ni = (t) => t.clone(), Vt = ({ skip: t = ei, key: e = ti, resolver: n = ni } = {}) => {
1089
+ const oi = (t, e) => e.skipDedupe || e.method !== "GET", ai = (t, e) => e.method + "@" + t, si = (t) => t.clone(), Bt = ({ skip: t = oi, key: e = ai, resolver: n = si } = {}) => {
1090
1090
  const r = /* @__PURE__ */ new Map();
1091
1091
  return (i) => (o, a) => {
1092
1092
  if (t(o, a))
@@ -1095,50 +1095,50 @@ const ei = (t, e) => e.skipDedupe || e.method !== "GET", ti = (t, e) => e.method
1095
1095
  if (!r.has(s))
1096
1096
  r.set(s, []);
1097
1097
  else
1098
- return new Promise((p, f) => {
1099
- r.get(s).push([p, f]);
1098
+ return new Promise((h, p) => {
1099
+ r.get(s).push([h, p]);
1100
1100
  });
1101
1101
  try {
1102
- return i(o, a).then((p) => (r.get(s).forEach(([f]) => f(n(p))), r.delete(s), p)).catch((p) => {
1103
- throw r.get(s).forEach(([f, u]) => u(p)), r.delete(s), p;
1102
+ return i(o, a).then((h) => (r.get(s).forEach(([p]) => p(n(h))), r.delete(s), h)).catch((h) => {
1103
+ throw r.get(s).forEach(([p, u]) => u(h)), r.delete(s), h;
1104
1104
  });
1105
- } catch (p) {
1106
- return r.delete(s), Promise.reject(p);
1105
+ } catch (h) {
1106
+ return r.delete(s), Promise.reject(h);
1107
1107
  }
1108
1108
  };
1109
- }, ri = (t, e) => t * e, ii = (t) => t && t.ok, Yt = ({ delayTimer: t = 500, delayRamp: e = ri, maxAttempts: n = 10, until: r = ii, onRetry: i = null, retryOnNetworkError: o = !1, resolveWithLatestResponse: a = !1, skip: s } = {}) => (p) => (f, u) => {
1109
+ }, ci = (t, e) => t * e, ui = (t) => t && t.ok, qt = ({ delayTimer: t = 500, delayRamp: e = ci, maxAttempts: n = 10, until: r = ui, onRetry: i = null, retryOnNetworkError: o = !1, resolveWithLatestResponse: a = !1, skip: s } = {}) => (h) => (p, u) => {
1110
1110
  let c = 0;
1111
- if (s && s(f, u))
1112
- return p(f, u);
1113
- const h = (d, w) => Promise.resolve(r(d, w)).then((k) => k ? d && a ? d : w ? Promise.reject(w) : d : (c++, !n || c <= n ? new Promise((v) => {
1111
+ if (s && s(p, u))
1112
+ return h(p, u);
1113
+ const f = (d, w) => Promise.resolve(r(d, w)).then((k) => k ? d && a ? d : w ? Promise.reject(w) : d : (c++, !n || c <= n ? new Promise((v) => {
1114
1114
  const _ = e(t, c);
1115
1115
  setTimeout(() => {
1116
1116
  typeof i == "function" ? Promise.resolve(i({
1117
1117
  response: d,
1118
1118
  error: w,
1119
- url: f,
1119
+ url: p,
1120
1120
  options: u
1121
1121
  })).then((S = {}) => {
1122
- var y, l;
1123
- v(p((y = S && S.url) !== null && y !== void 0 ? y : f, (l = S && S.options) !== null && l !== void 0 ? l : u));
1124
- }) : v(p(f, u));
1122
+ var g, l;
1123
+ v(h((g = S && S.url) !== null && g !== void 0 ? g : p, (l = S && S.options) !== null && l !== void 0 ? l : u));
1124
+ }) : v(h(p, u));
1125
1125
  }, _);
1126
- }).then(h).catch((v) => {
1126
+ }).then(f).catch((v) => {
1127
1127
  if (!o)
1128
1128
  throw v;
1129
- return h(null, v);
1129
+ return f(null, v);
1130
1130
  }) : d && a ? d : Promise.reject(w || new Error("Number of attempts exceeded."))));
1131
- return p(f, u).then(h).catch((d) => {
1131
+ return h(p, u).then(f).catch((d) => {
1132
1132
  if (!o)
1133
1133
  throw d;
1134
- return h(null, d);
1134
+ return f(null, d);
1135
1135
  });
1136
- }, oi = "application/json", Wn = "Content-Type", ve = Symbol(), Mn = Symbol();
1137
- function Gt(t = {}) {
1136
+ }, li = "application/json", Hn = "Content-Type", ve = Symbol(), Xn = Symbol();
1137
+ function Qt(t = {}) {
1138
1138
  var e;
1139
- return (e = Object.entries(t).find(([n]) => n.toLowerCase() === Wn.toLowerCase())) === null || e === void 0 ? void 0 : e[1];
1139
+ return (e = Object.entries(t).find(([n]) => n.toLowerCase() === Hn.toLowerCase())) === null || e === void 0 ? void 0 : e[1];
1140
1140
  }
1141
- function Bt(t) {
1141
+ function en(t) {
1142
1142
  return /^application\/.*json.*/.test(t);
1143
1143
  }
1144
1144
  const he = function(t, e, n = !1) {
@@ -1167,53 +1167,53 @@ const he = function(t, e, n = !1) {
1167
1167
  return n && i ? new i(...r) : i;
1168
1168
  }
1169
1169
  };
1170
- function ai(t, e = !1) {
1170
+ function di(t, e = !1) {
1171
1171
  Ee.options = e ? t : he(Ee.options, t);
1172
1172
  }
1173
- function si(t, e = !1) {
1173
+ function hi(t, e = !1) {
1174
1174
  Ee.polyfills = e ? t : he(Ee.polyfills, t);
1175
1175
  }
1176
- function ci(t) {
1176
+ function fi(t) {
1177
1177
  Ee.errorType = t;
1178
1178
  }
1179
- const ui = (t) => (e) => t.reduceRight((n, r) => r(n), e) || e;
1180
- class Kn extends Error {
1179
+ const pi = (t) => (e) => t.reduceRight((n, r) => r(n), e) || e;
1180
+ class Vn extends Error {
1181
1181
  }
1182
- const li = (t) => {
1182
+ const mi = (t) => {
1183
1183
  const e = /* @__PURE__ */ Object.create(null);
1184
- t = t._addons.reduce((y, l) => l.beforeRequest && l.beforeRequest(y, t._options, e) || y, t);
1185
- const { _url: n, _options: r, _config: i, _catchers: o, _resolvers: a, _middlewares: s, _addons: p } = t, f = new Map(o), u = he(i.options, r);
1184
+ t = t._addons.reduce((g, l) => l.beforeRequest && l.beforeRequest(g, t._options, e) || g, t);
1185
+ const { _url: n, _options: r, _config: i, _catchers: o, _resolvers: a, _middlewares: s, _addons: h } = t, p = new Map(o), u = he(i.options, r);
1186
1186
  let c = n;
1187
- const h = ui(s)((y, l) => (c = y, i.polyfill("fetch")(y, l)))(n, u), d = new Error(), w = h.catch((y) => {
1188
- throw { [ve]: y };
1189
- }).then((y) => {
1190
- if (!y.ok) {
1191
- const l = new Kn();
1187
+ const f = pi(s)((g, l) => (c = g, i.polyfill("fetch")(g, l)))(n, u), d = new Error(), w = f.catch((g) => {
1188
+ throw { [ve]: g };
1189
+ }).then((g) => {
1190
+ if (!g.ok) {
1191
+ const l = new Vn();
1192
1192
  if (l.cause = d, l.stack = l.stack + `
1193
- CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1193
+ CAUSE: ` + d.stack, l.response = g, l.url = c, g.type === "opaque")
1194
1194
  throw l;
1195
- return y.text().then((b) => {
1196
- var C;
1197
- if (l.message = b, i.errorType === "json" || ((C = y.headers.get("Content-Type")) === null || C === void 0 ? void 0 : C.split(";")[0]) === "application/json")
1195
+ return g.text().then((b) => {
1196
+ var T;
1197
+ if (l.message = b, i.errorType === "json" || ((T = g.headers.get("Content-Type")) === null || T === void 0 ? void 0 : T.split(";")[0]) === "application/json")
1198
1198
  try {
1199
1199
  l.json = JSON.parse(b);
1200
1200
  } catch {
1201
1201
  }
1202
- throw l.text = b, l.status = y.status, l;
1202
+ throw l.text = b, l.status = g.status, l;
1203
1203
  });
1204
1204
  }
1205
- return y;
1206
- }), k = (y) => y.catch((l) => {
1207
- const b = l.hasOwnProperty(ve), C = b ? l[ve] : l, O = (C == null ? void 0 : C.status) && f.get(C.status) || f.get(C == null ? void 0 : C.name) || b && f.has(ve) && f.get(ve);
1208
- if (O)
1209
- return O(C, t);
1210
- const A = f.get(Mn);
1211
- if (A)
1212
- return A(C, t);
1213
- throw C;
1214
- }), v = (y) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ k(y ? w.then((b) => b && b[y]()).then((b) => l ? l(b) : b) : w.then((b) => l ? l(b) : b)), _ = {
1205
+ return g;
1206
+ }), k = (g) => g.catch((l) => {
1207
+ const b = l.hasOwnProperty(ve), T = b ? l[ve] : l, j = (T == null ? void 0 : T.status) && p.get(T.status) || p.get(T == null ? void 0 : T.name) || b && p.has(ve) && p.get(ve);
1208
+ if (j)
1209
+ return j(T, t);
1210
+ const $ = p.get(Xn);
1211
+ if ($)
1212
+ return $(T, t);
1213
+ throw T;
1214
+ }), v = (g) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ k(g ? w.then((b) => b && b[g]()).then((b) => l ? l(b) : b) : w.then((b) => l ? l(b) : b)), _ = {
1215
1215
  _wretchReq: t,
1216
- _fetchReq: h,
1216
+ _fetchReq: f,
1217
1217
  _sharedState: e,
1218
1218
  res: v(null),
1219
1219
  json: v("json"),
@@ -1221,36 +1221,36 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1221
1221
  formData: v("formData"),
1222
1222
  arrayBuffer: v("arrayBuffer"),
1223
1223
  text: v("text"),
1224
- error(y, l) {
1225
- return f.set(y, l), this;
1224
+ error(g, l) {
1225
+ return p.set(g, l), this;
1226
1226
  },
1227
- badRequest(y) {
1228
- return this.error(400, y);
1227
+ badRequest(g) {
1228
+ return this.error(400, g);
1229
1229
  },
1230
- unauthorized(y) {
1231
- return this.error(401, y);
1230
+ unauthorized(g) {
1231
+ return this.error(401, g);
1232
1232
  },
1233
- forbidden(y) {
1234
- return this.error(403, y);
1233
+ forbidden(g) {
1234
+ return this.error(403, g);
1235
1235
  },
1236
- notFound(y) {
1237
- return this.error(404, y);
1236
+ notFound(g) {
1237
+ return this.error(404, g);
1238
1238
  },
1239
- timeout(y) {
1240
- return this.error(408, y);
1239
+ timeout(g) {
1240
+ return this.error(408, g);
1241
1241
  },
1242
- internalError(y) {
1243
- return this.error(500, y);
1242
+ internalError(g) {
1243
+ return this.error(500, g);
1244
1244
  },
1245
- fetchError(y) {
1246
- return this.error(ve, y);
1245
+ fetchError(g) {
1246
+ return this.error(ve, g);
1247
1247
  }
1248
- }, S = p.reduce((y, l) => ({
1249
- ...y,
1250
- ...typeof l.resolver == "function" ? l.resolver(y) : l.resolver
1248
+ }, S = h.reduce((g, l) => ({
1249
+ ...g,
1250
+ ...typeof l.resolver == "function" ? l.resolver(g) : l.resolver
1251
1251
  }), _);
1252
- return a.reduce((y, l) => l(y, t), S);
1253
- }, di = {
1252
+ return a.reduce((g, l) => l(g, t), S);
1253
+ }, gi = {
1254
1254
  _url: "",
1255
1255
  _options: {},
1256
1256
  _config: Ee,
@@ -1300,7 +1300,7 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1300
1300
  return this.headers({ Accept: t });
1301
1301
  },
1302
1302
  content(t) {
1303
- return this.headers({ [Wn]: t });
1303
+ return this.headers({ [Hn]: t });
1304
1304
  },
1305
1305
  auth(t) {
1306
1306
  return this.headers({ Authorization: t });
@@ -1310,7 +1310,7 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1310
1310
  return n.set(t, e), { ...this, _catchers: n };
1311
1311
  },
1312
1312
  catcherFallback(t) {
1313
- return this.catcher(Mn, t);
1313
+ return this.catcher(Xn, t);
1314
1314
  },
1315
1315
  resolve(t, e = !1) {
1316
1316
  return { ...this, _resolvers: e ? [t] : [...this._resolvers, t] };
@@ -1329,8 +1329,8 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1329
1329
  },
1330
1330
  fetch(t = this._options.method, e = "", n = null) {
1331
1331
  let r = this.url(e).options({ method: t });
1332
- const i = Gt(r._options.headers), o = typeof n == "object" && (!r._options.headers || !i || Bt(i));
1333
- return r = n ? o ? r.json(n, i) : r.body(n) : r, li(r._deferred.reduce((a, s) => s(a, a._url, a._options), r));
1332
+ const i = Qt(r._options.headers), o = typeof n == "object" && (!r._options.headers || !i || en(i));
1333
+ return r = n ? o ? r.json(n, i) : r.body(n) : r, mi(r._deferred.reduce((a, s) => s(a, a._url, a._options), r));
1334
1334
  },
1335
1335
  get(t = "") {
1336
1336
  return this.fetch("GET", t);
@@ -1357,62 +1357,62 @@ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1357
1357
  return { ...this, _options: { ...this._options, body: t } };
1358
1358
  },
1359
1359
  json(t, e) {
1360
- const n = Gt(this._options.headers);
1361
- return this.content(e || Bt(n) && n || oi).body(JSON.stringify(t));
1360
+ const n = Qt(this._options.headers);
1361
+ return this.content(e || en(n) && n || li).body(JSON.stringify(t));
1362
1362
  }
1363
1363
  };
1364
- function oe(t = "", e = {}) {
1365
- return { ...di, _url: t, _options: e };
1366
- }
1367
- oe.default = oe;
1368
- oe.options = ai;
1369
- oe.errorType = ci;
1370
- oe.polyfills = si;
1371
- oe.WretchError = Kn;
1372
- function hi(t) {
1373
- const e = t.endpoint || `https://api2.${Rn}`, n = (I = !0) => (j) => async (N, W) => {
1364
+ function ae(t = "", e = {}) {
1365
+ return { ...gi, _url: t, _options: e };
1366
+ }
1367
+ ae.default = ae;
1368
+ ae.options = di;
1369
+ ae.errorType = fi;
1370
+ ae.polyfills = hi;
1371
+ ae.WretchError = Vn;
1372
+ function yi(t) {
1373
+ const e = t.endpoint || `https://api2.${Fn}`, n = (I = !0) => (x) => async (E, N) => {
1374
1374
  let R = null;
1375
- if (R = await Br(I), !R) {
1375
+ if (R = await ni(I), !R) {
1376
1376
  if (I)
1377
1377
  throw new Error("No access token available");
1378
- return j(N, W);
1378
+ return x(E, N);
1379
1379
  }
1380
- const x = {
1381
- ...W,
1380
+ const P = {
1381
+ ...N,
1382
1382
  headers: {
1383
- ...W.headers,
1383
+ ...N.headers,
1384
1384
  ...R ? { Authorization: `Bearer ${R}` } : {}
1385
1385
  }
1386
1386
  };
1387
- return j(N, x);
1388
- }, r = (I) => (j, N) => {
1389
- if (N.headers.Authorization)
1390
- return I(j, N);
1391
- const W = localStorage.getItem("__anon_id"), R = btoa(`${W}:`), x = {
1392
- ...N,
1387
+ return x(E, P);
1388
+ }, r = (I) => (x, E) => {
1389
+ if (E.headers.Authorization)
1390
+ return I(x, E);
1391
+ const N = localStorage.getItem("__anon_id"), R = btoa(`${N}:`), P = {
1392
+ ...E,
1393
1393
  headers: {
1394
- ...N.headers,
1394
+ ...E.headers,
1395
1395
  Authorization: `Basic ${R}`
1396
1396
  }
1397
1397
  };
1398
- return I(j, x);
1399
- }, i = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
1398
+ return I(x, P);
1399
+ }, i = ae(e).headers({ "Content-Type": "application/json" }).middlewares([
1400
1400
  n(),
1401
- Vt(),
1402
- Yt({
1401
+ Bt(),
1402
+ qt({
1403
1403
  delayTimer: 1e3,
1404
- delayRamp: (I, j) => I * j,
1404
+ delayRamp: (I, x) => I * x,
1405
1405
  maxAttempts: 3,
1406
1406
  until: (I) => !!(I && (I.ok || I.status >= 400 && I.status < 500)),
1407
1407
  retryOnNetworkError: !1
1408
1408
  })
1409
- ]), o = oe(e).headers({ "Content-Type": "application/json" }).middlewares([
1409
+ ]), o = ae(e).headers({ "Content-Type": "application/json" }).middlewares([
1410
1410
  n(!1),
1411
1411
  r,
1412
- Vt(),
1413
- Yt({
1412
+ Bt(),
1413
+ qt({
1414
1414
  delayTimer: 1e3,
1415
- delayRamp: (I, j) => I * j,
1415
+ delayRamp: (I, x) => I * x,
1416
1416
  maxAttempts: 3,
1417
1417
  until: (I) => !!(I && (I.ok || I.status >= 400 && I.status < 500)),
1418
1418
  retryOnNetworkError: !1
@@ -1422,28 +1422,28 @@ function hi(t) {
1422
1422
  return i.get("/entitlements").json();
1423
1423
  }
1424
1424
  async function s(I) {
1425
- const j = await i.get("/entitlements").json();
1426
- return j == null ? void 0 : j.find((N) => N.id === I);
1425
+ const x = await i.get("/entitlements").json();
1426
+ return x == null ? void 0 : x.find((E) => E.id === I);
1427
1427
  }
1428
- async function p(I) {
1428
+ async function h(I) {
1429
1429
  return i.get(`/entitlements/${I}/access`).json();
1430
1430
  }
1431
- async function f() {
1431
+ async function p() {
1432
1432
  return i.get("/contracts").json();
1433
1433
  }
1434
1434
  async function u(I) {
1435
- const j = await i.get("/contracts").json();
1436
- return j == null ? void 0 : j.find((N) => N.id === I);
1435
+ const x = await i.get("/contracts").json();
1436
+ return x == null ? void 0 : x.find((E) => E.id === I);
1437
1437
  }
1438
1438
  async function c() {
1439
1439
  return i.get("/bills").json();
1440
1440
  }
1441
- async function h(I) {
1442
- const j = await i.get("/bills").json();
1443
- return j == null ? void 0 : j.find((N) => N.id === I);
1441
+ async function f(I) {
1442
+ const x = await i.get("/bills").json();
1443
+ return x == null ? void 0 : x.find((E) => E.id === I);
1444
1444
  }
1445
- async function d(I, j) {
1446
- return await i.url(`/user-metadata/${I}`).put(j).json();
1445
+ async function d(I, x) {
1446
+ return await i.url(`/user-metadata/${I}`).put(x).json();
1447
1447
  }
1448
1448
  async function w(I) {
1449
1449
  return (await i.url(`/user-metadata/${I}`).delete().res()).ok;
@@ -1460,7 +1460,7 @@ function hi(t) {
1460
1460
  async function S(I) {
1461
1461
  return (await i.url(`/tags/${I}`).delete().res()).ok;
1462
1462
  }
1463
- async function y(I) {
1463
+ async function g(I) {
1464
1464
  return (await i.url("/tags").post(I).res()).ok;
1465
1465
  }
1466
1466
  async function l(I) {
@@ -1469,232 +1469,161 @@ function hi(t) {
1469
1469
  async function b() {
1470
1470
  return await o.url("/tallies").get().json();
1471
1471
  }
1472
- async function C(I) {
1472
+ async function T(I) {
1473
1473
  return (await o.url(`/tallies/${I}`).delete().res()).ok;
1474
1474
  }
1475
- async function O(I, j) {
1476
- return await o.url(`/tallies/${I}/push`).post(j).json();
1475
+ async function j(I, x) {
1476
+ return await o.url(`/tallies/${I}/push`).post(x).json();
1477
1477
  }
1478
- async function A(I) {
1478
+ async function $(I) {
1479
1479
  return await i.url(`/products/${I}`).get().json();
1480
1480
  }
1481
- async function Z(I) {
1482
- return await i.url(`/products/${I}/auto-onboard`).post().json();
1481
+ async function L(I) {
1482
+ return i.url(`/products/${I}/auto-onboard`).post().json();
1483
1483
  }
1484
1484
  return {
1485
1485
  getEntitlements: a,
1486
1486
  getEntitlement: s,
1487
- getEntitlementAccess: p,
1488
- getContracts: f,
1487
+ getEntitlementAccess: h,
1488
+ getContracts: p,
1489
1489
  getContract: u,
1490
1490
  getBills: c,
1491
- getBill: h,
1491
+ getBill: f,
1492
1492
  setUserMetadata: d,
1493
1493
  deleteUserMetadata: w,
1494
1494
  getUserMetadata: k,
1495
1495
  listUserMetadata: v,
1496
1496
  getTags: _,
1497
1497
  deleteTag: S,
1498
- setTag: y,
1498
+ setTag: g,
1499
1499
  getTally: l,
1500
1500
  getTallies: b,
1501
- deleteTally: C,
1502
- pushTally: O,
1503
- getProduct: A,
1504
- autoOnboardProduct: Z
1505
- };
1506
- }
1507
- const Jn = "@sesamy/sesamy-js", Ct = "1.3.2";
1508
- function fi(t) {
1509
- const {
1510
- getEntitlement: e,
1511
- getEntitlements: n,
1512
- getEntitlementAccess: r,
1513
- getContract: i,
1514
- getContracts: o,
1515
- getBill: a,
1516
- getBills: s,
1517
- getTags: p,
1518
- deleteTag: f,
1519
- setTag: u,
1520
- getUserMetadata: c,
1521
- listUserMetadata: h,
1522
- setUserMetadata: d,
1523
- deleteUserMetadata: w,
1524
- getTally: k,
1525
- getTallies: v,
1526
- pushTally: _,
1527
- deleteTally: S,
1528
- getProduct: y,
1529
- autoOnboardProduct: l
1530
- } = hi(t), b = {
1531
- auth: {
1532
- getUser: Yr,
1533
- isAuthenticated: Vr,
1534
- loginWithRedirect: Gr,
1535
- logout: qr,
1536
- setToken: Zn
1537
- },
1538
- tags: {
1539
- list: p,
1540
- set: u,
1541
- delete: f
1542
- },
1543
- entitlements: {
1544
- get: e,
1545
- list: n,
1546
- access: r
1547
- },
1548
- contracts: {
1549
- get: i,
1550
- list: o
1551
- },
1552
- bills: {
1553
- get: a,
1554
- list: s
1555
- },
1556
- userMetadata: {
1557
- get: c,
1558
- list: h,
1559
- set: d,
1560
- delete: w
1561
- },
1562
- tallies: {
1563
- get: k,
1564
- list: v,
1565
- push: _,
1566
- delete: S
1567
- },
1568
- products: {
1569
- get: y,
1570
- autoOnboard: l
1571
- },
1572
- getVersion: pi
1501
+ deleteTally: T,
1502
+ pushTally: j,
1503
+ getProduct: $,
1504
+ autoOnboardProduct: L
1573
1505
  };
1574
- return t.namespace && (window[t.namespace] = b), b;
1575
- }
1576
- function pi() {
1577
- return Ct;
1578
1506
  }
1579
- function qt(t, e, n, r, i) {
1507
+ const Yn = "@sesamy/sesamy-js", zt = "1.3.2";
1508
+ function tn(t, e, n, r, i) {
1580
1509
  for (e = e.split ? e.split(".") : e, r = 0; r < e.length; r++)
1581
1510
  t = t ? t[e[r]] : i;
1582
1511
  return t === i ? n : t;
1583
1512
  }
1584
- var Je = "undefined", Qt = "object", mi = function() {
1585
- }, Xn = "any", Fn = "*", me = "__", qe = typeof process < "u" ? process : {};
1586
- qe.env && qe.env.NODE_ENV;
1587
- var Y = typeof document < "u";
1588
- qe.versions != null && qe.versions.node != null;
1513
+ var Fe = "undefined", nn = "object", _t = function() {
1514
+ }, Gn = "any", Bn = "*", me = "__", Qe = typeof process < "u" ? process : {};
1515
+ Qe.env && Qe.env.NODE_ENV;
1516
+ var J = typeof document < "u";
1517
+ Qe.versions != null && Qe.versions.node != null;
1589
1518
  typeof Deno < "u" && Deno.core;
1590
- Y && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
1591
- function Hn(t, e) {
1519
+ J && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
1520
+ function qn(t, e) {
1592
1521
  return e.charAt(0)[t]() + e.slice(1);
1593
1522
  }
1594
- var gi = Hn.bind(null, "toUpperCase"), yi = Hn.bind(null, "toLowerCase");
1595
- function vi(t) {
1596
- return Vn(t) ? gi("null") : typeof t == "object" ? Ii(t) : Object.prototype.toString.call(t).slice(8, -1);
1523
+ var vi = qn.bind(null, "toUpperCase"), wi = qn.bind(null, "toLowerCase");
1524
+ function bi(t) {
1525
+ return Qn(t) ? vi("null") : typeof t == "object" ? _i(t) : Object.prototype.toString.call(t).slice(8, -1);
1597
1526
  }
1598
- function Qe(t, e) {
1527
+ function et(t, e) {
1599
1528
  e === void 0 && (e = !0);
1600
- var n = vi(t);
1601
- return e ? yi(n) : n;
1529
+ var n = bi(t);
1530
+ return e ? wi(n) : n;
1602
1531
  }
1603
- function We(t, e) {
1532
+ function Ze(t, e) {
1604
1533
  return typeof e === t;
1605
1534
  }
1606
- var G = We.bind(null, "function"), re = We.bind(null, "string"), be = We.bind(null, "undefined"), wi = We.bind(null, "boolean");
1607
- We.bind(null, "symbol");
1608
- function Vn(t) {
1535
+ var V = Ze.bind(null, "function"), ie = Ze.bind(null, "string"), be = Ze.bind(null, "undefined"), ki = Ze.bind(null, "boolean");
1536
+ Ze.bind(null, "symbol");
1537
+ function Qn(t) {
1609
1538
  return t === null;
1610
1539
  }
1611
- function bi(t) {
1612
- return Qe(t) === "number" && !isNaN(t);
1540
+ function Ii(t) {
1541
+ return et(t) === "number" && !isNaN(t);
1613
1542
  }
1614
- function Yn(t) {
1615
- return Qe(t) === "array";
1543
+ function er(t) {
1544
+ return et(t) === "array";
1616
1545
  }
1617
- function F(t) {
1618
- if (!ki(t))
1546
+ function X(t) {
1547
+ if (!Si(t))
1619
1548
  return !1;
1620
1549
  for (var e = t; Object.getPrototypeOf(e) !== null; )
1621
1550
  e = Object.getPrototypeOf(e);
1622
1551
  return Object.getPrototypeOf(t) === e;
1623
1552
  }
1624
- function ki(t) {
1553
+ function Si(t) {
1625
1554
  return t && (typeof t == "object" || t !== null);
1626
1555
  }
1627
- function Ii(t) {
1628
- return G(t.constructor) ? t.constructor.name : null;
1629
- }
1630
1556
  function _i(t) {
1631
- return t instanceof Error || re(t.message) && t.constructor && bi(t.constructor.stackTraceLimit);
1557
+ return V(t.constructor) ? t.constructor.name : null;
1632
1558
  }
1633
- function Gn(t, e) {
1634
- if (typeof e != "object" || Vn(e))
1559
+ function Ei(t) {
1560
+ return t instanceof Error || ie(t.message) && t.constructor && Ii(t.constructor.stackTraceLimit);
1561
+ }
1562
+ function tr(t, e) {
1563
+ if (typeof e != "object" || Qn(e))
1635
1564
  return !1;
1636
1565
  if (e instanceof t)
1637
1566
  return !0;
1638
- var n = Qe(new t(""));
1639
- if (_i(e))
1567
+ var n = et(new t(""));
1568
+ if (Ei(e))
1640
1569
  for (; e; ) {
1641
- if (Qe(e) === n)
1570
+ if (et(e) === n)
1642
1571
  return !0;
1643
1572
  e = Object.getPrototypeOf(e);
1644
1573
  }
1645
1574
  return !1;
1646
1575
  }
1647
- Gn.bind(null, TypeError);
1648
- Gn.bind(null, SyntaxError);
1649
- function rt(t, e) {
1576
+ tr.bind(null, TypeError);
1577
+ tr.bind(null, SyntaxError);
1578
+ function it(t, e) {
1650
1579
  var n = t instanceof Element || t instanceof HTMLDocument;
1651
- return n && e ? Si(t, e) : n;
1580
+ return n && e ? Oi(t, e) : n;
1652
1581
  }
1653
- function Si(t, e) {
1582
+ function Oi(t, e) {
1654
1583
  return e === void 0 && (e = ""), t && t.nodeName === e.toUpperCase();
1655
1584
  }
1656
- function it(t) {
1585
+ function ot(t) {
1657
1586
  var e = [].slice.call(arguments, 1);
1658
1587
  return function() {
1659
1588
  return t.apply(void 0, [].slice.call(arguments).concat(e));
1660
1589
  };
1661
1590
  }
1662
- it(rt, "form");
1663
- it(rt, "button");
1664
- it(rt, "input");
1665
- it(rt, "select");
1666
- function Ei(t) {
1667
- return t ? Yn(t) ? t : [t] : [];
1591
+ ot(it, "form");
1592
+ ot(it, "button");
1593
+ ot(it, "input");
1594
+ ot(it, "select");
1595
+ function Ti(t) {
1596
+ return t ? er(t) ? t : [t] : [];
1668
1597
  }
1669
- function en(t) {
1598
+ function rn(t) {
1670
1599
  try {
1671
1600
  return decodeURIComponent(t.replace(/\+/g, " "));
1672
1601
  } catch {
1673
1602
  return null;
1674
1603
  }
1675
1604
  }
1676
- function Oi() {
1677
- if (Y) {
1605
+ function Pi() {
1606
+ if (J) {
1678
1607
  var t = navigator, e = t.languages;
1679
1608
  return t.userLanguage || (e && e.length ? e[0] : t.language);
1680
1609
  }
1681
1610
  }
1682
- function Ti() {
1611
+ function ji() {
1683
1612
  try {
1684
1613
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
1685
1614
  } catch {
1686
1615
  }
1687
1616
  }
1688
- function Pi(t) {
1617
+ function xi(t) {
1689
1618
  return function(e) {
1690
1619
  for (var n, r = /* @__PURE__ */ Object.create(null), i = /([^&=]+)=?([^&]*)/g; n = i.exec(e); ) {
1691
- var o = en(n[1]), a = en(n[2]);
1620
+ var o = rn(n[1]), a = rn(n[2]);
1692
1621
  o.substring(o.length - 2) === "[]" ? (r[o = o.substring(0, o.length - 2)] || (r[o] = [])).push(a) : r[o] = a === "" || a;
1693
1622
  }
1694
1623
  for (var s in r) {
1695
- var p = s.split("[");
1696
- p.length > 1 && (ji(r, p.map(function(f) {
1697
- return f.replace(/[?[\]\\ ]/g, "");
1624
+ var h = s.split("[");
1625
+ h.length > 1 && (Ci(r, h.map(function(p) {
1626
+ return p.replace(/[?[\]\\ ]/g, "");
1698
1627
  }), r[s]), delete r[s]);
1699
1628
  }
1700
1629
  return r;
@@ -1703,10 +1632,10 @@ function Pi(t) {
1703
1632
  var n = e.match(/\?(.*)/);
1704
1633
  return n && n[1] ? n[1].split("#")[0] : "";
1705
1634
  }
1706
- return Y && window.location.search.substring(1);
1635
+ return J && window.location.search.substring(1);
1707
1636
  }(t));
1708
1637
  }
1709
- function ji(t, e, n) {
1638
+ function Ci(t, e, n) {
1710
1639
  for (var r = e.length - 1, i = 0; i < r; ++i) {
1711
1640
  var o = e[i];
1712
1641
  if (o === "__proto__" || o === "constructor")
@@ -1715,14 +1644,25 @@ function ji(t, e, n) {
1715
1644
  }
1716
1645
  t[e[r]] = n;
1717
1646
  }
1718
- function ot() {
1647
+ function at() {
1719
1648
  for (var t = "", e = 0, n = 4294967295 * Math.random() | 0; e++ < 36; ) {
1720
1649
  var r = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[e - 1], i = 15 & n;
1721
1650
  t += r == "-" || r == "4" ? r : (r == "x" ? i : 3 & i | 8).toString(16), n = e % 8 == 0 ? 4294967295 * Math.random() | 0 : n >> 4;
1722
1651
  }
1723
1652
  return t;
1724
1653
  }
1725
- var De = "global", Oe = me + "global" + me, Te = typeof self === Qt && self.self === self && self || typeof global === Qt && global.global === global && global || void 0;
1654
+ function Ai(t, e) {
1655
+ var n, r, i, o = null, a = 0, s = function() {
1656
+ a = /* @__PURE__ */ new Date(), o = null, i = t.apply(n, r);
1657
+ };
1658
+ return function() {
1659
+ var h = /* @__PURE__ */ new Date();
1660
+ a || (a = h);
1661
+ var p = e - (h - a);
1662
+ return n = this, r = arguments, p <= 0 ? (clearTimeout(o), o = null, a = h, i = t.apply(n, r)) : o || (o = setTimeout(s, p)), i;
1663
+ };
1664
+ }
1665
+ var De = "global", Oe = me + "global" + me, Te = typeof self === nn && self.self === self && self || typeof global === nn && global.global === global && global || void 0;
1726
1666
  function ge(t) {
1727
1667
  return Te[Oe][t];
1728
1668
  }
@@ -1735,7 +1675,7 @@ function je(t) {
1735
1675
  function xe(t, e, n) {
1736
1676
  var r;
1737
1677
  try {
1738
- if (At(t)) {
1678
+ if (Nt(t)) {
1739
1679
  var i = window[t];
1740
1680
  r = i[e].bind(i);
1741
1681
  }
@@ -1744,80 +1684,80 @@ function xe(t, e, n) {
1744
1684
  return r || n;
1745
1685
  }
1746
1686
  Te[Oe] || (Te[Oe] = {});
1747
- var Xe = {};
1748
- function At(t) {
1749
- if (typeof Xe[t] !== Je)
1750
- return Xe[t];
1687
+ var Je = {};
1688
+ function Nt(t) {
1689
+ if (typeof Je[t] !== Fe)
1690
+ return Je[t];
1751
1691
  try {
1752
1692
  var e = window[t];
1753
- e.setItem(Je, Je), e.removeItem(Je);
1693
+ e.setItem(Fe, Fe), e.removeItem(Fe);
1754
1694
  } catch {
1755
- return Xe[t] = !1;
1695
+ return Je[t] = !1;
1756
1696
  }
1757
- return Xe[t] = !0;
1697
+ return Je[t] = !0;
1758
1698
  }
1759
- function P() {
1760
- return P = Object.assign || function(t) {
1699
+ function A() {
1700
+ return A = Object.assign || function(t) {
1761
1701
  for (var e = 1; e < arguments.length; e++) {
1762
1702
  var n = arguments[e];
1763
1703
  for (var r in n)
1764
1704
  Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
1765
1705
  }
1766
1706
  return t;
1767
- }, P.apply(this, arguments);
1707
+ }, A.apply(this, arguments);
1768
1708
  }
1769
- var ne = "function", ee = "undefined", xi = "@@redux/" + Math.random().toString(36), tn = /* @__PURE__ */ function() {
1770
- return typeof Symbol === ne && Symbol.observable || "@@observable";
1771
- }(), Fe = " != " + ne;
1772
- function Bn(t, e, n) {
1709
+ var re = "function", te = "undefined", $i = "@@redux/" + Math.random().toString(36), on = /* @__PURE__ */ function() {
1710
+ return typeof Symbol === re && Symbol.observable || "@@observable";
1711
+ }(), He = " != " + re;
1712
+ function nr(t, e, n) {
1773
1713
  var r;
1774
- if (typeof e === ne && typeof n === ee && (n = e, e = void 0), typeof n !== ee) {
1775
- if (typeof n !== ne)
1776
- throw new Error("enhancer" + Fe);
1777
- return n(Bn)(t, e);
1778
- }
1779
- if (typeof t !== ne)
1780
- throw new Error("reducer" + Fe);
1781
- var i = t, o = e, a = [], s = a, p = !1;
1782
- function f() {
1714
+ if (typeof e === re && typeof n === te && (n = e, e = void 0), typeof n !== te) {
1715
+ if (typeof n !== re)
1716
+ throw new Error("enhancer" + He);
1717
+ return n(nr)(t, e);
1718
+ }
1719
+ if (typeof t !== re)
1720
+ throw new Error("reducer" + He);
1721
+ var i = t, o = e, a = [], s = a, h = !1;
1722
+ function p() {
1783
1723
  s === a && (s = a.slice());
1784
1724
  }
1785
1725
  function u() {
1786
1726
  return o;
1787
1727
  }
1788
1728
  function c(d) {
1789
- if (typeof d !== ne)
1790
- throw new Error("Listener" + Fe);
1729
+ if (typeof d !== re)
1730
+ throw new Error("Listener" + He);
1791
1731
  var w = !0;
1792
- return f(), s.push(d), function() {
1732
+ return p(), s.push(d), function() {
1793
1733
  if (w) {
1794
- w = !1, f();
1734
+ w = !1, p();
1795
1735
  var k = s.indexOf(d);
1796
1736
  s.splice(k, 1);
1797
1737
  }
1798
1738
  };
1799
1739
  }
1800
- function h(d) {
1801
- if (!F(d))
1740
+ function f(d) {
1741
+ if (!X(d))
1802
1742
  throw new Error("Act != obj");
1803
- if (typeof d.type === ee)
1804
- throw new Error("ActType " + ee);
1805
- if (p)
1743
+ if (typeof d.type === te)
1744
+ throw new Error("ActType " + te);
1745
+ if (h)
1806
1746
  throw new Error("Dispatch in reducer");
1807
1747
  try {
1808
- p = !0, o = i(o, d);
1748
+ h = !0, o = i(o, d);
1809
1749
  } finally {
1810
- p = !1;
1750
+ h = !1;
1811
1751
  }
1812
1752
  for (var w = a = s, k = 0; k < w.length; k++)
1813
1753
  (0, w[k])();
1814
1754
  return d;
1815
1755
  }
1816
- return h({ type: "@@redux/INIT" }), (r = { dispatch: h, subscribe: c, getState: u, replaceReducer: function(d) {
1817
- if (typeof d !== ne)
1818
- throw new Error("next reducer" + Fe);
1819
- i = d, h({ type: "@@redux/INIT" });
1820
- } })[tn] = function() {
1756
+ return f({ type: "@@redux/INIT" }), (r = { dispatch: f, subscribe: c, getState: u, replaceReducer: function(d) {
1757
+ if (typeof d !== re)
1758
+ throw new Error("next reducer" + He);
1759
+ i = d, f({ type: "@@redux/INIT" });
1760
+ } })[on] = function() {
1821
1761
  var d, w = c;
1822
1762
  return (d = { subscribe: function(k) {
1823
1763
  if (typeof k != "object")
@@ -1826,14 +1766,14 @@ function Bn(t, e, n) {
1826
1766
  k.next && k.next(u());
1827
1767
  }
1828
1768
  return v(), { unsubscribe: w(v) };
1829
- } })[tn] = function() {
1769
+ } })[on] = function() {
1830
1770
  return this;
1831
1771
  }, d;
1832
1772
  }, r;
1833
1773
  }
1834
- function Ci(t, e) {
1774
+ function zi(t, e) {
1835
1775
  var n = e && e.type;
1836
- return "action " + (n && n.toString() || "?") + "reducer " + t + " returns " + ee;
1776
+ return "action " + (n && n.toString() || "?") + "reducer " + t + " returns " + te;
1837
1777
  }
1838
1778
  function Pe() {
1839
1779
  var t = [].slice.call(arguments);
@@ -1845,48 +1785,48 @@ function Pe() {
1845
1785
  };
1846
1786
  });
1847
1787
  }
1848
- function Ai() {
1788
+ function Ni() {
1849
1789
  var t = arguments;
1850
1790
  return function(e) {
1851
1791
  return function(n, r, i) {
1852
- var o, a = e(n, r, i), s = a.dispatch, p = { getState: a.getState, dispatch: function(f) {
1853
- return s(f);
1792
+ var o, a = e(n, r, i), s = a.dispatch, h = { getState: a.getState, dispatch: function(p) {
1793
+ return s(p);
1854
1794
  } };
1855
- return o = [].slice.call(t).map(function(f) {
1856
- return f(p);
1857
- }), P({}, a, { dispatch: s = Pe.apply(void 0, o)(a.dispatch) });
1795
+ return o = [].slice.call(t).map(function(p) {
1796
+ return p(h);
1797
+ }), A({}, a, { dispatch: s = Pe.apply(void 0, o)(a.dispatch) });
1858
1798
  };
1859
1799
  };
1860
1800
  }
1861
- var ie = me + "anon_id", fe = me + "user_id", Ie = me + "user_traits", te = "userId", ke = "anonymousId", Be = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], _t = ["name", "EVENTS", "config", "loaded"], T = Be.reduce(function(t, e) {
1801
+ var oe = me + "anon_id", fe = me + "user_id", Ie = me + "user_traits", ne = "userId", ke = "anonymousId", qe = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], Et = ["name", "EVENTS", "config", "loaded"], C = qe.reduce(function(t, e) {
1862
1802
  return t[e] = e, t;
1863
1803
  }, { registerPluginType: function(t) {
1864
1804
  return "registerPlugin:" + t;
1865
1805
  }, pluginReadyType: function(t) {
1866
1806
  return "ready:" + t;
1867
- } }), nn = /^utm_/, rn = /^an_prop_/, on = /^an_trait_/;
1868
- function $i(t) {
1807
+ } }), an = /^utm_/, sn = /^an_prop_/, cn = /^an_trait_/;
1808
+ function Di(t) {
1869
1809
  var e = t.storage.setItem;
1870
1810
  return function(n) {
1871
1811
  return function(r) {
1872
1812
  return function(i) {
1873
- if (i.type === T.bootstrap) {
1874
- var o = i.params, a = i.user, s = i.persistedUser, p = i.initialUser, f = s.userId === a.userId;
1875
- s.anonymousId !== a.anonymousId && e(ie, a.anonymousId), f || e(fe, a.userId), p.traits && e(Ie, P({}, f && s.traits ? s.traits : {}, p.traits));
1813
+ if (i.type === C.bootstrap) {
1814
+ var o = i.params, a = i.user, s = i.persistedUser, h = i.initialUser, p = s.userId === a.userId;
1815
+ s.anonymousId !== a.anonymousId && e(oe, a.anonymousId), p || e(fe, a.userId), h.traits && e(Ie, A({}, p && s.traits ? s.traits : {}, h.traits));
1876
1816
  var u = Object.keys(i.params);
1877
1817
  if (u.length) {
1878
- var c = o.an_uid, h = o.an_event, d = u.reduce(function(w, k) {
1879
- if (k.match(nn) || k.match(/^(d|g)clid/)) {
1880
- var v = k.replace(nn, "");
1818
+ var c = o.an_uid, f = o.an_event, d = u.reduce(function(w, k) {
1819
+ if (k.match(an) || k.match(/^(d|g)clid/)) {
1820
+ var v = k.replace(an, "");
1881
1821
  w.campaign[v === "campaign" ? "name" : v] = o[k];
1882
1822
  }
1883
- return k.match(rn) && (w.props[k.replace(rn, "")] = o[k]), k.match(on) && (w.traits[k.replace(on, "")] = o[k]), w;
1823
+ return k.match(sn) && (w.props[k.replace(sn, "")] = o[k]), k.match(cn) && (w.traits[k.replace(cn, "")] = o[k]), w;
1884
1824
  }, { campaign: {}, props: {}, traits: {} });
1885
- n.dispatch(P({ type: T.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
1825
+ n.dispatch(A({ type: C.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
1886
1826
  return t.identify(c, d.traits);
1887
- }, 0), h && setTimeout(function() {
1888
- return t.track(h, d.props);
1889
- }, 0), Object.keys(d.campaign).length && n.dispatch({ type: T.campaign, campaign: d.campaign });
1827
+ }, 0), f && setTimeout(function() {
1828
+ return t.track(f, d.props);
1829
+ }, 0), Object.keys(d.campaign).length && n.dispatch({ type: C.campaign, campaign: d.campaign });
1890
1830
  }
1891
1831
  }
1892
1832
  return r(i);
@@ -1894,19 +1834,19 @@ function $i(t) {
1894
1834
  };
1895
1835
  };
1896
1836
  }
1897
- function zi(t) {
1837
+ function Ui(t) {
1898
1838
  return function(e, n) {
1899
- if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type === T.setItemEnd) {
1900
- if (n.key === ie)
1901
- return P({}, e, { anonymousId: n.value });
1839
+ if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type === C.setItemEnd) {
1840
+ if (n.key === oe)
1841
+ return A({}, e, { anonymousId: n.value });
1902
1842
  if (n.key === fe)
1903
- return P({}, e, { userId: n.value });
1843
+ return A({}, e, { userId: n.value });
1904
1844
  }
1905
1845
  switch (n.type) {
1906
- case T.identify:
1907
- return Object.assign({}, e, { userId: n.userId, traits: P({}, e.traits, n.traits) });
1908
- case T.reset:
1909
- return [fe, ie, Ie].forEach(function(r) {
1846
+ case C.identify:
1847
+ return Object.assign({}, e, { userId: n.userId, traits: A({}, e.traits, n.traits) });
1848
+ case C.reset:
1849
+ return [fe, oe, Ie].forEach(function(r) {
1910
1850
  t.removeItem(r);
1911
1851
  }), Object.assign({}, e, { userId: null, anonymousId: null, traits: {} });
1912
1852
  default:
@@ -1914,26 +1854,26 @@ function zi(t) {
1914
1854
  }
1915
1855
  };
1916
1856
  }
1917
- function an(t) {
1918
- return { userId: t.getItem(fe), anonymousId: t.getItem(ie), traits: t.getItem(Ie) };
1857
+ function un(t) {
1858
+ return { userId: t.getItem(fe), anonymousId: t.getItem(oe), traits: t.getItem(Ie) };
1919
1859
  }
1920
- var St = function(t) {
1860
+ var Ot = function(t) {
1921
1861
  return me + "TEMP" + me + t;
1922
1862
  };
1923
- function Ni(t) {
1863
+ function Li(t) {
1924
1864
  var e = t.storage, n = e.setItem, r = e.removeItem, i = e.getItem;
1925
1865
  return function(o) {
1926
1866
  return function(a) {
1927
1867
  return function(s) {
1928
- var p = s.userId, f = s.traits, u = s.options;
1929
- if (s.type === T.reset && ([fe, Ie, ie].forEach(function(d) {
1868
+ var h = s.userId, p = s.traits, u = s.options;
1869
+ if (s.type === C.reset && ([fe, Ie, oe].forEach(function(d) {
1930
1870
  r(d);
1931
- }), [te, ke, "traits"].forEach(function(d) {
1932
- je(St(d));
1933
- })), s.type === T.identify) {
1934
- i(ie) || n(ie, ot());
1935
- var c = i(fe), h = i(Ie) || {};
1936
- c && c !== p && o.dispatch({ type: T.userIdChanged, old: { userId: c, traits: h }, new: { userId: p, traits: f }, options: u }), p && n(fe, p), f && n(Ie, P({}, h, f));
1871
+ }), [ne, ke, "traits"].forEach(function(d) {
1872
+ je(Ot(d));
1873
+ })), s.type === C.identify) {
1874
+ i(oe) || n(oe, at());
1875
+ var c = i(fe), f = i(Ie) || {};
1876
+ c && c !== h && o.dispatch({ type: C.userIdChanged, old: { userId: c, traits: f }, new: { userId: h, traits: p }, options: u }), h && n(fe, h), p && n(Ie, A({}, f, p));
1937
1877
  }
1938
1878
  return a(s);
1939
1879
  };
@@ -1941,155 +1881,155 @@ function Ni(t) {
1941
1881
  };
1942
1882
  }
1943
1883
  var Ne = {};
1944
- function sn(t, e) {
1945
- Ne[t] && G(Ne[t]) && (Ne[t](e), delete Ne[t]);
1884
+ function ln(t, e) {
1885
+ Ne[t] && V(Ne[t]) && (Ne[t](e), delete Ne[t]);
1946
1886
  }
1947
- function qn(t, e, n) {
1887
+ function rr(t, e, n) {
1948
1888
  return new Promise(function(r, i) {
1949
- return e() ? r(t) : n < 1 ? i(P({}, t, { queue: !0 })) : new Promise(function(o) {
1889
+ return e() ? r(t) : n < 1 ? i(A({}, t, { queue: !0 })) : new Promise(function(o) {
1950
1890
  return setTimeout(o, 10);
1951
1891
  }).then(function(o) {
1952
- return qn(t, e, n - 10).then(r, i);
1892
+ return rr(t, e, n - 10).then(r, i);
1953
1893
  });
1954
1894
  });
1955
1895
  }
1956
- function Di(t) {
1896
+ function Ri(t) {
1957
1897
  return { abort: t };
1958
1898
  }
1959
- function Qn(t, e, n) {
1960
- var r = {}, i = e(), o = t.getState(), a = o.plugins, s = o.queue, p = o.user;
1899
+ function ir(t, e, n) {
1900
+ var r = {}, i = e(), o = t.getState(), a = o.plugins, s = o.queue, h = o.user;
1961
1901
  if (!o.context.offline && s && s.actions && s.actions.length) {
1962
- var f = s.actions.reduce(function(c, h, d) {
1963
- return a[h.plugin].loaded ? (c.process.push(h), c.processIndex.push(d)) : (c.requeue.push(h), c.requeueIndex.push(d)), c;
1902
+ var p = s.actions.reduce(function(c, f, d) {
1903
+ return a[f.plugin].loaded ? (c.process.push(f), c.processIndex.push(d)) : (c.requeue.push(f), c.requeueIndex.push(d)), c;
1964
1904
  }, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
1965
- if (f.processIndex && f.processIndex.length) {
1966
- f.processIndex.forEach(function(c) {
1967
- var h = s.actions[c], d = h.plugin, w = h.payload.type, k = i[d][w];
1968
- if (k && G(k)) {
1905
+ if (p.processIndex && p.processIndex.length) {
1906
+ p.processIndex.forEach(function(c) {
1907
+ var f = s.actions[c], d = f.plugin, w = f.payload.type, k = i[d][w];
1908
+ if (k && V(k)) {
1969
1909
  var v, _ = function(l, b) {
1970
- return l === void 0 && (l = {}), b === void 0 && (b = {}), [te, ke].reduce(function(C, O) {
1971
- return l.hasOwnProperty(O) && b[O] && b[O] !== l[O] && (C[O] = b[O]), C;
1910
+ return l === void 0 && (l = {}), b === void 0 && (b = {}), [ne, ke].reduce(function(T, j) {
1911
+ return l.hasOwnProperty(j) && b[j] && b[j] !== l[j] && (T[j] = b[j]), T;
1972
1912
  }, l);
1973
- }(h.payload, p), S = r[_.meta.rid];
1974
- if (!S && (v = k({ payload: _, config: a[d].config, instance: n, abort: Di })) && F(v) && v.abort)
1913
+ }(f.payload, h), S = r[_.meta.rid];
1914
+ if (!S && (v = k({ payload: _, config: a[d].config, instance: n, abort: Ri })) && X(v) && v.abort)
1975
1915
  return void (r[_.meta.rid] = !0);
1976
1916
  if (!S) {
1977
- var y = w + ":" + d;
1978
- t.dispatch(P({}, _, { type: y, _: { called: y, from: "queueDrain" } }));
1917
+ var g = w + ":" + d;
1918
+ t.dispatch(A({}, _, { type: g, _: { called: g, from: "queueDrain" } }));
1979
1919
  }
1980
1920
  }
1981
1921
  });
1982
- var u = s.actions.filter(function(c, h) {
1983
- return !~f.processIndex.indexOf(h);
1922
+ var u = s.actions.filter(function(c, f) {
1923
+ return !~p.processIndex.indexOf(f);
1984
1924
  });
1985
1925
  s.actions = u;
1986
1926
  }
1987
1927
  }
1988
1928
  }
1989
- var ft = function(t) {
1990
- var e = t.data, n = t.action, r = t.instance, i = t.state, o = t.allPlugins, a = t.allMatches, s = t.store, p = t.EVENTS;
1929
+ var pt = function(t) {
1930
+ var e = t.data, n = t.action, r = t.instance, i = t.state, o = t.allPlugins, a = t.allMatches, s = t.store, h = t.EVENTS;
1991
1931
  try {
1992
- var f = i.plugins, u = i.context, c = n.type, h = c.match(_e), d = e.exact.map(function(v) {
1932
+ var p = i.plugins, u = i.context, c = n.type, f = c.match(Se), d = e.exact.map(function(v) {
1993
1933
  return v.pluginName;
1994
1934
  });
1995
- h && (d = a.during.map(function(v) {
1935
+ f && (d = a.during.map(function(v) {
1996
1936
  return v.pluginName;
1997
1937
  }));
1998
1938
  var w = /* @__PURE__ */ function(v, _) {
1999
- return function(S, y, l) {
2000
- var b = y.config, C = y.name, O = C + "." + S.type;
2001
- l && (O = l.event);
2002
- var A = S.type.match(_e) ? /* @__PURE__ */ function(Z, I, j, N, W) {
2003
- return function(R, x) {
2004
- var J = N ? N.name : Z, X = x && Ze(x) ? x : j;
2005
- if (N && (!(X = x && Ze(x) ? x : [Z]).includes(Z) || X.length !== 1))
2006
- throw new Error("Method " + I + " can only abort " + Z + " plugin. " + JSON.stringify(X) + " input valid");
2007
- return P({}, W, { abort: { reason: R, plugins: X, caller: I, _: J } });
1939
+ return function(S, g, l) {
1940
+ var b = g.config, T = g.name, j = T + "." + S.type;
1941
+ l && (j = l.event);
1942
+ var $ = S.type.match(Se) ? /* @__PURE__ */ function(L, I, x, E, N) {
1943
+ return function(R, P) {
1944
+ var K = E ? E.name : L, H = P && Me(P) ? P : x;
1945
+ if (E && (!(H = P && Me(P) ? P : [L]).includes(L) || H.length !== 1))
1946
+ throw new Error("Method " + I + " can only abort " + L + " plugin. " + JSON.stringify(H) + " input valid");
1947
+ return A({}, N, { abort: { reason: R, plugins: H, caller: I, _: K } });
2008
1948
  };
2009
- }(C, O, _, l, S) : /* @__PURE__ */ function(Z, I) {
1949
+ }(T, j, _, l, S) : /* @__PURE__ */ function(L, I) {
2010
1950
  return function() {
2011
- throw new Error(Z.type + " action not cancellable. Remove abort in " + I);
1951
+ throw new Error(L.type + " action not cancellable. Remove abort in " + I);
2012
1952
  };
2013
- }(S, O);
2014
- return { payload: Ui(S), instance: v, config: b || {}, abort: A };
1953
+ }(S, j);
1954
+ return { payload: Mi(S), instance: v, config: b || {}, abort: $ };
2015
1955
  };
2016
1956
  }(r, d), k = e.exact.reduce(function(v, _) {
2017
- var S = _.pluginName, y = _.methodName, l = !1;
2018
- return y.match(/^initialize/) || y.match(/^reset/) || (l = !f[S].loaded), u.offline && y.match(/^(page|track|identify)/) && (l = !0), v["" + S] = l, v;
1957
+ var S = _.pluginName, g = _.methodName, l = !1;
1958
+ return g.match(/^initialize/) || g.match(/^reset/) || (l = !p[S].loaded), u.offline && g.match(/^(page|track|identify)/) && (l = !0), v["" + S] = l, v;
2019
1959
  }, {});
2020
1960
  return Promise.resolve(e.exact.reduce(function(v, _, S) {
2021
1961
  try {
2022
- var y = _.pluginName;
1962
+ var g = _.pluginName;
2023
1963
  return Promise.resolve(v).then(function(l) {
2024
1964
  function b() {
2025
1965
  return Promise.resolve(l);
2026
1966
  }
2027
- var C = function() {
2028
- if (e.namespaced && e.namespaced[y])
2029
- return Promise.resolve(e.namespaced[y].reduce(function(O, A, Z) {
1967
+ var T = function() {
1968
+ if (e.namespaced && e.namespaced[g])
1969
+ return Promise.resolve(e.namespaced[g].reduce(function(j, $, L) {
2030
1970
  try {
2031
- return Promise.resolve(O).then(function(I) {
2032
- return A.method && G(A.method) ? (function(R, x) {
2033
- var J = pn(R);
2034
- if (J && J.name === x) {
2035
- var X = pn(J.method);
2036
- throw new Error([x + " plugin is calling method " + R, "Plugins cant call self", "Use " + J.method + " " + (X ? "or " + X.method : "") + " in " + x + " plugin insteadof " + R].join(`
1971
+ return Promise.resolve(j).then(function(I) {
1972
+ return $.method && V($.method) ? (function(R, P) {
1973
+ var K = yn(R);
1974
+ if (K && K.name === P) {
1975
+ var H = yn(K.method);
1976
+ throw new Error([P + " plugin is calling method " + R, "Plugins cant call self", "Use " + K.method + " " + (H ? "or " + H.method : "") + " in " + P + " plugin insteadof " + R].join(`
2037
1977
  `));
2038
1978
  }
2039
- }(A.methodName, A.pluginName), Promise.resolve(A.method({ payload: I, instance: r, abort: (j = I, N = y, W = A.pluginName, function(R, x) {
2040
- return P({}, j, { abort: { reason: R, plugins: x || [N], caller: c, from: W || N } });
2041
- }), config: ln(A.pluginName, f, o), plugins: f })).then(function(R) {
2042
- var x = F(R) ? R : {};
2043
- return Promise.resolve(P({}, I, x));
1979
+ }($.methodName, $.pluginName), Promise.resolve($.method({ payload: I, instance: r, abort: (x = I, E = g, N = $.pluginName, function(R, P) {
1980
+ return A({}, x, { abort: { reason: R, plugins: P || [E], caller: c, from: N || E } });
1981
+ }), config: fn($.pluginName, p, o), plugins: p })).then(function(R) {
1982
+ var P = X(R) ? R : {};
1983
+ return Promise.resolve(A({}, I, P));
2044
1984
  })) : I;
2045
- var j, N, W;
1985
+ var x, E, N;
2046
1986
  });
2047
1987
  } catch (I) {
2048
1988
  return Promise.reject(I);
2049
1989
  }
2050
- }, Promise.resolve(n))).then(function(O) {
2051
- l[y] = O;
1990
+ }, Promise.resolve(n))).then(function(j) {
1991
+ l[g] = j;
2052
1992
  });
2053
- l[y] = n;
1993
+ l[g] = n;
2054
1994
  }();
2055
- return C && C.then ? C.then(b) : b();
1995
+ return T && T.then ? T.then(b) : b();
2056
1996
  });
2057
1997
  } catch (l) {
2058
1998
  return Promise.reject(l);
2059
1999
  }
2060
2000
  }, Promise.resolve({}))).then(function(v) {
2061
- return Promise.resolve(e.exact.reduce(function(_, S, y) {
2001
+ return Promise.resolve(e.exact.reduce(function(_, S, g) {
2062
2002
  try {
2063
- var l = e.exact.length === y + 1, b = S.pluginName, C = o[b];
2064
- return Promise.resolve(_).then(function(O) {
2065
- var A = v[b] ? v[b] : {};
2066
- if (h && (A = O), mt(A, b))
2067
- return pt({ data: A, method: c, instance: r, pluginName: b, store: s }), Promise.resolve(O);
2068
- if (mt(O, b))
2069
- return l && pt({ data: O, method: c, instance: r, store: s }), Promise.resolve(O);
2003
+ var l = e.exact.length === g + 1, b = S.pluginName, T = o[b];
2004
+ return Promise.resolve(_).then(function(j) {
2005
+ var $ = v[b] ? v[b] : {};
2006
+ if (f && ($ = j), gt($, b))
2007
+ return mt({ data: $, method: c, instance: r, pluginName: b, store: s }), Promise.resolve(j);
2008
+ if (gt(j, b))
2009
+ return l && mt({ data: j, method: c, instance: r, store: s }), Promise.resolve(j);
2070
2010
  if (k.hasOwnProperty(b) && k[b] === !0)
2071
- return s.dispatch({ type: "queue", plugin: b, payload: A, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(O);
2072
- var Z = w(v[b], o[b]);
2073
- return Promise.resolve(C[c]({ abort: Z.abort, payload: A, instance: r, config: ln(b, f, o), plugins: f })).then(function(I) {
2074
- var j = F(I) ? I : {}, N = P({}, O, j), W = v[b];
2075
- if (mt(W, b))
2076
- pt({ data: W, method: c, instance: r, pluginName: b, store: s });
2011
+ return s.dispatch({ type: "queue", plugin: b, payload: $, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(j);
2012
+ var L = w(v[b], o[b]);
2013
+ return Promise.resolve(T[c]({ abort: L.abort, payload: $, instance: r, config: fn(b, p, o), plugins: p })).then(function(I) {
2014
+ var x = X(I) ? I : {}, E = A({}, j, x), N = v[b];
2015
+ if (gt(N, b))
2016
+ mt({ data: N, method: c, instance: r, pluginName: b, store: s });
2077
2017
  else {
2078
2018
  var R = c + ":" + b;
2079
- (R.match(/:/g) || []).length < 2 && !c.match(cn) && !c.match(un) && r.dispatch(P({}, h ? N : A, { type: R, _: { called: R, from: "submethod" } }));
2019
+ (R.match(/:/g) || []).length < 2 && !c.match(dn) && !c.match(hn) && r.dispatch(A({}, f ? E : $, { type: R, _: { called: R, from: "submethod" } }));
2080
2020
  }
2081
- return Promise.resolve(N);
2021
+ return Promise.resolve(E);
2082
2022
  });
2083
2023
  });
2084
- } catch (O) {
2085
- return Promise.reject(O);
2024
+ } catch (j) {
2025
+ return Promise.reject(j);
2086
2026
  }
2087
2027
  }, Promise.resolve(n))).then(function(_) {
2088
- if (!(c.match(_e) || c.match(/^registerPlugin/) || c.match(un) || c.match(cn) || c.match(/^params/) || c.match(/^userIdChanged/))) {
2089
- if (p.plugins.includes(c), _._ && _._.originalAction === c)
2028
+ if (!(c.match(Se) || c.match(/^registerPlugin/) || c.match(hn) || c.match(dn) || c.match(/^params/) || c.match(/^userIdChanged/))) {
2029
+ if (h.plugins.includes(c), _._ && _._.originalAction === c)
2090
2030
  return _;
2091
- var S = P({}, _, { _: { originalAction: _.type, called: _.type, from: "engineEnd" } });
2092
- er(_, e.exact.length) && !c.match(/End$/) && (S = P({}, S, { type: _.type + "Aborted" })), s.dispatch(S);
2031
+ var S = A({}, _, { _: { originalAction: _.type, called: _.type, from: "engineEnd" } });
2032
+ or(_, e.exact.length) && !c.match(/End$/) && (S = A({}, S, { type: _.type + "Aborted" })), s.dispatch(S);
2093
2033
  }
2094
2034
  return _;
2095
2035
  });
@@ -2097,157 +2037,157 @@ var ft = function(t) {
2097
2037
  } catch (v) {
2098
2038
  return Promise.reject(v);
2099
2039
  }
2100
- }, _e = /Start$/, cn = /^bootstrap/, un = /^ready/;
2101
- function pt(t) {
2040
+ }, Se = /Start$/, dn = /^bootstrap/, hn = /^ready/;
2041
+ function mt(t) {
2102
2042
  var e = t.pluginName, n = t.method + "Aborted" + (e ? ":" + e : "");
2103
- t.store.dispatch(P({}, t.data, { type: n, _: { called: n, from: "abort" } }));
2043
+ t.store.dispatch(A({}, t.data, { type: n, _: { called: n, from: "abort" } }));
2104
2044
  }
2105
- function ln(t, e, n) {
2045
+ function fn(t, e, n) {
2106
2046
  var r = e[t] || n[t];
2107
2047
  return r && r.config ? r.config : {};
2108
2048
  }
2109
- function dn(t, e) {
2049
+ function pn(t, e) {
2110
2050
  return e.reduce(function(n, r) {
2111
2051
  return r[t] ? n.concat({ methodName: t, pluginName: r.name, method: r[t] }) : n;
2112
2052
  }, []);
2113
2053
  }
2114
- function hn(t, e) {
2115
- var n = t.replace(_e, ""), r = e ? ":" + e : "";
2054
+ function mn(t, e) {
2055
+ var n = t.replace(Se, ""), r = e ? ":" + e : "";
2116
2056
  return ["" + t + r, "" + n + r, n + "End" + r];
2117
2057
  }
2118
- function mt(t, e) {
2058
+ function gt(t, e) {
2119
2059
  var n = t.abort;
2120
- return !!n && (n === !0 || fn(n, e) || n && fn(n.plugins, e));
2060
+ return !!n && (n === !0 || gn(n, e) || n && gn(n.plugins, e));
2121
2061
  }
2122
- function er(t, e) {
2062
+ function or(t, e) {
2123
2063
  var n = t.abort;
2124
2064
  if (!n)
2125
2065
  return !1;
2126
- if (n === !0 || re(n))
2066
+ if (n === !0 || ie(n))
2127
2067
  return !0;
2128
2068
  var r = n.plugins;
2129
- return Ze(n) && n.length === e || Ze(r) && r.length === e;
2069
+ return Me(n) && n.length === e || Me(r) && r.length === e;
2130
2070
  }
2131
- function Ze(t) {
2071
+ function Me(t) {
2132
2072
  return Array.isArray(t);
2133
2073
  }
2134
- function fn(t, e) {
2135
- return !(!t || !Ze(t)) && t.includes(e);
2074
+ function gn(t, e) {
2075
+ return !(!t || !Me(t)) && t.includes(e);
2136
2076
  }
2137
- function pn(t) {
2077
+ function yn(t) {
2138
2078
  var e = t.match(/(.*):(.*)/);
2139
2079
  return !!e && { method: e[1], name: e[2] };
2140
2080
  }
2141
- function Ui(t) {
2081
+ function Mi(t) {
2142
2082
  return Object.keys(t).reduce(function(e, n) {
2143
- return n === "type" || (e[n] = F(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
2083
+ return n === "type" || (e[n] = X(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
2144
2084
  }, {});
2145
2085
  }
2146
- function Li(t, e, n) {
2086
+ function Zi(t, e, n) {
2147
2087
  var r = {};
2148
2088
  return function(i) {
2149
2089
  return function(o) {
2150
2090
  return function(a) {
2151
2091
  try {
2152
- var s, p = function(l) {
2092
+ var s, h = function(l) {
2153
2093
  return s ? l : o(c);
2154
- }, f = a.type, u = a.plugins, c = a;
2094
+ }, p = a.type, u = a.plugins, c = a;
2155
2095
  if (a.abort)
2156
2096
  return Promise.resolve(o(a));
2157
- if (f === T.enablePlugin && i.dispatch({ type: T.initializeStart, plugins: u, disabled: [], fromEnable: !0, meta: a.meta }), f === T.disablePlugin && setTimeout(function() {
2158
- return sn(a.meta.rid, { payload: a });
2159
- }, 0), f === T.initializeEnd) {
2160
- var h = e(), d = Object.keys(h), w = d.filter(function(l) {
2097
+ if (p === C.enablePlugin && i.dispatch({ type: C.initializeStart, plugins: u, disabled: [], fromEnable: !0, meta: a.meta }), p === C.disablePlugin && setTimeout(function() {
2098
+ return ln(a.meta.rid, { payload: a });
2099
+ }, 0), p === C.initializeEnd) {
2100
+ var f = e(), d = Object.keys(f), w = d.filter(function(l) {
2161
2101
  return u.includes(l);
2162
2102
  }).map(function(l) {
2163
- return h[l];
2103
+ return f[l];
2164
2104
  }), k = [], v = [], _ = a.disabled, S = w.map(function(l) {
2165
- var b = l.loaded, C = l.name, O = l.config;
2166
- return qn(l, function() {
2167
- return b({ config: O });
2168
- }, 1e4).then(function(A) {
2169
- return r[C] || (i.dispatch({ type: T.pluginReadyType(C), name: C, events: Object.keys(l).filter(function(Z) {
2170
- return !_t.includes(Z);
2171
- }) }), r[C] = !0), k = k.concat(C), l;
2172
- }).catch(function(A) {
2173
- if (A instanceof Error)
2174
- throw new Error(A);
2175
- return v = v.concat(A.name), A;
2105
+ var b = l.loaded, T = l.name, j = l.config;
2106
+ return rr(l, function() {
2107
+ return b({ config: j });
2108
+ }, 1e4).then(function($) {
2109
+ return r[T] || (i.dispatch({ type: C.pluginReadyType(T), name: T, events: Object.keys(l).filter(function(L) {
2110
+ return !Et.includes(L);
2111
+ }) }), r[T] = !0), k = k.concat(T), l;
2112
+ }).catch(function($) {
2113
+ if ($ instanceof Error)
2114
+ throw new Error($);
2115
+ return v = v.concat($.name), $;
2176
2116
  });
2177
2117
  });
2178
2118
  Promise.all(S).then(function(l) {
2179
2119
  var b = { plugins: k, failed: v, disabled: _ };
2180
2120
  setTimeout(function() {
2181
- d.length === S.length + _.length && i.dispatch(P({}, { type: T.ready }, b));
2121
+ d.length === S.length + _.length && i.dispatch(A({}, { type: C.ready }, b));
2182
2122
  }, 0);
2183
2123
  });
2184
2124
  }
2185
- var y = function() {
2186
- if (f !== T.bootstrap)
2187
- return /^ready:([^:]*)$/.test(f) && setTimeout(function() {
2188
- return Qn(i, e, t);
2189
- }, 0), Promise.resolve(function(l, b, C, O, A) {
2125
+ var g = function() {
2126
+ if (p !== C.bootstrap)
2127
+ return /^ready:([^:]*)$/.test(p) && setTimeout(function() {
2128
+ return ir(i, e, t);
2129
+ }, 0), Promise.resolve(function(l, b, T, j, $) {
2190
2130
  try {
2191
- var Z = G(b) ? b() : b, I = l.type, j = I.replace(_e, "");
2131
+ var L = V(b) ? b() : b, I = l.type, x = I.replace(Se, "");
2192
2132
  if (l._ && l._.called)
2193
2133
  return Promise.resolve(l);
2194
- var N = C.getState(), W = (J = Z, (X = N.plugins) === void 0 && (X = {}), (Ce = l.options) === void 0 && (Ce = {}), Object.keys(J).filter(function(m) {
2195
- var g = Ce.plugins || {};
2196
- return wi(g[m]) ? g[m] : g.all !== !1 && (!X[m] || X[m].enabled !== !1);
2134
+ var E = T.getState(), N = (K = L, (H = E.plugins) === void 0 && (H = {}), (Ce = l.options) === void 0 && (Ce = {}), Object.keys(K).filter(function(m) {
2135
+ var y = Ce.plugins || {};
2136
+ return ki(y[m]) ? y[m] : y.all !== !1 && (!H[m] || H[m].enabled !== !1);
2197
2137
  }).map(function(m) {
2198
- return J[m];
2138
+ return K[m];
2199
2139
  }));
2200
- I === T.initializeStart && l.fromEnable && (W = Object.keys(N.plugins).filter(function(m) {
2201
- var g = N.plugins[m];
2202
- return l.plugins.includes(m) && !g.initialized;
2140
+ I === C.initializeStart && l.fromEnable && (N = Object.keys(E.plugins).filter(function(m) {
2141
+ var y = E.plugins[m];
2142
+ return l.plugins.includes(m) && !y.initialized;
2203
2143
  }).map(function(m) {
2204
- return Z[m];
2144
+ return L[m];
2205
2145
  }));
2206
- var R = W.map(function(m) {
2146
+ var R = N.map(function(m) {
2207
2147
  return m.name;
2208
- }), x = function(m, g, E) {
2209
- var $ = hn(m).map(function(z) {
2210
- return dn(z, g);
2148
+ }), P = function(m, y, O) {
2149
+ var z = mn(m).map(function(D) {
2150
+ return pn(D, y);
2211
2151
  });
2212
- return g.reduce(function(z, D) {
2213
- var K = D.name, L = hn(m, K).map(function(Ae) {
2214
- return dn(Ae, g);
2215
- }), M = L[0], U = L[1], q = L[2];
2216
- return M.length && (z.beforeNS[K] = M), U.length && (z.duringNS[K] = U), q.length && (z.afterNS[K] = q), z;
2217
- }, { before: $[0], beforeNS: {}, during: $[1], duringNS: {}, after: $[2], afterNS: {} });
2218
- }(I, W);
2219
- return Promise.resolve(ft({ action: l, data: { exact: x.before, namespaced: x.beforeNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(m) {
2220
- function g() {
2221
- var z = function() {
2222
- if (I.match(_e))
2223
- return Promise.resolve(ft({ action: P({}, E, { type: j + "End" }), data: { exact: x.after, namespaced: x.afterNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(D) {
2224
- D.meta && D.meta.hasCallback && sn(D.meta.rid, { payload: D });
2152
+ return y.reduce(function(D, U) {
2153
+ var F = U.name, Z = mn(m, F).map(function(Ae) {
2154
+ return pn(Ae, y);
2155
+ }), W = Z[0], M = Z[1], q = Z[2];
2156
+ return W.length && (D.beforeNS[F] = W), M.length && (D.duringNS[F] = M), q.length && (D.afterNS[F] = q), D;
2157
+ }, { before: z[0], beforeNS: {}, during: z[1], duringNS: {}, after: z[2], afterNS: {} });
2158
+ }(I, N);
2159
+ return Promise.resolve(pt({ action: l, data: { exact: P.before, namespaced: P.beforeNS }, state: E, allPlugins: L, allMatches: P, instance: T, store: j, EVENTS: $ })).then(function(m) {
2160
+ function y() {
2161
+ var D = function() {
2162
+ if (I.match(Se))
2163
+ return Promise.resolve(pt({ action: A({}, O, { type: x + "End" }), data: { exact: P.after, namespaced: P.afterNS }, state: E, allPlugins: L, allMatches: P, instance: T, store: j, EVENTS: $ })).then(function(U) {
2164
+ U.meta && U.meta.hasCallback && ln(U.meta.rid, { payload: U });
2225
2165
  });
2226
2166
  }();
2227
- return z && z.then ? z.then(function() {
2167
+ return D && D.then ? D.then(function() {
2228
2168
  return m;
2229
2169
  }) : m;
2230
2170
  }
2231
- if (er(m, R.length))
2171
+ if (or(m, R.length))
2232
2172
  return m;
2233
- var E, $ = function() {
2234
- if (I !== j)
2235
- return Promise.resolve(ft({ action: P({}, m, { type: j }), data: { exact: x.during, namespaced: x.duringNS }, state: N, allPlugins: Z, allMatches: x, instance: C, store: O, EVENTS: A })).then(function(z) {
2236
- E = z;
2173
+ var O, z = function() {
2174
+ if (I !== x)
2175
+ return Promise.resolve(pt({ action: A({}, m, { type: x }), data: { exact: P.during, namespaced: P.duringNS }, state: E, allPlugins: L, allMatches: P, instance: T, store: j, EVENTS: $ })).then(function(D) {
2176
+ O = D;
2237
2177
  });
2238
- E = m;
2178
+ O = m;
2239
2179
  }();
2240
- return $ && $.then ? $.then(g) : g();
2180
+ return z && z.then ? z.then(y) : y();
2241
2181
  });
2242
2182
  } catch (m) {
2243
2183
  return Promise.reject(m);
2244
2184
  }
2245
- var J, X, Ce;
2185
+ var K, H, Ce;
2246
2186
  }(a, e, t, i, n)).then(function(l) {
2247
2187
  return s = 1, o(l);
2248
2188
  });
2249
2189
  }();
2250
- return Promise.resolve(y && y.then ? y.then(p) : p(y));
2190
+ return Promise.resolve(g && g.then ? g.then(h) : h(g));
2251
2191
  } catch (l) {
2252
2192
  return Promise.reject(l);
2253
2193
  }
@@ -2255,22 +2195,22 @@ function Li(t, e, n) {
2255
2195
  };
2256
2196
  };
2257
2197
  }
2258
- function Ri(t) {
2198
+ function Wi(t) {
2259
2199
  return function(e) {
2260
2200
  return function(n) {
2261
2201
  return function(r) {
2262
2202
  var i = r.type, o = r.key, a = r.value, s = r.options;
2263
- if (i === T.setItem || i === T.removeItem) {
2203
+ if (i === C.setItem || i === C.removeItem) {
2264
2204
  if (r.abort)
2265
2205
  return n(r);
2266
- i === T.setItem ? t.setItem(o, a, s) : t.removeItem(o, s);
2206
+ i === C.setItem ? t.setItem(o, a, s) : t.removeItem(o, s);
2267
2207
  }
2268
2208
  return n(r);
2269
2209
  };
2270
2210
  };
2271
2211
  };
2272
2212
  }
2273
- var Zi = function() {
2213
+ var Ki = function() {
2274
2214
  var t = this;
2275
2215
  this.before = [], this.after = [], this.addMiddleware = function(e, n) {
2276
2216
  t[n] = t[n].concat(e);
@@ -2294,142 +2234,142 @@ var Zi = function() {
2294
2234
  };
2295
2235
  };
2296
2236
  };
2297
- function Wi(t) {
2237
+ function Fi(t) {
2298
2238
  return function(e, n) {
2299
2239
  e === void 0 && (e = {});
2300
2240
  var r = {};
2301
2241
  if (n.type === "initialize:aborted")
2302
2242
  return e;
2303
2243
  if (/^registerPlugin:([^:]*)$/.test(n.type)) {
2304
- var i = mn(n.type, "registerPlugin"), o = t()[i];
2244
+ var i = vn(n.type, "registerPlugin"), o = t()[i];
2305
2245
  if (!o || !i)
2306
2246
  return e;
2307
2247
  var a = n.enabled, s = o.config;
2308
- return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s }, P({}, e, r);
2248
+ return r[i] = { enabled: a, initialized: !!a && !o.initialize, loaded: !!a && !!o.loaded({ config: s }), config: s }, A({}, e, r);
2309
2249
  }
2310
2250
  if (/^initialize:([^:]*)$/.test(n.type)) {
2311
- var p = mn(n.type, T.initialize), f = t()[p];
2312
- return f && p ? (r[p] = P({}, e[p], { initialized: !0, loaded: !!f.loaded({ config: f.config }) }), P({}, e, r)) : e;
2251
+ var h = vn(n.type, C.initialize), p = t()[h];
2252
+ return p && h ? (r[h] = A({}, e[h], { initialized: !0, loaded: !!p.loaded({ config: p.config }) }), A({}, e, r)) : e;
2313
2253
  }
2314
2254
  if (/^ready:([^:]*)$/.test(n.type))
2315
- return r[n.name] = P({}, e[n.name], { loaded: !0 }), P({}, e, r);
2255
+ return r[n.name] = A({}, e[n.name], { loaded: !0 }), A({}, e, r);
2316
2256
  switch (n.type) {
2317
- case T.disablePlugin:
2318
- return P({}, e, gn(n.plugins, !1, e));
2319
- case T.enablePlugin:
2320
- return P({}, e, gn(n.plugins, !0, e));
2257
+ case C.disablePlugin:
2258
+ return A({}, e, wn(n.plugins, !1, e));
2259
+ case C.enablePlugin:
2260
+ return A({}, e, wn(n.plugins, !0, e));
2321
2261
  default:
2322
2262
  return e;
2323
2263
  }
2324
2264
  };
2325
2265
  }
2326
- function mn(t, e) {
2266
+ function vn(t, e) {
2327
2267
  return t.substring(e.length + 1, t.length);
2328
2268
  }
2329
- function gn(t, e, n) {
2269
+ function wn(t, e, n) {
2330
2270
  return t.reduce(function(r, i) {
2331
- return r[i] = P({}, n[i], { enabled: e }), r;
2271
+ return r[i] = A({}, n[i], { enabled: e }), r;
2332
2272
  }, n);
2333
2273
  }
2334
- function tr(t) {
2274
+ function ar(t) {
2335
2275
  try {
2336
2276
  return JSON.parse(JSON.stringify(t));
2337
2277
  } catch {
2338
2278
  }
2339
2279
  return t;
2340
2280
  }
2341
- var Mi = { last: {}, history: [] };
2342
- function Ki(t, e) {
2343
- t === void 0 && (t = Mi);
2281
+ var Ji = { last: {}, history: [] };
2282
+ function Hi(t, e) {
2283
+ t === void 0 && (t = Ji);
2344
2284
  var n = e.options, r = e.meta;
2345
- if (e.type === T.track) {
2346
- var i = tr(P({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
2347
- return P({}, t, { last: i, history: t.history.concat(i) });
2285
+ if (e.type === C.track) {
2286
+ var i = ar(A({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
2287
+ return A({}, t, { last: i, history: t.history.concat(i) });
2348
2288
  }
2349
2289
  return t;
2350
2290
  }
2351
- var Ji = { actions: [] };
2352
- function Xi(t, e) {
2353
- t === void 0 && (t = Ji);
2291
+ var Xi = { actions: [] };
2292
+ function Vi(t, e) {
2293
+ t === void 0 && (t = Xi);
2354
2294
  var n = e.payload;
2355
2295
  switch (e.type) {
2356
2296
  case "queue":
2357
2297
  var r;
2358
- return r = n && n.type && n.type === T.identify ? [e].concat(t.actions) : t.actions.concat(e), P({}, t, { actions: r });
2298
+ return r = n && n.type && n.type === C.identify ? [e].concat(t.actions) : t.actions.concat(e), A({}, t, { actions: r });
2359
2299
  case "dequeue":
2360
2300
  return [];
2361
2301
  default:
2362
2302
  return t;
2363
2303
  }
2364
2304
  }
2365
- var nr = /#.*$/;
2366
- function Fi(t) {
2305
+ var sr = /#.*$/;
2306
+ function Yi(t) {
2367
2307
  var e = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(t);
2368
- return "/" + (e && e[3] ? e[3].split("?")[0].replace(nr, "") : "");
2308
+ return "/" + (e && e[3] ? e[3].split("?")[0].replace(sr, "") : "");
2369
2309
  }
2370
- var rr, ir, or, ar, Hi = function(t) {
2371
- if (t === void 0 && (t = {}), !Y)
2310
+ var cr, ur, lr, dr, Gi = function(t) {
2311
+ if (t === void 0 && (t = {}), !J)
2372
2312
  return t;
2373
- var e = document, n = e.title, r = e.referrer, i = window, o = i.location, a = i.innerWidth, s = i.innerHeight, p = o.hash, f = o.search, u = function(h) {
2313
+ var e = document, n = e.title, r = e.referrer, i = window, o = i.location, a = i.innerWidth, s = i.innerHeight, h = o.hash, p = o.search, u = function(f) {
2374
2314
  var d = function() {
2375
- if (Y) {
2315
+ if (J) {
2376
2316
  for (var w, k = document.getElementsByTagName("link"), v = 0; w = k[v]; v++)
2377
2317
  if (w.getAttribute("rel") === "canonical")
2378
2318
  return w.getAttribute("href");
2379
2319
  }
2380
2320
  }();
2381
- return d ? d.match(/\?/) ? d : d + h : window.location.href.replace(nr, "");
2382
- }(f), c = { title: n, url: u, path: Fi(u), hash: p, search: f, width: a, height: s };
2383
- return r && r !== "" && (c.referrer = r), P({}, c, t);
2384
- }, Vi = { last: {}, history: [] };
2385
- function Yi(t, e) {
2386
- t === void 0 && (t = Vi);
2321
+ return d ? d.match(/\?/) ? d : d + f : window.location.href.replace(sr, "");
2322
+ }(p), c = { title: n, url: u, path: Yi(u), hash: h, search: p, width: a, height: s };
2323
+ return r && r !== "" && (c.referrer = r), A({}, c, t);
2324
+ }, Bi = { last: {}, history: [] };
2325
+ function qi(t, e) {
2326
+ t === void 0 && (t = Bi);
2387
2327
  var n = e.options;
2388
- if (e.type === T.page) {
2389
- var r = tr(P({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
2390
- return P({}, t, { last: r, history: t.history.concat(r) });
2328
+ if (e.type === C.page) {
2329
+ var r = ar(A({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
2330
+ return A({}, t, { last: r, history: t.history.concat(r) });
2391
2331
  }
2392
2332
  return t;
2393
2333
  }
2394
- rr = function() {
2395
- if (!Y)
2334
+ cr = function() {
2335
+ if (!J)
2396
2336
  return !1;
2397
2337
  var t = navigator.appVersion;
2398
2338
  return ~t.indexOf("Win") ? "Windows" : ~t.indexOf("Mac") ? "MacOS" : ~t.indexOf("X11") ? "UNIX" : ~t.indexOf("Linux") ? "Linux" : "Unknown OS";
2399
- }(), ir = Y ? document.referrer : null, or = Oi(), ar = Ti();
2400
- var yn = { initialized: !1, sessionId: ot(), app: null, version: null, debug: !1, offline: !!Y && !navigator.onLine, os: { name: rr }, userAgent: Y ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.7" }, timezone: ar, locale: or, campaign: {}, referrer: ir };
2401
- function Gi(t, e) {
2402
- t === void 0 && (t = yn);
2339
+ }(), ur = J ? document.referrer : null, lr = Pi(), dr = ji();
2340
+ var bn = { initialized: !1, sessionId: at(), app: null, version: null, debug: !1, offline: !!J && !navigator.onLine, os: { name: cr }, userAgent: J ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.7" }, timezone: dr, locale: lr, campaign: {}, referrer: ur };
2341
+ function Qi(t, e) {
2342
+ t === void 0 && (t = bn);
2403
2343
  var n = t.initialized, r = e.campaign;
2404
2344
  switch (e.type) {
2405
- case T.campaign:
2406
- return P({}, t, { campaign: r });
2407
- case T.offline:
2408
- return P({}, t, { offline: !0 });
2409
- case T.online:
2410
- return P({}, t, { offline: !1 });
2345
+ case C.campaign:
2346
+ return A({}, t, { campaign: r });
2347
+ case C.offline:
2348
+ return A({}, t, { offline: !0 });
2349
+ case C.online:
2350
+ return A({}, t, { offline: !1 });
2411
2351
  default:
2412
- return n ? t : P({}, yn, t, { initialized: !0 });
2352
+ return n ? t : A({}, bn, t, { initialized: !0 });
2413
2353
  }
2414
2354
  }
2415
- var Bi = ["plugins", "reducers", "storage"];
2416
- function qi(t, e, n) {
2417
- if (Y) {
2355
+ var eo = ["plugins", "reducers", "storage"];
2356
+ function to(t, e, n) {
2357
+ if (J) {
2418
2358
  var r = window[(n ? "add" : "remove") + "EventListener"];
2419
2359
  t.split(" ").forEach(function(i) {
2420
2360
  r(i, e);
2421
2361
  });
2422
2362
  }
2423
2363
  }
2424
- function Qi(t) {
2425
- var e = qi.bind(null, "online offline", function(n) {
2364
+ function no(t) {
2365
+ var e = to.bind(null, "online offline", function(n) {
2426
2366
  return Promise.resolve(!navigator.onLine).then(t);
2427
2367
  });
2428
2368
  return e(!0), function(n) {
2429
2369
  return e(!1);
2430
2370
  };
2431
2371
  }
2432
- function sr() {
2372
+ function hr() {
2433
2373
  return ye("analytics", []), function(t) {
2434
2374
  return function(e, n, r) {
2435
2375
  var i = t(e, n, r), o = i.dispatch;
@@ -2439,290 +2379,290 @@ function sr() {
2439
2379
  };
2440
2380
  };
2441
2381
  }
2442
- function vn(t) {
2382
+ function kn(t) {
2443
2383
  return function() {
2444
- return Pe(Pe.apply(null, arguments), sr());
2384
+ return Pe(Pe.apply(null, arguments), hr());
2445
2385
  };
2446
2386
  }
2447
- function gt(t) {
2448
- return t ? Yn(t) ? t : [t] : [];
2387
+ function yt(t) {
2388
+ return t ? er(t) ? t : [t] : [];
2449
2389
  }
2450
- function wn(t, e, n) {
2390
+ function In(t, e, n) {
2451
2391
  t === void 0 && (t = {});
2452
- var r, i, o = ot();
2392
+ var r, i, o = at();
2453
2393
  return e && (Ne[o] = (r = e, i = function(a) {
2454
- for (var s, p = a || Array.prototype.slice.call(arguments), f = 0; f < p.length; f++)
2455
- if (G(p[f])) {
2456
- s = p[f];
2394
+ for (var s, h = a || Array.prototype.slice.call(arguments), p = 0; p < h.length; p++)
2395
+ if (V(h[p])) {
2396
+ s = h[p];
2457
2397
  break;
2458
2398
  }
2459
2399
  return s;
2460
2400
  }(n), function(a) {
2461
2401
  i && i(a), r(a);
2462
- })), P({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
2402
+ })), A({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
2463
2403
  }
2464
- function eo(t) {
2404
+ function ro(t) {
2465
2405
  t === void 0 && (t = {});
2466
- var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m, g) {
2467
- if (G(g))
2468
- return m.middlewares = m.middlewares.concat(g), m;
2469
- if (g.NAMESPACE && (g.name = g.NAMESPACE), !g.name)
2406
+ var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m, y) {
2407
+ if (V(y))
2408
+ return m.middlewares = m.middlewares.concat(y), m;
2409
+ if (y.NAMESPACE && (y.name = y.NAMESPACE), !y.name)
2470
2410
  throw new Error("https://lytics.dev/errors/1");
2471
- g.config || (g.config = {});
2472
- var E = g.EVENTS ? Object.keys(g.EVENTS).map(function(D) {
2473
- return g.EVENTS[D];
2411
+ y.config || (y.config = {});
2412
+ var O = y.EVENTS ? Object.keys(y.EVENTS).map(function(U) {
2413
+ return y.EVENTS[U];
2474
2414
  }) : [];
2475
- m.pluginEnabled[g.name] = !(g.enabled === !1 || g.config.enabled === !1), delete g.enabled, g.methods && (m.methods[g.name] = Object.keys(g.methods).reduce(function(D, K) {
2476
- var L;
2477
- return D[K] = (L = g.methods[K], function() {
2478
- for (var M = Array.prototype.slice.call(arguments), U = new Array(L.length), q = 0; q < M.length; q++)
2479
- U[q] = M[q];
2480
- return U[U.length] = b, L.apply({ instance: b }, U);
2481
- }), D;
2482
- }, {}), delete g.methods);
2483
- var $ = Object.keys(g).concat(E), z = new Set(m.events.concat($));
2484
- if (m.events = Array.from(z), m.pluginsArray = m.pluginsArray.concat(g), m.plugins[g.name])
2485
- throw new Error(g.name + "AlreadyLoaded");
2486
- return m.plugins[g.name] = g, m.plugins[g.name].loaded || (m.plugins[g.name].loaded = function() {
2415
+ m.pluginEnabled[y.name] = !(y.enabled === !1 || y.config.enabled === !1), delete y.enabled, y.methods && (m.methods[y.name] = Object.keys(y.methods).reduce(function(U, F) {
2416
+ var Z;
2417
+ return U[F] = (Z = y.methods[F], function() {
2418
+ for (var W = Array.prototype.slice.call(arguments), M = new Array(Z.length), q = 0; q < W.length; q++)
2419
+ M[q] = W[q];
2420
+ return M[M.length] = b, Z.apply({ instance: b }, M);
2421
+ }), U;
2422
+ }, {}), delete y.methods);
2423
+ var z = Object.keys(y).concat(O), D = new Set(m.events.concat(z));
2424
+ if (m.events = Array.from(D), m.pluginsArray = m.pluginsArray.concat(y), m.plugins[y.name])
2425
+ throw new Error(y.name + "AlreadyLoaded");
2426
+ return m.plugins[y.name] = y, m.plugins[y.name].loaded || (m.plugins[y.name].loaded = function() {
2487
2427
  return !0;
2488
2428
  }), m;
2489
2429
  }, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: ge, setItem: ye, removeItem: je }, o = /* @__PURE__ */ function(m) {
2490
- return function(g, E, $) {
2491
- return E.getState("user")[g] || ($ && F($) && $[g] ? $[g] : an(m)[g] || ge(St(g)) || null);
2430
+ return function(y, O, z) {
2431
+ return O.getState("user")[y] || (z && X(z) && z[y] ? z[y] : un(m)[y] || ge(Ot(y)) || null);
2492
2432
  };
2493
2433
  }(i), a = r.plugins, s = r.events.filter(function(m) {
2494
- return !_t.includes(m);
2495
- }).sort(), p = new Set(s.concat(Be).filter(function(m) {
2496
- return !_t.includes(m);
2497
- })), f = Array.from(p).sort(), u = function() {
2434
+ return !Et.includes(m);
2435
+ }).sort(), h = new Set(s.concat(qe).filter(function(m) {
2436
+ return !Et.includes(m);
2437
+ })), p = Array.from(h).sort(), u = function() {
2498
2438
  return a;
2499
- }, c = new Zi(), h = c.addMiddleware, d = c.removeMiddleware, w = c.dynamicMiddlewares, k = function() {
2439
+ }, c = new Ki(), f = c.addMiddleware, d = c.removeMiddleware, w = c.dynamicMiddlewares, k = function() {
2500
2440
  throw new Error("Abort disabled inListener");
2501
- }, v = Pi(), _ = an(i), S = P({}, _, n, v.an_uid ? { userId: v.an_uid } : {}, v.an_aid ? { anonymousId: v.an_aid } : {});
2502
- S.anonymousId || (S.anonymousId = ot());
2503
- var y = P({ enable: function(m, g) {
2504
- return new Promise(function(E) {
2505
- x.dispatch({ type: T.enablePlugin, plugins: gt(m), _: { originalAction: T.enablePlugin } }, E, [g]);
2441
+ }, v = xi(), _ = un(i), S = A({}, _, n, v.an_uid ? { userId: v.an_uid } : {}, v.an_aid ? { anonymousId: v.an_aid } : {});
2442
+ S.anonymousId || (S.anonymousId = at());
2443
+ var g = A({ enable: function(m, y) {
2444
+ return new Promise(function(O) {
2445
+ P.dispatch({ type: C.enablePlugin, plugins: yt(m), _: { originalAction: C.enablePlugin } }, O, [y]);
2506
2446
  });
2507
- }, disable: function(m, g) {
2508
- return new Promise(function(E) {
2509
- x.dispatch({ type: T.disablePlugin, plugins: gt(m), _: { originalAction: T.disablePlugin } }, E, [g]);
2447
+ }, disable: function(m, y) {
2448
+ return new Promise(function(O) {
2449
+ P.dispatch({ type: C.disablePlugin, plugins: yt(m), _: { originalAction: C.disablePlugin } }, O, [y]);
2510
2450
  });
2511
- } }, r.methods), l = !1, b = { identify: function(m, g, E, $) {
2451
+ } }, r.methods), l = !1, b = { identify: function(m, y, O, z) {
2512
2452
  try {
2513
- var z = re(m) ? m : null, D = F(m) ? m : g, K = E || {}, L = b.user();
2514
- ye(St(te), z);
2515
- var M = z || D.userId || o(te, b, D);
2516
- return Promise.resolve(new Promise(function(U) {
2517
- x.dispatch(P({ type: T.identifyStart, userId: M, traits: D || {}, options: K, anonymousId: L.anonymousId }, L.id && L.id !== z && { previousId: L.id }), U, [g, E, $]);
2453
+ var D = ie(m) ? m : null, U = X(m) ? m : y, F = O || {}, Z = b.user();
2454
+ ye(Ot(ne), D);
2455
+ var W = D || U.userId || o(ne, b, U);
2456
+ return Promise.resolve(new Promise(function(M) {
2457
+ P.dispatch(A({ type: C.identifyStart, userId: W, traits: U || {}, options: F, anonymousId: Z.anonymousId }, Z.id && Z.id !== D && { previousId: Z.id }), M, [y, O, z]);
2518
2458
  }));
2519
- } catch (U) {
2520
- return Promise.reject(U);
2459
+ } catch (M) {
2460
+ return Promise.reject(M);
2521
2461
  }
2522
- }, track: function(m, g, E, $) {
2462
+ }, track: function(m, y, O, z) {
2523
2463
  try {
2524
- var z = F(m) ? m.event : m;
2525
- if (!z || !re(z))
2464
+ var D = X(m) ? m.event : m;
2465
+ if (!D || !ie(D))
2526
2466
  throw new Error("EventMissing");
2527
- var D = F(m) ? m : g || {}, K = F(E) ? E : {};
2528
- return Promise.resolve(new Promise(function(L) {
2529
- x.dispatch({ type: T.trackStart, event: z, properties: D, options: K, userId: o(te, b, g), anonymousId: o(ke, b, g) }, L, [g, E, $]);
2467
+ var U = X(m) ? m : y || {}, F = X(O) ? O : {};
2468
+ return Promise.resolve(new Promise(function(Z) {
2469
+ P.dispatch({ type: C.trackStart, event: D, properties: U, options: F, userId: o(ne, b, y), anonymousId: o(ke, b, y) }, Z, [y, O, z]);
2530
2470
  }));
2531
- } catch (L) {
2532
- return Promise.reject(L);
2471
+ } catch (Z) {
2472
+ return Promise.reject(Z);
2533
2473
  }
2534
- }, page: function(m, g, E) {
2474
+ }, page: function(m, y, O) {
2535
2475
  try {
2536
- var $ = F(m) ? m : {}, z = F(g) ? g : {};
2537
- return Promise.resolve(new Promise(function(D) {
2538
- x.dispatch({ type: T.pageStart, properties: Hi($), options: z, userId: o(te, b, $), anonymousId: o(ke, b, $) }, D, [m, g, E]);
2476
+ var z = X(m) ? m : {}, D = X(y) ? y : {};
2477
+ return Promise.resolve(new Promise(function(U) {
2478
+ P.dispatch({ type: C.pageStart, properties: Gi(z), options: D, userId: o(ne, b, z), anonymousId: o(ke, b, z) }, U, [m, y, O]);
2539
2479
  }));
2540
- } catch (D) {
2541
- return Promise.reject(D);
2480
+ } catch (U) {
2481
+ return Promise.reject(U);
2542
2482
  }
2543
2483
  }, user: function(m) {
2544
- if (m === te || m === "id")
2545
- return o(te, b);
2484
+ if (m === ne || m === "id")
2485
+ return o(ne, b);
2546
2486
  if (m === ke || m === "anonId")
2547
2487
  return o(ke, b);
2548
- var g = b.getState("user");
2549
- return m ? qt(g, m) : g;
2488
+ var y = b.getState("user");
2489
+ return m ? tn(y, m) : y;
2550
2490
  }, reset: function(m) {
2551
- return new Promise(function(g) {
2552
- x.dispatch({ type: T.resetStart }, g, m);
2491
+ return new Promise(function(y) {
2492
+ P.dispatch({ type: C.resetStart }, y, m);
2553
2493
  });
2554
2494
  }, ready: function(m) {
2555
- return l && m({ plugins: y, instance: b }), b.on(T.ready, function(g) {
2556
- m(g), l = !0;
2495
+ return l && m({ plugins: g, instance: b }), b.on(C.ready, function(y) {
2496
+ m(y), l = !0;
2557
2497
  });
2558
- }, on: function(m, g) {
2559
- if (!m || !G(g))
2498
+ }, on: function(m, y) {
2499
+ if (!m || !V(y))
2560
2500
  return !1;
2561
- if (m === T.bootstrap)
2501
+ if (m === C.bootstrap)
2562
2502
  throw new Error(".on disabled for " + m);
2563
- var E = /Start$|Start:/;
2503
+ var O = /Start$|Start:/;
2564
2504
  if (m === "*") {
2565
- var $ = function(L) {
2566
- return function(M) {
2567
- return function(U) {
2568
- return U.type.match(E) && g({ payload: U, instance: b, plugins: a }), M(U);
2505
+ var z = function(Z) {
2506
+ return function(W) {
2507
+ return function(M) {
2508
+ return M.type.match(O) && y({ payload: M, instance: b, plugins: a }), W(M);
2569
2509
  };
2570
2510
  };
2571
- }, z = function(L) {
2572
- return function(M) {
2573
- return function(U) {
2574
- return U.type.match(E) || g({ payload: U, instance: b, plugins: a }), M(U);
2511
+ }, D = function(Z) {
2512
+ return function(W) {
2513
+ return function(M) {
2514
+ return M.type.match(O) || y({ payload: M, instance: b, plugins: a }), W(M);
2575
2515
  };
2576
2516
  };
2577
2517
  };
2578
- return h($, He), h(z, Ve), function() {
2579
- d($, He), d(z, Ve);
2518
+ return f(z, Xe), f(D, Ve), function() {
2519
+ d(z, Xe), d(D, Ve);
2580
2520
  };
2581
2521
  }
2582
- var D = m.match(E) ? He : Ve, K = function(L) {
2583
- return function(M) {
2584
- return function(U) {
2585
- return U.type === m && g({ payload: U, instance: b, plugins: a, abort: k }), M(U);
2522
+ var U = m.match(O) ? Xe : Ve, F = function(Z) {
2523
+ return function(W) {
2524
+ return function(M) {
2525
+ return M.type === m && y({ payload: M, instance: b, plugins: a, abort: k }), W(M);
2586
2526
  };
2587
2527
  };
2588
2528
  };
2589
- return h(K, D), function() {
2590
- return d(K, D);
2529
+ return f(F, U), function() {
2530
+ return d(F, U);
2591
2531
  };
2592
- }, once: function(m, g) {
2593
- if (!m || !G(g))
2532
+ }, once: function(m, y) {
2533
+ if (!m || !V(y))
2594
2534
  return !1;
2595
- if (m === T.bootstrap)
2535
+ if (m === C.bootstrap)
2596
2536
  throw new Error(".once disabled for " + m);
2597
- var E = b.on(m, function($) {
2598
- g({ payload: $.payload, instance: b, plugins: a, abort: k }), E();
2537
+ var O = b.on(m, function(z) {
2538
+ y({ payload: z.payload, instance: b, plugins: a, abort: k }), O();
2599
2539
  });
2600
- return E;
2540
+ return O;
2601
2541
  }, getState: function(m) {
2602
- var g = x.getState();
2603
- return m ? qt(g, m) : Object.assign({}, g);
2542
+ var y = P.getState();
2543
+ return m ? tn(y, m) : Object.assign({}, y);
2604
2544
  }, dispatch: function(m) {
2605
- var g = re(m) ? { type: m } : m;
2606
- if (Be.includes(g.type))
2607
- throw new Error("reserved action " + g.type);
2608
- var E = P({}, g, { _: P({ originalAction: g.type }, m._ || {}) });
2609
- x.dispatch(E);
2610
- }, enablePlugin: y.enable, disablePlugin: y.disable, plugins: y, storage: { getItem: i.getItem, setItem: function(m, g, E) {
2611
- x.dispatch({ type: T.setItemStart, key: m, value: g, options: E });
2612
- }, removeItem: function(m, g) {
2613
- x.dispatch({ type: T.removeItemStart, key: m, options: g });
2614
- } }, setAnonymousId: function(m, g) {
2615
- b.storage.setItem(ie, m, g);
2616
- }, events: { core: Be, plugins: s } }, C = r.middlewares.concat([function(m) {
2617
- return function(g) {
2618
- return function(E) {
2619
- return E.meta || (E.meta = wn()), g(E);
2545
+ var y = ie(m) ? { type: m } : m;
2546
+ if (qe.includes(y.type))
2547
+ throw new Error("reserved action " + y.type);
2548
+ var O = A({}, y, { _: A({ originalAction: y.type }, m._ || {}) });
2549
+ P.dispatch(O);
2550
+ }, enablePlugin: g.enable, disablePlugin: g.disable, plugins: g, storage: { getItem: i.getItem, setItem: function(m, y, O) {
2551
+ P.dispatch({ type: C.setItemStart, key: m, value: y, options: O });
2552
+ }, removeItem: function(m, y) {
2553
+ P.dispatch({ type: C.removeItemStart, key: m, options: y });
2554
+ } }, setAnonymousId: function(m, y) {
2555
+ b.storage.setItem(oe, m, y);
2556
+ }, events: { core: qe, plugins: s } }, T = r.middlewares.concat([function(m) {
2557
+ return function(y) {
2558
+ return function(O) {
2559
+ return O.meta || (O.meta = In()), y(O);
2620
2560
  };
2621
2561
  };
2622
- }, w(He), Li(b, u, { all: f, plugins: s }), Ri(i), $i(b), Ni(b), w(Ve)]), O = { context: Gi, user: zi(i), page: Yi, track: Ki, plugins: Wi(u), queue: Xi }, A = Pe, Z = Pe;
2623
- if (Y && t.debug) {
2562
+ }, w(Xe), Zi(b, u, { all: p, plugins: s }), Wi(i), Di(b), Li(b), w(Ve)]), j = { context: Qi, user: Ui(i), page: qi, track: Hi, plugins: Fi(u), queue: Vi }, $ = Pe, L = Pe;
2563
+ if (J && t.debug) {
2624
2564
  var I = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
2625
- I && (A = I({ trace: !0, traceLimit: 25 })), Z = function() {
2626
- return arguments.length === 0 ? sr() : F(typeof arguments[0]) ? vn() : vn().apply(null, arguments);
2565
+ I && ($ = I({ trace: !0, traceLimit: 25 })), L = function() {
2566
+ return arguments.length === 0 ? hr() : X(typeof arguments[0]) ? kn() : kn().apply(null, arguments);
2627
2567
  };
2628
2568
  }
2629
- var j, N = function(m) {
2630
- return Object.keys(m).reduce(function(g, E) {
2631
- return Bi.includes(E) || (g[E] = m[E]), g;
2569
+ var x, E = function(m) {
2570
+ return Object.keys(m).reduce(function(y, O) {
2571
+ return eo.includes(O) || (y[O] = m[O]), y;
2632
2572
  }, {});
2633
- }(t), W = r.pluginsArray.reduce(function(m, g) {
2634
- var E = g.name, $ = g.config, z = g.loaded, D = r.pluginEnabled[E];
2635
- return m[E] = { enabled: D, initialized: !!D && !g.initialize, loaded: !!z({ config: $ }), config: $ }, m;
2636
- }, {}), R = { context: N, user: S, plugins: W }, x = Bn(function(m) {
2637
- for (var g = Object.keys(m), E = {}, $ = 0; $ < g.length; $++) {
2638
- var z = g[$];
2639
- typeof m[z] === ne && (E[z] = m[z]);
2573
+ }(t), N = r.pluginsArray.reduce(function(m, y) {
2574
+ var O = y.name, z = y.config, D = y.loaded, U = r.pluginEnabled[O];
2575
+ return m[O] = { enabled: U, initialized: !!U && !y.initialize, loaded: !!D({ config: z }), config: z }, m;
2576
+ }, {}), R = { context: E, user: S, plugins: N }, P = nr(function(m) {
2577
+ for (var y = Object.keys(m), O = {}, z = 0; z < y.length; z++) {
2578
+ var D = y[z];
2579
+ typeof m[D] === re && (O[D] = m[D]);
2640
2580
  }
2641
- var D, K = Object.keys(E);
2581
+ var U, F = Object.keys(O);
2642
2582
  try {
2643
- (function(L) {
2644
- Object.keys(L).forEach(function(M) {
2645
- var U = L[M];
2646
- if (typeof U(void 0, { type: "@@redux/INIT" }) === ee || typeof U(void 0, { type: xi }) === ee)
2647
- throw new Error("reducer " + M + " " + ee);
2583
+ (function(Z) {
2584
+ Object.keys(Z).forEach(function(W) {
2585
+ var M = Z[W];
2586
+ if (typeof M(void 0, { type: "@@redux/INIT" }) === te || typeof M(void 0, { type: $i }) === te)
2587
+ throw new Error("reducer " + W + " " + te);
2648
2588
  });
2649
- })(E);
2650
- } catch (L) {
2651
- D = L;
2589
+ })(O);
2590
+ } catch (Z) {
2591
+ U = Z;
2652
2592
  }
2653
- return function(L, M) {
2654
- if (L === void 0 && (L = {}), D)
2655
- throw D;
2656
- for (var U = !1, q = {}, Ae = 0; Ae < K.length; Ae++) {
2657
- var Me = K[Ae], Rt = L[Me], ct = (0, E[Me])(Rt, M);
2658
- if (typeof ct === ee) {
2659
- var vr = Ci(Me, M);
2660
- throw new Error(vr);
2593
+ return function(Z, W) {
2594
+ if (Z === void 0 && (Z = {}), U)
2595
+ throw U;
2596
+ for (var M = !1, q = {}, Ae = 0; Ae < F.length; Ae++) {
2597
+ var We = F[Ae], Wt = Z[We], ut = (0, O[We])(Wt, W);
2598
+ if (typeof ut === te) {
2599
+ var Sr = zi(We, W);
2600
+ throw new Error(Sr);
2661
2601
  }
2662
- q[Me] = ct, U = U || ct !== Rt;
2602
+ q[We] = ut, M = M || ut !== Wt;
2663
2603
  }
2664
- return U ? q : L;
2604
+ return M ? q : Z;
2665
2605
  };
2666
- }(P({}, O, e)), R, Z(A(Ai.apply(void 0, C))));
2667
- x.dispatch = (j = x.dispatch, function(m, g, E) {
2668
- var $ = P({}, m, { meta: wn(m.meta, g, gt(E)) });
2669
- return j.apply(null, [$]);
2606
+ }(A({}, j, e)), R, L($(Ni.apply(void 0, T))));
2607
+ P.dispatch = (x = P.dispatch, function(m, y, O) {
2608
+ var z = A({}, m, { meta: In(m.meta, y, yt(O)) });
2609
+ return x.apply(null, [z]);
2670
2610
  });
2671
- var J = Object.keys(a);
2672
- x.dispatch({ type: T.bootstrap, plugins: J, config: N, params: v, user: S, initialUser: n, persistedUser: _ });
2673
- var X = J.filter(function(m) {
2611
+ var K = Object.keys(a);
2612
+ P.dispatch({ type: C.bootstrap, plugins: K, config: E, params: v, user: S, initialUser: n, persistedUser: _ });
2613
+ var H = K.filter(function(m) {
2674
2614
  return r.pluginEnabled[m];
2675
- }), Ce = J.filter(function(m) {
2615
+ }), Ce = K.filter(function(m) {
2676
2616
  return !r.pluginEnabled[m];
2677
2617
  });
2678
- return x.dispatch({ type: T.registerPlugins, plugins: J, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, g) {
2679
- var E = m.bootstrap, $ = m.config, z = m.name;
2680
- E && G(E) && E({ instance: b, config: $, payload: m }), x.dispatch({ type: T.registerPluginType(z), name: z, enabled: r.pluginEnabled[z], plugin: m }), r.pluginsArray.length === g + 1 && x.dispatch({ type: T.initializeStart, plugins: X, disabled: Ce });
2681
- }), Qi(function(m) {
2682
- x.dispatch({ type: m ? T.offline : T.online });
2683
- }), function(m, g, E) {
2618
+ return P.dispatch({ type: C.registerPlugins, plugins: K, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, y) {
2619
+ var O = m.bootstrap, z = m.config, D = m.name;
2620
+ O && V(O) && O({ instance: b, config: z, payload: m }), P.dispatch({ type: C.registerPluginType(D), name: D, enabled: r.pluginEnabled[D], plugin: m }), r.pluginsArray.length === y + 1 && P.dispatch({ type: C.initializeStart, plugins: H, disabled: Ce });
2621
+ }), no(function(m) {
2622
+ P.dispatch({ type: m ? C.offline : C.online });
2623
+ }), function(m, y, O) {
2684
2624
  setInterval(function() {
2685
- return Qn(m, g, E);
2625
+ return ir(m, y, O);
2686
2626
  }, 3e3);
2687
- }(x, u, b), b;
2627
+ }(P, u, b), b;
2688
2628
  }
2689
- var He = "before", Ve = "after", Ue = "cookie", ue = lr(), cr = at, to = at;
2690
- function ur(t) {
2691
- return ue ? at(t, "", -1) : je(t);
2629
+ var Xe = "before", Ve = "after", Ue = "cookie", ue = mr(), fr = st, io = st;
2630
+ function pr(t) {
2631
+ return ue ? st(t, "", -1) : je(t);
2692
2632
  }
2693
- function lr() {
2633
+ function mr() {
2694
2634
  if (ue !== void 0)
2695
2635
  return ue;
2696
2636
  var t = "cookiecookie";
2697
2637
  try {
2698
- at(t, t), ue = document.cookie.indexOf(t) !== -1, ur(t);
2638
+ st(t, t), ue = document.cookie.indexOf(t) !== -1, pr(t);
2699
2639
  } catch {
2700
2640
  ue = !1;
2701
2641
  }
2702
2642
  return ue;
2703
2643
  }
2704
- function at(t, e, n, r, i, o) {
2644
+ function st(t, e, n, r, i, o) {
2705
2645
  if (typeof window < "u") {
2706
2646
  var a = arguments.length > 1;
2707
2647
  return ue === !1 && (a ? ye(t, e) : ge(t)), a ? document.cookie = t + "=" + encodeURIComponent(e) + (n ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * n).toUTCString() + (r ? "; path=" + r : "") + (i ? "; domain=" + i : "") + (o ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + t + "=")[1] || "").split(";")[0]);
2708
2648
  }
2709
2649
  }
2710
- var Le = "localStorage", no = At.bind(null, "localStorage");
2650
+ var Le = "localStorage", oo = Nt.bind(null, "localStorage");
2711
2651
  xe("localStorage", "getItem", ge);
2712
2652
  xe("localStorage", "setItem", ye);
2713
2653
  xe("localStorage", "removeItem", je);
2714
- var Re = "sessionStorage", ro = At.bind(null, "sessionStorage");
2654
+ var Re = "sessionStorage", ao = Nt.bind(null, "sessionStorage");
2715
2655
  xe("sessionStorage", "getItem", ge);
2716
2656
  xe("sessionStorage", "setItem", ye);
2717
2657
  xe("sessionStorage", "removeItem", je);
2718
- function Se(t) {
2658
+ function _e(t) {
2719
2659
  var e = t;
2720
2660
  try {
2721
2661
  if ((e = JSON.parse(t)) === "true")
2722
2662
  return !0;
2723
2663
  if (e === "false")
2724
2664
  return !1;
2725
- if (F(e))
2665
+ if (X(e))
2726
2666
  return e;
2727
2667
  parseFloat(e) === e && (e = parseFloat(e));
2728
2668
  } catch {
@@ -2730,57 +2670,57 @@ function Se(t) {
2730
2670
  if (e !== null && e !== "")
2731
2671
  return e;
2732
2672
  }
2733
- var io = no(), oo = ro(), ao = lr();
2734
- function dr(t, e) {
2673
+ var so = oo(), co = ao(), uo = mr();
2674
+ function gr(t, e) {
2735
2675
  if (t) {
2736
- var n = $t(e), r = !Ut(n), i = zt(n) ? Se(localStorage.getItem(t)) : void 0;
2676
+ var n = Dt(e), r = !Mt(n), i = Ut(n) ? _e(localStorage.getItem(t)) : void 0;
2737
2677
  if (r && !be(i))
2738
2678
  return i;
2739
- var o = Nt(n) ? Se(cr(t)) : void 0;
2679
+ var o = Lt(n) ? _e(fr(t)) : void 0;
2740
2680
  if (r && o)
2741
2681
  return o;
2742
- var a = Dt(n) ? Se(sessionStorage.getItem(t)) : void 0;
2682
+ var a = Rt(n) ? _e(sessionStorage.getItem(t)) : void 0;
2743
2683
  if (r && a)
2744
2684
  return a;
2745
2685
  var s = ge(t);
2746
2686
  return r ? s : { localStorage: i, sessionStorage: a, cookie: o, global: s };
2747
2687
  }
2748
2688
  }
2749
- function so(t, e, n) {
2689
+ function lo(t, e, n) {
2750
2690
  if (t && !be(e)) {
2751
- var r = {}, i = $t(n), o = JSON.stringify(e), a = !Ut(i);
2752
- return zt(i) && (r[Le] = Ye(Le, e, Se(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[Le] : Nt(i) && (r[Ue] = Ye(Ue, e, Se(cr(t))), to(t, o), a) ? r[Ue] : Dt(i) && (r[Re] = Ye(Re, e, Se(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[Re] : (r[De] = Ye(De, e, ge(t)), ye(t, e), a ? r[De] : r);
2691
+ var r = {}, i = Dt(n), o = JSON.stringify(e), a = !Mt(i);
2692
+ return Ut(i) && (r[Le] = Ye(Le, e, _e(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[Le] : Lt(i) && (r[Ue] = Ye(Ue, e, _e(fr(t))), io(t, o), a) ? r[Ue] : Rt(i) && (r[Re] = Ye(Re, e, _e(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[Re] : (r[De] = Ye(De, e, ge(t)), ye(t, e), a ? r[De] : r);
2753
2693
  }
2754
2694
  }
2755
- function co(t, e) {
2695
+ function ho(t, e) {
2756
2696
  if (t) {
2757
- var n = $t(e), r = dr(t, Fn), i = {};
2758
- return !be(r.localStorage) && zt(n) && (localStorage.removeItem(t), i[Le] = r.localStorage), !be(r.cookie) && Nt(n) && (ur(t), i[Ue] = r.cookie), !be(r.sessionStorage) && Dt(n) && (sessionStorage.removeItem(t), i[Re] = r.sessionStorage), !be(r.global) && st(n, De) && (je(t), i[De] = r.global), i;
2697
+ var n = Dt(e), r = gr(t, Bn), i = {};
2698
+ return !be(r.localStorage) && Ut(n) && (localStorage.removeItem(t), i[Le] = r.localStorage), !be(r.cookie) && Lt(n) && (pr(t), i[Ue] = r.cookie), !be(r.sessionStorage) && Rt(n) && (sessionStorage.removeItem(t), i[Re] = r.sessionStorage), !be(r.global) && ct(n, De) && (je(t), i[De] = r.global), i;
2759
2699
  }
2760
2700
  }
2761
- function $t(t) {
2762
- return t ? re(t) ? t : t.storage : Xn;
2701
+ function Dt(t) {
2702
+ return t ? ie(t) ? t : t.storage : Gn;
2763
2703
  }
2764
- function zt(t) {
2765
- return io && st(t, Le);
2704
+ function Ut(t) {
2705
+ return so && ct(t, Le);
2766
2706
  }
2767
- function Nt(t) {
2768
- return ao && st(t, Ue);
2707
+ function Lt(t) {
2708
+ return uo && ct(t, Ue);
2769
2709
  }
2770
- function Dt(t) {
2771
- return oo && st(t, Re);
2710
+ function Rt(t) {
2711
+ return co && ct(t, Re);
2772
2712
  }
2773
- function Ut(t) {
2774
- return t === Fn || t === "all";
2713
+ function Mt(t) {
2714
+ return t === Bn || t === "all";
2775
2715
  }
2776
- function st(t, e) {
2777
- return t === Xn || t === e || Ut(t);
2716
+ function ct(t, e) {
2717
+ return t === Gn || t === e || Mt(t);
2778
2718
  }
2779
2719
  function Ye(t, e, n) {
2780
2720
  return { location: t, current: e, previous: n };
2781
2721
  }
2782
- var uo = { setItem: so, getItem: dr, removeItem: co };
2783
- function lo(t, e, n) {
2722
+ var fo = { setItem: lo, getItem: gr, removeItem: ho };
2723
+ function po(t, e, n) {
2784
2724
  return e in t ? Object.defineProperty(t, e, {
2785
2725
  value: n,
2786
2726
  enumerable: !0,
@@ -2788,7 +2728,7 @@ function lo(t, e, n) {
2788
2728
  writable: !0
2789
2729
  }) : t[e] = n, t;
2790
2730
  }
2791
- function bn(t, e) {
2731
+ function Sn(t, e) {
2792
2732
  var n = Object.keys(t);
2793
2733
  if (Object.getOwnPropertySymbols) {
2794
2734
  var r = Object.getOwnPropertySymbols(t);
@@ -2798,24 +2738,24 @@ function bn(t, e) {
2798
2738
  }
2799
2739
  return n;
2800
2740
  }
2801
- function kn(t) {
2741
+ function _n(t) {
2802
2742
  for (var e = 1; e < arguments.length; e++) {
2803
2743
  var n = arguments[e] != null ? arguments[e] : {};
2804
- e % 2 ? bn(Object(n), !0).forEach(function(r) {
2805
- lo(t, r, n[r]);
2806
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : bn(Object(n)).forEach(function(r) {
2744
+ e % 2 ? Sn(Object(n), !0).forEach(function(r) {
2745
+ po(t, r, n[r]);
2746
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Sn(Object(n)).forEach(function(r) {
2807
2747
  Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
2808
2748
  });
2809
2749
  }
2810
2750
  return t;
2811
2751
  }
2812
- function ho() {
2752
+ function mo() {
2813
2753
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = {
2814
- storage: uo
2754
+ storage: fo
2815
2755
  };
2816
- return eo(kn(kn({}, e), t));
2756
+ return ro(_n(_n({}, e), t));
2817
2757
  }
2818
- function fo(t, e) {
2758
+ function go(t, e) {
2819
2759
  e = e || {};
2820
2760
  var n, r, i = [], o = e.max || 1 / 0;
2821
2761
  function a() {
@@ -2826,18 +2766,18 @@ function fo(t, e) {
2826
2766
  }
2827
2767
  return s(), {
2828
2768
  flush: a,
2829
- push: function(p) {
2830
- return r = i.push(p), r >= o && a(), r;
2769
+ push: function(h) {
2770
+ return r = i.push(h), r >= o && a(), r;
2831
2771
  },
2832
2772
  size: function() {
2833
2773
  return i.length;
2834
2774
  },
2835
- end: function(p) {
2836
- p && a(), clearInterval(n);
2775
+ end: function(h) {
2776
+ h && a(), clearInterval(n);
2837
2777
  }
2838
2778
  };
2839
2779
  }
2840
- function po(t) {
2780
+ function yo(t) {
2841
2781
  if (typeof window > "u")
2842
2782
  return;
2843
2783
  const { addEventListener: e, history: n, location: r } = window;
@@ -2847,52 +2787,107 @@ function po(t) {
2847
2787
  if (a !== "pushState" && a !== "replaceState")
2848
2788
  return;
2849
2789
  const s = n[a];
2850
- n[a] = function(...p) {
2790
+ n[a] = function(...h) {
2851
2791
  var c;
2852
- const f = ((c = p[2]) == null ? void 0 : c.toString()) || "", u = go(f);
2853
- return i !== u && (i = u, setTimeout(() => t(f), 0)), s.apply(n, p);
2792
+ const p = ((c = h[2]) == null ? void 0 : c.toString()) || "", u = wo(p);
2793
+ return i !== u && (i = u, setTimeout(() => t(p), 0)), s.apply(n, h);
2854
2794
  };
2855
2795
  });
2856
2796
  }
2857
- function mo(t, e) {
2797
+ function vo(t, e) {
2858
2798
  const n = t.indexOf(e);
2859
2799
  return n > -1 ? t.slice(0, n) : t;
2860
2800
  }
2861
- function go(t) {
2862
- return ["#", "?"].forEach((e) => t = mo(t, e)), t;
2801
+ function wo(t) {
2802
+ return ["#", "?"].forEach((e) => t = vo(t, e)), t;
2863
2803
  }
2864
- function yo() {
2865
- po(() => {
2866
- se.page();
2804
+ function bo() {
2805
+ yo(() => {
2806
+ ee.page();
2867
2807
  });
2868
2808
  }
2869
- var In = "EventListener";
2870
- function vo(t) {
2809
+ function ko(t) {
2810
+ if (t === void 0 && (t = {}), !J)
2811
+ return _t;
2812
+ var e = On(), n = Tt(), r = En(), i = Ge(r, e), o = Ge(n, e), a = [], s = [], h = [], p = r, u = i, c = o, f = Object.keys(t);
2813
+ if (!f.length)
2814
+ return _t;
2815
+ var d = f.map(function(k) {
2816
+ return Number(k);
2817
+ }), w = Ai(function() {
2818
+ var k = On(), v = function(E, N) {
2819
+ return N.map(function(R) {
2820
+ return R === 100 ? E - 5 : E * (R / 100);
2821
+ });
2822
+ }(k, d), _ = Tt(), S = En(), g = Ge(S, k), l = Ge(_, k);
2823
+ if (u = g > u ? g : u, c = l < c ? l : c, !(a.length >= d.length)) {
2824
+ var b = p === S, T = "up";
2825
+ b ? T = "initial" : p <= S && (T = "down");
2826
+ var j = v, $ = d;
2827
+ (T === "up" || b) && (j = v.slice().reverse(), $ = d.slice().reverse());
2828
+ var L = $.reduce(function(E, N, R) {
2829
+ var P = j[R];
2830
+ return h.includes(N) && S <= P && (h = h.filter(function(K) {
2831
+ return K !== N;
2832
+ }), E.singleFunction = N), T === "down" && !a.includes(N) && S >= P && N > o ? (s.push(N), E.callbacks = E.callbacks.concat(N), E) : T === "up" && !a.includes(N) && S <= P && N <= g ? (E.foundFunc = [N], E) : (b && S >= P && E.foundFunc.length === 0 && (E.foundFunc = [N]), !s.includes(N) && S >= P && (s.push(N), E.singleFunction ? h.push(N) : E.singleFunction = N), E);
2833
+ }, { foundFunc: [], singleFunction: null, callbacks: [], direction: T });
2834
+ if (p = S, T === "down" && L.callbacks && L.callbacks.forEach(function(E) {
2835
+ V(t[E]) && (t[E]({ trigger: E, direction: T, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(E));
2836
+ }), L.singleFunction) {
2837
+ var I = L.singleFunction, x = L.direction;
2838
+ V(t[I]) && t[I]({ trigger: I, direction: x, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(I);
2839
+ }
2840
+ }
2841
+ }, 500);
2842
+ return window.addEventListener("scroll", w), function() {
2843
+ return window.removeEventListener("scroll", w);
2844
+ };
2845
+ }
2846
+ function Tt() {
2847
+ return J ? document.body.scrollTop || document.documentElement.scrollTop : 0;
2848
+ }
2849
+ function Io() {
2850
+ return J ? window.innerHeight || document.documentElement.clientHeight : 0;
2851
+ }
2852
+ function En() {
2853
+ return Math.round(Tt() + Io());
2854
+ }
2855
+ function On() {
2856
+ if (!J)
2857
+ return 0;
2858
+ var t = document.body, e = document.documentElement;
2859
+ return Math.max(t.scrollHeight, t.offsetHeight, e.clientHeight, e.scrollHeight, e.offsetHeight);
2860
+ }
2861
+ function Ge(t, e) {
2862
+ return Math.round(t / e * 100);
2863
+ }
2864
+ var Tn = "EventListener";
2865
+ function So(t) {
2871
2866
  return function(e, n, r, i) {
2872
- var o = r || mi, a = i || !1;
2873
- if (!Y)
2867
+ var o = r || _t, a = i || !1;
2868
+ if (!J)
2874
2869
  return o;
2875
- var s = et(n), p = et(e, !0);
2876
- if (!p.length)
2870
+ var s = tt(n), h = tt(e, !0);
2871
+ if (!h.length)
2877
2872
  throw new Error("noElements");
2878
2873
  if (!s.length)
2879
2874
  throw new Error("noEvent");
2880
- var f = [];
2875
+ var p = [];
2881
2876
  return function u(c) {
2882
- c && (f = []);
2883
- for (var h = c ? "add" + In : "remove" + In, d = 0; d < p.length; d++) {
2884
- var w = p[d];
2885
- f[d] = c ? a && a.once ? wo(o) : o : f[d] || o;
2877
+ c && (p = []);
2878
+ for (var f = c ? "add" + Tn : "remove" + Tn, d = 0; d < h.length; d++) {
2879
+ var w = h[d];
2880
+ p[d] = c ? a && a.once ? _o(o) : o : p[d] || o;
2886
2881
  for (var k = 0; k < s.length; k++)
2887
- w[h] ? w["on" + s[k]] = c ? f[d] : null : w[h](s[k], f[d], a);
2882
+ w[f] ? w["on" + s[k]] = c ? p[d] : null : w[f](s[k], p[d], a);
2888
2883
  }
2889
2884
  return u.bind(null, !c);
2890
2885
  }(t);
2891
2886
  };
2892
2887
  }
2893
- function et(t, e) {
2894
- if (re(t))
2895
- return e ? et(document.querySelectorAll(t)) : (n = t).split(n.indexOf(",") > -1 ? "," : " ").map(function(a) {
2888
+ function tt(t, e) {
2889
+ if (ie(t))
2890
+ return e ? tt(document.querySelectorAll(t)) : (n = t).split(n.indexOf(",") > -1 ? "," : " ").map(function(a) {
2896
2891
  return a.trim();
2897
2892
  });
2898
2893
  var n;
@@ -2901,31 +2896,31 @@ function et(t, e) {
2901
2896
  r[i] = t[i];
2902
2897
  return r;
2903
2898
  }
2904
- var o = Ei(t);
2899
+ var o = Ti(t);
2905
2900
  return e ? o.map(function(a) {
2906
- return re(a) ? et(a, !0) : a;
2901
+ return ie(a) ? tt(a, !0) : a;
2907
2902
  }).flat() : o;
2908
2903
  }
2909
- function wo(t, e) {
2904
+ function _o(t, e) {
2910
2905
  var n;
2911
2906
  return function() {
2912
2907
  return t && (n = t.apply(e || this, arguments), t = null), n;
2913
2908
  };
2914
2909
  }
2915
- var yt = vo("Event");
2916
- function hr(t, e) {
2917
- return Y && G(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), G(n) ? function() {
2910
+ var vt = So("Event");
2911
+ function yr(t, e) {
2912
+ return J && V(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), V(n) ? function() {
2918
2913
  n.apply(i, arguments), r.apply(i, arguments);
2919
2914
  } : r) : window[t] = e;
2920
2915
  var n, r, i;
2921
2916
  }
2922
- hr.bind(null, "onerror");
2923
- hr.bind(null, "onload");
2924
- var fr = typeof window > "u", _n = "hidden";
2925
- function bo(t) {
2926
- if (fr)
2917
+ yr.bind(null, "onerror");
2918
+ yr.bind(null, "onload");
2919
+ var vr = typeof window > "u", Pn = "hidden";
2920
+ function Eo(t) {
2921
+ if (vr)
2927
2922
  return !1;
2928
- var e = ko(), n = "".concat(e.replace(/[H|h]idden/, ""), "visibilitychange"), r = function() {
2923
+ var e = Oo(), n = "".concat(e.replace(/[H|h]idden/, ""), "visibilitychange"), r = function() {
2929
2924
  return t(!!document[e]);
2930
2925
  }, i = function() {
2931
2926
  return document.addEventListener(n, r);
@@ -2934,31 +2929,31 @@ function bo(t) {
2934
2929
  return document.removeEventListener(n, r), i;
2935
2930
  };
2936
2931
  }
2937
- function ko() {
2932
+ function Oo() {
2938
2933
  var t = ["webkit", "moz", "ms", "o"];
2939
- return fr || _n in document ? _n : t.reduce(function(e, n) {
2934
+ return vr || Pn in document ? Pn : t.reduce(function(e, n) {
2940
2935
  var r = n + "Hidden";
2941
2936
  return !e && r in document ? r : e;
2942
2937
  }, null);
2943
2938
  }
2944
- var Io = ["mousemove", "mousedown", "touchmove", "touchstart", "touchend", "keydown"];
2945
- function _o(t, e) {
2939
+ var To = ["mousemove", "mousedown", "touchmove", "touchstart", "touchend", "keydown"];
2940
+ function Po(t, e) {
2946
2941
  e === void 0 && (e = {});
2947
2942
  var n = /* @__PURE__ */ function(a, s) {
2948
- var p = this, f = !1;
2943
+ var h = this, p = !1;
2949
2944
  return function(u) {
2950
- f || (a.call(p, u), f = !0, setTimeout(function() {
2951
- return f = !1;
2945
+ p || (a.call(h, u), p = !0, setTimeout(function() {
2946
+ return p = !1;
2952
2947
  }, s));
2953
2948
  };
2954
2949
  }(t, e.throttle || 1e4), r = [];
2955
2950
  function i() {
2956
- var a = bo(function(s) {
2951
+ var a = Eo(function(s) {
2957
2952
  s || n({ type: "tabVisible" });
2958
2953
  });
2959
- return r = [a].concat(Io.map(function(s) {
2960
- return yt(document, s, n);
2961
- })).concat(yt(window, "load", n)).concat(yt(window, "scroll", n, { capture: !0, passive: !0 })), o;
2954
+ return r = [a].concat(To.map(function(s) {
2955
+ return vt(document, s, n);
2956
+ })).concat(vt(window, "load", n)).concat(vt(window, "scroll", n, { capture: !0, passive: !0 })), o;
2962
2957
  }
2963
2958
  function o() {
2964
2959
  r.map(function(a) {
@@ -2969,31 +2964,31 @@ function _o(t, e) {
2969
2964
  return o(), i;
2970
2965
  };
2971
2966
  }
2972
- function So(t) {
2973
- var e, n, r = t.onIdle, i = t.onWakeUp, o = t.onHeartbeat, a = t.timeout, s = a === void 0 ? 1e4 : a, p = t.throttle, f = p === void 0 ? 2e3 : p, u = !1, c = !1, h = /* @__PURE__ */ new Date(), d = function() {
2967
+ function jo(t) {
2968
+ var e, n, r = t.onIdle, i = t.onWakeUp, o = t.onHeartbeat, a = t.timeout, s = a === void 0 ? 1e4 : a, h = t.throttle, p = h === void 0 ? 2e3 : h, u = !1, c = !1, f = /* @__PURE__ */ new Date(), d = function() {
2974
2969
  return clearTimeout(e);
2975
2970
  };
2976
2971
  function w(v) {
2977
- d(), o && !u && o(ze(h), v), i && u && (u = !1, i(ze(n), v), h = /* @__PURE__ */ new Date()), e = setTimeout(function() {
2978
- u = !0, r && (n = /* @__PURE__ */ new Date(), r(ze(h), v));
2972
+ d(), o && !u && o(ze(f), v), i && u && (u = !1, i(ze(n), v), f = /* @__PURE__ */ new Date()), e = setTimeout(function() {
2973
+ u = !0, r && (n = /* @__PURE__ */ new Date(), r(ze(f), v));
2979
2974
  }, s);
2980
2975
  }
2981
- var k = _o(w, { throttle: f });
2976
+ var k = Po(w, { throttle: p });
2982
2977
  return { disable: function() {
2983
2978
  c = !0, u = !1, d();
2984
2979
  var v = k();
2985
2980
  return function() {
2986
- return c = !1, h = /* @__PURE__ */ new Date(), w({ type: "load" }), v();
2981
+ return c = !1, f = /* @__PURE__ */ new Date(), w({ type: "load" }), v();
2987
2982
  };
2988
2983
  }, getStatus: function() {
2989
- return { isIdle: u, isDisabled: c, active: u ? 0 : ze(h, c), idle: u ? ze(n, c) : 0 };
2984
+ return { isIdle: u, isDisabled: c, active: u ? 0 : ze(f, c), idle: u ? ze(n, c) : 0 };
2990
2985
  } };
2991
2986
  }
2992
2987
  function ze(t, e) {
2993
2988
  return e ? 0 : Math.round((/* @__PURE__ */ new Date() - t) / 1e3);
2994
2989
  }
2995
- const Sn = 5e3;
2996
- class Eo {
2990
+ const jn = 5e3;
2991
+ class xo {
2997
2992
  constructor(e) {
2998
2993
  B(this, "element");
2999
2994
  B(this, "isInViewport", !1);
@@ -3005,7 +3000,8 @@ class Eo {
3005
3000
  B(this, "viewCallback");
3006
3001
  B(this, "activeDurationCallback");
3007
3002
  B(this, "idleDurationCallback");
3008
- this.element = e.element, this.viewCallback = e.viewCallback, this.activeDurationCallback = e.activeDurationCallback, this.idleDurationCallback = e.idleDurationCallback, this.observer = new IntersectionObserver(
3003
+ B(this, "scrollCallback");
3004
+ this.element = e.element, this.viewCallback = e.viewCallback, this.activeDurationCallback = e.activeDurationCallback, this.idleDurationCallback = e.idleDurationCallback, this.scrollCallback = e.scrollCallback, this.observer = new IntersectionObserver(
3009
3005
  (n) => {
3010
3006
  n.forEach((r) => {
3011
3007
  this.handleInViewPort(r.isIntersecting);
@@ -3014,10 +3010,16 @@ class Eo {
3014
3010
  {
3015
3011
  threshold: 0
3016
3012
  }
3017
- ), this.observer.observe(this.element), So({
3013
+ ), this.observer.observe(this.element), jo({
3018
3014
  onIdle: (n) => this.handleAwake(!1, n),
3019
3015
  onWakeUp: (n) => this.handleAwake(!0, n),
3020
- timeout: Sn
3016
+ timeout: jn
3017
+ }), ko({
3018
+ 25: this.handleScroll.bind(this),
3019
+ 50: this.handleScroll.bind(this),
3020
+ 75: this.handleScroll.bind(this),
3021
+ 90: this.handleScroll.bind(this),
3022
+ 100: this.handleScroll.bind(this)
3021
3023
  });
3022
3024
  }
3023
3025
  /**
@@ -3030,7 +3032,10 @@ class Eo {
3030
3032
  e ? (this.isAwake = !0, this.trackInViewport()) : this.handleAwake(!1), this.isInViewport = e;
3031
3033
  }
3032
3034
  handleAwake(e, n = Math.round((Date.now() - this.lastEventAt) / 1e3)) {
3033
- this.isAwake = e, this.lastEventAt = e ? Date.now() - n * Sn : Date.now(), this.isInViewport && this.trackAwake(e, n);
3035
+ this.isAwake = e, this.lastEventAt = e ? Date.now() - n * jn : Date.now(), this.isInViewport && this.trackAwake(e, n);
3036
+ }
3037
+ handleScroll(e) {
3038
+ this.scrollCallback && this.scrollCallback(e);
3034
3039
  }
3035
3040
  handleVisibilityChange() {
3036
3041
  this.isAwake = !1;
@@ -3044,56 +3049,61 @@ class Eo {
3044
3049
  this.registeredView || (this.registeredView = !0, this.viewCallback && this.viewCallback());
3045
3050
  }
3046
3051
  }
3047
- const En = "sesamy_session_id";
3048
- function Oo() {
3049
- let t = sessionStorage.getItem(En);
3050
- return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(En, t)), t;
3052
+ const xn = "sesamy_session_id";
3053
+ function Co() {
3054
+ let t = sessionStorage.getItem(xn);
3055
+ return t || (t = Math.random().toString(36).slice(2, 9), sessionStorage.setItem(xn, t)), t;
3051
3056
  }
3052
- let pr = !1, Et, On, tt;
3053
- function To({ clientId: t, enabled: e = !0, endpoint: n = Fr }) {
3054
- if (Et = t, On = e, tt = n, !On)
3057
+ let wr = !1, Pt, Cn, nt;
3058
+ function Ao({ clientId: t, enabled: e = !0, endpoint: n = Br }) {
3059
+ if (Pt = t, Cn = e, nt = n, !Cn)
3055
3060
  return;
3056
- yo();
3057
- const r = new Eo({
3061
+ bo();
3062
+ const r = new xo({
3058
3063
  element: document.body,
3059
3064
  viewCallback: () => {
3060
- se.page();
3065
+ ee.page();
3061
3066
  },
3062
3067
  activeDurationCallback: (i, o, a) => {
3063
- se.track("activeDuration", {
3068
+ ee.track("activeDuration", {
3064
3069
  duration: i,
3065
3070
  durationStart: a,
3066
3071
  flushing: o
3067
3072
  });
3068
3073
  },
3069
3074
  idleDurationCallback: (i, o, a) => {
3070
- se.track("idleDuration", {
3075
+ ee.track("idleDuration", {
3071
3076
  duration: i,
3072
3077
  durationStart: a,
3073
3078
  flushing: o
3074
3079
  });
3080
+ },
3081
+ scrollCallback: (i) => {
3082
+ ee.track("scroll", {
3083
+ scroll: i.scrollMax
3084
+ });
3075
3085
  }
3076
3086
  });
3077
- jo(document.body, () => {
3087
+ No(document.body, () => {
3078
3088
  r.flush();
3079
- }), xo(document.body, () => {
3089
+ }), Do(document.body, () => {
3080
3090
  r.handleVisibilityChange();
3081
3091
  }), window.addEventListener(pe.AUTHENTICATED, async (i) => {
3082
3092
  const o = i;
3083
- await se.identify(o.detail.sub);
3093
+ await ee.identify(o.detail.sub);
3084
3094
  }), window.addEventListener(pe.LOGOUT, async () => {
3085
- await se.track("logout", {}), Lt.flush(), await se.reset();
3095
+ await ee.track("logout", {}), Zt.flush(), await ee.reset();
3086
3096
  });
3087
3097
  }
3088
- function mr(t) {
3098
+ function br(t) {
3089
3099
  return JSON.stringify(
3090
3100
  t.map((e) => ({
3091
3101
  ...e,
3092
- clientId: Et,
3102
+ clientId: Pt,
3093
3103
  requestId: Math.random().toString(36).slice(2, 9),
3094
- sessionId: Oo(),
3104
+ sessionId: Co(),
3095
3105
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3096
- version: Ct,
3106
+ version: zt,
3097
3107
  event: e.event,
3098
3108
  context: {
3099
3109
  page: {
@@ -3104,18 +3114,18 @@ function mr(t) {
3104
3114
  referrer: document.referrer
3105
3115
  },
3106
3116
  locale: navigator.language,
3107
- library: Jn,
3117
+ library: Yn,
3108
3118
  userAgent: navigator.userAgent,
3109
- clientId: Et
3119
+ clientId: Pt
3110
3120
  }
3111
3121
  }))
3112
3122
  );
3113
3123
  }
3114
- const Lt = fo(
3124
+ const Zt = go(
3115
3125
  async (t) => {
3116
3126
  if (t.length > 0) {
3117
- const e = mr(t);
3118
- pr ? navigator.sendBeacon(tt, e) : (await fetch(tt, {
3127
+ const e = br(t);
3128
+ wr ? navigator.sendBeacon(nt, e) : (await fetch(nt, {
3119
3129
  method: "POST",
3120
3130
  body: e,
3121
3131
  headers: {
@@ -3131,24 +3141,24 @@ const Lt = fo(
3131
3141
  // 3s
3132
3142
  }
3133
3143
  );
3134
- function vt(t) {
3144
+ function wt(t) {
3135
3145
  var e;
3136
3146
  if (t.anonymousId)
3137
3147
  if ((e = t.properties) != null && e.flushing) {
3138
3148
  const n = { ...t };
3139
- delete n.properties.flushing, navigator.sendBeacon(tt, mr([n]));
3149
+ delete n.properties.flushing, navigator.sendBeacon(nt, br([n]));
3140
3150
  } else
3141
- Lt.push(t);
3151
+ Zt.push(t);
3142
3152
  }
3143
- const se = ho({
3144
- app: Jn,
3145
- version: Ct,
3153
+ const ee = mo({
3154
+ app: Yn,
3155
+ version: zt,
3146
3156
  plugins: [
3147
3157
  {
3148
3158
  name: "custom-analytics-plugin",
3149
3159
  page: ({ payload: t }) => {
3150
3160
  const { properties: e, anonymousId: n, userId: r, event: i } = t;
3151
- vt({
3161
+ wt({
3152
3162
  anonymousId: n,
3153
3163
  userId: r,
3154
3164
  properties: e,
@@ -3158,7 +3168,7 @@ const se = ho({
3158
3168
  },
3159
3169
  track: ({ payload: t }) => {
3160
3170
  const { properties: e, anonymousId: n, userId: r, event: i } = t;
3161
- vt({
3171
+ wt({
3162
3172
  anonymousId: n,
3163
3173
  userId: r,
3164
3174
  properties: e,
@@ -3168,7 +3178,7 @@ const se = ho({
3168
3178
  },
3169
3179
  identify: ({ payload: t }) => {
3170
3180
  const { properties: e, anonymousId: n, userId: r } = t;
3171
- vt({
3181
+ wt({
3172
3182
  anonymousId: n,
3173
3183
  userId: r,
3174
3184
  properties: e,
@@ -3178,58 +3188,135 @@ const se = ho({
3178
3188
  }
3179
3189
  ]
3180
3190
  });
3181
- function Po() {
3182
- return pr = !0, Lt.flush();
3191
+ function $o(t, e) {
3192
+ ee.track(t, e);
3193
+ }
3194
+ function zo() {
3195
+ return wr = !0, Zt.flush();
3183
3196
  }
3184
- const gr = /* @__PURE__ */ new Map();
3185
- function jo(t, e) {
3186
- gr.set(t, e);
3197
+ const kr = /* @__PURE__ */ new Map();
3198
+ function No(t, e) {
3199
+ kr.set(t, e);
3187
3200
  }
3188
3201
  window.addEventListener("beforeunload", () => {
3189
- gr.forEach((t, e) => {
3202
+ kr.forEach((t, e) => {
3190
3203
  t.bind(e)();
3191
- }), Po();
3204
+ }), zo();
3192
3205
  });
3193
- const yr = /* @__PURE__ */ new Map();
3194
- function xo(t, e) {
3195
- yr.set(t, e);
3206
+ const Ir = /* @__PURE__ */ new Map();
3207
+ function Do(t, e) {
3208
+ Ir.set(t, e);
3196
3209
  }
3197
3210
  window.addEventListener("visibilitychange", () => {
3198
- document.visibilityState !== "visible" && yr.forEach((t, e) => {
3211
+ document.visibilityState !== "visible" && Ir.forEach((t, e) => {
3199
3212
  t.bind(e)();
3200
3213
  });
3201
3214
  });
3202
- function Co() {
3215
+ function Uo(t) {
3216
+ const {
3217
+ getEntitlement: e,
3218
+ getEntitlements: n,
3219
+ getEntitlementAccess: r,
3220
+ getContract: i,
3221
+ getContracts: o,
3222
+ getBill: a,
3223
+ getBills: s,
3224
+ getTags: h,
3225
+ deleteTag: p,
3226
+ setTag: u,
3227
+ getUserMetadata: c,
3228
+ listUserMetadata: f,
3229
+ setUserMetadata: d,
3230
+ deleteUserMetadata: w,
3231
+ getTally: k,
3232
+ getTallies: v,
3233
+ pushTally: _,
3234
+ deleteTally: S,
3235
+ getProduct: g,
3236
+ autoOnboardProduct: l
3237
+ } = yi(t), b = {
3238
+ auth: {
3239
+ getUser: ei,
3240
+ isAuthenticated: Qr,
3241
+ loginWithRedirect: ti,
3242
+ logout: ri,
3243
+ setToken: Jn
3244
+ },
3245
+ analytics: {
3246
+ track: $o
3247
+ },
3248
+ tags: {
3249
+ list: h,
3250
+ set: u,
3251
+ delete: p
3252
+ },
3253
+ entitlements: {
3254
+ get: e,
3255
+ list: n,
3256
+ access: r
3257
+ },
3258
+ contracts: {
3259
+ get: i,
3260
+ list: o
3261
+ },
3262
+ bills: {
3263
+ get: a,
3264
+ list: s
3265
+ },
3266
+ userMetadata: {
3267
+ get: c,
3268
+ list: f,
3269
+ set: d,
3270
+ delete: w
3271
+ },
3272
+ tallies: {
3273
+ get: k,
3274
+ list: v,
3275
+ push: _,
3276
+ delete: S
3277
+ },
3278
+ products: {
3279
+ get: g,
3280
+ autoOnboard: l
3281
+ },
3282
+ getVersion: Lo
3283
+ };
3284
+ return t.namespace && (window[t.namespace] = b), b;
3285
+ }
3286
+ function Lo() {
3287
+ return zt;
3288
+ }
3289
+ function Ro() {
3203
3290
  const t = new URLSearchParams(window.location.hash.substring(1)), e = t.get("access_token"), n = t.get("expires_in");
3204
3291
  if (e && n) {
3205
- Zn(e, parseInt(n, 10));
3292
+ Jn(e, parseInt(n, 10));
3206
3293
  const r = new URL(window.location.href);
3207
3294
  t.delete("access_token"), t.delete("expires_in"), r.hash = t.toString(), window.history.replaceState(null, "", r);
3208
3295
  }
3209
3296
  }
3210
- async function Ao(t) {
3211
- To({
3297
+ async function Mo(t) {
3298
+ Ao({
3212
3299
  clientId: t.clientId,
3213
3300
  // The default client id can be overridden by the config
3214
3301
  ...t.analytics
3215
- }), await Hr({
3302
+ }), await qr({
3216
3303
  clientId: t.clientId,
3217
3304
  // The default client id can be overridden by the config
3218
3305
  ...t.auth
3219
3306
  });
3220
- const e = fi(t.api || {});
3221
- return nt(pe.READY, {}), Co(), e;
3307
+ const e = Uo(t.api || {});
3308
+ return rt(pe.READY, {}), Ro(), e;
3222
3309
  }
3223
3310
  if (typeof document < "u") {
3224
3311
  const t = document.getElementById("sesamy-js");
3225
3312
  if (t != null && t.textContent)
3226
3313
  try {
3227
3314
  const e = JSON.parse(t.textContent);
3228
- Ao(e);
3315
+ Mo(e);
3229
3316
  } catch (e) {
3230
3317
  console.error("Failed to parse config", e);
3231
3318
  }
3232
3319
  }
3233
3320
  export {
3234
- Ao as init
3321
+ Mo as init
3235
3322
  };