"use strict";var gtm4wp_vimeo_percentage_tracking=10,gtm4wp_vimeo_percentage_tracking_marks={};window.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll('iframe[src*="vimeo.com"]');e&&0!=e.length&&e.forEach(function(i){var a=new Vimeo.Player(i),r=i.getAttribute("src").split("?").shift(),n=r.split("/").pop(),t=(i.setAttribute("data-player_id",n),i.setAttribute("data-player_url",r),a.getVideoTitle().then(function(e){i.setAttribute("data-player_title",e),a.getDuration().then(function(e){i.setAttribute("data-player_duration",e),window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerReady",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:r,duration:e},mediaCurrentTime:0})}).catch(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:r,duration:0},mediaCurrentTime:0,mediaPlayerEvent:"error",mediaPlayerEventParam:e})})}).catch(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:"Unknown title",url:r,duration:0},mediaCurrentTime:0,mediaPlayerEvent:"error",mediaPlayerEventParam:e})}),a.on("play",function(e){t("play",e)}),a.on("pause",function(e){t("pause",e)}),a.on("ended",function(e){t("ended",e)}),a.on("seeked",function(e){t("seeked",e)}),a.on("texttrackchange",function(t){a.getCurrentTime().then(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:i.getAttribute("data-player_url"),duration:i.getAttribute("data-player_duration")},mediaPlayerEvent:"texttrackchange",mediaPlayerEventParam:t,mediaCurrentTime:e})}).catch(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:"Unknown title",url:r,duration:i.getAttribute("data-player_duration")},mediaCurrentTime:0,mediaPlayerEvent:"error",mediaPlayerEventParam:e})})}),a.on("volumechange",function(t){a.getCurrentTime().then(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:i.getAttribute("data-player_url"),duration:i.getAttribute("data-player_duration")},mediaPlayerEvent:"volumechange",mediaPlayerEventParam:t.volume,mediaCurrentTime:e})}).catch(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:"Unknown title",url:r,duration:i.getAttribute("data-player_duration")},mediaCurrentTime:0,mediaPlayerEvent:"error",mediaPlayerEventParam:e})})}),a.on("error",function(t){a.getCurrentTime().then(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:i.getAttribute("data-player_url"),duration:i.getAttribute("data-player_duration")},mediaPlayerEvent:"error",mediaPlayerEventParam:t,mediaCurrentTime:e})}).catch(function(e){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerEvent",mediaType:"vimeo",mediaData:{id:n,author:"",title:"Unknown title",url:r,duration:i.getAttribute("data-player_duration")},mediaCurrentTime:0,mediaPlayerEvent:"error",mediaPlayerEventParam:e})})}),a.on("timeupdate",function(e){d(e)}),function(e,t){window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlayerStateChange",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:i.getAttribute("data-player_url"),duration:t.duration},mediaPlayerState:e,mediaCurrentTime:t.seconds})}),d=function(e){var t=e.duration,a=Math.floor(e.seconds/t*100);void 0===gtm4wp_vimeo_percentage_tracking_marks[n]&&(gtm4wp_vimeo_percentage_tracking_marks[n]=[]);for(var r=0;r<100;r+=gtm4wp_vimeo_percentage_tracking)r<a&&-1==gtm4wp_vimeo_percentage_tracking_marks[n].indexOf(r)&&(gtm4wp_vimeo_percentage_tracking_marks[n].push(r),window[gtm4wp_datalayer_name].push({event:"gtm4wp.mediaPlaybackPercentage",mediaType:"vimeo",mediaData:{id:n,author:"",title:i.getAttribute("data-player_title"),url:i.getAttribute("data-player_url"),duration:t},mediaCurrentTime:e.seconds,mediaPercentage:r}))}})});