function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,n){"object"===("undefined"==typeof exports?"undefined":t(exports))&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).typer=n()}(this,(function(){"use strict";var t=function e(t){return t?(t^16*Math.random()>>t/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e)},n=["typer","cursor-block","cursor-soft","cursor-hard","no-cursor"],r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@$^*()";return function(i,o){var u=[],a=document.body,l={},c=0;if("String"===d(i)&&(i=document.querySelector(i)),i.getAttribute("data-typer"))throw new Error("You've already called Typer on this element.");o=p(o),u.speedSet=!0,u.voids=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"],u.classNames=n,u.id=t(),i.setAttribute("data-typer",u.id);var s={cursor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(u.cursorRan)return this;if(u.cursorRan=!0,!1===e)return u.cursor="no-cursor",this;var t=e.color,n=e.blink,r=e.block,i=[];return t&&y('[data-typer="'.concat(u.id,'"] .typer::after'),"background-color:".concat(t)),i.push("hard"===n?"cursor-hard":"cursor-soft"),!0===r&&i.push("cursor-block"),u.cursor=i.join(" "),this},line:function(e,t){return g("line",e,t),u.typing||(u.typing=!0,w()),this},continue:function(e,t){return g("continue",e,t),this},military:function(e,t){return g("military",e,t),u.typing||(u.typing=!0,w()),this},pause:function(e){return u.push({pause:+e||500}),this},emit:function(e,t){return t?"String"===d(t)&&(t=document.querySelector(t)):t=a,u.push({emit:e,el:t}),this},listen:function(e,t){return t?"String"===d(t)&&(t=document.querySelector(t)):t=a,u.push({listen:e,el:t}),this},back:function(e,t){return u.push({back:e,speed:t}),this},empty:function(){return u.push({empty:!0}),this},run:function(e){return u.push({run:e}),this},end:function(e,t){return u.push({end:!0}),u.cb=function(){return v(e,t)},L("end")},halt:function(){if(!u.typing)return this;u.halt=!0},resume:function(){if(!u.typing)return this;u.complete||(u.halt=!1,u.resume(),u.resume=null)},repeat:function(e,t){return u.push({repeat:!0,num:e,shouldEmpty:t,id:c++}),this},kill:E};function f(e){return{}.toString.call(e).slice(8,-1)}function d(e){var t=f(e);if("html"!==t.slice(0,4).toLowerCase()&&"String"!==t)throw"You need to provide a string selector, such as '.some-class', or an html element.";return t}function p(e){var t=f(e);if(void 0===e)return u.speedSet?o:70;if("Number"===t&&!isNaN(e))return e;if("Object"===t){var n=e.hasOwnProperty("min"),r=e.hasOwnProperty("max"),i=e.hasOwnProperty("speed");if(i&&!isNaN(e.speed))return e.speed;if(n&&r&&e.min0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0,u=r.container,a=r.totalTime,l=r.military,c=!o&&("String"===f(u)?document.querySelector(u).textContent:u.textContent);return e(n={},t,o||c),e(n,"speed",p(r)),e(n,"html",!1!==r.html),e(n,"element",i?r.element:null),e(n,"military",m(l)),e(n,"totalTime",a),n}}function w(){if(u.item>=0||(u.item=0),u.item===u.length)return u.complete=!0,a.removeEventListener("killTyper",E);u.ks||(u.ks=!0,a.addEventListener("killTyper",E)),u.cursor||(u.cursor="cursor-soft"),u.type=setInterval((function(){if(!u.length)return clearInterval(u.type);var e,t=u[u.item];t.line?T(t):t.continue?function(e){clearInterval(u.type),N(e)}(t):t.pause?function(e){clearInterval(u.type),u.pause=setTimeout((function(){u.pause=null,u.item++,w()}),e.pause)}(t):t.emit?function(e){clearInterval(u.type),e.el.dispatchEvent(new Event(e.emit)),u.item++,w()}(t):t.listen?function(e){var t=e.el,n=e.listen;function r(e){u.listening=!1,t.removeEventListener(e.type,r),u.killed||(u.item++,w())}clearInterval(u.type),u.listening=!0,t.addEventListener(n,r),l={el:t,type:n,fxn:r}}(t):t.back?function(e){var t=e.back,n=e.speed;if(clearInterval(u.type),!u.newDiv||!u.newDiv.textContent)return u.item++,w();var r=function e(t){var n=0;return Array.from(t.childNodes).forEach((function(t){u.voids.includes(t.nodeName)&&n++,t.childNodes.length&&(n+=e(t))})),n}(u.newDiv),i=u.newDiv.textContent.length;if("empty"===t){if(!n||n>=i)u.newDiv.innerHTML="";else{var a=u.newDiv.cloneNode(!0),l=s(a);n<0&&(n+=i);for(var c=0;ci+r&&(t="all"),"all"===t&&(t=i+r),t<0&&(t=i+r- -1*t),u.goBack=setInterval(s(),n||o)}(t):t.empty?(i.innerHTML="",T({line:1})):t.run?(e=t.run,clearInterval(u.type),e(i),u.item++,w()):t.repeat?function(e){if(clearInterval(u.type),e.shouldEmpty&&(i.innerHTML=""),e.num){e.num--;var t=u.findIndex((function(t){var n=t.repeat,r=t.id;return n&&r===e.id-1}))+1;u.item=t}else u.item++;w()}(t):t.end&&(clearInterval(u.type),u.cb())}),0)}function T(e){clearInterval(u.type),u.newDiv&&(h(),u.newDiv.classList.add("white-space"),u.newDiv.innerHTML||(u.newDiv.innerHTML=" "));var t=document.createElement(e.element||"div");if(t.setAttribute("data-typer-child",u.id),t.className="".concat(u.cursor," typer white-space"),i.appendChild(t),u.newDiv=t,1===e.line)return u.item++,w();N(e)}function b(e,t){var n,r,i="Object"===f(e)?(n=e.min,r=e.max,Math.floor(Math.random()*(r-n+1)+n)):e;u.halt?u.resume=function(){return u.iterator=setTimeout(t,i)}:u.iterator=setTimeout(t,i)}function N(e){var t,n,i=e.line||e.continue,o=document.createElement("div");if(Array.isArray(i))return t=0,void b(n=e.totalTime?e.totalTime/i.length:e.speed,(function r(){var a=i[t++];o.textContent=a,u.newDiv.innerHTML+=e.html?a:o.innerHTML,t===i.length?s():b(n,r)}));function a(e,t){var n=[];e=Array.from(e);for(var r=0;r