window._tteInitEffectType=function(t){var e=0,i=t.querySelector(".tte_mid"),n=i.getAttribute("data-text").replace(/\s*,\s*/g,",");if(n){n=n.split(",");var r='<span class="tte-cursor">|</span>',a=0,s="right",o=0,l=t.getAttribute("data-speed");"slow"===l?l=100:"normal"===l?l=60:"fast"===l&&(l=30);var u=t.getAttribute("data-delay"),c=n[a].length;i.innerHTML=r;setInterval(function(){if(e===c+1){if(++o*l<=u)return;o=0}i.innerHTML=n[a].substr(0,e)+r,"right"===s?e++:e--,e===c+1&&(s="left"),-1===e&&(s="right",e=0,++a===n.length&&(a=0),c=n[a].length)},l)}},window._tteInitEffectFade=function(t){var i=t.querySelector(".tte_mid"),n=i.getAttribute("data-text").split(","),e=parseInt(t.getAttribute("data-delay"),10),r=n.length,a=1;r-1<a&&(a=0),i.innerHTML=n[0],i.classList.add("tte_show"),setInterval(function(){i.classList.remove("tte_show"),i.classList.add("tte_hide"),i.style.width="",setTimeout(function(){var t=i.getBoundingClientRect().width;i.innerHTML=n[a];var e=i.getBoundingClientRect().width;i.style.width=t+"px",i.classList.remove("tte_hide"),i.style.transition="none",setTimeout(function(){i.style.width=e+"px",r-1<++a&&(a=0),i.style.transition="",i.classList.add("tte_show")},30)},410)},e)},window._tteInitEffectRandom=function(i){var n={resolve:function(t,e){var i=t.resolveString||t.element.getAttribute("data-text");function l(t){return t[(e=0,i=t.length-1,Math.floor(Math.random()*(i-e+1))+e)];var e,i}!function e(i,n){var r=i.resolveString,a=(i.characters,i.offset),t=r.substring(0,a);!function e(i,n){var r=i.characters,a=(i.timeout,i.element),s=i.partialString,o=i.iterations;setTimeout(function(){if(0<=o){var t=Object.assign({},i,{iterations:o-1});a.innerHTML=0===o?s:s.substring(0,s.length-1)+l(r),e(t,n)}else"function"==typeof n&&n()},i.timeout)}(Object.assign({},i,{partialString:t}),function(){var t=Object.assign({},i,{offset:a+1});a<=r.length?e(t,n):"function"==typeof n&&n()})}(Object.assign({},t,{resolveString:i}),e)}},r=i.querySelector(".tte_mid").getAttribute("data-text").split(","),a=0,t=i.getAttribute("data-speed");"slow"===t?t=50:"normal"===t?t=20:"fast"===t&&(t=9);var s={offset:0,timeout:t,iterations:5,characters:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z"],resolveString:r[a],element:i.querySelector(".tte_mid")};n.resolve(s,function e(){var t=i.getAttribute("data-delay");setTimeout(function(){++a>=r.length&&(a=0);var t=Object.assign({},s,{resolveString:r[a]});n.resolve(t,e)},t)})},window._tteInitEffectScrambled=function(f){"use strict";var t=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=t,this.chars="!<>-_\\/[]{}—=+*^?#________",this._lastTime=0,this.speed=t.parentNode.getAttribute("data-speed"),"fast"===this.speed?this.speed=5:"normal"===this.speed?this.speed=20:this.speed=40,this.update=this.update.bind(this)}return e.prototype.setText=function(t){var e=this,i=this.el.innerText,n=Math.max(i.length,t.length),r=new Promise(function(t){return e.resolve=t});this.queue=[];for(var a=0;a<n;a++){var s=i[a]||"",o=t[a]||"",l=Math.floor(40*Math.random()),u=l+Math.floor(40*Math.random());this.queue.push({from:s,to:o,start:l,end:u})}return cancelAnimationFrame(this.frameRequest),this.frame=0,this.update(),r},e.prototype.update=function(t){if(t-this._lastTime<this.speed)this.frameRequest=requestAnimationFrame(this.update);else{this._lastTime=t;for(var e="",i=0,n=0,r=this.queue.length;n<r;n++){var a=this.queue[n],s=a.from,o=a.to,l=a.start,u=a.end,c=a.char,h=f.getAttribute("char-color");this.frame>=u?(i++,e+=o):this.frame>=l?((!c||Math.random()<.28)&&(c=this.randomChar(),this.queue[n].char=c),e+='<span class="tte-scramble-symbol" style="color: '+h+';">'+c+"</span>"):e+=s}this.el.innerHTML=e,i===this.queue.length?this.resolve():(this.frameRequest=requestAnimationFrame(this.update),this.frame++)}},e.prototype.randomChar=function(){return this.chars[Math.floor(Math.random()*this.chars.length)]},e}(),e=f.querySelector(".tte_mid").getAttribute("data-text").split(","),i=f.querySelector(".tte_mid"),n=f.getAttribute("data-delay"),r=new t(i),a=0;!function t(){r.setText(e[a]).then(function(){setTimeout(t,n)}),a=(a+1)%e.length}()},function(){var t=document.querySelectorAll(".tte_wrapper");Array.prototype.forEach.call(t,function(t){var e=t.getAttribute("data-effect"),i=t.querySelector(".tte_mid");i.innerHTML="",i.style.opacity="","typing"===e?window._tteInitEffectType(t):"fade"===e||"top-to-bottom"===e||"bottom-to-top"===e||"vertical-flip"===e?window._tteInitEffectFade(t):"random-letters"===e?window._tteInitEffectRandom(t):"text-scrambled"===e&&window._tteInitEffectScrambled(t)})}();