@financial-times/custom-code-component 1.9.3 → 1.9.5

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.
@@ -28,7 +28,7 @@ w.prototype.on = function(t, e, n, o) {
28
28
  throw new TypeError("Invalid event type: " + t);
29
29
  if (typeof e == "function" && (o = n, n = e, e = null), o === void 0 && (o = this.captureForType(t)), typeof n != "function")
30
30
  throw new TypeError("Handler must be a type of Function");
31
- return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = kt) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = Ct) : (c = e, a = Element.prototype.matches) : (c = null, a = Ot.bind(this)), i[t].push({
31
+ return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = Et) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = xt) : (c = e, a = Element.prototype.matches) : (c = null, a = vt.bind(this)), i[t].push({
32
32
  selector: e,
33
33
  handler: n,
34
34
  matcher: a,
@@ -53,11 +53,11 @@ w.prototype.off = function(t, e, n, o) {
53
53
  w.prototype.handle = function(t) {
54
54
  let e, n;
55
55
  const o = t.type;
56
- let r, i, a, c, s = [], f;
56
+ let r, i, a, c, s = [], u;
57
57
  const l = "ftLabsDelegateIgnore";
58
58
  if (t[l] === !0)
59
59
  return;
60
- switch (f = t.target, f.nodeType === 3 && (f = f.parentNode), f.correspondingUseElement && (f = f.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
60
+ switch (u = t.target, u.nodeType === 3 && (u = u.parentNode), u.correspondingUseElement && (u = u.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
61
61
  case 1:
62
62
  s = this.listenerMap[1][o];
63
63
  break;
@@ -68,17 +68,17 @@ w.prototype.handle = function(t) {
68
68
  s = this.listenerMap[0][o];
69
69
  break;
70
70
  }
71
- let u = [];
72
- for (n = s.length; f && n; ) {
71
+ let f = [];
72
+ for (n = s.length; u && n; ) {
73
73
  for (e = 0; e < n && (a = s[e], !!a); e++)
74
- f.tagName && ["button", "input", "select", "textarea"].indexOf(f.tagName.toLowerCase()) > -1 && f.hasAttribute("disabled") ? u = [] : a.matcher.call(f, a.matcherParam, f) && u.push([t, f, a]);
75
- if (f === r || (n = s.length, f = f.parentElement || f.parentNode, f instanceof HTMLDocument))
74
+ u.tagName && ["button", "input", "select", "textarea"].indexOf(u.tagName.toLowerCase()) > -1 && u.hasAttribute("disabled") ? f = [] : a.matcher.call(u, a.matcherParam, u) && f.push([t, u, a]);
75
+ if (u === r || (n = s.length, u = u.parentElement || u.parentNode, u instanceof HTMLDocument))
76
76
  break;
77
77
  }
78
78
  let d;
79
- for (e = 0; e < u.length; e++)
80
- if (!(this._removedListeners.indexOf(u[e][2]) > -1) && (c = this.fire.apply(this, u[e]), c === !1)) {
81
- u[e][0][l] = !0, u[e][0].preventDefault(), d = !1;
79
+ for (e = 0; e < f.length; e++)
80
+ if (!(this._removedListeners.indexOf(f[e][2]) > -1) && (c = this.fire.apply(this, f[e]), c === !1)) {
81
+ f[e][0][l] = !0, f[e][0].preventDefault(), d = !1;
82
82
  break;
83
83
  }
84
84
  return d;
@@ -86,10 +86,10 @@ w.prototype.handle = function(t) {
86
86
  w.prototype.fire = function(t, e, n) {
87
87
  return n.handler.call(e, t, e);
88
88
  };
89
- function kt(t, e) {
89
+ function Et(t, e) {
90
90
  return t.toLowerCase() === e.tagName.toLowerCase();
91
91
  }
92
- function Ot(t, e) {
92
+ function vt(t, e) {
93
93
  return this.rootElement === window ? (
94
94
  // Match the outer document (dispatched from document)
95
95
  e === document || // The <html> element (dispatched from document.body or document.documentElement)
@@ -97,14 +97,14 @@ function Ot(t, e) {
97
97
  e === window
98
98
  ) : this.rootElement === e;
99
99
  }
100
- function Ct(t, e) {
100
+ function xt(t, e) {
101
101
  return t === e.id;
102
102
  }
103
103
  w.prototype.destroy = function() {
104
104
  this.off(), this.root();
105
105
  };
106
- const z = { config: {} };
107
- function ot(t) {
106
+ const K = { config: {} };
107
+ function tt(t) {
108
108
  if (t === void 0)
109
109
  return t;
110
110
  switch (Object.prototype.toString.call(t)) {
@@ -116,28 +116,28 @@ function ot(t) {
116
116
  return t;
117
117
  }
118
118
  }
119
- function St(t, e) {
120
- z[t] = ot(e);
119
+ function kt(t, e) {
120
+ K[t] = tt(e);
121
121
  }
122
- function At(t) {
123
- return ot(z[t]);
122
+ function Ot(t) {
123
+ return tt(K[t]);
124
124
  }
125
- function G(t) {
126
- delete z[t];
125
+ function Q(t) {
126
+ delete K[t];
127
127
  }
128
- const C = St, h = At;
129
- let P = 0;
130
- const W = 4, N = 36, rt = Math.pow(N, W), Q = function(e, n) {
128
+ const C = kt, h = Ot;
129
+ let A = 0;
130
+ const H = 4, N = 36, et = Math.pow(N, H), F = function(e, n) {
131
131
  const o = "000000000" + e;
132
132
  return o.substr(o.length - n);
133
- }, B = function() {
134
- return Q((Math.random() * rt << 0).toString(N), W);
135
- }, it = () => (P = P < rt ? P : 0, P++, P - 1), p = function() {
136
- const e = "c", n = (/* @__PURE__ */ new Date()).getTime().toString(N), o = p.fingerprint(), r = B() + B(), i = Q(it().toString(N), W);
133
+ }, U = function() {
134
+ return F((Math.random() * et << 0).toString(N), H);
135
+ }, nt = () => (A = A < et ? A : 0, A++, A - 1), p = function() {
136
+ const e = "c", n = (/* @__PURE__ */ new Date()).getTime().toString(N), o = p.fingerprint(), r = U() + U(), i = F(nt().toString(N), H);
137
137
  return e + n + i + o + r;
138
138
  };
139
139
  p.slug = function() {
140
- const e = (/* @__PURE__ */ new Date()).getTime().toString(36), n = p.fingerprint().slice(0, 1) + p.fingerprint().slice(-1), o = B().slice(-2), r = it().toString(36).slice(-4);
140
+ const e = (/* @__PURE__ */ new Date()).getTime().toString(36), n = p.fingerprint().slice(0, 1) + p.fingerprint().slice(-1), o = U().slice(-2), r = nt().toString(36).slice(-4);
141
141
  return e.slice(-2) + r + n + o;
142
142
  };
143
143
  p.globalCount = function() {
@@ -150,10 +150,10 @@ p.globalCount = function() {
150
150
  return p.globalCount = () => e, e;
151
151
  };
152
152
  p.fingerprint = function() {
153
- return Q((navigator.mimeTypes.length + navigator.userAgent.length).toString(36) + p.globalCount().toString(36), 4);
153
+ return F((navigator.mimeTypes.length + navigator.userAgent.length).toString(36) + p.globalCount().toString(36), 4);
154
154
  };
155
- const Z = [];
156
- function _(...t) {
155
+ const X = [];
156
+ function P(...t) {
157
157
  if (h("config").test && window.console)
158
158
  for (const e of t)
159
159
  window.console.log(e);
@@ -168,13 +168,13 @@ function m(t, e) {
168
168
  o = t[n], r = e[n], t !== r && typeof r < "u" && r !== null && (t[n] = o === Object(o) && !y(o, "function") ? m(o, r) : r);
169
169
  return t;
170
170
  }
171
- function K(t) {
171
+ function V(t) {
172
172
  return window.encodeURIComponent ? window.encodeURIComponent(t) : window.escape(t);
173
173
  }
174
- function Pt(t) {
174
+ function Ct(t) {
175
175
  return window.decodeURIComponent ? window.decodeURIComponent(t) : window.unescape(t);
176
176
  }
177
- function X(t, e, n) {
177
+ function z(t, e, n) {
178
178
  t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent("on" + e, n);
179
179
  }
180
180
  function v(t, e, n) {
@@ -187,27 +187,27 @@ function v(t, e, n) {
187
187
  } catch {
188
188
  }
189
189
  }
190
- function _t() {
191
- for (let t = 0; t < Z.length; t++)
192
- Z[t]();
190
+ function St() {
191
+ for (let t = 0; t < X.length; t++)
192
+ X[t]();
193
193
  }
194
- function tt(t) {
194
+ function Y(t) {
195
195
  return document.cookie.match(t) && RegExp.$1 !== "" && RegExp.$1 !== "null" ? RegExp.$1 : null;
196
196
  }
197
- function $t(t, e) {
197
+ function At(t, e) {
198
198
  const n = {};
199
199
  for (const o of e)
200
200
  t[o] && (n[o] = t[o]);
201
201
  return n;
202
202
  }
203
- function j(t) {
203
+ function R(t) {
204
204
  return typeof t == "string" ? t.trim() : t;
205
205
  }
206
- function $(t, e) {
206
+ function _(t, e) {
207
207
  for (const n in t)
208
208
  e[n] ? console.warn(`You can't set a custom property called ${n}`) : e[n] = t[n];
209
209
  }
210
- function st(t) {
210
+ function ot(t) {
211
211
  const e = /* @__PURE__ */ new WeakSet(), n = [];
212
212
  function o(r, i) {
213
213
  if (e.has(r)) {
@@ -222,7 +222,7 @@ function st(t) {
222
222
  }
223
223
  return o(t, ""), n;
224
224
  }
225
- function at(t) {
225
+ function rt(t) {
226
226
  const e = /* @__PURE__ */ new WeakSet();
227
227
  function n(o) {
228
228
  if (e.has(o))
@@ -238,7 +238,7 @@ function at(t) {
238
238
  t
239
239
  );
240
240
  }
241
- function H(t, e) {
241
+ function q(t, e) {
242
242
  if (t === e)
243
243
  return !0;
244
244
  if (t && e && typeof t == "object" && typeof e == "object") {
@@ -249,7 +249,7 @@ function H(t, e) {
249
249
  if (r !== e.length)
250
250
  return !1;
251
251
  for (let i = r; i-- !== 0; )
252
- if (!H(t[i], e[i]))
252
+ if (!q(t[i], e[i]))
253
253
  return !1;
254
254
  return !0;
255
255
  }
@@ -267,13 +267,13 @@ function H(t, e) {
267
267
  return !1;
268
268
  for (let r = o; r-- !== 0; ) {
269
269
  const i = n[r];
270
- if (!H(t[i], e[i]))
270
+ if (!q(t[i], e[i]))
271
271
  return !1;
272
272
  }
273
273
  return !0;
274
274
  }
275
275
  }
276
- const A = function(t, e = {}) {
276
+ const S = function(t, e = {}) {
277
277
  const n = "o-tracking";
278
278
  if (typeof t != "string" || t === "") {
279
279
  const s = new Error("You must specify a name for the store.");
@@ -287,8 +287,8 @@ const A = function(t, e = {}) {
287
287
  load: function(s) {
288
288
  return window.localStorage.getItem(s);
289
289
  },
290
- save: function(s, f) {
291
- return window.localStorage.setItem(s, f);
290
+ save: function(s, u) {
291
+ return window.localStorage.setItem(s, u);
292
292
  },
293
293
  remove: function(s) {
294
294
  return i(s), window.localStorage.removeItem(s);
@@ -296,18 +296,18 @@ const A = function(t, e = {}) {
296
296
  };
297
297
  function o(s) {
298
298
  s = s + "=";
299
- const f = window.document.cookie.split(";");
300
- let l, u;
301
- for (l = 0; l < f.length; l = l + 1)
302
- if (u = f[l].replace(/^\s+|\s+$/g, ""), u.indexOf(s) === 0)
303
- return Pt(u.substring(s.length, u.length));
299
+ const u = window.document.cookie.split(";");
300
+ let l, f;
301
+ for (l = 0; l < u.length; l = l + 1)
302
+ if (f = u[l].replace(/^\s+|\s+$/g, ""), f.indexOf(s) === 0)
303
+ return Ct(f.substring(s.length, f.length));
304
304
  return null;
305
305
  }
306
- function r(s, f, l) {
307
- let u, d = "";
308
- y(l, "number") && (u = /* @__PURE__ */ new Date(), u.setTime(u.getTime() + l), d = "expires=" + u.toUTCString() + ";");
309
- const xt = K(s) + "=" + K(f) + ";" + d + "path=/;" + (e.domain ? "domain=." + e.domain + ";" : "");
310
- window.document.cookie = xt;
306
+ function r(s, u, l) {
307
+ let f, d = "";
308
+ y(l, "number") && (f = /* @__PURE__ */ new Date(), f.setTime(f.getTime() + l), d = "expires=" + f.toUTCString() + ";");
309
+ const bt = V(s) + "=" + V(u) + ";" + d + "path=/;" + (e.domain ? "domain=." + e.domain + ";" : "");
310
+ window.document.cookie = bt;
311
311
  }
312
312
  function i(s) {
313
313
  r(s, "", -1);
@@ -330,8 +330,8 @@ const A = function(t, e = {}) {
330
330
  else {
331
331
  const s = JSON.parse(c);
332
332
  this.data ? Object.assign(this.data, s) : this.data = s;
333
- for (const f of Object.keys(s))
334
- f !== "spoor-id" && i(f);
333
+ for (const u of Object.keys(s))
334
+ u !== "spoor-id" && i(u);
335
335
  }
336
336
  } catch (s) {
337
337
  v("oErrors", "log", {
@@ -341,31 +341,31 @@ const A = function(t, e = {}) {
341
341
  }
342
342
  return this;
343
343
  };
344
- A.prototype.read = function() {
344
+ S.prototype.read = function() {
345
345
  return this.data;
346
346
  };
347
- A.prototype.write = function(t) {
347
+ S.prototype.write = function(t) {
348
348
  this.data = t;
349
349
  let e;
350
350
  if (typeof this.data == "string")
351
351
  e = this.data;
352
352
  else {
353
- if (at(this.data)) {
353
+ if (rt(this.data)) {
354
354
  const n = `o-tracking does not support circular references in the analytics data.
355
355
  Please remove the circular references in the data.
356
356
  Here are the paths in the data which are circular:
357
- ` + JSON.stringify(st(this.data), void 0, 4);
357
+ ` + JSON.stringify(ot(this.data), void 0, 4);
358
358
  throw new Error(n);
359
359
  }
360
360
  e = JSON.stringify(this.data);
361
361
  }
362
362
  return this.storage.save(this.storageKey, e), this;
363
363
  };
364
- A.prototype.destroy = function() {
364
+ S.prototype.destroy = function() {
365
365
  return this.data = null, this.storage.remove(this.storageKey), this;
366
366
  };
367
- let O, F;
368
- function Nt(t, e) {
367
+ let O, B;
368
+ function Pt(t, e) {
369
369
  const n = {
370
370
  storage: "cookie",
371
371
  name: "spoor-id",
@@ -374,46 +374,46 @@ function Nt(t, e) {
374
374
  // Set the store cookie domain to .ft.com for ft.com and all its subdomains
375
375
  domain: location.hostname.match(/^(?:.+\.)?ft\.com$/) ? "ft.com" : null
376
376
  };
377
- e && (n.domain = e), F = new A(n.name, n);
378
- let o = F.read();
379
- return o || (o = t), ct(o);
377
+ e && (n.domain = e), B = new S(n.name, n);
378
+ let o = B.read();
379
+ return o || (o = t), it(o);
380
380
  }
381
- function ct(t) {
382
- return O = t, O || (O = p()), F.write(O), O;
381
+ function it(t) {
382
+ return O = t, O || (O = p()), B.write(O), O;
383
383
  }
384
- function Lt() {
384
+ function _t() {
385
385
  return O;
386
386
  }
387
- let L;
388
- const It = {
387
+ let $;
388
+ const Nt = {
389
389
  storage: "best",
390
390
  name: "session",
391
391
  expires: 30 * 60 * 1e3
392
392
  // 30 minutes
393
393
  };
394
- function Dt(t) {
394
+ function $t(t) {
395
395
  const e = /* @__PURE__ */ new Date();
396
- e.setTime(e.getTime() + L.config.expires), L.write({
396
+ e.setTime(e.getTime() + $.config.expires), $.write({
397
397
  value: t,
398
398
  expiry: e.valueOf()
399
399
  });
400
400
  }
401
- function ft() {
402
- const t = L.read();
401
+ function st() {
402
+ const t = $.read();
403
403
  let e, n = !1;
404
404
  if (t) {
405
405
  const o = (/* @__PURE__ */ new Date()).valueOf();
406
406
  parseInt(t.expiry, 10) >= o ? e = t.value : (e = p(), n = !0);
407
407
  }
408
- return e || (e = p(), n = !0), Dt(e), {
408
+ return e || (e = p(), n = !0), $t(e), {
409
409
  id: e,
410
410
  isNew: n
411
411
  };
412
412
  }
413
- function Tt(t) {
413
+ function It(t) {
414
414
  y(t, "string") && (t = { name: t }), y(t) && (t = {});
415
- const e = m(It, t);
416
- return e.storage === "cookie" && t.name && (e.nameOverride = e.name), L = new A(e.name, e), ft();
415
+ const e = m(Nt, t);
416
+ return e.storage === "cookie" && t.name && (e.nameOverride = e.name), $ = new S(e.name, e), st();
417
417
  }
418
418
  function b(t) {
419
419
  if (y(t)) {
@@ -423,7 +423,7 @@ function b(t) {
423
423
  info: { module: "o-tracking" }
424
424
  }), e;
425
425
  }
426
- return this.queue = [], this.storage = new A(t), this.storage.read() && (this.queue = this.storage.read()), this;
426
+ return this.queue = [], this.storage = new S(t), this.storage.read() && (this.queue = this.storage.read()), this;
427
427
  }
428
428
  b.prototype.all = function() {
429
429
  if (this.queue.length === 0)
@@ -473,7 +473,7 @@ b.prototype.shift = function() {
473
473
  b.prototype.save = function() {
474
474
  return this.storage.write(this.queue), this;
475
475
  };
476
- function Mt() {
476
+ function Lt() {
477
477
  const t = new window.XMLHttpRequest();
478
478
  return {
479
479
  name: "xhr",
@@ -489,7 +489,7 @@ function Mt() {
489
489
  }
490
490
  };
491
491
  }
492
- function Rt() {
492
+ function Dt() {
493
493
  let t, e;
494
494
  const n = new Promise((o, r) => {
495
495
  t = o, e = r;
@@ -504,39 +504,39 @@ function Rt() {
504
504
  }
505
505
  };
506
506
  }
507
- function jt() {
507
+ function Rt() {
508
508
  const t = new Image(1, 1);
509
509
  return {
510
510
  name: "image",
511
511
  send: function(e, n) {
512
- e = e.replace("https://spoor-api.ft.com/ingest", "https://spoor-api.ft.com/px.gif"), t.src = e + (e.indexOf("?") > -1 ? "&" : "?") + "data=" + K(n);
512
+ e = e.replace("https://spoor-api.ft.com/ingest", "https://spoor-api.ft.com/px.gif"), t.src = e + (e.indexOf("?") > -1 ? "&" : "?") + "data=" + V(n);
513
513
  },
514
514
  complete: function(e) {
515
515
  t.addEventListener ? (t.addEventListener("error", e), t.addEventListener("load", () => e())) : (t.attachEvent("onerror", e), t.attachEvent("onload", () => e()));
516
516
  }
517
517
  };
518
518
  }
519
- const et = {};
520
- function V(t) {
521
- if (et.transport)
522
- return et.transport;
519
+ const G = {};
520
+ function j(t) {
521
+ if (G.transport)
522
+ return G.transport;
523
523
  switch (t) {
524
524
  case "xhr":
525
- return Mt;
525
+ return Lt;
526
526
  case "sendBeacon":
527
- return Rt;
527
+ return Dt;
528
528
  case "image":
529
- return jt;
529
+ return Rt;
530
530
  default:
531
531
  return;
532
532
  }
533
533
  }
534
534
  let g;
535
- function ut() {
535
+ function at() {
536
536
  return (h("config") || {}).queue === !0 ? !1 : !!navigator.sendBeacon;
537
537
  }
538
- function lt(t, e) {
539
- const n = t.queueTime, o = (/* @__PURE__ */ new Date()).getTime() - n, r = ut() ? V("sendBeacon")() : window.XMLHttpRequest && "withCredentials" in new window.XMLHttpRequest() ? V("xhr")() : V("image")(), i = t.callback, a = h("config") && h("config").system || {}, c = m(a, {
538
+ function ct(t, e) {
539
+ const n = t.queueTime, o = (/* @__PURE__ */ new Date()).getTime() - n, r = at() ? j("sendBeacon")() : window.XMLHttpRequest && "withCredentials" in new window.XMLHttpRequest() ? j("xhr")() : j("image")(), i = t.callback, a = h("config") && h("config").system || {}, c = m(a, {
540
540
  version: h("version"),
541
541
  // Version of the tracking client e.g. '1.2'
542
542
  source: h("source"),
@@ -544,25 +544,25 @@ function lt(t, e) {
544
544
  transport: r.name
545
545
  // The transport method used.
546
546
  });
547
- if (h("config").test || h("config").test_data ? c.is_live = !1 : c.is_live = !0, t = m({ system: c }, t), o > 1e3 && o < 12 * 30 * 24 * 60 * 60 * 1e3 && (t.time = t.time || {}, t.time.offset = o), delete t.callback, delete t.type, delete t.queueTime, _("user_callback", i), _("PreSend", t), at(t)) {
547
+ if (h("config").test || h("config").test_data ? c.is_live = !1 : c.is_live = !0, t = m({ system: c }, t), o > 1e3 && o < 12 * 30 * 24 * 60 * 60 * 1e3 && (t.time = t.time || {}, t.time.offset = o), delete t.callback, delete t.type, delete t.queueTime, P("user_callback", i), P("PreSend", t), rt(t)) {
548
548
  const l = `o-tracking does not support circular references in the analytics data.
549
549
  Please remove the circular references in the data.
550
550
  Here are the paths in the data which are circular:
551
- ` + JSON.stringify(st(t), void 0, 4);
551
+ ` + JSON.stringify(ot(t), void 0, 4);
552
552
  throw new Error(l);
553
553
  }
554
554
  const s = JSON.stringify(t);
555
555
  r.complete(function(l) {
556
- y(i, "function") && (i.call(t), _("calling user_callback")), l ? (t.queueTime = n, g.add(t).save(), v("oErrors", "log", {
556
+ y(i, "function") && (i.call(t), P("calling user_callback")), l ? (t.queueTime = n, g.add(t).save(), v("oErrors", "log", {
557
557
  error: l.message,
558
558
  info: { module: "o-tracking" }
559
559
  })) : e && e();
560
560
  });
561
- let f = "https://spoor-api.ft.com/ingest";
562
- t && t.category && t.action && (f += `?type=${t.category}:${t.action}`), r.send(f, s);
561
+ let u = "https://spoor-api.ft.com/ingest";
562
+ t && t.category && t.action && (u += `?type=${t.category}:${t.action}`), r.send(u, s);
563
563
  }
564
- function Jt(t) {
565
- t.queueTime = (/* @__PURE__ */ new Date()).getTime(), ut() ? lt(t) : g.add(t).save(), _("AddedToQueue", g);
564
+ function Mt(t) {
565
+ t.queueTime = (/* @__PURE__ */ new Date()).getTime(), at() ? ct(t) : g.add(t).save(), P("AddedToQueue", g);
566
566
  }
567
567
  function I(t = function() {
568
568
  }) {
@@ -586,56 +586,56 @@ function I(t = function() {
586
586
  const n = function() {
587
587
  I(), t();
588
588
  }, o = g.shift();
589
- return o ? lt(o, n) : t();
589
+ return o ? ct(o, n) : t();
590
590
  }
591
- function Ut(t) {
592
- Jt(t), I();
591
+ function Tt(t) {
592
+ Mt(t), I();
593
593
  }
594
- function Vt() {
595
- return g = new b("requests"), X(window, "online", function() {
594
+ function jt() {
595
+ return g = new b("requests"), z(window, "online", function() {
596
596
  I();
597
597
  }), I(), g;
598
598
  }
599
- let D;
600
- function dt() {
601
- return D = p(), D;
599
+ let L;
600
+ function ut() {
601
+ return L = p(), L;
602
602
  }
603
- function ht() {
604
- return D || dt(), D;
603
+ function ft() {
604
+ return L || ut(), L;
605
605
  }
606
- function qt(t, e = function() {
606
+ function Jt(t, e = function() {
607
607
  }) {
608
- const n = ft(), o = {
608
+ const n = st(), o = {
609
609
  callback: e,
610
610
  context: {
611
611
  id: t.id || p(),
612
612
  // Use a supplied id or generate one for this request
613
- root_id: ht()
613
+ root_id: ft()
614
614
  },
615
615
  user: {
616
- ft_session: tt(/FTSession=([^;]+)/),
617
- ft_session_s: tt(/FTSession_s=([^;]+)/)
616
+ ft_session: Y(/FTSession=([^;]+)/),
617
+ ft_session_s: Y(/FTSession_s=([^;]+)/)
618
618
  },
619
619
  device: {
620
620
  spoor_session: n.id,
621
621
  spoor_session_is_new: n.isNew,
622
- spoor_id: Lt()
622
+ spoor_id: _t()
623
623
  }
624
624
  }, r = h("config") || {};
625
- return r.context && m(o.context, r.context), r.user && m(o.user, r.user), r.device && m(o.device, r.device), m(o, t), _("Core.Track", o), Ut(o), o;
625
+ return r.context && m(o.context, r.context), r.user && m(o.user, r.user), r.device && m(o.device, r.device), m(o, t), P("Core.Track", o), Tt(o), o;
626
626
  }
627
627
  const x = {
628
- setRootID: dt,
629
- getRootID: ht,
630
- track: qt
631
- }, Bt = function() {
628
+ setRootID: ut,
629
+ getRootID: ft,
630
+ track: Jt
631
+ }, Ut = function() {
632
632
  return {
633
633
  category: "event",
634
634
  action: "generic",
635
635
  context: {}
636
636
  };
637
637
  };
638
- function J(t, e) {
638
+ function M(t, e) {
639
639
  if (y(t.detail.category) || y(t.detail.action)) {
640
640
  const r = "Missing category or action values";
641
641
  throw v("oErrors", "log", {
@@ -643,22 +643,22 @@ function J(t, e) {
643
643
  info: { module: "o-tracking" }
644
644
  }), r;
645
645
  }
646
- const n = m(Bt(), {
646
+ const n = m(Ut(), {
647
647
  category: t.detail.category,
648
648
  action: t.detail.action,
649
649
  context: t.detail
650
650
  });
651
651
  delete n.context.category, delete n.context.action;
652
- const o = Kt(t);
653
- o && (n.context.component_name = o.getAttribute("data-o-component"), n.context.component_id = n.context.component_id || Ht(o)), x.track(n, e);
652
+ const o = Vt(t);
653
+ o && (n.context.component_name = o.getAttribute("data-o-component"), n.context.component_id = n.context.component_id || qt(o)), x.track(n, e);
654
654
  }
655
- function Kt(t) {
655
+ function Vt(t) {
656
656
  const e = t.target || t.srcElement;
657
657
  if (e && e.getAttribute("data-o-component"))
658
658
  return e;
659
659
  }
660
- function Ht(t) {
661
- const e = Ft(t);
660
+ function qt(t) {
661
+ const e = Bt(t);
662
662
  if (typeof e > "u")
663
663
  return;
664
664
  const n = e[0], o = function(a) {
@@ -677,15 +677,15 @@ function Ht(t) {
677
677
  const c = a.nodeName.toLowerCase();
678
678
  return c.indexOf("#") === 0 ? i + "<" + c + ">" : i + "<" + c + ' id="' + (a.id || "") + '">';
679
679
  }, "");
680
- return zt(r + "_siblingIndex=" + o);
680
+ return Kt(r + "_siblingIndex=" + o);
681
681
  }
682
- function Ft(t) {
682
+ function Bt(t) {
683
683
  const e = [];
684
684
  for (; t; )
685
685
  e.push(t), t = t.parentElement;
686
686
  return e;
687
687
  }
688
- function zt(t) {
688
+ function Kt(t) {
689
689
  let e = t.length, n = 1 ^ e, o = 0, r;
690
690
  for (; e >= 4; )
691
691
  r = t.charCodeAt(o) & 255 | (t.charCodeAt(++o) & 255) << 8 | (t.charCodeAt(++o) & 255) << 16 | (t.charCodeAt(++o) & 255) << 24, r = (r & 65535) * 1540483477 + (((r >>> 16) * 1540483477 & 65535) << 16), r ^= r >>> 24, r = (r & 65535) * 1540483477 + (((r >>> 16) * 1540483477 & 65535) << 16), n = (n & 65535) * 1540483477 + (((n >>> 16) * 1540483477 & 65535) << 16) ^ r, e -= 4, ++o;
@@ -702,12 +702,12 @@ function zt(t) {
702
702
  }
703
703
  return n ^= n >>> 13, n = (n & 65535) * 1540483477 + (((n >>> 16) * 1540483477 & 65535) << 16), n ^= n >>> 15, n >>> 0;
704
704
  }
705
- const Wt = function() {
706
- X(window, "oTracking.event", J);
705
+ const Ht = function() {
706
+ z(window, "oTracking.event", M);
707
707
  };
708
- J.init = Wt;
708
+ M.init = Ht;
709
709
  C("page_has_already_been_viewed", !1);
710
- const Qt = function() {
710
+ const Ft = function() {
711
711
  return {
712
712
  category: "page",
713
713
  action: "view",
@@ -717,23 +717,23 @@ const Qt = function() {
717
717
  }
718
718
  };
719
719
  };
720
- function U(t, e) {
721
- t = m(Qt(), {
720
+ function T(t, e) {
721
+ t = m(Ft(), {
722
722
  context: t
723
- }), h("page_has_already_been_viewed") && x.setRootID(), C("page_has_already_been_viewed", !0), Xt(t) ? h("config").test && console.warn("A page event has already been sent for this page, refusing to send a duplicate page event.") : (x.track(t, e), _t());
723
+ }), h("page_has_already_been_viewed") && x.setRootID(), C("page_has_already_been_viewed", !0), zt(t) ? h("config").test && console.warn("A page event has already been sent for this page, refusing to send a duplicate page event.") : (x.track(t, e), St());
724
724
  }
725
- let nt = {};
726
- function Xt(t) {
725
+ let Z = {};
726
+ function zt(t) {
727
727
  const e = JSON.parse(JSON.stringify(t));
728
- return delete e.context.id, delete e.context.root_id, H(nt, e) ? !0 : (nt = e, !1);
728
+ return delete e.context.id, delete e.context.root_id, q(Z, e) ? !0 : (Z = e, !1);
729
729
  }
730
- function Yt(t) {
731
- U(t.detail);
730
+ function Wt(t) {
731
+ T(t.detail);
732
732
  }
733
- const Gt = function() {
734
- X(window, "oTracking.page", Yt);
733
+ const Qt = function() {
734
+ z(window, "oTracking.page", Wt);
735
735
  };
736
- U.init = Gt;
736
+ T.init = Qt;
737
737
  function E(t) {
738
738
  this.listenerMap = [{}, {}], t && this.root(t), this.handle = E.prototype.handle.bind(this), this._removedListeners = [];
739
739
  }
@@ -764,7 +764,7 @@ E.prototype.on = function(t, e, n, o) {
764
764
  throw new TypeError("Invalid event type: " + t);
765
765
  if (typeof e == "function" && (o = n, n = e, e = null), o === void 0 && (o = this.captureForType(t)), typeof n != "function")
766
766
  throw new TypeError("Handler must be a type of Function");
767
- return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = Zt) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = ee) : (c = e, a = Element.prototype.matches) : (c = null, a = te.bind(this)), i[t].push({
767
+ return r = this.rootElement, i = this.listenerMap[o ? 1 : 0], i[t] || (r && r.addEventListener(t, this.handle, o), i[t] = []), e ? /^[a-z]+$/i.test(e) ? (c = e, a = Xt) : /^#[a-z0-9\-_]+$/i.test(e) ? (c = e.slice(1), a = Gt) : (c = e, a = Element.prototype.matches) : (c = null, a = Yt.bind(this)), i[t].push({
768
768
  selector: e,
769
769
  handler: n,
770
770
  matcher: a,
@@ -789,11 +789,11 @@ E.prototype.off = function(t, e, n, o) {
789
789
  E.prototype.handle = function(t) {
790
790
  let e, n;
791
791
  const o = t.type;
792
- let r, i, a, c, s = [], f;
792
+ let r, i, a, c, s = [], u;
793
793
  const l = "ftLabsDelegateIgnore";
794
794
  if (t[l] === !0)
795
795
  return;
796
- switch (f = t.target, f.nodeType === 3 && (f = f.parentNode), f.correspondingUseElement && (f = f.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
796
+ switch (u = t.target, u.nodeType === 3 && (u = u.parentNode), u.correspondingUseElement && (u = u.correspondingUseElement), r = this.rootElement, i = t.eventPhase || (t.target !== t.currentTarget ? 3 : 2), i) {
797
797
  case 1:
798
798
  s = this.listenerMap[1][o];
799
799
  break;
@@ -804,17 +804,17 @@ E.prototype.handle = function(t) {
804
804
  s = this.listenerMap[0][o];
805
805
  break;
806
806
  }
807
- let u = [];
808
- for (n = s.length; f && n; ) {
807
+ let f = [];
808
+ for (n = s.length; u && n; ) {
809
809
  for (e = 0; e < n && (a = s[e], !!a); e++)
810
- f.tagName && ["button", "input", "select", "textarea"].indexOf(f.tagName.toLowerCase()) > -1 && f.hasAttribute("disabled") ? u = [] : a.matcher.call(f, a.matcherParam, f) && u.push([t, f, a]);
811
- if (f === r || (n = s.length, f = f.parentElement || f.parentNode, f instanceof HTMLDocument))
810
+ u.tagName && ["button", "input", "select", "textarea"].indexOf(u.tagName.toLowerCase()) > -1 && u.hasAttribute("disabled") ? f = [] : a.matcher.call(u, a.matcherParam, u) && f.push([t, u, a]);
811
+ if (u === r || (n = s.length, u = u.parentElement || u.parentNode, u instanceof HTMLDocument))
812
812
  break;
813
813
  }
814
814
  let d;
815
- for (e = 0; e < u.length; e++)
816
- if (!(this._removedListeners.indexOf(u[e][2]) > -1) && (c = this.fire.apply(this, u[e]), c === !1)) {
817
- u[e][0][l] = !0, u[e][0].preventDefault(), d = !1;
815
+ for (e = 0; e < f.length; e++)
816
+ if (!(this._removedListeners.indexOf(f[e][2]) > -1) && (c = this.fire.apply(this, f[e]), c === !1)) {
817
+ f[e][0][l] = !0, f[e][0].preventDefault(), d = !1;
818
818
  break;
819
819
  }
820
820
  return d;
@@ -822,10 +822,10 @@ E.prototype.handle = function(t) {
822
822
  E.prototype.fire = function(t, e, n) {
823
823
  return n.handler.call(e, t, e);
824
824
  };
825
- function Zt(t, e) {
825
+ function Xt(t, e) {
826
826
  return t.toLowerCase() === e.tagName.toLowerCase();
827
827
  }
828
- function te(t, e) {
828
+ function Yt(t, e) {
829
829
  return this.rootElement === window ? (
830
830
  // Match the outer document (dispatched from document)
831
831
  e === document || // The <html> element (dispatched from document.body or document.documentElement)
@@ -833,113 +833,113 @@ function te(t, e) {
833
833
  e === window
834
834
  ) : this.rootElement === e;
835
835
  }
836
- function ee(t, e) {
836
+ function Gt(t, e) {
837
837
  return t === e.id;
838
838
  }
839
839
  E.prototype.destroy = function() {
840
840
  this.off(), this.root();
841
841
  };
842
- const ne = (t, e, n) => {
842
+ const Zt = (t, e, n) => {
843
843
  const o = Array.from(t.querySelectorAll(n)), r = o.findIndex((i) => i === e);
844
844
  if (r !== -1)
845
845
  return {
846
846
  siblings: o.length,
847
847
  position: r
848
848
  };
849
- }, pt = [
849
+ }, lt = [
850
850
  "nodeName",
851
851
  "className",
852
852
  "id",
853
853
  "href",
854
854
  "text",
855
855
  "role"
856
- ], oe = (t) => {
856
+ ], te = (t) => {
857
857
  const e = {};
858
- for (const n of pt) {
858
+ for (const n of lt) {
859
859
  const o = t[n] || t.getAttribute(n) || t.hasAttribute(n);
860
- o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = j(o));
860
+ o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = R(o));
861
861
  }
862
862
  return e;
863
- }, re = (t) => {
863
+ }, ee = (t) => {
864
864
  try {
865
865
  const e = JSON.parse(t), n = Object.prototype.toString.call(e);
866
866
  return [n === "[object Object]" || n === "[object Array]", e];
867
867
  } catch {
868
868
  return [!1, null];
869
869
  }
870
- }, ie = (t) => {
871
- const [e, n] = re(t);
870
+ }, ne = (t) => {
871
+ const [e, n] = ee(t);
872
872
  return e ? n : t;
873
- }, se = (t, e) => (t.filter((n) => n.name.match(/^data-trackable|^data-o-|^aria-/i)).forEach((n) => {
873
+ }, oe = (t, e) => (t.filter((n) => n.name.match(/^data-trackable|^data-o-|^aria-/i)).forEach((n) => {
874
874
  e[n.name] = n.value;
875
- }), e), ae = (t, e, n) => {
875
+ }), e), re = (t, e, n) => {
876
876
  const o = {};
877
- return n && pt.forEach((r) => {
877
+ return n && lt.forEach((r) => {
878
878
  typeof e[r] < "u" && r !== "id" && (o[r] = e[r]);
879
879
  }), t.filter((r) => r.name.match(/^data-trackable-context-/i)).forEach((r) => {
880
- o[r.name.replace("data-trackable-context-", "")] = ie(r.value);
880
+ o[r.name.replace("data-trackable-context-", "")] = ne(r.value);
881
881
  }), o;
882
882
  };
883
- function mt(t) {
883
+ function dt(t) {
884
884
  const e = document, n = t, o = n.getAttribute("data-trackable") ? `[data-trackable="${n.getAttribute("data-trackable")}"]` : n.nodeName, r = [], i = {};
885
885
  for (; t && t !== e; ) {
886
- const a = oe(t), c = Array.from(t.attributes);
887
- let s = se(c, a);
886
+ const a = te(t), c = Array.from(t.attributes);
887
+ let s = oe(c, a);
888
888
  s["data-trackable"] && (s = Object.assign(
889
889
  s,
890
- ne(t, n, o)
890
+ Zt(t, n, o)
891
891
  )), r.push(s);
892
- const f = ae(c, a, t === n);
893
- $(f, i), t = t.parentNode;
892
+ const u = re(c, a, t === n);
893
+ _(u, i), t = t.parentNode;
894
894
  }
895
895
  return { trace: r, customContext: i };
896
896
  }
897
- let q;
898
- const ce = [
897
+ let J;
898
+ const ie = [
899
899
  "ctrlKey",
900
900
  "altKey",
901
901
  "shiftKey",
902
902
  "metaKey"
903
- ], fe = (t) => {
903
+ ], se = (t) => {
904
904
  const e = {};
905
- for (const n of ce)
905
+ for (const n of ie)
906
906
  if (t[n])
907
907
  try {
908
- e[n] = j(t[n]);
908
+ e[n] = R(t[n]);
909
909
  } catch (o) {
910
910
  console.log(o);
911
911
  }
912
912
  return e;
913
- }, ue = (t) => (e, n) => {
913
+ }, ae = (t) => (e, n) => {
914
914
  if (n.getAttribute("data-o-tracking-do-not-track") === "true")
915
915
  return;
916
- const o = fe(e), { trace: r, customContext: i } = mt(n);
917
- o.domPathTokens = r, o.url = window.document.location.href || null, o.source_id = x.getRootID(), $(i, o), t.context = o;
916
+ const o = se(e), { trace: r, customContext: i } = dt(n);
917
+ o.domPathTokens = r, o.url = window.document.location.href || null, o.source_id = x.getRootID(), _(i, o), t.context = o;
918
918
  const a = m(h("config"), t);
919
919
  x.track(a);
920
- }, le = (t, e) => {
920
+ }, ce = (t, e) => {
921
921
  e = e || 'a, button, input, [role="button"]';
922
922
  const n = {
923
923
  action: "click",
924
924
  category: t || "o-tracking"
925
925
  };
926
- q = q || new E(document.body), q.on("click", e, ue(n), !0);
926
+ J = J || new E(document.body), J.on("click", e, ae(n), !0);
927
927
  const o = new b("clicks");
928
- gt(o);
928
+ ht(o);
929
929
  };
930
- function gt(t) {
930
+ function ht(t) {
931
931
  const e = t.shift();
932
- e && x.track(e, () => gt(t));
932
+ e && x.track(e, () => ht(t));
933
933
  }
934
- const de = {
935
- init: le
936
- }, he = [
934
+ const ue = {
935
+ init: ce
936
+ }, fe = [
937
937
  "componentContentId",
938
938
  "type",
939
939
  "subtype",
940
940
  "component"
941
- ], pe = (t, e, n) => {
942
- const { trace: o, customContext: r } = mt(e);
941
+ ], le = (t, e, n) => {
942
+ const { trace: o, customContext: r } = dt(e);
943
943
  let i;
944
944
  if (n.getContextData) {
945
945
  if (typeof n.getContextData != "function")
@@ -947,11 +947,11 @@ const de = {
947
947
  const a = n.getContextData(e);
948
948
  if (typeof a != "object")
949
949
  throw new Error("opts.getContextData function should return {object}");
950
- i = $t(a, he);
950
+ i = At(a, fe);
951
951
  } else
952
952
  i = {};
953
- i.domPathTokens = o, i.url = window.document.location.href || null, $(r, i), t.context = i;
954
- }, me = (t = {}) => {
953
+ i.domPathTokens = o, i.url = window.document.location.href || null, _(r, i), t.context = i;
954
+ }, de = (t = {}) => {
955
955
  if (!window.IntersectionObserver) {
956
956
  console.warn('o-tracking: Unable to track component view events as "window.IntersectionObserver" is not supported.');
957
957
  return;
@@ -966,39 +966,39 @@ const de = {
966
966
  action: t.action || "view",
967
967
  category: t.category || "component"
968
968
  }, s = a.target;
969
- pe(c, s, t), x.track(c), r.unobserve(s);
969
+ le(c, s, t), x.track(c), r.unobserve(s);
970
970
  }
971
971
  });
972
972
  }
973
973
  const r = new IntersectionObserver(o, { threshold: [1] });
974
974
  n.forEach((i) => r.observe(i));
975
- }, ge = {
976
- init: me
977
- }, ye = J.init, we = U.init, Y = "4.5.4", yt = "o-tracking";
978
- function wt(t) {
975
+ }, he = {
976
+ init: de
977
+ }, pe = M.init, me = T.init, W = "4.5.4", pt = "o-tracking";
978
+ function mt(t) {
979
979
  let e = h("config") || {};
980
- e = m(e, t), C("config", e), e.user && e.user.user_id && ct(e.user.user_id);
980
+ e = m(e, t), C("config", e), e.user && e.user.user_id && it(e.user.user_id);
981
981
  }
982
- function be() {
983
- k.initialised = !1, G("config"), G("page_sent");
982
+ function ge() {
983
+ k.initialised = !1, Q("config"), Q("page_sent");
984
984
  }
985
- function Ee() {
986
- return "oTracking version " + Y;
985
+ function ye() {
986
+ return "oTracking version " + W;
987
987
  }
988
- function ve(t = {}) {
988
+ function we(t = {}) {
989
989
  if (k.initialised)
990
990
  return k;
991
- if (!!bt() && (t = xe(t)), Object.keys(t).length === 0 && t.constructor === Object)
991
+ if (!!gt() && (t = be(t)), Object.keys(t).length === 0 && t.constructor === Object)
992
992
  return null;
993
- C("version", Y), C("source", yt), C("page_sent", !1);
993
+ C("version", W), C("source", pt), C("page_sent", !1);
994
994
  const n = t ? t.cookieDomain : "";
995
- return Nt("", n), wt(t), Tt(t.session), Vt(), ye(), we(), k.initialised = !0, k;
995
+ return Pt("", n), mt(t), It(t.session), jt(), pe(), me(), k.initialised = !0, k;
996
996
  }
997
- function bt() {
997
+ function gt() {
998
998
  return document.querySelector("script[data-o-tracking-config]");
999
999
  }
1000
- function xe(t) {
1001
- const e = bt();
1000
+ function be(t) {
1001
+ const e = gt();
1002
1002
  let n;
1003
1003
  if (e)
1004
1004
  n = e.textContent || e.innerText || e.innerHTML;
@@ -1023,151 +1023,165 @@ const k = {
1023
1023
  * @type {boolean}
1024
1024
  */
1025
1025
  initialised: !1,
1026
- version: Y,
1027
- updateConfig: wt,
1028
- source: yt,
1029
- destroy: be,
1030
- toString: Ee,
1031
- init: ve,
1032
- click: de,
1033
- event: J,
1034
- page: U,
1035
- view: ge,
1026
+ version: W,
1027
+ updateConfig: mt,
1028
+ source: pt,
1029
+ destroy: ge,
1030
+ toString: ye,
1031
+ init: we,
1032
+ click: ue,
1033
+ event: M,
1034
+ page: T,
1035
+ view: he,
1036
1036
  getRootID: x.getRootID
1037
1037
  };
1038
- function Et() {
1039
- k.init(), document.removeEventListener("o.DOMContentLoaded", Et);
1038
+ function yt() {
1039
+ k.init(), document.removeEventListener("o.DOMContentLoaded", yt);
1040
1040
  }
1041
- typeof document < "u" && document.addEventListener("o.DOMContentLoaded", Et);
1042
- const ke = (t, e, n) => {
1041
+ typeof document < "u" && document.addEventListener("o.DOMContentLoaded", yt);
1042
+ const Ee = (t, e, n) => {
1043
1043
  const o = Array.from(t.querySelectorAll(n)), r = o.findIndex((i) => i === e);
1044
1044
  if (r !== -1)
1045
1045
  return {
1046
1046
  siblings: o.length,
1047
1047
  position: r
1048
1048
  };
1049
- }, vt = [
1049
+ }, wt = [
1050
1050
  "nodeName",
1051
1051
  "className",
1052
1052
  "id",
1053
1053
  "href",
1054
1054
  "text",
1055
1055
  "role"
1056
- ], Oe = (t) => {
1056
+ ], ve = (t) => {
1057
1057
  const e = {};
1058
- for (const n of vt) {
1058
+ for (const n of wt) {
1059
1059
  const o = t[n] || t.getAttribute(n) || t.hasAttribute(n);
1060
- o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = j(o));
1060
+ o !== void 0 && (typeof o == "boolean" ? e[n] = o : e[n] = R(o));
1061
1061
  }
1062
1062
  return e;
1063
- }, Ce = (t) => {
1063
+ }, xe = (t) => {
1064
1064
  try {
1065
1065
  const e = JSON.parse(t), n = Object.prototype.toString.call(e);
1066
1066
  return [n === "[object Object]" || n === "[object Array]", e];
1067
1067
  } catch {
1068
1068
  return [!1, null];
1069
1069
  }
1070
- }, Se = (t) => {
1071
- const [e, n] = Ce(t);
1070
+ }, ke = (t) => {
1071
+ const [e, n] = xe(t);
1072
1072
  return e ? n : t;
1073
- }, Ae = (t, e) => (t.filter(
1073
+ }, Oe = (t, e) => (t.filter(
1074
1074
  (n) => n.name.match(/^data-trackable|^data-o-|^aria-/i)
1075
1075
  ).forEach((n) => {
1076
1076
  e[n.name] = n.value;
1077
- }), e), Pe = (t, e, n) => {
1077
+ }), e), Ce = (t, e, n) => {
1078
1078
  const o = {};
1079
- return n && vt.forEach((r) => {
1079
+ return n && wt.forEach((r) => {
1080
1080
  typeof e[r] < "u" && r !== "id" && (o[r] = e[r]);
1081
1081
  }), t.filter((r) => r.name.match(/^data-trackable-context-/i)).forEach((r) => {
1082
- o[r.name.replace("data-trackable-context-", "")] = Se(r.value);
1082
+ o[r.name.replace("data-trackable-context-", "")] = ke(r.value);
1083
1083
  }), o;
1084
1084
  };
1085
- function _e(t, e) {
1085
+ function Se(t, e) {
1086
1086
  const n = t, o = n.getAttribute("data-trackable") ? `[data-trackable="${n.getAttribute("data-trackable")}"]` : n.nodeName, r = [], i = {};
1087
1087
  for (; t && t !== e; ) {
1088
- const a = Oe(t), c = Array.from(t.attributes);
1089
- let s = Ae(c, a);
1088
+ const a = ve(t), c = Array.from(t.attributes);
1089
+ let s = Oe(c, a);
1090
1090
  s["data-trackable"] && (s = Object.assign(
1091
1091
  s,
1092
- ke(t, n, o)
1092
+ Ee(t, n, o)
1093
1093
  )), r.push(s);
1094
- const f = Pe(c, a, t === n);
1095
- $(f, i), t = t.parentNode;
1094
+ const u = Ce(c, a, t === n);
1095
+ _(u, i), t = t.parentNode;
1096
1096
  }
1097
1097
  return { trace: r, customContext: i };
1098
1098
  }
1099
- let S = "ccc-component", T = "interactive";
1100
- const $e = ["ctrlKey", "altKey", "shiftKey", "metaKey"], Ne = (t) => {
1101
- const e = {};
1102
- for (const n of $e)
1103
- if (t[n])
1104
- try {
1105
- e[n] = j(t[n]);
1106
- } catch (o) {
1107
- console.log(o);
1108
- }
1109
- return e;
1110
- }, Le = (t, e) => (n, o) => {
1111
- const r = Ne(n), { trace: i, customContext: a } = _e(o, e);
1112
- r.custom = o.dataset && o.dataset.custom ? JSON.parse(o.dataset.custom) : null, r.domPathTokens = i, r.component = {
1113
- id: S,
1114
- name: S,
1115
- type: "custom-code-component",
1116
- subtype: T
1117
- }, r.teamName = "djd", $(a, r), t.context = r, t.method = "ftCustomAnalytics", document.body.dispatchEvent(
1118
- new CustomEvent("oTracking.event", {
1119
- detail: t,
1120
- bubbles: !0,
1121
- composed: !0
1122
- })
1123
- );
1124
- };
1125
- function Ie(t, e) {
1126
- const n = {
1127
- category: "component",
1128
- action: "act",
1129
- context: {
1130
- component: {
1131
- id: S,
1132
- name: S,
1099
+ const Ae = ["ctrlKey", "altKey", "shiftKey", "metaKey"];
1100
+ class Pe {
1101
+ constructor({
1102
+ id: e = "00000000-0000-0000-0000-000000000000",
1103
+ name: n = "ccc-component",
1104
+ subtype: o = "interactive",
1105
+ teamName: r = "djd",
1106
+ shadowRoot: i = null,
1107
+ category: a = "cta",
1108
+ elements: c = 'a, button, input, [role="button"]'
1109
+ } = {}) {
1110
+ this.cccId = e, this.cccName = n, this.subtype = o, this.teamName = r, this.shadowRoot = i, this.category = a, this.elements = c, this.isInitialised = !1;
1111
+ }
1112
+ // Get properties for the event (as opposed to properties of the clicked element)
1113
+ getEventProperties(e) {
1114
+ const n = {};
1115
+ for (const o of Ae)
1116
+ if (e[o])
1117
+ try {
1118
+ n[o] = R(e[o]);
1119
+ } catch (r) {
1120
+ console.log(r);
1121
+ }
1122
+ return n;
1123
+ }
1124
+ // Controller for handling click events
1125
+ handleClickEvent(e, n) {
1126
+ return (o, r) => {
1127
+ const i = this.getEventProperties(o), { trace: a, customContext: c } = Se(r, n);
1128
+ i.custom = r.dataset && r.dataset.custom ? JSON.parse(r.dataset.custom) : null, i.domPathTokens = a, i.component = {
1129
+ id: this.cccId,
1130
+ name: this.cccName,
1133
1131
  type: "custom-code-component",
1134
- subtype: T
1132
+ subtype: this.subtype
1133
+ }, i.teamName = this.teamName, _(c, i), e.context = i, e.method = "ftCustomAnalytics", document.body.dispatchEvent(
1134
+ new CustomEvent("oTracking.event", {
1135
+ detail: e,
1136
+ bubbles: !0,
1137
+ composed: !0
1138
+ })
1139
+ );
1140
+ };
1141
+ }
1142
+ sendSpoorEvent(e, n) {
1143
+ const o = {
1144
+ category: "component",
1145
+ action: "act",
1146
+ context: {
1147
+ component: {
1148
+ id: this.cccId,
1149
+ name: this.cccName,
1150
+ type: "custom-code-component",
1151
+ subtype: this.subtype
1152
+ },
1153
+ teamName: this.teamName,
1154
+ trigger_action: e,
1155
+ custom: n
1135
1156
  },
1136
- teamName: "djd",
1137
- trigger_action: t,
1138
- custom: e
1139
- },
1140
- method: "ftCustomAnalytics"
1141
- };
1142
- document.body.dispatchEvent(
1143
- new CustomEvent("oTracking.event", {
1144
- detail: n,
1145
- bubbles: !0,
1146
- composed: !0
1147
- })
1148
- );
1149
- }
1150
- function De(t, e, n, o) {
1151
- if (!M.isInitialised) {
1152
- M.isInitialised = !0, t && (S = t.id || S, T = t.subtype || T), k.init({ queue: !0, test: !0 });
1153
- const r = o || 'a, button, input, [role="button"]', i = {
1154
- action: "click",
1155
- category: n || "cta"
1156
- }, a = e == null ? void 0 : e.querySelector("#component-root");
1157
- e && new w(a).on(
1158
- "click",
1159
- r,
1160
- Le(i, a),
1161
- !0
1157
+ method: "ftCustomAnalytics"
1158
+ };
1159
+ document.body.dispatchEvent(
1160
+ new CustomEvent("oTracking.event", {
1161
+ detail: o,
1162
+ bubbles: !0,
1163
+ composed: !0
1164
+ })
1162
1165
  );
1163
1166
  }
1167
+ init(e) {
1168
+ var n;
1169
+ if (!this.isInitialised) {
1170
+ this.isInitialised = !0, this.cccId = e || this.cccId, k.init({ queue: !0, test: !0 });
1171
+ const o = {
1172
+ action: "click",
1173
+ category: this.category
1174
+ }, r = (n = this.shadowRoot) == null ? void 0 : n.querySelector("#component-root");
1175
+ this.shadowRoot && new w(r).on(
1176
+ "click",
1177
+ this.elements,
1178
+ this.handleClickEvent(o, r),
1179
+ !0
1180
+ );
1181
+ }
1182
+ }
1164
1183
  }
1165
- const M = {
1166
- init: De,
1167
- isInitialised: !1,
1168
- sendSpoorEvent: Ie
1169
- };
1170
- class Te extends HTMLElement {
1184
+ class _e extends HTMLElement {
1171
1185
  constructor() {
1172
1186
  super(...arguments), this.RESERVED_ATTRS = /* @__PURE__ */ new Set([
1173
1187
  "iframe",
@@ -1188,14 +1202,19 @@ class Te extends HTMLElement {
1188
1202
  const e = this.shadowRoot ?? this.attachShadow({ mode: this.mode }), n = this.app, o = JSON.parse(this.getAttribute("data-component-props")), r = Object.fromEntries(
1189
1203
  [...this.attributes].filter((s) => !this.RESERVED_ATTRS.has(s.name)).map((s) => [s.name, s.value])
1190
1204
  );
1191
- (c = this.shadowRoot) == null || c.replaceChildren();
1205
+ (c = this.shadowRoot) == null || c.replaceChildren(), this.tracking = new Pe({
1206
+ name: `${this.getAttribute("path")}@${this.getAttribute("version")}`,
1207
+ subtype: "interactive",
1208
+ teamName: "djd",
1209
+ shadowRoot: this.shadowRoot
1210
+ });
1192
1211
  const { unmount: i, onmessage: a } = n(
1193
1212
  e,
1194
1213
  {
1195
1214
  ...r,
1196
1215
  data: o,
1197
1216
  port: this.channel.port2,
1198
- tracking: M
1217
+ tracking: this.tracking
1199
1218
  },
1200
1219
  ...this.children
1201
1220
  ) || {};
@@ -1212,8 +1231,8 @@ class Te extends HTMLElement {
1212
1231
  if (!(!i || !a || !c)) {
1213
1232
  this.source = r ? `http://localhost:5173/src/${i}/index.jsx` : `https://www.ft.com/__component/${c}/${a}${n ? `@${n}` : "@latest"}/${i}/${i}.js`;
1214
1233
  try {
1215
- this.app = await new Promise((f, l) => {
1216
- const u = setTimeout(() => {
1234
+ this.app = await new Promise((u, l) => {
1235
+ const f = setTimeout(() => {
1217
1236
  this.dispatchEvent(
1218
1237
  new CustomEvent("ccc-timeout", {
1219
1238
  bubbles: !0,
@@ -1231,17 +1250,17 @@ class Te extends HTMLElement {
1231
1250
  /* @vite-ignore */
1232
1251
  ).then(({ default: d }) => {
1233
1252
  if (d)
1234
- clearTimeout(u), f(d);
1253
+ clearTimeout(f), u(d);
1235
1254
  else
1236
- throw new R(
1255
+ throw new D(
1237
1256
  "No component renderer default export found"
1238
1257
  );
1239
- }).catch((d) => l(new R(d)));
1258
+ }).catch((d) => l(new D(d)));
1240
1259
  });
1241
- } catch (f) {
1260
+ } catch (u) {
1242
1261
  console.error(
1243
1262
  `<custom-code-component> error during import from ${e}@${n}`
1244
- ), delete this.dataset.cccReady, this.dataset.cccError = "import-failure", this.dispatchEvent(new ErrorEvent("error", f)), console.error(f);
1263
+ ), delete this.dataset.cccReady, this.dataset.cccError = "import-failure", this.dispatchEvent(new ErrorEvent("error", u)), console.error(u);
1245
1264
  return;
1246
1265
  }
1247
1266
  try {
@@ -1255,23 +1274,17 @@ class Te extends HTMLElement {
1255
1274
  }
1256
1275
  })
1257
1276
  ), this.dataset.cccReady = "true", delete this.dataset.cccError;
1258
- } catch (f) {
1277
+ } catch (u) {
1259
1278
  console.info(
1260
1279
  `<custom-code-component> uncaught error during mount from ${e}@${n}`
1261
- ), console.error(f), this.dispatchEvent(new ErrorEvent("error", f)), this.dataset.cccError = "mount-error", delete this.dataset.cccReady;
1280
+ ), console.error(u), this.dispatchEvent(new ErrorEvent("error", u)), this.dataset.cccError = "mount-error", delete this.dataset.cccReady;
1262
1281
  }
1263
1282
  try {
1264
- M.init(
1265
- {
1266
- id: this.getAttribute("path"),
1267
- subtype: "interactive"
1268
- },
1269
- this.shadowRoot
1270
- );
1271
- } catch (f) {
1283
+ this.tracking.init(this.id);
1284
+ } catch (u) {
1272
1285
  console.info(
1273
1286
  `Error initialising tracking on <custom-code-component> ${e}@${n}`
1274
- ), console.error(f);
1287
+ ), console.error(u);
1275
1288
  }
1276
1289
  }
1277
1290
  }
@@ -1286,13 +1299,13 @@ class Te extends HTMLElement {
1286
1299
  this.channel.port1.postMessage(e);
1287
1300
  }
1288
1301
  }
1289
- const Me = () => customElements.define("custom-code-component", Te);
1290
- customElements && !customElements.get("custom-code-component") && Me();
1291
- class R extends Error {
1302
+ const Ne = () => customElements.define("custom-code-component", _e);
1303
+ customElements && !customElements.get("custom-code-component") && Ne();
1304
+ class D extends Error {
1292
1305
  constructor(...e) {
1293
- super(...e), Error.captureStackTrace && Error.captureStackTrace(this, R), this.name = "CCCImportError";
1306
+ super(...e), Error.captureStackTrace && Error.captureStackTrace(this, D), this.name = "CCCImportError";
1294
1307
  }
1295
1308
  }
1296
1309
  export {
1297
- Me as init
1310
+ Ne as init
1298
1311
  };