function typeWrite(a,b={}){a=document.querySelector(a),this.element=a,this.text=a.textContent,this.options=b,this.options={speed:b.speed?b.speed:100,separator:b.separator?b.separator:" ",texts:b.texts?this.options.texts:[this.text],loop:!!b.loop&&this.options.loop,reverseDelay:b.reverseDelay?this.options.reverseDelay:100,cursor:b.cursor?this.options.cursor:"|"};var c=document.createElement("style");c.type="text/css";var d=Math.floor(9999*Math.random()+1);return c.innerHTML=".typewriter-"+d+":after{content:'"+this.options.cursor+"';display: inline-block;animation-name:typewrite;animation-duration:.5s;animation-timing-function:ease;animation-iteration-count:infinite}@keyframes typewrite{0%{opacity:0}100%{opacity:1}}",document.body.appendChild(c),this.typewriteAddClass("typewriter-"+d),this.text}typeWrite.prototype.start=function(){var j,a=this.options.speed,b=0,d=this.element,g=(this.text,this.options,this.options.texts),h=this,i=this.options.loop;d.innerText="",d.textContent="";var m,k=0,n=new CustomEvent("typeDone"),o=function(){d.innerText||d.textContent;if("undefined"!=typeof g[k][b])d.textContent+=g[k].charAt(b);else{clearInterval(m);var e=k;i?h.reverse(function(){b=0,"undefined"!=typeof g[e++]&&k<g.length-1?k++:k=0,clearInterval(m),j=setInterval(o,a)}):k<g.length-1&&h.reverse(function(){b=0,"undefined"!=typeof g[e++]&&(k++,j=setInterval(o,a))}),clearInterval(j),d.dispatchEvent(n)}b<=g[k].length&&b++};m=setInterval(o,a)},typeWrite.prototype.stop=function(){},typeWrite.prototype.typewriteAddClass=function(a){this.element.classList?this.element.classList.add(a):this.element.className+=" "+a},typeWrite.prototype.reverse=function(a=""){var b=this.element,c=this.options.speed,d=new CustomEvent("reverse"),e=this.options.reverseDelay;setTimeout(function(){var e=setInterval(function(){""!=b.innerText?b.innerText=b.innerText.slice(0,-1):(clearInterval(e),a(),b.dispatchEvent(d))},c)},e)};