@qbix/q 1.0.5 → 1.0.7
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.
- package/README.md +4 -6
- package/dist/Metrics.js +36 -347
- package/dist/Metrics.min.js +159 -94
- package/dist/handlebars.minimal.min.js +12 -1
- package/dist/jquery.minimal.min.js +10 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Size: ~40KB (Minified + GZipped), [compare to other frameworks](https://gist.git
|
|
|
6
6
|
How to use: copy contents of `dist` into your project, and then include it like this:
|
|
7
7
|
| File Type | Code to Use |
|
|
8
8
|
|------------|-------------|
|
|
9
|
-
|`.html` files| `<script type="module" src="https://unpkg.com/@qbix/q
|
|
10
|
-
|`.js` or `.ts` files|`import Q from 'https://unpkg.com/@qbix/q
|
|
9
|
+
|`.html` files| `<script type="module" src="https://unpkg.com/@qbix/q/dist/Q.min.js">`|
|
|
10
|
+
|`.js` or `.ts` files|`import Q from 'https://unpkg.com/@qbix/q/dist/Q.min.js';`
|
|
11
11
|
|<img src="https://github.com/user-attachments/assets/ba3df93e-0cd8-4189-93fc-11947b63b684" alt="Description" width="100" height="87"> | Full documentation here: https://qbix.com/platform/guide/javascript |
|
|
12
12
|
|
|
13
13
|
This is part of the much larger full-stack [Qbix Platform](https://github.com/Qbix/Platform) that contains many pre-built reusable tools, plugins, and requires PHP and Node.js on the back-end. If you want to build an entire full-stack social network like Facebook you're well-advised to go with that. But if you just want to use the lightweight front-end core, with your own back-end and other frameworks, then start with this framework here.
|
|
@@ -646,17 +646,15 @@ In it, you will define the tools, methods, and other things. Here is an example:
|
|
|
646
646
|
| **Learning Curve** 📚 | **Simple (declarative, minimal magic)** | Medium-high (hooks, context, JSX) | Medium (directives, reactivity caveats) | High (decorators, DI, RxJS) | Medium |
|
|
647
647
|
| **Best For** ✅ | **High-performance apps, real-time dashboards, low-latency UI, social platforms** | Full-scale apps, large component hierarchies | Small-to-medium apps, good DX | Enterprise-scale apps | Small-to-medium apps, hobby projects |
|
|
648
648
|
|
|
649
|
-
```
|
|
650
|
-
|
|
651
649
|
|
|
652
650
|
# 📊 Metrics.js — Standalone Telemetry
|
|
653
651
|
|
|
654
652
|
This repo also includes **Metrics.js** — a standalone telemetry library that tracks scroll depth, section engagement, and video/audio playback across 9 embed providers. No dependencies, no build step, works on any website.
|
|
655
653
|
|
|
656
654
|
```html
|
|
657
|
-
<script src="https://unpkg.com/@qbix/q
|
|
655
|
+
<script src="https://unpkg.com/@qbix/q/dist/Metrics.js"></script>
|
|
658
656
|
<script>
|
|
659
|
-
Metrics.init({
|
|
657
|
+
Metrics.init(); // sends to invites.to by default — or pass {endpoint: '/your-own'}
|
|
660
658
|
Metrics.ScrollTracker.init({ sections: 'h2[id]' });
|
|
661
659
|
Metrics.MediaTracker.init(); // auto-discovers YouTube, Vimeo, SoundCloud, Wistia, JW Player, Dailymotion, Spotify, Twitch, Muse.ai
|
|
662
660
|
</script>
|
package/dist/Metrics.js
CHANGED
|
@@ -19,6 +19,12 @@ Metrics._visitorKey = 'metrics_vid';
|
|
|
19
19
|
Metrics._sid = null;
|
|
20
20
|
Metrics._vid = null;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Get or create a per-tab session ID (sessionStorage).
|
|
24
|
+
* A new ID is generated for each browser tab.
|
|
25
|
+
* @method getSessionId
|
|
26
|
+
* @return {String} The session ID
|
|
27
|
+
*/
|
|
22
28
|
Metrics.getSessionId = function () {
|
|
23
29
|
if (Metrics._sid) return Metrics._sid;
|
|
24
30
|
try {
|
|
@@ -38,20 +44,14 @@ Metrics.getSessionId = function () {
|
|
|
38
44
|
* Get or create a persistent visitor ID that survives across sessions.
|
|
39
45
|
* Tries localStorage first (persists until cleared).
|
|
40
46
|
* Falls back to sessionStorage (ITP-safe, but per-tab only).
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* When loaded cross-origin (e.g. from invites.to CDN onto
|
|
44
|
-
* summerfest.com), localStorage may be partitioned by Safari's
|
|
45
|
-
* ITP — meaning the same visitor gets different vids on different
|
|
46
|
-
* sites. This is fine: the inv_token from the redirect query
|
|
47
|
-
* string is what links visits across domains, not the vid.
|
|
47
|
+
* When loaded cross-origin (e.g. from a CDN), localStorage is still
|
|
48
|
+
* first-party to the page's domain — ITP won't block it.
|
|
48
49
|
* @method getVisitorId
|
|
49
|
-
* @return {String}
|
|
50
|
+
* @return {String} The visitor ID
|
|
50
51
|
*/
|
|
51
52
|
Metrics.getVisitorId = function () {
|
|
52
53
|
if (Metrics._vid) return Metrics._vid;
|
|
53
54
|
var vid = null;
|
|
54
|
-
// Try localStorage first (persistent)
|
|
55
55
|
try {
|
|
56
56
|
vid = localStorage.getItem(Metrics._visitorKey);
|
|
57
57
|
if (!vid) {
|
|
@@ -61,8 +61,7 @@ Metrics.getVisitorId = function () {
|
|
|
61
61
|
}
|
|
62
62
|
Metrics._vid = vid;
|
|
63
63
|
return vid;
|
|
64
|
-
} catch (e) {
|
|
65
|
-
// Fall back to sessionStorage
|
|
64
|
+
} catch (e) {}
|
|
66
65
|
try {
|
|
67
66
|
vid = sessionStorage.getItem(Metrics._visitorKey);
|
|
68
67
|
if (!vid) {
|
|
@@ -72,8 +71,7 @@ Metrics.getVisitorId = function () {
|
|
|
72
71
|
}
|
|
73
72
|
Metrics._vid = vid;
|
|
74
73
|
return vid;
|
|
75
|
-
} catch (e) {
|
|
76
|
-
// Last resort: in-memory only (won't survive page reload)
|
|
74
|
+
} catch (e) {}
|
|
77
75
|
vid = Math.random().toString(36).slice(2) + Date.now().toString(36)
|
|
78
76
|
+ Math.random().toString(36).slice(2);
|
|
79
77
|
Metrics._vid = vid;
|
|
@@ -82,6 +80,7 @@ Metrics.getVisitorId = function () {
|
|
|
82
80
|
|
|
83
81
|
// ── Transport (standalone — overridden by Q integration below) ──
|
|
84
82
|
|
|
83
|
+
Metrics._defaultEndpoint = 'https://invites.to/metrics';
|
|
85
84
|
Metrics._endpoint = null;
|
|
86
85
|
Metrics._page = null;
|
|
87
86
|
Metrics._extra = null;
|
|
@@ -101,6 +100,8 @@ Metrics.send = function (label, data) {
|
|
|
101
100
|
var payload = {
|
|
102
101
|
session: Metrics.getSessionId(),
|
|
103
102
|
visitor: Metrics.getVisitorId(),
|
|
103
|
+
origin: location.origin,
|
|
104
|
+
url: location.pathname + location.search + location.hash,
|
|
104
105
|
page: Metrics._page || document.title,
|
|
105
106
|
label: label,
|
|
106
107
|
t: Date.now()
|
|
@@ -252,7 +253,7 @@ function _sendUnload() {
|
|
|
252
253
|
*/
|
|
253
254
|
Metrics.init = function (options) {
|
|
254
255
|
options = options || {};
|
|
255
|
-
|
|
256
|
+
Metrics._endpoint = options.endpoint || Metrics._defaultEndpoint;
|
|
256
257
|
if (options.page) Metrics._page = options.page;
|
|
257
258
|
if (options.sessionKey) Metrics._sessionKey = options.sessionKey;
|
|
258
259
|
if (options.sessionId) Metrics._sid = options.sessionId;
|
|
@@ -263,7 +264,27 @@ Metrics.init = function (options) {
|
|
|
263
264
|
_bindUnload();
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
|
|
267
|
+
// Context snapshot — sent once with the "loaded" event
|
|
268
|
+
var ctx = {
|
|
269
|
+
referrer: document.referrer || '',
|
|
270
|
+
screen: screen.width + 'x' + screen.height,
|
|
271
|
+
viewport: window.innerWidth + 'x' + window.innerHeight,
|
|
272
|
+
dpr: window.devicePixelRatio || 1,
|
|
273
|
+
lang: navigator.language || '',
|
|
274
|
+
touch: ('ontouchstart' in window) || (navigator.maxTouchPoints > 0)
|
|
275
|
+
};
|
|
276
|
+
try { ctx.tz = Intl.DateTimeFormat().resolvedOptions().timeZone; } catch (e) {}
|
|
277
|
+
try {
|
|
278
|
+
if (navigator.connection && navigator.connection.effectiveType) {
|
|
279
|
+
ctx.conn = navigator.connection.effectiveType;
|
|
280
|
+
}
|
|
281
|
+
} catch (e) {}
|
|
282
|
+
try {
|
|
283
|
+
var nav = performance.getEntriesByType('navigation');
|
|
284
|
+
if (nav && nav[0]) ctx.navType = nav[0].type;
|
|
285
|
+
} catch (e) {}
|
|
286
|
+
|
|
287
|
+
Metrics.send('loaded', ctx);
|
|
267
288
|
return Metrics;
|
|
268
289
|
};
|
|
269
290
|
|
|
@@ -863,338 +884,6 @@ Metrics.ScrollTracker = {
|
|
|
863
884
|
|
|
864
885
|
})(typeof window !== 'undefined' ? window : this);
|
|
865
886
|
|
|
866
|
-
/**
|
|
867
|
-
* Metrics.ScrollTracker — Section-aware scroll telemetry
|
|
868
|
-
*
|
|
869
|
-
* Tracks which sections a user reads, how far they scroll,
|
|
870
|
-
* and what they click. Delegates transport, session, visibility,
|
|
871
|
-
* and unload handling to the core Metrics object.
|
|
872
|
-
*
|
|
873
|
-
* Usage (standalone):
|
|
874
|
-
* Metrics.init({ endpoint: '/telemetry.php', page: 'My Page' });
|
|
875
|
-
* Metrics.ScrollTracker.init({
|
|
876
|
-
* sections: 'h2[id], h3[id]',
|
|
877
|
-
* debounce: 1000
|
|
878
|
-
* });
|
|
879
|
-
*
|
|
880
|
-
* Usage (with Q framework):
|
|
881
|
-
* // Auto-initializes from config if endpoint is set
|
|
882
|
-
*
|
|
883
|
-
* @module Metrics
|
|
884
|
-
* @class Metrics.ScrollTracker
|
|
885
|
-
*/
|
|
886
|
-
"use strict";
|
|
887
|
-
(function (root) {
|
|
888
|
-
|
|
889
|
-
var Metrics = root.Metrics;
|
|
890
|
-
if (!Metrics) {
|
|
891
|
-
console.warn('Metrics.ScrollTracker: Metrics core not loaded');
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
var defaults = {
|
|
896
|
-
// CSS selector for sections to track
|
|
897
|
-
sections: 'h2[id], h3[id], section[id], [data-section]',
|
|
898
|
-
|
|
899
|
-
// Minimum pixel height for auto-detected containers
|
|
900
|
-
minSectionHeight: 100,
|
|
901
|
-
|
|
902
|
-
// Milliseconds to wait after scroll stops before firing
|
|
903
|
-
debounce: 1000,
|
|
904
|
-
|
|
905
|
-
// Milliseconds to wait on page load (ignores scroll restoration)
|
|
906
|
-
initDelay: 800,
|
|
907
|
-
|
|
908
|
-
// Milliseconds to suppress tracking after anchor click
|
|
909
|
-
anchorCooldown: 1500,
|
|
910
|
-
|
|
911
|
-
// Scroll depth milestones (percentage)
|
|
912
|
-
depthMilestones: [25, 50, 75, 100],
|
|
913
|
-
|
|
914
|
-
// Max px above viewport top to consider a section "current"
|
|
915
|
-
sectionLookback: 300,
|
|
916
|
-
|
|
917
|
-
// Scroll considered settled if moved less than this (px)
|
|
918
|
-
settleTolerance: 2,
|
|
919
|
-
|
|
920
|
-
// Recheck interval when not settled (ms)
|
|
921
|
-
recheckInterval: 500,
|
|
922
|
-
|
|
923
|
-
// Track link/anchor clicks
|
|
924
|
-
trackClicks: true,
|
|
925
|
-
|
|
926
|
-
// Visual TOC highlighting selector (real-time, not debounced)
|
|
927
|
-
tocSelector: null,
|
|
928
|
-
tocActiveClass: 'active',
|
|
929
|
-
tocSectionSelector: 'h2[id]'
|
|
930
|
-
};
|
|
931
|
-
|
|
932
|
-
// ── State ──
|
|
933
|
-
var state = {
|
|
934
|
-
initialized: false,
|
|
935
|
-
options: null,
|
|
936
|
-
sections: [],
|
|
937
|
-
tocSections: [],
|
|
938
|
-
seen: {},
|
|
939
|
-
depthHit: {},
|
|
940
|
-
scrollTimer: null,
|
|
941
|
-
anchorCooling: false,
|
|
942
|
-
_prevY: -1
|
|
943
|
-
};
|
|
944
|
-
|
|
945
|
-
// ── Section Discovery ──
|
|
946
|
-
|
|
947
|
-
function discoverSections(selector) {
|
|
948
|
-
var elements = document.querySelectorAll(selector);
|
|
949
|
-
var result = [];
|
|
950
|
-
var ordinal = 0;
|
|
951
|
-
var minH = (state.options && state.options.minSectionHeight) || 0;
|
|
952
|
-
|
|
953
|
-
for (var i = 0; i < elements.length; i++) {
|
|
954
|
-
var el = elements[i];
|
|
955
|
-
if (el.offsetHeight < minH) continue;
|
|
956
|
-
|
|
957
|
-
if (!el.id) {
|
|
958
|
-
var text = (el.textContent || '').trim().slice(0, 60);
|
|
959
|
-
var slug = text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
960
|
-
el.id = slug || ('section-' + ordinal);
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
result.push({
|
|
964
|
-
el: el,
|
|
965
|
-
id: el.id,
|
|
966
|
-
tag: el.tagName.toLowerCase(),
|
|
967
|
-
ordinal: ordinal++,
|
|
968
|
-
snippet: (el.textContent || '').trim().slice(0, 80)
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
return result;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
// ── Find Current Section ──
|
|
975
|
-
|
|
976
|
-
function findCurrentSection() {
|
|
977
|
-
var scrollY = window.scrollY || window.pageYOffset;
|
|
978
|
-
var opts = state.options;
|
|
979
|
-
var best = null;
|
|
980
|
-
var bestDist = Infinity;
|
|
981
|
-
|
|
982
|
-
for (var i = 0; i < state.sections.length; i++) {
|
|
983
|
-
var sec = state.sections[i];
|
|
984
|
-
var top = sec.el.offsetTop;
|
|
985
|
-
if (top <= scrollY + opts.sectionLookback) {
|
|
986
|
-
var dist = Math.abs(top - scrollY - 180);
|
|
987
|
-
if (dist < bestDist) {
|
|
988
|
-
bestDist = dist;
|
|
989
|
-
best = sec;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
return best;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
// ── Scroll Settle Detection ──
|
|
997
|
-
|
|
998
|
-
function onScrollSettle() {
|
|
999
|
-
var opts = state.options;
|
|
1000
|
-
var curY = window.scrollY || window.pageYOffset;
|
|
1001
|
-
|
|
1002
|
-
if (Math.abs(curY - state._prevY) > opts.settleTolerance) {
|
|
1003
|
-
state._prevY = curY;
|
|
1004
|
-
state.scrollTimer = setTimeout(onScrollSettle, opts.recheckInterval);
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
// Settled — report section
|
|
1009
|
-
var current = findCurrentSection();
|
|
1010
|
-
if (current && !state.seen[current.id]) {
|
|
1011
|
-
state.seen[current.id] = true;
|
|
1012
|
-
Metrics.send('section:' + current.id, {
|
|
1013
|
-
tag: current.tag,
|
|
1014
|
-
ordinal: current.ordinal,
|
|
1015
|
-
snippet: current.snippet
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// Report depth
|
|
1020
|
-
var docH = document.documentElement.scrollHeight - window.innerHeight;
|
|
1021
|
-
if (docH > 0) {
|
|
1022
|
-
var pct = Math.round((curY / docH) * 100);
|
|
1023
|
-
for (var j = 0; j < opts.depthMilestones.length; j++) {
|
|
1024
|
-
var m = opts.depthMilestones[j];
|
|
1025
|
-
if (pct >= m && !state.depthHit[m]) {
|
|
1026
|
-
state.depthHit[m] = true;
|
|
1027
|
-
Metrics.send('depth:' + m + '%');
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
function onScroll() {
|
|
1034
|
-
if (state.anchorCooling) return;
|
|
1035
|
-
clearTimeout(state.scrollTimer);
|
|
1036
|
-
state._prevY = window.scrollY || window.pageYOffset;
|
|
1037
|
-
state.scrollTimer = setTimeout(onScrollSettle, state.options.debounce);
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
// ── TOC Highlighting (real-time) ──
|
|
1041
|
-
|
|
1042
|
-
function updateTocHighlight() {
|
|
1043
|
-
var opts = state.options;
|
|
1044
|
-
if (!opts.tocSelector) return;
|
|
1045
|
-
|
|
1046
|
-
var scrollY = window.scrollY || window.pageYOffset;
|
|
1047
|
-
var currentId = '';
|
|
1048
|
-
|
|
1049
|
-
for (var i = 0; i < state.tocSections.length; i++) {
|
|
1050
|
-
if (scrollY >= state.tocSections[i].el.offsetTop - 160) {
|
|
1051
|
-
currentId = state.tocSections[i].id;
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
var links = document.querySelectorAll(opts.tocSelector);
|
|
1056
|
-
for (var j = 0; j < links.length; j++) {
|
|
1057
|
-
links[j].classList.remove(opts.tocActiveClass);
|
|
1058
|
-
if (links[j].getAttribute('href') === '#' + currentId) {
|
|
1059
|
-
links[j].classList.add(opts.tocActiveClass);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
// ── Click Tracking ──
|
|
1065
|
-
|
|
1066
|
-
function onDocumentClick(e) {
|
|
1067
|
-
var a = e.target.closest('a[href]');
|
|
1068
|
-
if (!a) return;
|
|
1069
|
-
|
|
1070
|
-
var href = a.getAttribute('href') || '';
|
|
1071
|
-
|
|
1072
|
-
if (href.charAt(0) === '#') {
|
|
1073
|
-
// Anchor click — cooldown to suppress scroll tracking
|
|
1074
|
-
state.anchorCooling = true;
|
|
1075
|
-
setTimeout(function () { state.anchorCooling = false; },
|
|
1076
|
-
state.options.anchorCooldown);
|
|
1077
|
-
Metrics.send('anchor:' + href.slice(1));
|
|
1078
|
-
return;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
// External link
|
|
1082
|
-
var label = a.dataset.track || 'link:' + href;
|
|
1083
|
-
Metrics.send(label);
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
// ── Pre-mark Initial State ──
|
|
1087
|
-
|
|
1088
|
-
function premarkInitialState() {
|
|
1089
|
-
var scrollY = window.scrollY || window.pageYOffset;
|
|
1090
|
-
|
|
1091
|
-
for (var i = 0; i < state.sections.length; i++) {
|
|
1092
|
-
var rect = state.sections[i].el.getBoundingClientRect();
|
|
1093
|
-
if (rect.top >= -100 && rect.top < window.innerHeight) {
|
|
1094
|
-
state.seen[state.sections[i].id] = true;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
var docH = document.documentElement.scrollHeight - window.innerHeight;
|
|
1099
|
-
if (docH > 0) {
|
|
1100
|
-
var pct = Math.round((scrollY / docH) * 100);
|
|
1101
|
-
for (var j = 0; j < state.options.depthMilestones.length; j++) {
|
|
1102
|
-
var m = state.options.depthMilestones[j];
|
|
1103
|
-
if (pct >= m) state.depthHit[m] = true;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
// ── Public API ──
|
|
1109
|
-
|
|
1110
|
-
Metrics.ScrollTracker = {
|
|
1111
|
-
|
|
1112
|
-
init: function (options) {
|
|
1113
|
-
if (state.initialized) {
|
|
1114
|
-
console.warn('Metrics.ScrollTracker already initialized');
|
|
1115
|
-
return this;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
var opts = {};
|
|
1119
|
-
var k;
|
|
1120
|
-
for (k in defaults) { if (defaults.hasOwnProperty(k)) opts[k] = defaults[k]; }
|
|
1121
|
-
for (k in (options || {})) { if (options.hasOwnProperty(k) && options[k] !== undefined) opts[k] = options[k]; }
|
|
1122
|
-
state.options = opts;
|
|
1123
|
-
state.initialized = true;
|
|
1124
|
-
|
|
1125
|
-
// If Metrics core hasn't been initialized yet with an endpoint,
|
|
1126
|
-
// initialize it now from our options
|
|
1127
|
-
if (!Metrics._endpoint && options && options.endpoint) {
|
|
1128
|
-
Metrics.init({
|
|
1129
|
-
endpoint: options.endpoint,
|
|
1130
|
-
page: options.page,
|
|
1131
|
-
sessionKey: options.sessionKey,
|
|
1132
|
-
sessionId: options.sessionId,
|
|
1133
|
-
extra: options.extra,
|
|
1134
|
-
trackUnload: options.trackUnload
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
// Delayed init — let scroll restoration settle
|
|
1139
|
-
setTimeout(function () {
|
|
1140
|
-
state.sections = discoverSections(opts.sections);
|
|
1141
|
-
|
|
1142
|
-
if (opts.tocSelector && opts.tocSectionSelector) {
|
|
1143
|
-
state.tocSections = discoverSections(opts.tocSectionSelector);
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
premarkInitialState();
|
|
1147
|
-
|
|
1148
|
-
window.addEventListener('scroll', onScroll, { passive: true });
|
|
1149
|
-
|
|
1150
|
-
if (opts.tocSelector) {
|
|
1151
|
-
window.addEventListener('scroll', updateTocHighlight, { passive: true });
|
|
1152
|
-
updateTocHighlight();
|
|
1153
|
-
}
|
|
1154
|
-
}, opts.initDelay);
|
|
1155
|
-
|
|
1156
|
-
if (opts.trackClicks) {
|
|
1157
|
-
document.addEventListener('click', onDocumentClick);
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
return this;
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
send: function (label, data) { Metrics.send(label, data); },
|
|
1164
|
-
markSeen: function (id) { state.seen[id] = true; },
|
|
1165
|
-
getSessionId: function () { return Metrics.getSessionId(); },
|
|
1166
|
-
getSections: function () {
|
|
1167
|
-
return state.sections.map(function (s) {
|
|
1168
|
-
return { id: s.id, tag: s.tag, ordinal: s.ordinal, snippet: s.snippet };
|
|
1169
|
-
});
|
|
1170
|
-
},
|
|
1171
|
-
getSeen: function () {
|
|
1172
|
-
var copy = {};
|
|
1173
|
-
for (var k in state.seen) copy[k] = true;
|
|
1174
|
-
return copy;
|
|
1175
|
-
},
|
|
1176
|
-
reset: function () {
|
|
1177
|
-
state.seen = {};
|
|
1178
|
-
state.depthHit = {};
|
|
1179
|
-
state.anchorCooling = false;
|
|
1180
|
-
clearTimeout(state.scrollTimer);
|
|
1181
|
-
state.sections = discoverSections(state.options.sections);
|
|
1182
|
-
premarkInitialState();
|
|
1183
|
-
},
|
|
1184
|
-
destroy: function () {
|
|
1185
|
-
window.removeEventListener('scroll', onScroll);
|
|
1186
|
-
window.removeEventListener('scroll', updateTocHighlight);
|
|
1187
|
-
document.removeEventListener('click', onDocumentClick);
|
|
1188
|
-
clearTimeout(state.scrollTimer);
|
|
1189
|
-
state.initialized = false;
|
|
1190
|
-
},
|
|
1191
|
-
|
|
1192
|
-
defaults: defaults,
|
|
1193
|
-
state: state
|
|
1194
|
-
};
|
|
1195
|
-
|
|
1196
|
-
})(typeof window !== 'undefined' ? window : this);
|
|
1197
|
-
|
|
1198
887
|
/**
|
|
1199
888
|
* Metrics.NavigationTracker — Track how users navigate and explore content
|
|
1200
889
|
*
|
package/dist/Metrics.min.js
CHANGED
|
@@ -1,95 +1,160 @@
|
|
|
1
|
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(
|
|
2
|
-
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var
|
|
3
|
-
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var
|
|
4
|
-
$jscomp.iteratorPrototype=function(
|
|
5
|
-
$jscomp.polyfill=function(
|
|
6
|
-
(function(
|
|
7
|
-
document.addEventListener(
|
|
8
|
-
Math.round((Date.now()-
|
|
9
|
-
|
|
10
|
-
Date.now().toString(36)+Math.random().toString(36).slice(2);return
|
|
11
|
-
headers:{"Content-Type":"text/plain"},keepalive:!0,body:
|
|
12
|
-
(b._sessionKey=
|
|
13
|
-
"undefined"!==typeof Q&&function(
|
|
14
|
-
keepalive:!0})},5E3)};
|
|
15
|
-
document.title,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"Metrics.NavigationTracker");
|
|
19
|
-
location.hash.queryField("v"))k(
|
|
20
|
-
userAgent:navigator.userAgent,timestamp:Date.now(),performanceNow:performance.now()};k&&(g.details=k);g=JSON.stringify({error:g});
|
|
21
|
-
!0)});window.addEventListener("error",function(
|
|
22
|
-
(function(
|
|
23
|
-
|
|
24
|
-
0;
|
|
25
|
-
for(
|
|
26
|
-
-100<=c.top&&c.top<window.innerHeight&&(
|
|
27
|
-
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
28
|
-
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){
|
|
29
|
-
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return
|
|
30
|
-
clearTimeout(
|
|
31
|
-
(function(
|
|
32
|
-
|
|
33
|
-
0;
|
|
34
|
-
for(
|
|
35
|
-
-100<=c.top&&c.top<window.innerHeight&&(
|
|
36
|
-
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
37
|
-
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){
|
|
38
|
-
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return
|
|
39
|
-
clearTimeout(
|
|
40
|
-
(function(
|
|
41
|
-
|
|
42
|
-
0;
|
|
43
|
-
for(
|
|
44
|
-
|
|
45
|
-
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?
|
|
46
|
-
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));
|
|
47
|
-
a.nodeType&&(a.matches&&a.matches(b)&&
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for(var
|
|
52
|
-
""})}},closed:function(a){
|
|
53
|
-
{},b;for(b in
|
|
54
|
-
window.removeEventListener("scroll",
|
|
55
|
-
|
|
56
|
-
(function(
|
|
57
|
-
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var
|
|
61
|
-
|
|
62
|
-
a);
|
|
63
|
-
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function
|
|
64
|
-
function(
|
|
65
|
-
a>
|
|
66
|
-
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function
|
|
67
|
-
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?
|
|
68
|
-
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var
|
|
69
|
-
/muse\.ai\/embed/.test(b)&&trackMuseAi(c
|
|
70
|
-
c.lastPosition),
|
|
71
|
-
this.ranges[
|
|
72
|
-
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!
|
|
1
|
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,c){d!=Array.prototype&&d!=Object.prototype&&(d[k]=c.value)};$jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
|
|
2
|
+
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var d=0;return function(k){return $jscomp.SYMBOL_PREFIX+(k||"")+d++}}();
|
|
3
|
+
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var d=$jscomp.global.Symbol.iterator;d||(d=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&$jscomp.defineProperty(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(d){var k=0;return $jscomp.iteratorPrototype(function(){return k<d.length?{done:!1,value:d[k++]}:{done:!0}})};
|
|
4
|
+
$jscomp.iteratorPrototype=function(d){$jscomp.initSymbolIterator();d={next:d};d[$jscomp.global.Symbol.iterator]=function(){return this};return d};$jscomp.iteratorFromArray=function(d,k){$jscomp.initSymbolIterator();d instanceof String&&(d+="");var c=0,b={next:function(){if(c<d.length){var a=c++;return{value:k(a,d[a]),done:!1}}b.next=function(){return{done:!0,value:void 0}};return b.next()}};b[Symbol.iterator]=function(){return b};return b};
|
|
5
|
+
$jscomp.polyfill=function(d,k,c,b){if(k){c=$jscomp.global;d=d.split(".");for(b=0;b<d.length-1;b++){var a=d[b];a in c||(c[a]={});c=c[a]}d=d[d.length-1];b=c[d];k=k(b);k!=b&&null!=k&&$jscomp.defineProperty(c,d,{configurable:!0,writable:!0,value:k})}};$jscomp.polyfill("Array.prototype.keys",function(d){return d?d:function(){return $jscomp.iteratorFromArray(this,function(d){return d})}},"es6","es3");
|
|
6
|
+
(function(d){function k(){function b(b){b=!("pause"===b.type||"resign"===b.type||("resume"===b.type||"active"===b.type?0:"hidden"===document.visibilityState));if(b!==a._visible){a._visible=b;for(var c=0;c<a._visibilityCallbacks.length;c++)try{a._visibilityCallbacks[c].fn(b)}catch(m){}}}if(!a._visibilityBound){a._visibilityBound=!0;for(var c=null,d=["","moz","ms","webkit","o"],k=0;k<d.length;k++){var h=d[k];if((h?h+"Hidden":"hidden")in document){c=h?h+"visibilitychange":"visibilitychange";break}}c&&
|
|
7
|
+
document.addEventListener(c,b,!1);document.addEventListener("pause",b,!1);document.addEventListener("resume",b,!1);document.addEventListener("resign",b,!1);document.addEventListener("active",b,!1)}}function c(){a._unloadBound||(a._unloadBound=!0,a.onVisibilityChange(function(c){c?a._unloaded=!1:b()},"Metrics.unload"),window.addEventListener("pagehide",function(){b()}),window.addEventListener("pageshow",function(b){b.persisted&&(a._unloaded=!1)}))}function b(){if(!a._unloaded){a._unloaded=!0;var b=
|
|
8
|
+
Math.round((Date.now()-a._startTime)/1E3);a.send("unload:"+b+"s")}}var a=d.Metrics||{};d.Metrics=a;a._sessionKey="metrics_sid";a._visitorKey="metrics_vid";a._sid=null;a._vid=null;a.getSessionId=function(){if(a._sid)return a._sid;try{var b=sessionStorage.getItem(a._sessionKey);b||(b=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2),sessionStorage.setItem(a._sessionKey,b));a._sid=b}catch(q){a._sid=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}return a._sid};
|
|
9
|
+
a.getVisitorId=function(){if(a._vid)return a._vid;var b=null;try{return b=localStorage.getItem(a._visitorKey),b||(b=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),localStorage.setItem(a._visitorKey,b)),a._vid=b}catch(q){}try{return b=sessionStorage.getItem(a._visitorKey),b||(b=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),sessionStorage.setItem(a._visitorKey,b)),a._vid=b}catch(q){}b=Math.random().toString(36).slice(2)+
|
|
10
|
+
Date.now().toString(36)+Math.random().toString(36).slice(2);return a._vid=b};a._endpoint=null;a._page=null;a._extra=null;a._unloaded=!1;a._startTime=Date.now();a.send=function(b,c){if(a._endpoint&&!a._unloaded){b={session:a.getSessionId(),visitor:a.getVisitorId(),origin:location.origin,page:a._page||document.title,label:b,t:Date.now()};a._extra&&(b.extra=a._extra);c&&(b.data=c);c=JSON.stringify(b);try{navigator.sendBeacon?navigator.sendBeacon(a._endpoint,new Blob([c],{type:"text/plain"})):fetch(a._endpoint,
|
|
11
|
+
{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:c})}catch(n){}}};a._visible=!0;a._visibilityCallbacks=[];a._visibilityBound=!1;a.isVisible=function(){return a._visible};a.onVisibilityChange=function(b,c){if(c)for(var g=0;g<a._visibilityCallbacks.length;g++)if(a._visibilityCallbacks[g].key===c){a._visibilityCallbacks[g].fn=b;return}a._visibilityCallbacks.push({fn:b,key:c||null})};a._unloadBound=!1;a._defaultEndpoint="https://invites.to/metrics";a.init=function(b){b=b||{};a._endpoint=
|
|
12
|
+
b.endpoint||a._defaultEndpoint;b.page&&(a._page=b.page);b.sessionKey&&(a._sessionKey=b.sessionKey);b.sessionId&&(a._sid=b.sessionId);b.extra&&(a._extra=b.extra);k();!1!==b.trackUnload&&c();a.send("loaded");return a}})("undefined"!==typeof window?window:this);
|
|
13
|
+
"undefined"!==typeof Q&&function(d){function k(b){var a=location.hash||"#";b=a.queryField("v",b);b!==a&&history.replaceState(history.state,document.title,b)}var c=d.Metrics=d.plugins.Metrics=window.Metrics;c.setState=function(b,a){var g=d.info.url;c.setState.pending[g]=d.setTimeout(function(){c.setState.pending[g]&&(clearTimeout(c.setState.pending[g]),delete c.setState.pending[g]);d.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:d.info.url,state:b,extra:JSON.stringify(a)},
|
|
14
|
+
keepalive:!0})},5E3)};c.setState.pending={};d.extend.dontCopy["Q.Users.User"]=!0;d.text.Metrics={};d.onReady.add(function(){d.onVisibilityChange&&d.onVisibilityChange.set&&d.onVisibilityChange.set(function(a){if(c._visible!==a){c._visible=a;for(var b=0;b<c._visibilityCallbacks.length;b++)try{c._visibilityCallbacks[b].fn(a)}catch(h){}}},"Metrics");var b=d.getObject("Metrics.navigationTracker",d.plugins)||d.getObject("Metrics.navigationTracker",d);b&&c.NavigationTracker&&(b.page=b.page||d.info.url||
|
|
15
|
+
document.title,c.NavigationTracker.init(b));(b=d.getObject("Metrics.mediaTracker",d.plugins)||d.getObject("Metrics.mediaTracker",d))&&c.MediaTracker&&c.MediaTracker.init(b);var a=c.NavigationTracker;if(a){var g=null;d.Tool.onActivate("Q/tabs").set(function(){this.state.onCurrent.set(function(b,c){clearTimeout(g);g=setTimeout(function(){c&&a.state.initialized&&a.opened("tab:"+c)},300)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");d.Tool.onActivate("Q/columns").set(function(){this.state.onActivate.set(function(b,
|
|
16
|
+
c,g){a.state.initialized&&(b=b&&b.getAttribute("data-name")||"column-"+g,a.opened("column:"+b))},"Metrics.NavigationTracker");this.state.onClose.set(function(b,c){a.state.initialized&&(b=c&&c.getAttribute("data-name")||"column-"+b,a.closed("column:"+b))},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");d.Tool.onActivate("Q/expandable").set(function(){var b=this.element.id||this.element.getAttribute("data-name")||this.id;this.state.onExpand.set(function(){a.state.initialized&&a.opened("expandable:"+
|
|
17
|
+
b)},"Metrics.NavigationTracker");this.state.onCollapse.set(function(){a.state.initialized&&a.closed("expandable:"+b)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");if(d.Contextual){d.Contextual.onShow.set(function(b){if(a.state.initialized){var c=$(b).data("Q/contextual trigger");c=c&&c.attr("data-name")||c&&c.attr("id")||"contextual-"+d.Contextual.current;a.opened("contextual:"+c);(b=b.querySelector?b.querySelector(".Q_listing_wrapper, .Q_listing"):null)&&a.observeNavContainer(b)}},
|
|
18
|
+
"Metrics.NavigationTracker");d.Contextual.onHide.set(function(b){a.state.initialized&&a.state.activeSection&&0===a.state.activeSection.indexOf("contextual:")&&a.closed(a.state.activeSection)},"Metrics.NavigationTracker");var q=d.Contextual.itemSelectHandler;q&&(d.Contextual.itemSelectHandler=function(b,g){if(a.state.initialized){var d=b.getAttribute("data-action")||b.getAttribute("data-name")||(b.textContent||"").trim().slice(0,40);c.send("contextual-item:"+d)}return q.apply(this,arguments)})}}if(b=
|
|
19
|
+
location.hash.queryField("v"))k(b),d.req("Metrics/landed",{method:"POST",fields:{trackerId:"visitId:"+b}},function(a,b){a?window.console&&console.error("Metrics landed request failed",a):b&&b.slots&&b.slots.visitId&&k(b.slots.visitId)})},"Metrics");(function(){function b(a,b){var c="",g="";if(a instanceof Error)c=a.message,g=a.stack;else if("string"===typeof a)c=a;else if(a&&"object"===typeof a)try{var k=JSON.stringify(a)}catch(h){k="[unserializable reason]"}g={message:c||"",stack:g||"",url:location.href,
|
|
20
|
+
userAgent:navigator.userAgent,timestamp:Date.now(),performanceNow:performance.now()};k&&(g.details=k);g=JSON.stringify({error:g});d.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:d.info&&d.info.url,state:"error",extra:g},keepalive:!0});console.warn(b?"Unhandled rejection:":"Unhandled error:",a);c&&/indexedDB/i.test(c)&&console.warn("[Recovery] Error suggests IndexedDB corruption. Triggering recovery...")}window.addEventListener("unhandledrejection",function(a){b(a.reason,
|
|
21
|
+
!0)});window.addEventListener("error",function(a){b(a.error||a.message,!1)})})()}(Q);"use strict";
|
|
22
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,g=h.options&&h.options.minSectionHeight||0,f=0;f<a.length;f++){var d=a[f];if(!(d.offsetHeight<g)){if(!d.id){var t=(d.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");d.id=t||"section-"+c}b.push({el:d,id:d.id,tag:d.tagName.toLowerCase(),ordinal:c++,snippet:(d.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
23
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var g=window.scrollY||window.pageYOffset;for(var d=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=g+d.sectionLookback&&(e=Math.abs(e-g-180),e<k&&(k=e,f=l))}(g=f)&&!h.seen[g.id]&&(h.seen[g.id]=!0,n.send("section:"+g.id,{tag:g.tag,ordinal:g.ordinal,snippet:g.snippet}));g=document.documentElement.scrollHeight-window.innerHeight;if(0<g)for(b=Math.round(b/g*100),g=
|
|
24
|
+
0;g<a.depthMilestones.length;g++)d=a.depthMilestones[g],b>=d&&!h.depthHit[d]&&(h.depthHit[d]=!0,n.send("depth:"+d+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",g=0;g<h.tocSections.length;g++)b>=h.tocSections[g].el.offsetTop-160&&(c=h.tocSections[g].id);b=document.querySelectorAll(a.tocSelector);
|
|
25
|
+
for(g=0;g<b.length;g++)b[g].classList.remove(a.tocActiveClass),b[g].getAttribute("href")==="#"+c&&b[g].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
26
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
27
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
28
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
29
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
30
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
31
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,g=h.options&&h.options.minSectionHeight||0,f=0;f<a.length;f++){var d=a[f];if(!(d.offsetHeight<g)){if(!d.id){var t=(d.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");d.id=t||"section-"+c}b.push({el:d,id:d.id,tag:d.tagName.toLowerCase(),ordinal:c++,snippet:(d.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
32
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var g=window.scrollY||window.pageYOffset;for(var d=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=g+d.sectionLookback&&(e=Math.abs(e-g-180),e<k&&(k=e,f=l))}(g=f)&&!h.seen[g.id]&&(h.seen[g.id]=!0,n.send("section:"+g.id,{tag:g.tag,ordinal:g.ordinal,snippet:g.snippet}));g=document.documentElement.scrollHeight-window.innerHeight;if(0<g)for(b=Math.round(b/g*100),g=
|
|
33
|
+
0;g<a.depthMilestones.length;g++)d=a.depthMilestones[g],b>=d&&!h.depthHit[d]&&(h.depthHit[d]=!0,n.send("depth:"+d+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",g=0;g<h.tocSections.length;g++)b>=h.tocSections[g].el.offsetTop-160&&(c=h.tocSections[g].id);b=document.querySelectorAll(a.tocSelector);
|
|
34
|
+
for(g=0;g<b.length;g++)b[g].classList.remove(a.tocActiveClass),b[g].getAttribute("href")==="#"+c&&b[g].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
35
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
36
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
37
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
38
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
39
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
40
|
+
(function(d){function k(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}function c(a){a=document.querySelectorAll(a);for(var b=[],e=0,c=f.options&&f.options.minSectionHeight||0,r=0;r<a.length;r++){var g=a[r];g.offsetHeight<c||(g.id||(g.id=k(g.textContent||"")||"section-"+e),b.push({el:g,id:g.id,tag:g.tagName.toLowerCase(),ordinal:e++,snippet:(g.textContent||"").trim().slice(0,80)}))}return b}function b(){var a=f.options,c=window.scrollY||window.pageYOffset;if(Math.abs(c-
|
|
41
|
+
f._prevY)>a.settleTolerance)f._prevY=c,f.scrollTimer=setTimeout(b,a.recheckInterval);else{var e=window.scrollY||window.pageYOffset;for(var p=f.options,r=null,g=Infinity,d=0;d<f.sections.length;d++){var h=f.sections[d],k=h.el.offsetTop;k<=e+p.sectionLookback&&(k=Math.abs(k-e-180),k<g&&(g=k,r=h))}(e=r)&&!f.seen[e.id]&&(f.seen[e.id]=!0,m.send("section:"+e.id,{tag:e.tag,ordinal:e.ordinal,snippet:e.snippet}));e=document.documentElement.scrollHeight-window.innerHeight;if(0<e)for(c=Math.round(c/e*100),e=
|
|
42
|
+
0;e<a.depthMilestones.length;e++)p=a.depthMilestones[e],c>=p&&!f.depthHit[p]&&(f.depthHit[p]=!0,m.send("depth:"+p+"%"))}}function a(){f.anchorCooling||(clearTimeout(f.scrollTimer),f._prevY=window.scrollY||window.pageYOffset,f.scrollTimer=setTimeout(b,f.options.debounce))}function g(){var a=f.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,e="",c=0;c<f.tocSections.length;c++)b>=f.tocSections[c].el.offsetTop-160&&(e=f.tocSections[c].id);b=document.querySelectorAll(a.tocSelector);
|
|
43
|
+
for(c=0;c<b.length;c++)b[c].classList.remove(a.tocActiveClass),b[c].getAttribute("href")==="#"+e&&b[c].classList.add(a.tocActiveClass)}}function q(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(f.anchorCooling=!0,setTimeout(function(){f.anchorCooling=!1},f.options.anchorCooldown),m.send("anchor:"+b.slice(1))):m.send(a.dataset.track||"link:"+b)}}function n(){if(f.activeSection&&f.options.trackDwell){var a=Math.round((Date.now()-f.activeSince)/1E3);if(0<a){var b=
|
|
44
|
+
f.dynamicSections[f.activeSection];m.send("dwell:"+f.activeSection,{seconds:a,name:b?b.name:f.activeSection})}f.activeSection=null;f.activeSince=null}}function u(a,b){var e=b.id||a.id||a.getAttribute("data-section")||a.getAttribute("data-track-section")||k(a.textContent||"")||"dyn-"+Object.keys(f.dynamicSections).length;a.id||(a.id=e);f.dynamicSections[e]={el:a,id:e,name:b.name||a.getAttribute("data-section-name")||a.getAttribute("title")||e,snippet:(a.textContent||"").trim().slice(0,80),observedAt:Date.now()};
|
|
45
|
+
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?v.opened(e):a.isIntersecting||f.activeSection!==e||v.closed(e)})},{threshold:[0,.3]}),b.observe(a),f.dynamicSections[e]._io=b);return e}function h(a){var b=a.querySelectorAll("a[href], li[data-action], li[data-name]");if(b.length){a=new IntersectionObserver(function(a){a.forEach(function(a){if(a.isIntersecting){a=a.target;var b="nav-link:"+(a.getAttribute("data-name")||
|
|
46
|
+
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));f._navLinksSeen[b]||(f._navLinksSeen[b]=!0,m.send(b,{text:a.textContent.trim().slice(0,60)}))}})},{root:a,threshold:.5});for(var e=0;e<b.length;e++)a.observe(b[e]);f._navObservers.push(a)}}function y(){if(window.MutationObserver&&f.options.observeDom){var a=f.options.observeRoot||document.body,b=f.options.observeSelector;f._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
47
|
+
a.nodeType&&(a.matches&&a.matches(b)&&u(a,{}),a.querySelectorAll)){a=a.querySelectorAll(b);for(var e=0;e<a.length;e++)u(a[e],{})}})})});f._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function w(){for(var a=window.scrollY||window.pageYOffset,b=0;b<f.sections.length;b++){var e=f.sections[b].el.getBoundingClientRect();-100<=e.top&&e.top<window.innerHeight&&(f.seen[f.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<f.options.depthMilestones.length;b++)e=
|
|
48
|
+
f.options.depthMilestones[b],a>=e&&(f.depthHit[e]=!0)}var m=d.Metrics;if(m){var x={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,observeDom:!1,observeRoot:null,observeSelector:"[data-section], [data-track-section]",trackDwell:!0,navContainers:null,trackContextuals:!0,trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
49
|
+
f={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1,dynamicSections:{},activeSection:null,activeSince:null,_mutationObserver:null,_navObservers:[],_navLinksSeen:{}},v={init:function(b){if(f.initialized)return console.warn("Metrics.NavigationTracker already initialized"),this;var d={},e;for(e in x)x.hasOwnProperty(e)&&(d[e]=x[e]);for(e in b||{})b.hasOwnProperty(e)&&void 0!==b[e]&&(d[e]=b[e]);f.options=d;f.initialized=!0;!m._endpoint&&
|
|
50
|
+
b&&b.endpoint&&m.init({endpoint:b.endpoint,page:b.page,sessionKey:b.sessionKey,sessionId:b.sessionId,extra:b.extra,trackUnload:b.trackUnload});setTimeout(function(){f.sections=c(d.sections);d.tocSelector&&d.tocSectionSelector&&(f.tocSections=c(d.tocSectionSelector));w();window.addEventListener("scroll",a,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",g,{passive:!0}),g());d.observeDom&&y();if(d.navContainers){var b=f.options.navContainers;if(b&&window.IntersectionObserver){b=document.querySelectorAll(b);
|
|
51
|
+
for(var e=0;e<b.length;e++)h(b[e])}}},d.initDelay);d.trackClicks&&document.addEventListener("click",q);if(d.trackDwell)m.onVisibilityChange(function(a){a||n()},"NavigationTracker.dwell");return this},observe:function(a,b){return u(a,b||{})},opened:function(a){if(f.activeSection!==a)if(n(),f.activeSection=a,f.activeSince=Date.now(),f.seen[a])m.send("switched:"+a,{name:(f.dynamicSections[a]||{}).name||a});else{f.seen[a]=!0;var b=f.dynamicSections[a];m.send("opened:"+a,{name:b?b.name:a,snippet:b?b.snippet:
|
|
52
|
+
""})}},closed:function(a){f.activeSection===a&&n()},observeNavContainer:function(a){h(a)},send:function(a,b){m.send(a,b)},markSeen:function(a){f.seen[a]=!0},getSessionId:function(){return m.getSessionId()},getSections:function(){return f.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getDynamicSections:function(){var a={},b;for(b in f.dynamicSections){var e=f.dynamicSections[b];a[b]={id:e.id,name:e.name,snippet:e.snippet}}return a},getSeen:function(){var a=
|
|
53
|
+
{},b;for(b in f.seen)a[b]=!0;return a},getActive:function(){return f.activeSection?{id:f.activeSection,since:f.activeSince,elapsed:Math.round((Date.now()-f.activeSince)/1E3)}:null},reset:function(){n();f.seen={};f.depthHit={};f.anchorCooling=!1;f._navLinksSeen={};clearTimeout(f.scrollTimer);for(var a in f.dynamicSections)f.dynamicSections[a]._io&&f.dynamicSections[a]._io.disconnect();f.dynamicSections={};f.activeSection=null;f.activeSince=null;f.sections=c(f.options.sections);w()},destroy:function(){n();
|
|
54
|
+
window.removeEventListener("scroll",a);window.removeEventListener("scroll",g);document.removeEventListener("click",q);clearTimeout(f.scrollTimer);f._mutationObserver&&(f._mutationObserver.disconnect(),f._mutationObserver=null);for(var b in f.dynamicSections)f.dynamicSections[b]._io&&f.dynamicSections[b]._io.disconnect();for(b=0;b<f._navObservers.length;b++)f._navObservers[b].disconnect();f._navObservers=[];f.initialized=!1},defaults:x,state:f};m.NavigationTracker=v;m.SectionTracker=v;m.ScrollTracker=
|
|
55
|
+
v}else console.warn("Metrics.NavigationTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
56
|
+
(function(d){function k(a){if(a.id)return a.id;if(a=a.src||a.currentSrc||""){var b=a.match(/(?:youtu\.be\/|youtube\.com\/embed\/|vimeo\.com\/video\/|vimeo\.com\/)([^?&#]+)/);if(b)return b[1];if((a=a.split("/").pop().split("?")[0])&&60>a.length)return a}return"media-"+l._counter++}function c(){this.ranges=[]}function b(a,b,r,g){return{id:a,type:b,el:r,duration:g||0,playing:!1,lastPosition:0,lastCheckpointAt:0,watched:new c,checkpointTimer:null,_lastTimeUpdate:0}}function a(a,b,c){var e={type:a.type,
|
|
57
|
+
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var p in c)e[p]=c[p];v.send(b+":"+a.id,e)}function g(b){q(b);b.checkpointTimer=setInterval(function(){b.playing&&a(b,"media-checkpoint")},1E3*l.options.checkpointInterval)}function q(a){a.checkpointTimer&&(clearInterval(a.checkpointTimer),a.checkpointTimer=null)}function n(e){var c=k(e);if(!l.tracked[c]){var r=b(c,"native",e,e.duration||0);l.tracked[c]=r;e.addEventListener("loadedmetadata",function(){r.duration=
|
|
58
|
+
e.duration||0});e.addEventListener("play",function(){r.playing=!0;r.lastPosition=e.currentTime;r._lastTimeUpdate=e.currentTime;a(r,"media-play");g(r)});e.addEventListener("pause",function(){r.playing&&(r.playing=!1,r.watched.add(r._lastTimeUpdate,e.currentTime),r.lastPosition=e.currentTime,q(r),a(r,"media-pause"))});e.addEventListener("ended",function(){r.playing=!1;r.watched.add(r._lastTimeUpdate,e.currentTime);r.lastPosition=e.currentTime;q(r);a(r,"media-ended")});e.addEventListener("seeked",function(){var b=
|
|
59
|
+
r.lastPosition;r.lastPosition=e.currentTime;r._lastTimeUpdate=e.currentTime;a(r,"media-seeked",{from:Math.round(b),to:Math.round(e.currentTime)})});e.addEventListener("timeupdate",function(){r.playing&&e.currentTime>r._lastTimeUpdate&&r.watched.add(r._lastTimeUpdate,e.currentTime);r._lastTimeUpdate=e.currentTime;r.lastPosition=e.currentTime})}}function u(a){if(l._ytApiLoaded)a();else if(l._ytApiLoading)l._ytPendingPlayers.push(a);else{l._ytApiLoading=!0;var b=d.onYouTubeIframeAPIReady;d.onYouTubeIframeAPIReady=
|
|
60
|
+
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var e=0;e<l._ytPendingPlayers.length;e++)l._ytPendingPlayers[e]();l._ytPendingPlayers=[]};var e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";document.head.appendChild(e)}}function h(e){var c=e.src||"",r=k(e);if(!l.tracked[r]){if(-1===c.indexOf("enablejsapi"))if(l.options.reloadIframes){var d=-1===c.indexOf("?")?"?":"&";e.src=c+d+"enablejsapi=1&origin="+encodeURIComponent(location.origin)}else{console.warn("Metrics.MediaTracker: YouTube iframe missing enablejsapi=1, set reloadIframes:true to auto-fix. iframe:",
|
|
61
|
+
e);return}e.id||(e.id="yt-"+r);u(function(){if(!l.tracked[r]){var c=b(r,"youtube",e,0);l.tracked[r]=c;var p=new YT.Player(e.id,{events:{onReady:function(a){c.duration=p.getDuration()||0},onStateChange:function(b){var e=p.getCurrentTime()||0;c.lastPosition=e;switch(b.data){case YT.PlayerState.PLAYING:c.playing=!0;c._lastTimeUpdate=e;c.duration=p.getDuration()||c.duration;a(c,"media-play");g(c);c._pollTimer=setInterval(function(){var a=p.getCurrentTime()||0;c.playing&&a>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,
|
|
62
|
+
a);c._lastTimeUpdate=a;c.lastPosition=a},1E3);break;case YT.PlayerState.PAUSED:if(!c.playing)break;c.playing=!1;c.watched.add(c._lastTimeUpdate,e);q(c);clearInterval(c._pollTimer);a(c,"media-pause");break;case YT.PlayerState.ENDED:c.playing=!1,c.watched.add(c._lastTimeUpdate,e),q(c),clearInterval(c._pollTimer),a(c,"media-ended")}}}});c._player=p}})}}function y(a){if(l._vimeoApiLoaded)a();else if(l._vimeoApiLoading)setTimeout(function(){y(a)},200);else{l._vimeoApiLoading=!0;var b=document.createElement("script");
|
|
63
|
+
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function w(e){var c=k(e);l.tracked[c]||y(function(){if(!l.tracked[c]){var p=b(c,"vimeo",e,0);l.tracked[c]=p;var d=new Vimeo.Player(e);p._player=d;d.getDuration().then(function(a){p.duration=a||0});d.on("play",function(b){p.playing=!0;p.lastPosition=b.seconds||0;p._lastTimeUpdate=p.lastPosition;p.duration=b.duration||p.duration;a(p,"media-play");g(p)});d.on("pause",
|
|
64
|
+
function(b){p.playing&&(p.playing=!1,b=b.seconds||0,p.watched.add(p._lastTimeUpdate,b),p.lastPosition=b,q(p),a(p,"media-pause"))});d.on("ended",function(b){p.playing=!1;b=b.seconds||p.duration;p.watched.add(p._lastTimeUpdate,b);p.lastPosition=b;q(p);a(p,"media-ended")});d.on("seeked",function(b){var e=p.lastPosition;p.lastPosition=b.seconds||0;p._lastTimeUpdate=p.lastPosition;a(p,"media-seeked",{from:Math.round(e),to:Math.round(p.lastPosition)})});d.on("timeupdate",function(a){a=a.seconds||0;p.playing&&
|
|
65
|
+
a>p._lastTimeUpdate&&p.watched.add(p._lastTimeUpdate,a);p._lastTimeUpdate=a;p.lastPosition=a})}})}function m(){for(var a=document.querySelectorAll(l.options.mediaSelector),b=0;b<a.length;b++)n(a[b]);a=document.querySelectorAll("iframe[src]");for(b=0;b<a.length;b++){var c=a[b].src||"";/youtube\.com\/embed|youtube-nocookie\.com\/embed/.test(c)?h(a[b]):/player\.vimeo\.com/.test(c)?w(a[b]):/w\.soundcloud\.com\/player/.test(c)?trackSoundCloud(a[b]):/dailymotion\.com\/embed/.test(c)?trackDailymotion(a[b]):
|
|
66
|
+
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function x(){if(window.MutationObserver&&l.options.observeDom){var a=l.options.observeRoot||document.body;l._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
67
|
+
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?h(a):/player\.vimeo\.com/.test(b)?w(a):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(a):/dailymotion\.com\/embed/.test(b)?trackDailymotion(a):/open\.spotify\.com\/embed/.test(b)?trackSpotify(a):/player\.twitch\.tv/.test(b)?trackTwitch(a):/muse\.ai\/embed/.test(b)&&trackMuseAi(a)}a.className&&/wistia_embed|wistia_async_/.test(a.className)&&trackWistia(a);a.className&&
|
|
68
|
+
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var e=0;e<b.length;e++)n(b[e]);e=a.querySelectorAll("iframe[src]");for(var c=0;c<e.length;c++)b=e[c].src||"",/youtube\.com\/embed/.test(b)?h(e[c]):/player\.vimeo\.com/.test(b)?w(e[c]):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(e[c]):/dailymotion\.com\/embed/.test(b)?trackDailymotion(e[c]):/open\.spotify\.com\/embed/.test(b)?trackSpotify(e[c]):/player\.twitch\.tv/.test(b)?trackTwitch(e[c]):
|
|
69
|
+
/muse\.ai\/embed/.test(b)&&trackMuseAi(e[c]);b=a.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(e=0;e<b.length;e++)trackWistia(b[e]);a=a.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}}})})});l._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function f(){for(var b in l.tracked){var c=l.tracked[b];c.playing&&("native"===c.type&&c.el&&(c.watched.add(c._lastTimeUpdate,c.el.currentTime||c.lastPosition),c.lastPosition=c.el.currentTime||
|
|
70
|
+
c.lastPosition),a(c,"media-checkpoint"))}}var v=d.Metrics;if(v){var t={checkpointInterval:10,autoDiscover:!0,mediaSelector:"video, audio",reloadIframes:!1,observeDom:!0,observeRoot:null,checkpointDebounce:1E3},l={initialized:!1,options:null,tracked:{},_counter:0,_mutationObserver:null,_ytApiLoaded:!1,_ytApiLoading:!1,_ytPendingPlayers:[],_vimeoApiLoaded:!1,_vimeoApiLoading:!1};c.prototype.add=function(a,b){if(!(b<=a)){a={start:Math.floor(a),end:Math.ceil(b)};b=[];for(var e=!1,c=0;c<this.ranges.length;c++){var g=
|
|
71
|
+
this.ranges[c];g.end<a.start?b.push(g):g.start>a.end?(e||(b.push(a),e=!0),b.push(g)):(a.start=Math.min(a.start,g.start),a.end=Math.max(a.end,g.end))}e||b.push(a);this.ranges=b}};c.prototype.total=function(){for(var a=0,b=0;b<this.ranges.length;b++)a+=this.ranges[b].end-this.ranges[b].start;return a};v.MediaTracker={init:function(a){if(l.initialized)return console.warn("Metrics.MediaTracker already initialized"),this;var b={},c;for(c in t)t.hasOwnProperty(c)&&(b[c]=t[c]);for(c in a||{})a.hasOwnProperty(c)&&
|
|
72
|
+
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!v._endpoint&&a&&a.endpoint&&v.init({endpoint:a.endpoint,page:a.page,trackUnload:a.trackUnload});b.autoDiscover&&setTimeout(function(){m()},500);b.observeDom&&x();v.onVisibilityChange(function(a){a||f()},"MediaTracker.flush");return this},trackNative:function(a,b){b&&(a.id=b);n(a)},trackYouTube:function(a,b){b&&(a.id=b);h(a)},trackVimeo:function(a,b){b&&(a.id=b);w(a)},trackSoundCloud:function(a,b){b&&(a.id=b);trackSoundCloud(a)},trackWistia:function(a,
|
|
73
73
|
b){b&&(a.id=b);trackWistia(a)},trackJWPlayer:function(a,b){b&&(a.id=b);trackJWPlayer(a)},trackDailymotion:function(a,b){b&&(a.id=b);trackDailymotion(a)},trackSpotify:function(a,b){b&&(a.id=b);trackSpotify(a)},trackTwitch:function(a,b){b&&(a.id=b);trackTwitch(a)},trackMuseAi:function(a,b){b&&(a.id=b);trackMuseAi(a)},getTracked:function(){var a={},b;for(b in l.tracked){var c=l.tracked[b];a[b]={id:c.id,type:c.type,playing:c.playing,position:Math.round(c.lastPosition),duration:Math.round(c.duration),
|
|
74
|
-
watched:c.watched.total()}}return a},flush:
|
|
75
|
-
function loadSoundCloudAPI(
|
|
76
|
-
function trackSoundCloud(
|
|
77
|
-
(
|
|
78
|
-
to:Math.round(
|
|
79
|
-
function trackWistia(
|
|
80
|
-
function(){if(
|
|
81
|
-
|
|
82
|
-
function trackJWPlayer(
|
|
83
|
-
g.watched.add(g._lastTimeUpdate,
|
|
84
|
-
b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var
|
|
85
|
-
function trackDailymotion(
|
|
86
|
-
!1;
|
|
87
|
-
|
|
88
|
-
function trackSpotify(
|
|
89
|
-
|
|
90
|
-
function trackTwitch(
|
|
91
|
-
c);
|
|
92
|
-
var
|
|
93
|
-
function trackMuseAi(
|
|
94
|
-
0,
|
|
95
|
-
"*")}catch(
|
|
74
|
+
watched:c.watched.total()}}return a},flush:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];q(b);b._pollTimer&&clearInterval(b._pollTimer)}l.tracked={};l._mutationObserver&&(l._mutationObserver.disconnect(),l._mutationObserver=null);l.initialized=!1},defaults:t,state:l}}else console.warn("Metrics.MediaTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);
|
|
75
|
+
function loadSoundCloudAPI(d){if(root.SC&&root.SC.Widget)d();else{var k=document.createElement("script");k.src="https://w.soundcloud.com/player/api.js";k.onload=d;document.head.appendChild(k)}}
|
|
76
|
+
function trackSoundCloud(d){var k=genId(d);state.tracked[k]||loadSoundCloudAPI(function(){if(!state.tracked[k]){var c=SC.Widget(d),b=createTracker(k,"soundcloud",d,0);state.tracked[k]=b;c.bind(SC.Widget.Events.READY,function(){c.getDuration(function(a){b.duration=(a||0)/1E3})});c.bind(SC.Widget.Events.PLAY,function(){b.playing=!0;c.getPosition(function(a){b.lastPosition=(a||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-play");startCheckpoints(b)})});c.bind(SC.Widget.Events.PAUSE,function(){b.playing&&
|
|
77
|
+
(b.playing=!1,c.getPosition(function(a){a=(a||0)/1E3;b.watched.add(b._lastTimeUpdate,a);b.lastPosition=a;stopCheckpoints(b);sendEvent(b,"media-pause")}))});c.bind(SC.Widget.Events.FINISH,function(){b.playing=!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")});c.bind(SC.Widget.Events.SEEK,function(a){var c=b.lastPosition;b.lastPosition=(a.currentPosition||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),
|
|
78
|
+
to:Math.round(b.lastPosition)})});c.bind(SC.Widget.Events.PLAY_PROGRESS,function(a){a=(a.currentPosition||0)/1E3;b.playing&&a>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,a);b._lastTimeUpdate=a;b.lastPosition=a})}})}
|
|
79
|
+
function trackWistia(d){var k=genId(d);if(!state.tracked[k]){var c=d.getAttribute("data-wistia-id")||(d.className.match(/wistia_async_(\w+)/)||[])[1]||k;root._wq=root._wq||[];root._wq.push({id:c,onReady:function(b){if(!state.tracked[k]){var a=createTracker(k,"wistia",d,b.duration()||0);state.tracked[k]=a;a._player=b;b.bind("play",function(){a.playing=!0;a.lastPosition=b.time();a._lastTimeUpdate=a.lastPosition;a.duration=b.duration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a)});b.bind("pause",
|
|
80
|
+
function(){if(a.playing){a.playing=!1;var c=b.time();a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);sendEvent(a,"media-pause")}});b.bind("end",function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")});b.bind("seek",function(b,c){a.lastPosition=b;a._lastTimeUpdate=b;sendEvent(a,"media-seeked",{from:Math.round(c),to:Math.round(b)})});b.bind("secondchange",function(b){a.playing&&b>a._lastTimeUpdate&&
|
|
81
|
+
a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b})}}});root.Wistia||(c=document.createElement("script"),c.src="https://fast.wistia.com/assets/external/E-v1.js",c.async=!0,document.head.appendChild(c))}}
|
|
82
|
+
function trackJWPlayer(d){function k(){if(!root.jwplayer||"function"!==typeof root.jwplayer)return!1;try{var a=jwplayer(b)}catch(q){return!1}if(!a||!a.getState)return!1;var g=createTracker(c,"jwplayer",d,a.getDuration()||0);state.tracked[c]=g;g._player=a;a.on("play",function(){g.playing=!0;g.lastPosition=a.getPosition();g._lastTimeUpdate=g.lastPosition;g.duration=a.getDuration()||g.duration;sendEvent(g,"media-play");startCheckpoints(g)});a.on("pause",function(){if(g.playing){g.playing=!1;var b=a.getPosition();
|
|
83
|
+
g.watched.add(g._lastTimeUpdate,b);g.lastPosition=b;stopCheckpoints(g);sendEvent(g,"media-pause")}});a.on("complete",function(){g.playing=!1;g.watched.add(g._lastTimeUpdate,g.duration);g.lastPosition=g.duration;stopCheckpoints(g);sendEvent(g,"media-ended")});a.on("seek",function(a){g.lastPosition=a.offset;g._lastTimeUpdate=a.offset;sendEvent(g,"media-seeked",{from:Math.round(a.position),to:Math.round(a.offset)})});a.on("time",function(a){var b=a.position;g.playing&&b>g._lastTimeUpdate&&g.watched.add(g._lastTimeUpdate,
|
|
84
|
+
b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var c=genId(d);if(!state.tracked[c]){var b=d.id||c;k()||setTimeout(function(){k()},2E3)}}
|
|
85
|
+
function trackDailymotion(d){function k(){if(!state.tracked[c]){var b=createTracker(c,"dailymotion",d,0);state.tracked[c]=b;var a=DM.player(d,{events:{playing:function(){b.playing=!0;b.lastPosition=a.currentTime||0;b._lastTimeUpdate=b.lastPosition;b.duration=a.duration||b.duration;sendEvent(b,"media-play");startCheckpoints(b)},pause:function(){if(b.playing){b.playing=!1;var c=a.currentTime||0;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);sendEvent(b,"media-pause")}},end:function(){b.playing=
|
|
86
|
+
!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")},seeking:function(){var c=b.lastPosition;b.lastPosition=a.currentTime||0;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),to:Math.round(b.lastPosition)})},timeupdate:function(){var c=a.currentTime||0;b.playing&&c>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,c);b._lastTimeUpdate=c;b.lastPosition=c;b.duration=a.duration||b.duration}}});b._player=
|
|
87
|
+
a}}var c=genId(d);state.tracked[c]||function(){if(root.DM&&root.DM.player)k();else{var b=document.createElement("script");b.src="https://api.dmcdn.net/all.js";b.onload=function(){k()};document.head.appendChild(b)}}()}
|
|
88
|
+
function trackSpotify(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"spotify",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){try{var a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(q){return}if(a.type&&"playback_update"===a.type){b=a.payload&&a.payload.position||0;b/=1E3;var g=a.payload&&a.payload.isPaused;c.duration=(a.payload&&a.payload.duration||0)/1E3||c.duration;g||c.playing?g&&c.playing?(c.playing=!1,c.watched.add(c._lastTimeUpdate,
|
|
89
|
+
b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):!g&&c.playing&&b>c._lastTimeUpdate&&(c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b):(c.playing=!0,c.lastPosition=b,c._lastTimeUpdate=b,sendEvent(c,"media-play"),startCheckpoints(c))}}})}}
|
|
90
|
+
function trackTwitch(d){function k(){if(!state.tracked[c]){d.id||(d.id="twitch-"+c);var b=createTracker(c,"twitch",d,0);state.tracked[c]=b;var a=new Twitch.Player(d.id,{});b._player=a;a.addEventListener(Twitch.Player.PLAY,function(){b.playing=!0;b.lastPosition=a.getCurrentTime()||0;b._lastTimeUpdate=b.lastPosition;b.duration=a.getDuration()||b.duration;sendEvent(b,"media-play");startCheckpoints(b);b._pollTimer=setInterval(function(){var c=a.getCurrentTime()||0;b.playing&&c>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,
|
|
91
|
+
c);b._lastTimeUpdate=c;b.lastPosition=c},1E3)});a.addEventListener(Twitch.Player.PAUSE,function(){if(b.playing){b.playing=!1;var c=a.getCurrentTime()||0;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);clearInterval(b._pollTimer);sendEvent(b,"media-pause")}});a.addEventListener(Twitch.Player.ENDED,function(){b.playing=!1;var c=a.getCurrentTime()||b.duration;b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);clearInterval(b._pollTimer);sendEvent(b,"media-ended")})}}
|
|
92
|
+
var c=genId(d);state.tracked[c]||function(){if(root.Twitch&&root.Twitch.Player)k();else{var b=document.createElement("script");b.src="https://player.twitch.tv/js/embed/v1.js";b.onload=function(){k()};document.head.appendChild(b)}}()}
|
|
93
|
+
function trackMuseAi(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"museai",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){try{var a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(g){return}"play"===a.event?(c.playing=!0,c.lastPosition=a.currentTime||0,c._lastTimeUpdate=c.lastPosition,c.duration=a.duration||c.duration,sendEvent(c,"media-play"),startCheckpoints(c)):"pause"===a.event?c.playing&&(c.playing=!1,b=a.currentTime||
|
|
94
|
+
0,c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):"ended"===a.event?(c.playing=!1,c.watched.add(c._lastTimeUpdate,c.duration),c.lastPosition=c.duration,stopCheckpoints(c),sendEvent(c,"media-ended")):"timeupdate"===a.event&&(b=a.currentTime||0,c.duration=a.duration||c.duration,c.playing&&b>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b)}});try{d.contentWindow.postMessage({method:"addEventListener",value:"play"},
|
|
95
|
+
"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"pause"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"ended"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"timeupdate"},"*")}catch(b){}}}"use strict";
|
|
96
|
+
(function(d){function k(a){a=document.querySelectorAll(a);for(var b=[],c=0,d=h.options&&h.options.minSectionHeight||0,g=0;g<a.length;g++){var k=a[g];if(!(k.offsetHeight<d)){if(!k.id){var t=(k.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");k.id=t||"section-"+c}b.push({el:k,id:k.id,tag:k.tagName.toLowerCase(),ordinal:c++,snippet:(k.textContent||"").trim().slice(0,80)})}}return b}function c(){var a=h.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
97
|
+
h._prevY)>a.settleTolerance)h._prevY=b,h.scrollTimer=setTimeout(c,a.recheckInterval);else{var d=window.scrollY||window.pageYOffset;for(var g=h.options,f=null,k=Infinity,t=0;t<h.sections.length;t++){var l=h.sections[t],e=l.el.offsetTop;e<=d+g.sectionLookback&&(e=Math.abs(e-d-180),e<k&&(k=e,f=l))}(d=f)&&!h.seen[d.id]&&(h.seen[d.id]=!0,n.send("section:"+d.id,{tag:d.tag,ordinal:d.ordinal,snippet:d.snippet}));d=document.documentElement.scrollHeight-window.innerHeight;if(0<d)for(b=Math.round(b/d*100),d=
|
|
98
|
+
0;d<a.depthMilestones.length;d++)g=a.depthMilestones[d],b>=g&&!h.depthHit[g]&&(h.depthHit[g]=!0,n.send("depth:"+g+"%"))}}function b(){h.anchorCooling||(clearTimeout(h.scrollTimer),h._prevY=window.scrollY||window.pageYOffset,h.scrollTimer=setTimeout(c,h.options.debounce))}function a(){var a=h.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",d=0;d<h.tocSections.length;d++)b>=h.tocSections[d].el.offsetTop-160&&(c=h.tocSections[d].id);b=document.querySelectorAll(a.tocSelector);
|
|
99
|
+
for(d=0;d<b.length;d++)b[d].classList.remove(a.tocActiveClass),b[d].getAttribute("href")==="#"+c&&b[d].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(h.anchorCooling=!0,setTimeout(function(){h.anchorCooling=!1},h.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function q(){for(var a=window.scrollY||window.pageYOffset,b=0;b<h.sections.length;b++){var c=h.sections[b].el.getBoundingClientRect();
|
|
100
|
+
-100<=c.top&&c.top<window.innerHeight&&(h.seen[h.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<h.options.depthMilestones.length;b++)c=h.options.depthMilestones[b],a>=c&&(h.depthHit[c]=!0)}var n=d.Metrics;if(n){var u={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,
|
|
101
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},h={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(h.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in u)u.hasOwnProperty(m)&&(d[m]=u[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);h.options=d;h.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
102
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){h.sections=k(d.sections);d.tocSelector&&d.tocSectionSelector&&(h.tocSections=k(d.tocSectionSelector));q();window.addEventListener("scroll",b,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",a,{passive:!0}),a())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){h.seen[a]=
|
|
103
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return h.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getSeen:function(){var a={},b;for(b in h.seen)a[b]=!0;return a},reset:function(){h.seen={};h.depthHit={};h.anchorCooling=!1;clearTimeout(h.scrollTimer);h.sections=k(h.options.sections);q()},destroy:function(){window.removeEventListener("scroll",b);window.removeEventListener("scroll",a);document.removeEventListener("click",g);
|
|
104
|
+
clearTimeout(h.scrollTimer);h.initialized=!1},defaults:u,state:h}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
105
|
+
(function(d){function k(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}function c(a){a=document.querySelectorAll(a);for(var b=[],c=0,d=f.options&&f.options.minSectionHeight||0,g=0;g<a.length;g++){var h=a[g];h.offsetHeight<d||(h.id||(h.id=k(h.textContent||"")||"section-"+c),b.push({el:h,id:h.id,tag:h.tagName.toLowerCase(),ordinal:c++,snippet:(h.textContent||"").trim().slice(0,80)}))}return b}function b(){var a=f.options,c=window.scrollY||window.pageYOffset;if(Math.abs(c-
|
|
106
|
+
f._prevY)>a.settleTolerance)f._prevY=c,f.scrollTimer=setTimeout(b,a.recheckInterval);else{var e=window.scrollY||window.pageYOffset;for(var d=f.options,g=null,h=Infinity,k=0;k<f.sections.length;k++){var q=f.sections[k],n=q.el.offsetTop;n<=e+d.sectionLookback&&(n=Math.abs(n-e-180),n<h&&(h=n,g=q))}(e=g)&&!f.seen[e.id]&&(f.seen[e.id]=!0,m.send("section:"+e.id,{tag:e.tag,ordinal:e.ordinal,snippet:e.snippet}));e=document.documentElement.scrollHeight-window.innerHeight;if(0<e)for(c=Math.round(c/e*100),e=
|
|
107
|
+
0;e<a.depthMilestones.length;e++)d=a.depthMilestones[e],c>=d&&!f.depthHit[d]&&(f.depthHit[d]=!0,m.send("depth:"+d+"%"))}}function a(){f.anchorCooling||(clearTimeout(f.scrollTimer),f._prevY=window.scrollY||window.pageYOffset,f.scrollTimer=setTimeout(b,f.options.debounce))}function g(){var a=f.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,c="",d=0;d<f.tocSections.length;d++)b>=f.tocSections[d].el.offsetTop-160&&(c=f.tocSections[d].id);b=document.querySelectorAll(a.tocSelector);
|
|
108
|
+
for(d=0;d<b.length;d++)b[d].classList.remove(a.tocActiveClass),b[d].getAttribute("href")==="#"+c&&b[d].classList.add(a.tocActiveClass)}}function q(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(f.anchorCooling=!0,setTimeout(function(){f.anchorCooling=!1},f.options.anchorCooldown),m.send("anchor:"+b.slice(1))):m.send(a.dataset.track||"link:"+b)}}function n(){if(f.activeSection&&f.options.trackDwell){var a=Math.round((Date.now()-f.activeSince)/1E3);if(0<a){var b=
|
|
109
|
+
f.dynamicSections[f.activeSection];m.send("dwell:"+f.activeSection,{seconds:a,name:b?b.name:f.activeSection})}f.activeSection=null;f.activeSince=null}}function u(a,b){var c=b.id||a.id||a.getAttribute("data-section")||a.getAttribute("data-track-section")||k(a.textContent||"")||"dyn-"+Object.keys(f.dynamicSections).length;a.id||(a.id=c);f.dynamicSections[c]={el:a,id:c,name:b.name||a.getAttribute("data-section-name")||a.getAttribute("title")||c,snippet:(a.textContent||"").trim().slice(0,80),observedAt:Date.now()};
|
|
110
|
+
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?v.opened(c):a.isIntersecting||f.activeSection!==c||v.closed(c)})},{threshold:[0,.3]}),b.observe(a),f.dynamicSections[c]._io=b);return c}function h(a){var b=a.querySelectorAll("a[href], li[data-action], li[data-name]");if(b.length){a=new IntersectionObserver(function(a){a.forEach(function(a){if(a.isIntersecting){a=a.target;var b="nav-link:"+(a.getAttribute("data-name")||
|
|
111
|
+
a.getAttribute("data-action")||a.getAttribute("href")||a.textContent.trim().slice(0,40));f._navLinksSeen[b]||(f._navLinksSeen[b]=!0,m.send(b,{text:a.textContent.trim().slice(0,60)}))}})},{root:a,threshold:.5});for(var c=0;c<b.length;c++)a.observe(b[c]);f._navObservers.push(a)}}function y(){if(window.MutationObserver&&f.options.observeDom){var a=f.options.observeRoot||document.body,b=f.options.observeSelector;f._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
112
|
+
a.nodeType&&(a.matches&&a.matches(b)&&u(a,{}),a.querySelectorAll)){a=a.querySelectorAll(b);for(var c=0;c<a.length;c++)u(a[c],{})}})})});f._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function w(){for(var a=window.scrollY||window.pageYOffset,b=0;b<f.sections.length;b++){var c=f.sections[b].el.getBoundingClientRect();-100<=c.top&&c.top<window.innerHeight&&(f.seen[f.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<f.options.depthMilestones.length;b++)c=
|
|
113
|
+
f.options.depthMilestones[b],a>=c&&(f.depthHit[c]=!0)}var m=d.Metrics;if(m){var x={sections:"h2[id], h3[id], section[id], [data-section]",minSectionHeight:100,debounce:1E3,initDelay:800,anchorCooldown:1500,depthMilestones:[25,50,75,100],sectionLookback:300,settleTolerance:2,recheckInterval:500,observeDom:!1,observeRoot:null,observeSelector:"[data-section], [data-track-section]",trackDwell:!0,navContainers:null,trackContextuals:!0,trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},
|
|
114
|
+
f={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1,dynamicSections:{},activeSection:null,activeSince:null,_mutationObserver:null,_navObservers:[],_navLinksSeen:{}},v={init:function(b){if(f.initialized)return console.warn("Metrics.NavigationTracker already initialized"),this;var d={},e;for(e in x)x.hasOwnProperty(e)&&(d[e]=x[e]);for(e in b||{})b.hasOwnProperty(e)&&void 0!==b[e]&&(d[e]=b[e]);f.options=d;f.initialized=!0;!m._endpoint&&
|
|
115
|
+
b&&b.endpoint&&m.init({endpoint:b.endpoint,page:b.page,sessionKey:b.sessionKey,sessionId:b.sessionId,extra:b.extra,trackUnload:b.trackUnload});setTimeout(function(){f.sections=c(d.sections);d.tocSelector&&d.tocSectionSelector&&(f.tocSections=c(d.tocSectionSelector));w();window.addEventListener("scroll",a,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",g,{passive:!0}),g());d.observeDom&&y();if(d.navContainers){var b=f.options.navContainers;if(b&&window.IntersectionObserver){b=document.querySelectorAll(b);
|
|
116
|
+
for(var e=0;e<b.length;e++)h(b[e])}}},d.initDelay);d.trackClicks&&document.addEventListener("click",q);if(d.trackDwell)m.onVisibilityChange(function(a){a||n()},"NavigationTracker.dwell");return this},observe:function(a,b){return u(a,b||{})},opened:function(a){if(f.activeSection!==a)if(n(),f.activeSection=a,f.activeSince=Date.now(),f.seen[a])m.send("switched:"+a,{name:(f.dynamicSections[a]||{}).name||a});else{f.seen[a]=!0;var b=f.dynamicSections[a];m.send("opened:"+a,{name:b?b.name:a,snippet:b?b.snippet:
|
|
117
|
+
""})}},closed:function(a){f.activeSection===a&&n()},observeNavContainer:function(a){h(a)},send:function(a,b){m.send(a,b)},markSeen:function(a){f.seen[a]=!0},getSessionId:function(){return m.getSessionId()},getSections:function(){return f.sections.map(function(a){return{id:a.id,tag:a.tag,ordinal:a.ordinal,snippet:a.snippet}})},getDynamicSections:function(){var a={},b;for(b in f.dynamicSections){var c=f.dynamicSections[b];a[b]={id:c.id,name:c.name,snippet:c.snippet}}return a},getSeen:function(){var a=
|
|
118
|
+
{},b;for(b in f.seen)a[b]=!0;return a},getActive:function(){return f.activeSection?{id:f.activeSection,since:f.activeSince,elapsed:Math.round((Date.now()-f.activeSince)/1E3)}:null},reset:function(){n();f.seen={};f.depthHit={};f.anchorCooling=!1;f._navLinksSeen={};clearTimeout(f.scrollTimer);for(var a in f.dynamicSections)f.dynamicSections[a]._io&&f.dynamicSections[a]._io.disconnect();f.dynamicSections={};f.activeSection=null;f.activeSince=null;f.sections=c(f.options.sections);w()},destroy:function(){n();
|
|
119
|
+
window.removeEventListener("scroll",a);window.removeEventListener("scroll",g);document.removeEventListener("click",q);clearTimeout(f.scrollTimer);f._mutationObserver&&(f._mutationObserver.disconnect(),f._mutationObserver=null);for(var b in f.dynamicSections)f.dynamicSections[b]._io&&f.dynamicSections[b]._io.disconnect();for(b=0;b<f._navObservers.length;b++)f._navObservers[b].disconnect();f._navObservers=[];f.initialized=!1},defaults:x,state:f};m.NavigationTracker=v;m.SectionTracker=v;m.ScrollTracker=
|
|
120
|
+
v}else console.warn("Metrics.NavigationTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
121
|
+
(function(d){function k(a){if(a.id)return a.id;if(a=a.src||a.currentSrc||""){var b=a.match(/(?:youtu\.be\/|youtube\.com\/embed\/|vimeo\.com\/video\/|vimeo\.com\/)([^?&#]+)/);if(b)return b[1];if((a=a.split("/").pop().split("?")[0])&&60>a.length)return a}return"media-"+l._counter++}function c(){this.ranges=[]}function b(a,b,d,g){return{id:a,type:b,el:d,duration:g||0,playing:!1,lastPosition:0,lastCheckpointAt:0,watched:new c,checkpointTimer:null,_lastTimeUpdate:0}}function a(a,b,c){var d={type:a.type,
|
|
122
|
+
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var e in c)d[e]=c[e];v.send(b+":"+a.id,d)}function g(b){q(b);b.checkpointTimer=setInterval(function(){b.playing&&a(b,"media-checkpoint")},1E3*l.options.checkpointInterval)}function q(a){a.checkpointTimer&&(clearInterval(a.checkpointTimer),a.checkpointTimer=null)}function n(c){var d=k(c);if(!l.tracked[d]){var e=b(d,"native",c,c.duration||0);l.tracked[d]=e;c.addEventListener("loadedmetadata",function(){e.duration=
|
|
123
|
+
c.duration||0});c.addEventListener("play",function(){e.playing=!0;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;a(e,"media-play");g(e)});c.addEventListener("pause",function(){e.playing&&(e.playing=!1,e.watched.add(e._lastTimeUpdate,c.currentTime),e.lastPosition=c.currentTime,q(e),a(e,"media-pause"))});c.addEventListener("ended",function(){e.playing=!1;e.watched.add(e._lastTimeUpdate,c.currentTime);e.lastPosition=c.currentTime;q(e);a(e,"media-ended")});c.addEventListener("seeked",function(){var b=
|
|
124
|
+
e.lastPosition;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;a(e,"media-seeked",{from:Math.round(b),to:Math.round(c.currentTime)})});c.addEventListener("timeupdate",function(){e.playing&&c.currentTime>e._lastTimeUpdate&&e.watched.add(e._lastTimeUpdate,c.currentTime);e._lastTimeUpdate=c.currentTime;e.lastPosition=c.currentTime})}}function u(a){if(l._ytApiLoaded)a();else if(l._ytApiLoading)l._ytPendingPlayers.push(a);else{l._ytApiLoading=!0;var b=d.onYouTubeIframeAPIReady;d.onYouTubeIframeAPIReady=
|
|
125
|
+
function(){l._ytApiLoaded=!0;l._ytApiLoading=!1;b&&b();a();for(var c=0;c<l._ytPendingPlayers.length;c++)l._ytPendingPlayers[c]();l._ytPendingPlayers=[]};var c=document.createElement("script");c.src="https://www.youtube.com/iframe_api";document.head.appendChild(c)}}function h(c){var d=c.src||"",e=k(c);if(!l.tracked[e]){if(-1===d.indexOf("enablejsapi"))if(l.options.reloadIframes){var f=-1===d.indexOf("?")?"?":"&";c.src=d+f+"enablejsapi=1&origin="+encodeURIComponent(location.origin)}else{console.warn("Metrics.MediaTracker: YouTube iframe missing enablejsapi=1, set reloadIframes:true to auto-fix. iframe:",
|
|
126
|
+
c);return}c.id||(c.id="yt-"+e);u(function(){if(!l.tracked[e]){var d=b(e,"youtube",c,0);l.tracked[e]=d;var f=new YT.Player(c.id,{events:{onReady:function(a){d.duration=f.getDuration()||0},onStateChange:function(b){var c=f.getCurrentTime()||0;d.lastPosition=c;switch(b.data){case YT.PlayerState.PLAYING:d.playing=!0;d._lastTimeUpdate=c;d.duration=f.getDuration()||d.duration;a(d,"media-play");g(d);d._pollTimer=setInterval(function(){var a=f.getCurrentTime()||0;d.playing&&a>d._lastTimeUpdate&&d.watched.add(d._lastTimeUpdate,
|
|
127
|
+
a);d._lastTimeUpdate=a;d.lastPosition=a},1E3);break;case YT.PlayerState.PAUSED:if(!d.playing)break;d.playing=!1;d.watched.add(d._lastTimeUpdate,c);q(d);clearInterval(d._pollTimer);a(d,"media-pause");break;case YT.PlayerState.ENDED:d.playing=!1,d.watched.add(d._lastTimeUpdate,c),q(d),clearInterval(d._pollTimer),a(d,"media-ended")}}}});d._player=f}})}}function y(a){if(l._vimeoApiLoaded)a();else if(l._vimeoApiLoading)setTimeout(function(){y(a)},200);else{l._vimeoApiLoading=!0;var b=document.createElement("script");
|
|
128
|
+
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function w(c){var d=k(c);l.tracked[d]||y(function(){if(!l.tracked[d]){var e=b(d,"vimeo",c,0);l.tracked[d]=e;var f=new Vimeo.Player(c);e._player=f;f.getDuration().then(function(a){e.duration=a||0});f.on("play",function(b){e.playing=!0;e.lastPosition=b.seconds||0;e._lastTimeUpdate=e.lastPosition;e.duration=b.duration||e.duration;a(e,"media-play");g(e)});f.on("pause",
|
|
129
|
+
function(b){e.playing&&(e.playing=!1,b=b.seconds||0,e.watched.add(e._lastTimeUpdate,b),e.lastPosition=b,q(e),a(e,"media-pause"))});f.on("ended",function(b){e.playing=!1;b=b.seconds||e.duration;e.watched.add(e._lastTimeUpdate,b);e.lastPosition=b;q(e);a(e,"media-ended")});f.on("seeked",function(b){var c=e.lastPosition;e.lastPosition=b.seconds||0;e._lastTimeUpdate=e.lastPosition;a(e,"media-seeked",{from:Math.round(c),to:Math.round(e.lastPosition)})});f.on("timeupdate",function(a){a=a.seconds||0;e.playing&&
|
|
130
|
+
a>e._lastTimeUpdate&&e.watched.add(e._lastTimeUpdate,a);e._lastTimeUpdate=a;e.lastPosition=a})}})}function m(){for(var a=document.querySelectorAll(l.options.mediaSelector),b=0;b<a.length;b++)n(a[b]);a=document.querySelectorAll("iframe[src]");for(b=0;b<a.length;b++){var c=a[b].src||"";/youtube\.com\/embed|youtube-nocookie\.com\/embed/.test(c)?h(a[b]):/player\.vimeo\.com/.test(c)?w(a[b]):/w\.soundcloud\.com\/player/.test(c)?trackSoundCloud(a[b]):/dailymotion\.com\/embed/.test(c)?trackDailymotion(a[b]):
|
|
131
|
+
/open\.spotify\.com\/embed/.test(c)?trackSpotify(a[b]):/player\.twitch\.tv/.test(c)?trackTwitch(a[b]):/muse\.ai\/embed/.test(c)&&trackMuseAi(a[b])}a=document.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(b=0;b<a.length;b++)trackWistia(a[b]);a=document.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}function x(){if(window.MutationObserver&&l.options.observeDom){var a=l.options.observeRoot||document.body;l._mutationObserver=new MutationObserver(function(a){a.forEach(function(a){a.addedNodes.forEach(function(a){if(1===
|
|
132
|
+
a.nodeType){a.matches&&a.matches("video, audio")&&n(a);if("IFRAME"===a.tagName&&a.src){var b=a.src;/youtube\.com\/embed/.test(b)?h(a):/player\.vimeo\.com/.test(b)?w(a):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(a):/dailymotion\.com\/embed/.test(b)?trackDailymotion(a):/open\.spotify\.com\/embed/.test(b)?trackSpotify(a):/player\.twitch\.tv/.test(b)?trackTwitch(a):/muse\.ai\/embed/.test(b)&&trackMuseAi(a)}a.className&&/wistia_embed|wistia_async_/.test(a.className)&&trackWistia(a);a.className&&
|
|
133
|
+
/jwplayer/.test(a.className)&&trackJWPlayer(a);if(a.querySelectorAll){b=a.querySelectorAll("video, audio");for(var c=0;c<b.length;c++)n(b[c]);c=a.querySelectorAll("iframe[src]");for(var d=0;d<c.length;d++)b=c[d].src||"",/youtube\.com\/embed/.test(b)?h(c[d]):/player\.vimeo\.com/.test(b)?w(c[d]):/w\.soundcloud\.com\/player/.test(b)?trackSoundCloud(c[d]):/dailymotion\.com\/embed/.test(b)?trackDailymotion(c[d]):/open\.spotify\.com\/embed/.test(b)?trackSpotify(c[d]):/player\.twitch\.tv/.test(b)?trackTwitch(c[d]):
|
|
134
|
+
/muse\.ai\/embed/.test(b)&&trackMuseAi(c[d]);b=a.querySelectorAll('[class*="wistia_embed"], [class*="wistia_async_"]');for(c=0;c<b.length;c++)trackWistia(b[c]);a=a.querySelectorAll(".jwplayer, [data-jw-id]");for(b=0;b<a.length;b++)trackJWPlayer(a[b])}}})})});l._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function f(){for(var b in l.tracked){var c=l.tracked[b];c.playing&&("native"===c.type&&c.el&&(c.watched.add(c._lastTimeUpdate,c.el.currentTime||c.lastPosition),c.lastPosition=c.el.currentTime||
|
|
135
|
+
c.lastPosition),a(c,"media-checkpoint"))}}var v=d.Metrics;if(v){var t={checkpointInterval:10,autoDiscover:!0,mediaSelector:"video, audio",reloadIframes:!1,observeDom:!0,observeRoot:null,checkpointDebounce:1E3},l={initialized:!1,options:null,tracked:{},_counter:0,_mutationObserver:null,_ytApiLoaded:!1,_ytApiLoading:!1,_ytPendingPlayers:[],_vimeoApiLoaded:!1,_vimeoApiLoading:!1};c.prototype.add=function(a,b){if(!(b<=a)){a={start:Math.floor(a),end:Math.ceil(b)};b=[];for(var c=!1,d=0;d<this.ranges.length;d++){var e=
|
|
136
|
+
this.ranges[d];e.end<a.start?b.push(e):e.start>a.end?(c||(b.push(a),c=!0),b.push(e)):(a.start=Math.min(a.start,e.start),a.end=Math.max(a.end,e.end))}c||b.push(a);this.ranges=b}};c.prototype.total=function(){for(var a=0,b=0;b<this.ranges.length;b++)a+=this.ranges[b].end-this.ranges[b].start;return a};v.MediaTracker={init:function(a){if(l.initialized)return console.warn("Metrics.MediaTracker already initialized"),this;var b={},c;for(c in t)t.hasOwnProperty(c)&&(b[c]=t[c]);for(c in a||{})a.hasOwnProperty(c)&&
|
|
137
|
+
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!v._endpoint&&a&&a.endpoint&&v.init({endpoint:a.endpoint,page:a.page,trackUnload:a.trackUnload});b.autoDiscover&&setTimeout(function(){m()},500);b.observeDom&&x();v.onVisibilityChange(function(a){a||f()},"MediaTracker.flush");return this},trackNative:function(a,b){b&&(a.id=b);n(a)},trackYouTube:function(a,b){b&&(a.id=b);h(a)},trackVimeo:function(a,b){b&&(a.id=b);w(a)},trackSoundCloud:function(a,b){b&&(a.id=b);trackSoundCloud(a)},trackWistia:function(a,
|
|
138
|
+
b){b&&(a.id=b);trackWistia(a)},trackJWPlayer:function(a,b){b&&(a.id=b);trackJWPlayer(a)},trackDailymotion:function(a,b){b&&(a.id=b);trackDailymotion(a)},trackSpotify:function(a,b){b&&(a.id=b);trackSpotify(a)},trackTwitch:function(a,b){b&&(a.id=b);trackTwitch(a)},trackMuseAi:function(a,b){b&&(a.id=b);trackMuseAi(a)},getTracked:function(){var a={},b;for(b in l.tracked){var c=l.tracked[b];a[b]={id:c.id,type:c.type,playing:c.playing,position:Math.round(c.lastPosition),duration:Math.round(c.duration),
|
|
139
|
+
watched:c.watched.total()}}return a},flush:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];q(b);b._pollTimer&&clearInterval(b._pollTimer)}l.tracked={};l._mutationObserver&&(l._mutationObserver.disconnect(),l._mutationObserver=null);l.initialized=!1},defaults:t,state:l}}else console.warn("Metrics.MediaTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);
|
|
140
|
+
function loadSoundCloudAPI(d){if(root.SC&&root.SC.Widget)d();else{var k=document.createElement("script");k.src="https://w.soundcloud.com/player/api.js";k.onload=d;document.head.appendChild(k)}}
|
|
141
|
+
function trackSoundCloud(d){var k=genId(d);state.tracked[k]||loadSoundCloudAPI(function(){if(!state.tracked[k]){var c=SC.Widget(d),b=createTracker(k,"soundcloud",d,0);state.tracked[k]=b;c.bind(SC.Widget.Events.READY,function(){c.getDuration(function(a){b.duration=(a||0)/1E3})});c.bind(SC.Widget.Events.PLAY,function(){b.playing=!0;c.getPosition(function(a){b.lastPosition=(a||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-play");startCheckpoints(b)})});c.bind(SC.Widget.Events.PAUSE,function(){b.playing&&
|
|
142
|
+
(b.playing=!1,c.getPosition(function(a){a=(a||0)/1E3;b.watched.add(b._lastTimeUpdate,a);b.lastPosition=a;stopCheckpoints(b);sendEvent(b,"media-pause")}))});c.bind(SC.Widget.Events.FINISH,function(){b.playing=!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")});c.bind(SC.Widget.Events.SEEK,function(a){var c=b.lastPosition;b.lastPosition=(a.currentPosition||0)/1E3;b._lastTimeUpdate=b.lastPosition;sendEvent(b,"media-seeked",{from:Math.round(c),
|
|
143
|
+
to:Math.round(b.lastPosition)})});c.bind(SC.Widget.Events.PLAY_PROGRESS,function(a){a=(a.currentPosition||0)/1E3;b.playing&&a>b._lastTimeUpdate&&b.watched.add(b._lastTimeUpdate,a);b._lastTimeUpdate=a;b.lastPosition=a})}})}
|
|
144
|
+
function trackWistia(d){var k=genId(d);if(!state.tracked[k]){var c=d.getAttribute("data-wistia-id")||(d.className.match(/wistia_async_(\w+)/)||[])[1]||k;root._wq=root._wq||[];root._wq.push({id:c,onReady:function(b){if(!state.tracked[k]){var a=createTracker(k,"wistia",d,b.duration()||0);state.tracked[k]=a;a._player=b;b.bind("play",function(){a.playing=!0;a.lastPosition=b.time();a._lastTimeUpdate=a.lastPosition;a.duration=b.duration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a)});b.bind("pause",
|
|
145
|
+
function(){if(a.playing){a.playing=!1;var c=b.time();a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);sendEvent(a,"media-pause")}});b.bind("end",function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")});b.bind("seek",function(b,c){a.lastPosition=b;a._lastTimeUpdate=b;sendEvent(a,"media-seeked",{from:Math.round(c),to:Math.round(b)})});b.bind("secondchange",function(b){a.playing&&b>a._lastTimeUpdate&&
|
|
146
|
+
a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b})}}});root.Wistia||(c=document.createElement("script"),c.src="https://fast.wistia.com/assets/external/E-v1.js",c.async=!0,document.head.appendChild(c))}}
|
|
147
|
+
function trackJWPlayer(d){function k(){if(!root.jwplayer||"function"!==typeof root.jwplayer)return!1;var a;try{a=jwplayer(b)}catch(q){return!1}if(!a||!a.getState)return!1;var g=createTracker(c,"jwplayer",d,a.getDuration()||0);state.tracked[c]=g;g._player=a;a.on("play",function(){g.playing=!0;g.lastPosition=a.getPosition();g._lastTimeUpdate=g.lastPosition;g.duration=a.getDuration()||g.duration;sendEvent(g,"media-play");startCheckpoints(g)});a.on("pause",function(){if(g.playing){g.playing=!1;var b=
|
|
148
|
+
a.getPosition();g.watched.add(g._lastTimeUpdate,b);g.lastPosition=b;stopCheckpoints(g);sendEvent(g,"media-pause")}});a.on("complete",function(){g.playing=!1;g.watched.add(g._lastTimeUpdate,g.duration);g.lastPosition=g.duration;stopCheckpoints(g);sendEvent(g,"media-ended")});a.on("seek",function(a){g.lastPosition=a.offset;g._lastTimeUpdate=a.offset;sendEvent(g,"media-seeked",{from:Math.round(a.position),to:Math.round(a.offset)})});a.on("time",function(a){var b=a.position;g.playing&&b>g._lastTimeUpdate&&
|
|
149
|
+
g.watched.add(g._lastTimeUpdate,b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var c=genId(d);if(!state.tracked[c]){var b=d.id||c;k()||setTimeout(function(){k()},2E3)}}
|
|
150
|
+
function trackDailymotion(d){function k(){if(root.DM&&root.DM.player)c();else{var a=document.createElement("script");a.src="https://api.dmcdn.net/all.js";a.onload=function(){c()};document.head.appendChild(a)}}function c(){if(!state.tracked[b]){var a=createTracker(b,"dailymotion",d,0);state.tracked[b]=a;var c=DM.player(d,{events:{playing:function(){a.playing=!0;a.lastPosition=c.currentTime||0;a._lastTimeUpdate=a.lastPosition;a.duration=c.duration||a.duration;sendEvent(a,"media-play");startCheckpoints(a)},
|
|
151
|
+
pause:function(){if(a.playing){a.playing=!1;var b=c.currentTime||0;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);sendEvent(a,"media-pause")}},end:function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")},seeking:function(){var b=a.lastPosition;a.lastPosition=c.currentTime||0;a._lastTimeUpdate=a.lastPosition;sendEvent(a,"media-seeked",{from:Math.round(b),to:Math.round(a.lastPosition)})},timeupdate:function(){var b=
|
|
152
|
+
c.currentTime||0;a.playing&&b>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b;a.duration=c.duration||a.duration}}});a._player=c}}var b=genId(d);state.tracked[b]||k()}
|
|
153
|
+
function trackSpotify(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"spotify",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){var a;try{a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(q){return}if(a.type&&"playback_update"===a.type){b=a.payload&&a.payload.position||0;b/=1E3;var g=a.payload&&a.payload.duration||0;a=a.payload&&a.payload.isPaused;c.duration=g/1E3||c.duration;a||c.playing?a&&c.playing?(c.playing=!1,
|
|
154
|
+
c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):!a&&c.playing&&b>c._lastTimeUpdate&&(c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b):(c.playing=!0,c.lastPosition=b,c._lastTimeUpdate=b,sendEvent(c,"media-play"),startCheckpoints(c))}}})}}
|
|
155
|
+
function trackTwitch(d){function k(){if(root.Twitch&&root.Twitch.Player)c();else{var a=document.createElement("script");a.src="https://player.twitch.tv/js/embed/v1.js";a.onload=function(){c()};document.head.appendChild(a)}}function c(){if(!state.tracked[b]){d.id||(d.id="twitch-"+b);var a=createTracker(b,"twitch",d,0);state.tracked[b]=a;var c=new Twitch.Player(d.id,{});a._player=c;c.addEventListener(Twitch.Player.PLAY,function(){a.playing=!0;a.lastPosition=c.getCurrentTime()||0;a._lastTimeUpdate=a.lastPosition;
|
|
156
|
+
a.duration=c.getDuration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a);a._pollTimer=setInterval(function(){var b=c.getCurrentTime()||0;a.playing&&b>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b},1E3)});c.addEventListener(Twitch.Player.PAUSE,function(){if(a.playing){a.playing=!1;var b=c.getCurrentTime()||0;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-pause")}});c.addEventListener(Twitch.Player.ENDED,
|
|
157
|
+
function(){a.playing=!1;var b=c.getCurrentTime()||a.duration;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-ended")})}}var b=genId(d);state.tracked[b]||k()}
|
|
158
|
+
function trackMuseAi(d){var k=genId(d);if(!state.tracked[k]){var c=createTracker(k,"museai",d,0);state.tracked[k]=c;window.addEventListener("message",function(b){if(b.data&&b.source===d.contentWindow){var a;try{a="string"===typeof b.data?JSON.parse(b.data):b.data}catch(g){return}"play"===a.event?(c.playing=!0,c.lastPosition=a.currentTime||0,c._lastTimeUpdate=c.lastPosition,c.duration=a.duration||c.duration,sendEvent(c,"media-play"),startCheckpoints(c)):"pause"===a.event?c.playing&&(c.playing=!1,b=
|
|
159
|
+
a.currentTime||0,c.watched.add(c._lastTimeUpdate,b),c.lastPosition=b,stopCheckpoints(c),sendEvent(c,"media-pause")):"ended"===a.event?(c.playing=!1,c.watched.add(c._lastTimeUpdate,c.duration),c.lastPosition=c.duration,stopCheckpoints(c),sendEvent(c,"media-ended")):"timeupdate"===a.event&&(b=a.currentTime||0,c.duration=a.duration||c.duration,c.playing&&b>c._lastTimeUpdate&&c.watched.add(c._lastTimeUpdate,b),c._lastTimeUpdate=b,c.lastPosition=b)}});try{d.contentWindow.postMessage({method:"addEventListener",
|
|
160
|
+
value:"play"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"pause"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"ended"},"*")}catch(b){}try{d.contentWindow.postMessage({method:"addEventListener",value:"timeupdate"},"*")}catch(b){}}};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
!
|
|
1
|
+
if(!window.$){var c=function(a){this.length=a.length;for(var b=0;b<a.length;b++)this[b]=a[b]};if(!window.jQuery){var fn={each:function(a){for(var b=0;b<this.length;b++)a.call(this[b],b,this[b]);return this},html:function(a){if(a===undefined)return this[0]&&this[0].innerHTML;return this.each(function(){this.innerHTML=a})},text:function(a){if(a===undefined)return this[0]&&this[0].textContent;return this.each(function(){this.textContent=a})},val:function(v){if(!this[0])return;var el=this[0];if(v===undefined)return el.value;
|
|
2
|
+
if(el.value!==undefined)this.each(function(){this.value=v});return this},append:function(a){return this.each(function(){var b=this;if(a instanceof c)a.each(function(){b.appendChild(this)});else if(a instanceof Element)b.appendChild(a);else if(typeof a==="string")b.insertAdjacentHTML("beforeend",a)})},prepend:function(a){return this.each(function(){var b=this;if(a instanceof c)a.each(function(){b.insertBefore(this,b.firstChild)});else if(a instanceof Element)b.insertBefore(a,b.firstChild);else if(typeof a===
|
|
3
|
+
"string")b.insertAdjacentHTML("afterbegin",a)})},appendTo:function(a){var t=this;if(a instanceof c)a.each(function(){for(var i=0;i<t.length;i++)this.appendChild(t[i])});else if(a instanceof Element)for(var i=0;i<t.length;i++)a.appendChild(t[i]);else if(typeof a==="string")$(a).append(this);return this},prependTo:function(a){var t=this;if(a instanceof c)a.each(function(){for(var i=0;i<t.length;i++)this.insertBefore(t[i],this.firstChild)});else if(a instanceof Element)for(var i=0;i<t.length;i++)a.insertBefore(t[i],
|
|
4
|
+
a.firstChild);else if(typeof a==="string")$(a).prepend(this);return this},parents:function(s){var p=[];this.each(function(){for(var x=this.parentElement;x;x=x.parentElement)if(p.indexOf(x)<0)p.push(x)});p=new c(p);return s?p.filter(s):p},parent:function(s){var p=[];this.each(function(){var x=this.parentElement;if(x&&p.indexOf(x)<0)p.push(x)});p=new c(p);return s?p.filter(s):p},children:function(s){var ch=[];this.each(function(){for(var i=0;i<this.children.length;i++)ch.push(this.children[i])});ch=
|
|
5
|
+
new c(ch);return s?ch.filter(s):ch},filter:function(sel){var r=[];this.each(function(){if(this.matches(sel))r.push(this)});return new c(r)},eq:function(i){return new c([this[i]])},addClass:function(a){return this.each(function(){this.classList.add(a)})},removeClass:function(a){return this.each(function(){this.classList.remove(a)})},hasClass:function(a){return this[0]?this[0].classList.contains(a):false},attr:function(a,b){if(typeof a==="object"&&a){for(var k in a)this.each(function(){this.setAttribute(k,
|
|
6
|
+
a[k])});return this}if(b===undefined)return this[0]&&this[0].getAttribute(a);return this.each(function(){this.setAttribute(a,b)})},css:function(a,b){if(typeof a==="object"&&a){for(var k in a)this.each(function(){this.style[k]=a[k]});return this}if(b===undefined)return this[0]&&getComputedStyle(this[0])[a];return this.each(function(){this.style[a]=b})},scrollTop:function(v){if(!this[0])return 0;if(v===undefined)return this[0].scrollTop;return this.each(function(){this.scrollTop=v})},on:function(a,
|
|
7
|
+
b){return this.each(function(){this.addEventListener(a,b)})},off:function(a,b){return this.each(function(){this.removeEventListener(a,b)})},trigger:function(a){return this.each(function(){this.dispatchEvent(new Event(a))})},hide:function(){return this.each(function(){this.style.display="none"})},show:function(){return this.each(function(){this.style.display=""})},toggle:function(state){return this.each(function(){this.style.display=state===undefined?this.style.display==="none"?"":"none":state?"":
|
|
8
|
+
"none"})},empty:function(){return this.each(function(){this.innerHTML=""})},remove:function(){return this.each(function(){this.remove()})},find:function(a){return new c(this[0]?this[0].querySelectorAll(a):[])},closest:function(a){return new c(this[0]?[this[0].closest(a)]:[])},height:function(){return this[0]?this[0].offsetHeight:0},width:function(){return this[0]?this[0].offsetWidth:0},outerHeight:function(){if(!this[0])return 0;var s=getComputedStyle(this[0]);return this[0].offsetHeight+parseFloat(s.marginTop||
|
|
9
|
+
0)+parseFloat(s.marginBottom||0)},outerWidth:function(){if(!this[0])return 0;var s=getComputedStyle(this[0]);return this[0].offsetWidth+parseFloat(s.marginLeft||0)+parseFloat(s.marginRight||0)},data:function(a,b){if(!this[0])return;if(!this[0].__data)this[0].__data={};if(b===undefined)return this[0].__data[a];this.each(function(){this.__data[a]=b});return this},is:function(a){if(!this[0])return!1;if(a===":visible")return this[0].offsetParent!==null;return this[0].matches(a)},ready:function(fn){if(this[0]===
|
|
10
|
+
document||this[0]===window)if(document.readyState==="complete"||document.readyState==="interactive")setTimeout(fn,0);else document.addEventListener("DOMContentLoaded",fn);return this}};["click","focus","blur","change","submit"].forEach(function(ev){fn[ev]=function(handler){if(handler)return this.on(ev,handler);return this.trigger(ev)}});c.prototype=fn;window.$=window.jQuery=function(a){if(typeof a==="function")return $(document).ready(a);if(typeof a==="string"&&a.trim().startsWith("<")){a=a.trim();
|
|
11
|
+
var tagMatch=a.match(/^<([a-z0-9-]+)/i);if(tagMatch){var tag=tagMatch[1];var attrMatch=a.match(/<[^>]+>/);var attrs={};(attrMatch?attrMatch[0]:"").replace(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)="([^"]*)"/g,function(_,key,val){attrs[key]=val});return new c([Q.element?Q.element(tag,attrs):Object.assign(document.createElement(tag),attrs)])}var div=document.createElement("div");div.innerHTML=a;return new c(Array.from(div.children))}if(typeof a==="string")return new c(document.querySelectorAll(a));if(a instanceof
|
|
12
|
+
Element||a===window||a===document)return new c([a]);if(a&&a.length)return new c(a);return new c([])};window.$.fn=fn;fn.constructor=c}};
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
$
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.
|
|
10
|
-
|
|
11
|
-
$(a).prepend(this);return this},parents:function(a){var b=[];this.each(function(){for(var a=this.parentElement;a;a=a.parentElement)0>b.indexOf(a)&&b.push(a)});b=new c(b);return a?b.filter(a):b},parent:function(a){var b=[];this.each(function(){var a=this.parentElement;a&&0>b.indexOf(a)&&b.push(a)});b=new c(b);return a?b.filter(a):b},children:function(a){var b=[];this.each(function(){for(var a=0;a<this.children.length;a++)b.push(this.children[a])});b=new c(b);return a?b.filter(a):b},filter:function(a){var b=
|
|
12
|
-
[];this.each(function(){this.matches(a)&&b.push(this)});return new c(b)},eq:function(a){return new c([this[a]])},addClass:function(a){return this.each(function(){this.classList.add(a)})},removeClass:function(a){return this.each(function(){this.classList.remove(a)})},hasClass:function(a){return this[0]?this[0].classList.contains(a):!1},attr:function(a,b){if("object"===typeof a&&a){for(var d in a)this.each(function(){this.setAttribute(d,a[d])});return this}return void 0===b?this[0]&&this[0].getAttribute(a):
|
|
13
|
-
this.each(function(){this.setAttribute(a,b)})},css:function(a,b){if("object"===typeof a&&a){for(var d in a)this.each(function(){this.style[d]=a[d]});return this}return void 0===b?this[0]&&getComputedStyle(this[0])[a]:this.each(function(){this.style[a]=b})},scrollTop:function(a){return this[0]?void 0===a?this[0].scrollTop:this.each(function(){this.scrollTop=a}):0},on:function(a,b){return this.each(function(){this.addEventListener(a,b)})},off:function(a,b){return this.each(function(){this.removeEventListener(a,
|
|
14
|
-
b)})},trigger:function(a){return this.each(function(){this.dispatchEvent(new Event(a))})},hide:function(){return this.each(function(){this.style.display="none"})},show:function(){return this.each(function(){this.style.display="block"})},toggle:function(a){return this.each(function(){this.style.display=void 0===a?"none"===this.style.display?"":"none":a?"":"none"})},empty:function(){return this.each(function(){this.innerHTML=""})},remove:function(){return this.each(function(){this.remove()})},find:function(a){return new c(this[0]?
|
|
15
|
-
this[0].querySelectorAll(a):[])},closest:function(a){return new c(this[0]?[this[0].closest(a)]:[])},height:function(){return this[0]?this[0].offsetHeight:0},width:function(){return this[0]?this[0].offsetWidth:0},outerHeight:function(){if(!this[0])return 0;var a=getComputedStyle(this[0]);return this[0].offsetHeight+parseFloat(a.marginTop||0)+parseFloat(a.marginBottom||0)},outerWidth:function(){if(!this[0])return 0;var a=getComputedStyle(this[0]);return this[0].offsetWidth+parseFloat(a.marginLeft||
|
|
16
|
-
0)+parseFloat(a.marginRight||0)},data:function(a,b){if(this[0]){this[0].__data||(this[0].__data={});if(void 0===b)return this[0].__data[a];this.each(function(){this.__data[a]=b});return this}},is:function(a){return this[0]?":visible"===a?null!==this[0].offsetParent:this[0].matches(a):!1},ready:function(a){if(this[0]===document||this[0]===window)"complete"===document.readyState||"interactive"===document.readyState?setTimeout(a,0):document.addEventListener("DOMContentLoaded",a);return this}};["click",
|
|
17
|
-
"focus","blur","change","submit"].forEach(function(a){fn[a]=function(b){return b?this.on(a,b):this.trigger(a)}});c.prototype=fn;window.$=window.jQuery=function(a){if("function"===typeof a)return $(document).ready(a);if("string"===typeof a&&a.trim().startsWith("<")){a=a.trim();var b=a.match(/^<([a-z0-9-]+)/i);if(b){b=b[1];a=a.match(/<[^>]+>/);var d={};(a?a[0]:"").replace(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)="([^"]*)"/g,function(a,b,e){d[b]=e});return new c([Q.element?Q.element(b,d):Object.assign(document.createElement(b),
|
|
18
|
-
d)])}b=document.createElement("div");b.innerHTML=a;return new c(Array.from(b.children))}return"string"===typeof a?new c(document.querySelectorAll(a)):a instanceof Element||a===window||a===document?new c([a]):a&&a.length?new c(a):new c([])};window.$.fn=fn;fn.constructor=c}};
|
|
1
|
+
if(!window.$){var c=function(a){this.length=a.length;for(var b=0;b<a.length;b++)this[b]=a[b]};if(!window.jQuery){var fn={each:function(a){for(var b=0;b<this.length;b++)a.call(this[b],b,this[b]);return this},html:function(a){if(a===undefined)return this[0]&&this[0].innerHTML;return this.each(function(){this.innerHTML=a})},append:function(a){return this.each(function(){var b=this;if(a instanceof c)a.each(function(){b.appendChild(this)});else if(a instanceof Element)b.appendChild(a);else if(typeof a===
|
|
2
|
+
"string")b.insertAdjacentHTML("beforeend",a)})},prepend:function(a){return this.each(function(){var b=this;if(a instanceof c)a.each(function(){b.insertBefore(this,b.firstChild)});else if(a instanceof Element)b.insertBefore(a,b.firstChild);else if(typeof a==="string")b.insertAdjacentHTML("afterbegin",a)})},appendTo:function(a){var t=this;if(a instanceof c)a.each(function(){for(var i=0;i<t.length;i++)this.appendChild(t[i])});else if(a instanceof Element)for(var i=0;i<t.length;i++)a.appendChild(t[i]);
|
|
3
|
+
else if(typeof a==="string")$(a).append(this);return this},prependTo:function(a){var t=this;if(a instanceof c)a.each(function(){for(var i=0;i<t.length;i++)this.insertBefore(t[i],this.firstChild)});else if(a instanceof Element)for(var i=0;i<t.length;i++)a.insertBefore(t[i],a.firstChild);else if(typeof a==="string")$(a).prepend(this);return this},parents:function(s){var p=[];this.each(function(){for(var x=this.parentElement;x;x=x.parentElement)if(p.indexOf(x)<0)p.push(x)});p=new c(p);return s?p.filter(s):
|
|
4
|
+
p},parent:function(s){var p=[];this.each(function(){var x=this.parentElement;if(x&&p.indexOf(x)<0)p.push(x)});p=new c(p);return s?p.filter(s):p},children:function(s){var ch=[];this.each(function(){for(var i=0;i<this.children.length;i++)ch.push(this.children[i])});ch=new c(ch);return s?ch.filter(s):ch},addClass:function(a){return this.each(function(){this.classList.add(a)})},removeClass:function(a){return this.each(function(){this.classList.remove(a)})},hasClass:function(a){return this[0]?this[0].classList.contains(a):
|
|
5
|
+
false},attr:function(a,b){if(b===undefined)return this[0]&&this[0].getAttribute(a);return this.each(function(){this.setAttribute(a,b)})},css:function(a,b){if(typeof a==="object"&&a){for(var k in a)this.each(function(){this.style[k]=a[k]});return this}if(b===undefined)return this[0]&&getComputedStyle(this[0])[a];return this.each(function(){this.style[a]=b})},scrollTop:function(v){if(!this[0])return 0;if(v===undefined)return this[0].scrollTop;return this.each(function(){this.scrollTop=v})},on:function(a,
|
|
6
|
+
b){return this.each(function(){this.addEventListener(a,b)})},off:function(a,b){return this.each(function(){this.removeEventListener(a,b)})},trigger:function(a){return this.each(function(){this.dispatchEvent(new Event(a))})},hide:function(){return this.each(function(){this.style.display="none"})},show:function(){return this.each(function(){this.style.display="block"})},empty:function(){return this.each(function(){this.innerHTML=""})},remove:function(){return this.each(function(){this.remove()})},find:function(a){return new c(this[0]?
|
|
7
|
+
this[0].querySelectorAll(a):[])},closest:function(a){return new c(this[0]?[this[0].closest(a)]:[])},height:function(){return this[0]?this[0].offsetHeight:0},width:function(){return this[0]?this[0].offsetWidth:0},outerHeight:function(){if(!this[0])return 0;var s=getComputedStyle(this[0]);return this[0].offsetHeight+parseFloat(s.marginTop||0)+parseFloat(s.marginBottom||0)},outerWidth:function(){if(!this[0])return 0;var s=getComputedStyle(this[0]);return this[0].offsetWidth+parseFloat(s.marginLeft||
|
|
8
|
+
0)+parseFloat(s.marginRight||0)},data:function(a,b){if(!this[0])return;if(!this[0].__data)this[0].__data={};if(b===undefined)return this[0].__data[a];this.each(function(){this.__data[a]=b});return this},is:function(a){if(!this[0])return!1;if(a===":visible")return this[0].offsetParent!==null;return this[0].matches(a)},ready:function(fn){if(this[0]===document||this[0]===window)if(document.readyState==="complete"||document.readyState==="interactive")setTimeout(fn,0);else document.addEventListener("DOMContentLoaded",
|
|
9
|
+
fn);return this}};["click","focus","blur","change","submit"].forEach(function(ev){fn[ev]=function(handler){if(handler)return this.on(ev,handler);return this.trigger(ev)}});c.prototype=fn;window.$=window.jQuery=function(a){if(typeof a==="function")return $(document).ready(a);if(typeof a==="string"&&a.trim().startsWith("<")){a=a.trim();var tagMatch=a.match(/^<([a-z0-9-]+)/i);if(tagMatch){var tag=tagMatch[1];var attrMatch=a.match(/<[^>]+>/);var attrs={};(attrMatch?attrMatch[0]:"").replace(/([a-zA-Z_:][-a-zA-Z0-9_:.]*)="([^"]*)"/g,
|
|
10
|
+
function(_,key,val){attrs[key]=val});return new c([Q.element?Q.element(tag,attrs):Object.assign(document.createElement(tag),attrs)])}var div=document.createElement("div");div.innerHTML=a;return new c(Array.from(div.children))}if(typeof a==="string")return new c(document.querySelectorAll(a));if(a instanceof Element||a===window||a===document)return new c([a]);if(a&&a.length)return new c(a);return new c([])};window.$.fn=fn;fn.constructor=c}};
|