/**
 * require it! (dependencies)
 * @author Dominik Kressler
 * @version 1.0.0
 * @date 2021-02-09
 */
function rIt(e){if(0===Object.keys(e).length||e.constructor!==Object)return!1;let t={},n={};for(let r in window.rItLoaded||(window.rItLoaded=[]),e)e[r].assets instanceof Array||(e[r].assets=[]),e[r].selector=r,null!==document.querySelector(r)&&(e[r].lazy?n[r]=e[r]:t[r]=e[r]);if(loadAsset=async e=>!(window.rItLoaded.indexOf(e)>-1)&&new Promise((t,n)=>{if(window.rItLoaded.push(e),-1!==e.indexOf(".css",e.length-4)||e.indexOf("rforce=css")>-1){var r=document.createElement("link");r.setAttribute("href",e),r.setAttribute("rel","stylesheet")}else{var r=document.createElement("script");r.src=e,r.setAttribute("defer","defer")}r.onload=async()=>{t(!0)},document.body.appendChild(r)}),Object.keys(n).length>0){let o=new IntersectionObserver(function(e){if(e[0].intersectionRatio<=0)return;let t=e[0].target.dataset.ritSelector,r=n[t];(async()=>{for(let e of r.assets)await loadAsset(e);"string"==typeof r.function&&window[r.function](t),"function"==typeof r.function&&r.function(t)})(),o.unobserve(e[0].target)},{threshold:.01});for(let s in n){let i=s,f=document.querySelector(i);f.dataset.ritSelector=i,o.observe(f)}}return Object.keys(t).length>0&&(async()=>{for(let e in t){let n=t[e];for(let r of n.assets)await loadAsset(r);"string"==typeof n.function&&window[n.function](e),"function"==typeof n.function&&n.function(e)}})(),this}