1/*! 2 * 3 * typeit - The most versatile animated typing utility on the planet. 4 * Author: Alex MacArthur <[email protected]> (https://macarthur.me) 5 * Version: v6.0.2 6 * URL: https://typeitjs.com 7 * License: GPL-2.0 8 * 9 */ 10(function(){"use strict";var t=function(t){var n;switch(t){case 0:n=[l,l,c,c]}return e[t]=n,n},e=new Array(1),n={enumerable:!1,configurable:!0,writable:!0},i={enumerable:!1,configurable:!0,writable:!1},r=this.Object.defineProperty,s=function(t){var e=t.getBoundingClientRect();return!(e.right>window.innerWidth||e.bottom>window.innerHeight)&&!(e.top<0||e.left<0)},o=function(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))},a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=document.createElement("style");n.id=e,n.appendChild(document.createTextNode(t)),document.head.appendChild(n)},u=function(t){return t.replace(/&(.+);/,function(t){var e=document.createElement("textarea");return e.innerHTML=t,e.value})},l=function(n){var i=e[0]||t(0);return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?i[1]=function(t){return typeof t}:i[1]=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i[1](n)},c=function(n){var i=e[0]||t(0);return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?i[3]=function(t){return typeof t}:i[3]=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i[3](n)},h=function(t){return d(t)||f(t)||p()},p=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")},f=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)},d=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}},v=function(t){return m(t)||y(t)||g()},g=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")},y=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)},m=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}},b=function(t,e){for(var n=Object(t),i=1;i<arguments.length;i++){var r=arguments[i];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&
10(n[s]=r[s])}return n},w=function(t){return Array.isArray(t)?t.slice(0):t.split("<br>")},S=function(n){var i=function(t){var e=(new DOMParser).parseFromString(t,"text/html"),n=[].slice.call(e.body.querySelectorAll("*"));return(n=n.filter(function(e){return!(e.outerHTML.indexOf("></")>-1&&(t=t.replace(e.outerHTML,""),1))})).forEach(function(e){t=t.replace(new RegExp("<".concat(e.tagName,"(.*?)/?>((.*?)</").concat(e.tagName,">)?"),"i"),"{%}")}),{string:t,nodes:n}}(n),r=i.string,s=i.nodes,o=u(r).split(""),a=[];return o.forEach(function(t,e){if("{%}"===o.slice(e,e+3).join("")){var n=e,i=s.shift(),r=u(i.innerHTML).split(""),l=[].slice.call(i.attributes).map(function(t){return{name:t.name,value:t.nodeValue}});r.length?r.forEach(function(t,s){a.push({tag:i.tagName,attributes:l,content:t,isFirstCharacter:n===e,isLastCharacter:s+1===r.length}),n++}):a.push({tag:i.tagName,attributes:l,content:null})}else a.push(t)}),a=function(n){for(var i=e[0]||t(0),r=!0;r;)n.some(function(t,e){return!("object"!==i[1](t)||!t.isLastCharacter&&null!==t.content||"%}"!==n.slice(e+1,e+3).join("")||(n.splice(e+1,2),0))})||(r=!1);return n}(a)},q=function(t){var e=t.tag,n=t.attributes,i=void 0===n?[]:n,r=t.content,s=void 0===r?"":r,o=document.createElement(e);return void 0!==i&&i.forEach(function(t){o.setAttribute(t.name,t.value)}),s&&(o.innerHTML=s),o.outerHTML},C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,C),this.executed=[],this.waiting=t,!t.length&&e&&this.add(e)},L=C.prototype,T=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
10,e=t.element,n=t.id,i=t.options,r=t.queue,s=void 0===r?[]:r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,T),this.status={started:!1,complete:!1,frozen:!1,destroyed:!1},this.timeouts=[],this.id=n,this.$e=e,this.isInput=["textarea","input"].indexOf(e.tagName.toLowerCase())>-1,this.opts=b({},A,i),this.opts.strings=w(this.opts.strings),this.opts.html=!this.isInput&&this.opts.html,this.queue=new C(s,[this.pause,this.opts.startDelay]),function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?t.value="":[].slice.call(t.childNodes).forEach(function(e){void 0!==e.classList&&e.classList.contains("ti-wrapper")&&(t.innerHTML="")})}(e,this.isInput),this.prepareDelay("nextStringDelay"),this.prepareDelay("loopDelay");var o=this.$e.innerHTML;this.prepDOM(),this.handleHardCoded(o),this.opts.strings=this.opts.strings.map(function(t){return t.replace(/<\!--.*?-->/g,"")}),!this.opts.strings.length||this.queue.waiting.length>1||this.generateQueue()},$=T.prototype,D=function(t,e){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,D),this.instances=(n=t,"string"==typeof n?n=document.querySelectorAll(n):n instanceof NodeList||(n=[n]),[].slice.call(n)).map(function(t){return new T({element:t,id:Math.random().toString(36).substring(2,15),options:e,queue:[]})})},P=D.prototype,A={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:null,html:!0,waitUntilVisible:!1,beforeString:!1,afterString:!1,beforeStep:!1,afterStep:!1,afterComplete:!1};n.value=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.waiting[e?"unshift":"push"](t),this},r(L,"add",n),n.value=function(t){return this.waiting.splice(t,1),this},r(L,"delete",n),n.value=function(){return this.waiting=[].concat(h(this.executed),h(this.waiting)),this.executed=[],this},r(L,"reset",n),i.value="Instance",r(T,"name",i),n.value=function(){return this.queue.reset(),new T({element:this.$e,id:this.id,options:this.opts,queue:this.queue.waiting})},r($,"reset",n),n.value=function(){var t=this;if(!this.status.started){if(this.cursor(),!this.opts.waitUntilVisible||s(this.$e))return this.status.started=!0,this.fire();window.addEventListener("scroll",function e(){s(t.$e)&&!t.status.started&&(t.fire(),window.removeEventListener("scroll",e))})}},r($,"init",n),n.value=function(){for(var t=this,e=this.queue.waiting.slice(),n=Promise.resolve(),i=function(i){var r=e[i],s=[r,t.queue,t];n=n.then(function(){return new Promise(function(e,n){if(t.status.frozen)return n();var i,o;t.setPace(),r[2]&&r[2].isFirst&&t.opts.beforeString&&(i=t.opts).beforeString.apply(i,s),t.opts.beforeStep&&(o=t.opts).beforeStep.apply(o,s),r[0].call(t,r[1],r[2]).then(function(){var n,i,o=t.queue.waiting.shift();return r[2]&&r[2].isPhantom?e():(r[2]&&r[2].isLast&&t.opts.afterString&&(n=t.opts).afterString.apply(n,s),t.opts.afterStep&&(i=t.opts).afterStep.apply(i,s),t.queue.executed.push(o),e())})})})},r=0;r<e.length;r++)i(r);n.then(function(){if(t.opts.loop){var e=t.opts.loopDelay?t.opts.loopDelay:t.opts.nextStringDelay;t.wait(function(){t.loopify(e),t.fire()},e.after)}t.status.completed=!0,t.opts.afterComplete&&t.opts.afterComplete(t)}).catch(function(){})},r($,"fire",n),n.value=function(t){var e=this;this.queue.reset().delete(0).add([this.pause,t.before],!0),this.getNoderized().forEach(function(t){e.queue.add([e.delete,null,{isPhantom:!0}],!0)})},r($,"loopify",n),n.value=function(){this.isInput||(this.$e.innerHTML='\n <span style="'.concat("display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;",'" class="ti-wrapper">\n <span style="').concat("display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;",'" class="ti-container"></span>\n </span>\n '),this.$e.setAttribute("data-typeit-id",this.id),this.$eContainer=this.$e.querySelector(".ti-container"),this.$eWrapper=this.$e.querySelector(".ti-wrapper"),a("\n .".concat(this.$eContainer.className,":before {\n content: '.';\n display: inline-block;\n width: 0;\n visibility: hidden;\n }\n ")))},r($,"prepDOM",n),n.value=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.isInput?this.$e.value=t:this.$eContainer[this.opts.html?"innerHTML":"innerText"]=t},r($,"setContents",n),n.value=function(){return this.isInput?this.$e.value:this.opts.html?this.$eContainer.innerHTML:this.$eContainer.innerText},r($,"getRaw",n),n.value=function(){return this.maybeNoderize(this.getRaw())},r($,"getNoderized",n),n.value=function(t){var e=this.opts[t];if(e){var n=Array.isArray(e),i=n?null:e/2;this.opts[t]={before:n?e[0]:i,after:n?e[1]:i,total:n?e[0]+e[1]:e}}},r($,"prepareDelay",n),n.value=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;
10e&&this.queue.add(e),this.opts.strings.forEach(function(e,n){t.queueString(e);var i=t.queue.waiting.length;if(n+1!==t.opts.strings.length){if(t.opts.breakLines)return t.queue.add([t.type,"<br>"]),void t.addSplitPause(i);t.queueDeletions(e),t.addSplitPause(i,e.length)}})},r($,"generateQueue",n),n.value=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e="string"==typeof t?this.maybeNoderize(t).length:t,n=0;n<e;n++)this.queue.add([this.delete])},r($,"queueDeletions",n),n.value=function(t){return this.opts.html?S(t):t.split("")},r($,"maybeNoderize",n),n.value=function(t){var e=this,n=(t=this.maybeNoderize(t)).length;t.forEach(function(t,i){var r=[e.type,t];0===i&&r.push({isFirst:!0}),i+1===n&&r.push({isLast:!0}),e.queue.add(r)})},r($,"queueString",n),n.value=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.queue.waiting.splice(t,0,[this.pause,this.opts.nextStringDelay.before]),this.queue.waiting.splice(t+e+1,0,[this.pause,this.opts.nextStringDelay.after])},r($,"addSplitPause",n),n.value=function(){if(!this.isInput){var t="display: none;";this.opts.cursor&&(a("\n @keyframes blink-".concat(this.id," {\n 0% {opacity: 0}\n 49% {opacity: 0}\n 50% {opacity: 1}\n }\n\n [data-typeit-id='").concat(this.id,"'] .ti-cursor {\n animation: blink-").concat(this.id," ").concat(this.opts.cursorSpeed/1e3,"s infinite;\n }\n "),this.id),t=""),this.$eWrapper.insertAdjacentHTML("beforeend",'<span style="'.concat("display:inline;position:relative;font:inherit;color:inherit;line-height:inherit;").concat(t,'left: -.25ch;" class="ti-cursor">').concat(this.opts.cursorChar,"</span>"))}},r($,"cursor",n),n.value=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.isInput?this.$e.value="".concat(this.$e.value).concat(t):((e?this.$eContainer.lastChild:this.$eContainer).insertAdjacentHTML("beforeend",t),this.setContents(this.getRaw().split("").join("")))},r($,"insert",n),n.value=function(t){return!!t.length&&(this.opts.startDelete?(this.insert(t),this.queue.add([this.delete,!0]),void this.addSplitPause(1)):void(this.opts.strings=[].concat(v(w(t.trim())),v(this.opts.strings))))},r($,"handleHardCoded",n),n.value=function(t,e){this.timeouts.push(setTimeout(t,e))},r($,"wait",n),n.value=function(){var t=this.opts.speed,e=null!==this.opts.deleteSpeed?this.opts.deleteSpeed:this.opts.speed/3,n=t/2,i=e/2;this.typePace=this.opts.lifeLike?o(t,n):t,this.deletePace=this.opts.lifeLike?o(e,i):e},r($,"setPace",n),n.value=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(n,i){t.wait(function(){return n()},e||t.opts.nextStringDelay.total)})},r($,"pause",n),n.value=function(t){var e=this;return new Promise(function(n,i){e.wait(function(){return"string"==typeof t?(e.insert(t),n()):t.isFirstCharacter||null===t.content?(e.insert(q({tag:t.tag,attributes:t.attributes,content:t.content})),n()):(e.insert(t.content,!0),n())},e.typePace)})},r($,"type",n),n.value=function(){var t=this;return new Promise(function(e){return t.setContents(""),e()})},r($,"empty",n),n.value=function(){var n=this,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(r,s){n.wait(function(){var s=n.getNoderized();return s.splice(-1,1),s=function(n){var i=e[0]||t(0);return(n=n.map(function(t,e){if("object"===i[3](t)&&(t.isFirstCharacter||null===t.content)){for(var r=e,s=[t.content],o=!1;!o;){var a=n[++r];void 0!==a&&s.push(a.content),(void 0===a||a.isLastCharacter)&&(o=!0)}return q({tag:t.tag,attributes:t.attributes,content:s.join("")})}return t})).filter(function(t){return"object"!==i[3](t)})}(s),n.setContents(s.join("")),i&&s.length>0?n.delete(!0).then(function(){return r()}):r()},n.deletePace)})},r($,"delete",n),n.value=function(t){var e=this;return new Promise(function(n){return e.opts=b({},e.opts,t),n()})},r($,"setOptions",n),i.value="TypeIt",r(D,"name",i),n.value=function(t){var e=this;this.instances.forEach(function(n){t.call(e,n)})},r(P,"each",n),n.value=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.each(function(r){for(var s="string"!=typeof t,o=s?t:r[t],a=s?e:n,u=0;u<i;u++)r.queue.add([o,a])})},r(P,"queueUp",n),n.value=function(t){return e=this.instances,n=t,i=!0,!!e.length&&e.filter(function(t){return t.status[n]===i}).length===e.length;var e,n,i},r(P,"is",n),n.value=function(){this.each(function(t){t.status.frozen=!0})},r(P,"freeze",n),n.value=function(){this.each(function(t){t.status.frozen&&(t.status.frozen=!1,t.fire())})},r(P,"unfreeze",n),n.value=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.each(function(e){return e.queueString(t)}),this},r(P,"type",n),n.value=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("delete",null===t,null===t?1:t),this},r(P,"delete",n),n.value=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.queueUp("pause",t),this},r(P,"pause",n),n.value=function(){return this.queueUp("type","<br>"),this},r(P,"break",n),n.value=function(t){return this.queueUp("setOptions",t),this},r(P,"options",n),n.value=function(t){return this.queueUp(t),this},r(P,"exec",n),n.value=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];
10this.each(function(e){e.timeouts.forEach(function(t){clearTimeout(t)}),e.timeouts=[];var n=e.isInput?null:e.$eWrapper.querySelector(".ti-cursor");t&&e.opts.cursor&&null!==n&&e.$eWrapper.removeChild(n),e.status.destroyed=!0})},r(P,"destroy",n),n.value=function(){return this.queueUp("empty"),this},r(P,"empty",n),n.value=function(){return this.destroy(),this.instances=this.instances.map(function(t){return t.reset()}),this},r(P,"reset",n),n.value=function(){return this.each(function(t){t.init()}),this},r(P,"go",n),this.TypeIt=D}).call(this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.