@qbix/q.js 1.0.7 → 1.0.8
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/dist/Metrics.min.js +86 -159
- package/package.json +1 -1
package/dist/Metrics.min.js
CHANGED
|
@@ -1,160 +1,87 @@
|
|
|
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
|
-
{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:
|
|
12
|
-
b.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
b)},"Metrics.NavigationTracker");this.state.
|
|
18
|
-
"Metrics.NavigationTracker");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
h
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(
|
|
32
|
-
h
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
f
|
|
42
|
-
|
|
43
|
-
for(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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,
|
|
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(c,h,d){c!=Array.prototype&&c!=Object.prototype&&(c[h]=d.value)};$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$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 c=0;return function(h){return $jscomp.SYMBOL_PREFIX+(h||"")+c++}}();
|
|
3
|
+
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var c=$jscomp.global.Symbol.iterator;c||(c=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[c]&&$jscomp.defineProperty(Array.prototype,c,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(c){var h=0;return $jscomp.iteratorPrototype(function(){return h<c.length?{done:!1,value:c[h++]}:{done:!0}})};
|
|
4
|
+
$jscomp.iteratorPrototype=function(c){$jscomp.initSymbolIterator();c={next:c};c[$jscomp.global.Symbol.iterator]=function(){return this};return c};$jscomp.iteratorFromArray=function(c,h){$jscomp.initSymbolIterator();c instanceof String&&(c+="");var d=0,a={next:function(){if(d<c.length){var b=d++;return{value:h(b,c[b]),done:!1}}a.next=function(){return{done:!0,value:void 0}};return a.next()}};a[Symbol.iterator]=function(){return a};return a};
|
|
5
|
+
$jscomp.polyfill=function(c,h,d,a){if(h){d=$jscomp.global;c=c.split(".");for(a=0;a<c.length-1;a++){var b=c[a];b in d||(d[b]={});d=d[b]}c=c[c.length-1];a=d[c];h=h(a);h!=a&&null!=h&&$jscomp.defineProperty(d,c,{configurable:!0,writable:!0,value:h})}};$jscomp.polyfill("Array.prototype.keys",function(c){return c?c:function(){return $jscomp.iteratorFromArray(this,function(c){return c})}},"es6","es3");
|
|
6
|
+
(function(c){function h(){function a(a){a=!("pause"===a.type||"resign"===a.type||("resume"===a.type||"active"===a.type?0:"hidden"===document.visibilityState));if(a!==b._visible){b._visible=a;for(var g=0;g<b._visibilityCallbacks.length;g++)try{b._visibilityCallbacks[g].fn(a)}catch(m){}}}if(!b._visibilityBound){b._visibilityBound=!0;for(var d=null,c=["","moz","ms","webkit","o"],h=0;h<c.length;h++){var k=c[h];if((k?k+"Hidden":"hidden")in document){d=k?k+"visibilitychange":"visibilitychange";break}}d&&
|
|
7
|
+
document.addEventListener(d,a,!1);document.addEventListener("pause",a,!1);document.addEventListener("resume",a,!1);document.addEventListener("resign",a,!1);document.addEventListener("active",a,!1)}}function d(){b._unloadBound||(b._unloadBound=!0,b.onVisibilityChange(function(g){g?b._unloaded=!1:a()},"Metrics.unload"),window.addEventListener("pagehide",function(){a()}),window.addEventListener("pageshow",function(a){a.persisted&&(b._unloaded=!1)}))}function a(){if(!b._unloaded){b._unloaded=!0;var a=
|
|
8
|
+
Math.round((Date.now()-b._startTime)/1E3);b.send("unload:"+a+"s")}}var b=c.Metrics||{};c.Metrics=b;b._sessionKey="metrics_sid";b._visitorKey="metrics_vid";b._sid=null;b._vid=null;b.getSessionId=function(){if(b._sid)return b._sid;try{var a=sessionStorage.getItem(b._sessionKey);a||(a=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2),sessionStorage.setItem(b._sessionKey,a));b._sid=a}catch(p){b._sid=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}return b._sid};
|
|
9
|
+
b.getVisitorId=function(){if(b._vid)return b._vid;var a=null;try{return a=localStorage.getItem(b._visitorKey),a||(a=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),localStorage.setItem(b._visitorKey,a)),b._vid=a}catch(p){}try{return a=sessionStorage.getItem(b._visitorKey),a||(a=Math.random().toString(36).slice(2)+Date.now().toString(36)+Math.random().toString(36).slice(2),sessionStorage.setItem(b._visitorKey,a)),b._vid=a}catch(p){}a=Math.random().toString(36).slice(2)+
|
|
10
|
+
Date.now().toString(36)+Math.random().toString(36).slice(2);return b._vid=a};b._defaultEndpoint="https://invites.to/metrics";b._endpoint=null;b._page=null;b._extra=null;b._unloaded=!1;b._startTime=Date.now();b.send=function(a,d){if(b._endpoint&&!b._unloaded){a={session:b.getSessionId(),visitor:b.getVisitorId(),origin:location.origin,url:location.pathname+location.search+location.hash,page:b._page||document.title,label:a,t:Date.now()};b._extra&&(a.extra=b._extra);d&&(a.data=d);d=JSON.stringify(a);
|
|
11
|
+
try{navigator.sendBeacon?navigator.sendBeacon(b._endpoint,new Blob([d],{type:"text/plain"})):fetch(b._endpoint,{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:d})}catch(n){}}};b._visible=!0;b._visibilityCallbacks=[];b._visibilityBound=!1;b.isVisible=function(){return b._visible};b.onVisibilityChange=function(a,d){if(d)for(var c=0;c<b._visibilityCallbacks.length;c++)if(b._visibilityCallbacks[c].key===d){b._visibilityCallbacks[c].fn=a;return}b._visibilityCallbacks.push({fn:a,
|
|
12
|
+
key:d||null})};b._unloadBound=!1;b.init=function(a){a=a||{};b._endpoint=a.endpoint||b._defaultEndpoint;a.page&&(b._page=a.page);a.sessionKey&&(b._sessionKey=a.sessionKey);a.sessionId&&(b._sid=a.sessionId);a.extra&&(b._extra=a.extra);h();!1!==a.trackUnload&&d();a={referrer:document.referrer||"",screen:screen.width+"x"+screen.height,viewport:window.innerWidth+"x"+window.innerHeight,dpr:window.devicePixelRatio||1,lang:navigator.language||"",touch:"ontouchstart"in window||0<navigator.maxTouchPoints};
|
|
13
|
+
try{a.tz=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){}try{navigator.connection&&navigator.connection.effectiveType&&(a.conn=navigator.connection.effectiveType)}catch(n){}try{var c=performance.getEntriesByType("navigation");c&&c[0]&&(a.navType=c[0].type)}catch(n){}b.send("loaded",a);return b}})("undefined"!==typeof window?window:this);
|
|
14
|
+
"undefined"!==typeof Q&&function(c){function h(a){var b=location.hash||"#";a=b.queryField("v",a);a!==b&&history.replaceState(history.state,document.title,a)}var d=c.Metrics=c.plugins.Metrics=window.Metrics;d.setState=function(a,b){var g=c.info.url;d.setState.pending[g]=c.setTimeout(function(){d.setState.pending[g]&&(clearTimeout(d.setState.pending[g]),delete d.setState.pending[g]);c.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:c.info.url,state:a,extra:JSON.stringify(b)},
|
|
15
|
+
keepalive:!0})},5E3)};d.setState.pending={};c.extend.dontCopy["Q.Users.User"]=!0;c.text.Metrics={};c.onReady.add(function(){c.onVisibilityChange&&c.onVisibilityChange.set&&c.onVisibilityChange.set(function(a){if(d._visible!==a){d._visible=a;for(var b=0;b<d._visibilityCallbacks.length;b++)try{d._visibilityCallbacks[b].fn(a)}catch(k){}}},"Metrics");var a=c.getObject("Metrics.navigationTracker",c.plugins)||c.getObject("Metrics.navigationTracker",c);a&&d.NavigationTracker&&(a.page=a.page||c.info.url||
|
|
16
|
+
document.title,d.NavigationTracker.init(a));(a=c.getObject("Metrics.mediaTracker",c.plugins)||c.getObject("Metrics.mediaTracker",c))&&d.MediaTracker&&d.MediaTracker.init(a);var b=d.NavigationTracker;if(b){var g=null;c.Tool.onActivate("Q/tabs").set(function(){this.state.onCurrent.set(function(a,d){clearTimeout(g);g=setTimeout(function(){d&&b.state.initialized&&b.opened("tab:"+d)},300)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");c.Tool.onActivate("Q/columns").set(function(){this.state.onActivate.set(function(a,
|
|
17
|
+
d,c){b.state.initialized&&(a=a&&a.getAttribute("data-name")||"column-"+c,b.opened("column:"+a))},"Metrics.NavigationTracker");this.state.onClose.set(function(a,d){b.state.initialized&&(a=d&&d.getAttribute("data-name")||"column-"+a,b.closed("column:"+a))},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");c.Tool.onActivate("Q/expandable").set(function(){var a=this.element.id||this.element.getAttribute("data-name")||this.id;this.state.onExpand.set(function(){b.state.initialized&&b.opened("expandable:"+
|
|
18
|
+
a)},"Metrics.NavigationTracker");this.state.onCollapse.set(function(){b.state.initialized&&b.closed("expandable:"+a)},"Metrics.NavigationTracker")},"Metrics.NavigationTracker");if(c.Contextual){c.Contextual.onShow.set(function(a){if(b.state.initialized){var d=$(a).data("Q/contextual trigger");d=d&&d.attr("data-name")||d&&d.attr("id")||"contextual-"+c.Contextual.current;b.opened("contextual:"+d);(a=a.querySelector?a.querySelector(".Q_listing_wrapper, .Q_listing"):null)&&b.observeNavContainer(a)}},
|
|
19
|
+
"Metrics.NavigationTracker");c.Contextual.onHide.set(function(a){b.state.initialized&&b.state.activeSection&&0===b.state.activeSection.indexOf("contextual:")&&b.closed(b.state.activeSection)},"Metrics.NavigationTracker");var p=c.Contextual.itemSelectHandler;p&&(c.Contextual.itemSelectHandler=function(a,c){if(b.state.initialized){var g=a.getAttribute("data-action")||a.getAttribute("data-name")||(a.textContent||"").trim().slice(0,40);d.send("contextual-item:"+g)}return p.apply(this,arguments)})}}if(a=
|
|
20
|
+
location.hash.queryField("v"))h(a),c.req("Metrics/landed",{method:"POST",fields:{trackerId:"visitId:"+a}},function(a,b){a?window.console&&console.error("Metrics landed request failed",a):b&&b.slots&&b.slots.visitId&&h(b.slots.visitId)})},"Metrics");(function(){function a(a,d){var b="",g="";if(a instanceof Error)b=a.message,g=a.stack;else if("string"===typeof a)b=a;else if(a&&"object"===typeof a)try{var h=JSON.stringify(a)}catch(k){h="[unserializable reason]"}g={message:b||"",stack:g||"",url:location.href,
|
|
21
|
+
userAgent:navigator.userAgent,timestamp:Date.now(),performanceNow:performance.now()};h&&(g.details=h);g=JSON.stringify({error:g});c.req("Metrics/update",[],null,{method:"POST",fields:{navigatorUrl:location.href,url:c.info&&c.info.url,state:"error",extra:g},keepalive:!0});console.warn(d?"Unhandled rejection:":"Unhandled error:",a);b&&/indexedDB/i.test(b)&&console.warn("[Recovery] Error suggests IndexedDB corruption. Triggering recovery...")}window.addEventListener("unhandledrejection",function(b){a(b.reason,
|
|
22
|
+
!0)});window.addEventListener("error",function(b){a(b.error||b.message,!1)})})()}(Q);"use strict";
|
|
23
|
+
(function(c){function h(a){a=document.querySelectorAll(a);for(var b=[],d=0,c=k.options&&k.options.minSectionHeight||0,g=0;g<a.length;g++){var h=a[g];if(!(h.offsetHeight<c)){if(!h.id){var t=(h.textContent||"").trim().slice(0,60).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");h.id=t||"section-"+d}b.push({el:h,id:h.id,tag:h.tagName.toLowerCase(),ordinal:d++,snippet:(h.textContent||"").trim().slice(0,80)})}}return b}function d(){var a=k.options,b=window.scrollY||window.pageYOffset;if(Math.abs(b-
|
|
24
|
+
k._prevY)>a.settleTolerance)k._prevY=b,k.scrollTimer=setTimeout(d,a.recheckInterval);else{var c=window.scrollY||window.pageYOffset;for(var g=k.options,f=null,h=Infinity,t=0;t<k.sections.length;t++){var l=k.sections[t],e=l.el.offsetTop;e<=c+g.sectionLookback&&(e=Math.abs(e-c-180),e<h&&(h=e,f=l))}(c=f)&&!k.seen[c.id]&&(k.seen[c.id]=!0,n.send("section:"+c.id,{tag:c.tag,ordinal:c.ordinal,snippet:c.snippet}));c=document.documentElement.scrollHeight-window.innerHeight;if(0<c)for(b=Math.round(b/c*100),c=
|
|
25
|
+
0;c<a.depthMilestones.length;c++)g=a.depthMilestones[c],b>=g&&!k.depthHit[g]&&(k.depthHit[g]=!0,n.send("depth:"+g+"%"))}}function a(){k.anchorCooling||(clearTimeout(k.scrollTimer),k._prevY=window.scrollY||window.pageYOffset,k.scrollTimer=setTimeout(d,k.options.debounce))}function b(){var a=k.options;if(a.tocSelector){for(var b=window.scrollY||window.pageYOffset,d="",c=0;c<k.tocSections.length;c++)b>=k.tocSections[c].el.offsetTop-160&&(d=k.tocSections[c].id);b=document.querySelectorAll(a.tocSelector);
|
|
26
|
+
for(c=0;c<b.length;c++)b[c].classList.remove(a.tocActiveClass),b[c].getAttribute("href")==="#"+d&&b[c].classList.add(a.tocActiveClass)}}function g(a){if(a=a.target.closest("a[href]")){var b=a.getAttribute("href")||"";"#"===b.charAt(0)?(k.anchorCooling=!0,setTimeout(function(){k.anchorCooling=!1},k.options.anchorCooldown),n.send("anchor:"+b.slice(1))):n.send(a.dataset.track||"link:"+b)}}function p(){for(var a=window.scrollY||window.pageYOffset,b=0;b<k.sections.length;b++){var c=k.sections[b].el.getBoundingClientRect();
|
|
27
|
+
-100<=c.top&&c.top<window.innerHeight&&(k.seen[k.sections[b].id]=!0)}b=document.documentElement.scrollHeight-window.innerHeight;if(0<b)for(a=Math.round(a/b*100),b=0;b<k.options.depthMilestones.length;b++)c=k.options.depthMilestones[b],a>=c&&(k.depthHit[c]=!0)}var n=c.Metrics;if(n){var r={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,
|
|
28
|
+
trackClicks:!0,tocSelector:null,tocActiveClass:"active",tocSectionSelector:"h2[id]"},k={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1};n.ScrollTracker={init:function(c){if(k.initialized)return console.warn("Metrics.ScrollTracker already initialized"),this;var d={},m;for(m in r)r.hasOwnProperty(m)&&(d[m]=r[m]);for(m in c||{})c.hasOwnProperty(m)&&void 0!==c[m]&&(d[m]=c[m]);k.options=d;k.initialized=!0;!n._endpoint&&c&&c.endpoint&&
|
|
29
|
+
n.init({endpoint:c.endpoint,page:c.page,sessionKey:c.sessionKey,sessionId:c.sessionId,extra:c.extra,trackUnload:c.trackUnload});setTimeout(function(){k.sections=h(d.sections);d.tocSelector&&d.tocSectionSelector&&(k.tocSections=h(d.tocSectionSelector));p();window.addEventListener("scroll",a,{passive:!0});d.tocSelector&&(window.addEventListener("scroll",b,{passive:!0}),b())},d.initDelay);d.trackClicks&&document.addEventListener("click",g);return this},send:function(a,b){n.send(a,b)},markSeen:function(a){k.seen[a]=
|
|
30
|
+
!0},getSessionId:function(){return n.getSessionId()},getSections:function(){return k.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 k.seen)a[b]=!0;return a},reset:function(){k.seen={};k.depthHit={};k.anchorCooling=!1;clearTimeout(k.scrollTimer);k.sections=h(k.options.sections);p()},destroy:function(){window.removeEventListener("scroll",a);window.removeEventListener("scroll",b);document.removeEventListener("click",g);
|
|
31
|
+
clearTimeout(k.scrollTimer);k.initialized=!1},defaults:r,state:k}}else console.warn("Metrics.ScrollTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
32
|
+
(function(c){function h(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}function d(a){a=document.querySelectorAll(a);for(var b=[],e=0,c=f.options&&f.options.minSectionHeight||0,d=0;d<a.length;d++){var g=a[d];g.offsetHeight<c||(g.id||(g.id=h(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 a(){var b=f.options,c=window.scrollY||window.pageYOffset;if(Math.abs(c-
|
|
33
|
+
f._prevY)>b.settleTolerance)f._prevY=c,f.scrollTimer=setTimeout(a,b.recheckInterval);else{var e=window.scrollY||window.pageYOffset;for(var d=f.options,y=null,g=Infinity,x=0;x<f.sections.length;x++){var h=f.sections[x],k=h.el.offsetTop;k<=e+d.sectionLookback&&(k=Math.abs(k-e-180),k<g&&(g=k,y=h))}(e=y)&&!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=
|
|
34
|
+
0;e<b.depthMilestones.length;e++)d=b.depthMilestones[e],c>=d&&!f.depthHit[d]&&(f.depthHit[d]=!0,m.send("depth:"+d+"%"))}}function b(){f.anchorCooling||(clearTimeout(f.scrollTimer),f._prevY=window.scrollY||window.pageYOffset,f.scrollTimer=setTimeout(a,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);
|
|
35
|
+
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 p(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=
|
|
36
|
+
f.dynamicSections[f.activeSection];m.send("dwell:"+f.activeSection,{seconds:a,name:b?b.name:f.activeSection})}f.activeSection=null;f.activeSince=null}}function r(a,b){var e=b.id||a.id||a.getAttribute("data-section")||a.getAttribute("data-track-section")||h(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()};
|
|
37
|
+
window.IntersectionObserver&&!1!==b.autoTrack&&(b=new IntersectionObserver(function(a){a.forEach(function(a){a.isIntersecting&&.3<a.intersectionRatio?q.opened(e):a.isIntersecting||f.activeSection!==e||q.closed(e)})},{threshold:[0,.3]}),b.observe(a),f.dynamicSections[e]._io=b);return e}function k(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")||
|
|
38
|
+
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 w(){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===
|
|
39
|
+
a.nodeType&&(a.matches&&a.matches(b)&&r(a,{}),a.querySelectorAll)){a=a.querySelectorAll(b);for(var e=0;e<a.length;e++)r(a[e],{})}})})});f._mutationObserver.observe(a,{childList:!0,subtree:!0})}}function u(){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=
|
|
40
|
+
f.options.depthMilestones[b],a>=e&&(f.depthHit[e]=!0)}var m=c.Metrics;if(m){var v={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]"},
|
|
41
|
+
f={initialized:!1,options:null,sections:[],tocSections:[],seen:{},depthHit:{},scrollTimer:null,anchorCooling:!1,_prevY:-1,dynamicSections:{},activeSection:null,activeSince:null,_mutationObserver:null,_navObservers:[],_navLinksSeen:{}},q={init:function(a){if(f.initialized)return console.warn("Metrics.NavigationTracker already initialized"),this;var c={},e;for(e in v)v.hasOwnProperty(e)&&(c[e]=v[e]);for(e in a||{})a.hasOwnProperty(e)&&void 0!==a[e]&&(c[e]=a[e]);f.options=c;f.initialized=!0;!m._endpoint&&
|
|
42
|
+
a&&a.endpoint&&m.init({endpoint:a.endpoint,page:a.page,sessionKey:a.sessionKey,sessionId:a.sessionId,extra:a.extra,trackUnload:a.trackUnload});setTimeout(function(){f.sections=d(c.sections);c.tocSelector&&c.tocSectionSelector&&(f.tocSections=d(c.tocSectionSelector));u();window.addEventListener("scroll",b,{passive:!0});c.tocSelector&&(window.addEventListener("scroll",g,{passive:!0}),g());c.observeDom&&w();if(c.navContainers){var a=f.options.navContainers;if(a&&window.IntersectionObserver){a=document.querySelectorAll(a);
|
|
43
|
+
for(var e=0;e<a.length;e++)k(a[e])}}},c.initDelay);c.trackClicks&&document.addEventListener("click",p);if(c.trackDwell)m.onVisibilityChange(function(a){a||n()},"NavigationTracker.dwell");return this},observe:function(a,b){return r(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:
|
|
44
|
+
""})}},closed:function(a){f.activeSection===a&&n()},observeNavContainer:function(a){k(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=
|
|
45
|
+
{},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=d(f.options.sections);u()},destroy:function(){n();
|
|
46
|
+
window.removeEventListener("scroll",b);window.removeEventListener("scroll",g);document.removeEventListener("click",p);clearTimeout(f.scrollTimer);f._mutationObserver&&(f._mutationObserver.disconnect(),f._mutationObserver=null);for(var a in f.dynamicSections)f.dynamicSections[a]._io&&f.dynamicSections[a]._io.disconnect();for(a=0;a<f._navObservers.length;a++)f._navObservers[a].disconnect();f._navObservers=[];f.initialized=!1},defaults:v,state:f};m.NavigationTracker=q;m.SectionTracker=q;m.ScrollTracker=
|
|
47
|
+
q}else console.warn("Metrics.NavigationTracker: Metrics core not loaded")})("undefined"!==typeof window?window:this);"use strict";
|
|
48
|
+
(function(c){function h(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 d(){this.ranges=[]}function a(a,b,c,g){return{id:a,type:b,el:c,duration:g||0,playing:!1,lastPosition:0,lastCheckpointAt:0,watched:new d,checkpointTimer:null,_lastTimeUpdate:0}}function b(a,b,c){var e={type:a.type,
|
|
49
|
+
position:Math.round(a.lastPosition),duration:Math.round(a.duration),watched:a.watched.total()};if(c)for(var d in c)e[d]=c[d];q.send(b+":"+a.id,e)}function g(a){p(a);a.checkpointTimer=setInterval(function(){a.playing&&b(a,"media-checkpoint")},1E3*l.options.checkpointInterval)}function p(a){a.checkpointTimer&&(clearInterval(a.checkpointTimer),a.checkpointTimer=null)}function n(c){var d=h(c);if(!l.tracked[d]){var e=a(d,"native",c,c.duration||0);l.tracked[d]=e;c.addEventListener("loadedmetadata",function(){e.duration=
|
|
50
|
+
c.duration||0});c.addEventListener("play",function(){e.playing=!0;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;b(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,p(e),b(e,"media-pause"))});c.addEventListener("ended",function(){e.playing=!1;e.watched.add(e._lastTimeUpdate,c.currentTime);e.lastPosition=c.currentTime;p(e);b(e,"media-ended")});c.addEventListener("seeked",function(){var a=
|
|
51
|
+
e.lastPosition;e.lastPosition=c.currentTime;e._lastTimeUpdate=c.currentTime;b(e,"media-seeked",{from:Math.round(a),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 r(a){if(l._ytApiLoaded)a();else if(l._ytApiLoading)l._ytPendingPlayers.push(a);else{l._ytApiLoading=!0;var b=c.onYouTubeIframeAPIReady;c.onYouTubeIframeAPIReady=
|
|
52
|
+
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 e=document.createElement("script");e.src="https://www.youtube.com/iframe_api";document.head.appendChild(e)}}function k(c){var e=c.src||"",d=h(c);if(!l.tracked[d]){if(-1===e.indexOf("enablejsapi"))if(l.options.reloadIframes){var f=-1===e.indexOf("?")?"?":"&";c.src=e+f+"enablejsapi=1&origin="+encodeURIComponent(location.origin)}else{console.warn("Metrics.MediaTracker: YouTube iframe missing enablejsapi=1, set reloadIframes:true to auto-fix. iframe:",
|
|
53
|
+
c);return}c.id||(c.id="yt-"+d);r(function(){if(!l.tracked[d]){var e=a(d,"youtube",c,0);l.tracked[d]=e;var f=new YT.Player(c.id,{events:{onReady:function(a){e.duration=f.getDuration()||0},onStateChange:function(a){var c=f.getCurrentTime()||0;e.lastPosition=c;switch(a.data){case YT.PlayerState.PLAYING:e.playing=!0;e._lastTimeUpdate=c;e.duration=f.getDuration()||e.duration;b(e,"media-play");g(e);e._pollTimer=setInterval(function(){var a=f.getCurrentTime()||0;e.playing&&a>e._lastTimeUpdate&&e.watched.add(e._lastTimeUpdate,
|
|
54
|
+
a);e._lastTimeUpdate=a;e.lastPosition=a},1E3);break;case YT.PlayerState.PAUSED:if(!e.playing)break;e.playing=!1;e.watched.add(e._lastTimeUpdate,c);p(e);clearInterval(e._pollTimer);b(e,"media-pause");break;case YT.PlayerState.ENDED:e.playing=!1,e.watched.add(e._lastTimeUpdate,c),p(e),clearInterval(e._pollTimer),b(e,"media-ended")}}}});e._player=f}})}}function w(a){if(l._vimeoApiLoaded)a();else if(l._vimeoApiLoading)setTimeout(function(){w(a)},200);else{l._vimeoApiLoading=!0;var b=document.createElement("script");
|
|
55
|
+
b.src="https://player.vimeo.com/api/player.js";b.onload=function(){l._vimeoApiLoaded=!0;l._vimeoApiLoading=!1;a()};document.head.appendChild(b)}}function u(c){var e=h(c);l.tracked[e]||w(function(){if(!l.tracked[e]){var d=a(e,"vimeo",c,0);l.tracked[e]=d;var f=new Vimeo.Player(c);d._player=f;f.getDuration().then(function(a){d.duration=a||0});f.on("play",function(a){d.playing=!0;d.lastPosition=a.seconds||0;d._lastTimeUpdate=d.lastPosition;d.duration=a.duration||d.duration;b(d,"media-play");g(d)});f.on("pause",
|
|
56
|
+
function(a){d.playing&&(d.playing=!1,a=a.seconds||0,d.watched.add(d._lastTimeUpdate,a),d.lastPosition=a,p(d),b(d,"media-pause"))});f.on("ended",function(a){d.playing=!1;a=a.seconds||d.duration;d.watched.add(d._lastTimeUpdate,a);d.lastPosition=a;p(d);b(d,"media-ended")});f.on("seeked",function(a){var c=d.lastPosition;d.lastPosition=a.seconds||0;d._lastTimeUpdate=d.lastPosition;b(d,"media-seeked",{from:Math.round(c),to:Math.round(d.lastPosition)})});f.on("timeupdate",function(a){a=a.seconds||0;d.playing&&
|
|
57
|
+
a>d._lastTimeUpdate&&d.watched.add(d._lastTimeUpdate,a);d._lastTimeUpdate=a;d.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)?k(a[b]):/player\.vimeo\.com/.test(c)?u(a[b]):/w\.soundcloud\.com\/player/.test(c)?trackSoundCloud(a[b]):/dailymotion\.com\/embed/.test(c)?trackDailymotion(a[b]):
|
|
58
|
+
/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 v(){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===
|
|
59
|
+
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)?k(a):/player\.vimeo\.com/.test(b)?u(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&&
|
|
60
|
+
/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)?k(c[d]):/player\.vimeo\.com/.test(b)?u(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]):
|
|
61
|
+
/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 a in l.tracked){var c=l.tracked[a];c.playing&&("native"===c.type&&c.el&&(c.watched.add(c._lastTimeUpdate,c.el.currentTime||c.lastPosition),c.lastPosition=c.el.currentTime||
|
|
62
|
+
c.lastPosition),b(c,"media-checkpoint"))}}var q=c.Metrics;if(q){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};d.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=
|
|
63
|
+
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}};d.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};q.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)&&
|
|
64
|
+
void 0!==a[c]&&(b[c]=a[c]);l.options=b;l.initialized=!0;!q._endpoint&&a&&a.endpoint&&q.init({endpoint:a.endpoint,page:a.page,trackUnload:a.trackUnload});b.autoDiscover&&setTimeout(function(){m()},500);b.observeDom&&v();q.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);k(a)},trackVimeo:function(a,b){b&&(a.id=b);u(a)},trackSoundCloud:function(a,b){b&&(a.id=b);trackSoundCloud(a)},trackWistia:function(a,
|
|
73
65
|
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:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];
|
|
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(
|
|
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){}}};
|
|
66
|
+
watched:c.watched.total()}}return a},flush:f,rescan:m,destroy:function(){for(var a in l.tracked){var b=l.tracked[a];p(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);
|
|
67
|
+
function loadSoundCloudAPI(c){if(root.SC&&root.SC.Widget)c();else{var h=document.createElement("script");h.src="https://w.soundcloud.com/player/api.js";h.onload=c;document.head.appendChild(h)}}
|
|
68
|
+
function trackSoundCloud(c){var h=genId(c);state.tracked[h]||loadSoundCloudAPI(function(){if(!state.tracked[h]){var d=SC.Widget(c),a=createTracker(h,"soundcloud",c,0);state.tracked[h]=a;d.bind(SC.Widget.Events.READY,function(){d.getDuration(function(b){a.duration=(b||0)/1E3})});d.bind(SC.Widget.Events.PLAY,function(){a.playing=!0;d.getPosition(function(b){a.lastPosition=(b||0)/1E3;a._lastTimeUpdate=a.lastPosition;sendEvent(a,"media-play");startCheckpoints(a)})});d.bind(SC.Widget.Events.PAUSE,function(){a.playing&&
|
|
69
|
+
(a.playing=!1,d.getPosition(function(b){b=(b||0)/1E3;a.watched.add(a._lastTimeUpdate,b);a.lastPosition=b;stopCheckpoints(a);sendEvent(a,"media-pause")}))});d.bind(SC.Widget.Events.FINISH,function(){a.playing=!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")});d.bind(SC.Widget.Events.SEEK,function(b){var c=a.lastPosition;a.lastPosition=(b.currentPosition||0)/1E3;a._lastTimeUpdate=a.lastPosition;sendEvent(a,"media-seeked",{from:Math.round(c),
|
|
70
|
+
to:Math.round(a.lastPosition)})});d.bind(SC.Widget.Events.PLAY_PROGRESS,function(b){b=(b.currentPosition||0)/1E3;a.playing&&b>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,b);a._lastTimeUpdate=b;a.lastPosition=b})}})}
|
|
71
|
+
function trackWistia(c){var h=genId(c);if(!state.tracked[h]){var d=c.getAttribute("data-wistia-id")||(c.className.match(/wistia_async_(\w+)/)||[])[1]||h;root._wq=root._wq||[];root._wq.push({id:d,onReady:function(a){if(!state.tracked[h]){var b=createTracker(h,"wistia",c,a.duration()||0);state.tracked[h]=b;b._player=a;a.bind("play",function(){b.playing=!0;b.lastPosition=a.time();b._lastTimeUpdate=b.lastPosition;b.duration=a.duration()||b.duration;sendEvent(b,"media-play");startCheckpoints(b)});a.bind("pause",
|
|
72
|
+
function(){if(b.playing){b.playing=!1;var c=a.time();b.watched.add(b._lastTimeUpdate,c);b.lastPosition=c;stopCheckpoints(b);sendEvent(b,"media-pause")}});a.bind("end",function(){b.playing=!1;b.watched.add(b._lastTimeUpdate,b.duration);b.lastPosition=b.duration;stopCheckpoints(b);sendEvent(b,"media-ended")});a.bind("seek",function(a,c){b.lastPosition=a;b._lastTimeUpdate=a;sendEvent(b,"media-seeked",{from:Math.round(c),to:Math.round(a)})});a.bind("secondchange",function(a){b.playing&&a>b._lastTimeUpdate&&
|
|
73
|
+
b.watched.add(b._lastTimeUpdate,a);b._lastTimeUpdate=a;b.lastPosition=a})}}});root.Wistia||(d=document.createElement("script"),d.src="https://fast.wistia.com/assets/external/E-v1.js",d.async=!0,document.head.appendChild(d))}}
|
|
74
|
+
function trackJWPlayer(c){function h(){if(!root.jwplayer||"function"!==typeof root.jwplayer)return!1;try{var b=jwplayer(a)}catch(p){return!1}if(!b||!b.getState)return!1;var g=createTracker(d,"jwplayer",c,b.getDuration()||0);state.tracked[d]=g;g._player=b;b.on("play",function(){g.playing=!0;g.lastPosition=b.getPosition();g._lastTimeUpdate=g.lastPosition;g.duration=b.getDuration()||g.duration;sendEvent(g,"media-play");startCheckpoints(g)});b.on("pause",function(){if(g.playing){g.playing=!1;var a=b.getPosition();
|
|
75
|
+
g.watched.add(g._lastTimeUpdate,a);g.lastPosition=a;stopCheckpoints(g);sendEvent(g,"media-pause")}});b.on("complete",function(){g.playing=!1;g.watched.add(g._lastTimeUpdate,g.duration);g.lastPosition=g.duration;stopCheckpoints(g);sendEvent(g,"media-ended")});b.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)})});b.on("time",function(a){var b=a.position;g.playing&&b>g._lastTimeUpdate&&g.watched.add(g._lastTimeUpdate,
|
|
76
|
+
b);g._lastTimeUpdate=b;g.lastPosition=b;g.duration=a.duration||g.duration});return!0}var d=genId(c);if(!state.tracked[d]){var a=c.id||d;h()||setTimeout(function(){h()},2E3)}}
|
|
77
|
+
function trackDailymotion(c){function h(){if(!state.tracked[d]){var a=createTracker(d,"dailymotion",c,0);state.tracked[d]=a;var b=DM.player(c,{events:{playing:function(){a.playing=!0;a.lastPosition=b.currentTime||0;a._lastTimeUpdate=a.lastPosition;a.duration=b.duration||a.duration;sendEvent(a,"media-play");startCheckpoints(a)},pause:function(){if(a.playing){a.playing=!1;var c=b.currentTime||0;a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);sendEvent(a,"media-pause")}},end:function(){a.playing=
|
|
78
|
+
!1;a.watched.add(a._lastTimeUpdate,a.duration);a.lastPosition=a.duration;stopCheckpoints(a);sendEvent(a,"media-ended")},seeking:function(){var c=a.lastPosition;a.lastPosition=b.currentTime||0;a._lastTimeUpdate=a.lastPosition;sendEvent(a,"media-seeked",{from:Math.round(c),to:Math.round(a.lastPosition)})},timeupdate:function(){var c=b.currentTime||0;a.playing&&c>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,c);a._lastTimeUpdate=c;a.lastPosition=c;a.duration=b.duration||a.duration}}});a._player=
|
|
79
|
+
b}}var d=genId(c);state.tracked[d]||function(){if(root.DM&&root.DM.player)h();else{var a=document.createElement("script");a.src="https://api.dmcdn.net/all.js";a.onload=function(){h()};document.head.appendChild(a)}}()}
|
|
80
|
+
function trackSpotify(c){var h=genId(c);if(!state.tracked[h]){var d=createTracker(h,"spotify",c,0);state.tracked[h]=d;window.addEventListener("message",function(a){if(a.data&&a.source===c.contentWindow){try{var b="string"===typeof a.data?JSON.parse(a.data):a.data}catch(p){return}if(b.type&&"playback_update"===b.type){a=b.payload&&b.payload.position||0;a/=1E3;var g=b.payload&&b.payload.isPaused;d.duration=(b.payload&&b.payload.duration||0)/1E3||d.duration;g||d.playing?g&&d.playing?(d.playing=!1,d.watched.add(d._lastTimeUpdate,
|
|
81
|
+
a),d.lastPosition=a,stopCheckpoints(d),sendEvent(d,"media-pause")):!g&&d.playing&&a>d._lastTimeUpdate&&(d.watched.add(d._lastTimeUpdate,a),d._lastTimeUpdate=a,d.lastPosition=a):(d.playing=!0,d.lastPosition=a,d._lastTimeUpdate=a,sendEvent(d,"media-play"),startCheckpoints(d))}}})}}
|
|
82
|
+
function trackTwitch(c){function h(){if(!state.tracked[d]){c.id||(c.id="twitch-"+d);var a=createTracker(d,"twitch",c,0);state.tracked[d]=a;var b=new Twitch.Player(c.id,{});a._player=b;b.addEventListener(Twitch.Player.PLAY,function(){a.playing=!0;a.lastPosition=b.getCurrentTime()||0;a._lastTimeUpdate=a.lastPosition;a.duration=b.getDuration()||a.duration;sendEvent(a,"media-play");startCheckpoints(a);a._pollTimer=setInterval(function(){var c=b.getCurrentTime()||0;a.playing&&c>a._lastTimeUpdate&&a.watched.add(a._lastTimeUpdate,
|
|
83
|
+
c);a._lastTimeUpdate=c;a.lastPosition=c},1E3)});b.addEventListener(Twitch.Player.PAUSE,function(){if(a.playing){a.playing=!1;var c=b.getCurrentTime()||0;a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-pause")}});b.addEventListener(Twitch.Player.ENDED,function(){a.playing=!1;var c=b.getCurrentTime()||a.duration;a.watched.add(a._lastTimeUpdate,c);a.lastPosition=c;stopCheckpoints(a);clearInterval(a._pollTimer);sendEvent(a,"media-ended")})}}
|
|
84
|
+
var d=genId(c);state.tracked[d]||function(){if(root.Twitch&&root.Twitch.Player)h();else{var a=document.createElement("script");a.src="https://player.twitch.tv/js/embed/v1.js";a.onload=function(){h()};document.head.appendChild(a)}}()}
|
|
85
|
+
function trackMuseAi(c){var h=genId(c);if(!state.tracked[h]){var d=createTracker(h,"museai",c,0);state.tracked[h]=d;window.addEventListener("message",function(a){if(a.data&&a.source===c.contentWindow){try{var b="string"===typeof a.data?JSON.parse(a.data):a.data}catch(g){return}"play"===b.event?(d.playing=!0,d.lastPosition=b.currentTime||0,d._lastTimeUpdate=d.lastPosition,d.duration=b.duration||d.duration,sendEvent(d,"media-play"),startCheckpoints(d)):"pause"===b.event?d.playing&&(d.playing=!1,a=b.currentTime||
|
|
86
|
+
0,d.watched.add(d._lastTimeUpdate,a),d.lastPosition=a,stopCheckpoints(d),sendEvent(d,"media-pause")):"ended"===b.event?(d.playing=!1,d.watched.add(d._lastTimeUpdate,d.duration),d.lastPosition=d.duration,stopCheckpoints(d),sendEvent(d,"media-ended")):"timeupdate"===b.event&&(a=b.currentTime||0,d.duration=b.duration||d.duration,d.playing&&a>d._lastTimeUpdate&&d.watched.add(d._lastTimeUpdate,a),d._lastTimeUpdate=a,d.lastPosition=a)}});try{c.contentWindow.postMessage({method:"addEventListener",value:"play"},
|
|
87
|
+
"*")}catch(a){}try{c.contentWindow.postMessage({method:"addEventListener",value:"pause"},"*")}catch(a){}try{c.contentWindow.postMessage({method:"addEventListener",value:"ended"},"*")}catch(a){}try{c.contentWindow.postMessage({method:"addEventListener",value:"timeupdate"},"*")}catch(a){}}};
|