govuk_publishing_components 24.13.4 → 24.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +6 -5
  3. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +4 -4
  4. data/app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js +6 -7
  5. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +7 -7
  6. data/app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js +13 -12
  7. data/app/assets/javascripts/govuk_publishing_components/components/details.js +12 -18
  8. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +213 -215
  9. data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +4 -4
  10. data/app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js +6 -4
  11. data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +4 -3
  12. data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +4 -4
  13. data/app/assets/javascripts/govuk_publishing_components/components/show-password.js +5 -4
  14. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +4 -4
  15. data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +22 -2
  16. data/app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb +36 -0
  17. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js +159 -0
  18. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js +868 -0
  19. data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +3 -3
  20. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +2 -0
  21. data/config/initializers/assets.rb +3 -0
  22. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +25 -10
  23. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -0
  24. data/lib/govuk_publishing_components/version.rb +1 -1
  25. metadata +5 -2
@@ -2,11 +2,11 @@ window.GOVUK = window.GOVUK || {}
2
2
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
3
 
4
4
  (function (Modules) {
5
- function Govspeak () { }
6
-
7
- Govspeak.prototype.start = function ($module) {
8
- this.$module = $module[0]
5
+ function Govspeak ($module) {
6
+ this.$module = $module
7
+ }
9
8
 
9
+ Govspeak.prototype.init = function () {
10
10
  if (this.$module.className.indexOf('disable-youtube') === -1) {
11
11
  this.embedYoutube()
12
12
  }
@@ -2,14 +2,16 @@ window.GOVUK = window.GOVUK || {}
2
2
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
3
 
4
4
  (function (Modules) {
5
- function ModalDialogue () { }
6
-
7
- ModalDialogue.prototype.start = function ($module) {
8
- this.$module = $module[0]
5
+ function ModalDialogue ($module) {
6
+ this.$module = $module
9
7
  this.$dialogBox = this.$module.querySelector('.gem-c-modal-dialogue__box')
10
8
  this.$closeButton = this.$module.querySelector('.gem-c-modal-dialogue__close-button')
11
9
  this.$html = document.querySelector('html')
12
10
  this.$body = document.querySelector('body')
11
+ }
12
+
13
+ ModalDialogue.prototype.init = function () {
14
+ if (!this.$dialogBox || !this.$closeButton) return
13
15
 
14
16
  this.$module.resize = this.handleResize.bind(this)
15
17
  this.$module.open = this.handleOpen.bind(this)
@@ -2,10 +2,11 @@ window.GOVUK = window.GOVUK || {}
2
2
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
3
 
4
4
  (function (Modules) {
5
- function PrintLink () { }
5
+ function PrintLink ($module) {
6
+ this.$module = $module
7
+ }
6
8
 
7
- PrintLink.prototype.start = function ($module) {
8
- this.$module = $module[0]
9
+ PrintLink.prototype.init = function () {
9
10
  this.$module.addEventListener('click', function () {
10
11
  window.print()
11
12
  })
@@ -3,13 +3,13 @@ window.GOVUK = window.GOVUK || {}
3
3
  window.GOVUK.Modules = window.GOVUK.Modules || {};
4
4
 
5
5
  (function (Modules) {
6
- function ReorderableList () { }
7
-
8
- ReorderableList.prototype.start = function ($module) {
9
- this.$module = $module[0]
6
+ function ReorderableList ($module) {
7
+ this.$module = $module
10
8
  this.$upButtons = this.$module.querySelectorAll('.js-reorderable-list-up')
11
9
  this.$downButtons = this.$module.querySelectorAll('.js-reorderable-list-down')
10
+ }
12
11
 
12
+ ReorderableList.prototype.init = function () {
13
13
  this.sortable = window.Sortable.create(this.$module, { // eslint-disable-line new-cap
14
14
  chosenClass: 'gem-c-reorderable-list__item--chosen',
15
15
  dragClass: 'gem-c-reorderable-list__item--drag',
@@ -2,11 +2,12 @@ window.GOVUK = window.GOVUK || {}
2
2
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
3
 
4
4
  (function (Modules) {
5
- function ShowPassword () { }
6
-
7
- ShowPassword.prototype.start = function ($module) {
8
- this.$module = $module[0]
5
+ function ShowPassword ($module) {
6
+ this.$module = $module
9
7
  this.input = this.$module.querySelector('.gem-c-input')
8
+ }
9
+
10
+ ShowPassword.prototype.init = function () {
10
11
  this.$module.togglePassword = this.togglePassword.bind(this)
11
12
  this.$module.revertToPasswordOnFormSubmit = this.revertToPasswordOnFormSubmit.bind(this)
12
13
  this.input.classList.add('gem-c-input--with-password')
@@ -6,10 +6,8 @@ window.GOVUK = window.GOVUK || {}
6
6
  window.GOVUK.Modules = window.GOVUK.Modules || {};
7
7
 
8
8
  (function (Modules) {
9
- function Gemstepnav () { }
10
-
11
- Gemstepnav.prototype.start = function ($module) {
12
- this.$module = $module[0]
9
+ function Gemstepnav ($module) {
10
+ this.$module = $module
13
11
  this.$module.actions = {} // stores text for JS appended elements 'show' and 'hide' on steps, and 'show/hide all' button
14
12
  this.$module.rememberShownStep = false
15
13
  this.$module.stepNavSize = false
@@ -18,7 +16,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
18
16
  this.$module.activeStepClass = 'gem-c-step-nav__step--active'
19
17
  this.$module.activeLinkHref = '#content'
20
18
  this.$module.uniqueId = false
19
+ }
21
20
 
21
+ Gemstepnav.prototype.init = function () {
22
22
  // Indicate that js has worked
23
23
  this.$module.classList.add('gem-c-step-nav--active')
24
24
 
@@ -22,12 +22,12 @@
22
22
  if (targetClass.indexOf('js-visible') !== -1) {
23
23
  target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, ''))
24
24
  if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
25
- window.GOVUK.analytics.trackEvent('headerClicked', 'searchClosed', { label: 'none' })
25
+ window.GOVUK.analytics.trackEvent('headerClicked', 'menuClosed', { label: 'none' })
26
26
  }
27
27
  } else {
28
28
  target.setAttribute('class', targetClass + ' js-visible')
29
29
  if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
30
- window.GOVUK.analytics.trackEvent('headerClicked', 'searchOpened', { label: 'none' })
30
+ window.GOVUK.analytics.trackEvent('headerClicked', 'menuOpened', { label: 'none' })
31
31
  }
32
32
  }
33
33
  if (sourceClass.indexOf('js-visible') !== -1) {
@@ -47,3 +47,23 @@
47
47
  }
48
48
  }
49
49
  }).call(this)
50
+
51
+ ;(function () {
52
+ var $menuToggleButtons = document.querySelectorAll('.govuk-js-header-toggle')
53
+
54
+ for (var j = 0; j < $menuToggleButtons.length; j++) {
55
+ var element = $menuToggleButtons[j]
56
+
57
+ element.addEventListener('click', function (event) {
58
+ var expanded = event.target.getAttribute('aria-expanded')
59
+
60
+ if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
61
+ if (expanded === 'true') {
62
+ window.GOVUK.analytics.trackEvent('headerClicked', 'menuClosed', { label: 'none' })
63
+ } else {
64
+ window.GOVUK.analytics.trackEvent('headerClicked', 'menuOpened', { label: 'none' })
65
+ }
66
+ }
67
+ })
68
+ }
69
+ })()
@@ -0,0 +1,36 @@
1
+ (function() {
2
+ var marker = document.getElementsByTagName('script')[0]
3
+ var scripts = [
4
+ '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux-polyfill") %>',
5
+ '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux") %>'
6
+ ]
7
+ var parsedCookie = (function() {
8
+ try {
9
+ var cookies = document.cookie.split(';')
10
+
11
+ for (var i = 0; i < cookies.length; i++) {
12
+ var cookie = cookies[i].replace(/\s/g, '') // Remove all whitespace.
13
+ var cookieName = 'cookies_policy='
14
+
15
+ if (cookie.indexOf(cookieName) === 0) {
16
+ return JSON.parse(cookie.substring(cookieName.length))
17
+ }
18
+ }
19
+ } catch (error) {
20
+ console.error(error)
21
+ }
22
+
23
+ return {}
24
+ })()
25
+
26
+ if (parsedCookie.usage === true) {
27
+ for (var i = 0; i < scripts.length; i++) {
28
+ var script = document.createElement('script')
29
+ script.src = scripts[i]
30
+ script.async = true
31
+ script.defer = true
32
+
33
+ marker.parentNode.insertBefore(script, marker)
34
+ }
35
+ }
36
+ })()
@@ -0,0 +1,159 @@
1
+ /* eslint-disable */
2
+
3
+ /*
4
+ * Part of Speedcurve's LUX script, which allows us to run real user metrics on
5
+ * pages using the public layout template.
6
+ *
7
+ * See docs/real-user-metrics.md for more information.
8
+ */
9
+
10
+ LUX = (function () {
11
+ var a =
12
+ "undefined" !== typeof LUX && "undefined" !== typeof LUX.gaMarks
13
+ ? LUX.gaMarks
14
+ : [];
15
+ var d =
16
+ "undefined" !== typeof LUX && "undefined" !== typeof LUX.gaMeasures
17
+ ? LUX.gaMeasures
18
+ : [];
19
+ var j = "LUX_start";
20
+ var k = window.performance;
21
+ var l =
22
+ "undefined" !== typeof LUX && LUX.ns
23
+ ? LUX.ns
24
+ : Date.now
25
+ ? Date.now()
26
+ : +new Date();
27
+ if (k && k.timing && k.timing.navigationStart) {
28
+ l = k.timing.navigationStart;
29
+ }
30
+ function f() {
31
+ if (k && k.now) {
32
+ return k.now();
33
+ }
34
+ var o = Date.now ? Date.now() : +new Date();
35
+ return o - l;
36
+ }
37
+ function b(n) {
38
+ if (k) {
39
+ if (k.mark) {
40
+ return k.mark(n);
41
+ } else {
42
+ if (k.webkitMark) {
43
+ return k.webkitMark(n);
44
+ }
45
+ }
46
+ }
47
+ a.push({ name: n, entryType: "mark", startTime: f(), duration: 0 });
48
+ return;
49
+ }
50
+ function m(p, t, n) {
51
+ if ("undefined" === typeof t && h(j)) {
52
+ t = j;
53
+ }
54
+ if (k) {
55
+ if (k.measure) {
56
+ if (t) {
57
+ if (n) {
58
+ return k.measure(p, t, n);
59
+ } else {
60
+ return k.measure(p, t);
61
+ }
62
+ } else {
63
+ return k.measure(p);
64
+ }
65
+ } else {
66
+ if (k.webkitMeasure) {
67
+ return k.webkitMeasure(p, t, n);
68
+ }
69
+ }
70
+ }
71
+ var r = 0,
72
+ o = f();
73
+ if (t) {
74
+ var s = h(t);
75
+ if (s) {
76
+ r = s.startTime;
77
+ } else {
78
+ if (k && k.timing && k.timing[t]) {
79
+ r = k.timing[t] - k.timing.navigationStart;
80
+ } else {
81
+ return;
82
+ }
83
+ }
84
+ }
85
+ if (n) {
86
+ var q = h(n);
87
+ if (q) {
88
+ o = q.startTime;
89
+ } else {
90
+ if (k && k.timing && k.timing[n]) {
91
+ o = k.timing[n] - k.timing.navigationStart;
92
+ } else {
93
+ return;
94
+ }
95
+ }
96
+ }
97
+ d.push({ name: p, entryType: "measure", startTime: r, duration: o - r });
98
+ return;
99
+ }
100
+ function h(n) {
101
+ return c(n, g());
102
+ }
103
+ function c(p, o) {
104
+ for (i = o.length - 1; i >= 0; i--) {
105
+ var n = o[i];
106
+ if (p === n.name) {
107
+ return n;
108
+ }
109
+ }
110
+ return undefined;
111
+ }
112
+ function g() {
113
+ if (k) {
114
+ if (k.getEntriesByType) {
115
+ return k.getEntriesByType("mark");
116
+ } else {
117
+ if (k.webkitGetEntriesByType) {
118
+ return k.webkitGetEntriesByType("mark");
119
+ }
120
+ }
121
+ }
122
+ return a;
123
+ }
124
+ return { mark: b, measure: m, gaMarks: a, gaMeasures: d };
125
+ })();
126
+ LUX.ns = Date.now ? Date.now() : +new Date();
127
+ LUX.ac = [];
128
+ LUX.cmd = function (a) {
129
+ LUX.ac.push(a);
130
+ };
131
+ LUX.init = function () {
132
+ LUX.cmd(["init"]);
133
+ };
134
+ LUX.send = function () {
135
+ LUX.cmd(["send"]);
136
+ };
137
+ LUX.addData = function (a, b) {
138
+ LUX.cmd(["addData", a, b]);
139
+ };
140
+ LUX_ae = [];
141
+ window.addEventListener("error", function (a) {
142
+ LUX_ae.push(a);
143
+ });
144
+ LUX_al = [];
145
+ if (
146
+ "function" === typeof PerformanceObserver &&
147
+ "function" === typeof PerformanceLongTaskTiming
148
+ ) {
149
+ var LongTaskObserver = new PerformanceObserver(function (c) {
150
+ var b = c.getEntries();
151
+ for (var a = 0; a < b.length; a++) {
152
+ var d = b[a];
153
+ LUX_al.push(d);
154
+ }
155
+ });
156
+ try {
157
+ LongTaskObserver.observe({ type: ["longtask"] });
158
+ } catch (e) {}
159
+ }
@@ -0,0 +1,868 @@
1
+ /* eslint-disable */
2
+
3
+ /*
4
+ * Part of Speedcurve's LUX script, which allows us to run real user metrics on
5
+ * pages using the public layout template.
6
+ *
7
+ * See docs/real-user-metrics.md for more information.
8
+ */
9
+
10
+
11
+ /* ! Remember to keep these settings at the end of this file when updating LUX:
12
+ *
13
+ * * `LUX.customerid = 47044334` to let LUX know who this is
14
+ * * `LUX.beaconMode = "simple"` to fire the beacon as an image, which is now
15
+ * allowed by the content security policy.
16
+ * * `LUX.debug = false` turns debugging on and off. Left set to false - and
17
+ * kept in the file so it's easier to remember that this can be turned on.
18
+ *
19
+ * ! And the sample rate needs to be set inside the main function that's
20
+ * assigned to `LUX`:
21
+
22
+ * * `LUX.samplerate = 1` to set sample rate to 1% of users.
23
+ */
24
+
25
+ var LUX_t_start = Date.now(),
26
+ LUX = window.LUX || {};
27
+ LUX = function() {
28
+ // -------------------------------------------------------------------------
29
+ // Settings
30
+ // -------------------------------------------------------------------------
31
+ // Set the sample rate to 1% to avoid all events being sent.
32
+ LUX.samplerate = 1
33
+ // -------------------------------------------------------------------------
34
+ /// End
35
+ // -------------------------------------------------------------------------
36
+
37
+ var gaLog = [];
38
+ dlog("lux.js evaluation start.");
39
+ var version = "214",
40
+ _errorUrl = "https://lux.speedcurve.com/error/",
41
+ nErrors = 0,
42
+ maxErrors = 5;
43
+
44
+ function errorHandler(e) {
45
+ nErrors++, e && void 0 !== e.filename && void 0 !== e.message && (-1 !== e.filename.indexOf("/lux.js?") || -1 !== e.message.indexOf("LUX") || nErrors <= maxErrors && "function" == typeof _sample && _sample()) && ((new Image).src = _errorUrl + "?v=" + version + "&id=" + getCustomerId() + "&fn=" + encodeURIComponent(e.filename) + "&ln=" + e.lineno + "&cn=" + e.colno + "&msg=" + encodeURIComponent(e.message) + "&l=" + encodeURIComponent(_getPageLabel()) + (connectionType() ? "&ct=" + connectionType() : ""))
46
+ }
47
+ window.addEventListener("error", errorHandler);
48
+ var gaPerfEntries = "object" == typeof window.LUX_al ? window.LUX_al.slice() : [];
49
+ if ("function" == typeof PerformanceObserver) {
50
+ var perfObserver = new PerformanceObserver((function(e) {
51
+ e.getEntries().forEach((function(e) {
52
+ gaPerfEntries.push(e)
53
+ }))
54
+ }));
55
+ try {
56
+ "function" == typeof PerformanceLongTaskTiming && perfObserver.observe({
57
+ type: "longtask"
58
+ }), "function" == typeof LargestContentfulPaint && perfObserver.observe({
59
+ type: "largest-contentful-paint",
60
+ buffered: !0
61
+ }), "function" == typeof PerformanceElementTiming && perfObserver.observe({
62
+ type: "element",
63
+ buffered: !0
64
+ }), "function" == typeof PerformancePaintTiming && perfObserver.observe({
65
+ type: "paint",
66
+ buffered: !0
67
+ }), "function" == typeof LayoutShift && perfObserver.observe({
68
+ type: "layout-shift",
69
+ buffered: !0
70
+ })
71
+ } catch (e) {
72
+ dlog("Long Tasks error.")
73
+ }
74
+ } else dlog("Long Tasks not supported.");
75
+ var gFlags = 0,
76
+ gFlag_InitCalled = 1,
77
+ gFlag_NoNavTiming = 2,
78
+ gFlag_NoUserTiming = 4,
79
+ gFlag_NotVisible = 8,
80
+ gaMarks = void 0 !== LUX.gaMarks ? LUX.gaMarks : [],
81
+ gaMeasures = void 0 !== LUX.gaMeasures ? LUX.gaMeasures : [],
82
+ ghIx = {},
83
+ ghData = {},
84
+ gbLuxSent = 0,
85
+ gbNavSent = 0,
86
+ gbIxSent = 0,
87
+ gbUpdated = 0,
88
+ gbFirstPV = 1,
89
+ gStartMark = "LUX_start",
90
+ gEndMark = "LUX_end",
91
+ gSessionTimeout = 1800,
92
+ gSyncId = createSyncId(),
93
+ gUid = refreshUniqueId(gSyncId),
94
+ gCustomerDataTimeout, perf = window.performance,
95
+ gMaxQuerystring = 2e3,
96
+ _beaconUrl = void 0 !== LUX.beaconUrl ? LUX.beaconUrl : "https://lux.speedcurve.com/lux/",
97
+ _samplerate = void 0 !== LUX.samplerate ? LUX.samplerate : 100;
98
+ dlog("Sample rate = " + _samplerate + "%. " + (_sample() ? "This session IS being sampled." : "This session is NOT being sampled. The data will NOT show up in your LUX dashboards. Call LUX.forceSample() and try again."));
99
+ var _auto = void 0 === LUX.auto || LUX.auto,
100
+ _navigationStart = LUX.ns ? LUX.ns : Date.now ? Date.now() : +new Date,
101
+ gLuxSnippetStart = 0,
102
+ gFirstInputDelay;
103
+ perf && perf.timing && perf.timing.navigationStart ? (_navigationStart = perf.timing.navigationStart, gLuxSnippetStart = LUX.ns ? LUX.ns - _navigationStart : 0) : (dlog("Nav Timing is not supported."), gFlags |= gFlag_NoNavTiming);
104
+ var gaEventTypes = ["click", "mousedown", "keydown", "touchstart", "pointerdown"],
105
+ ghListenerOptions = {
106
+ passive: !0,
107
+ capture: !0
108
+ };
109
+
110
+ function recordDelay(e) {
111
+ gFirstInputDelay || (gFirstInputDelay = Math.round(e), gaEventTypes.forEach((function(e) {
112
+ removeEventListener(e, onInput, ghListenerOptions)
113
+ })))
114
+ }
115
+
116
+ function onPointerDown(e, t) {
117
+ function n() {
118
+ recordDelay(e, t), a()
119
+ }
120
+
121
+ function r() {
122
+ a()
123
+ }
124
+
125
+ function a() {
126
+ window.removeEventListener("pointerup", n, ghListenerOptions), window.removeEventListener("pointercancel", r, ghListenerOptions)
127
+ }
128
+ window.addEventListener("pointerup", n, ghListenerOptions), window.addEventListener("pointercancel", r, ghListenerOptions)
129
+ }
130
+
131
+ function onInput(e) {
132
+ var t = !1;
133
+ try {
134
+ t = e.cancelable
135
+ } catch (e) {
136
+ return void dlog("Permission error accessing input event.")
137
+ }
138
+ if (t) {
139
+ var n = _now(!0),
140
+ r = e.timeStamp;
141
+ if (r > 152e7 && (n = Number(new Date)), r > n) return;
142
+ var a = n - r;
143
+ "pointerdown" == e.type ? onPointerDown(a, e) : recordDelay(a, e)
144
+ }
145
+ }
146
+
147
+ function _now(e) {
148
+ var t = (Date.now ? Date.now() : +new Date) - _navigationStart,
149
+ n = _getMark(gStartMark);
150
+ return n && !e ? t - n.startTime : perf && perf.now ? perf.now() : t
151
+ }
152
+
153
+ function _mark(e) {
154
+ if (dlog("Enter LUX.mark(), name = " + e), perf) {
155
+ if (perf.mark) return perf.mark(e);
156
+ if (perf.webkitMark) return perf.webkitMark(e)
157
+ }
158
+ gFlags |= gFlag_NoUserTiming, gaMarks.push({
159
+ name: e,
160
+ entryType: "mark",
161
+ startTime: _now(),
162
+ duration: 0
163
+ })
164
+ }
165
+
166
+ function _measure(e, t, n) {
167
+ if (dlog("Enter LUX.measure(), name = " + e), void 0 === t && _getMark(gStartMark) && (t = gStartMark), perf) {
168
+ if (perf.measure) return t ? n ? perf.measure(e, t, n) : perf.measure(e, t) : perf.measure(e);
169
+ if (perf.webkitMeasure) return perf.webkitMeasure(e, t, n)
170
+ }
171
+ var r = 0,
172
+ a = _now();
173
+ if (t) {
174
+ var i = _getMark(t);
175
+ if (i) r = i.startTime;
176
+ else {
177
+ if (!(perf && perf.timing && perf.timing[t])) return;
178
+ r = perf.timing[t] - perf.timing.navigationStart
179
+ }
180
+ }
181
+ if (n) {
182
+ var o = _getMark(n);
183
+ if (o) a = o.startTime;
184
+ else {
185
+ if (!(perf && perf.timing && perf.timing[n])) return;
186
+ a = perf.timing[n] - perf.timing.navigationStart
187
+ }
188
+ }
189
+ gaMeasures.push({
190
+ name: e,
191
+ entryType: "measure",
192
+ startTime: r,
193
+ duration: a - r
194
+ })
195
+ }
196
+
197
+ function _getMark(e) {
198
+ return _getM(e, _getMarks())
199
+ }
200
+
201
+ function _getM(e, t) {
202
+ if (t)
203
+ for (var n = t.length - 1; n >= 0; n--) {
204
+ var r = t[n];
205
+ if (e === r.name) return r
206
+ }
207
+ }
208
+
209
+ function _getMarks() {
210
+ if (perf) {
211
+ if (perf.getEntriesByType) return perf.getEntriesByType("mark");
212
+ if (perf.webkitGetEntriesByType) return perf.webkitGetEntriesByType("mark")
213
+ }
214
+ return gaMarks
215
+ }
216
+
217
+ function _getMeasures() {
218
+ if (perf) {
219
+ if (perf.getEntriesByType) return perf.getEntriesByType("measure");
220
+ if (perf.webkitGetEntriesByType) return perf.webkitGetEntriesByType("measure")
221
+ }
222
+ return gaMeasures
223
+ }
224
+
225
+ function userTimingValues() {
226
+ var e = {},
227
+ t = _getMark(gStartMark),
228
+ n = _getMarks();
229
+ n && n.forEach((function(n) {
230
+ var r = n.name,
231
+ a = r !== gStartMark && t ? t.startTime : 0,
232
+ i = Math.round(n.startTime - a);
233
+ i < 0 || (void 0 === e[r] ? e[r] = i : e[r] = Math.max(i, e[r]))
234
+ }));
235
+ var r = _getMeasures();
236
+ r && r.forEach((function(n) {
237
+ if (!(t && n.startTime < t.startTime)) {
238
+ var r = n.name,
239
+ a = Math.round(n.duration);
240
+ void 0 === e[r] ? e[r] = a : e[r] = Math.max(a, e[r])
241
+ }
242
+ }));
243
+ var a = [];
244
+ return Object.keys(e).forEach((function(t) {
245
+ a.push(t + "|" + e[t])
246
+ })), a.join(",")
247
+ }
248
+
249
+ function elementTimingValues() {
250
+ var e = [];
251
+ if (gaPerfEntries.length)
252
+ for (var t = 0; t < gaPerfEntries.length; t++) {
253
+ var n = gaPerfEntries[t];
254
+ "element" === n.entryType && n.identifier && n.startTime && e.push(n.identifier + "|" + Math.round(n.startTime))
255
+ }
256
+ return e.join(",")
257
+ }
258
+
259
+ function cpuTimes() {
260
+ if ("function" != typeof PerformanceLongTaskTiming) return "";
261
+ var e = "",
262
+ t = {},
263
+ n = {};
264
+ if (gaPerfEntries.length)
265
+ for (var r = _getMark(gStartMark), a = r ? r.startTime : 0, i = r ? _getMark(gEndMark).startTime : perf.timing.loadEventEnd - perf.timing.navigationStart, o = 0; o < gaPerfEntries.length; o++) {
266
+ var s = gaPerfEntries[o];
267
+ if ("longtask" === s.entryType) {
268
+ var d = Math.round(s.duration);
269
+ if (s.startTime < a) d -= a - s.startTime;
270
+ else if (s.startTime >= i) continue;
271
+ var g = s.attribution[0].name;
272
+ t[g] || (t[g] = 0, n[g] = ""), t[g] += d, n[g] += "," + Math.round(s.startTime) + "|" + d
273
+ }
274
+ }
275
+ var u = void 0 !== t.script ? "script" : "unknown";
276
+ void 0 === t[u] && (t[u] = 0, n[u] = "");
277
+ var c = cpuStats(n[u]),
278
+ l = ",n|" + c.count + ",d|" + c.median + ",x|" + c.max + (0 === c.fci ? "" : ",i|" + c.fci);
279
+ return e += "s|" + t[u] + l + n[u]
280
+ }
281
+
282
+ function cpuStats(e) {
283
+ for (var t = 0, n = getFcp(), r = 0 === n, a = [], i = e.split(","), o = 0; o < i.length; o++) {
284
+ var s = i[o].split("|");
285
+ if (2 === s.length) {
286
+ var d = parseInt(s[0]),
287
+ g = parseInt(s[1]);
288
+ a.push(g), t = g > t ? g : t, !r && d > n && (d - n > 5e3 ? r = !0 : n = d + g)
289
+ }
290
+ }
291
+ return {
292
+ count: a.length,
293
+ median: arrayMedian(a),
294
+ max: t,
295
+ fci: n
296
+ }
297
+ }
298
+
299
+ function calculateDCLS() {
300
+ if ("function" != typeof LayoutShift) return !1;
301
+ for (var e = 0, t = 0; t < gaPerfEntries.length; t++) {
302
+ var n = gaPerfEntries[t];
303
+ "layout-shift" !== n.entryType || n.hadRecentInput || (e += n.value)
304
+ }
305
+ return e.toFixed(6)
306
+ }
307
+
308
+ function arrayMedian(e) {
309
+ if (0 === e.length) return 0;
310
+ var t = Math.floor(e.length / 2);
311
+ return e.sort((function(e, t) {
312
+ return e - t
313
+ })), e.length % 2 ? e[t] : Math.round((e[t - 1] + e[t]) / 2)
314
+ }
315
+
316
+ function selfLoading() {
317
+ var e = "";
318
+ if (perf && perf.getEntriesByName) {
319
+ var t = getScriptElement("/js/lux.js");
320
+ if (t) {
321
+ var n = perf.getEntriesByName(t.src);
322
+ if (n && n.length) {
323
+ var r = n[0],
324
+ a = Math.round(r.domainLookupEnd - r.domainLookupStart),
325
+ i = Math.round(r.connectEnd - r.connectStart),
326
+ o = Math.round(r.responseStart - r.requestStart),
327
+ s = Math.round(r.responseEnd - r.responseStart),
328
+ d = a + i + o + s,
329
+ g = LUX_t_end - LUX_t_start,
330
+ u = r.encodedBodySize ? r.encodedBodySize : 0;
331
+ e = "d" + a + "t" + i + "f" + o + "c" + s + "n" + d + "e" + g + "r" + _samplerate + (u ? "x" + u : "") + (gLuxSnippetStart ? "l" + gLuxSnippetStart : "") + "s" + (LUX_t_start - _navigationStart)
332
+ }
333
+ }
334
+ }
335
+ return e
336
+ }
337
+
338
+ function _clearIx() {
339
+ ghIx = {}
340
+ }
341
+
342
+ function ixValues() {
343
+ var e = [];
344
+ for (var t in ghIx) e.push(t + "|" + ghIx[t]);
345
+ return e.join(",")
346
+ }
347
+
348
+ function _addData(e, t) {
349
+ dlog("Enter LUX.addData(), name = " + e + ", value = " + t);
350
+ var n = typeof t;
351
+ "string" !== typeof e || "string" !== n && "number" !== n && "boolean" !== n || (ghData[e] = t), gbLuxSent && (gCustomerDataTimeout && clearTimeout(gCustomerDataTimeout), gCustomerDataTimeout = setTimeout(_sendCustomerData, 100))
352
+ }
353
+
354
+ function _sample() {
355
+ if (void 0 === gUid || void 0 === _samplerate) return !1;
356
+ var e = ("" + gUid).substr(-2);
357
+ return parseInt(e) < _samplerate
358
+ }
359
+
360
+ function customerDataValues() {
361
+ var e = [];
362
+ for (var t in ghData) {
363
+ var n = "" + ghData[t];
364
+ t = t.replace(/,/g, "").replace(/\|/g, ""), n = n.replace(/,/g, "").replace(/\|/g, ""), e.push(t + "|" + n)
365
+ }
366
+ return encodeURIComponent(e.join(","))
367
+ }
368
+
369
+ function _init() {
370
+ dlog("Enter LUX.init()."), _clearIx(), _removeIxHandlers(), _addIxHandlers(), gbNavSent = 0, gbLuxSent = 0, gbIxSent = 0, gbFirstPV = 0, gSyncId = createSyncId(), gUid = refreshUniqueId(gSyncId), gaPerfEntries.splice(0), gFlags = 0, gFlags |= gFlag_InitCalled, _mark(gStartMark)
371
+ }
372
+
373
+ function blockingScripts() {
374
+ var e = lastViewportElement();
375
+ if (!e) return syncScripts();
376
+ for (var t = document.getElementsByTagName("script"), n = 0, r = 0, a = t.length; r < a; r++) {
377
+ var i = t[r];
378
+ !i.src || i.async || i.defer || 0 == (4 & i.compareDocumentPosition(e)) || n++
379
+ }
380
+ return n
381
+ }
382
+
383
+ function blockingStylesheets() {
384
+ for (var e = 0, t = document.getElementsByTagName("link"), n = 0, r = t.length; n < r; n++) {
385
+ var a = t[n];
386
+ a.href && "stylesheet" === a.rel && 0 !== a.href.indexOf("data:") && (a.onloadcssdefined || "print" === a.media || "style" === a.as || "function" == typeof a.onload && "all" === a.media || e++)
387
+ }
388
+ return e
389
+ }
390
+
391
+ function syncScripts() {
392
+ for (var e = document.getElementsByTagName("script"), t = 0, n = 0, r = e.length; n < r; n++) {
393
+ var a = e[n];
394
+ !a.src || a.async || a.defer || t++
395
+ }
396
+ return t
397
+ }
398
+
399
+ function numScripts() {
400
+ for (var e = document.getElementsByTagName("script"), t = 0, n = 0, r = e.length; n < r; n++) {
401
+ e[n].src && t++
402
+ }
403
+ return t
404
+ }
405
+
406
+ function numStylesheets() {
407
+ for (var e = document.getElementsByTagName("link"), t = 0, n = 0, r = e.length; n < r; n++) {
408
+ var a = e[n];
409
+ a.href && "stylesheet" == a.rel && t++
410
+ }
411
+ return t
412
+ }
413
+
414
+ function inlineTagSize(e) {
415
+ for (var t = document.getElementsByTagName(e), n = 0, r = 0, a = t.length; r < a; r++) {
416
+ var i = t[r];
417
+ try {
418
+ n += i.innerHTML.length
419
+ } catch (i) {
420
+ return dlog("Error accessing inline element innerHTML."), -1
421
+ }
422
+ }
423
+ return n
424
+ }
425
+
426
+ function getNavTiming() {
427
+ var e = "",
428
+ t = _navigationStart;
429
+ if (_getMark(gStartMark) && _getMark(gEndMark)) {
430
+ var n = Math.round(_getMark(gStartMark).startTime);
431
+ e = (t += n) + "fs0ls" + (s = Math.round(_getMark(gEndMark).startTime) - n) + "le" + s
432
+ } else if (perf && perf.timing) {
433
+ var r = perf.timing,
434
+ a = getStartRender(),
435
+ i = getFcp(),
436
+ o = getLcp();
437
+ e = t + (r.redirectStart ? "rs" + (r.redirectStart - t) : "") + (r.redirectEnd ? "re" + (r.redirectEnd - t) : "") + (r.fetchStart ? "fs" + (r.fetchStart - t) : "") + (r.domainLookupStart ? "ds" + (r.domainLookupStart - t) : "") + (r.domainLookupEnd ? "de" + (r.domainLookupEnd - t) : "") + (r.connectStart ? "cs" + (r.connectStart - t) : "") + (r.secureConnectionStart ? "sc" + (r.secureConnectionStart - t) : "") + (r.connectEnd ? "ce" + (r.connectEnd - t) : "") + (r.requestStart ? "qs" + (r.requestStart - t) : "") + (r.responseStart ? "bs" + (r.responseStart - t) : "") + (r.responseEnd ? "be" + (r.responseEnd - t) : "") + (r.domLoading ? "ol" + (r.domLoading - t) : "") + (r.domInteractive ? "oi" + (r.domInteractive - t) : "") + (r.domContentLoadedEventStart ? "os" + (r.domContentLoadedEventStart - t) : "") + (r.domContentLoadedEventEnd ? "oe" + (r.domContentLoadedEventEnd - t) : "") + (r.domComplete ? "oc" + (r.domComplete - t) : "") + (r.loadEventStart ? "ls" + (r.loadEventStart - t) : "") + (r.loadEventEnd ? "le" + (r.loadEventEnd - t) : "") + (a ? "sr" + a : "") + (i ? "fc" + i : "") + (o ? "lc" + o : "")
438
+ } else if (_getMark(gEndMark)) {
439
+ var s;
440
+ e = t + "fs0ls" + (s = Math.round(_getMark(gEndMark).startTime)) + "le" + s
441
+ }
442
+ return e
443
+ }
444
+
445
+ function getFcp() {
446
+ if (perf && perf.getEntriesByType && perf.getEntriesByType("paint"))
447
+ for (var e = perf.getEntriesByType("paint"), t = 0; t < e.length; t++) {
448
+ var n = e[t];
449
+ if ("first-contentful-paint" === n.name) return Math.round(n.startTime)
450
+ }
451
+ return 0
452
+ }
453
+
454
+ function getLcp() {
455
+ if (gaPerfEntries.length)
456
+ for (var e = gaPerfEntries.length - 1; e >= 0; e--) {
457
+ var t = gaPerfEntries[e];
458
+ if ("largest-contentful-paint" === t.entryType) return Math.round(t.startTime)
459
+ }
460
+ return 0
461
+ }
462
+
463
+ function getStartRender() {
464
+ if (perf && perf.timing) {
465
+ var e, t = perf.timing,
466
+ n = t.navigationStart;
467
+ if (n) {
468
+ if (perf && perf.getEntriesByType && perf.getEntriesByType("paint") && perf.getEntriesByType("paint").length)
469
+ for (var r = perf.getEntriesByType("paint"), a = 0; a < r.length; a++) {
470
+ var i = r[a];
471
+ if ("first-paint" === i.name) {
472
+ e = Math.round(i.startTime);
473
+ break
474
+ }
475
+ } else if (window.chrome && "function" == typeof window.chrome.loadTimes) {
476
+ var o = window.chrome.loadTimes();
477
+ o && (e = Math.round(1e3 * o.firstPaintTime - n))
478
+ } else t.msFirstPaint && (e = Math.round(t.msFirstPaint - n));
479
+ if (e > 0) return e
480
+ }
481
+ }
482
+ return dlog("Paint Timing not supported."), null
483
+ }
484
+
485
+ function getCustomerId() {
486
+ if (void 0 !== LUX.customerid) return LUX.customerid;
487
+ var e = getScriptElement("/js/lux.js");
488
+ return e ? (LUX.customerid = getQuerystringParam(e.src, "id"), LUX.customerid) : ""
489
+ }
490
+
491
+ function getScriptElement(e) {
492
+ for (var t = document.getElementsByTagName("script"), n = 0, r = t.length; n < r; n++) {
493
+ var a = t[n];
494
+ if (a.src && -1 !== a.src.indexOf(e)) return a
495
+ }
496
+ return null
497
+ }
498
+
499
+ function getQuerystringParam(e, t) {
500
+ for (var n = e.split("?")[1].split("&"), r = 0, a = n.length; r < a; r++) {
501
+ var i = n[r].split("=");
502
+ if (t === i[0]) return i[1]
503
+ }
504
+ }
505
+
506
+ function avgDomDepth() {
507
+ for (var e = document.getElementsByTagName("*"), t = e.length, n = 0; t--;) n += numParents(e[t]);
508
+ return Math.round(n / e.length)
509
+ }
510
+
511
+ function numParents(e) {
512
+ var t = 0;
513
+ if (e.parentNode)
514
+ for (; e = e.parentNode;) t++;
515
+ return t
516
+ }
517
+
518
+ function docHeight(e) {
519
+ var t = e.body,
520
+ n = e.documentElement;
521
+ return Math.max(t ? t.scrollHeight : 0, t ? t.offsetHeight : 0, n ? n.clientHeight : 0, n ? n.scrollHeight : 0, n ? n.offsetHeight : 0)
522
+ }
523
+
524
+ function docWidth(e) {
525
+ var t = e.body,
526
+ n = e.documentElement;
527
+ return Math.max(t ? t.scrollWidth : 0, t ? t.offsetWidth : 0, n ? n.clientWidth : 0, n ? n.scrollWidth : 0, n ? n.offsetWidth : 0)
528
+ }
529
+
530
+ function docSize() {
531
+ if (perf && perf.getEntriesByType) {
532
+ var e = performance.getEntriesByType("navigation");
533
+ if (e && e.length > 0 && e[0].encodedBodySize) return e[0].encodedBodySize
534
+ }
535
+ return 0
536
+ }
537
+
538
+ function navigationType() {
539
+ return perf && perf.navigation && void 0 !== perf.navigation.type ? perf.navigation.type : ""
540
+ }
541
+
542
+ function connectionType() {
543
+ var e = navigator.connection,
544
+ t = "";
545
+ return e && e.effectiveType && (t = "slow-2g" === (t = e.effectiveType) ? "Slow 2G" : "2g" === t || "3g" === t || "4g" === t || "5g" === t ? t.toUpperCase() : t.charAt(0).toUpperCase() + t.slice(1)), t
546
+ }
547
+
548
+ function imagesATF() {
549
+ var e = document.getElementsByTagName("img"),
550
+ t = [];
551
+ if (e)
552
+ for (var n = 0, r = e.length; n < r; n++) {
553
+ var a = e[n];
554
+ inViewport(a) && t.push(a)
555
+ }
556
+ return t
557
+ }
558
+
559
+ function lastViewportElement(e) {
560
+ var t;
561
+ if (e || (e = document.body), e) {
562
+ var n = e.children;
563
+ if (n)
564
+ for (var r = 0, a = n.length; r < a; r++) {
565
+ var i = n[r];
566
+ inViewport(i) && (t = i)
567
+ }
568
+ }
569
+ return t ? lastViewportElement(t) : e
570
+ }
571
+
572
+ function inViewport(e) {
573
+ var t = document.documentElement.clientHeight,
574
+ n = document.documentElement.clientWidth,
575
+ r = findPos(e);
576
+ return r[0] >= 0 && r[1] >= 0 && r[0] < n && r[1] < t && e.offsetWidth > 0 && e.offsetHeight > 0
577
+ }
578
+
579
+ function findPos(e) {
580
+ for (var t = 0, n = 0; e;) t += e.offsetLeft, n += e.offsetTop, e = e.offsetParent;
581
+ return [t, n]
582
+ }
583
+
584
+ function _sendLux() {
585
+ dlog("Enter LUX.send().");
586
+ var e = getCustomerId();
587
+ if (e && gSyncId && validDomain() && _sample() && !gbLuxSent) {
588
+ _mark(gEndMark);
589
+ var t = userTimingValues(),
590
+ n = elementTimingValues(),
591
+ r = customerDataValues(),
592
+ a = "";
593
+ gbIxSent || (a = ixValues());
594
+ var i = cpuTimes(),
595
+ o = calculateDCLS(),
596
+ s = selfLoading();
597
+ document.visibilityState && "visible" !== document.visibilityState && (gFlags |= gFlag_NotVisible);
598
+ var d = _beaconUrl + "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + (r ? "&CD=" + r : "") + "&l=" + encodeURIComponent(_getPageLabel()),
599
+ g = inlineTagSize("script"),
600
+ u = inlineTagSize("style"),
601
+ c = (gbNavSent ? "" : "&NT=" + getNavTiming()) + (gbFirstPV ? "&LJS=" + s : "") + "&PS=ns" + numScripts() + "bs" + blockingScripts() + (g > -1 ? "is" + g : "") + "ss" + numStylesheets() + "bc" + blockingStylesheets() + (u > -1 ? "ic" + u : "") + "ia" + imagesATF().length + "it" + document.getElementsByTagName("img").length + "dd" + avgDomDepth() + "nd" + document.getElementsByTagName("*").length + "vh" + document.documentElement.clientHeight + "vw" + document.documentElement.clientWidth + "dh" + docHeight(document) + "dw" + docWidth(document) + (docSize() ? "ds" + docSize() : "") + (connectionType() ? "ct" + connectionType() + "_" : "") + "er" + nErrors + "nt" + navigationType() + (navigator.deviceMemory ? "dm" + Math.round(navigator.deviceMemory) : "") + (a ? "&IX=" + a : "") + (gFirstInputDelay ? "&FID=" + gFirstInputDelay : "") + (i ? "&CPU=" + i : "") + (gFlags ? "&fl=" + gFlags : "") + (n ? "&ET=" + n : "") + "&HN=" + encodeURIComponent(document.location.hostname) + (!1 !== o ? "&CLS=" + o : ""),
602
+ l = "";
603
+ if (t) {
604
+ var f = d.length + c.length;
605
+ if (f + t.length <= gMaxQuerystring) c += "&UT=" + t;
606
+ else {
607
+ var m = gMaxQuerystring - f,
608
+ p = t.lastIndexOf(",", m);
609
+ c += "&UT=" + t.substring(0, p), l = t.substring(p + 1)
610
+ }
611
+ }
612
+ var v = d + c;
613
+ dlog("Sending main LUX beacon: " + v), _sendBeacon(v), gbLuxSent = 1, gbNavSent = 1, gbIxSent = a ? 1 : 0;
614
+ for (var h = gMaxQuerystring - d.length; l;) {
615
+ var y = "";
616
+ if (l.length <= h) y = l, l = "";
617
+ else {
618
+ var _ = l.lastIndexOf(",", h); - 1 === _ && (_ = l.indexOf(",")), -1 === _ ? (y = l, l = "") : (y = l.substring(0, _), l = l.substring(_ + 1))
619
+ }
620
+ var L = d + "&UT=" + y;
621
+ dlog("Sending extra User Timing beacon: " + L), _sendBeacon(L)
622
+ }
623
+ }
624
+ }
625
+
626
+ function _sendIx() {
627
+ var e = getCustomerId();
628
+ if (e && gSyncId && validDomain() && _sample() && !gbIxSent && gbLuxSent) {
629
+ var t = ixValues();
630
+ if (t) {
631
+ var n = customerDataValues(),
632
+ r = "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + (n ? "&CD=" + n : "") + "&l=" + encodeURIComponent(_getPageLabel()) + "&IX=" + t + (gFirstInputDelay ? "&FID=" + gFirstInputDelay : "") + "&HN=" + encodeURIComponent(document.location.hostname),
633
+ a = _beaconUrl + r;
634
+ dlog("Sending Interaction Metrics beacon: " + a), _sendBeacon(a), gbIxSent = 1
635
+ }
636
+ }
637
+ }
638
+
639
+ function _sendCustomerData() {
640
+ var e = getCustomerId();
641
+ if (e && gSyncId && validDomain() && _sample() && gbLuxSent) {
642
+ var t = customerDataValues();
643
+ if (t) {
644
+ var n = "?v=" + version + "&id=" + e + "&sid=" + gSyncId + "&uid=" + gUid + "&CD=" + t + "&l=" + encodeURIComponent(_getPageLabel()) + "&HN=" + encodeURIComponent(document.location.hostname),
645
+ r = _beaconUrl + n;
646
+ dlog("Sending late Customer Data beacon: " + r), _sendBeacon(r)
647
+ }
648
+ }
649
+ }
650
+
651
+ function _sendBeacon(e) {
652
+ if ("simple" !== LUX.beaconMode) return _sendBeaconAutoUpdate(e);
653
+ (new Image).src = e
654
+ }
655
+
656
+ function _sendBeaconAutoUpdate(e) {
657
+ var t = document.createElement("script");
658
+ t.async = !0, t.src = e;
659
+ var n = document.getElementsByTagName("script");
660
+ n.length ? n[0].parentNode.insertBefore(t, n[0]) : ((n = document.getElementsByTagName("head")).length || (n = document.getElementsByTagName("body")).length) && n[0].appendChild(t)
661
+ }
662
+
663
+ function interactionAttributionForElement(e) {
664
+ if (e.id) return e.id;
665
+ for (var t, n = e; n.parentNode && n.parentNode.tagName;) {
666
+ if ((n = n.parentNode).hasAttribute("data-sctrack")) return n.getAttribute("data-sctrack");
667
+ n.id && !t && (t = n.id)
668
+ }
669
+ var r = "INPUT" === e.tagName && "submit" === e.type,
670
+ a = "BUTTON" === e.tagName,
671
+ i = "A" === e.tagName;
672
+ return r && e.value ? e.value : (a || i) && e.innerText ? e.innerText : t || ""
673
+ }
674
+
675
+ function _scrollHandler() {
676
+ void 0 === ghIx.s && (ghIx.s = Math.round(_now()))
677
+ }
678
+
679
+ function _keyHandler(e) {
680
+ if (_removeIxHandlers(), void 0 === ghIx.k) {
681
+ if (ghIx.k = Math.round(_now()), e && e.target) {
682
+ var t = interactionAttributionForElement(e.target);
683
+ t && (ghIx.ki = t)
684
+ }
685
+ _sendIx()
686
+ }
687
+ }
688
+
689
+ function _clickHandler(e) {
690
+ if (_removeIxHandlers(), void 0 === ghIx.c) {
691
+ ghIx.c = Math.round(_now());
692
+ var t = null;
693
+ try {
694
+ e && e.target && (t = e.target)
695
+ } catch (e) {
696
+ dlog("Error accessing event target."), t = null
697
+ }
698
+ if (t) {
699
+ e.clientX && (ghIx.cx = e.clientX, ghIx.cy = e.clientY);
700
+ var n = interactionAttributionForElement(e.target);
701
+ n && (ghIx.ci = n)
702
+ }
703
+ _sendIx()
704
+ }
705
+ }
706
+
707
+ function _doUpdate(e, t) {
708
+ if (e && version < e && document.body && !gbUpdated) {
709
+ dlog("Updating cached version of lux.js from " + version + " to " + e + "."), gbUpdated = 1;
710
+ var n = getScriptElement("/js/lux.js");
711
+ if (n)
712
+ if ("function" == typeof fetch) fetch(n.src, {
713
+ cache: "reload"
714
+ });
715
+ else {
716
+ var r = document.createElement("iframe");
717
+ r.style.display = "none", r.id = "LUX_update_iframe", r.src = "//cdn.speedcurve.com/luxupdate.php?src=" + encodeURIComponent(n.src) + (t ? "&tw=" + t : ""), document.body.appendChild(r)
718
+ }
719
+ }
720
+ }
721
+
722
+ function addListener(e, t) {
723
+ window.addEventListener ? window.addEventListener(e, t, !1) : window.attachEvent && window.attachEvent("on" + e, t)
724
+ }
725
+
726
+ function removeListener(e, t) {
727
+ window.removeEventListener ? window.removeEventListener(e, t, !1) : window.detachEvent && window.detachEvent("on" + e, t)
728
+ }
729
+
730
+ function _addIxHandlers() {
731
+ addListener("scroll", _scrollHandler), addListener("keypress", _keyHandler), addListener("mousedown", _clickHandler)
732
+ }
733
+
734
+ function _removeIxHandlers() {
735
+ removeListener("scroll", _scrollHandler), removeListener("keypress", _keyHandler), removeListener("mousedown", _clickHandler)
736
+ }
737
+
738
+ function createSyncId(e) {
739
+ return e ? Number(new Date) + "00000" : Number(new Date) + "" + _padLeft(parseInt(1e5 * Math.random()), "00000")
740
+ }
741
+
742
+ function refreshUniqueId(e) {
743
+ var t = _getCookie("lux_uid");
744
+ if (!t || t.length < 11) t = e;
745
+ else {
746
+ var n = parseInt(t.substring(0, 10));
747
+ Number(new Date) / 1e3 - n > 86400 && (t = e)
748
+ }
749
+ return setUniqueId(t), t
750
+ }
751
+
752
+ function setUniqueId(e) {
753
+ return _setCookie("lux_uid", e, gSessionTimeout), e
754
+ }
755
+
756
+ function _getUniqueId() {
757
+ return gUid
758
+ }
759
+
760
+ function _getPageLabel() {
761
+ if (void 0 !== LUX.label) return LUX.label;
762
+ if (void 0 !== LUX.jspagelabel) {
763
+ try {
764
+ var label = eval(LUX.jspagelabel)
765
+ } catch (e) {
766
+ console.log("Error evaluating customer settings LUX page label:", e)
767
+ }
768
+ if (label) return label
769
+ }
770
+ return document.title
771
+ }
772
+
773
+ function validDomain() {
774
+ return !0
775
+ }
776
+
777
+ function _getCookie(e) {
778
+ try {
779
+ for (var t = document.cookie.split(";"), n = 0; n < t.length; n++) {
780
+ var r = t[n].split("=");
781
+ if (e === r[0].trim()) return unescape(r[1])
782
+ }
783
+ } catch (e) {
784
+ dlog("Error accessing document.cookie.")
785
+ }
786
+ }
787
+
788
+ function _setCookie(e, t, n) {
789
+ try {
790
+ document.cookie = e + "=" + escape(t) + (n ? "; max-age=" + n : "") + "; path=/; SameSite=Lax"
791
+ } catch (e) {
792
+ dlog("Error setting document.cookie.")
793
+ }
794
+ }
795
+
796
+ function _padLeft(e, t) {
797
+ return (t + e).slice(-t.length)
798
+ }
799
+
800
+ function dlog(e) {
801
+ gaLog.push(e), LUX.debug && console.log("LUX: " + e)
802
+ }
803
+ gaEventTypes.forEach((function(e) {
804
+ window.addEventListener(e, onInput, ghListenerOptions)
805
+ })), _auto && ("complete" == document.readyState ? _sendLux() : addListener("load", (function() {
806
+ setTimeout(_sendLux, 200)
807
+ })), addListener("beforeunload", _sendLux), addListener("unload", _sendLux), addListener("beforeunload", _sendIx), addListener("unload", _sendIx)), _addIxHandlers();
808
+ var _LUX = {
809
+ mark: _mark,
810
+ measure: _measure,
811
+ init: _init,
812
+ send: _sendLux,
813
+ addData: _addData,
814
+ getSessionId: _getUniqueId,
815
+ getDebug: function() {
816
+ return gaLog
817
+ },
818
+ forceSample: function() {
819
+ setUniqueId(createSyncId(!0)), console.log("Sampling has been turned on for this session.")
820
+ },
821
+ doUpdate: _doUpdate,
822
+ cmd: function(e) {
823
+ var t = e.shift();
824
+ "function" == typeof _LUX[t] && _LUX[t].apply(_LUX, e)
825
+ },
826
+ beaconUrl: _beaconUrl,
827
+ samplerate: _samplerate,
828
+ auto: _auto,
829
+ label: void 0 !== LUX.label ? LUX.label : void 0,
830
+ jspagelabel: void 0 !== LUX.jspagelabel ? LUX.jspagelabel : void 0,
831
+ version: version,
832
+ ae: [],
833
+ al: [],
834
+ debug: !!LUX.debug
835
+ };
836
+ return LUX.ac && LUX.ac.length && LUX.ac.forEach((function(e) {
837
+ var t = e.shift();
838
+ "function" == typeof _LUX[t] && _LUX[t].apply(_LUX, e)
839
+ })), void 0 !== window.LUX_ae && window.LUX_ae.forEach((function(e) {
840
+ errorHandler(e)
841
+ })), dlog("lux.js evaluation end."), _LUX
842
+ }();
843
+ var LUX_t_end = Date.now();
844
+
845
+ // -----------------------------------------------------------------------------
846
+ // More settings
847
+ // -----------------------------------------------------------------------------
848
+ //
849
+ // This ID usually appended to the end of the lux.js as a query string when
850
+ // using the SpeedCurve hosted version - but we have to include it here as this
851
+ // is self hosted.
852
+ LUX.customerid = 47044334;
853
+
854
+ // Turn on the image-based beacon, rather than have a remote JavaScript file
855
+ // fetched and executed.
856
+ LUX.beaconMode = "simple";
857
+
858
+ // Setting debug to `true` shows what happening as it happens. Running
859
+ // `LUX.getDebug()` in the browser's console will show the history of what's
860
+ // happened.
861
+ LUX.debug = false;
862
+
863
+ // Forces sampling - useful for when used with `debug = true`
864
+ // LUX.forceSample()
865
+
866
+ // -----------------------------------------------------------------------------
867
+ // End of more settings
868
+ // -----------------------------------------------------------------------------