@sesamy/sesamy-js 1.16.0 → 1.18.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,6 +1,6 @@
1
1
  var zr = Object.defineProperty;
2
2
  var Mr = (t, e, n) => e in t ? zr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var B = (t, e, n) => Mr(t, typeof e != "symbol" ? e + "" : e, n);
3
+ var q = (t, e, n) => Mr(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  function le(t, e) {
5
5
  const n = new CustomEvent(t, {
6
6
  detail: e,
@@ -58,41 +58,41 @@ var he = Ut(function(t, e) {
58
58
  Lt(he);
59
59
  var Zr = Lt(Ut(function(t, e) {
60
60
  var n = fe && fe.__awaiter || function(u, c, f, d) {
61
- return new (f || (f = Promise))(function(b, S) {
62
- function w(v) {
61
+ return new (f || (f = Promise))(function(b, I) {
62
+ function v(y) {
63
63
  try {
64
- _(d.next(v));
64
+ _(d.next(y));
65
65
  } catch (l) {
66
- S(l);
66
+ I(l);
67
67
  }
68
68
  }
69
- function E(v) {
69
+ function E(y) {
70
70
  try {
71
- _(d.throw(v));
71
+ _(d.throw(y));
72
72
  } catch (l) {
73
- S(l);
73
+ I(l);
74
74
  }
75
75
  }
76
- function _(v) {
77
- v.done ? b(v.value) : new f(function(l) {
78
- l(v.value);
79
- }).then(w, E);
76
+ function _(y) {
77
+ y.done ? b(y.value) : new f(function(l) {
78
+ l(y.value);
79
+ }).then(v, E);
80
80
  }
81
81
  _((d = d.apply(u, c || [])).next());
82
82
  });
83
83
  }, r = fe && fe.__generator || function(u, c) {
84
- var f, d, b, S, w = { label: 0, sent: function() {
84
+ var f, d, b, I, v = { label: 0, sent: function() {
85
85
  if (1 & b[0]) throw b[1];
86
86
  return b[1];
87
87
  }, trys: [], ops: [] };
88
- return S = { next: E(0), throw: E(1), return: E(2) }, typeof Symbol == "function" && (S[Symbol.iterator] = function() {
88
+ return I = { next: E(0), throw: E(1), return: E(2) }, typeof Symbol == "function" && (I[Symbol.iterator] = function() {
89
89
  return this;
90
- }), S;
90
+ }), I;
91
91
  function E(_) {
92
- return function(v) {
92
+ return function(y) {
93
93
  return function(l) {
94
94
  if (f) throw new TypeError("Generator is already executing.");
95
- for (; w; ) try {
95
+ for (; v; ) try {
96
96
  if (f = 1, d && (b = 2 & l[0] ? d.return : l[0] ? d.throw || ((b = d.return) && b.call(d), 0) : d.next) && !(b = b.call(d, l[1])).done) return b;
97
97
  switch (d = 0, b && (l = [2 & l[0], b.value]), l[0]) {
98
98
  case 0:
@@ -100,34 +100,34 @@ var Zr = Lt(Ut(function(t, e) {
100
100
  b = l;
101
101
  break;
102
102
  case 4:
103
- return w.label++, { value: l[1], done: !1 };
103
+ return v.label++, { value: l[1], done: !1 };
104
104
  case 5:
105
- w.label++, d = l[1], l = [0];
105
+ v.label++, d = l[1], l = [0];
106
106
  continue;
107
107
  case 7:
108
- l = w.ops.pop(), w.trys.pop();
108
+ l = v.ops.pop(), v.trys.pop();
109
109
  continue;
110
110
  default:
111
- if (b = w.trys, !((b = b.length > 0 && b[b.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
112
- w = 0;
111
+ if (b = v.trys, !((b = b.length > 0 && b[b.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
112
+ v = 0;
113
113
  continue;
114
114
  }
115
115
  if (l[0] === 3 && (!b || l[1] > b[0] && l[1] < b[3])) {
116
- w.label = l[1];
116
+ v.label = l[1];
117
117
  break;
118
118
  }
119
- if (l[0] === 6 && w.label < b[1]) {
120
- w.label = b[1], b = l;
119
+ if (l[0] === 6 && v.label < b[1]) {
120
+ v.label = b[1], b = l;
121
121
  break;
122
122
  }
123
- if (b && w.label < b[2]) {
124
- w.label = b[2], w.ops.push(l);
123
+ if (b && v.label < b[2]) {
124
+ v.label = b[2], v.ops.push(l);
125
125
  break;
126
126
  }
127
- b[2] && w.ops.pop(), w.trys.pop();
127
+ b[2] && v.ops.pop(), v.trys.pop();
128
128
  continue;
129
129
  }
130
- l = c.call(u, w);
130
+ l = c.call(u, v);
131
131
  } catch (k) {
132
132
  l = [6, k], d = 0;
133
133
  } finally {
@@ -135,7 +135,7 @@ var Zr = Lt(Ut(function(t, e) {
135
135
  }
136
136
  if (5 & l[0]) throw l[1];
137
137
  return { value: l[0] ? l[1] : void 0, done: !0 };
138
- }([_, v]);
138
+ }([_, y]);
139
139
  };
140
140
  }
141
141
  }, i = fe;
@@ -197,19 +197,19 @@ var Zr = Lt(Ut(function(t, e) {
197
197
  }
198
198
  return u.prototype.acquireLock = function(c, f) {
199
199
  return f === void 0 && (f = 5e3), n(this, void 0, void 0, function() {
200
- var d, b, S, w, E, _, v;
200
+ var d, b, I, v, E, _, y;
201
201
  return r(this, function(l) {
202
202
  switch (l.label) {
203
203
  case 0:
204
- d = Date.now() + h(4), b = Date.now() + f, S = o + "-" + c, w = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
204
+ d = Date.now() + h(4), b = Date.now() + f, I = o + "-" + c, v = this.storageHandler === void 0 ? a : this.storageHandler, l.label = 1;
205
205
  case 1:
206
206
  return Date.now() < b ? [4, s(30)] : [3, 8];
207
207
  case 2:
208
- return l.sent(), w.getItemSync(S) !== null ? [3, 5] : (E = this.id + "-" + c + "-" + d, [4, s(Math.floor(25 * Math.random()))]);
208
+ return l.sent(), v.getItemSync(I) !== null ? [3, 5] : (E = this.id + "-" + c + "-" + d, [4, s(Math.floor(25 * Math.random()))]);
209
209
  case 3:
210
- return l.sent(), w.setItemSync(S, JSON.stringify({ id: this.id, iat: d, timeoutKey: E, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, s(30)];
210
+ return l.sent(), v.setItemSync(I, JSON.stringify({ id: this.id, iat: d, timeoutKey: E, timeAcquired: Date.now(), timeRefreshed: Date.now() })), [4, s(30)];
211
211
  case 4:
212
- return l.sent(), (_ = w.getItemSync(S)) !== null && (v = JSON.parse(_)).id === this.id && v.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(S, d), [2, !0]) : [3, 7];
212
+ return l.sent(), (_ = v.getItemSync(I)) !== null && (y = JSON.parse(_)).id === this.id && y.iat === d ? (this.acquiredIatSet.add(d), this.refreshLockWhileAcquired(I, d), [2, !0]) : [3, 7];
213
213
  case 5:
214
214
  return u.lockCorrector(this.storageHandler === void 0 ? a : this.storageHandler), [4, this.waitForSomethingToChange(b)];
215
215
  case 6:
@@ -227,13 +227,13 @@ var Zr = Lt(Ut(function(t, e) {
227
227
  return r(this, function(b) {
228
228
  return setTimeout(function() {
229
229
  return n(d, void 0, void 0, function() {
230
- var S, w, E;
230
+ var I, v, E;
231
231
  return r(this, function(_) {
232
232
  switch (_.label) {
233
233
  case 0:
234
234
  return [4, he.default().lock(f)];
235
235
  case 1:
236
- return _.sent(), this.acquiredIatSet.has(f) ? (S = this.storageHandler === void 0 ? a : this.storageHandler, (w = S.getItemSync(c)) === null ? (he.default().unlock(f), [2]) : ((E = JSON.parse(w)).timeRefreshed = Date.now(), S.setItemSync(c, JSON.stringify(E)), he.default().unlock(f), this.refreshLockWhileAcquired(c, f), [2])) : (he.default().unlock(f), [2]);
236
+ return _.sent(), this.acquiredIatSet.has(f) ? (I = this.storageHandler === void 0 ? a : this.storageHandler, (v = I.getItemSync(c)) === null ? (he.default().unlock(f), [2]) : ((E = JSON.parse(v)).timeRefreshed = Date.now(), I.setItemSync(c, JSON.stringify(E)), he.default().unlock(f), this.refreshLockWhileAcquired(c, f), [2])) : (he.default().unlock(f), [2]);
237
237
  }
238
238
  });
239
239
  });
@@ -246,12 +246,12 @@ var Zr = Lt(Ut(function(t, e) {
246
246
  switch (f.label) {
247
247
  case 0:
248
248
  return [4, new Promise(function(d) {
249
- var b = !1, S = Date.now(), w = !1;
249
+ var b = !1, I = Date.now(), v = !1;
250
250
  function E() {
251
- if (w || (window.removeEventListener("storage", E), u.removeFromWaiting(E), clearTimeout(_), w = !0), !b) {
251
+ if (v || (window.removeEventListener("storage", E), u.removeFromWaiting(E), clearTimeout(_), v = !0), !b) {
252
252
  b = !0;
253
- var v = 50 - (Date.now() - S);
254
- v > 0 ? setTimeout(d, v) : d(null);
253
+ var y = 50 - (Date.now() - I);
254
+ y > 0 ? setTimeout(d, y) : d(null);
255
255
  }
256
256
  }
257
257
  window.addEventListener("storage", E), u.addToWaiting(E);
@@ -285,31 +285,31 @@ var Zr = Lt(Ut(function(t, e) {
285
285
  });
286
286
  }, u.prototype.releaseLock__private__ = function(c) {
287
287
  return n(this, void 0, void 0, function() {
288
- var f, d, b, S;
289
- return r(this, function(w) {
290
- switch (w.label) {
288
+ var f, d, b, I;
289
+ return r(this, function(v) {
290
+ switch (v.label) {
291
291
  case 0:
292
- return f = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (b = f.getItemSync(d)) === null ? [2] : (S = JSON.parse(b)).id !== this.id ? [3, 2] : [4, he.default().lock(S.iat)];
292
+ return f = this.storageHandler === void 0 ? a : this.storageHandler, d = o + "-" + c, (b = f.getItemSync(d)) === null ? [2] : (I = JSON.parse(b)).id !== this.id ? [3, 2] : [4, he.default().lock(I.iat)];
293
293
  case 1:
294
- w.sent(), this.acquiredIatSet.delete(S.iat), f.removeItemSync(d), he.default().unlock(S.iat), u.notifyWaiters(), w.label = 2;
294
+ v.sent(), this.acquiredIatSet.delete(I.iat), f.removeItemSync(d), he.default().unlock(I.iat), u.notifyWaiters(), v.label = 2;
295
295
  case 2:
296
296
  return [2];
297
297
  }
298
298
  });
299
299
  });
300
300
  }, u.lockCorrector = function(c) {
301
- for (var f = Date.now() - 5e3, d = c, b = [], S = 0; ; ) {
302
- var w = d.keySync(S);
303
- if (w === null) break;
304
- b.push(w), S++;
301
+ for (var f = Date.now() - 5e3, d = c, b = [], I = 0; ; ) {
302
+ var v = d.keySync(I);
303
+ if (v === null) break;
304
+ b.push(v), I++;
305
305
  }
306
306
  for (var E = !1, _ = 0; _ < b.length; _++) {
307
- var v = b[_];
308
- if (v.includes(o)) {
309
- var l = d.getItemSync(v);
307
+ var y = b[_];
308
+ if (y.includes(o)) {
309
+ var l = d.getItemSync(y);
310
310
  if (l !== null) {
311
311
  var k = JSON.parse(l);
312
- (k.timeRefreshed === void 0 && k.timeAcquired < f || k.timeRefreshed !== void 0 && k.timeRefreshed < f) && (d.removeItemSync(v), E = !0);
312
+ (k.timeRefreshed === void 0 && k.timeAcquired < f || k.timeRefreshed !== void 0 && k.timeRefreshed < f) && (d.removeItemSync(y), E = !0);
313
313
  }
314
314
  }
315
315
  }
@@ -319,18 +319,18 @@ var Zr = Lt(Ut(function(t, e) {
319
319
  e.default = p;
320
320
  }));
321
321
  const Hr = { timeoutInSeconds: 60 }, Wn = { name: "auth0-spa-js", version: "2.1.3" }, Fn = () => Date.now();
322
- let Y = class _t extends Error {
322
+ let G = class _t extends Error {
323
323
  constructor(e, n) {
324
324
  super(n), this.error = e, this.error_description = n, Object.setPrototypeOf(this, _t.prototype);
325
325
  }
326
326
  static fromPayload({ error: e, error_description: n }) {
327
327
  return new _t(e, n);
328
328
  }
329
- }, Kr = class Jn extends Y {
329
+ }, Kr = class Jn extends G {
330
330
  constructor(e, n, r, i = null) {
331
331
  super(e, n), this.state = r, this.appState = i, Object.setPrototypeOf(this, Jn.prototype);
332
332
  }
333
- }, Et = class Xn extends Y {
333
+ }, Et = class Xn extends G {
334
334
  constructor() {
335
335
  super("timeout", "Timeout"), Object.setPrototypeOf(this, Xn.prototype);
336
336
  }
@@ -338,15 +338,15 @@ let Y = class _t extends Error {
338
338
  constructor(e) {
339
339
  super(), this.popup = e, Object.setPrototypeOf(this, Vn.prototype);
340
340
  }
341
- }, Fr = class Yn extends Y {
341
+ }, Fr = class Yn extends G {
342
342
  constructor(e) {
343
343
  super("cancelled", "Popup closed"), this.popup = e, Object.setPrototypeOf(this, Yn.prototype);
344
344
  }
345
- }, Jr = class Gn extends Y {
345
+ }, Jr = class Gn extends G {
346
346
  constructor(e, n, r) {
347
347
  super(e, n), this.mfa_token = r, Object.setPrototypeOf(this, Gn.prototype);
348
348
  }
349
- }, Bn = class qn extends Y {
349
+ }, Bn = class qn extends G {
350
350
  constructor(e, n) {
351
351
  super("missing_refresh_token", `Missing Refresh Token (audience: '${Vt(e, ["default"])}', scope: '${Vt(n)}')`), this.audience = e, this.scope = n, Object.setPrototypeOf(this, qn.prototype);
352
352
  }
@@ -386,19 +386,19 @@ const nt = () => window.crypto, pt = () => {
386
386
  async function Br(t, e) {
387
387
  var { baseUrl: n, timeout: r, audience: i, scope: o, auth0Client: a, useFormData: s } = t, h = te(t, ["baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData"]);
388
388
  const p = s ? Pt(h) : JSON.stringify(h);
389
- return await async function(u, c, f, d, b, S, w) {
389
+ return await async function(u, c, f, d, b, I, v) {
390
390
  let E, _ = null;
391
391
  for (let x = 0; x < 3; x++) try {
392
- E = await Gr(u, f, d, b, S, w, c), _ = null;
392
+ E = await Gr(u, f, d, b, I, v, c), _ = null;
393
393
  break;
394
- } catch (N) {
395
- _ = N;
394
+ } catch (z) {
395
+ _ = z;
396
396
  }
397
397
  if (_) throw _;
398
- const v = E.json, { error: l, error_description: k } = v, O = te(v, ["error", "error_description"]), { ok: C } = E;
399
- if (!C) {
398
+ const y = E.json, { error: l, error_description: k } = y, O = te(y, ["error", "error_description"]), { ok: j } = E;
399
+ if (!j) {
400
400
  const x = k || `HTTP error. Unable to fetch ${u}`;
401
- throw l === "mfa_required" ? new Jr(l, x, O.mfa_token) : l === "missing_refresh_token" ? new Bn(f, d) : new Y(l || "request_error", x);
401
+ throw l === "mfa_required" ? new Jr(l, x, O.mfa_token) : l === "missing_refresh_token" ? new Bn(f, d) : new G(l || "request_error", x);
402
402
  }
403
403
  return O;
404
404
  }(`${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 || Wn)) } }, e, s);
@@ -741,7 +741,7 @@ let li = class {
741
741
  const d = { "+": "-", "/": "_", "=": "" };
742
742
  return f.replace(/[+/=]/g, (b) => d[b]);
743
743
  })(window.btoa(String.fromCharCode(...Array.from(c))));
744
- })(await (async (u) => await nt().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), h = ((u, c, f, d, b, S, w, E) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), f), { scope: Ve(c, f.scope), response_type: "code", response_mode: E || "query", state: d, nonce: b, redirect_uri: w || u.authorizationParams.redirect_uri, code_challenge: S, 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);
744
+ })(await (async (u) => await nt().subtle.digest({ name: "SHA-256" }, new TextEncoder().encode(u)))(a)), h = ((u, c, f, d, b, I, v, E) => Object.assign(Object.assign(Object.assign({ client_id: u.clientId }, u.authorizationParams), f), { scope: Ve(c, f.scope), response_type: "code", response_mode: E || "query", state: d, nonce: b, redirect_uri: v || u.authorizationParams.redirect_uri, code_challenge: I, 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);
745
745
  return { nonce: o, code_verifier: a, scope: h.scope, audience: h.audience || "default", redirect_uri: h.redirect_uri, state: i, url: p };
746
746
  }
747
747
  async loginWithPopup(e, n) {
@@ -761,12 +761,12 @@ let li = class {
761
761
  }, 1e3 * (s.timeoutInSeconds || 60));
762
762
  u = function(d) {
763
763
  if (d.data && d.data.type === "authorization_response") {
764
- if (clearTimeout(f), clearInterval(c), window.removeEventListener("message", u, !1), s.popup.close(), d.data.response.error) return p(Y.fromPayload(d.data.response));
764
+ if (clearTimeout(f), clearInterval(c), window.removeEventListener("message", u, !1), s.popup.close(), d.data.response.error) return p(G.fromPayload(d.data.response));
765
765
  h(d.data.response);
766
766
  }
767
767
  }, window.addEventListener("message", u);
768
768
  }))(Object.assign(Object.assign({}, n), { timeoutInSeconds: n.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || 60 }));
769
- if (i.state !== o.state) throw new Y("state_mismatch", "Invalid state");
769
+ if (i.state !== o.state) throw new G("state_mismatch", "Invalid state");
770
770
  const a = ((r = e.authorizationParams) === null || r === void 0 ? void 0 : r.organization) || this.options.authorizationParams.organization;
771
771
  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 });
772
772
  }
@@ -795,9 +795,9 @@ let li = class {
795
795
  const f = new URLSearchParams(c);
796
796
  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 };
797
797
  })(n.join("")), s = this.transactionManager.get();
798
- if (!s) throw new Y("missing_transaction", "Invalid state");
798
+ if (!s) throw new G("missing_transaction", "Invalid state");
799
799
  if (this.transactionManager.remove(), o) throw new Kr(o, a || o, r, s.appState);
800
- if (!s.code_verifier || s.state && s.state !== r) throw new Y("state_mismatch", "Invalid state");
800
+ if (!s.code_verifier || s.state && s.state !== r) throw new G("state_mismatch", "Invalid state");
801
801
  const h = s.organization, p = s.nonce, u = s.redirect_uri;
802
802
  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 };
803
803
  }
@@ -868,24 +868,24 @@ let li = class {
868
868
  r && !n.organization && (n.organization = r);
869
869
  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);
870
870
  try {
871
- if (window.crossOriginIsolated) 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.");
872
- const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, f = await ((b, S, w = 60) => new Promise((E, _) => {
873
- const v = window.document.createElement("iframe");
874
- v.setAttribute("width", "0"), v.setAttribute("height", "0"), v.style.display = "none";
871
+ if (window.crossOriginIsolated) throw new G("login_required", "The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");
872
+ const c = e.timeoutInSeconds || this.options.authorizeTimeoutInSeconds, f = await ((b, I, v = 60) => new Promise((E, _) => {
873
+ const y = window.document.createElement("iframe");
874
+ y.setAttribute("width", "0"), y.setAttribute("height", "0"), y.style.display = "none";
875
875
  const l = () => {
876
- window.document.body.contains(v) && (window.document.body.removeChild(v), window.removeEventListener("message", k, !1));
876
+ window.document.body.contains(y) && (window.document.body.removeChild(y), window.removeEventListener("message", k, !1));
877
877
  };
878
878
  let k;
879
879
  const O = setTimeout(() => {
880
880
  _(new Et()), l();
881
- }, 1e3 * w);
882
- k = function(C) {
883
- if (C.origin != S || !C.data || C.data.type !== "authorization_response") return;
884
- const x = C.source;
885
- x && x.close(), C.data.response.error ? _(Y.fromPayload(C.data.response)) : E(C.data.response), clearTimeout(O), window.removeEventListener("message", k, !1), setTimeout(l, 2e3);
886
- }, window.addEventListener("message", k, !1), window.document.body.appendChild(v), v.setAttribute("src", b);
881
+ }, 1e3 * v);
882
+ k = function(j) {
883
+ if (j.origin != I || !j.data || j.data.type !== "authorization_response") return;
884
+ const x = j.source;
885
+ x && x.close(), j.data.response.error ? _(G.fromPayload(j.data.response)) : E(j.data.response), clearTimeout(O), window.removeEventListener("message", k, !1), setTimeout(l, 2e3);
886
+ }, window.addEventListener("message", k, !1), window.document.body.appendChild(y), y.setAttribute("src", b);
887
887
  }))(i, this.domainUrl, c);
888
- if (o !== f.state) throw new Y("state_mismatch", "Invalid state");
888
+ if (o !== f.state) throw new G("state_mismatch", "Invalid state");
889
889
  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 });
890
890
  return Object.assign(Object.assign({}, d), { scope: p, oauthTokenScope: d.scope, audience: u });
891
891
  } catch (c) {
@@ -931,12 +931,12 @@ async function di(t) {
931
931
  const e = new li(t);
932
932
  return await e.checkSession(), e;
933
933
  }
934
- var Q = /* @__PURE__ */ ((t) => (t.READY = "sesamyJsReady", t.AUTHENTICATED = "sesamyJsAuthenticated", t.LOGOUT = "sesamyJsLogout", t.CLEAR_CACHE = "sesamyJsClearCache", t.USER_ATTRIBUTE_CHANGED = "sesamyUserAttributeChanged", t.PURCHASE = "sesamyJsPurchase", t))(Q || {});
934
+ var ee = /* @__PURE__ */ ((t) => (t.READY = "sesamyJsReady", t.AUTHENTICATED = "sesamyJsAuthenticated", t.LOGOUT = "sesamyJsLogout", t.CLEAR_CACHE = "sesamyJsClearCache", t.USER_ATTRIBUTE_CHANGED = "sesamyUserAttributeChanged", t.PURCHASE = "sesamyJsPurchase", t))(ee || {});
935
935
  const hi = "sesamy.com", fi = "sesamy.dev", pi = "https://sesa.my", Ot = "sesamyCacheTimestamp";
936
936
  function ae(t, e) {
937
937
  return `https://${t}.${e === "dev" ? fi : hi}`;
938
938
  }
939
- let G, nr;
939
+ let B, nr;
940
940
  const We = "sesamyAccessToken";
941
941
  function Rt() {
942
942
  const t = localStorage.getItem(We);
@@ -962,11 +962,11 @@ async function mi(t) {
962
962
  clientId: t.clientId,
963
963
  useCookiesForTransactions: !0
964
964
  };
965
- if (nn(window.location.href) !== nn(ae("auth", t.environment)) && (e.cacheLocation = "localstorage", e.useRefreshTokens = !0), G = await di(e), window.location.search.includes("code="))
965
+ if (nn(window.location.href) !== nn(ae("auth", t.environment)) && (e.cacheLocation = "localstorage", e.useRefreshTokens = !0), B = await di(e), window.location.search.includes("code="))
966
966
  try {
967
- await G.handleRedirectCallback();
968
- const n = await G.getUser();
969
- le(Q.AUTHENTICATED, n);
967
+ await B.handleRedirectCallback();
968
+ const n = await B.getUser();
969
+ le(ee.AUTHENTICATED, n);
970
970
  const r = new URL(location.href), i = r.searchParams;
971
971
  i.delete("code"), i.delete("state"), r.search = i.toString(), window.history.replaceState({}, document.title, r.toString());
972
972
  } catch (n) {
@@ -974,19 +974,19 @@ async function mi(t) {
974
974
  }
975
975
  }
976
976
  async function Nt() {
977
- return Rt() ? !0 : G ? G.isAuthenticated() : !1;
977
+ return Rt() ? !0 : B ? B.isAuthenticated() : !1;
978
978
  }
979
979
  async function gi() {
980
980
  return Rt() ? {
981
981
  sub: "local",
982
982
  name: "Local User"
983
- } : G ? G.getUser() : null;
983
+ } : B ? B.getUser() : null;
984
984
  }
985
985
  function Dt(t) {
986
- if (localStorage.removeItem(We), !G)
986
+ if (localStorage.removeItem(We), !B)
987
987
  throw new Error("Auth0 client not initialized");
988
988
  const e = (t == null ? void 0 : t.authorizationParams) || {};
989
- return G.loginWithRedirect({
989
+ return B.loginWithRedirect({
990
990
  ...t,
991
991
  authorizationParams: {
992
992
  organization: nr,
@@ -1000,7 +1000,7 @@ async function Ne(t = !0) {
1000
1000
  if (e)
1001
1001
  return e;
1002
1002
  try {
1003
- return G ? await G.getTokenSilently() : null;
1003
+ return B ? await B.getTokenSilently() : null;
1004
1004
  } catch (n) {
1005
1005
  if (t)
1006
1006
  throw n;
@@ -1008,8 +1008,8 @@ async function Ne(t = !0) {
1008
1008
  }
1009
1009
  }
1010
1010
  async function yi(t = {}) {
1011
- if (localStorage.removeItem(We), le(Q.LOGOUT, {}), !!G)
1012
- return G.logout({
1011
+ if (localStorage.removeItem(We), le(ee.LOGOUT, {}), !!B)
1012
+ return B.logout({
1013
1013
  ...t,
1014
1014
  // Default to the current URL if no returnTo is specified
1015
1015
  logoutParams: { returnTo: window.location.href, ...t.logoutParams }
@@ -1030,9 +1030,9 @@ async function ir(t) {
1030
1030
  const e = rr(t);
1031
1031
  if (!e || !e.exp || e.exp < (/* @__PURE__ */ new Date()).getTime() / 1e3)
1032
1032
  throw new Error("Invalid token");
1033
- localStorage.setItem(We, t), le(Q.AUTHENTICATED, e);
1033
+ localStorage.setItem(We, t), le(ee.AUTHENTICATED, e);
1034
1034
  }
1035
- const vi = (t, e) => e.skipDedupe || e.method !== "GET", wi = (t, e) => e.method + "@" + t, bi = (t) => t.clone(), rn = ({ skip: t = vi, key: e = wi, resolver: n = bi } = {}) => {
1035
+ const wi = (t, e) => e.skipDedupe || e.method !== "GET", vi = (t, e) => e.method + "@" + t, bi = (t) => t.clone(), rn = ({ skip: t = wi, key: e = vi, resolver: n = bi } = {}) => {
1036
1036
  const r = /* @__PURE__ */ new Map();
1037
1037
  return (i) => (o, a) => {
1038
1038
  if (t(o, a))
@@ -1056,7 +1056,7 @@ const vi = (t, e) => e.skipDedupe || e.method !== "GET", wi = (t, e) => e.method
1056
1056
  let c = 0;
1057
1057
  if (s && s(p, u))
1058
1058
  return h(p, u);
1059
- const f = (d, b) => Promise.resolve(r(d, b)).then((S) => S ? d && a ? d : b ? Promise.reject(b) : d : (c++, !n || c <= n ? new Promise((w) => {
1059
+ const f = (d, b) => Promise.resolve(r(d, b)).then((I) => I ? d && a ? d : b ? Promise.reject(b) : d : (c++, !n || c <= n ? new Promise((v) => {
1060
1060
  const E = e(t, c);
1061
1061
  setTimeout(() => {
1062
1062
  typeof i == "function" ? Promise.resolve(i({
@@ -1065,14 +1065,14 @@ const vi = (t, e) => e.skipDedupe || e.method !== "GET", wi = (t, e) => e.method
1065
1065
  url: p,
1066
1066
  options: u
1067
1067
  })).then((_ = {}) => {
1068
- var v, l;
1069
- w(h((v = _ && _.url) !== null && v !== void 0 ? v : p, (l = _ && _.options) !== null && l !== void 0 ? l : u));
1070
- }) : w(h(p, u));
1068
+ var y, l;
1069
+ v(h((y = _ && _.url) !== null && y !== void 0 ? y : p, (l = _ && _.options) !== null && l !== void 0 ? l : u));
1070
+ }) : v(h(p, u));
1071
1071
  }, E);
1072
- }).then(f).catch((w) => {
1072
+ }).then(f).catch((v) => {
1073
1073
  if (!o)
1074
- throw w;
1075
- return f(null, w);
1074
+ throw v;
1075
+ return f(null, v);
1076
1076
  }) : d && a ? d : Promise.reject(b || new Error("Number of attempts exceeded."))));
1077
1077
  return h(p, u).then(f).catch((d) => {
1078
1078
  if (!o)
@@ -1128,75 +1128,75 @@ class sr extends Error {
1128
1128
  }
1129
1129
  const Oi = (t) => {
1130
1130
  const e = /* @__PURE__ */ Object.create(null);
1131
- t = t._addons.reduce((v, l) => l.beforeRequest && l.beforeRequest(v, t._options, e) || v, t);
1131
+ t = t._addons.reduce((y, l) => l.beforeRequest && l.beforeRequest(y, t._options, e) || y, t);
1132
1132
  const { _url: n, _options: r, _config: i, _catchers: o, _resolvers: a, _middlewares: s, _addons: h } = t, p = new Map(o), u = ye(i.options, r);
1133
1133
  let c = n;
1134
- const f = Ti(s)((v, l) => (c = v, i.polyfill("fetch")(v, l)))(n, u), d = new Error(), b = f.catch((v) => {
1135
- throw { [Ie]: v };
1136
- }).then((v) => {
1137
- if (!v.ok) {
1134
+ const f = Ti(s)((y, l) => (c = y, i.polyfill("fetch")(y, l)))(n, u), d = new Error(), b = f.catch((y) => {
1135
+ throw { [Ie]: y };
1136
+ }).then((y) => {
1137
+ if (!y.ok) {
1138
1138
  const l = new sr();
1139
1139
  if (l.cause = d, l.stack = l.stack + `
1140
- CAUSE: ` + d.stack, l.response = v, l.url = c, v.type === "opaque")
1140
+ CAUSE: ` + d.stack, l.response = y, l.url = c, y.type === "opaque")
1141
1141
  throw l;
1142
- return v.text().then((k) => {
1142
+ return y.text().then((k) => {
1143
1143
  var O;
1144
- if (l.message = k, i.errorType === "json" || ((O = v.headers.get("Content-Type")) === null || O === void 0 ? void 0 : O.split(";")[0]) === "application/json")
1144
+ if (l.message = k, i.errorType === "json" || ((O = y.headers.get("Content-Type")) === null || O === void 0 ? void 0 : O.split(";")[0]) === "application/json")
1145
1145
  try {
1146
1146
  l.json = JSON.parse(k);
1147
1147
  } catch {
1148
1148
  }
1149
- throw l.text = k, l.status = v.status, l;
1149
+ throw l.text = k, l.status = y.status, l;
1150
1150
  });
1151
1151
  }
1152
- return v;
1153
- }), S = (v) => v.catch((l) => {
1154
- const k = l.hasOwnProperty(Ie), O = k ? l[Ie] : l, C = (O == null ? void 0 : O.status) && p.get(O.status) || p.get(O == null ? void 0 : O.name) || k && p.has(Ie) && p.get(Ie);
1155
- if (C)
1156
- return C(O, t);
1152
+ return y;
1153
+ }), I = (y) => y.catch((l) => {
1154
+ const k = l.hasOwnProperty(Ie), O = k ? l[Ie] : l, j = (O == null ? void 0 : O.status) && p.get(O.status) || p.get(O == null ? void 0 : O.name) || k && p.has(Ie) && p.get(Ie);
1155
+ if (j)
1156
+ return j(O, t);
1157
1157
  const x = p.get(ar);
1158
1158
  if (x)
1159
1159
  return x(O, t);
1160
1160
  throw O;
1161
- }), w = (v) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ S(v ? b.then((k) => k && k[v]()).then((k) => l ? l(k) : k) : b.then((k) => l ? l(k) : k)), E = {
1161
+ }), v = (y) => (l) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ I(y ? b.then((k) => k && k[y]()).then((k) => l ? l(k) : k) : b.then((k) => l ? l(k) : k)), E = {
1162
1162
  _wretchReq: t,
1163
1163
  _fetchReq: f,
1164
1164
  _sharedState: e,
1165
- res: w(null),
1166
- json: w("json"),
1167
- blob: w("blob"),
1168
- formData: w("formData"),
1169
- arrayBuffer: w("arrayBuffer"),
1170
- text: w("text"),
1171
- error(v, l) {
1172
- return p.set(v, l), this;
1165
+ res: v(null),
1166
+ json: v("json"),
1167
+ blob: v("blob"),
1168
+ formData: v("formData"),
1169
+ arrayBuffer: v("arrayBuffer"),
1170
+ text: v("text"),
1171
+ error(y, l) {
1172
+ return p.set(y, l), this;
1173
1173
  },
1174
- badRequest(v) {
1175
- return this.error(400, v);
1174
+ badRequest(y) {
1175
+ return this.error(400, y);
1176
1176
  },
1177
- unauthorized(v) {
1178
- return this.error(401, v);
1177
+ unauthorized(y) {
1178
+ return this.error(401, y);
1179
1179
  },
1180
- forbidden(v) {
1181
- return this.error(403, v);
1180
+ forbidden(y) {
1181
+ return this.error(403, y);
1182
1182
  },
1183
- notFound(v) {
1184
- return this.error(404, v);
1183
+ notFound(y) {
1184
+ return this.error(404, y);
1185
1185
  },
1186
- timeout(v) {
1187
- return this.error(408, v);
1186
+ timeout(y) {
1187
+ return this.error(408, y);
1188
1188
  },
1189
- internalError(v) {
1190
- return this.error(500, v);
1189
+ internalError(y) {
1190
+ return this.error(500, y);
1191
1191
  },
1192
- fetchError(v) {
1193
- return this.error(Ie, v);
1192
+ fetchError(y) {
1193
+ return this.error(Ie, y);
1194
1194
  }
1195
- }, _ = h.reduce((v, l) => ({
1196
- ...v,
1197
- ...typeof l.resolver == "function" ? l.resolver(v) : l.resolver
1195
+ }, _ = h.reduce((y, l) => ({
1196
+ ...y,
1197
+ ...typeof l.resolver == "function" ? l.resolver(y) : l.resolver
1198
1198
  }), E);
1199
- return a.reduce((v, l) => l(v, t), _);
1199
+ return a.reduce((y, l) => l(y, t), _);
1200
1200
  }, ji = {
1201
1201
  _url: "",
1202
1202
  _options: {},
@@ -1316,60 +1316,60 @@ ie.options = _i;
1316
1316
  ie.errorType = Pi;
1317
1317
  ie.polyfills = Ei;
1318
1318
  ie.WretchError = sr;
1319
- function q() {
1320
- sessionStorage.removeItem(Ot), le(Q.CLEAR_CACHE, {});
1319
+ function Q() {
1320
+ sessionStorage.removeItem(Ot), le(ee.CLEAR_CACHE, {});
1321
1321
  }
1322
1322
  function Ci() {
1323
1323
  var n;
1324
1324
  return (n = (document.documentElement.getAttribute("lang") ?? "en").split("-")[0]) == null ? void 0 : n.toLocaleLowerCase();
1325
1325
  }
1326
1326
  function xi(t) {
1327
- const e = ae("api2", t.environment), n = (g) => async (I, P) => {
1328
- let M = sessionStorage.getItem(Ot);
1329
- M || (M = Date.now().toString(), sessionStorage.setItem(Ot, M));
1330
- const U = {
1327
+ const e = ae("api2", t.environment), n = (w) => async (S, P) => {
1328
+ let Z = sessionStorage.getItem(Ot);
1329
+ Z || (Z = Date.now().toString(), sessionStorage.setItem(Ot, Z));
1330
+ const N = {
1331
1331
  ...P,
1332
1332
  headers: {
1333
1333
  ...P.headers,
1334
- "Cache-Timestamp": M
1334
+ "Cache-Timestamp": Z
1335
1335
  }
1336
1336
  };
1337
- return g(I, U);
1338
- }, r = (g = !0) => (I) => async (P, M) => {
1339
- let U = null;
1340
- if (U = await Ne(g), !U) {
1341
- if (g)
1337
+ return w(S, N);
1338
+ }, r = (w = !0) => (S) => async (P, Z) => {
1339
+ let N = null;
1340
+ if (N = await Ne(w), !N) {
1341
+ if (w)
1342
1342
  throw new Error("No access token available");
1343
- return I(P, M);
1343
+ return S(P, Z);
1344
1344
  }
1345
- const H = {
1346
- ...M,
1345
+ const X = {
1346
+ ...Z,
1347
1347
  headers: {
1348
- ...M.headers,
1349
- ...U ? { Authorization: `Bearer ${U}` } : {}
1348
+ ...Z.headers,
1349
+ ...N ? { Authorization: `Bearer ${N}` } : {}
1350
1350
  }
1351
1351
  };
1352
- return I(P, H);
1353
- }, i = (g) => (I, P) => {
1352
+ return S(P, X);
1353
+ }, i = (w) => (S, P) => {
1354
1354
  if (P.headers.Authorization)
1355
- return g(I, P);
1356
- const M = localStorage.getItem("__anon_id"), U = btoa(`${M}:`), H = {
1355
+ return w(S, P);
1356
+ const Z = localStorage.getItem("__anon_id"), N = btoa(`${Z}:`), X = {
1357
1357
  ...P,
1358
1358
  headers: {
1359
1359
  ...P.headers,
1360
- Authorization: `Basic ${U}`
1360
+ Authorization: `Basic ${N}`
1361
1361
  }
1362
1362
  };
1363
- return g(I, H);
1363
+ return w(S, X);
1364
1364
  }, o = ie(e).headers({ "Content-Type": "application/json" }).middlewares([
1365
1365
  n,
1366
1366
  r(),
1367
1367
  rn(),
1368
1368
  on({
1369
1369
  delayTimer: 1e3,
1370
- delayRamp: (g, I) => g * I,
1370
+ delayRamp: (w, S) => w * S,
1371
1371
  maxAttempts: 3,
1372
- until: (g) => !!(g && (g.ok || g.status >= 400 && g.status < 500)),
1372
+ until: (w) => !!(w && (w.ok || w.status >= 400 && w.status < 500)),
1373
1373
  retryOnNetworkError: !1
1374
1374
  })
1375
1375
  ]), a = ie(e).headers({ "Content-Type": "application/json" }).middlewares([
@@ -1379,28 +1379,28 @@ function xi(t) {
1379
1379
  rn(),
1380
1380
  on({
1381
1381
  delayTimer: 1e3,
1382
- delayRamp: (g, I) => g * I,
1382
+ delayRamp: (w, S) => w * S,
1383
1383
  maxAttempts: 3,
1384
- until: (g) => !!(g && (g.ok || g.status >= 400 && g.status < 500)),
1384
+ until: (w) => !!(w && (w.ok || w.status >= 400 && w.status < 500)),
1385
1385
  retryOnNetworkError: !1
1386
1386
  })
1387
1387
  ]);
1388
1388
  async function s() {
1389
1389
  return o.get("/entitlements").json();
1390
1390
  }
1391
- async function h(g) {
1392
- const I = await o.get("/entitlements").json();
1393
- return I == null ? void 0 : I.find((P) => P.id === g);
1391
+ async function h(w) {
1392
+ const S = await o.get("/entitlements").json();
1393
+ return S == null ? void 0 : S.find((P) => P.id === w);
1394
1394
  }
1395
- async function p(g) {
1396
- return o.get(`/entitlements/${g}/access`).json();
1395
+ async function p(w) {
1396
+ return o.get(`/entitlements/${w}/access`).json();
1397
1397
  }
1398
1398
  async function u() {
1399
1399
  return o.get("/contracts").json();
1400
1400
  }
1401
- async function c(g) {
1402
- const I = await o.get("/contracts").json();
1403
- return I == null ? void 0 : I.find((P) => P.id === g);
1401
+ async function c(w) {
1402
+ const S = await o.get("/contracts").json();
1403
+ return S == null ? void 0 : S.find((P) => P.id === w);
1404
1404
  }
1405
1405
  async function f() {
1406
1406
  return o.get("/subscriptions").json();
@@ -1408,135 +1408,143 @@ function xi(t) {
1408
1408
  async function d() {
1409
1409
  return o.get("/bills").json();
1410
1410
  }
1411
- async function b(g) {
1412
- const I = await o.get("/bills").json();
1413
- return I == null ? void 0 : I.find((P) => P.id === g);
1411
+ async function b(w) {
1412
+ const S = await o.get("/bills").json();
1413
+ return S == null ? void 0 : S.find((P) => P.id === w);
1414
1414
  }
1415
- async function S(g, I) {
1416
- const P = await o.url(`/user-metadata/${g}`).put(I).json();
1417
- return le(Q.USER_ATTRIBUTE_CHANGED, {}), q(), P;
1415
+ async function I(w, S) {
1416
+ const P = await o.url(`/user-metadata/${w}`).put(S).json();
1417
+ return le(ee.USER_ATTRIBUTE_CHANGED, {}), Q(), P;
1418
1418
  }
1419
- async function w(g) {
1420
- const I = await o.url(`/user-metadata/${g}`).delete().res();
1421
- return q(), I.ok;
1419
+ async function v(w) {
1420
+ const S = await o.url(`/user-metadata/${w}`).delete().res();
1421
+ return Q(), S.ok;
1422
1422
  }
1423
- async function E(g) {
1424
- return (await o.url(`/user-metadata/${g}`).get().json())[g];
1423
+ async function E(w) {
1424
+ return (await o.url(`/user-metadata/${w}`).get().json())[w];
1425
1425
  }
1426
1426
  async function _() {
1427
1427
  return await o.url("/user-metadata").get().json();
1428
1428
  }
1429
- async function v() {
1429
+ async function y() {
1430
1430
  return await o.url("/tags").get().json();
1431
1431
  }
1432
- async function l(g) {
1433
- const I = await o.url(`/tags/${g}`).delete().res();
1434
- return q(), I.ok;
1432
+ async function l(w) {
1433
+ const S = await o.url(`/tags/${w}`).delete().res();
1434
+ return Q(), S.ok;
1435
1435
  }
1436
- async function k(g) {
1437
- const I = await o.url("/tags").post(g).res();
1438
- return le(Q.USER_ATTRIBUTE_CHANGED, {}), q(), I.ok;
1436
+ async function k(w) {
1437
+ const S = await o.url("/tags").post(w).res();
1438
+ return le(ee.USER_ATTRIBUTE_CHANGED, {}), Q(), S.ok;
1439
1439
  }
1440
- async function O(g) {
1441
- return (await a.url("/tallies").get().json())[g];
1440
+ async function O(w) {
1441
+ return (await a.url("/tallies").get().json())[w];
1442
1442
  }
1443
- async function C() {
1443
+ async function j() {
1444
1444
  return await a.url("/tallies").get().json();
1445
1445
  }
1446
- async function x(g) {
1447
- const I = await a.url(`/tallies/${g}`).delete().res();
1448
- return q(), I.ok;
1446
+ async function x(w) {
1447
+ const S = await a.url(`/tallies/${w}`).delete().res();
1448
+ return Q(), S.ok;
1449
1449
  }
1450
- async function N(g, I) {
1451
- return await a.url(`/tallies/${g}/push`).post(I).json();
1450
+ async function z(w, S) {
1451
+ return await a.url(`/tallies/${w}/push`).post(S).json();
1452
1452
  }
1453
- async function D(g) {
1454
- return await o.url(`/products/${g}`).get().json();
1453
+ async function M(w) {
1454
+ return await o.url(`/products/${w}`).get().json();
1455
1455
  }
1456
- async function K() {
1456
+ async function W() {
1457
1457
  return await Ne(!1) ? await o.url("/profile").get().json() : null;
1458
1458
  }
1459
- async function L(g) {
1460
- const I = await o.url("/profile").patch(g).res();
1461
- return q(), I.ok;
1459
+ async function L(w) {
1460
+ const S = await o.url("/profile").patch(w).res();
1461
+ return Q(), S.ok;
1462
1462
  }
1463
- async function R() {
1463
+ async function D() {
1464
1464
  return await o.url("/payment-issues").get().json();
1465
1465
  }
1466
- async function Z() {
1466
+ async function H() {
1467
1467
  return (await o.url("/profile/spotify-link").get().json()).isSpotifyLinked;
1468
1468
  }
1469
- async function j() {
1469
+ async function C() {
1470
1470
  return (await o.url("/profile/unlink-spotify").post().res()).ok;
1471
1471
  }
1472
- async function W(g) {
1473
- const I = await Ne(!1);
1474
- if (!I)
1472
+ async function K(w) {
1473
+ const S = await Ne(!1);
1474
+ if (!S)
1475
1475
  throw new Error("No access token available");
1476
1476
  const P = new URL(`${ae("spotify-oas", t.environment)}/sesamy-callback`);
1477
- P.searchParams.set("access_token", I), P.searchParams.set("state", g), window.location.href = P.toString();
1477
+ P.searchParams.set("access_token", S), P.searchParams.set("state", w), window.location.href = P.toString();
1478
1478
  }
1479
- async function J(g) {
1480
- const I = await o.url(`/products/${g}/auto-onboard`).post().json();
1481
- return I.length && q(), I;
1479
+ async function F(w) {
1480
+ const S = await o.url(`/products/${w}/auto-onboard`).post().json();
1481
+ return S.length && Q(), S;
1482
1482
  }
1483
- async function de(g, I = 3600) {
1484
- const { shortlink: P } = await ie(pi).post({ url: g, ttl: I }).json();
1483
+ async function de(w, S = 3600) {
1484
+ const { shortlink: P } = await ie(pi).post({ url: w, ttl: S }).json();
1485
1485
  return P;
1486
1486
  }
1487
- async function m(g) {
1488
- const I = await Ne(!1);
1487
+ async function m(w) {
1488
+ const S = await Ne(!1);
1489
1489
  let P;
1490
- switch (g.target) {
1490
+ switch (w.target) {
1491
1491
  case "account":
1492
1492
  P = new URL(`${ae("account", t.environment)}/subscriptions/${t.clientId}`);
1493
1493
  break;
1494
1494
  case "consume":
1495
- P = new URL(`${ae("consume", t.environment)}/@${t.clientId}/${g.sku}`), g.episodeId && (P.href += `/${g.episodeId}`);
1495
+ P = new URL(`${ae("consume", t.environment)}/@${t.clientId}/${w.sku}`), w.episodeId ? P.href += `/${w.episodeId}` : P.href += "/listen";
1496
1496
  break;
1497
1497
  default:
1498
1498
  throw new Error("Invalid target");
1499
1499
  }
1500
- return P.searchParams.set("sesamy-redirect-url", g.redirectUrl || window.location.href), I && (P.hash = `#access_token=${I}`), g.shorten ? de(P.href, g.ttl) : P.href;
1500
+ return P.searchParams.set("sesamy-redirect-url", w.redirectUrl || window.location.href), S && (P.hash = `#access_token=${S}`), w.shorten ? de(P.href, w.ttl) : P.href;
1501
1501
  }
1502
- async function y(g) {
1503
- return (await a.url("/checkouts").post({ language: Ci(), ...g, vendorId: t.clientId })).json();
1502
+ async function g(w) {
1503
+ return (await a.url("/checkouts").post({ language: Ci(), ...w, vendorId: t.clientId })).json();
1504
1504
  }
1505
- async function T() {
1506
- const g = await Ne(!1), I = new URL(`${ae("account", t.environment)}/subscriptions/${t.clientId}`);
1507
- g && (I.hash = `#access_token=${g}`), window.location.href = I.toString();
1505
+ async function T(w, S) {
1506
+ return (await a.url(`/checkouts/${w}`).patch(S)).json();
1507
+ }
1508
+ async function U(w) {
1509
+ return (await a.url(`/checkouts/${w}`).get()).json();
1510
+ }
1511
+ async function R() {
1512
+ const w = await Ne(!1), S = new URL(`${ae("account", t.environment)}/subscriptions/${t.clientId}`);
1513
+ w && (S.hash = `#access_token=${w}`), window.location.href = S.toString();
1508
1514
  }
1509
1515
  return {
1510
- createCheckout: y,
1516
+ createCheckout: g,
1517
+ updateCheckout: T,
1518
+ getCheckout: U,
1511
1519
  getEntitlements: s,
1512
1520
  getEntitlement: h,
1513
1521
  getEntitlementAccess: p,
1514
1522
  getContracts: u,
1515
1523
  getContract: c,
1516
- getProfile: K,
1524
+ getProfile: W,
1517
1525
  updateProfile: L,
1518
1526
  getSubscriptions: f,
1519
1527
  getBills: d,
1520
1528
  getBill: b,
1521
- setUserMetadata: S,
1522
- deleteUserMetadata: w,
1529
+ setUserMetadata: I,
1530
+ deleteUserMetadata: v,
1523
1531
  getUserMetadata: E,
1524
1532
  listUserMetadata: _,
1525
- getTags: v,
1533
+ getTags: y,
1526
1534
  deleteTag: l,
1527
1535
  setTag: k,
1528
1536
  getTally: O,
1529
- getTallies: C,
1537
+ getTallies: j,
1530
1538
  deleteTally: x,
1531
- pushTally: N,
1532
- getProduct: D,
1533
- getPaymentIssues: R,
1534
- autoOnboardProduct: J,
1535
- isSpotifyLinked: Z,
1536
- unlinkSpotify: j,
1537
- linkSpotify: W,
1539
+ pushTally: z,
1540
+ getProduct: M,
1541
+ getPaymentIssues: D,
1542
+ autoOnboardProduct: F,
1543
+ isSpotifyLinked: H,
1544
+ unlinkSpotify: C,
1545
+ linkSpotify: K,
1538
1546
  generateLink: m,
1539
- openHostedAccountPage: T
1547
+ openHostedAccountPage: R
1540
1548
  };
1541
1549
  }
1542
1550
  const cr = "@sesamy/sesamy-js", zt = "1.13.2";
@@ -1545,12 +1553,12 @@ function cn(t, e, n, r, i) {
1545
1553
  return t === i ? n : t;
1546
1554
  }
1547
1555
  var Ye = "undefined", un = "object", jt = function() {
1548
- }, ur = "any", lr = "*", we = "__", it = typeof process < "u" ? process : {};
1556
+ }, ur = "any", lr = "*", ve = "__", it = typeof process < "u" ? process : {};
1549
1557
  it.env && it.env.NODE_ENV;
1550
- var F = typeof document < "u";
1558
+ var J = typeof document < "u";
1551
1559
  it.versions != null && it.versions.node != null;
1552
1560
  typeof Deno < "u" && Deno.core;
1553
- F && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
1561
+ J && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
1554
1562
  function dr(t, e) {
1555
1563
  return e.charAt(0)[t]() + e.slice(1);
1556
1564
  }
@@ -1566,7 +1574,7 @@ function ot(t, e) {
1566
1574
  function Je(t, e) {
1567
1575
  return typeof e === t;
1568
1576
  }
1569
- var V = Je.bind(null, "function"), ce = Je.bind(null, "string"), _e = Je.bind(null, "undefined"), Ui = Je.bind(null, "boolean");
1577
+ var Y = Je.bind(null, "function"), ce = Je.bind(null, "string"), _e = Je.bind(null, "undefined"), Ui = Je.bind(null, "boolean");
1570
1578
  Je.bind(null, "symbol");
1571
1579
  function hr(t) {
1572
1580
  return t === null;
@@ -1577,7 +1585,7 @@ function Ri(t) {
1577
1585
  function fr(t) {
1578
1586
  return ot(t) === "array";
1579
1587
  }
1580
- function X(t) {
1588
+ function V(t) {
1581
1589
  if (!Ni(t)) return !1;
1582
1590
  for (var e = t; Object.getPrototypeOf(e) !== null; ) e = Object.getPrototypeOf(e);
1583
1591
  return Object.getPrototypeOf(t) === e;
@@ -1586,7 +1594,7 @@ function Ni(t) {
1586
1594
  return t && (typeof t == "object" || t !== null);
1587
1595
  }
1588
1596
  function Di(t) {
1589
- return V(t.constructor) ? t.constructor.name : null;
1597
+ return Y(t.constructor) ? t.constructor.name : null;
1590
1598
  }
1591
1599
  function zi(t) {
1592
1600
  return t instanceof Error || ce(t.message) && t.constructor && Ri(t.constructor.stackTraceLimit);
@@ -1631,7 +1639,7 @@ function ln(t) {
1631
1639
  }
1632
1640
  }
1633
1641
  function Hi() {
1634
- if (F) {
1642
+ if (J) {
1635
1643
  var t = navigator, e = t.languages;
1636
1644
  return t.userLanguage || (e && e.length ? e[0] : t.language);
1637
1645
  }
@@ -1656,7 +1664,7 @@ function Wi(t) {
1656
1664
  }
1657
1665
  return r;
1658
1666
  }(function(e) {
1659
- return F && window.location.search.substring(1);
1667
+ return J && window.location.search.substring(1);
1660
1668
  }());
1661
1669
  }
1662
1670
  function Fi(t, e, n) {
@@ -1685,7 +1693,7 @@ function Ji(t, e) {
1685
1693
  return n = this, r = arguments, p <= 0 ? (clearTimeout(o), o = null, a = h, i = t.apply(n, r)) : o || (o = setTimeout(s, p)), i;
1686
1694
  };
1687
1695
  }
1688
- var Me = "global", Ce = we + "global" + we, xe = typeof self === un && self.self === self && self || typeof global === un && global.global === global && global || void 0;
1696
+ var Me = "global", Ce = ve + "global" + ve, xe = typeof self === un && self.self === self && self || typeof global === un && global.global === global && global || void 0;
1689
1697
  function be(t) {
1690
1698
  return xe[Ce][t];
1691
1699
  }
@@ -1750,13 +1758,13 @@ function mr(t, e, n) {
1750
1758
  return p(), s.push(d), function() {
1751
1759
  if (b) {
1752
1760
  b = !1, p();
1753
- var S = s.indexOf(d);
1754
- s.splice(S, 1);
1761
+ var I = s.indexOf(d);
1762
+ s.splice(I, 1);
1755
1763
  }
1756
1764
  };
1757
1765
  }
1758
1766
  function f(d) {
1759
- if (!X(d)) throw new Error("Act != obj");
1767
+ if (!V(d)) throw new Error("Act != obj");
1760
1768
  if (typeof d.type === re) throw new Error("ActType " + re);
1761
1769
  if (h) throw new Error("Dispatch in reducer");
1762
1770
  try {
@@ -1764,7 +1772,7 @@ function mr(t, e, n) {
1764
1772
  } finally {
1765
1773
  h = !1;
1766
1774
  }
1767
- for (var b = a = s, S = 0; S < b.length; S++) (0, b[S])();
1775
+ for (var b = a = s, I = 0; I < b.length; I++) (0, b[I])();
1768
1776
  return d;
1769
1777
  }
1770
1778
  return f({ type: "@@redux/INIT" }), (r = { dispatch: f, subscribe: c, getState: u, replaceReducer: function(d) {
@@ -1772,12 +1780,12 @@ function mr(t, e, n) {
1772
1780
  i = d, f({ type: "@@redux/INIT" });
1773
1781
  } })[dn] = function() {
1774
1782
  var d, b = c;
1775
- return (d = { subscribe: function(S) {
1776
- if (typeof S != "object") throw new TypeError("Observer != obj");
1777
- function w() {
1778
- S.next && S.next(u());
1783
+ return (d = { subscribe: function(I) {
1784
+ if (typeof I != "object") throw new TypeError("Observer != obj");
1785
+ function v() {
1786
+ I.next && I.next(u());
1779
1787
  }
1780
- return w(), { unsubscribe: b(w) };
1788
+ return v(), { unsubscribe: b(v) };
1781
1789
  } })[dn] = function() {
1782
1790
  return this;
1783
1791
  }, d;
@@ -1810,7 +1818,7 @@ function Yi() {
1810
1818
  };
1811
1819
  };
1812
1820
  }
1813
- var ue = we + "anon_id", ve = we + "user_id", Pe = we + "user_traits", oe = "userId", Ee = "anonymousId", rt = ["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"], Ct = ["name", "EVENTS", "config", "loaded"], $ = rt.reduce(function(t, e) {
1821
+ var ue = ve + "anon_id", we = ve + "user_id", Pe = ve + "user_traits", oe = "userId", Ee = "anonymousId", rt = ["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"], Ct = ["name", "EVENTS", "config", "loaded"], $ = rt.reduce(function(t, e) {
1814
1822
  return t[e] = e, t;
1815
1823
  }, { registerPluginType: function(t) {
1816
1824
  return "registerPlugin:" + t;
@@ -1824,15 +1832,15 @@ function Gi(t) {
1824
1832
  return function(i) {
1825
1833
  if (i.type === $.bootstrap) {
1826
1834
  var o = i.params, a = i.user, s = i.persistedUser, h = i.initialUser, p = s.userId === a.userId;
1827
- s.anonymousId !== a.anonymousId && e(ue, a.anonymousId), p || e(ve, a.userId), h.traits && e(Pe, A({}, p && s.traits ? s.traits : {}, h.traits));
1835
+ s.anonymousId !== a.anonymousId && e(ue, a.anonymousId), p || e(we, a.userId), h.traits && e(Pe, A({}, p && s.traits ? s.traits : {}, h.traits));
1828
1836
  var u = Object.keys(i.params);
1829
1837
  if (u.length) {
1830
- var c = o.an_uid, f = o.an_event, d = u.reduce(function(b, S) {
1831
- if (S.match(hn) || S.match(/^(d|g)clid/)) {
1832
- var w = S.replace(hn, "");
1833
- b.campaign[w === "campaign" ? "name" : w] = o[S];
1838
+ var c = o.an_uid, f = o.an_event, d = u.reduce(function(b, I) {
1839
+ if (I.match(hn) || I.match(/^(d|g)clid/)) {
1840
+ var v = I.replace(hn, "");
1841
+ b.campaign[v === "campaign" ? "name" : v] = o[I];
1834
1842
  }
1835
- return S.match(fn) && (b.props[S.replace(fn, "")] = o[S]), S.match(pn) && (b.traits[S.replace(pn, "")] = o[S]), b;
1843
+ return I.match(fn) && (b.props[I.replace(fn, "")] = o[I]), I.match(pn) && (b.traits[I.replace(pn, "")] = o[I]), b;
1836
1844
  }, { campaign: {}, props: {}, traits: {} });
1837
1845
  n.dispatch(A({ type: $.params, raw: o }, d, c ? { userId: c } : {})), c && setTimeout(function() {
1838
1846
  return t.identify(c, d.traits);
@@ -1850,13 +1858,13 @@ function Bi(t) {
1850
1858
  return function(e, n) {
1851
1859
  if (e === void 0 && (e = {}), n === void 0 && (n = {}), n.type === $.setItemEnd) {
1852
1860
  if (n.key === ue) return A({}, e, { anonymousId: n.value });
1853
- if (n.key === ve) return A({}, e, { userId: n.value });
1861
+ if (n.key === we) return A({}, e, { userId: n.value });
1854
1862
  }
1855
1863
  switch (n.type) {
1856
1864
  case $.identify:
1857
1865
  return Object.assign({}, e, { userId: n.userId, traits: A({}, e.traits, n.traits) });
1858
1866
  case $.reset:
1859
- return [ve, ue, Pe].forEach(function(r) {
1867
+ return [we, ue, Pe].forEach(function(r) {
1860
1868
  t.removeItem(r);
1861
1869
  }), Object.assign({}, e, { userId: null, anonymousId: null, traits: {} });
1862
1870
  default:
@@ -1865,10 +1873,10 @@ function Bi(t) {
1865
1873
  };
1866
1874
  }
1867
1875
  function mn(t) {
1868
- return { userId: t.getItem(ve), anonymousId: t.getItem(ue), traits: t.getItem(Pe) };
1876
+ return { userId: t.getItem(we), anonymousId: t.getItem(ue), traits: t.getItem(Pe) };
1869
1877
  }
1870
1878
  var xt = function(t) {
1871
- return we + "TEMP" + we + t;
1879
+ return ve + "TEMP" + ve + t;
1872
1880
  };
1873
1881
  function qi(t) {
1874
1882
  var e = t.storage, n = e.setItem, r = e.removeItem, i = e.getItem;
@@ -1876,14 +1884,14 @@ function qi(t) {
1876
1884
  return function(a) {
1877
1885
  return function(s) {
1878
1886
  var h = s.userId, p = s.traits, u = s.options;
1879
- if (s.type === $.reset && ([ve, Pe, ue].forEach(function(d) {
1887
+ if (s.type === $.reset && ([we, Pe, ue].forEach(function(d) {
1880
1888
  r(d);
1881
1889
  }), [oe, Ee, "traits"].forEach(function(d) {
1882
1890
  Ae(xt(d));
1883
1891
  })), s.type === $.identify) {
1884
1892
  i(ue) || n(ue, lt());
1885
- var c = i(ve), f = i(Pe) || {};
1886
- c && c !== h && o.dispatch({ type: $.userIdChanged, old: { userId: c, traits: f }, new: { userId: h, traits: p }, options: u }), h && n(ve, h), p && n(Pe, A({}, f, p));
1893
+ var c = i(we), f = i(Pe) || {};
1894
+ c && c !== h && o.dispatch({ type: $.userIdChanged, old: { userId: c, traits: f }, new: { userId: h, traits: p }, options: u }), h && n(we, h), p && n(Pe, A({}, f, p));
1887
1895
  }
1888
1896
  return a(s);
1889
1897
  };
@@ -1892,7 +1900,7 @@ function qi(t) {
1892
1900
  }
1893
1901
  var ze = {};
1894
1902
  function gn(t, e) {
1895
- ze[t] && V(ze[t]) && (ze[t](e), delete ze[t]);
1903
+ ze[t] && Y(ze[t]) && (ze[t](e), delete ze[t]);
1896
1904
  }
1897
1905
  function gr(t, e, n) {
1898
1906
  return new Promise(function(r, i) {
@@ -1914,17 +1922,17 @@ function yr(t, e, n) {
1914
1922
  }, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
1915
1923
  if (p.processIndex && p.processIndex.length) {
1916
1924
  p.processIndex.forEach(function(c) {
1917
- var f = s.actions[c], d = f.plugin, b = f.payload.type, S = i[d][b];
1918
- if (S && V(S)) {
1919
- var w, E = function(l, k) {
1920
- return l === void 0 && (l = {}), k === void 0 && (k = {}), [oe, Ee].reduce(function(O, C) {
1921
- return l.hasOwnProperty(C) && k[C] && k[C] !== l[C] && (O[C] = k[C]), O;
1925
+ var f = s.actions[c], d = f.plugin, b = f.payload.type, I = i[d][b];
1926
+ if (I && Y(I)) {
1927
+ var v, E = function(l, k) {
1928
+ return l === void 0 && (l = {}), k === void 0 && (k = {}), [oe, Ee].reduce(function(O, j) {
1929
+ return l.hasOwnProperty(j) && k[j] && k[j] !== l[j] && (O[j] = k[j]), O;
1922
1930
  }, l);
1923
1931
  }(f.payload, h), _ = r[E.meta.rid];
1924
- if (!_ && (w = S({ payload: E, config: a[d].config, instance: n, abort: Qi })) && X(w) && w.abort) return void (r[E.meta.rid] = !0);
1932
+ if (!_ && (v = I({ payload: E, config: a[d].config, instance: n, abort: Qi })) && V(v) && v.abort) return void (r[E.meta.rid] = !0);
1925
1933
  if (!_) {
1926
- var v = b + ":" + d;
1927
- t.dispatch(A({}, E, { type: v, _: { called: v, from: "queueDrain" } }));
1934
+ var y = b + ":" + d;
1935
+ t.dispatch(A({}, E, { type: y, _: { called: y, from: "queueDrain" } }));
1928
1936
  }
1929
1937
  }
1930
1938
  });
@@ -1935,116 +1943,116 @@ function yr(t, e, n) {
1935
1943
  }
1936
1944
  }
1937
1945
  }
1938
- var vt = function(t) {
1946
+ var wt = function(t) {
1939
1947
  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;
1940
1948
  try {
1941
- var p = i.plugins, u = i.context, c = n.type, f = c.match(Te), d = e.exact.map(function(w) {
1942
- return w.pluginName;
1949
+ var p = i.plugins, u = i.context, c = n.type, f = c.match(Te), d = e.exact.map(function(v) {
1950
+ return v.pluginName;
1943
1951
  });
1944
- f && (d = a.during.map(function(w) {
1945
- return w.pluginName;
1952
+ f && (d = a.during.map(function(v) {
1953
+ return v.pluginName;
1946
1954
  }));
1947
- var b = /* @__PURE__ */ function(w, E) {
1948
- return function(_, v, l) {
1949
- var k = v.config, O = v.name, C = O + "." + _.type;
1950
- l && (C = l.event);
1951
- var x = _.type.match(Te) ? /* @__PURE__ */ function(N, D, K, L, R) {
1952
- return function(Z, j) {
1953
- var W = L ? L.name : N, J = j && Fe(j) ? j : K;
1954
- if (L && (!(J = j && Fe(j) ? j : [N]).includes(N) || J.length !== 1)) throw new Error("Method " + D + " can only abort " + N + " plugin. " + JSON.stringify(J) + " input valid");
1955
- return A({}, R, { abort: { reason: Z, plugins: J, caller: D, _: W } });
1955
+ var b = /* @__PURE__ */ function(v, E) {
1956
+ return function(_, y, l) {
1957
+ var k = y.config, O = y.name, j = O + "." + _.type;
1958
+ l && (j = l.event);
1959
+ var x = _.type.match(Te) ? /* @__PURE__ */ function(z, M, W, L, D) {
1960
+ return function(H, C) {
1961
+ var K = L ? L.name : z, F = C && Fe(C) ? C : W;
1962
+ if (L && (!(F = C && Fe(C) ? C : [z]).includes(z) || F.length !== 1)) throw new Error("Method " + M + " can only abort " + z + " plugin. " + JSON.stringify(F) + " input valid");
1963
+ return A({}, D, { abort: { reason: H, plugins: F, caller: M, _: K } });
1956
1964
  };
1957
- }(O, C, E, l, _) : /* @__PURE__ */ function(N, D) {
1965
+ }(O, j, E, l, _) : /* @__PURE__ */ function(z, M) {
1958
1966
  return function() {
1959
- throw new Error(N.type + " action not cancellable. Remove abort in " + D);
1967
+ throw new Error(z.type + " action not cancellable. Remove abort in " + M);
1960
1968
  };
1961
- }(_, C);
1962
- return { payload: eo(_), instance: w, config: k || {}, abort: x };
1969
+ }(_, j);
1970
+ return { payload: eo(_), instance: v, config: k || {}, abort: x };
1963
1971
  };
1964
- }(r, d), S = e.exact.reduce(function(w, E) {
1965
- var _ = E.pluginName, v = E.methodName, l = !1;
1966
- return v.match(/^initialize/) || v.match(/^reset/) || (l = !p[_].loaded), u.offline && v.match(/^(page|track|identify)/) && (l = !0), w["" + _] = l, w;
1972
+ }(r, d), I = e.exact.reduce(function(v, E) {
1973
+ var _ = E.pluginName, y = E.methodName, l = !1;
1974
+ return y.match(/^initialize/) || y.match(/^reset/) || (l = !p[_].loaded), u.offline && y.match(/^(page|track|identify)/) && (l = !0), v["" + _] = l, v;
1967
1975
  }, {});
1968
- return Promise.resolve(e.exact.reduce(function(w, E, _) {
1976
+ return Promise.resolve(e.exact.reduce(function(v, E, _) {
1969
1977
  try {
1970
- var v = E.pluginName;
1971
- return Promise.resolve(w).then(function(l) {
1978
+ var y = E.pluginName;
1979
+ return Promise.resolve(v).then(function(l) {
1972
1980
  function k() {
1973
1981
  return Promise.resolve(l);
1974
1982
  }
1975
1983
  var O = function() {
1976
- if (e.namespaced && e.namespaced[v]) return Promise.resolve(e.namespaced[v].reduce(function(C, x, N) {
1984
+ if (e.namespaced && e.namespaced[y]) return Promise.resolve(e.namespaced[y].reduce(function(j, x, z) {
1977
1985
  try {
1978
- return Promise.resolve(C).then(function(D) {
1979
- return x.method && V(x.method) ? (function(Z, j) {
1980
- var W = Sn(Z);
1981
- if (W && W.name === j) {
1982
- var J = Sn(W.method);
1983
- throw new Error([j + " plugin is calling method " + Z, "Plugins cant call self", "Use " + W.method + " " + (J ? "or " + J.method : "") + " in " + j + " plugin insteadof " + Z].join(`
1986
+ return Promise.resolve(j).then(function(M) {
1987
+ return x.method && Y(x.method) ? (function(H, C) {
1988
+ var K = Sn(H);
1989
+ if (K && K.name === C) {
1990
+ var F = Sn(K.method);
1991
+ throw new Error([C + " plugin is calling method " + H, "Plugins cant call self", "Use " + K.method + " " + (F ? "or " + F.method : "") + " in " + C + " plugin insteadof " + H].join(`
1984
1992
  `));
1985
1993
  }
1986
- }(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: D, instance: r, abort: (K = D, L = v, R = x.pluginName, function(Z, j) {
1987
- return A({}, K, { abort: { reason: Z, plugins: j || [L], caller: c, from: R || L } });
1988
- }), config: wn(x.pluginName, p, o), plugins: p })).then(function(Z) {
1989
- var j = X(Z) ? Z : {};
1990
- return Promise.resolve(A({}, D, j));
1991
- })) : D;
1992
- var K, L, R;
1994
+ }(x.methodName, x.pluginName), Promise.resolve(x.method({ payload: M, instance: r, abort: (W = M, L = y, D = x.pluginName, function(H, C) {
1995
+ return A({}, W, { abort: { reason: H, plugins: C || [L], caller: c, from: D || L } });
1996
+ }), config: vn(x.pluginName, p, o), plugins: p })).then(function(H) {
1997
+ var C = V(H) ? H : {};
1998
+ return Promise.resolve(A({}, M, C));
1999
+ })) : M;
2000
+ var W, L, D;
1993
2001
  });
1994
- } catch (D) {
1995
- return Promise.reject(D);
2002
+ } catch (M) {
2003
+ return Promise.reject(M);
1996
2004
  }
1997
- }, Promise.resolve(n))).then(function(C) {
1998
- l[v] = C;
2005
+ }, Promise.resolve(n))).then(function(j) {
2006
+ l[y] = j;
1999
2007
  });
2000
- l[v] = n;
2008
+ l[y] = n;
2001
2009
  }();
2002
2010
  return O && O.then ? O.then(k) : k();
2003
2011
  });
2004
2012
  } catch (l) {
2005
2013
  return Promise.reject(l);
2006
2014
  }
2007
- }, Promise.resolve({}))).then(function(w) {
2008
- return Promise.resolve(e.exact.reduce(function(E, _, v) {
2015
+ }, Promise.resolve({}))).then(function(v) {
2016
+ return Promise.resolve(e.exact.reduce(function(E, _, y) {
2009
2017
  try {
2010
- var l = e.exact.length === v + 1, k = _.pluginName, O = o[k];
2011
- return Promise.resolve(E).then(function(C) {
2012
- var x = w[k] ? w[k] : {};
2013
- if (f && (x = C), bt(x, k)) return wt({ data: x, method: c, instance: r, pluginName: k, store: s }), Promise.resolve(C);
2014
- if (bt(C, k)) return l && wt({ data: C, method: c, instance: r, store: s }), Promise.resolve(C);
2015
- if (S.hasOwnProperty(k) && S[k] === !0) return s.dispatch({ type: "queue", plugin: k, payload: x, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(C);
2016
- var N = b(w[k], o[k]);
2017
- return Promise.resolve(O[c]({ abort: N.abort, payload: x, instance: r, config: wn(k, p, o), plugins: p })).then(function(D) {
2018
- var K = X(D) ? D : {}, L = A({}, C, K), R = w[k];
2019
- if (bt(R, k)) wt({ data: R, method: c, instance: r, pluginName: k, store: s });
2018
+ var l = e.exact.length === y + 1, k = _.pluginName, O = o[k];
2019
+ return Promise.resolve(E).then(function(j) {
2020
+ var x = v[k] ? v[k] : {};
2021
+ if (f && (x = j), bt(x, k)) return vt({ data: x, method: c, instance: r, pluginName: k, store: s }), Promise.resolve(j);
2022
+ if (bt(j, k)) return l && vt({ data: j, method: c, instance: r, store: s }), Promise.resolve(j);
2023
+ if (I.hasOwnProperty(k) && I[k] === !0) return s.dispatch({ type: "queue", plugin: k, payload: x, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(j);
2024
+ var z = b(v[k], o[k]);
2025
+ return Promise.resolve(O[c]({ abort: z.abort, payload: x, instance: r, config: vn(k, p, o), plugins: p })).then(function(M) {
2026
+ var W = V(M) ? M : {}, L = A({}, j, W), D = v[k];
2027
+ if (bt(D, k)) vt({ data: D, method: c, instance: r, pluginName: k, store: s });
2020
2028
  else {
2021
- var Z = c + ":" + k;
2022
- (Z.match(/:/g) || []).length < 2 && !c.match(yn) && !c.match(vn) && r.dispatch(A({}, f ? L : x, { type: Z, _: { called: Z, from: "submethod" } }));
2029
+ var H = c + ":" + k;
2030
+ (H.match(/:/g) || []).length < 2 && !c.match(yn) && !c.match(wn) && r.dispatch(A({}, f ? L : x, { type: H, _: { called: H, from: "submethod" } }));
2023
2031
  }
2024
2032
  return Promise.resolve(L);
2025
2033
  });
2026
2034
  });
2027
- } catch (C) {
2028
- return Promise.reject(C);
2035
+ } catch (j) {
2036
+ return Promise.reject(j);
2029
2037
  }
2030
2038
  }, Promise.resolve(n))).then(function(E) {
2031
- if (!(c.match(Te) || c.match(/^registerPlugin/) || c.match(vn) || c.match(yn) || c.match(/^params/) || c.match(/^userIdChanged/))) {
2039
+ if (!(c.match(Te) || c.match(/^registerPlugin/) || c.match(wn) || c.match(yn) || c.match(/^params/) || c.match(/^userIdChanged/))) {
2032
2040
  if (h.plugins.includes(c), E._ && E._.originalAction === c) return E;
2033
2041
  var _ = A({}, E, { _: { originalAction: E.type, called: E.type, from: "engineEnd" } });
2034
- vr(E, e.exact.length) && !c.match(/End$/) && (_ = A({}, _, { type: E.type + "Aborted" })), s.dispatch(_);
2042
+ wr(E, e.exact.length) && !c.match(/End$/) && (_ = A({}, _, { type: E.type + "Aborted" })), s.dispatch(_);
2035
2043
  }
2036
2044
  return E;
2037
2045
  });
2038
2046
  });
2039
- } catch (w) {
2040
- return Promise.reject(w);
2047
+ } catch (v) {
2048
+ return Promise.reject(v);
2041
2049
  }
2042
- }, Te = /Start$/, yn = /^bootstrap/, vn = /^ready/;
2043
- function wt(t) {
2050
+ }, Te = /Start$/, yn = /^bootstrap/, wn = /^ready/;
2051
+ function vt(t) {
2044
2052
  var e = t.pluginName, n = t.method + "Aborted" + (e ? ":" + e : "");
2045
2053
  t.store.dispatch(A({}, t.data, { type: n, _: { called: n, from: "abort" } }));
2046
2054
  }
2047
- function wn(t, e, n) {
2055
+ function vn(t, e, n) {
2048
2056
  var r = e[t] || n[t];
2049
2057
  return r && r.config ? r.config : {};
2050
2058
  }
@@ -2061,7 +2069,7 @@ function bt(t, e) {
2061
2069
  var n = t.abort;
2062
2070
  return !!n && (n === !0 || In(n, e) || n && In(n.plugins, e));
2063
2071
  }
2064
- function vr(t, e) {
2072
+ function wr(t, e) {
2065
2073
  var n = t.abort;
2066
2074
  if (!n) return !1;
2067
2075
  if (n === !0 || ce(n)) return !0;
@@ -2080,7 +2088,7 @@ function Sn(t) {
2080
2088
  }
2081
2089
  function eo(t) {
2082
2090
  return Object.keys(t).reduce(function(e, n) {
2083
- return n === "type" || (e[n] = X(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
2091
+ return n === "type" || (e[n] = V(t[n]) ? Object.assign({}, t[n]) : t[n]), e;
2084
2092
  }, {});
2085
2093
  }
2086
2094
  function to(t, e, n) {
@@ -2100,87 +2108,87 @@ function to(t, e, n) {
2100
2108
  return u.includes(l);
2101
2109
  }).map(function(l) {
2102
2110
  return f[l];
2103
- }), S = [], w = [], E = a.disabled, _ = b.map(function(l) {
2104
- var k = l.loaded, O = l.name, C = l.config;
2111
+ }), I = [], v = [], E = a.disabled, _ = b.map(function(l) {
2112
+ var k = l.loaded, O = l.name, j = l.config;
2105
2113
  return gr(l, function() {
2106
- return k({ config: C });
2114
+ return k({ config: j });
2107
2115
  }, 1e4).then(function(x) {
2108
- return r[O] || (i.dispatch({ type: $.pluginReadyType(O), name: O, events: Object.keys(l).filter(function(N) {
2109
- return !Ct.includes(N);
2110
- }) }), r[O] = !0), S = S.concat(O), l;
2116
+ return r[O] || (i.dispatch({ type: $.pluginReadyType(O), name: O, events: Object.keys(l).filter(function(z) {
2117
+ return !Ct.includes(z);
2118
+ }) }), r[O] = !0), I = I.concat(O), l;
2111
2119
  }).catch(function(x) {
2112
2120
  if (x instanceof Error) throw new Error(x);
2113
- return w = w.concat(x.name), x;
2121
+ return v = v.concat(x.name), x;
2114
2122
  });
2115
2123
  });
2116
2124
  Promise.all(_).then(function(l) {
2117
- var k = { plugins: S, failed: w, disabled: E };
2125
+ var k = { plugins: I, failed: v, disabled: E };
2118
2126
  setTimeout(function() {
2119
2127
  d.length === _.length + E.length && i.dispatch(A({}, { type: $.ready }, k));
2120
2128
  }, 0);
2121
2129
  });
2122
2130
  }
2123
- var v = function() {
2131
+ var y = function() {
2124
2132
  if (p !== $.bootstrap) return /^ready:([^:]*)$/.test(p) && setTimeout(function() {
2125
2133
  return yr(i, e, t);
2126
- }, 0), Promise.resolve(function(l, k, O, C, x) {
2134
+ }, 0), Promise.resolve(function(l, k, O, j, x) {
2127
2135
  try {
2128
- var N = V(k) ? k() : k, D = l.type, K = D.replace(Te, "");
2136
+ var z = Y(k) ? k() : k, M = l.type, W = M.replace(Te, "");
2129
2137
  if (l._ && l._.called) return Promise.resolve(l);
2130
- var L = O.getState(), R = (W = N, (J = L.plugins) === void 0 && (J = {}), (de = l.options) === void 0 && (de = {}), Object.keys(W).filter(function(m) {
2131
- var y = de.plugins || {};
2132
- return Ui(y[m]) ? y[m] : y.all !== !1 && (!J[m] || J[m].enabled !== !1);
2138
+ var L = O.getState(), D = (K = z, (F = L.plugins) === void 0 && (F = {}), (de = l.options) === void 0 && (de = {}), Object.keys(K).filter(function(m) {
2139
+ var g = de.plugins || {};
2140
+ return Ui(g[m]) ? g[m] : g.all !== !1 && (!F[m] || F[m].enabled !== !1);
2133
2141
  }).map(function(m) {
2134
- return W[m];
2142
+ return K[m];
2135
2143
  }));
2136
- D === $.initializeStart && l.fromEnable && (R = Object.keys(L.plugins).filter(function(m) {
2137
- var y = L.plugins[m];
2138
- return l.plugins.includes(m) && !y.initialized;
2144
+ M === $.initializeStart && l.fromEnable && (D = Object.keys(L.plugins).filter(function(m) {
2145
+ var g = L.plugins[m];
2146
+ return l.plugins.includes(m) && !g.initialized;
2139
2147
  }).map(function(m) {
2140
- return N[m];
2148
+ return z[m];
2141
2149
  }));
2142
- var Z = R.map(function(m) {
2150
+ var H = D.map(function(m) {
2143
2151
  return m.name;
2144
- }), j = function(m, y, T) {
2145
- var g = kn(m).map(function(I) {
2146
- return bn(I, y);
2152
+ }), C = function(m, g, T) {
2153
+ var U = kn(m).map(function(R) {
2154
+ return bn(R, g);
2147
2155
  });
2148
- return y.reduce(function(I, P) {
2149
- var M = P.name, U = kn(m, M).map(function(Ue) {
2150
- return bn(Ue, y);
2151
- }), H = U[0], z = U[1], ee = U[2];
2152
- return H.length && (I.beforeNS[M] = H), z.length && (I.duringNS[M] = z), ee.length && (I.afterNS[M] = ee), I;
2153
- }, { before: g[0], beforeNS: {}, during: g[1], duringNS: {}, after: g[2], afterNS: {} });
2154
- }(D, R);
2155
- return Promise.resolve(vt({ action: l, data: { exact: j.before, namespaced: j.beforeNS }, state: L, allPlugins: N, allMatches: j, instance: O, store: C, EVENTS: x })).then(function(m) {
2156
- function y() {
2157
- var I = function() {
2158
- if (D.match(Te)) return Promise.resolve(vt({ action: A({}, T, { type: K + "End" }), data: { exact: j.after, namespaced: j.afterNS }, state: L, allPlugins: N, allMatches: j, instance: O, store: C, EVENTS: x })).then(function(P) {
2159
- P.meta && P.meta.hasCallback && gn(P.meta.rid, { payload: P });
2156
+ return g.reduce(function(R, w) {
2157
+ var S = w.name, P = kn(m, S).map(function(Ue) {
2158
+ return bn(Ue, g);
2159
+ }), Z = P[0], N = P[1], X = P[2];
2160
+ return Z.length && (R.beforeNS[S] = Z), N.length && (R.duringNS[S] = N), X.length && (R.afterNS[S] = X), R;
2161
+ }, { before: U[0], beforeNS: {}, during: U[1], duringNS: {}, after: U[2], afterNS: {} });
2162
+ }(M, D);
2163
+ return Promise.resolve(wt({ action: l, data: { exact: C.before, namespaced: C.beforeNS }, state: L, allPlugins: z, allMatches: C, instance: O, store: j, EVENTS: x })).then(function(m) {
2164
+ function g() {
2165
+ var R = function() {
2166
+ if (M.match(Te)) return Promise.resolve(wt({ action: A({}, T, { type: W + "End" }), data: { exact: C.after, namespaced: C.afterNS }, state: L, allPlugins: z, allMatches: C, instance: O, store: j, EVENTS: x })).then(function(w) {
2167
+ w.meta && w.meta.hasCallback && gn(w.meta.rid, { payload: w });
2160
2168
  });
2161
2169
  }();
2162
- return I && I.then ? I.then(function() {
2170
+ return R && R.then ? R.then(function() {
2163
2171
  return m;
2164
2172
  }) : m;
2165
2173
  }
2166
- if (vr(m, Z.length)) return m;
2167
- var T, g = function() {
2168
- if (D !== K) return Promise.resolve(vt({ action: A({}, m, { type: K }), data: { exact: j.during, namespaced: j.duringNS }, state: L, allPlugins: N, allMatches: j, instance: O, store: C, EVENTS: x })).then(function(I) {
2169
- T = I;
2174
+ if (wr(m, H.length)) return m;
2175
+ var T, U = function() {
2176
+ if (M !== W) return Promise.resolve(wt({ action: A({}, m, { type: W }), data: { exact: C.during, namespaced: C.duringNS }, state: L, allPlugins: z, allMatches: C, instance: O, store: j, EVENTS: x })).then(function(R) {
2177
+ T = R;
2170
2178
  });
2171
2179
  T = m;
2172
2180
  }();
2173
- return g && g.then ? g.then(y) : y();
2181
+ return U && U.then ? U.then(g) : g();
2174
2182
  });
2175
2183
  } catch (m) {
2176
2184
  return Promise.reject(m);
2177
2185
  }
2178
- var W, J, de;
2186
+ var K, F, de;
2179
2187
  }(a, e, t, i, n)).then(function(l) {
2180
2188
  return s = 1, o(l);
2181
2189
  });
2182
2190
  }();
2183
- return Promise.resolve(v && v.then ? v.then(h) : h(v));
2191
+ return Promise.resolve(y && y.then ? y.then(h) : h(y));
2184
2192
  } catch (l) {
2185
2193
  return Promise.reject(l);
2186
2194
  }
@@ -2260,7 +2268,7 @@ function En(t, e, n) {
2260
2268
  return r[i] = A({}, n[i], { enabled: e }), r;
2261
2269
  }, n);
2262
2270
  }
2263
- function wr(t) {
2271
+ function vr(t) {
2264
2272
  try {
2265
2273
  return JSON.parse(JSON.stringify(t));
2266
2274
  } catch {
@@ -2272,7 +2280,7 @@ function ao(t, e) {
2272
2280
  t === void 0 && (t = oo);
2273
2281
  var n = e.options, r = e.meta;
2274
2282
  if (e.type === $.track) {
2275
- var i = wr(A({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
2283
+ var i = vr(A({ event: e.event, properties: e.properties }, Object.keys(n).length && { options: n }, { meta: r }));
2276
2284
  return A({}, t, { last: i, history: t.history.concat(i) });
2277
2285
  }
2278
2286
  return t;
@@ -2297,11 +2305,11 @@ function uo(t) {
2297
2305
  return "/" + (e && e[3] ? e[3].split("?")[0].replace(br, "") : "");
2298
2306
  }
2299
2307
  var kr, Ir, Sr, _r, lo = function(t) {
2300
- if (t === void 0 && (t = {}), !F) return t;
2308
+ if (t === void 0 && (t = {}), !J) return t;
2301
2309
  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) {
2302
2310
  var d = function() {
2303
- if (F) {
2304
- for (var b, S = document.getElementsByTagName("link"), w = 0; b = S[w]; w++) if (b.getAttribute("rel") === "canonical") return b.getAttribute("href");
2311
+ if (J) {
2312
+ for (var b, I = document.getElementsByTagName("link"), v = 0; b = I[v]; v++) if (b.getAttribute("rel") === "canonical") return b.getAttribute("href");
2305
2313
  }
2306
2314
  }();
2307
2315
  return d ? d.match(/\?/) ? d : d + f : window.location.href.replace(br, "");
@@ -2312,17 +2320,17 @@ function fo(t, e) {
2312
2320
  t === void 0 && (t = ho);
2313
2321
  var n = e.options;
2314
2322
  if (e.type === $.page) {
2315
- var r = wr(A({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
2323
+ var r = vr(A({ properties: e.properties, meta: e.meta }, Object.keys(n).length && { options: n }));
2316
2324
  return A({}, t, { last: r, history: t.history.concat(r) });
2317
2325
  }
2318
2326
  return t;
2319
2327
  }
2320
2328
  kr = function() {
2321
- if (!F) return !1;
2329
+ if (!J) return !1;
2322
2330
  var t = navigator.appVersion;
2323
2331
  return ~t.indexOf("Win") ? "Windows" : ~t.indexOf("Mac") ? "MacOS" : ~t.indexOf("X11") ? "UNIX" : ~t.indexOf("Linux") ? "Linux" : "Unknown OS";
2324
- }(), Ir = F ? document.referrer : null, Sr = Hi(), _r = Ki();
2325
- var Pn = { initialized: !1, sessionId: lt(), app: null, version: null, debug: !1, offline: !!F && !navigator.onLine, os: { name: kr }, userAgent: F ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.13" }, timezone: _r, locale: Sr, campaign: {}, referrer: Ir };
2332
+ }(), Ir = J ? document.referrer : null, Sr = Hi(), _r = Ki();
2333
+ var Pn = { initialized: !1, sessionId: lt(), app: null, version: null, debug: !1, offline: !!J && !navigator.onLine, os: { name: kr }, userAgent: J ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.13" }, timezone: _r, locale: Sr, campaign: {}, referrer: Ir };
2326
2334
  function po(t, e) {
2327
2335
  t === void 0 && (t = Pn);
2328
2336
  var n = t.initialized, r = e.campaign;
@@ -2339,7 +2347,7 @@ function po(t, e) {
2339
2347
  }
2340
2348
  var mo = ["plugins", "reducers", "storage"];
2341
2349
  function go(t, e, n) {
2342
- if (F) {
2350
+ if (J) {
2343
2351
  var r = window[(n ? "add" : "remove") + "EventListener"];
2344
2352
  t.split(" ").forEach(function(i) {
2345
2353
  r(i, e);
@@ -2376,7 +2384,7 @@ function On(t, e, n) {
2376
2384
  t === void 0 && (t = {});
2377
2385
  var r, i, o = lt();
2378
2386
  return e && (ze[o] = (r = e, i = function(a) {
2379
- for (var s, h = a || Array.prototype.slice.call(arguments), p = 0; p < h.length; p++) if (V(h[p])) {
2387
+ for (var s, h = a || Array.prototype.slice.call(arguments), p = 0; p < h.length; p++) if (Y(h[p])) {
2380
2388
  s = h[p];
2381
2389
  break;
2382
2390
  }
@@ -2385,30 +2393,30 @@ function On(t, e, n) {
2385
2393
  i && i(a), r(a);
2386
2394
  })), A({}, t, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, e ? { hasCallback: !0 } : {});
2387
2395
  }
2388
- function vo(t) {
2396
+ function wo(t) {
2389
2397
  t === void 0 && (t = {});
2390
- var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m, y) {
2391
- if (V(y)) return m.middlewares = m.middlewares.concat(y), m;
2392
- if (y.NAMESPACE && (y.name = y.NAMESPACE), !y.name) throw new Error("https://lytics.dev/errors/1");
2393
- y.config || (y.config = {});
2394
- var T = y.EVENTS ? Object.keys(y.EVENTS).map(function(P) {
2395
- return y.EVENTS[P];
2398
+ var e = t.reducers || {}, n = t.initialUser || {}, r = (t.plugins || []).reduce(function(m, g) {
2399
+ if (Y(g)) return m.middlewares = m.middlewares.concat(g), m;
2400
+ if (g.NAMESPACE && (g.name = g.NAMESPACE), !g.name) throw new Error("https://lytics.dev/errors/1");
2401
+ g.config || (g.config = {});
2402
+ var T = g.EVENTS ? Object.keys(g.EVENTS).map(function(w) {
2403
+ return g.EVENTS[w];
2396
2404
  }) : [];
2397
- 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(P, M) {
2398
- var U;
2399
- return P[M] = (U = y.methods[M], function() {
2400
- for (var H = Array.prototype.slice.call(arguments), z = new Array(U.length), ee = 0; ee < H.length; ee++) z[ee] = H[ee];
2401
- return z[z.length] = k, U.apply({ instance: k }, z);
2402
- }), P;
2403
- }, {}), delete y.methods);
2404
- var g = Object.keys(y).concat(T), I = new Set(m.events.concat(g));
2405
- if (m.events = Array.from(I), m.pluginsArray = m.pluginsArray.concat(y), m.plugins[y.name]) throw new Error(y.name + "AlreadyLoaded");
2406
- return m.plugins[y.name] = y, m.plugins[y.name].loaded || (m.plugins[y.name].loaded = function() {
2405
+ 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(w, S) {
2406
+ var P;
2407
+ return w[S] = (P = g.methods[S], function() {
2408
+ for (var Z = Array.prototype.slice.call(arguments), N = new Array(P.length), X = 0; X < Z.length; X++) N[X] = Z[X];
2409
+ return N[N.length] = k, P.apply({ instance: k }, N);
2410
+ }), w;
2411
+ }, {}), delete g.methods);
2412
+ var U = Object.keys(g).concat(T), R = new Set(m.events.concat(U));
2413
+ if (m.events = Array.from(R), m.pluginsArray = m.pluginsArray.concat(g), m.plugins[g.name]) throw new Error(g.name + "AlreadyLoaded");
2414
+ return m.plugins[g.name] = g, m.plugins[g.name].loaded || (m.plugins[g.name].loaded = function() {
2407
2415
  return !0;
2408
2416
  }), m;
2409
2417
  }, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), i = t.storage ? t.storage : { getItem: be, setItem: ke, removeItem: Ae }, o = /* @__PURE__ */ function(m) {
2410
- return function(y, T, g) {
2411
- return T.getState("user")[y] || (g && X(g) && g[y] ? g[y] : mn(m)[y] || be(xt(y)) || null);
2418
+ return function(g, T, U) {
2419
+ return T.getState("user")[g] || (U && V(U) && U[g] ? U[g] : mn(m)[g] || be(xt(g)) || null);
2412
2420
  };
2413
2421
  }(i), a = r.plugins, s = r.events.filter(function(m) {
2414
2422
  return !Ct.includes(m);
@@ -2416,187 +2424,187 @@ function vo(t) {
2416
2424
  return !Ct.includes(m);
2417
2425
  })), p = Array.from(h).sort(), u = function() {
2418
2426
  return a;
2419
- }, c = new ro(), f = c.addMiddleware, d = c.removeMiddleware, b = c.dynamicMiddlewares, S = function() {
2427
+ }, c = new ro(), f = c.addMiddleware, d = c.removeMiddleware, b = c.dynamicMiddlewares, I = function() {
2420
2428
  throw new Error("Abort disabled inListener");
2421
- }, w = Wi(), E = mn(i), _ = A({}, E, n, w.an_uid ? { userId: w.an_uid } : {}, w.an_aid ? { anonymousId: w.an_aid } : {});
2429
+ }, v = Wi(), E = mn(i), _ = A({}, E, n, v.an_uid ? { userId: v.an_uid } : {}, v.an_aid ? { anonymousId: v.an_aid } : {});
2422
2430
  _.anonymousId || (_.anonymousId = lt());
2423
- var v = A({ enable: function(m, y) {
2431
+ var y = A({ enable: function(m, g) {
2424
2432
  return new Promise(function(T) {
2425
- j.dispatch({ type: $.enablePlugin, plugins: kt(m), _: { originalAction: $.enablePlugin } }, T, [y]);
2433
+ C.dispatch({ type: $.enablePlugin, plugins: kt(m), _: { originalAction: $.enablePlugin } }, T, [g]);
2426
2434
  });
2427
- }, disable: function(m, y) {
2435
+ }, disable: function(m, g) {
2428
2436
  return new Promise(function(T) {
2429
- j.dispatch({ type: $.disablePlugin, plugins: kt(m), _: { originalAction: $.disablePlugin } }, T, [y]);
2437
+ C.dispatch({ type: $.disablePlugin, plugins: kt(m), _: { originalAction: $.disablePlugin } }, T, [g]);
2430
2438
  });
2431
- } }, r.methods), l = !1, k = { identify: function(m, y, T, g) {
2432
- try {
2433
- var I = ce(m) ? m : null, P = X(m) ? m : y, M = T || {}, U = k.user();
2434
- ke(xt(oe), I);
2435
- var H = I || P.userId || o(oe, k, P);
2436
- return Promise.resolve(new Promise(function(z) {
2437
- j.dispatch(A({ type: $.identifyStart, userId: H, traits: P || {}, options: M, anonymousId: U.anonymousId }, U.id && U.id !== I && { previousId: U.id }), z, [y, T, g]);
2438
- }));
2439
- } catch (z) {
2440
- return Promise.reject(z);
2441
- }
2442
- }, track: function(m, y, T, g) {
2439
+ } }, r.methods), l = !1, k = { identify: function(m, g, T, U) {
2443
2440
  try {
2444
- var I = X(m) ? m.event : m;
2445
- if (!I || !ce(I)) throw new Error("EventMissing");
2446
- var P = X(m) ? m : y || {}, M = X(T) ? T : {};
2447
- return Promise.resolve(new Promise(function(U) {
2448
- j.dispatch({ type: $.trackStart, event: I, properties: P, options: M, userId: o(oe, k, y), anonymousId: o(Ee, k, y) }, U, [y, T, g]);
2441
+ var R = ce(m) ? m : null, w = V(m) ? m : g, S = T || {}, P = k.user();
2442
+ ke(xt(oe), R);
2443
+ var Z = R || w.userId || o(oe, k, w);
2444
+ return Promise.resolve(new Promise(function(N) {
2445
+ C.dispatch(A({ type: $.identifyStart, userId: Z, traits: w || {}, options: S, anonymousId: P.anonymousId }, P.id && P.id !== R && { previousId: P.id }), N, [g, T, U]);
2449
2446
  }));
2450
- } catch (U) {
2451
- return Promise.reject(U);
2447
+ } catch (N) {
2448
+ return Promise.reject(N);
2452
2449
  }
2453
- }, page: function(m, y, T) {
2450
+ }, track: function(m, g, T, U) {
2454
2451
  try {
2455
- var g = X(m) ? m : {}, I = X(y) ? y : {};
2452
+ var R = V(m) ? m.event : m;
2453
+ if (!R || !ce(R)) throw new Error("EventMissing");
2454
+ var w = V(m) ? m : g || {}, S = V(T) ? T : {};
2456
2455
  return Promise.resolve(new Promise(function(P) {
2457
- j.dispatch({ type: $.pageStart, properties: lo(g), options: I, userId: o(oe, k, g), anonymousId: o(Ee, k, g) }, P, [m, y, T]);
2456
+ C.dispatch({ type: $.trackStart, event: R, properties: w, options: S, userId: o(oe, k, g), anonymousId: o(Ee, k, g) }, P, [g, T, U]);
2458
2457
  }));
2459
2458
  } catch (P) {
2460
2459
  return Promise.reject(P);
2461
2460
  }
2461
+ }, page: function(m, g, T) {
2462
+ try {
2463
+ var U = V(m) ? m : {}, R = V(g) ? g : {};
2464
+ return Promise.resolve(new Promise(function(w) {
2465
+ C.dispatch({ type: $.pageStart, properties: lo(U), options: R, userId: o(oe, k, U), anonymousId: o(Ee, k, U) }, w, [m, g, T]);
2466
+ }));
2467
+ } catch (w) {
2468
+ return Promise.reject(w);
2469
+ }
2462
2470
  }, user: function(m) {
2463
2471
  if (m === oe || m === "id") return o(oe, k);
2464
2472
  if (m === Ee || m === "anonId") return o(Ee, k);
2465
- var y = k.getState("user");
2466
- return m ? cn(y, m) : y;
2473
+ var g = k.getState("user");
2474
+ return m ? cn(g, m) : g;
2467
2475
  }, reset: function(m) {
2468
- return new Promise(function(y) {
2469
- j.dispatch({ type: $.resetStart }, y, m);
2476
+ return new Promise(function(g) {
2477
+ C.dispatch({ type: $.resetStart }, g, m);
2470
2478
  });
2471
2479
  }, ready: function(m) {
2472
- return l && m({ plugins: v, instance: k }), k.on($.ready, function(y) {
2473
- m(y), l = !0;
2480
+ return l && m({ plugins: y, instance: k }), k.on($.ready, function(g) {
2481
+ m(g), l = !0;
2474
2482
  });
2475
- }, on: function(m, y) {
2476
- if (!m || !V(y)) return !1;
2483
+ }, on: function(m, g) {
2484
+ if (!m || !Y(g)) return !1;
2477
2485
  if (m === $.bootstrap) throw new Error(".on disabled for " + m);
2478
2486
  var T = /Start$|Start:/;
2479
2487
  if (m === "*") {
2480
- var g = function(U) {
2481
- return function(H) {
2482
- return function(z) {
2483
- return z.type.match(T) && y({ payload: z, instance: k, plugins: a }), H(z);
2488
+ var U = function(P) {
2489
+ return function(Z) {
2490
+ return function(N) {
2491
+ return N.type.match(T) && g({ payload: N, instance: k, plugins: a }), Z(N);
2484
2492
  };
2485
2493
  };
2486
- }, I = function(U) {
2487
- return function(H) {
2488
- return function(z) {
2489
- return z.type.match(T) || y({ payload: z, instance: k, plugins: a }), H(z);
2494
+ }, R = function(P) {
2495
+ return function(Z) {
2496
+ return function(N) {
2497
+ return N.type.match(T) || g({ payload: N, instance: k, plugins: a }), Z(N);
2490
2498
  };
2491
2499
  };
2492
2500
  };
2493
- return f(g, qe), f(I, Qe), function() {
2494
- d(g, qe), d(I, Qe);
2501
+ return f(U, qe), f(R, Qe), function() {
2502
+ d(U, qe), d(R, Qe);
2495
2503
  };
2496
2504
  }
2497
- var P = m.match(T) ? qe : Qe, M = function(U) {
2498
- return function(H) {
2499
- return function(z) {
2500
- return z.type === m && y({ payload: z, instance: k, plugins: a, abort: S }), H(z);
2505
+ var w = m.match(T) ? qe : Qe, S = function(P) {
2506
+ return function(Z) {
2507
+ return function(N) {
2508
+ return N.type === m && g({ payload: N, instance: k, plugins: a, abort: I }), Z(N);
2501
2509
  };
2502
2510
  };
2503
2511
  };
2504
- return f(M, P), function() {
2505
- return d(M, P);
2512
+ return f(S, w), function() {
2513
+ return d(S, w);
2506
2514
  };
2507
- }, once: function(m, y) {
2508
- if (!m || !V(y)) return !1;
2515
+ }, once: function(m, g) {
2516
+ if (!m || !Y(g)) return !1;
2509
2517
  if (m === $.bootstrap) throw new Error(".once disabled for " + m);
2510
- var T = k.on(m, function(g) {
2511
- y({ payload: g.payload, instance: k, plugins: a, abort: S }), T();
2518
+ var T = k.on(m, function(U) {
2519
+ g({ payload: U.payload, instance: k, plugins: a, abort: I }), T();
2512
2520
  });
2513
2521
  return T;
2514
2522
  }, getState: function(m) {
2515
- var y = j.getState();
2516
- return m ? cn(y, m) : Object.assign({}, y);
2523
+ var g = C.getState();
2524
+ return m ? cn(g, m) : Object.assign({}, g);
2517
2525
  }, dispatch: function(m) {
2518
- var y = ce(m) ? { type: m } : m;
2519
- if (rt.includes(y.type)) throw new Error("reserved action " + y.type);
2520
- var T = A({}, y, { _: A({ originalAction: y.type }, m._ || {}) });
2521
- j.dispatch(T);
2522
- }, enablePlugin: v.enable, disablePlugin: v.disable, plugins: v, storage: { getItem: i.getItem, setItem: function(m, y, T) {
2523
- j.dispatch({ type: $.setItemStart, key: m, value: y, options: T });
2524
- }, removeItem: function(m, y) {
2525
- j.dispatch({ type: $.removeItemStart, key: m, options: y });
2526
- } }, setAnonymousId: function(m, y) {
2527
- k.storage.setItem(ue, m, y);
2526
+ var g = ce(m) ? { type: m } : m;
2527
+ if (rt.includes(g.type)) throw new Error("reserved action " + g.type);
2528
+ var T = A({}, g, { _: A({ originalAction: g.type }, m._ || {}) });
2529
+ C.dispatch(T);
2530
+ }, enablePlugin: y.enable, disablePlugin: y.disable, plugins: y, storage: { getItem: i.getItem, setItem: function(m, g, T) {
2531
+ C.dispatch({ type: $.setItemStart, key: m, value: g, options: T });
2532
+ }, removeItem: function(m, g) {
2533
+ C.dispatch({ type: $.removeItemStart, key: m, options: g });
2534
+ } }, setAnonymousId: function(m, g) {
2535
+ k.storage.setItem(ue, m, g);
2528
2536
  }, events: { core: rt, plugins: s } }, O = r.middlewares.concat([function(m) {
2529
- return function(y) {
2537
+ return function(g) {
2530
2538
  return function(T) {
2531
- return T.meta || (T.meta = On()), y(T);
2539
+ return T.meta || (T.meta = On()), g(T);
2532
2540
  };
2533
2541
  };
2534
- }, b(qe), to(k, u, { all: p, plugins: s }), no(i), Gi(k), qi(k), b(Qe)]), C = { context: po, user: Bi(i), page: fo, track: ao, plugins: io(u), queue: co }, x = $e, N = $e;
2535
- if (F && t.debug) {
2536
- var D = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
2537
- D && (x = D({ trace: !0, traceLimit: 25 })), N = function() {
2538
- return arguments.length === 0 ? Er() : X(typeof arguments[0]) ? Tn() : Tn().apply(null, arguments);
2542
+ }, b(qe), to(k, u, { all: p, plugins: s }), no(i), Gi(k), qi(k), b(Qe)]), j = { context: po, user: Bi(i), page: fo, track: ao, plugins: io(u), queue: co }, x = $e, z = $e;
2543
+ if (J && t.debug) {
2544
+ var M = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
2545
+ M && (x = M({ trace: !0, traceLimit: 25 })), z = function() {
2546
+ return arguments.length === 0 ? Er() : V(typeof arguments[0]) ? Tn() : Tn().apply(null, arguments);
2539
2547
  };
2540
2548
  }
2541
- var K, L = function(m) {
2542
- return Object.keys(m).reduce(function(y, T) {
2543
- return mo.includes(T) || (y[T] = m[T]), y;
2549
+ var W, L = function(m) {
2550
+ return Object.keys(m).reduce(function(g, T) {
2551
+ return mo.includes(T) || (g[T] = m[T]), g;
2544
2552
  }, {});
2545
- }(t), R = r.pluginsArray.reduce(function(m, y) {
2546
- var T = y.name, g = y.config, I = y.loaded, P = r.pluginEnabled[T];
2547
- return m[T] = { enabled: P, initialized: !!P && !y.initialize, loaded: !!I({ config: g }), config: g }, m;
2548
- }, {}), Z = { context: L, user: _, plugins: R }, j = mr(function(m) {
2549
- for (var y = Object.keys(m), T = {}, g = 0; g < y.length; g++) {
2550
- var I = y[g];
2551
- typeof m[I] === se && (T[I] = m[I]);
2553
+ }(t), D = r.pluginsArray.reduce(function(m, g) {
2554
+ var T = g.name, U = g.config, R = g.loaded, w = r.pluginEnabled[T];
2555
+ return m[T] = { enabled: w, initialized: !!w && !g.initialize, loaded: !!R({ config: U }), config: U }, m;
2556
+ }, {}), H = { context: L, user: _, plugins: D }, C = mr(function(m) {
2557
+ for (var g = Object.keys(m), T = {}, U = 0; U < g.length; U++) {
2558
+ var R = g[U];
2559
+ typeof m[R] === se && (T[R] = m[R]);
2552
2560
  }
2553
- var P, M = Object.keys(T);
2561
+ var w, S = Object.keys(T);
2554
2562
  try {
2555
- (function(U) {
2556
- Object.keys(U).forEach(function(H) {
2557
- var z = U[H];
2558
- if (typeof z(void 0, { type: "@@redux/INIT" }) === re || typeof z(void 0, { type: Xi }) === re) throw new Error("reducer " + H + " " + re);
2563
+ (function(P) {
2564
+ Object.keys(P).forEach(function(Z) {
2565
+ var N = P[Z];
2566
+ if (typeof N(void 0, { type: "@@redux/INIT" }) === re || typeof N(void 0, { type: Xi }) === re) throw new Error("reducer " + Z + " " + re);
2559
2567
  });
2560
2568
  })(T);
2561
- } catch (U) {
2562
- P = U;
2569
+ } catch (P) {
2570
+ w = P;
2563
2571
  }
2564
- return function(U, H) {
2565
- if (U === void 0 && (U = {}), P) throw P;
2566
- for (var z = !1, ee = {}, Ue = 0; Ue < M.length; Ue++) {
2567
- var Xe = M[Ue], Xt = U[Xe], ft = (0, T[Xe])(Xt, H);
2572
+ return function(P, Z) {
2573
+ if (P === void 0 && (P = {}), w) throw w;
2574
+ for (var N = !1, X = {}, Ue = 0; Ue < S.length; Ue++) {
2575
+ var Xe = S[Ue], Xt = P[Xe], ft = (0, T[Xe])(Xt, Z);
2568
2576
  if (typeof ft === re) {
2569
- var Dr = Vi(Xe, H);
2577
+ var Dr = Vi(Xe, Z);
2570
2578
  throw new Error(Dr);
2571
2579
  }
2572
- ee[Xe] = ft, z = z || ft !== Xt;
2580
+ X[Xe] = ft, N = N || ft !== Xt;
2573
2581
  }
2574
- return z ? ee : U;
2582
+ return N ? X : P;
2575
2583
  };
2576
- }(A({}, C, e)), Z, N(x(Yi.apply(void 0, O))));
2577
- j.dispatch = (K = j.dispatch, function(m, y, T) {
2578
- var g = A({}, m, { meta: On(m.meta, y, kt(T)) });
2579
- return K.apply(null, [g]);
2584
+ }(A({}, j, e)), H, z(x(Yi.apply(void 0, O))));
2585
+ C.dispatch = (W = C.dispatch, function(m, g, T) {
2586
+ var U = A({}, m, { meta: On(m.meta, g, kt(T)) });
2587
+ return W.apply(null, [U]);
2580
2588
  });
2581
- var W = Object.keys(a);
2582
- j.dispatch({ type: $.bootstrap, plugins: W, config: L, params: w, user: _, initialUser: n, persistedUser: E });
2583
- var J = W.filter(function(m) {
2589
+ var K = Object.keys(a);
2590
+ C.dispatch({ type: $.bootstrap, plugins: K, config: L, params: v, user: _, initialUser: n, persistedUser: E });
2591
+ var F = K.filter(function(m) {
2584
2592
  return r.pluginEnabled[m];
2585
- }), de = W.filter(function(m) {
2593
+ }), de = K.filter(function(m) {
2586
2594
  return !r.pluginEnabled[m];
2587
2595
  });
2588
- return j.dispatch({ type: $.registerPlugins, plugins: W, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, y) {
2589
- var T = m.bootstrap, g = m.config, I = m.name;
2590
- T && V(T) && T({ instance: k, config: g, payload: m }), j.dispatch({ type: $.registerPluginType(I), name: I, enabled: r.pluginEnabled[I], plugin: m }), r.pluginsArray.length === y + 1 && j.dispatch({ type: $.initializeStart, plugins: J, disabled: de });
2596
+ return C.dispatch({ type: $.registerPlugins, plugins: K, enabled: r.pluginEnabled }), r.pluginsArray.map(function(m, g) {
2597
+ var T = m.bootstrap, U = m.config, R = m.name;
2598
+ T && Y(T) && T({ instance: k, config: U, payload: m }), C.dispatch({ type: $.registerPluginType(R), name: R, enabled: r.pluginEnabled[R], plugin: m }), r.pluginsArray.length === g + 1 && C.dispatch({ type: $.initializeStart, plugins: F, disabled: de });
2591
2599
  }), yo(function(m) {
2592
- j.dispatch({ type: m ? $.offline : $.online });
2593
- }), function(m, y, T) {
2600
+ C.dispatch({ type: m ? $.offline : $.online });
2601
+ }), function(m, g, T) {
2594
2602
  setInterval(function() {
2595
- return yr(m, y, T);
2603
+ return yr(m, g, T);
2596
2604
  }, 3e3);
2597
- }(j, u, k), k;
2605
+ }(C, u, k), k;
2598
2606
  }
2599
- var qe = "before", Qe = "after", Ze = "cookie", pe = Or(), Pr = dt, wo = dt;
2607
+ var qe = "before", Qe = "after", Ze = "cookie", pe = Or(), Pr = dt, vo = dt;
2600
2608
  function Tr(t) {
2601
2609
  return pe ? dt(t, "", -1) : Ae(t);
2602
2610
  }
@@ -2629,7 +2637,7 @@ function Oe(t) {
2629
2637
  try {
2630
2638
  if ((e = JSON.parse(t)) === "true") return !0;
2631
2639
  if (e === "false") return !1;
2632
- if (X(e)) return e;
2640
+ if (V(e)) return e;
2633
2641
  parseFloat(e) === e && (e = parseFloat(e));
2634
2642
  } catch {
2635
2643
  }
@@ -2651,7 +2659,7 @@ function jr(t, e) {
2651
2659
  function Eo(t, e, n) {
2652
2660
  if (t && !_e(e)) {
2653
2661
  var r = {}, i = Zt(n), o = JSON.stringify(e), a = !Ft(i);
2654
- return Ht(i) && (r[He] = et(He, e, Oe(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[He] : Kt(i) && (r[Ze] = et(Ze, e, Oe(Pr(t))), wo(t, o), a) ? r[Ze] : Wt(i) && (r[Ke] = et(Ke, e, Oe(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[Ke] : (r[Me] = et(Me, e, be(t)), ke(t, e), a ? r[Me] : r);
2662
+ return Ht(i) && (r[He] = et(He, e, Oe(localStorage.getItem(t))), localStorage.setItem(t, o), a) ? r[He] : Kt(i) && (r[Ze] = et(Ze, e, Oe(Pr(t))), vo(t, o), a) ? r[Ze] : Wt(i) && (r[Ke] = et(Ke, e, Oe(sessionStorage.getItem(t))), sessionStorage.setItem(t, o), a) ? r[Ke] : (r[Me] = et(Me, e, be(t)), ke(t, e), a ? r[Me] : r);
2655
2663
  }
2656
2664
  }
2657
2665
  function Po(t, e) {
@@ -2715,7 +2723,7 @@ function jo() {
2715
2723
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, e = {
2716
2724
  storage: To
2717
2725
  };
2718
- return vo(Cn(Cn({}, e), t));
2726
+ return wo(Cn(Cn({}, e), t));
2719
2727
  }
2720
2728
  function Co(t, e) {
2721
2729
  e = e || {};
@@ -2767,33 +2775,33 @@ function Lo() {
2767
2775
  });
2768
2776
  }
2769
2777
  function Uo(t) {
2770
- if (t === void 0 && (t = {}), !F) return jt;
2778
+ if (t === void 0 && (t = {}), !J) return jt;
2771
2779
  var e = $n(), n = $t(), r = xn(), i = tt(r, e), o = tt(n, e), a = [], s = [], h = [], p = r, u = i, c = o, f = Object.keys(t);
2772
2780
  if (!f.length) return jt;
2773
- var d = f.map(function(S) {
2774
- return Number(S);
2781
+ var d = f.map(function(I) {
2782
+ return Number(I);
2775
2783
  }), b = Ji(function() {
2776
- var S = $n(), w = function(L, R) {
2777
- return R.map(function(Z) {
2778
- return Z === 100 ? L - 5 : L * (Z / 100);
2784
+ var I = $n(), v = function(L, D) {
2785
+ return D.map(function(H) {
2786
+ return H === 100 ? L - 5 : L * (H / 100);
2779
2787
  });
2780
- }(S, d), E = $t(), _ = xn(), v = tt(_, S), l = tt(E, S);
2781
- if (u = v > u ? v : u, c = l < c ? l : c, !(a.length >= d.length)) {
2788
+ }(I, d), E = $t(), _ = xn(), y = tt(_, I), l = tt(E, I);
2789
+ if (u = y > u ? y : u, c = l < c ? l : c, !(a.length >= d.length)) {
2782
2790
  var k = p === _, O = "up";
2783
2791
  k ? O = "initial" : p <= _ && (O = "down");
2784
- var C = w, x = d;
2785
- (O === "up" || k) && (C = w.slice().reverse(), x = d.slice().reverse());
2786
- var N = x.reduce(function(L, R, Z) {
2787
- var j = C[Z];
2788
- return h.includes(R) && _ <= j && (h = h.filter(function(W) {
2789
- return W !== R;
2790
- }), L.singleFunction = R), O === "down" && !a.includes(R) && _ >= j && R > o ? (s.push(R), L.callbacks = L.callbacks.concat(R), L) : O === "up" && !a.includes(R) && _ <= j && R <= v ? (L.foundFunc = [R], L) : (k && _ >= j && L.foundFunc.length === 0 && (L.foundFunc = [R]), !s.includes(R) && _ >= j && (s.push(R), L.singleFunction ? h.push(R) : L.singleFunction = R), L);
2792
+ var j = v, x = d;
2793
+ (O === "up" || k) && (j = v.slice().reverse(), x = d.slice().reverse());
2794
+ var z = x.reduce(function(L, D, H) {
2795
+ var C = j[H];
2796
+ return h.includes(D) && _ <= C && (h = h.filter(function(K) {
2797
+ return K !== D;
2798
+ }), L.singleFunction = D), O === "down" && !a.includes(D) && _ >= C && D > o ? (s.push(D), L.callbacks = L.callbacks.concat(D), L) : O === "up" && !a.includes(D) && _ <= C && D <= y ? (L.foundFunc = [D], L) : (k && _ >= C && L.foundFunc.length === 0 && (L.foundFunc = [D]), !s.includes(D) && _ >= C && (s.push(D), L.singleFunction ? h.push(D) : L.singleFunction = D), L);
2791
2799
  }, { foundFunc: [], singleFunction: null, callbacks: [], direction: O });
2792
- if (p = _, O === "down" && N.callbacks && N.callbacks.forEach(function(L) {
2793
- V(t[L]) && (t[L]({ trigger: L, direction: O, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(L));
2794
- }), N.singleFunction) {
2795
- var D = N.singleFunction, K = N.direction;
2796
- V(t[D]) && t[D]({ trigger: D, direction: K, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(D);
2800
+ if (p = _, O === "down" && z.callbacks && z.callbacks.forEach(function(L) {
2801
+ Y(t[L]) && (t[L]({ trigger: L, direction: O, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(L));
2802
+ }), z.singleFunction) {
2803
+ var M = z.singleFunction, W = z.direction;
2804
+ Y(t[M]) && t[M]({ trigger: M, direction: W, scrollMin: c, scrollMax: u, range: [c, u] }), a.push(M);
2797
2805
  }
2798
2806
  }
2799
2807
  }, 500);
@@ -2802,16 +2810,16 @@ function Uo(t) {
2802
2810
  };
2803
2811
  }
2804
2812
  function $t() {
2805
- return F ? document.body.scrollTop || document.documentElement.scrollTop : 0;
2813
+ return J ? document.body.scrollTop || document.documentElement.scrollTop : 0;
2806
2814
  }
2807
2815
  function Ro() {
2808
- return F ? window.innerHeight || document.documentElement.clientHeight : 0;
2816
+ return J ? window.innerHeight || document.documentElement.clientHeight : 0;
2809
2817
  }
2810
2818
  function xn() {
2811
2819
  return Math.round($t() + Ro());
2812
2820
  }
2813
2821
  function $n() {
2814
- if (!F) return 0;
2822
+ if (!J) return 0;
2815
2823
  var t = document.body, e = document.documentElement;
2816
2824
  return Math.max(t.scrollHeight, t.offsetHeight, e.clientHeight, e.scrollHeight, e.offsetHeight);
2817
2825
  }
@@ -2822,7 +2830,7 @@ var An = "EventListener";
2822
2830
  function No(t) {
2823
2831
  return function(e, n, r, i) {
2824
2832
  var o = r || jt, a = i || !1;
2825
- if (!F) return o;
2833
+ if (!J) return o;
2826
2834
  var s = at(n), h = at(e, !0);
2827
2835
  if (!h.length) throw new Error("noElements");
2828
2836
  if (!s.length) throw new Error("noEvent");
@@ -2832,7 +2840,7 @@ function No(t) {
2832
2840
  for (var f = c ? "add" + An : "remove" + An, d = 0; d < h.length; d++) {
2833
2841
  var b = h[d];
2834
2842
  p[d] = c ? a && a.once ? Do(o) : o : p[d] || o;
2835
- for (var S = 0; S < s.length; S++) b[f] ? b["on" + s[S]] = c ? p[d] : null : b[f](s[S], p[d], a);
2843
+ for (var I = 0; I < s.length; I++) b[f] ? b["on" + s[I]] = c ? p[d] : null : b[f](s[I], p[d], a);
2836
2844
  }
2837
2845
  return u.bind(null, !c);
2838
2846
  }(t);
@@ -2860,7 +2868,7 @@ function Do(t, e) {
2860
2868
  }
2861
2869
  var It = No("Event");
2862
2870
  function Cr(t, e) {
2863
- return F && V(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), V(n) ? function() {
2871
+ return J && Y(window[t]) ? (n = window[t], r = e, (i = window) === void 0 && (i = null), Y(n) ? function() {
2864
2872
  n.apply(i, arguments), r.apply(i, arguments);
2865
2873
  } : r) : window[t] = e;
2866
2874
  var n, r, i;
@@ -2918,17 +2926,17 @@ function Ko(t) {
2918
2926
  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() {
2919
2927
  return clearTimeout(e);
2920
2928
  };
2921
- function b(w) {
2922
- d(), o && !u && o(De(f), w), i && u && (u = !1, i(De(n), w), f = /* @__PURE__ */ new Date()), e = setTimeout(function() {
2923
- u = !0, r && (n = /* @__PURE__ */ new Date(), r(De(f), w));
2929
+ function b(v) {
2930
+ d(), o && !u && o(De(f), v), i && u && (u = !1, i(De(n), v), f = /* @__PURE__ */ new Date()), e = setTimeout(function() {
2931
+ u = !0, r && (n = /* @__PURE__ */ new Date(), r(De(f), v));
2924
2932
  }, s);
2925
2933
  }
2926
- var S = Ho(b, { throttle: p });
2934
+ var I = Ho(b, { throttle: p });
2927
2935
  return { disable: function() {
2928
2936
  c = !0, u = !1, d();
2929
- var w = S();
2937
+ var v = I();
2930
2938
  return function() {
2931
- return c = !1, f = /* @__PURE__ */ new Date(), b({ type: "load" }), w();
2939
+ return c = !1, f = /* @__PURE__ */ new Date(), b({ type: "load" }), v();
2932
2940
  };
2933
2941
  }, getStatus: function() {
2934
2942
  return { isIdle: u, isDisabled: c, active: u ? 0 : De(f, c), idle: u ? De(n, c) : 0 };
@@ -2940,17 +2948,17 @@ function De(t, e) {
2940
2948
  const Un = 5e3;
2941
2949
  class Wo {
2942
2950
  constructor(e) {
2943
- B(this, "element");
2944
- B(this, "isInViewport", !1);
2945
- B(this, "isAwake", !1);
2946
- B(this, "isFlushing");
2947
- B(this, "observer");
2948
- B(this, "lastEventAt", Date.now());
2949
- B(this, "registeredView", !1);
2950
- B(this, "viewCallback");
2951
- B(this, "activeDurationCallback");
2952
- B(this, "idleDurationCallback");
2953
- B(this, "scrollCallback");
2951
+ q(this, "element");
2952
+ q(this, "isInViewport", !1);
2953
+ q(this, "isAwake", !1);
2954
+ q(this, "isFlushing");
2955
+ q(this, "observer");
2956
+ q(this, "lastEventAt", Date.now());
2957
+ q(this, "registeredView", !1);
2958
+ q(this, "viewCallback");
2959
+ q(this, "activeDurationCallback");
2960
+ q(this, "idleDurationCallback");
2961
+ q(this, "scrollCallback");
2954
2962
  this.element = e.element, this.viewCallback = e.viewCallback, this.activeDurationCallback = e.activeDurationCallback, this.idleDurationCallback = e.idleDurationCallback, this.scrollCallback = e.scrollCallback, this.observer = new IntersectionObserver(
2955
2963
  (n) => {
2956
2964
  n.forEach((r) => {
@@ -3038,10 +3046,10 @@ function Jo({ clientId: t, enabled: e = !0, environment: n }) {
3038
3046
  r.flush();
3039
3047
  }), Go(document.body, () => {
3040
3048
  r.handleVisibilityChange();
3041
- }), window.addEventListener(Q.AUTHENTICATED, async (i) => {
3049
+ }), window.addEventListener(ee.AUTHENTICATED, async (i) => {
3042
3050
  const o = i;
3043
3051
  await ne.identify(o.detail.sub);
3044
- }), window.addEventListener(Q.LOGOUT, async () => {
3052
+ }), window.addEventListener(ee.LOGOUT, async () => {
3045
3053
  await ne.track("logout", {}), Jt.flush(), await ne.reset();
3046
3054
  });
3047
3055
  }
@@ -3174,101 +3182,105 @@ function Bo(t) {
3174
3182
  function qo(t) {
3175
3183
  const {
3176
3184
  createCheckout: e,
3177
- getEntitlement: n,
3178
- getEntitlements: r,
3179
- getEntitlementAccess: i,
3180
- getSubscriptions: o,
3181
- getContract: a,
3182
- getContracts: s,
3183
- getBill: h,
3184
- getBills: p,
3185
- getProfile: u,
3186
- updateProfile: c,
3187
- getTags: f,
3188
- deleteTag: d,
3189
- setTag: b,
3190
- getUserMetadata: S,
3191
- listUserMetadata: w,
3192
- setUserMetadata: E,
3193
- deleteUserMetadata: _,
3194
- getTally: v,
3195
- getTallies: l,
3196
- pushTally: k,
3197
- deleteTally: O,
3198
- getProduct: C,
3199
- getPaymentIssues: x,
3200
- isSpotifyLinked: N,
3201
- unlinkSpotify: D,
3202
- linkSpotify: K,
3203
- autoOnboardProduct: L,
3204
- openHostedAccountPage: R,
3205
- generateLink: Z
3206
- } = xi(t), j = {
3185
+ getCheckout: n,
3186
+ updateCheckout: r,
3187
+ getEntitlement: i,
3188
+ getEntitlements: o,
3189
+ getEntitlementAccess: a,
3190
+ getSubscriptions: s,
3191
+ getContract: h,
3192
+ getContracts: p,
3193
+ getBill: u,
3194
+ getBills: c,
3195
+ getProfile: f,
3196
+ updateProfile: d,
3197
+ getTags: b,
3198
+ deleteTag: I,
3199
+ setTag: v,
3200
+ getUserMetadata: E,
3201
+ listUserMetadata: _,
3202
+ setUserMetadata: y,
3203
+ deleteUserMetadata: l,
3204
+ getTally: k,
3205
+ getTallies: O,
3206
+ pushTally: j,
3207
+ deleteTally: x,
3208
+ getProduct: z,
3209
+ getPaymentIssues: M,
3210
+ isSpotifyLinked: W,
3211
+ unlinkSpotify: L,
3212
+ linkSpotify: D,
3213
+ autoOnboardProduct: H,
3214
+ openHostedAccountPage: C,
3215
+ generateLink: K
3216
+ } = xi(t), F = {
3207
3217
  auth: {
3208
- getUser: u,
3218
+ getUser: f,
3209
3219
  isAuthenticated: Nt,
3210
3220
  loginWithRedirect: Dt,
3211
3221
  logout: yi,
3212
3222
  setToken: ir
3213
3223
  },
3214
3224
  checkouts: {
3215
- create: e
3225
+ get: n,
3226
+ create: e,
3227
+ update: r
3216
3228
  },
3217
3229
  profile: {
3218
- get: u,
3219
- update: c,
3220
- openHostedAccountPage: R,
3221
- isSpotifyLinked: N,
3222
- unlinkSpotify: D
3230
+ get: f,
3231
+ update: d,
3232
+ openHostedAccountPage: C,
3233
+ isSpotifyLinked: W,
3234
+ unlinkSpotify: L
3223
3235
  },
3224
3236
  analytics: {
3225
3237
  track: Xo
3226
3238
  },
3227
3239
  tags: {
3228
- list: f,
3229
- set: b,
3230
- delete: d
3240
+ list: b,
3241
+ set: v,
3242
+ delete: I
3231
3243
  },
3232
3244
  entitlements: {
3233
- get: n,
3234
- list: r,
3235
- access: i,
3245
+ get: i,
3246
+ list: o,
3247
+ access: a,
3236
3248
  signedLinks: Nr
3237
3249
  },
3238
3250
  contracts: {
3239
- get: a,
3240
- list: s
3241
- },
3242
- bills: {
3243
3251
  get: h,
3244
3252
  list: p
3245
3253
  },
3254
+ bills: {
3255
+ get: u,
3256
+ list: c
3257
+ },
3246
3258
  userMetadata: {
3247
- get: S,
3248
- list: w,
3249
- set: E,
3250
- delete: _
3259
+ get: E,
3260
+ list: _,
3261
+ set: y,
3262
+ delete: l
3251
3263
  },
3252
3264
  tallies: {
3253
- get: v,
3254
- list: l,
3255
- push: k,
3256
- delete: O
3265
+ get: k,
3266
+ list: O,
3267
+ push: j,
3268
+ delete: x
3257
3269
  },
3258
3270
  subscriptions: {
3259
- list: o
3271
+ list: s
3260
3272
  },
3261
3273
  products: {
3262
- get: C,
3263
- autoOnboard: L,
3264
- linkSpotify: K
3274
+ get: z,
3275
+ autoOnboard: H,
3276
+ linkSpotify: D
3265
3277
  },
3266
3278
  getVersion: Qo,
3267
- getPaymentIssues: x,
3268
- generateLink: Z,
3269
- clearCache: q
3279
+ getPaymentIssues: M,
3280
+ generateLink: K,
3281
+ clearCache: Q
3270
3282
  };
3271
- return t.namespace && (window[t.namespace] = j), j;
3283
+ return t.namespace && (window[t.namespace] = F), F;
3272
3284
  }
3273
3285
  function Qo() {
3274
3286
  return zt;
@@ -3331,7 +3343,7 @@ function na() {
3331
3343
  const t = new URLSearchParams(window.location.search), e = t.get(Mn), n = t.get(zn);
3332
3344
  if (e !== null || n !== null) {
3333
3345
  const r = new URL(window.location.href);
3334
- t.delete(Mn), t.delete(zn), r.search = t.toString(), q(), window.history.replaceState(null, "", r);
3346
+ t.delete(Mn), t.delete(zn), r.search = t.toString(), Q(), window.history.replaceState(null, "", r);
3335
3347
  }
3336
3348
  }
3337
3349
  function ra() {
@@ -3356,7 +3368,7 @@ async function ia() {
3356
3368
  if (!e)
3357
3369
  return;
3358
3370
  const n = await gi();
3359
- (n == null ? void 0 : n.email) !== e && (q(), Dt({ authorizationParams: { email_hint: e, login_hint: e } }));
3371
+ (n == null ? void 0 : n.email) !== e && (Q(), Dt({ authorizationParams: { email_hint: e, login_hint: e } }));
3360
3372
  const r = new URL(window.location.href);
3361
3373
  r.searchParams.delete(Zn), window.history.replaceState(null, "", r);
3362
3374
  }
@@ -3365,7 +3377,7 @@ function oa() {
3365
3377
  const t = new URLSearchParams(window.location.search), e = t.get(Hn);
3366
3378
  if (e !== null) {
3367
3379
  const n = new URL(window.location.href);
3368
- t.delete(Hn), n.search = t.toString(), le(Q.PURCHASE, { itemSrc: e }), q(), window.history.replaceState(null, "", n);
3380
+ t.delete(Hn), n.search = t.toString(), le(ee.PURCHASE, { itemSrc: e }), Q(), window.history.replaceState(null, "", n);
3369
3381
  }
3370
3382
  }
3371
3383
  const Kn = "sesamy-login";
@@ -3390,7 +3402,7 @@ async function sa(t) {
3390
3402
  ...t.auth
3391
3403
  }), t.transform && await ea(t.transform);
3392
3404
  const e = qo({ clientId: t.clientId, environment: t.environment, ...t.api });
3393
- return le(Q.READY, {}), ta(), na(), ra(), await aa(), await ia(), oa(), e;
3405
+ return le(ee.READY, {}), ta(), na(), ra(), await aa(), await ia(), oa(), e;
3394
3406
  }
3395
3407
  if (typeof document < "u") {
3396
3408
  const t = document.getElementById("sesamy-js");