var fadeElements=document.querySelectorAll(".FadeElement"),fadeElementsAlt=document.querySelectorAll(".FadeElementAlt"),fadeElementsAltWrap=document.querySelectorAll(".FadeElementAltWrap"),fadeOffsetElements=document.querySelectorAll(".FadeOffsetElement"),siteHeader=document.querySelector(".SiteHeader");
function fadeElementsInit() {
  for(i=0;
  i<fadeElements.length;
  ++i) {
    var e=fadeElements[i].getBoundingClientRect();
    (t=window.innerHeight-e.top)<.05*window.innerHeight&&fadeElements[i].classList.add("FadeElement--hidden")
  }
  for(i=0;
  i<fadeElementsAlt.length;
  ++i) {
    e=fadeElementsAlt[i].getBoundingClientRect();
    (t=window.innerHeight-e.top)<.05*window.innerHeight&&fadeElementsAlt[i].classList.add("FadeElementAlt--hidden")
  }
  for(i=0;
  i<fadeElementsAltWrap.length;
  ++i) {
    e=fadeElementsAltWrap[i].getBoundingClientRect();
    var t=window.innerHeight-e.top,n=fadeElementsAltWrap[i].children;
    if(t<.1*window.innerHeight)for(var o=0;
    o<n.length;
    o++)n[o].classList.add("FadeElementAltWrap--hidden")
  }
}
function fadeInOnScroll() {
  for(i=0;
  i<fadeElements.length;
  ++i) {
    var e=fadeElements[i].getBoundingClientRect();
    (t=window.innerHeight-e.top)>.05*window.innerHeight&&fadeElements[i].classList.remove("FadeElement--hidden")
  }
  for(i=0;
  i<fadeElementsAlt.length;
  ++i) {
    e=fadeElementsAlt[i].getBoundingClientRect();
    (t=window.innerHeight-e.top)>.05*window.innerHeight&&fadeElementsAlt[i].classList.remove("FadeElementAlt--hidden")
  }
  for(i=0;
  i<fadeElementsAltWrap.length;
  ++i) {
    e=fadeElementsAltWrap[i].getBoundingClientRect();
    var t=window.innerHeight-e.top,n=fadeElementsAltWrap[i].children;
    if(t>.1*window.innerHeight)for(var o=0;
    o<n.length;
    o++)n[o].classList.remove("FadeElementAltWrap--hidden")
  }
}
function relativeFadeOffset() {
  for(i=0;
  i<fadeOffsetElements.length;
  ++i) {
    var e=fadeOffsetElements[i].getBoundingClientRect(),t=window.innerHeight-e.top,n=(window.innerHeight-e.top)/window.innerHeight;
    t>.15*window.innerHeight&&(fadeOffsetElements[i].style.opacity=4*n,fadeOffsetElements[i].style.transform="translateY("+-100*n+"px)")
  }
}
document.addEventListener("DOMContentLoaded",function() {
  fadeElementsInit(),window.addEventListener("scroll",fadeInOnScroll)
});
var lastScrollTop=0;
document.addEventListener("DOMContentLoaded",function() {
  if(document.getElementById("PromoBar")) {
    var e=document.getElementById("PromoBar");
    document.getElementById("PromoBar__dismiss").addEventListener("click",function(t) {
      t.preventDefault(),e.classList.add("PromoBar--dismissed")
    }),e.classList.contains("PromoBar--hideOnScroll")&&window.addEventListener("scroll",function() {
      var t=window.pageYOffset||document.documentElement.scrollTop;
      t>lastScrollTop&&t>25?e.classList.add("PromoBar--hidden"):e.classList.remove("PromoBar--hidden"),lastScrollTop=t
    })
  }
});
var pressPagers=document.querySelectorAll(".HomePress__pagination .HomePress__pager"),featuredPagers=document.querySelectorAll(".HomeFeatured__pagination .HomeFeatured__pager");
if(document.addEventListener("DOMContentLoaded",function() {
  new Swiper(".HomeFeatured__carousel", {
    loop:!0,grabCursor:!0,speed:400,spaceBetween:100,effect:"fade",fadeEffect: {
      crossFade:!0
    },autoplay: {
      delay:8e3
    },pagination: {
      el:".HomeFeatured__pagination",type:"custom",clickable:!0,bulletClass:"HomeFeatured__pager"
    },on: {
      slideChangeTransitionStart:function() {
        var e=parseInt(document.querySelector(".HomeFeatured__carousel .swiper-slide-active").dataset.swiperSlideIndex);
        for(i=0;
        i<featuredPagers.length;
        ++i)i!==e?featuredPagers[i].classList.remove("HomeFeatured__pager--active"):featuredPagers[i].classList.add("HomeFeatured__pager--active")
      }
    }
  }),new Swiper(".HomePress__carousel", {
    loop:!0,grabCursor:!0,speed:400,spaceBetween:100,effect:"fade",fadeEffect: {
      crossFade:!0
    },autoplay: {
      delay:8e3
    },pagination: {
      el:".HomePress__pagination",type:"custom",clickable:!0,bulletClass:"HomePress__pager"
    },on: {
      slideChangeTransitionStart:function() {
        var e=parseInt(document.querySelector(".HomePress__carousel .swiper-slide-active").dataset.swiperSlideIndex);
        for(i=0;
        i<pressPagers.length;
        ++i)i!==e?pressPagers[i].classList.remove("HomePress__pager--active"):pressPagers[i].classList.add("HomePress__pager--active")
      }
    }
  })
}),document.body.classList.contains("home")||document.body.classList.contains("page-template-page-developers")) {
  function validateHubspotEmail(e) {
    return!!/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z] {
      2,20
    }
    \b/gi.test(e)
  }
  function checkHubspotEmail() {
    document.querySelector(".SubscribeForm").classList.remove("SubscribeForm--error");
    var e=document.querySelector(".SubscribeForm__email").value;
    !0===validateHubspotEmail(e)?(submitHubspotForm(e),document.querySelector(".SubscribeForm__notification").innerHTML="Submitting...",document.querySelector(".SubscribeForm").classList.add("SubscribeForm--success"),document.querySelector(".SubscribeForm__email").value=""):(document.querySelector(".SubscribeForm__notification").innerHTML="Please enter a valid email address.",document.querySelector(".SubscribeForm").classList.add("SubscribeForm--error"))
  }
  function readCookie(e) {
    for(var t=e+"=",n=document.cookie.split(";"),i=0;
    i<n.length;
    i++) {
      for(var o=n[i];
      " "===o.charAt(0);)o=o.substring(1,o.length);
      if(0===o.indexOf(t))return o.substring(t.length,o.length)
    }
    return null
  }
  function submitHubspotForm(e) {
    var t=document.querySelector(".SubscribeForm").dataset.submitBase,n=document.querySelector(".SubscribeForm").dataset.portalId,i=document.querySelector(".SubscribeForm").dataset.formId,o=readCookie("hubspotutk"),a=window.location.href,r=document.querySelector('meta[name="csrf-token"]').getAttribute("content"),l=new XMLHttpRequest,c=t+"/includes/hubspot-form-submit.php";
    l.open("POST",c,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.setRequestHeader("X-CSRF-Token",r),l.onreadystatechange=function() {
      4===l.readyState&&200===l.status&&(document.querySelector(".SubscribeForm__notification").innerHTML="Thank you! Stay tuned for Jibo updates.",emailSignupTracking(e))
    };
    var s="email="+e+"&hutk="+o+"&pageUrl="+a+"&portalID="+n+"&formID="+i;
    l.send(s)
  }
  function clearSuccessNotification() {
    var e=document.querySelector(".SubscribeForm");
    e.classList.contains("SubscribeForm--success")&&(e.classList.remove("SubscribeForm--success"),e.querySelector(".SubscribeForm__notification").innerHTML="")
  }
  document.addEventListener("DOMContentLoaded",function() {
    document.querySelector(".SubscribeForm__submit").onclick=function(e) {
      e.preventDefault(),checkHubspotEmail()
    },document.querySelector(".SubscribeForm__email").onfocus=function(e) {
      clearSuccessNotification()
    }
  })
}
if(document.body.classList.contains("page-template-page-jobs")) {
  function initTestimonialsSlider() {
    slider=document.getElementsByClassName("JobsTestimonials__testimonialsWrap");
    new Swiper(slider, {
      loop:!0,speed:400,effect:"fade",fadeEffect: {
        crossFade:!0
      },autoplay: {
        delay:8e3
      },pagination: {
        el:".JobsTestimonials__swiperPagination",type:"bullets",clickable:!0
      }
    })
  }
  document.addEventListener("DOMContentLoaded",function() {
    initTestimonialsSlider()
  })
}
if(document.body.classList.contains("page-template-page-skills")) {
  var paginationSlides=!1,paginationList=[],IFTTTPagers=document.querySelectorAll(".SkillsIFTTT__pagination .SkillsIFTTT__pager");
  function initDemoSliders() {
    sliders=document.getElementsByClassName("Skills__demoWrap"),Array.prototype.forEach.call(sliders,function(e,t,n) {
      var o=e.parentNode,a=o.getElementsByClassName("Skills__pagination")[0],r=o.getElementsByClassName("Skills__pager");
      new Swiper(e, {
        loop:!0,speed:400,effect:"fade",fadeEffect: {
          crossFade:!0
        },pagination: {
          el:a,type:"custom",clickable:!0,bulletClass:"Skills__pager"
        },on: {
          init:function() {
          },slideChangeTransitionStart:function() {
            var t=parseInt(e.querySelector(".swiper-slide-active").dataset.swiperSlideIndex);
            for(i=0;
            i<r.length;
            ++i)i!==t?r[i].classList.remove("active"):(r[i].classList.add("active"),e.querySelector(".swiper-slide-active").classList.add("demo-text-active"))
          }
        }
      })
    })
  }
  function initDemoSlidersPagination() {
    var e=document.getElementsByClassName("Skills__pagination");
    window.innerWidth<768&&(console.log("Initialized pagi slider."),Array.prototype.forEach.call(e,function(e,t,n) {
      var i=new Swiper(e, {
        speed:400,slidesPerView:1,spaceBetween:30,navigation: {
          nextEl:e.parentNode.querySelector(".swiper-button-next"),prevEl:e.parentNode.querySelector(".swiper-button-prev")
        }
      });
      paginationList.push(i)
    }),paginationSlides=!0)
  }
  function sliderResizeToggle() {
    var e=document.getElementsByClassName("Skills__pagination");
    window.innerWidth<768?0==paginationSlides&&(Array.prototype.forEach.call(e,function(e,t,n) {
      var i=new Swiper(e, {
        speed:400,slidesPerView:1,spaceBetween:30,navigation: {
          nextEl:e.parentNode.querySelector(".swiper-button-next"),prevEl:e.parentNode.querySelector(".swiper-button-prev")
        }
      });
      paginationList.push(i)
    }),paginationSlides=!0):0!=paginationSlides&&(Array.prototype.forEach.call(paginationList,function(e,t,n) {
      e.destroy()
    }),paginationList=[],paginationSlides=!1)
  }
  function initIFTTTSlider() {
    new Swiper(".SkillsIFTTT__slider", {
      loop:!0,grabCursor:!0,speed:400,spaceBetween:100,effect:"fade",fadeEffect: {
        crossFade:!0
      },autoplay: {
        delay:8e3
      },pagination: {
        el:".SkillsIFTTT__pagination",type:"custom",clickable:!0,bulletClass:"SkillsIFTTT__pager"
      },on: {
        slideChangeTransitionStart:function() {
          var e=parseInt(document.querySelector(".SkillsIFTTT__slider .swiper-slide-active").dataset.swiperSlideIndex);
          for(i=0;
          i<IFTTTPagers.length;
          ++i)i!==e?IFTTTPagers[i].classList.remove("SkillsIFTTT__pager--active"):IFTTTPagers[i].classList.add("SkillsIFTTT__pager--active")
        }
      }
    })
  }
  document.addEventListener("DOMContentLoaded",function() {
    initDemoSliders(),initDemoSlidersPagination(),initIFTTTSlider(),window.addEventListener("resize",sliderResizeToggle,!1);
    document.querySelectorAll(".CTALink--skillLink").forEach(function(e) {
      e.addEventListener("click",function(e) {
        var t=this.parentNode.querySelector(".active-displayed");
        null!==t&&t.classList.remove("active-displayed"),this.classList.add("active-displayed"),this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(".swiper-slide-active").classList.add("demo-text-active")
      })
    })
  })
}
if("serviceWorker"in navigator&&window.addEventListener("load",function() {
  console.log("https://"+window.location.hostname+"/sw.js"),navigator.serviceWorker.register("https://"+window.location.hostname+"/sw.js").then(function(e) {
    console.log("Service worker successfully registered on scope",e.scope)
  }).catch(function(e) {
    console.log("Service worker failed to register")
  })
}),document.body.classList.contains("page-template-page-technology")) {
  var techSpecSlider,animateDiagramTimeout,techSpecSlides=!1,techSpecElements=[],techSpecAnimations=[],techSpecAnimationWrap=document.querySelector(".TechnologyJiboHardware__diagramAnimations"),heroText=document.querySelector(".TechnologyHeroText");
  function stopWheel(e) {
    e.preventDefault&&e.preventDefault()
  }
  function preventScrollOnHero() {
    var e=document.querySelector(".TechnologyHeroText");
    e.addEventListener?(e.addEventListener("mousewheel",stopWheel,!1),e.addEventListener("DOMMouseScroll",stopWheel,!1)):e.attachEvent&&e.attachEvent("onmousewheel",stopWheel)
  }
  function initTechSpecSlider() {
    if(window.innerWidth<768&&1!=techSpecSlides) {
      document.querySelector(".TechnologyJiboHardware__techSpecsList");
      techSpecSlider=new Swiper(".TechnologyJiboHardware__techSpecsList", {
        loop:!0,grabCursor:!0,speed:400,spaceBetween:100,navigation: {
          nextEl:document.querySelector(".TechnologyJiboHardware__techSpecsList .swiper-button-next"),prevEl:document.querySelector(".TechnologyJiboHardware__techSpecsList .swiper-button-prev")
        },on: {
          slideChangeTransitionEnd:function() {
            techSpecElements.forEach(function(e) {
              e.classList.remove("CTALink--secondaryActive")
            }),setTimeout(function() {
              var e=techSpecSlider.activeIndex,t=techSpecSlider.slides.eq(e).attr("data-swiper-slide-index");
              document.querySelectorAll('[data-swiper-slide-index="'+t+'"] .CTALink').forEach(function(e) {
                e.click()
              })
            },750)
          }
        }
      }),techSpecSlides=!0
    }
    else window.innerWidth>=768&&0!=techSpecSlides&&(techSpecSlider.destroy(!0,!0),techSpecSlides=!1)
  }
  function animateDiagram() {
    document.querySelector(".TechnologyJiboHardware__diagram").classList.toggle("TechnologyJiboHardware__diagram--showBody")
  }
  function heroAnimation() {
    document.querySelector(".TechnologyHeroText").classList.add("TechnologyHeroText--loaded")
  }
  function removeHeroText() {
    heroText.remove()
  }
  function forceDiagramAnimation() {
    heroText.classList.remove("TechnologyHeroText--loaded"),heroText.classList.add("TechnologyHeroText--forceLoad"),setTimeout(removeHeroText,500),clearTimeout(animateDiagramTimeout),animateDiagram()
  }
  function backTopTopToggle() {
    var e=document.getElementById("TechnologyDetailOne").getBoundingClientRect(),t=window.innerHeight-e.top;
    window.innerHeight,e.top,window.innerHeight;
    t>.5*window.innerHeight?document.querySelector(".TechnologyBacktoTop").classList.add("TechnologyBacktoTop--visible"):document.querySelector(".TechnologyBacktoTop").classList.remove("TechnologyBacktoTop--visible")
  }
  document.addEventListener("DOMContentLoaded",function() {
    preventScrollOnHero(),initTechSpecSlider();
    new SmoothScroll(".TechnologyJiboHardware__secondaryDesc a, .TechnologyBacktoTop", {
      offset:75
    });
    setTimeout(heroAnimation,0),animateDiagramTimeout=setTimeout(animateDiagram,9200),diagramTrigger=document.querySelector(".TechnologyJiboHardware__diagram"),diagramTrigger.onclick=function() {
      animateDiagram()
    },exploreTrigger=document.querySelector(".TechnologyHeroText .CTALink"),exploreTrigger.onclick=function(e) {
      e.preventDefault(),forceDiagramAnimation()
    },Array.prototype.forEach.call(document.querySelectorAll(".CTALink--techLink"),function(e) {
      techSpecElements.push(e)
    }),Array.prototype.forEach.call(document.querySelectorAll(".TechnologyJiboHardware__diagramAnimations svg"),function(e) {
      techSpecAnimations.push(e)
    }),techSpecElements.forEach(function(e) {
      e.addEventListener("click",function() {
        var t=e,n=e.getAttribute("data-animation-target");
        techSpecElements.forEach(function(e) {
          e!=t&&e.classList.remove("CTALink--secondaryActive")
        }),techSpecAnimations.forEach(function(e) {
          e.classList.remove("TechnologyJiboHardware__diagramAnimation--active")
        }),this.classList.contains("CTALink--secondaryActive")?(this.classList.remove("CTALink--secondaryActive"),document.getElementById(n).classList.remove("TechnologyJiboHardware__diagramAnimation--active")):(this.classList.add("CTALink--secondaryActive"),document.getElementById(n).classList.add("TechnologyJiboHardware__diagramAnimation--active"))
      })
    }),window.addEventListener("resize",initTechSpecSlider,!1),window.addEventListener("scroll",backTopTopToggle,!1)
  })
}
var scrolledQuarter=!1,scrolledHalf=!1,scrolledThreeQuarters=!1,scrolledFull=!1,buttonText=null,utmCampaign=null,utmSource=null,utmMedium=null,utmContent=null;
function getQueryVariable(e) {
  for(var t=window.location.search.substring(1).split("&"),n=0;
  n<t.length;
  n++) {
    var i=t[n].split("=");
    if(i[0]==e)return i[1]
  }
  return!1
}
function trackEvent(e,t) {
  t=t|| {
  };
  try {
    analytics.track(e,t)
  }
  catch(e) {
    console.log(e)
  }
}
function getScrollPercent() {
  var e=document.documentElement,t=document.body;
  return(e.scrollTop||t.scrollTop)/((e.scrollHeight||t.scrollHeight)-e.clientHeight)*100
}
function scrollTracking() {
  getScrollPercent()>=25&&0==scrolledQuarter?(trackEvent("Scrolled 25%", {
    category:"Scroll Tracking"
  }),scrolledQuarter=!0):getScrollPercent()>=50&&0==scrolledHalf?(trackEvent("Scrolled 50%", {
    category:"Scroll Tracking"
  }),scrolledHalf=!0):getScrollPercent()>=75&&0==scrolledThreeQuarters?(trackEvent("Scrolled 75%", {
    category:"Scroll Tracking"
  }),scrolledThreeQuarters=!0):getScrollPercent()>=100&&0==scrolledFull&&(trackEvent("Scrolled 100%", {
    category:"Scroll Tracking"
  }),scrolledFull=!0)
}
function emailSignupTracking(e) {
  trackEvent("Email Submitted", {
    category:"Conversions",email:e,name:utmCampaign,source:utmSource,medium:utmMedium,content:utmContent
  }),analytics.identify( {
    email:e
  })
}
function buyButtonTracking(e) {
  var t=window.getComputedStyle(e).backgroundColor,n=e.innerHTML,i=e.classList;
  analytics.track("Clicked Buy Button", {
    label:i,color:t,text:n
  })
}
document.addEventListener("DOMContentLoaded",function() {
  !1!==getQueryVariable("utm_campaign")&&(utmCampaign=getQueryVariable("utm_campaign")),!1!==getQueryVariable("utm_source")&&(utmSource=getQueryVariable("utm_source")),!1!==getQueryVariable("utm_medium")&&(utmMedium=getQueryVariable("utm_medium")),!1!==getQueryVariable("utm_content")&&(utmContent=getQueryVariable("utm_content")),window._wq=window._wq||[],_wq.push( {
    id:"_all",onHasData:function(e) {
      e.bind("play",function() {
        trackEvent("Play", {
          label:e.name(),category:"Video"
        })
      }),e.bind("pause",function() {
        trackEvent("Pause", {
          label:e.name(),secondsWatched:e.secondsWatched(),percentWatched:e.percentWatched(),category:"Video"
        })
      }),e.bind("end",function() {
        trackEvent("100% Watched", {
          label:e.name(),secondsWatched:e.secondsWatched(),percentWatched:e.percentWatched(),category:"Video"
        })
      }),e.bind("percentwatchedchanged",function(t,n) {
        t>=.25&&n<.25?trackEvent("25% Watched", {
          label:e.name(),category:"Video"
        }):t>=.5&&n<.5?trackEvent("50% Watched", {
          label:e.name(),category:"Video"
        }):t>=.75&&n<.75&&trackEvent("75% Watched", {
          label:e.name(),category:"Video"
        })
      })
    }
  }),window.addEventListener("scroll",scrollTracking);
  document.querySelectorAll(".BuyButton").forEach(function(e) {
    e.addEventListener("click",function(e) {
      buyButtonTracking(this)
    })
  })
});
