Socket
Socket
Sign inDemoInstall

typeit

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeit - npm Package Compare versions

Comparing version 8.0.0-rc.6 to 8.0.0

dist/defaults.d.ts

2

dist/index.esm.js
// TypeIt by Alex MacArthur - https://typeitjs.com
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var c=e=>document.createElement(e),l=e=>document.createTextNode(e),a=(e,t="")=>{let n=c("style");n.id=t,n.appendChild(l(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},v={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var p=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,y=e=>(f(e)||(e=[e/2,e/2]),e),g=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let P=e=>e/2;var b=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,c=i?t.content:l(t.content);if(b(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!N(u)){let r=T(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{c=u.cloneNode(),c.appendChild(l(t.content));let n=u.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(c,f.contains(n)?n:null)};var L=e=>e&&e.remove();const j={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function w(e,t,n){if(!e.s){if(n instanceof D){if(!n.s)return void(n.o=w.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(w.bind(null,e,t),w.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const D=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{w(r,1,e(this.v))}catch(e){w(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?w(r,1,t?t(o):o):n?w(r,1,n(o)):w(r,2,o)}catch(e){w(r,2,e)}},r},e}();function E(e){return e instanceof D&&1&e.s}function x(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!E(u))return void u.then(s,o||(o=w.bind(null,r=new D,2)));u=u.v}r?w(r,1,u):r=u}catch(e){w(r||(r=new D),2,e)}}(),r}function k(e,t,n){for(var r;;){var o=e();if(E(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!E(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!E(s)){r=2;break}}}var u=new D,c=w.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(l):s.then(f)).then(void 0,c),u;function l(r){i=r;do{if(t&&(s=t())&&s.then&&!E(s))return void s.then(f).then(void 0,c);if(!(o=e())||E(o)&&!o.v)return void w(u,1,i);if(o.then)return void o.then(a).then(void 0,c);E(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function a(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):w(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):w(u,1,i)}}function C(l,N={}){const T=this,w=this,D=function(e,t,n=!1){try{function r(){function r(r){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,K)).then(function(){return n?void 0:Promise.resolve($.afterStep(T)).then(function(e){})})}return n?r():Promise.resolve($.beforeStep(T)).then(r)}const o=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{T.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},E=()=>b(G),C=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[g(t,P(t)),g(n,P(n))]:[t,n]}($)[e],H=(e,t=0)=>e?C(t):0,z=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),R=()=>(e=>b(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(G),A=(e={})=>[[Q,e],[Q,$]],B=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},I=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},O=function(){try{let e;Z.started=!0;let t=ee.getItems();const n=function(e,n){try{var r=function(){function e(){return Z.completed=!0,Promise.resolve($.afterComplete(w)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;D(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[V,e,{}]),Promise.resolve(F({num:null})).then(function(){})}return Promise.resolve(W?Promise.resolve(q({value:W})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){O()})}catch(e){return Promise.reject(e)}},e[1])})}const n=x(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&I(!0),Promise.resolve(n[0].call(w,n[1],r)).then(function(){ee.setMeta(e,{executed:!0}),I(!1)})});return n&&n.then?n.then(e):e()}()}catch(e){return}return r&&r.then?r.then(void 0,function(){}):r}();return Promise.resolve(n&&n.then?n.then(function(t){return e?t:w}):e?n:w)}catch(e){return Promise.reject(e)}},V=(e=0)=>D(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=p({el:G,move:e,cursorPos:W,to:t}),o=()=>{W+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(G,R(),ne,W)};return Promise.resolve(D(function(){try{let e=0;const t=k(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(D(o,C(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return D(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=x(e,function(n){return t?void i(e[n]):Promise.resolve(D(()=>{i(e[n])},C(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>M(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},H(t),!0)},Q=function(e){try{return $=t($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return E()?(G.value="",Promise.resolve()):(R().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(D(function(){try{let r=h(e)?e:p({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=R();var t;e.length&&(E()?G.value=G.value.slice(0,-1):(L(e[W]),t=ne,d("*",G,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};let i=0;const s=k(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(D(o,C(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(F({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(c("BR"));return z([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=A(t),r=e,{instant:o,to:i}=t;return z([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return z([[Y]],e)},this.exec=function(e,t){let n=A(t);return z([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=A(t),{instant:r,to:o}=t;return z([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=S(e),z([[Q,e]],e)},this.pause=function(e,t={}){return z([[V,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=A(t),r=u(e,$.html),{instant:o}=t;return z([n[0],[U,{chars:r,instant:o},X],n[1]],t)},this.is=function(e){return Z[e]},this.destroy=function(e=!0){K.forEach(e=>clearTimeout(e)),K=[],S(e)&&L(ne),Z.destroyed=!0},this.freeze=function(){Z.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),W=0;for(let e in Z)Z[e]=!1;return G[E()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!E()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(j).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(_,$,G),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),$.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(G,O.bind(this)),this):(O(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=l)?d(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=t({},m),$=t(v,N);$=t($,{html:!E()&&$.html,nextStringDelay:y($.nextStringDelay),loopDelay:y($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!E(),ne=(()=>{if(E())return;let e=c("span");return e.className="ti-cursor",te?(e.innerHTML=r($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(s(t).forEach(e=>{M(G,e,ne,W)}),B([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[i(c("BR"))],silent:!0},X]]:[[F,{num:r.length},X]];B(o)})})()}export{C as default};
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var c=e=>document.createElement(e),l=e=>document.createTextNode(e),a=(e,t="")=>{let n=c("style");n.id=t,n.appendChild(l(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},v={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var p=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,y=e=>(f(e)||(e=[e/2,e/2]),e),g=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let P=e=>e/2;var b=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,c=i?t.content:l(t.content);if(b(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!N(u)){let r=T(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{c=u.cloneNode(),c.appendChild(l(t.content));let n=u.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(c,f.contains(n)?n:null)};var L=e=>e&&e.remove();const j={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function w(e,t,n){if(!e.s){if(n instanceof D){if(!n.s)return void(n.o=w.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(w.bind(null,e,t),w.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const D=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{w(r,1,e(this.v))}catch(e){w(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?w(r,1,t?t(o):o):n?w(r,1,n(o)):w(r,2,o)}catch(e){w(r,2,e)}},r},e}();function E(e){return e instanceof D&&1&e.s}function x(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!E(u))return void u.then(s,o||(o=w.bind(null,r=new D,2)));u=u.v}r?w(r,1,u):r=u}catch(e){w(r||(r=new D),2,e)}}(),r}function k(e,t,n){for(var r;;){var o=e();if(E(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!E(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!E(s)){r=2;break}}}var u=new D,c=w.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(l):s.then(f)).then(void 0,c),u;function l(r){i=r;do{if(t&&(s=t())&&s.then&&!E(s))return void s.then(f).then(void 0,c);if(!(o=e())||E(o)&&!o.v)return void w(u,1,i);if(o.then)return void o.then(a).then(void 0,c);E(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function a(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):w(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):w(u,1,i)}}function C(l,N={}){const T=this,w=this,D=function(e,t){try{function n(){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,K))}const r=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{T.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},E=()=>b(G),C=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[g(t,P(t)),g(n,P(n))]:[t,n]}($)[e],H=(e,t=0)=>e?C(t):0,z=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),R=()=>(e=>b(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(G),A=(e={})=>[[Q,e],[Q,$]],B=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},I=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},O=function(){try{let e;Z.started=!0;let t,n=ee.getItems();const r=function(e,r){try{var o=function(){function e(){return Z.completed=!0,Promise.resolve($.afterComplete(...t)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;D(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[V,e,{}]),Promise.resolve(F({num:null})).then(function(){})}return Promise.resolve(W?Promise.resolve(q({value:W})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){O()})}catch(e){return Promise.reject(e)}},e[1])})}const r=x(n,function(e){let r=n[e],o=r[2];return t=[r,w],o.freezeCursor&&I(!0),Promise.resolve($.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(w,r[1],o)).then(function(){return Promise.resolve($.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),I(!1)})})})});return r&&r.then?r.then(e):e()}()}catch(e){return}return o&&o.then?o.then(void 0,function(){}):o}();return Promise.resolve(r&&r.then?r.then(function(t){return e?t:w}):e?r:w)}catch(e){return Promise.reject(e)}},V=(e=0)=>D(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=p({el:G,move:e,cursorPos:W,to:t}),o=()=>{W+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(G,R(),ne,W)};return Promise.resolve(D(function(){try{let e=0;const t=k(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(D(o,C(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return D(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=x(e,function(n){return t?void i(e[n]):Promise.resolve(D(()=>{i(e[n])},C(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>M(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},H(t))},Q=function(e){try{return $=t($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return E()?(G.value="",Promise.resolve()):(R().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(D(function(){try{let r=h(e)?e:p({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=R();var t;e.length&&(E()?G.value=G.value.slice(0,-1):(L(e[W]),t=ne,d("*",G,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};let i=0;const s=k(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(D(o,C(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(F({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(c("BR"));return z([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=A(t),r=e,{instant:o,to:i}=t;return z([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return z([[Y]],e)},this.exec=function(e,t){let n=A(t);return z([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=A(t),{instant:r,to:o}=t;return z([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=S(e),z([[Q,e]],e)},this.pause=function(e,t={}){return z([[V,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=A(t),r=u(e,$.html),{instant:o}=t;return z([n[0],[U,{chars:r,instant:o},X],n[1]],t)},this.is=function(e){return Z[e]},this.destroy=function(e=!0){K.forEach(e=>clearTimeout(e)),K=[],S(e)&&L(ne),Z.destroyed=!0},this.freeze=function(){Z.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),W=0;for(let e in Z)Z[e]=!1;return G[E()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!E()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(j).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(_,$,G),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),$.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(G,O.bind(this)),this):(O(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=l)?d(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=t({},m),$=t(v,N);$=t($,{html:!E()&&$.html,nextStringDelay:y($.nextStringDelay),loopDelay:y($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!E(),ne=(()=>{if(E())return;let e=c("span");return e.className="ti-cursor",te?(e.innerHTML=r($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(s(t).forEach(e=>{M(G,e,ne,W)}),B([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[i(c("BR"))]},X]]:[[F,{num:r.length},X]];B(o)})})()}export{C as default};
// TypeIt by Alex MacArthur - https://typeitjs.com
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var c=e=>document.createElement(e),l=e=>document.createTextNode(e),a=(e,t="")=>{let n=c("style");n.id=t,n.appendChild(l(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},v={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var p=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,y=e=>(f(e)||(e=[e/2,e/2]),e),g=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let P=e=>e/2;var b=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,c=i?t.content:l(t.content);if(b(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!N(u)){let r=T(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{c=u.cloneNode(),c.appendChild(l(t.content));let n=u.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(c,f.contains(n)?n:null)};var L=e=>e&&e.remove();const j={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function w(e,t,n){if(!e.s){if(n instanceof D){if(!n.s)return void(n.o=w.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(w.bind(null,e,t),w.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const D=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{w(r,1,e(this.v))}catch(e){w(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?w(r,1,t?t(o):o):n?w(r,1,n(o)):w(r,2,o)}catch(e){w(r,2,e)}},r},e}();function E(e){return e instanceof D&&1&e.s}function x(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!E(u))return void u.then(s,o||(o=w.bind(null,r=new D,2)));u=u.v}r?w(r,1,u):r=u}catch(e){w(r||(r=new D),2,e)}}(),r}function k(e,t,n){for(var r;;){var o=e();if(E(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!E(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!E(s)){r=2;break}}}var u=new D,c=w.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(l):s.then(f)).then(void 0,c),u;function l(r){i=r;do{if(t&&(s=t())&&s.then&&!E(s))return void s.then(f).then(void 0,c);if(!(o=e())||E(o)&&!o.v)return void w(u,1,i);if(o.then)return void o.then(a).then(void 0,c);E(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function a(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):w(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):w(u,1,i)}}module.exports=function(l,N={}){const T=this,w=this,D=function(e,t,n=!1){try{function r(){function r(r){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,K)).then(function(){return n?void 0:Promise.resolve($.afterStep(T)).then(function(e){})})}return n?r():Promise.resolve($.beforeStep(T)).then(r)}const o=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{T.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},E=()=>b(G),C=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[g(t,P(t)),g(n,P(n))]:[t,n]}($)[e],H=(e,t=0)=>e?C(t):0,z=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),R=()=>(e=>b(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(G),A=(e={})=>[[Q,e],[Q,$]],B=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},I=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},O=function(){try{let e;Z.started=!0;let t=ee.getItems();const n=function(e,n){try{var r=function(){function e(){return Z.completed=!0,Promise.resolve($.afterComplete(w)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;D(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[V,e,{}]),Promise.resolve(F({num:null})).then(function(){})}return Promise.resolve(W?Promise.resolve(q({value:W})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){O()})}catch(e){return Promise.reject(e)}},e[1])})}const n=x(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&I(!0),Promise.resolve(n[0].call(w,n[1],r)).then(function(){ee.setMeta(e,{executed:!0}),I(!1)})});return n&&n.then?n.then(e):e()}()}catch(e){return}return r&&r.then?r.then(void 0,function(){}):r}();return Promise.resolve(n&&n.then?n.then(function(t){return e?t:w}):e?n:w)}catch(e){return Promise.reject(e)}},V=(e=0)=>D(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=p({el:G,move:e,cursorPos:W,to:t}),o=()=>{W+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(G,R(),ne,W)};return Promise.resolve(D(function(){try{let e=0;const t=k(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(D(o,C(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return D(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=x(e,function(n){return t?void i(e[n]):Promise.resolve(D(()=>{i(e[n])},C(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>M(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},H(t),!0)},Q=function(e){try{return $=t($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return E()?(G.value="",Promise.resolve()):(R().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(D(function(){try{let r=h(e)?e:p({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=R();var t;e.length&&(E()?G.value=G.value.slice(0,-1):(L(e[W]),t=ne,d("*",G,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};let i=0;const s=k(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(D(o,C(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(F({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(c("BR"));return z([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=A(t),r=e,{instant:o,to:i}=t;return z([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return z([[Y]],e)},this.exec=function(e,t){let n=A(t);return z([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=A(t),{instant:r,to:o}=t;return z([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=S(e),z([[Q,e]],e)},this.pause=function(e,t={}){return z([[V,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=A(t),r=u(e,$.html),{instant:o}=t;return z([n[0],[U,{chars:r,instant:o},X],n[1]],t)},this.is=function(e){return Z[e]},this.destroy=function(e=!0){K.forEach(e=>clearTimeout(e)),K=[],S(e)&&L(ne),Z.destroyed=!0},this.freeze=function(){Z.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),W=0;for(let e in Z)Z[e]=!1;return G[E()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!E()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(j).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(_,$,G),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),$.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(G,O.bind(this)),this):(O(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=l)?d(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=t({},m),$=t(v,N);$=t($,{html:!E()&&$.html,nextStringDelay:y($.nextStringDelay),loopDelay:y($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!E(),ne=(()=>{if(E())return;let e=c("span");return e.className="ti-cursor",te?(e.innerHTML=r($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(s(t).forEach(e=>{M(G,e,ne,W)}),B([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[i(c("BR"))],silent:!0},X]]:[[F,{num:r.length},X]];B(o)})})()};
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var c=e=>document.createElement(e),l=e=>document.createTextNode(e),a=(e,t="")=>{let n=c("style");n.id=t,n.appendChild(l(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},v={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var p=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,y=e=>(f(e)||(e=[e/2,e/2]),e),g=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let P=e=>e/2;var b=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,c=i?t.content:l(t.content);if(b(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!N(u)){let r=T(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{c=u.cloneNode(),c.appendChild(l(t.content));let n=u.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(c,f.contains(n)?n:null)};var L=e=>e&&e.remove();const j={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function w(e,t,n){if(!e.s){if(n instanceof D){if(!n.s)return void(n.o=w.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(w.bind(null,e,t),w.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const D=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{w(r,1,e(this.v))}catch(e){w(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?w(r,1,t?t(o):o):n?w(r,1,n(o)):w(r,2,o)}catch(e){w(r,2,e)}},r},e}();function E(e){return e instanceof D&&1&e.s}function x(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!E(u))return void u.then(s,o||(o=w.bind(null,r=new D,2)));u=u.v}r?w(r,1,u):r=u}catch(e){w(r||(r=new D),2,e)}}(),r}function k(e,t,n){for(var r;;){var o=e();if(E(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!E(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!E(s)){r=2;break}}}var u=new D,c=w.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(l):s.then(f)).then(void 0,c),u;function l(r){i=r;do{if(t&&(s=t())&&s.then&&!E(s))return void s.then(f).then(void 0,c);if(!(o=e())||E(o)&&!o.v)return void w(u,1,i);if(o.then)return void o.then(a).then(void 0,c);E(i=n())&&(i=i.v)}while(!i||!i.then);i.then(l).then(void 0,c)}function a(e){e?(i=n())&&i.then?i.then(l).then(void 0,c):l(i):w(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):w(u,1,i)}}module.exports=function(l,N={}){const T=this,w=this,D=function(e,t){try{function n(){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,K))}const r=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{T.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},E=()=>b(G),C=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[g(t,P(t)),g(n,P(n))]:[t,n]}($)[e],H=(e,t=0)=>e?C(t):0,z=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),R=()=>(e=>b(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(G),A=(e={})=>[[Q,e],[Q,$]],B=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},I=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},O=function(){try{let e;Z.started=!0;let t,n=ee.getItems();const r=function(e,r){try{var o=function(){function e(){return Z.completed=!0,Promise.resolve($.afterComplete(...t)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;D(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[V,e,{}]),Promise.resolve(F({num:null})).then(function(){})}return Promise.resolve(W?Promise.resolve(q({value:W})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){O()})}catch(e){return Promise.reject(e)}},e[1])})}const r=x(n,function(e){let r=n[e],o=r[2];return t=[r,w],o.freezeCursor&&I(!0),Promise.resolve($.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(w,r[1],o)).then(function(){return Promise.resolve($.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),I(!1)})})})});return r&&r.then?r.then(e):e()}()}catch(e){return}return o&&o.then?o.then(void 0,function(){}):o}();return Promise.resolve(r&&r.then?r.then(function(t){return e?t:w}):e?r:w)}catch(e){return Promise.reject(e)}},V=(e=0)=>D(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=p({el:G,move:e,cursorPos:W,to:t}),o=()=>{W+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(G,R(),ne,W)};return Promise.resolve(D(function(){try{let e=0;const t=k(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(D(o,C(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return D(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=x(e,function(n){return t?void i(e[n]):Promise.resolve(D(()=>{i(e[n])},C(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>M(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},H(t))},Q=function(e){try{return $=t($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return E()?(G.value="",Promise.resolve()):(R().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(D(function(){try{let r=h(e)?e:p({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=R();var t;e.length&&(E()?G.value=G.value.slice(0,-1):(L(e[W]),t=ne,d("*",G,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};let i=0;const s=k(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(D(o,C(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},H(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(F({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(c("BR"));return z([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=A(t),r=e,{instant:o,to:i}=t;return z([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return z([[Y]],e)},this.exec=function(e,t){let n=A(t);return z([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=A(t),{instant:r,to:o}=t;return z([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=S(e),z([[Q,e]],e)},this.pause=function(e,t={}){return z([[V,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=A(t),r=u(e,$.html),{instant:o}=t;return z([n[0],[U,{chars:r,instant:o},X],n[1]],t)},this.is=function(e){return Z[e]},this.destroy=function(e=!0){K.forEach(e=>clearTimeout(e)),K=[],S(e)&&L(ne),Z.destroyed=!0},this.freeze=function(){Z.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),W=0;for(let e in Z)Z[e]=!1;return G[E()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!E()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(j).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(_,$,G),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),$.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(G,O.bind(this)),this):(O(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=l)?d(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=t({},m),$=t(v,N);$=t($,{html:!E()&&$.html,nextStringDelay:y($.nextStringDelay),loopDelay:y($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!E(),ne=(()=>{if(E())return;let e=c("span");return e.className="ti-cursor",te?(e.innerHTML=r($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(s(t).forEach(e=>{M(G,e,ne,W)}),B([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[i(c("BR"))]},X]]:[[F,{num:r.length},X]];B(o)})})()};
// TypeIt by Alex MacArthur - https://typeitjs.com
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const i=(e,t=null,r=!1)=>{let a=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:i(e);var t});return t&&(a=a.filter(e=>!t.contains(e))),r?a.reverse():a},a=(e,t=null)=>({node:t,content:e});function l(e){let t=r(e);return i(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>a(t,e)):a(e))}function o(e,t=!0){return t?l(e):n(e).map(e=>a(e))}var s=e=>document.createElement(e),u=e=>document.createTextNode(e),c=(e,t="")=>{let n=s("style");n.id=t,n.appendChild(u(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const f=e=>Number.isInteger(e),h=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},p={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var y=({el:e,move:t,cursorPos:n,to:r})=>f(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),a=h(".ti-cursor",t),l=e?h(e,t):t,o=i(l,a,!0),s=o[0],u=o[o.length-1],c=r&&!e?0:i(t,a,!0).findIndex(e=>e.isSameNode(r?s:u));return r&&c--,c+1})(t,e,r)-n,g=e=>(d(e)||(e=[e/2,e/2]),e),v=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let b=e=>e/2;var w=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(h("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let a=t.content instanceof HTMLElement,l=t.node,o=null==l?void 0:l.parentNode,s=a?t.content:u(t.content);if(w(e))return void(e.value=`${e.value}${t.content}`);if(!a&&o&&!N(o)){let r=T(o,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{s=o.cloneNode(),s.appendChild(u(t.content));let n=o.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let i=r;i.innerHTML=s.outerHTML,s=i,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let c=i(e,n,!0)[r-1],d=c?c.parentNode:e;d.insertBefore(s,d.contains(n)?n:null)};var L=e=>e&&e.remove();const D={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function E(u,N={}){const T=async(e,t,n=!1)=>{G.frozen&&await new Promise(e=>{this.unfreeze=()=>{G.frozen=!1,e()}}),n||await J.beforeStep(this),await(async(e,t,n)=>new Promise(r=>{n.push(setTimeout(async()=>{await e(),r()},t))}))(e,t,Q),n||await J.afterStep(this)},E=()=>w(j),$=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[v(t,b(t)),v(n,b(n))]:[t,n]}(J)[e],x=(e,t=0)=>e?$(t):0,C=(e,t)=>(W.add(e),((e={})=>{let t=e.delay;t&&W.add([[B,t]])})(t),this),H=()=>(e=>w(e)?n(e.value):i(e,h(".ti-cursor",e),!0))(j),z=(e={})=>[[P,e],[P,J]],k=e=>{let t=J.nextStringDelay;W.add([[B,t[0]],...e,[B,t[1]]])},R=e=>{X&&(Z.classList.toggle("disabled",e),Z.classList.toggle("with-delay",!e))},A=async()=>{G.started=!0;let e=W.getItems();try{for(let t=0;t<e.length;t++){let n=e[t],r=n[2];r.freezeCursor&&R(!0),await n[0].call(this,n[1],r),W.setMeta(t,{executed:!0}),R(!1)}if(G.completed=!0,await J.afterComplete(this),!J.loop)throw"";let t=J.loopDelay;T(async()=>{await(async e=>{Y&&await I({value:Y}),W.reset(),W.set(0,[B,e,{}]),await q({num:null})})(t[0]),A()},t[1])}catch(e){}return this},B=(e=0)=>T(()=>{},e),I=async({value:e,to:t="START",instant:n=!1})=>{let r=y({el:j,move:e,cursorPos:Y,to:t}),i=()=>{Y+=r<0?-1:1,((e,t,n,r)=>{let i=t[Math.min(r,t.length)-1];(e=(null==i?void 0:i.parentNode)||e).insertBefore(n,i||null)})(j,H(),Z,Y)};await T(async()=>{for(let e=0;e<Math.abs(r);e++)n?i():await T(i,$(0))},x(n))},O=({chars:e,instant:t,silent:n})=>T(async()=>{const r=e=>M(j,e,Z,Y);n||await J.beforeString(e,this);for(let n=0;n<e.length;n++)t?r(e[n]):await T(()=>{r(e[n])},$(0));n||await J.afterString(e,this)},x(t),!0),P=async e=>{J=t(J,e)},V=async()=>{E()?j.value="":H().forEach(e=>{L(e)})},q=async({num:e=null,instant:t=!1,to:n="START"})=>{await T(async()=>{let r=f(e)?e:y({el:j,move:e,cursorPos:Y,to:n});const i=()=>{let e=H();var t;e.length&&(E()?j.value=j.value.slice(0,-1):(L(e[Y]),t=Z,h("*",j,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};for(let e=0;e<r;e++)t?i():await T(i,$(1))},x(t,1)),null===e&&H().length-1>0&&await q({num:null})};this.break=function(e){const t=a(s("BR"));return C([[O,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=z(t),r=e,{instant:i,to:a}=t;return C([n[0],[q,{num:r,instant:i,to:a},F],n[1]],t)},this.empty=function(e={}){return C([[V]],e)},this.exec=function(e,t){let n=z(t);return C([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=z(t),{instant:r,to:i}=t;return C([n[0],[I,{value:null===e?"":e,to:i,instant:r},F],n[1]],t)},this.options=function(e){return e=S(e),C([[P,e]],e)},this.pause=function(e,t={}){return C([[B,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=z(t),r=o(e,J.html),{instant:i}=t;return C([n[0],[O,{chars:r,instant:i},F],n[1]],t)},this.is=function(e){return G[e]},this.destroy=function(e=!0){Q.forEach(e=>clearTimeout(e)),Q=[],S(e)&&L(Z),G.destroyed=!0},this.freeze=function(){G.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),W.reset(),Y=0;for(let e in G)G[e]=!1;return j[E()?"value":"innerHTML"]="",this},this.go=function(){return G.started?this:((async()=>{!E()&&j.appendChild(Z),X&&((e,t,n)=>{let r=`[data-typeit-id='${e}'] .ti-cursor`,i=getComputedStyle(n),a=Object.entries(D).reduce((e,[t,n])=>`${e} ${t}: var(--ti-${t}, ${n||i[t]});`,"");c(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${r} { display: inline; letter-spacing: -1em; ${a} animation: blink-${e} ${t.cursorSpeed/1e3}s infinite; } ${r}.with-delay { animation-delay: 500ms; } ${r}.disabled { animation: none; }`,e)})(K,J,j)})(),J.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(j,A.bind(this)),this):(A(),this))},this.getQueue=function(){return W},this.getOptions=function(){return J},this.getElement=function(){return j};let j="string"==typeof(U=u)?h(U):U;var U;let Q=[],Y=0,F={freezeCursor:!0},G=t({},m),J=t(p,N);J=t(J,{html:!E()&&J.html,nextStringDelay:g(J.nextStringDelay),loopDelay:g(J.loopDelay)});let K=Math.random().toString().substring(2,9),W=function(n){const r=function(t){return i=i.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let i=[];return r(n),{add:r,set:function(e,t){i[e]=t},reset:function(){i=i.map(e=>(e[2].executed=!1,e))},getItems:function(){return i.filter(e=>!e[2].executed)},setMeta:function(e,n){i[e][2]=t(i[e][2],n)}}}([[B,J.startDelay]]);j.dataset.typeitId=K,c("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let X=J.cursor&&!E(),Z=(()=>{if(E())return;let e=s("span");return e.className="ti-cursor",X?(e.innerHTML=r(J.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var _;J.strings=(e=>{let t=j.innerHTML;return t?(j.innerHTML="",J.startDelete?(l(t).forEach(e=>{M(j,e,Z,Y)}),k([[q,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(_=J.strings)?_:[_]),J.strings.length&&(()=>{let e=J.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=o(t,J.html);if(W.add([[O,{chars:r},F]]),n+1===e.length)return;const i=J.breakLines?[[O,{chars:[a(s("BR"))],silent:!0},F]]:[[q,{num:r.length},F]];k(i)})})()}export{E as default};
const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const i=(e,t=null,r=!1)=>{let a=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:i(e);var t});return t&&(a=a.filter(e=>!t.contains(e))),r?a.reverse():a},a=(e,t=null)=>({node:t,content:e});function l(e){let t=r(e);return i(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>a(t,e)):a(e))}function o(e,t=!0){return t?l(e):n(e).map(e=>a(e))}var s=e=>document.createElement(e),u=e=>document.createTextNode(e),c=(e,t="")=>{let n=s("style");n.id=t,n.appendChild(u(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const f=e=>Number.isInteger(e),h=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m={started:!1,completed:!1,frozen:!1,destroyed:!1},p={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var y=({el:e,move:t,cursorPos:n,to:r})=>f(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),a=h(".ti-cursor",t),l=e?h(e,t):t,o=i(l,a,!0),s=o[0],u=o[o.length-1],c=r&&!e?0:i(t,a,!0).findIndex(e=>e.isSameNode(r?s:u));return r&&c--,c+1})(t,e,r)-n,g=e=>(d(e)||(e=[e/2,e/2]),e),v=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let b=e=>e/2;var w=e=>"value"in e;const S=e=>"function"==typeof e?e():e;var N=e=>"BODY"===e.tagName;const T=(e,t)=>{let r=n(h("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},M=(e,t,n,r)=>{let a=t.content instanceof HTMLElement,l=t.node,o=null==l?void 0:l.parentNode,s=a?t.content:u(t.content);if(w(e))return void(e.value=`${e.value}${t.content}`);if(!a&&o&&!N(o)){let r=T(o,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{s=o.cloneNode(),s.appendChild(u(t.content));let n=o.parentNode,r=n.cloneNode();if(!N(n)){let t=T(r,e);for(;!t&&!N(n);){let i=r;i.innerHTML=s.outerHTML,s=i,n=n.parentNode,r=n.cloneNode(),t=T(r,e)}e=t||e}}}let c=i(e,n,!0)[r-1],d=c?c.parentNode:e;d.insertBefore(s,d.contains(n)?n:null)};var L=e=>e&&e.remove();const D={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function E(u,N={}){const T=async(e,t)=>(G.frozen&&await new Promise(e=>{this.unfreeze=()=>{G.frozen=!1,e()}}),await(async(e,t,n)=>new Promise(r=>{n.push(setTimeout(async()=>{await e(),r()},t))}))(e,t,Q)),E=()=>w(j),$=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[v(t,b(t)),v(n,b(n))]:[t,n]}(J)[e],x=(e,t=0)=>e?$(t):0,C=(e,t)=>(W.add(e),((e={})=>{let t=e.delay;t&&W.add([[B,t]])})(t),this),H=()=>(e=>w(e)?n(e.value):i(e,h(".ti-cursor",e),!0))(j),z=(e={})=>[[P,e],[P,J]],k=e=>{let t=J.nextStringDelay;W.add([[B,t[0]],...e,[B,t[1]]])},R=e=>{X&&(Z.classList.toggle("disabled",e),Z.classList.toggle("with-delay",!e))},A=async()=>{G.started=!0;let e,t=W.getItems();try{for(let n=0;n<t.length;n++){let r=t[n],i=r[2];e=[r,this],i.freezeCursor&&R(!0),await J.beforeStep(...e),await r[0].call(this,r[1],i),await J.afterStep(...e),W.setMeta(n,{executed:!0}),R(!1)}if(G.completed=!0,await J.afterComplete(...e),!J.loop)throw"";let n=J.loopDelay;T(async()=>{await(async e=>{Y&&await I({value:Y}),W.reset(),W.set(0,[B,e,{}]),await q({num:null})})(n[0]),A()},n[1])}catch(e){}return this},B=(e=0)=>T(()=>{},e),I=async({value:e,to:t="START",instant:n=!1})=>{let r=y({el:j,move:e,cursorPos:Y,to:t}),i=()=>{Y+=r<0?-1:1,((e,t,n,r)=>{let i=t[Math.min(r,t.length)-1];(e=(null==i?void 0:i.parentNode)||e).insertBefore(n,i||null)})(j,H(),Z,Y)};await T(async()=>{for(let e=0;e<Math.abs(r);e++)n?i():await T(i,$(0))},x(n))},O=({chars:e,instant:t,silent:n})=>T(async()=>{const r=e=>M(j,e,Z,Y);n||await J.beforeString(e,this);for(let n=0;n<e.length;n++)t?r(e[n]):await T(()=>{r(e[n])},$(0));n||await J.afterString(e,this)},x(t)),P=async e=>{J=t(J,e)},V=async()=>{E()?j.value="":H().forEach(e=>{L(e)})},q=async({num:e=null,instant:t=!1,to:n="START"})=>{await T(async()=>{let r=f(e)?e:y({el:j,move:e,cursorPos:Y,to:n});const i=()=>{let e=H();var t;e.length&&(E()?j.value=j.value.slice(0,-1):(L(e[Y]),t=Z,h("*",j,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;L(t)}})))};for(let e=0;e<r;e++)t?i():await T(i,$(1))},x(t,1)),null===e&&H().length-1>0&&await q({num:null})};this.break=function(e){const t=a(s("BR"));return C([[O,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=S(e);let n=z(t),r=e,{instant:i,to:a}=t;return C([n[0],[q,{num:r,instant:i,to:a},F],n[1]],t)},this.empty=function(e={}){return C([[V]],e)},this.exec=function(e,t){let n=z(t);return C([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=S(e);let n=z(t),{instant:r,to:i}=t;return C([n[0],[I,{value:null===e?"":e,to:i,instant:r},F],n[1]],t)},this.options=function(e){return e=S(e),C([[P,e]],e)},this.pause=function(e,t={}){return C([[B,S(e)]],t)},this.type=function(e,t={}){e=S(e);let n=z(t),r=o(e,J.html),{instant:i}=t;return C([n[0],[O,{chars:r,instant:i},F],n[1]],t)},this.is=function(e){return G[e]},this.destroy=function(e=!0){Q.forEach(e=>clearTimeout(e)),Q=[],S(e)&&L(Z),G.destroyed=!0},this.freeze=function(){G.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),W.reset(),Y=0;for(let e in G)G[e]=!1;return j[E()?"value":"innerHTML"]="",this},this.go=function(){return G.started?this:((async()=>{!E()&&j.appendChild(Z),X&&((e,t,n)=>{let r=`[data-typeit-id='${e}'] .ti-cursor`,i=getComputedStyle(n),a=Object.entries(D).reduce((e,[t,n])=>`${e} ${t}: var(--ti-${t}, ${n||i[t]});`,"");c(`@keyframes blink-${e} { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ${r} { display: inline; letter-spacing: -1em; ${a} animation: blink-${e} ${t.cursorSpeed/1e3}s infinite; } ${r}.with-delay { animation-delay: 500ms; } ${r}.disabled { animation: none; }`,e)})(K,J,j)})(),J.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(j,A.bind(this)),this):(A(),this))},this.getQueue=function(){return W},this.getOptions=function(){return J},this.getElement=function(){return j};let j="string"==typeof(U=u)?h(U):U;var U;let Q=[],Y=0,F={freezeCursor:!0},G=t({},m),J=t(p,N);J=t(J,{html:!E()&&J.html,nextStringDelay:g(J.nextStringDelay),loopDelay:g(J.loopDelay)});let K=Math.random().toString().substring(2,9),W=function(n){const r=function(t){return i=i.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let i=[];return r(n),{add:r,set:function(e,t){i[e]=t},reset:function(){i=i.map(e=>(e[2].executed=!1,e))},getItems:function(){return i.filter(e=>!e[2].executed)},setMeta:function(e,n){i[e][2]=t(i[e][2],n)}}}([[B,J.startDelay]]);j.dataset.typeitId=K,c("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let X=J.cursor&&!E(),Z=(()=>{if(E())return;let e=s("span");return e.className="ti-cursor",X?(e.innerHTML=r(J.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var _;J.strings=(e=>{let t=j.innerHTML;return t?(j.innerHTML="",J.startDelete?(l(t).forEach(e=>{M(j,e,Z,Y)}),k([[q,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(_=J.strings)?_:[_]),J.strings.length&&(()=>{let e=J.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=o(t,J.html);if(W.add([[O,{chars:r},F]]),n+1===e.length)return;const i=J.breakLines?[[O,{chars:[a(s("BR"))]},F]]:[[q,{num:r.length},F]];k(i)})})()}export{E as default};
// TypeIt by Alex MacArthur - https://typeitjs.com
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).TypeIt=t()}(this,function(){const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var l=e=>document.createElement(e),c=e=>document.createTextNode(e),a=(e,t="")=>{let n=l("style");n.id=t,n.appendChild(c(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m="ti-cursor",v="START",p={started:!1,completed:!1,frozen:!1,destroyed:!1},y={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var g=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n=v)=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),l=u[0],c=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?l:c));return r&&a--,a+1})(t,e,r)-n,P=e=>(f(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let N=e=>e/2;var S=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const j=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},L=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,l=i?t.content:c(t.content);if(S(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!T(u)){let r=j(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{l=u.cloneNode(),l.appendChild(c(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=j(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=l.outerHTML,l=o,n=n.parentNode,r=n.cloneNode(),t=j(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(l,f.contains(n)?n:null)};var w=e=>e&&e.remove();const D={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function E(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=E.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(E.bind(null,e,t),E.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const x=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{E(r,1,e(this.v))}catch(e){E(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?E(r,1,t?t(o):o):n?E(r,1,n(o)):E(r,2,o)}catch(e){E(r,2,e)}},r},e}();function k(e){return e instanceof x&&1&e.s}function C(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!k(u))return void u.then(s,o||(o=E.bind(null,r=new x,2)));u=u.v}r?E(r,1,u):r=u}catch(e){E(r||(r=new x),2,e)}}(),r}function H(e,t,n){for(var r;;){var o=e();if(k(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!k(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!k(s)){r=2;break}}}var u=new x,l=E.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(c):s.then(f)).then(void 0,l),u;function c(r){i=r;do{if(t&&(s=t())&&s.then&&!k(s))return void s.then(f).then(void 0,l);if(!(o=e())||k(o)&&!o.v)return void E(u,1,i);if(o.then)return void o.then(a).then(void 0,l);k(i=n())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,l)}function a(e){e?(i=n())&&i.then?i.then(c).then(void 0,l):c(i):E(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,l):a(o):E(u,1,i)}}return function(c,T={}){const j=this,E=this,x=function(e,t,n=!1){try{function r(){function r(r){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,X)).then(function(){return n?void 0:Promise.resolve(ee.afterStep(j)).then(function(e){})})}return n?r():Promise.resolve(ee.beforeStep(j)).then(r)}const o=function(){if(_.frozen)return Promise.resolve(new Promise(e=>{j.unfreeze=()=>{_.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},k=()=>S(K),z=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,N(t)),b(n,N(n))]:[t,n]}(ee)[e],I=(e,t=0)=>e?z(t):0,B=(e,t)=>(ne.add(e),((e={})=>{let t=e.delay;t&&ne.add([[U,t]])})(t),this),R=()=>(e=>S(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(K),A=(e={})=>[[F,e],[F,ee]],O=e=>{let t=ee.nextStringDelay;ne.add([[U,t[0]],...e,[U,t[1]]])},V=e=>{re&&(oe.classList.toggle("disabled",e),oe.classList.toggle("with-delay",!e))},q=function(){try{let e;_.started=!0;let t=ne.getItems();const n=function(e,n){try{var r=function(){function e(){return _.completed=!0,Promise.resolve(ee.afterComplete(E)).then(function(){if(!ee.loop)throw"";let e=ee.loopDelay;x(function(){try{return Promise.resolve(function(e){try{function t(t){return ne.reset(),ne.set(0,[U,e,{}]),Promise.resolve(J({num:null})).then(function(){})}return Promise.resolve(Z?Promise.resolve(Q({value:Z})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){q()})}catch(e){return Promise.reject(e)}},e[1])})}const n=C(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&V(!0),Promise.resolve(n[0].call(E,n[1],r)).then(function(){ne.setMeta(e,{executed:!0}),V(!1)})});return n&&n.then?n.then(e):e()}()}catch(e){return}return r&&r.then?r.then(void 0,function(){}):r}();return Promise.resolve(n&&n.then?n.then(function(t){return e?t:E}):e?n:E)}catch(e){return Promise.reject(e)}},U=(e=0)=>x(()=>{},e),Q=function({value:e,to:t=v,instant:n=!1}){try{let r=g({el:K,move:e,cursorPos:Z,to:t}),o=()=>{Z+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(K,R(),oe,Z)};return Promise.resolve(x(function(){try{let e=0;const t=H(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(x(o,z(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I(n))).then(function(){})}catch(e){return Promise.reject(e)}},Y=({chars:e,instant:t,silent:n})=>{const r=this;return x(function(){try{function o(o){function s(){return n?void 0:Promise.resolve(ee.afterString(e,r)).then(function(e){})}const u=C(e,function(n){return t?void i(e[n]):Promise.resolve(x(()=>{i(e[n])},z(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>L(K,e,oe,Z);return Promise.resolve(n?o():Promise.resolve(ee.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},I(t),!0)},F=function(e){try{return ee=t(ee,e),Promise.resolve()}catch(e){return Promise.reject(e)}},G=function(){try{return k()?(K.value="",Promise.resolve()):(R().forEach(e=>{w(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},J=function({num:e=null,instant:t=!1,to:n=v}){try{return Promise.resolve(x(function(){try{let r=h(e)?e:g({el:K,move:e,cursorPos:Z,to:n});const o=()=>{let e=R();var t;e.length&&(k()?K.value=K.value.slice(0,-1):(w(e[Z]),t=oe,d("*",K,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;w(t)}})))};let i=0;const s=H(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(x(o,z(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(J({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(l("BR"));return B([[Y,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=A(t),r=e,{instant:o,to:i}=t;return B([n[0],[J,{num:r,instant:o,to:i},$],n[1]],t)},this.empty=function(e={}){return B([[G]],e)},this.exec=function(e,t){let n=A(t);return B([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=A(t),{instant:r,to:o}=t;return B([n[0],[Q,{value:null===e?"":e,to:o,instant:r},$],n[1]],t)},this.options=function(e){return e=M(e),B([[F,e]],e)},this.pause=function(e,t={}){return B([[U,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=A(t),r=u(e,ee.html),{instant:o}=t;return B([n[0],[Y,{chars:r,instant:o},$],n[1]],t)},this.is=function(e){return _[e]},this.destroy=function(e=!0){X.forEach(e=>clearTimeout(e)),X=[],M(e)&&w(oe),_.destroyed=!0},this.freeze=function(){_.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ne.reset(),Z=0;for(let e in _)_[e]=!1;return K[k()?"value":"innerHTML"]="",this},this.go=function(){return _.started?this:(function(){try{!k()&&K.appendChild(oe),re?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] ."+m,o=getComputedStyle(n),i=Object.entries(D).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(te,ee,K),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),ee.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(K,q.bind(this)),this):(q(),this))},this.getQueue=function(){return ne},this.getOptions=function(){return ee},this.getElement=function(){return K};let K="string"==typeof(W=c)?d(W):W;var W;let X=[],Z=0,$={freezeCursor:!0},_=t({},p),ee=t(y,T);ee=t(ee,{html:!k()&&ee.html,nextStringDelay:P(ee.nextStringDelay),loopDelay:P(ee.loopDelay)});let te=Math.random().toString().substring(2,9),ne=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[U,ee.startDelay]]);K.dataset.typeitId=te,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let re=ee.cursor&&!k(),oe=(()=>{if(k())return;let e=l("span");return e.className=m,re?(e.innerHTML=r(ee.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var ie;ee.strings=(e=>{let t=K.innerHTML;return t?(K.innerHTML="",ee.startDelete?(s(t).forEach(e=>{L(K,e,oe,Z)}),O([[J,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(ie=ee.strings)?ie:[ie]),ee.strings.length&&(()=>{let e=ee.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,ee.html);if(ne.add([[Y,{chars:r},$]]),n+1===e.length)return;const o=ee.breakLines?[[Y,{chars:[i(l("BR"))],silent:!0},$]]:[[J,{num:r.length},$]];O(o)})})()}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).TypeIt=t()}(this,function(){const e=[null,null,{}];var t=(e,t)=>Object.assign({},e,t),n=e=>Array.from(e),r=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const o=(e,t=null,r=!1)=>{let i=n(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:o(e);var t});return t&&(i=i.filter(e=>!t.contains(e))),r?i.reverse():i},i=(e,t=null)=>({node:t,content:e});function s(e){let t=r(e);return o(t).flatMap(e=>e.nodeValue?n(e.nodeValue).map(t=>i(t,e)):i(e))}function u(e,t=!0){return t?s(e):n(e).map(e=>i(e))}var l=e=>document.createElement(e),c=e=>document.createTextNode(e),a=(e,t="")=>{let n=l("style");n.id=t,n.appendChild(c(e)),document.head.appendChild(n)},f=e=>Array.isArray(e);const h=e=>Number.isInteger(e),d=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),m="ti-cursor",v="START",p={started:!1,completed:!1,frozen:!1,destroyed:!1},y={breakLines:!0,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}};var g=({el:e,move:t,cursorPos:n,to:r})=>h(t)?-1*t:((e,t,n=v)=>{let r=new RegExp("END","i").test(n),i=d(".ti-cursor",t),s=e?d(e,t):t,u=o(s,i,!0),l=u[0],c=u[u.length-1],a=r&&!e?0:o(t,i,!0).findIndex(e=>e.isSameNode(r?l:c));return r&&a--,a+1})(t,e,r)-n,P=e=>(f(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let N=e=>e/2;var S=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const j=(e,t)=>{let r=n(d("*",t,!0));return[t].concat(r.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},L=(e,t,n,r)=>{let i=t.content instanceof HTMLElement,s=t.node,u=null==s?void 0:s.parentNode,l=i?t.content:c(t.content);if(S(e))return void(e.value=""+e.value+t.content);if(!i&&u&&!T(u)){let r=j(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{l=u.cloneNode(),l.appendChild(c(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=j(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=l.outerHTML,l=o,n=n.parentNode,r=n.cloneNode(),t=j(r,e)}e=t||e}}}let a=o(e,n,!0)[r-1],f=a?a.parentNode:e;f.insertBefore(l,f.contains(n)?n:null)};var w=e=>e&&e.remove();const D={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function E(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=E.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(E.bind(null,e,t),E.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const x=function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{E(r,1,e(this.v))}catch(e){E(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?E(r,1,t?t(o):o):n?E(r,1,n(o)):E(r,2,o)}catch(e){E(r,2,e)}},r},e}();function k(e){return e instanceof x&&1&e.s}function C(e,t,n){var r,o,i=-1;return function s(u){try{for(;++i<e.length&&(!n||!n());)if((u=t(i))&&u.then){if(!k(u))return void u.then(s,o||(o=E.bind(null,r=new x,2)));u=u.v}r?E(r,1,u):r=u}catch(e){E(r||(r=new x),2,e)}}(),r}function H(e,t,n){for(var r;;){var o=e();if(k(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!k(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!k(s)){r=2;break}}}var u=new x,l=E.bind(null,u,2);return(0===r?o.then(a):1===r?i.then(c):s.then(f)).then(void 0,l),u;function c(r){i=r;do{if(t&&(s=t())&&s.then&&!k(s))return void s.then(f).then(void 0,l);if(!(o=e())||k(o)&&!o.v)return void E(u,1,i);if(o.then)return void o.then(a).then(void 0,l);k(i=n())&&(i=i.v)}while(!i||!i.then);i.then(c).then(void 0,l)}function a(e){e?(i=n())&&i.then?i.then(c).then(void 0,l):c(i):E(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,l):a(o):E(u,1,i)}}return function(c,T={}){const j=this,E=this,x=function(e,t){try{function n(){return Promise.resolve(function(e,t,n){try{return Promise.resolve(new Promise(r=>{n.push(setTimeout(function(){try{return Promise.resolve(e()).then(function(){r()})}catch(e){return Promise.reject(e)}},t))}))}catch(e){return Promise.reject(e)}}(e,t,X))}const r=function(){if(_.frozen)return Promise.resolve(new Promise(e=>{j.unfreeze=()=>{_.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},k=()=>S(K),z=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,N(t)),b(n,N(n))]:[t,n]}(ee)[e],I=(e,t=0)=>e?z(t):0,B=(e,t)=>(ne.add(e),((e={})=>{let t=e.delay;t&&ne.add([[U,t]])})(t),this),R=()=>(e=>S(e)?n(e.value):o(e,d(".ti-cursor",e),!0))(K),A=(e={})=>[[F,e],[F,ee]],O=e=>{let t=ee.nextStringDelay;ne.add([[U,t[0]],...e,[U,t[1]]])},V=e=>{re&&(oe.classList.toggle("disabled",e),oe.classList.toggle("with-delay",!e))},q=function(){try{let e;_.started=!0;let t,n=ne.getItems();const r=function(e,r){try{var o=function(){function e(){return _.completed=!0,Promise.resolve(ee.afterComplete(...t)).then(function(){if(!ee.loop)throw"";let e=ee.loopDelay;x(function(){try{return Promise.resolve(function(e){try{function t(t){return ne.reset(),ne.set(0,[U,e,{}]),Promise.resolve(J({num:null})).then(function(){})}return Promise.resolve(Z?Promise.resolve(Q({value:Z})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){q()})}catch(e){return Promise.reject(e)}},e[1])})}const r=C(n,function(e){let r=n[e],o=r[2];return t=[r,E],o.freezeCursor&&V(!0),Promise.resolve(ee.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(E,r[1],o)).then(function(){return Promise.resolve(ee.afterStep(...t)).then(function(){ne.setMeta(e,{executed:!0}),V(!1)})})})});return r&&r.then?r.then(e):e()}()}catch(e){return}return o&&o.then?o.then(void 0,function(){}):o}();return Promise.resolve(r&&r.then?r.then(function(t){return e?t:E}):e?r:E)}catch(e){return Promise.reject(e)}},U=(e=0)=>x(()=>{},e),Q=function({value:e,to:t=v,instant:n=!1}){try{let r=g({el:K,move:e,cursorPos:Z,to:t}),o=()=>{Z+=r<0?-1:1,((e,t,n,r)=>{let o=t[Math.min(r,t.length)-1];(e=(null==o?void 0:o.parentNode)||e).insertBefore(n,o||null)})(K,R(),oe,Z)};return Promise.resolve(x(function(){try{let e=0;const t=H(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(x(o,z(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I(n))).then(function(){})}catch(e){return Promise.reject(e)}},Y=({chars:e,instant:t,silent:n})=>{const r=this;return x(function(){try{function o(o){function s(){return n?void 0:Promise.resolve(ee.afterString(e,r)).then(function(e){})}const u=C(e,function(n){return t?void i(e[n]):Promise.resolve(x(()=>{i(e[n])},z(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>L(K,e,oe,Z);return Promise.resolve(n?o():Promise.resolve(ee.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},I(t))},F=function(e){try{return ee=t(ee,e),Promise.resolve()}catch(e){return Promise.reject(e)}},G=function(){try{return k()?(K.value="",Promise.resolve()):(R().forEach(e=>{w(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},J=function({num:e=null,instant:t=!1,to:n=v}){try{return Promise.resolve(x(function(){try{let r=h(e)?e:g({el:K,move:e,cursorPos:Z,to:n});const o=()=>{let e=R();var t;e.length&&(k()?K.value=K.value.slice(0,-1):(w(e[Z]),t=oe,d("*",K,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;w(t)}})))};let i=0;const s=H(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(x(o,z(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},I(t,1))).then(function(){const t=function(){if(null===e&&R().length-1>0)return Promise.resolve(J({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=i(l("BR"));return B([[Y,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=A(t),r=e,{instant:o,to:i}=t;return B([n[0],[J,{num:r,instant:o,to:i},$],n[1]],t)},this.empty=function(e={}){return B([[G]],e)},this.exec=function(e,t){let n=A(t);return B([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=A(t),{instant:r,to:o}=t;return B([n[0],[Q,{value:null===e?"":e,to:o,instant:r},$],n[1]],t)},this.options=function(e){return e=M(e),B([[F,e]],e)},this.pause=function(e,t={}){return B([[U,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=A(t),r=u(e,ee.html),{instant:o}=t;return B([n[0],[Y,{chars:r,instant:o},$],n[1]],t)},this.is=function(e){return _[e]},this.destroy=function(e=!0){X.forEach(e=>clearTimeout(e)),X=[],M(e)&&w(oe),_.destroyed=!0},this.freeze=function(){_.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ne.reset(),Z=0;for(let e in _)_[e]=!1;return K[k()?"value":"innerHTML"]="",this},this.go=function(){return _.started?this:(function(){try{!k()&&K.appendChild(oe),re?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] ."+m,o=getComputedStyle(n),i=Object.entries(D).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");a("@keyframes blink-"+e+" { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } "+r+" { display: inline; letter-spacing: -1em; "+i+" animation: blink-"+e+" "+t.cursorSpeed/1e3+"s infinite; } "+r+".with-delay { animation-delay: 500ms; } "+r+".disabled { animation: none; }",e)})(te,ee,K),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),ee.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(K,q.bind(this)),this):(q(),this))},this.getQueue=function(){return ne},this.getOptions=function(){return ee},this.getElement=function(){return K};let K="string"==typeof(W=c)?d(W):W;var W;let X=[],Z=0,$={freezeCursor:!0},_=t({},p),ee=t(y,T);ee=t(ee,{html:!k()&&ee.html,nextStringDelay:P(ee.nextStringDelay),loopDelay:P(ee.loopDelay)});let te=Math.random().toString().substring(2,9),ne=function(n){const r=function(t){return o=o.concat(t.map(t=>e.map((e,n)=>t[n]?t[n]:e))),this};let o=[];return r(n),{add:r,set:function(e,t){o[e]=t},reset:function(){o=o.map(e=>(e[2].executed=!1,e))},getItems:function(){return o.filter(e=>!e[2].executed)},setMeta:function(e,n){o[e][2]=t(o[e][2],n)}}}([[U,ee.startDelay]]);K.dataset.typeitId=te,a("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let re=ee.cursor&&!k(),oe=(()=>{if(k())return;let e=l("span");return e.className=m,re?(e.innerHTML=r(ee.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var ie;ee.strings=(e=>{let t=K.innerHTML;return t?(K.innerHTML="",ee.startDelete?(s(t).forEach(e=>{L(K,e,oe,Z)}),O([[J,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(f(ie=ee.strings)?ie:[ie]),ee.strings.length&&(()=>{let e=ee.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=u(t,ee.html);if(ne.add([[Y,{chars:r},$]]),n+1===e.length)return;const o=ee.breakLines?[[Y,{chars:[i(l("BR"))]},$]]:[[J,{num:r.length},$]];O(o)})})()}});

@@ -30,2 +30,3 @@ export declare type Character = {

instant?: boolean;
delay?: number;
};

@@ -32,0 +33,0 @@ export declare type QueueItem = [Function?, any?, {

{
"name": "typeit",
"version": "8.0.0-rc.6",
"version": "8.0.0",
"description": "The most versatile animated typing utility on the planet.",

@@ -5,0 +5,0 @@ "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",

@@ -12,2 +12,3 @@ import Queue from "./Queue";

import calculatePace from "./helpers/calculatePace";
import calculateStepsToSelector from "./helpers/calculateStepsToSelector";
import createElement from "./helpers/createElement";

@@ -50,3 +51,3 @@ import destroyTimeouts from "./helpers/destroyTimeouts";

): void {
const _wait = async (callback: Function, delay: number, silent: boolean = false) => {
const _wait = async (callback: Function, delay: number) => {
if (_statuses.frozen) {

@@ -61,7 +62,3 @@ await new Promise<void>((resolve) => {

silent || await _opts.beforeStep(this);
await wait(callback, delay, _timeouts);
silent || await _opts.afterStep(this);
return await wait(callback, delay, _timeouts);
};

@@ -185,3 +182,3 @@

_type,
{ chars: [createCharacterObject(createElement("BR"))], silent: true },
{ chars: [createCharacterObject(createElement("BR"))] },
_freezeCursorMeta,

@@ -238,2 +235,3 @@ ],

let queueItems = _queue.getItems();
let callbackArgs;

@@ -245,6 +243,12 @@ try {

callbackArgs = [queueAction, this];
queueActionMeta.freezeCursor && _disableCursorBlink(true);
await _opts.beforeStep(...callbackArgs);
await queueAction[0].call(this, queueAction[1], queueActionMeta);
await _opts.afterStep(...callbackArgs);
_queue.setMeta(i, { executed: true });

@@ -257,3 +261,3 @@

await _opts.afterComplete(this);
await _opts.afterComplete(...callbackArgs);

@@ -343,3 +347,3 @@ if (!_opts.loop) {

silent || (await _opts.afterString(chars, this));
}, _getActionPace(instant), true);
}, _getActionPace(instant));
};

@@ -443,7 +447,7 @@

this.empty = function (actionOpts = {}) {
this.empty = function (actionOpts: ActionOpts = {}) {
return _queueAndReturn([[_empty]], actionOpts);
};
this.exec = function (func: () => any, actionOpts) {
this.exec = function (func: () => any, actionOpts?: ActionOpts) {
let bookEndQueueItems = _generateTemporaryOptionQueueItems(actionOpts);

@@ -450,0 +454,0 @@ return _queueAndReturn(

@@ -32,2 +32,3 @@ export type Character = {

instant?: boolean;
delay?: number;
};

@@ -34,0 +35,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc