Socket
Socket
Sign inDemoInstall

typeit-react

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeit-react - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

dist/index.esm.js

@@ -1,1 +0,1 @@

import*as e from"react";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const n=[null,null,{}];var r=(e,t)=>Object.assign({},e,t),o=e=>Array.from(e),i=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=o(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},u=(e,t=null)=>({node:t,content:e});function c(e){let t=i(e);return s(t).flatMap(e=>e.nodeValue?o(e.nodeValue).map(t=>u(t,e)):u(e))}function l(e,t=!0){return t?c(e):o(e).map(e=>u(e))}var a=e=>document.createElement(e),f=e=>document.createTextNode(e),h=(e,t="")=>{let n=a("style");n.id=t,n.appendChild(f(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const m=e=>Number.isInteger(e),v=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),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})=>m(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=v(".ti-cursor",t),i=e?v(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,P=e=>(d(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let S=e=>e/2;var N=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=o(v("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},j=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:f(t.content);if(N(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(f(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var E=e=>e&&e.remove();const L={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function k(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=k.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(k.bind(null,e,t),k.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{k(r,1,e(this.v))}catch(e){k(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?k(r,1,t?t(o):o):n?k(r,1,n(o)):k(r,2,o)}catch(e){k(r,2,e)}},r},e}();function D(e){return e instanceof x&&1&e.s}function I(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(!D(u))return void u.then(s,o||(o=k.bind(null,r=new x,2)));u=u.v}r?k(r,1,u):r=u}catch(e){k(r||(r=new x),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(D(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!D(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!D(s)){r=2;break}}}var u=new x,c=k.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&&!D(s))return void s.then(f).then(void 0,c);if(!(o=e())||D(o)&&!o.v)return void k(u,1,i);if(o.then)return void o.then(a).then(void 0,c);D(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):k(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):k(u,1,i)}}function H(e,t={}){const f=this,T=this,w=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=>{f.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},k=()=>N(G),x=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,S(t)),b(n,S(n))]:[t,n]}($)[e],D=(e,t=0)=>e?x(t):0,H=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),O=()=>(e=>N(e)?o(e.value):s(e,v(".ti-cursor",e),!0))(G),z=(e={})=>[[Q,e],[Q,$]],A=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=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;w(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(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const r=I(n,function(e){let r=n[e],o=r[2];return t=[r,T],o.freezeCursor&&B(!0),Promise.resolve($.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(T,r[1],o)).then(function(){return Promise.resolve($.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:T}):e?r:T)}catch(e){return Promise.reject(e)}},V=(e=0)=>w(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=g({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,O(),ne,W)};return Promise.resolve(w(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(w(o,x(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return w(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=I(e,function(n){return t?void i(e[n]):Promise.resolve(w(()=>{i(e[n])},x(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>j(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t))},Q=function(e){try{return $=r($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return k()?(G.value="",Promise.resolve()):(O().forEach(e=>{E(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(w(function(){try{let r=m(e)?e:g({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=O();var t;e.length&&(k()?G.value=G.value.slice(0,-1):(E(e[W]),t=ne,v("*",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;E(t)}})))};let i=0;const s=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(w(o,x(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&O().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=u(a("BR"));return H([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=z(t),r=e,{instant:o,to:i}=t;return H([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return H([[Y]],e)},this.exec=function(e,t){let n=z(t);return H([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=z(t),{instant:r,to:o}=t;return H([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=M(e),H([[Q,e]],e)},this.pause=function(e,t={}){return H([[V,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=z(t),r=l(e,$.html),{instant:o}=t;return H([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=[],M(e)&&E(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[k()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!k()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(L).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");h("@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,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=e)?v(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=r({},p),$=r(y,t);$=r($,{html:!k()&&$.html,nextStringDelay:P($.nextStringDelay),loopDelay:P($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return o=o.concat(e.map(e=>n.map((t,n)=>e[n]?e[n]:t))),this};let o=[];return t(e),{add:t,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,t){o[e][2]=r(o[e][2],t)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,h("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!k(),ne=(()=>{if(k())return;let e=a("span");return e.className="ti-cursor",te?(e.innerHTML=i($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(c(t).forEach(e=>{j(G,e,ne,W)}),A([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=l(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[u(a("BR"))]},X]]:[[F,{num:r.length},X]];A(o)})})()}var O=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],z=["options","as","children","getBeforeInit","getAfterInit"],A=e.useRef,B=e.useEffect,R=e.useState,V=e.useMemo,q=function(n){var r=R(!0),o=r[0],i=r[1],s=A(null),u=n.options,c=n.as,l=n.children,a=n.getBeforeInit,f=n.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(n,z),d=c,m=V(function(){return O.indexOf(d.toLowerCase())>-1},[d]);return B(function(){l&&(u.strings=s.current.innerHTML),i(!1)},[]),B(function(){if(!o){var e=new H(s.current,t({},u));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),e.createElement("div",{style:{opacity:o?0:1}},m?e.createElement(d,t({ref:s},h)):e.createElement(d,t({ref:s},h),o&&l))};q.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}};export{q as default};
import*as e from"react";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const n=[null,null,{}];var r=(e,t)=>Object.assign({},e,t),o=e=>Array.from(e),i=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=o(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},u=(e,t=null)=>({node:t,content:e});function c(e){let t=i(e);return s(t).flatMap(e=>e.nodeValue?o(e.nodeValue).map(t=>u(t,e)):u(e))}function l(e,t=!0){return t?c(e):o(e).map(e=>u(e))}var a=e=>document.createElement(e),f=e=>document.createTextNode(e),h=(e,t="")=>{let n=a("style");n.id=t,n.appendChild(f(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const m=e=>Number.isInteger(e),v=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),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})=>m(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=v(".ti-cursor",t),i=e?v(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,P=e=>(d(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let S=e=>e/2;var N=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=o(v("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},j=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:f(t.content);if(N(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(f(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var E=e=>e&&e.remove();const L={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function k(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=k.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(k.bind(null,e,t),k.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{k(r,1,e(this.v))}catch(e){k(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?k(r,1,t?t(o):o):n?k(r,1,n(o)):k(r,2,o)}catch(e){k(r,2,e)}},r},e}();function D(e){return e instanceof x&&1&e.s}function I(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(!D(u))return void u.then(s,o||(o=k.bind(null,r=new x,2)));u=u.v}r?k(r,1,u):r=u}catch(e){k(r||(r=new x),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(D(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!D(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!D(s)){r=2;break}}}var u=new x,c=k.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&&!D(s))return void s.then(f).then(void 0,c);if(!(o=e())||D(o)&&!o.v)return void k(u,1,i);if(o.then)return void o.then(a).then(void 0,c);D(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):k(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):k(u,1,i)}}function H(e,t={}){const f=this,T=this,w=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(f)).then(function(e){})})}return n?r():Promise.resolve($.beforeStep(f)).then(r)}const o=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{f.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},k=()=>N(G),x=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,S(t)),b(n,S(n))]:[t,n]}($)[e],D=(e,t=0)=>e?x(t):0,H=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),O=()=>(e=>N(e)?o(e.value):s(e,v(".ti-cursor",e),!0))(G),z=(e={})=>[[Q,e],[Q,$]],A=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=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(T)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;w(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(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const n=I(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&B(!0),Promise.resolve(n[0].call(T,n[1],r)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:T}):e?n:T)}catch(e){return Promise.reject(e)}},V=(e=0)=>w(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=g({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,O(),ne,W)};return Promise.resolve(w(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(w(o,x(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return w(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=I(e,function(n){return t?void i(e[n]):Promise.resolve(w(()=>{i(e[n])},x(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>j(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t),!0)},Q=function(e){try{return $=r($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return k()?(G.value="",Promise.resolve()):(O().forEach(e=>{E(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(w(function(){try{let r=m(e)?e:g({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=O();var t;e.length&&(k()?G.value=G.value.slice(0,-1):(E(e[W]),t=ne,v("*",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;E(t)}})))};let i=0;const s=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(w(o,x(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&O().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=u(a("BR"));return H([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=z(t),r=e,{instant:o,to:i}=t;return H([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return H([[Y]],e)},this.exec=function(e,t){let n=z(t);return H([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=z(t),{instant:r,to:o}=t;return H([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=M(e),H([[Q,e]],e)},this.pause=function(e,t={}){return H([[V,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=z(t),r=l(e,$.html),{instant:o}=t;return H([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=[],M(e)&&E(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[k()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!k()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(L).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");h("@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,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=e)?v(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=r({},p),$=r(y,t);$=r($,{html:!k()&&$.html,nextStringDelay:P($.nextStringDelay),loopDelay:P($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return o=o.concat(e.map(e=>n.map((t,n)=>e[n]?e[n]:t))),this};let o=[];return t(e),{add:t,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,t){o[e][2]=r(o[e][2],t)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,h("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!k(),ne=(()=>{if(k())return;let e=a("span");return e.className="ti-cursor",te?(e.innerHTML=i($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(c(t).forEach(e=>{j(G,e,ne,W)}),A([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=l(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[u(a("BR"))],silent:!0},X]]:[[F,{num:r.length},X]];A(o)})})()}var O=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],z=["options","as","children","getBeforeInit","getAfterInit"],A=e.useRef,B=e.useEffect,R=e.useState,V=e.useMemo,q=function(n){var r=R(!0),o=r[0],i=r[1],s=A(null),u=n.options,c=n.as,l=n.children,a=n.getBeforeInit,f=n.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(n,z),d=c,m=V(function(){return O.indexOf(d.toLowerCase())>-1},[d]);return B(function(){l&&(u.strings=s.current.innerHTML),i(!1)},[]),B(function(){if(!o){var e=new H(s.current,t({},u));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),e.createElement("div",{style:{opacity:o?0:1}},m?e.createElement(d,t({ref:s},h)):e.createElement(d,t({ref:s},h),o&&l))};q.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}};export{q as default};

@@ -1,1 +0,1 @@

function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var t=e(require("react"));function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const r=[null,null,{}];var o=(e,t)=>Object.assign({},e,t),i=e=>Array.from(e),u=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=i(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},c=(e,t=null)=>({node:t,content:e});function l(e){let t=u(e);return s(t).flatMap(e=>e.nodeValue?i(e.nodeValue).map(t=>c(t,e)):c(e))}function a(e,t=!0){return t?l(e):i(e).map(e=>c(e))}var f=e=>document.createElement(e),h=e=>document.createTextNode(e),d=(e,t="")=>{let n=f("style");n.id=t,n.appendChild(h(e)),document.head.appendChild(n)},m=e=>Array.isArray(e);const v=e=>Number.isInteger(e),p=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),y={started:!1,completed:!1,frozen:!1,destroyed:!1},g={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})=>v(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=p(".ti-cursor",t),i=e?p(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,b=e=>(m(e)||(e=[e/2,e/2]),e),S=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let j=e=>e/2;var M=e=>"value"in e;const N=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=i(p("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},E=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:h(t.content);if(M(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(h(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var L=e=>e&&e.remove();const k={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function D(e,t,n){if(!e.s){if(n instanceof O){if(!n.s)return void(n.o=D.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(D.bind(null,e,t),D.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const O=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{D(r,1,e(this.v))}catch(e){D(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?D(r,1,t?t(o):o):n?D(r,1,n(o)):D(r,2,o)}catch(e){D(r,2,e)}},r},e}();function x(e){return e instanceof O&&1&e.s}function I(e,t,n){var r,o,i=-1;return function u(s){try{for(;++i<e.length&&(!n||!n());)if((s=t(i))&&s.then){if(!x(s))return void s.then(u,o||(o=D.bind(null,r=new O,2)));s=s.v}r?D(r,1,s):r=s}catch(e){D(r||(r=new O),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(x(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!x(i)){r=1;break}i=i.s}if(t){var u=t();if(u&&u.then&&!x(u)){r=2;break}}}var s=new O,c=D.bind(null,s,2);return(0===r?o.then(a):1===r?i.then(l):u.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(u=t())&&u.then&&!x(u))return void u.then(f).then(void 0,c);if(!(o=e())||x(o)&&!o.v)return void D(s,1,i);if(o.then)return void o.then(a).then(void 0,c);x(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):D(s,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):D(s,1,i)}}function H(e,t={}){const n=this,h=this,T=function(e,t){try{function 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,J))}const o=function(){if(X.frozen)return Promise.resolve(new Promise(e=>{n.unfreeze=()=>{X.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},w=()=>M(F),D=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[S(t,j(t)),S(n,j(n))]:[t,n]}(Z)[e],O=(e,t=0)=>e?D(t):0,x=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[q,t]])})(t),this),H=()=>(e=>M(e)?i(e.value):s(e,p(".ti-cursor",e),!0))(F),z=(e={})=>[[_,e],[_,Z]],A=e=>{let t=Z.nextStringDelay;ee.add([[q,t[0]],...e,[q,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=function(){try{let e;X.started=!0;let t,n=ee.getItems();const r=function(e,r){try{var o=function(){function e(){return X.completed=!0,Promise.resolve(Z.afterComplete(...t)).then(function(){if(!Z.loop)throw"";let e=Z.loopDelay;T(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[q,e,{}]),Promise.resolve(Y({num:null})).then(function(){})}return Promise.resolve(K?Promise.resolve(V({value:K})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const r=I(n,function(e){let r=n[e],o=r[2];return t=[r,h],o.freezeCursor&&B(!0),Promise.resolve(Z.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(h,r[1],o)).then(function(){return Promise.resolve(Z.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:h}):e?r:h)}catch(e){return Promise.reject(e)}},q=(e=0)=>T(()=>{},e),V=function({value:e,to:t="START",instant:n=!1}){try{let r=P({el:F,move:e,cursorPos:K,to:t}),o=()=>{K+=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)})(F,H(),ne,K)};return Promise.resolve(T(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(T(o,D(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return T(function(){try{function o(o){function u(){return n?void 0:Promise.resolve(Z.afterString(e,r)).then(function(e){})}const s=I(e,function(n){return t?void i(e[n]):Promise.resolve(T(()=>{i(e[n])},D(0))).then(function(e){})});return s&&s.then?s.then(u):u()}const i=e=>E(F,e,ne,K);return Promise.resolve(n?o():Promise.resolve(Z.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},O(t))},_=function(e){try{return Z=o(Z,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Q=function(){try{return w()?(F.value="",Promise.resolve()):(H().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},Y=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(T(function(){try{let r=v(e)?e:P({el:F,move:e,cursorPos:K,to:n});const o=()=>{let e=H();var t;e.length&&(w()?F.value=F.value.slice(0,-1):(L(e[K]),t=ne,p("*",F,!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 u=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(T(o,D(1))).then(function(e){})});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O(t,1))).then(function(){const t=function(){if(null===e&&H().length-1>0)return Promise.resolve(Y({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=c(f("BR"));return x([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=N(e);let n=z(t),r=e,{instant:o,to:i}=t;return x([n[0],[Y,{num:r,instant:o,to:i},W],n[1]],t)},this.empty=function(e={}){return x([[Q]],e)},this.exec=function(e,t){let n=z(t);return x([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=N(e);let n=z(t),{instant:r,to:o}=t;return x([n[0],[V,{value:null===e?"":e,to:o,instant:r},W],n[1]],t)},this.options=function(e){return e=N(e),x([[_,e]],e)},this.pause=function(e,t={}){return x([[q,N(e)]],t)},this.type=function(e,t={}){e=N(e);let n=z(t),r=a(e,Z.html),{instant:o}=t;return x([n[0],[U,{chars:r,instant:o},W],n[1]],t)},this.is=function(e){return X[e]},this.destroy=function(e=!0){J.forEach(e=>clearTimeout(e)),J=[],N(e)&&L(ne),X.destroyed=!0},this.freeze=function(){X.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),K=0;for(let e in X)X[e]=!1;return F[w()?"value":"innerHTML"]="",this},this.go=function(){return X.started?this:(function(){try{!w()&&F.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(k).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");d("@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)})($,Z,F),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),Z.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(F,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return Z},this.getElement=function(){return F};let F="string"==typeof(G=e)?p(G):G;var G;let J=[],K=0,W={freezeCursor:!0},X=o({},y),Z=o(g,t);Z=o(Z,{html:!w()&&Z.html,nextStringDelay:b(Z.nextStringDelay),loopDelay:b(Z.loopDelay)});let $=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return n=n.concat(e.map(e=>r.map((t,n)=>e[n]?e[n]:t))),this};let n=[];return t(e),{add:t,set:function(e,t){n[e]=t},reset:function(){n=n.map(e=>(e[2].executed=!1,e))},getItems:function(){return n.filter(e=>!e[2].executed)},setMeta:function(e,t){n[e][2]=o(n[e][2],t)}}}([[q,Z.startDelay]]);F.dataset.typeitId=$,d("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=Z.cursor&&!w(),ne=(()=>{if(w())return;let e=f("span");return e.className="ti-cursor",te?(e.innerHTML=u(Z.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;Z.strings=(e=>{let t=F.innerHTML;return t?(F.innerHTML="",Z.startDelete?(l(t).forEach(e=>{E(F,e,ne,K)}),A([[Y,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(m(re=Z.strings)?re:[re]),Z.strings.length&&(()=>{let e=Z.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=a(t,Z.html);if(ee.add([[U,{chars:r},W]]),n+1===e.length)return;const o=Z.breakLines?[[U,{chars:[c(f("BR"))]},W]]:[[Y,{num:r.length},W]];A(o)})})()}var z=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=["options","as","children","getBeforeInit","getAfterInit"],B=t.useRef,R=t.useEffect,q=t.useState,V=t.useMemo,U=function(e){var r=q(!0),o=r[0],i=r[1],u=B(null),s=e.options,c=e.as,l=e.children,a=e.getBeforeInit,f=e.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,A),d=c,m=V(function(){return z.indexOf(d.toLowerCase())>-1},[d]);return R(function(){l&&(s.strings=u.current.innerHTML),i(!1)},[]),R(function(){if(!o){var e=new H(u.current,n({},s));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),t.createElement("div",{style:{opacity:o?0:1}},m?t.createElement(d,n({ref:u},h)):t.createElement(d,n({ref:u},h),o&&l))};U.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}},module.exports=U;
function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var t=e(require("react"));function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const r=[null,null,{}];var o=(e,t)=>Object.assign({},e,t),i=e=>Array.from(e),u=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=i(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},c=(e,t=null)=>({node:t,content:e});function l(e){let t=u(e);return s(t).flatMap(e=>e.nodeValue?i(e.nodeValue).map(t=>c(t,e)):c(e))}function a(e,t=!0){return t?l(e):i(e).map(e=>c(e))}var f=e=>document.createElement(e),h=e=>document.createTextNode(e),d=(e,t="")=>{let n=f("style");n.id=t,n.appendChild(h(e)),document.head.appendChild(n)},m=e=>Array.isArray(e);const v=e=>Number.isInteger(e),p=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),y={started:!1,completed:!1,frozen:!1,destroyed:!1},g={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})=>v(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=p(".ti-cursor",t),i=e?p(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,b=e=>(m(e)||(e=[e/2,e/2]),e),S=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let j=e=>e/2;var M=e=>"value"in e;const N=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=i(p("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},E=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:h(t.content);if(M(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(h(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var L=e=>e&&e.remove();const k={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function D(e,t,n){if(!e.s){if(n instanceof O){if(!n.s)return void(n.o=D.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(D.bind(null,e,t),D.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const O=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{D(r,1,e(this.v))}catch(e){D(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?D(r,1,t?t(o):o):n?D(r,1,n(o)):D(r,2,o)}catch(e){D(r,2,e)}},r},e}();function x(e){return e instanceof O&&1&e.s}function I(e,t,n){var r,o,i=-1;return function u(s){try{for(;++i<e.length&&(!n||!n());)if((s=t(i))&&s.then){if(!x(s))return void s.then(u,o||(o=D.bind(null,r=new O,2)));s=s.v}r?D(r,1,s):r=s}catch(e){D(r||(r=new O),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(x(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!x(i)){r=1;break}i=i.s}if(t){var u=t();if(u&&u.then&&!x(u)){r=2;break}}}var s=new O,c=D.bind(null,s,2);return(0===r?o.then(a):1===r?i.then(l):u.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(u=t())&&u.then&&!x(u))return void u.then(f).then(void 0,c);if(!(o=e())||x(o)&&!o.v)return void D(s,1,i);if(o.then)return void o.then(a).then(void 0,c);x(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):D(s,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):D(s,1,i)}}function H(e,t={}){const n=this,h=this,T=function(e,t,r=!1){try{function o(){function o(o){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,J)).then(function(){return r?void 0:Promise.resolve(Z.afterStep(n)).then(function(e){})})}return r?o():Promise.resolve(Z.beforeStep(n)).then(o)}const i=function(){if(X.frozen)return Promise.resolve(new Promise(e=>{n.unfreeze=()=>{X.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(i&&i.then?i.then(o):o())}catch(e){return Promise.reject(e)}},w=()=>M(F),D=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[S(t,j(t)),S(n,j(n))]:[t,n]}(Z)[e],O=(e,t=0)=>e?D(t):0,x=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[q,t]])})(t),this),H=()=>(e=>M(e)?i(e.value):s(e,p(".ti-cursor",e),!0))(F),z=(e={})=>[[_,e],[_,Z]],A=e=>{let t=Z.nextStringDelay;ee.add([[q,t[0]],...e,[q,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=function(){try{let e;X.started=!0;let t=ee.getItems();const n=function(e,n){try{var r=function(){function e(){return X.completed=!0,Promise.resolve(Z.afterComplete(h)).then(function(){if(!Z.loop)throw"";let e=Z.loopDelay;T(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[q,e,{}]),Promise.resolve(Y({num:null})).then(function(){})}return Promise.resolve(K?Promise.resolve(V({value:K})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const n=I(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&B(!0),Promise.resolve(n[0].call(h,n[1],r)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:h}):e?n:h)}catch(e){return Promise.reject(e)}},q=(e=0)=>T(()=>{},e),V=function({value:e,to:t="START",instant:n=!1}){try{let r=P({el:F,move:e,cursorPos:K,to:t}),o=()=>{K+=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)})(F,H(),ne,K)};return Promise.resolve(T(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(T(o,D(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return T(function(){try{function o(o){function u(){return n?void 0:Promise.resolve(Z.afterString(e,r)).then(function(e){})}const s=I(e,function(n){return t?void i(e[n]):Promise.resolve(T(()=>{i(e[n])},D(0))).then(function(e){})});return s&&s.then?s.then(u):u()}const i=e=>E(F,e,ne,K);return Promise.resolve(n?o():Promise.resolve(Z.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},O(t),!0)},_=function(e){try{return Z=o(Z,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Q=function(){try{return w()?(F.value="",Promise.resolve()):(H().forEach(e=>{L(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},Y=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(T(function(){try{let r=v(e)?e:P({el:F,move:e,cursorPos:K,to:n});const o=()=>{let e=H();var t;e.length&&(w()?F.value=F.value.slice(0,-1):(L(e[K]),t=ne,p("*",F,!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 u=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(T(o,D(1))).then(function(e){})});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},O(t,1))).then(function(){const t=function(){if(null===e&&H().length-1>0)return Promise.resolve(Y({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=c(f("BR"));return x([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=N(e);let n=z(t),r=e,{instant:o,to:i}=t;return x([n[0],[Y,{num:r,instant:o,to:i},W],n[1]],t)},this.empty=function(e={}){return x([[Q]],e)},this.exec=function(e,t){let n=z(t);return x([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=N(e);let n=z(t),{instant:r,to:o}=t;return x([n[0],[V,{value:null===e?"":e,to:o,instant:r},W],n[1]],t)},this.options=function(e){return e=N(e),x([[_,e]],e)},this.pause=function(e,t={}){return x([[q,N(e)]],t)},this.type=function(e,t={}){e=N(e);let n=z(t),r=a(e,Z.html),{instant:o}=t;return x([n[0],[U,{chars:r,instant:o},W],n[1]],t)},this.is=function(e){return X[e]},this.destroy=function(e=!0){J.forEach(e=>clearTimeout(e)),J=[],N(e)&&L(ne),X.destroyed=!0},this.freeze=function(){X.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),K=0;for(let e in X)X[e]=!1;return F[w()?"value":"innerHTML"]="",this},this.go=function(){return X.started?this:(function(){try{!w()&&F.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(k).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");d("@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)})($,Z,F),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),Z.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(F,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return Z},this.getElement=function(){return F};let F="string"==typeof(G=e)?p(G):G;var G;let J=[],K=0,W={freezeCursor:!0},X=o({},y),Z=o(g,t);Z=o(Z,{html:!w()&&Z.html,nextStringDelay:b(Z.nextStringDelay),loopDelay:b(Z.loopDelay)});let $=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return n=n.concat(e.map(e=>r.map((t,n)=>e[n]?e[n]:t))),this};let n=[];return t(e),{add:t,set:function(e,t){n[e]=t},reset:function(){n=n.map(e=>(e[2].executed=!1,e))},getItems:function(){return n.filter(e=>!e[2].executed)},setMeta:function(e,t){n[e][2]=o(n[e][2],t)}}}([[q,Z.startDelay]]);F.dataset.typeitId=$,d("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=Z.cursor&&!w(),ne=(()=>{if(w())return;let e=f("span");return e.className="ti-cursor",te?(e.innerHTML=u(Z.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;Z.strings=(e=>{let t=F.innerHTML;return t?(F.innerHTML="",Z.startDelete?(l(t).forEach(e=>{E(F,e,ne,K)}),A([[Y,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(m(re=Z.strings)?re:[re]),Z.strings.length&&(()=>{let e=Z.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=a(t,Z.html);if(ee.add([[U,{chars:r},W]]),n+1===e.length)return;const o=Z.breakLines?[[U,{chars:[c(f("BR"))],silent:!0},W]]:[[Y,{num:r.length},W]];A(o)})})()}var z=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=["options","as","children","getBeforeInit","getAfterInit"],B=t.useRef,R=t.useEffect,q=t.useState,V=t.useMemo,U=function(e){var r=q(!0),o=r[0],i=r[1],u=B(null),s=e.options,c=e.as,l=e.children,a=e.getBeforeInit,f=e.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,A),d=c,m=V(function(){return z.indexOf(d.toLowerCase())>-1},[d]);return R(function(){l&&(s.strings=u.current.innerHTML),i(!1)},[]),R(function(){if(!o){var e=new H(u.current,n({},s));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),t.createElement("div",{style:{opacity:o?0:1}},m?t.createElement(d,n({ref:u},h)):t.createElement(d,n({ref:u},h),o&&l))};U.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}},module.exports=U;

@@ -1,1 +0,1 @@

import*as e from"react";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const n=[null,null,{}];var r=(e,t)=>Object.assign({},e,t),o=e=>Array.from(e),i=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=o(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},u=(e,t=null)=>({node:t,content:e});function c(e){let t=i(e);return s(t).flatMap(e=>e.nodeValue?o(e.nodeValue).map(t=>u(t,e)):u(e))}function l(e,t=!0){return t?c(e):o(e).map(e=>u(e))}var a=e=>document.createElement(e),f=e=>document.createTextNode(e),h=(e,t="")=>{let n=a("style");n.id=t,n.appendChild(f(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const m=e=>Number.isInteger(e),v=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),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})=>m(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=v(".ti-cursor",t),i=e?v(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,P=e=>(d(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let S=e=>e/2;var N=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=o(v("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},j=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:f(t.content);if(N(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(f(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var E=e=>e&&e.remove();const L={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function k(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=k.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(k.bind(null,e,t),k.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{k(r,1,e(this.v))}catch(e){k(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?k(r,1,t?t(o):o):n?k(r,1,n(o)):k(r,2,o)}catch(e){k(r,2,e)}},r},e}();function D(e){return e instanceof x&&1&e.s}function I(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(!D(u))return void u.then(s,o||(o=k.bind(null,r=new x,2)));u=u.v}r?k(r,1,u):r=u}catch(e){k(r||(r=new x),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(D(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!D(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!D(s)){r=2;break}}}var u=new x,c=k.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&&!D(s))return void s.then(f).then(void 0,c);if(!(o=e())||D(o)&&!o.v)return void k(u,1,i);if(o.then)return void o.then(a).then(void 0,c);D(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):k(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):k(u,1,i)}}function H(e,t={}){const f=this,T=this,w=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=>{f.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(r&&r.then?r.then(n):n())}catch(e){return Promise.reject(e)}},k=()=>N(G),x=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,S(t)),b(n,S(n))]:[t,n]}($)[e],D=(e,t=0)=>e?x(t):0,H=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),O=()=>(e=>N(e)?o(e.value):s(e,v(".ti-cursor",e),!0))(G),z=(e={})=>[[Q,e],[Q,$]],A=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=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;w(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(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const r=I(n,function(e){let r=n[e],o=r[2];return t=[r,T],o.freezeCursor&&B(!0),Promise.resolve($.beforeStep(...t)).then(function(){return Promise.resolve(r[0].call(T,r[1],o)).then(function(){return Promise.resolve($.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:T}):e?r:T)}catch(e){return Promise.reject(e)}},V=(e=0)=>w(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=g({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,O(),ne,W)};return Promise.resolve(w(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(w(o,x(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return w(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=I(e,function(n){return t?void i(e[n]):Promise.resolve(w(()=>{i(e[n])},x(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>j(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t))},Q=function(e){try{return $=r($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return k()?(G.value="",Promise.resolve()):(O().forEach(e=>{E(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(w(function(){try{let r=m(e)?e:g({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=O();var t;e.length&&(k()?G.value=G.value.slice(0,-1):(E(e[W]),t=ne,v("*",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;E(t)}})))};let i=0;const s=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(w(o,x(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&O().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=u(a("BR"));return H([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=z(t),r=e,{instant:o,to:i}=t;return H([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return H([[Y]],e)},this.exec=function(e,t){let n=z(t);return H([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=z(t),{instant:r,to:o}=t;return H([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=M(e),H([[Q,e]],e)},this.pause=function(e,t={}){return H([[V,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=z(t),r=l(e,$.html),{instant:o}=t;return H([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=[],M(e)&&E(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[k()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!k()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(L).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");h("@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,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=e)?v(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=r({},p),$=r(y,t);$=r($,{html:!k()&&$.html,nextStringDelay:P($.nextStringDelay),loopDelay:P($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return o=o.concat(e.map(e=>n.map((t,n)=>e[n]?e[n]:t))),this};let o=[];return t(e),{add:t,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,t){o[e][2]=r(o[e][2],t)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,h("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!k(),ne=(()=>{if(k())return;let e=a("span");return e.className="ti-cursor",te?(e.innerHTML=i($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(c(t).forEach(e=>{j(G,e,ne,W)}),A([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=l(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[u(a("BR"))]},X]]:[[F,{num:r.length},X]];A(o)})})()}const O=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],z=["options","as","children","getBeforeInit","getAfterInit"],{useRef:A,useEffect:B,useState:R,useMemo:V}=e,q=n=>{const[r,o]=R(!0),i=A(null),{options:s,as:u,children:c,getBeforeInit:l,getAfterInit:a}=n,f=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(n,z),h=u,d=V(()=>O.indexOf(h.toLowerCase())>-1,[h]);return B(()=>{c&&(s.strings=i.current.innerHTML),o(!1)},[]),B(()=>{if(r)return;let e=new H(i.current,t({},s));return e=l(e),e.go(),e=a(e),()=>{e.destroy()}},[r]),e.createElement("div",{style:{opacity:r?0:1}},d?e.createElement(h,t({ref:i},f)):e.createElement(h,t({ref:i},f),r&&c))};q.defaultProps={as:"span",options:{},getBeforeInit:e=>e,getAfterInit:e=>e};export{q as default};
import*as e from"react";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const n=[null,null,{}];var r=(e,t)=>Object.assign({},e,t),o=e=>Array.from(e),i=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const s=(e,t=null,n=!1)=>{let r=o(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:s(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},u=(e,t=null)=>({node:t,content:e});function c(e){let t=i(e);return s(t).flatMap(e=>e.nodeValue?o(e.nodeValue).map(t=>u(t,e)):u(e))}function l(e,t=!0){return t?c(e):o(e).map(e=>u(e))}var a=e=>document.createElement(e),f=e=>document.createTextNode(e),h=(e,t="")=>{let n=a("style");n.id=t,n.appendChild(f(e)),document.head.appendChild(n)},d=e=>Array.isArray(e);const m=e=>Number.isInteger(e),v=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),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})=>m(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=v(".ti-cursor",t),i=e?v(e,t):t,u=s(i,o,!0),c=u[0],l=u[u.length-1],a=r&&!e?0:s(t,o,!0).findIndex(e=>e.isSameNode(r?c:l));return r&&a--,a+1})(t,e,r)-n,P=e=>(d(e)||(e=[e/2,e/2]),e),b=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let S=e=>e/2;var N=e=>"value"in e;const M=e=>"function"==typeof e?e():e;var T=e=>"BODY"===e.tagName;const w=(e,t)=>{let n=o(v("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},j=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,c=o?t.content:f(t.content);if(N(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!T(u)){let r=w(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(f(t.content));let n=u.parentNode,r=n.cloneNode();if(!T(n)){let t=w(r,e);for(;!t&&!T(n);){let o=r;o.innerHTML=c.outerHTML,c=o,n=n.parentNode,r=n.cloneNode(),t=w(r,e)}e=t||e}}}let l=s(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(c,a.contains(n)?n:null)};var E=e=>e&&e.remove();const L={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function k(e,t,n){if(!e.s){if(n instanceof x){if(!n.s)return void(n.o=k.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(k.bind(null,e,t),k.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{k(r,1,e(this.v))}catch(e){k(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?k(r,1,t?t(o):o):n?k(r,1,n(o)):k(r,2,o)}catch(e){k(r,2,e)}},r},e}();function D(e){return e instanceof x&&1&e.s}function I(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(!D(u))return void u.then(s,o||(o=k.bind(null,r=new x,2)));u=u.v}r?k(r,1,u):r=u}catch(e){k(r||(r=new x),2,e)}}(),r}function C(e,t,n){for(var r;;){var o=e();if(D(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!D(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!D(s)){r=2;break}}}var u=new x,c=k.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&&!D(s))return void s.then(f).then(void 0,c);if(!(o=e())||D(o)&&!o.v)return void k(u,1,i);if(o.then)return void o.then(a).then(void 0,c);D(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):k(u,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):k(u,1,i)}}function H(e,t={}){const f=this,T=this,w=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(f)).then(function(e){})})}return n?r():Promise.resolve($.beforeStep(f)).then(r)}const o=function(){if(Z.frozen)return Promise.resolve(new Promise(e=>{f.unfreeze=()=>{Z.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},k=()=>N(G),x=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[b(t,S(t)),b(n,S(n))]:[t,n]}($)[e],D=(e,t=0)=>e?x(t):0,H=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[V,t]])})(t),this),O=()=>(e=>N(e)?o(e.value):s(e,v(".ti-cursor",e),!0))(G),z=(e={})=>[[Q,e],[Q,$]],A=e=>{let t=$.nextStringDelay;ee.add([[V,t[0]],...e,[V,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=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(T)).then(function(){if(!$.loop)throw"";let e=$.loopDelay;w(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(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const n=I(t,function(e){let n=t[e],r=n[2];return r.freezeCursor&&B(!0),Promise.resolve(n[0].call(T,n[1],r)).then(function(){ee.setMeta(e,{executed:!0}),B(!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:T}):e?n:T)}catch(e){return Promise.reject(e)}},V=(e=0)=>w(()=>{},e),q=function({value:e,to:t="START",instant:n=!1}){try{let r=g({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,O(),ne,W)};return Promise.resolve(w(function(){try{let e=0;const t=C(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(w(o,x(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(n))).then(function(){})}catch(e){return Promise.reject(e)}},U=({chars:e,instant:t,silent:n})=>{const r=this;return w(function(){try{function o(o){function s(){return n?void 0:Promise.resolve($.afterString(e,r)).then(function(e){})}const u=I(e,function(n){return t?void i(e[n]):Promise.resolve(w(()=>{i(e[n])},x(0))).then(function(e){})});return u&&u.then?u.then(s):s()}const i=e=>j(G,e,ne,W);return Promise.resolve(n?o():Promise.resolve($.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t),!0)},Q=function(e){try{return $=r($,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Y=function(){try{return k()?(G.value="",Promise.resolve()):(O().forEach(e=>{E(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},F=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(w(function(){try{let r=m(e)?e:g({el:G,move:e,cursorPos:W,to:n});const o=()=>{let e=O();var t;e.length&&(k()?G.value=G.value.slice(0,-1):(E(e[W]),t=ne,v("*",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;E(t)}})))};let i=0;const s=C(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(w(o,x(1))).then(function(e){})});return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&O().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=u(a("BR"));return H([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=M(e);let n=z(t),r=e,{instant:o,to:i}=t;return H([n[0],[F,{num:r,instant:o,to:i},X],n[1]],t)},this.empty=function(e={}){return H([[Y]],e)},this.exec=function(e,t){let n=z(t);return H([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=M(e);let n=z(t),{instant:r,to:o}=t;return H([n[0],[q,{value:null===e?"":e,to:o,instant:r},X],n[1]],t)},this.options=function(e){return e=M(e),H([[Q,e]],e)},this.pause=function(e,t={}){return H([[V,M(e)]],t)},this.type=function(e,t={}){e=M(e);let n=z(t),r=l(e,$.html),{instant:o}=t;return H([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=[],M(e)&&E(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[k()?"value":"innerHTML"]="",this},this.go=function(){return Z.started?this:(function(){try{!k()&&G.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(L).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");h("@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,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return $},this.getElement=function(){return G};let G="string"==typeof(J=e)?v(J):J;var J;let K=[],W=0,X={freezeCursor:!0},Z=r({},p),$=r(y,t);$=r($,{html:!k()&&$.html,nextStringDelay:P($.nextStringDelay),loopDelay:P($.loopDelay)});let _=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return o=o.concat(e.map(e=>n.map((t,n)=>e[n]?e[n]:t))),this};let o=[];return t(e),{add:t,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,t){o[e][2]=r(o[e][2],t)}}}([[V,$.startDelay]]);G.dataset.typeitId=_,h("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=$.cursor&&!k(),ne=(()=>{if(k())return;let e=a("span");return e.className="ti-cursor",te?(e.innerHTML=i($.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;$.strings=(e=>{let t=G.innerHTML;return t?(G.innerHTML="",$.startDelete?(c(t).forEach(e=>{j(G,e,ne,W)}),A([[F,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(d(re=$.strings)?re:[re]),$.strings.length&&(()=>{let e=$.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=l(t,$.html);if(ee.add([[U,{chars:r},X]]),n+1===e.length)return;const o=$.breakLines?[[U,{chars:[u(a("BR"))],silent:!0},X]]:[[F,{num:r.length},X]];A(o)})})()}const O=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],z=["options","as","children","getBeforeInit","getAfterInit"],{useRef:A,useEffect:B,useState:R,useMemo:V}=e,q=n=>{const[r,o]=R(!0),i=A(null),{options:s,as:u,children:c,getBeforeInit:l,getAfterInit:a}=n,f=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(n,z),h=u,d=V(()=>O.indexOf(h.toLowerCase())>-1,[h]);return B(()=>{c&&(s.strings=i.current.innerHTML),o(!1)},[]),B(()=>{if(r)return;let e=new H(i.current,t({},s));return e=l(e),e.go(),e=a(e),()=>{e.destroy()}},[r]),e.createElement("div",{style:{opacity:r?0:1}},d?e.createElement(h,t({ref:i},f)):e.createElement(h,t({ref:i},f),r&&c))};q.defaultProps={as:"span",options:{},getBeforeInit:e=>e,getAfterInit:e=>e};export{q as default};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e||self).TypeIt=t(e.react)}(this,function(e){function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var n=t(e);function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const o=[null,null,{}];var i=(e,t)=>Object.assign({},e,t),u=e=>Array.from(e),s=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const c=(e,t=null,n=!1)=>{let r=u(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:c(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},l=(e,t=null)=>({node:t,content:e});function a(e){let t=s(e);return c(t).flatMap(e=>e.nodeValue?u(e.nodeValue).map(t=>l(t,e)):l(e))}function f(e,t=!0){return t?a(e):u(e).map(e=>l(e))}var h=e=>document.createElement(e),d=e=>document.createTextNode(e),m=(e,t="")=>{let n=h("style");n.id=t,n.appendChild(d(e)),document.head.appendChild(n)},v=e=>Array.isArray(e);const p=e=>Number.isInteger(e),y=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),g={started:!1,completed:!1,frozen:!1,destroyed:!1},b={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})=>p(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=y(".ti-cursor",t),i=e?y(e,t):t,u=c(i,o,!0),s=u[0],l=u[u.length-1],a=r&&!e?0:c(t,o,!0).findIndex(e=>e.isSameNode(r?s:l));return r&&a--,a+1})(t,e,r)-n,S=e=>(v(e)||(e=[e/2,e/2]),e),T=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let j=e=>e/2;var M=e=>"value"in e;const N=e=>"function"==typeof e?e():e;var w=e=>"BODY"===e.tagName;const E=(e,t)=>{let n=u(y("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},L=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,s=o?t.content:d(t.content);if(M(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!w(u)){let r=E(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{s=u.cloneNode(),s.appendChild(d(t.content));let n=u.parentNode,r=n.cloneNode();if(!w(n)){let t=E(r,e);for(;!t&&!w(n);){let o=r;o.innerHTML=s.outerHTML,s=o,n=n.parentNode,r=n.cloneNode(),t=E(r,e)}e=t||e}}}let l=c(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(s,a.contains(n)?n:null)};var k=e=>e&&e.remove();const x={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function D(e,t,n){if(!e.s){if(n instanceof O){if(!n.s)return void(n.o=D.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(D.bind(null,e,t),D.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const O=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{D(r,1,e(this.v))}catch(e){D(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?D(r,1,t?t(o):o):n?D(r,1,n(o)):D(r,2,o)}catch(e){D(r,2,e)}},r},e}();function I(e){return e instanceof O&&1&e.s}function C(e,t,n){var r,o,i=-1;return function u(s){try{for(;++i<e.length&&(!n||!n());)if((s=t(i))&&s.then){if(!I(s))return void s.then(u,o||(o=D.bind(null,r=new O,2)));s=s.v}r?D(r,1,s):r=s}catch(e){D(r||(r=new O),2,e)}}(),r}function H(e,t,n){for(var r;;){var o=e();if(I(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!I(i)){r=1;break}i=i.s}if(t){var u=t();if(u&&u.then&&!I(u)){r=2;break}}}var s=new O,c=D.bind(null,s,2);return(0===r?o.then(a):1===r?i.then(l):u.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(u=t())&&u.then&&!I(u))return void u.then(f).then(void 0,c);if(!(o=e())||I(o)&&!o.v)return void D(s,1,i);if(o.then)return void o.then(a).then(void 0,c);I(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):D(s,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):D(s,1,i)}}function z(e,t={}){const n=this,r=this,d=function(e,t){try{function 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,J))}const o=function(){if(X.frozen)return Promise.resolve(new Promise(e=>{n.unfreeze=()=>{X.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(o&&o.then?o.then(r):r())}catch(e){return Promise.reject(e)}},w=()=>M(F),E=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[T(t,j(t)),T(n,j(n))]:[t,n]}(Z)[e],D=(e,t=0)=>e?E(t):0,O=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[q,t]])})(t),this),I=()=>(e=>M(e)?u(e.value):c(e,y(".ti-cursor",e),!0))(F),z=(e={})=>[[_,e],[_,Z]],A=e=>{let t=Z.nextStringDelay;ee.add([[q,t[0]],...e,[q,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=function(){try{let e;X.started=!0;let t,n=ee.getItems();const o=function(e,o){try{var i=function(){function e(){return X.completed=!0,Promise.resolve(Z.afterComplete(...t)).then(function(){if(!Z.loop)throw"";let e=Z.loopDelay;d(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[q,e,{}]),Promise.resolve(Y({num:null})).then(function(){})}return Promise.resolve(K?Promise.resolve(V({value:K})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const o=C(n,function(e){let o=n[e],i=o[2];return t=[o,r],i.freezeCursor&&B(!0),Promise.resolve(Z.beforeStep(...t)).then(function(){return Promise.resolve(o[0].call(r,o[1],i)).then(function(){return Promise.resolve(Z.afterStep(...t)).then(function(){ee.setMeta(e,{executed:!0}),B(!1)})})})});return o&&o.then?o.then(e):e()}()}catch(e){return}return i&&i.then?i.then(void 0,function(){}):i}();return Promise.resolve(o&&o.then?o.then(function(t){return e?t:r}):e?o:r)}catch(e){return Promise.reject(e)}},q=(e=0)=>d(()=>{},e),V=function({value:e,to:t="START",instant:n=!1}){try{let r=P({el:F,move:e,cursorPos:K,to:t}),o=()=>{K+=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)})(F,I(),ne,K)};return Promise.resolve(d(function(){try{let e=0;const t=H(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(d(o,E(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(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 u(){return n?void 0:Promise.resolve(Z.afterString(e,r)).then(function(e){})}const s=C(e,function(n){return t?void i(e[n]):Promise.resolve(d(()=>{i(e[n])},E(0))).then(function(e){})});return s&&s.then?s.then(u):u()}const i=e=>L(F,e,ne,K);return Promise.resolve(n?o():Promise.resolve(Z.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t))},_=function(e){try{return Z=i(Z,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Q=function(){try{return w()?(F.value="",Promise.resolve()):(I().forEach(e=>{k(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},Y=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(d(function(){try{let r=p(e)?e:P({el:F,move:e,cursorPos:K,to:n});const o=()=>{let e=I();var t;e.length&&(w()?F.value=F.value.slice(0,-1):(k(e[K]),t=ne,y("*",F,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;k(t)}})))};let i=0;const u=H(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(d(o,E(1))).then(function(e){})});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&I().length-1>0)return Promise.resolve(Y({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=l(h("BR"));return O([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=N(e);let n=z(t),r=e,{instant:o,to:i}=t;return O([n[0],[Y,{num:r,instant:o,to:i},W],n[1]],t)},this.empty=function(e={}){return O([[Q]],e)},this.exec=function(e,t){let n=z(t);return O([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=N(e);let n=z(t),{instant:r,to:o}=t;return O([n[0],[V,{value:null===e?"":e,to:o,instant:r},W],n[1]],t)},this.options=function(e){return e=N(e),O([[_,e]],e)},this.pause=function(e,t={}){return O([[q,N(e)]],t)},this.type=function(e,t={}){e=N(e);let n=z(t),r=f(e,Z.html),{instant:o}=t;return O([n[0],[U,{chars:r,instant:o},W],n[1]],t)},this.is=function(e){return X[e]},this.destroy=function(e=!0){J.forEach(e=>clearTimeout(e)),J=[],N(e)&&k(ne),X.destroyed=!0},this.freeze=function(){X.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),K=0;for(let e in X)X[e]=!1;return F[w()?"value":"innerHTML"]="",this},this.go=function(){return X.started?this:(function(){try{!w()&&F.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(x).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");m("@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)})($,Z,F),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),Z.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(F,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return Z},this.getElement=function(){return F};let F="string"==typeof(G=e)?y(G):G;var G;let J=[],K=0,W={freezeCursor:!0},X=i({},g),Z=i(b,t);Z=i(Z,{html:!w()&&Z.html,nextStringDelay:S(Z.nextStringDelay),loopDelay:S(Z.loopDelay)});let $=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return n=n.concat(e.map(e=>o.map((t,n)=>e[n]?e[n]:t))),this};let n=[];return t(e),{add:t,set:function(e,t){n[e]=t},reset:function(){n=n.map(e=>(e[2].executed=!1,e))},getItems:function(){return n.filter(e=>!e[2].executed)},setMeta:function(e,t){n[e][2]=i(n[e][2],t)}}}([[q,Z.startDelay]]);F.dataset.typeitId=$,m("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=Z.cursor&&!w(),ne=(()=>{if(w())return;let e=h("span");return e.className="ti-cursor",te?(e.innerHTML=s(Z.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;Z.strings=(e=>{let t=F.innerHTML;return t?(F.innerHTML="",Z.startDelete?(a(t).forEach(e=>{L(F,e,ne,K)}),A([[Y,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(v(re=Z.strings)?re:[re]),Z.strings.length&&(()=>{let e=Z.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=f(t,Z.html);if(ee.add([[U,{chars:r},W]]),n+1===e.length)return;const o=Z.breakLines?[[U,{chars:[l(h("BR"))]},W]]:[[Y,{num:r.length},W]];A(o)})})()}var A=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],B=["options","as","children","getBeforeInit","getAfterInit"],R=n.useRef,q=n.useEffect,V=n.useState,U=n.useMemo,_=function(e){var t=V(!0),o=t[0],i=t[1],u=R(null),s=e.options,c=e.as,l=e.children,a=e.getBeforeInit,f=e.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,B),d=c,m=U(function(){return A.indexOf(d.toLowerCase())>-1},[d]);return q(function(){l&&(s.strings=u.current.innerHTML),i(!1)},[]),q(function(){if(!o){var e=new z(u.current,r({},s));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),n.createElement("div",{style:{opacity:o?0:1}},m?n.createElement(d,r({ref:u},h)):n.createElement(d,r({ref:u},h),o&&l))};return _.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}},_});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e||self).TypeIt=t(e.react)}(this,function(e){function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var n=t(e);function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}const o=[null,null,{}];var i=(e,t)=>Object.assign({},e,t),u=e=>Array.from(e),s=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,t.body};const c=(e,t=null,n=!1)=>{let r=u(e.childNodes).flatMap(e=>{return 3===(t=e).nodeType||"BR"===t.tagName?e:c(e);var t});return t&&(r=r.filter(e=>!t.contains(e))),n?r.reverse():r},l=(e,t=null)=>({node:t,content:e});function a(e){let t=s(e);return c(t).flatMap(e=>e.nodeValue?u(e.nodeValue).map(t=>l(t,e)):l(e))}function f(e,t=!0){return t?a(e):u(e).map(e=>l(e))}var h=e=>document.createElement(e),d=e=>document.createTextNode(e),m=(e,t="")=>{let n=h("style");n.id=t,n.appendChild(d(e)),document.head.appendChild(n)},v=e=>Array.isArray(e);const p=e=>Number.isInteger(e),y=(e,t=document,n=!1)=>t["querySelector"+(n?"All":"")](e),g={started:!1,completed:!1,frozen:!1,destroyed:!1},b={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})=>p(t)?-1*t:((e,t,n="START")=>{let r=new RegExp("END","i").test(n),o=y(".ti-cursor",t),i=e?y(e,t):t,u=c(i,o,!0),s=u[0],l=u[u.length-1],a=r&&!e?0:c(t,o,!0).findIndex(e=>e.isSameNode(r?s:l));return r&&a--,a+1})(t,e,r)-n,S=e=>(v(e)||(e=[e/2,e/2]),e),T=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let j=e=>e/2;var M=e=>"value"in e;const N=e=>"function"==typeof e?e():e;var w=e=>"BODY"===e.tagName;const E=(e,t)=>{let n=u(y("*",t,!0));return[t].concat(n.reverse()).find(t=>t.cloneNode().isEqualNode(e.cloneNode()))},L=(e,t,n,r)=>{let o=t.content instanceof HTMLElement,i=t.node,u=null==i?void 0:i.parentNode,s=o?t.content:d(t.content);if(M(e))return void(e.value=""+e.value+t.content);if(!o&&u&&!w(u)){let r=E(u,e);if(r&&((e,t)=>{let n=e.nextSibling;return!n||n.isEqualNode(t)})(r,n))e=r;else{s=u.cloneNode(),s.appendChild(d(t.content));let n=u.parentNode,r=n.cloneNode();if(!w(n)){let t=E(r,e);for(;!t&&!w(n);){let o=r;o.innerHTML=s.outerHTML,s=o,n=n.parentNode,r=n.cloneNode(),t=E(r,e)}e=t||e}}}let l=c(e,n,!0)[r-1],a=l?l.parentNode:e;a.insertBefore(s,a.contains(n)?n:null)};var k=e=>e&&e.remove();const x={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"","margin-left":"-.125em","margin-right":".125em"};function D(e,t,n){if(!e.s){if(n instanceof O){if(!n.s)return void(n.o=D.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(D.bind(null,e,t),D.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const O=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{D(r,1,e(this.v))}catch(e){D(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?D(r,1,t?t(o):o):n?D(r,1,n(o)):D(r,2,o)}catch(e){D(r,2,e)}},r},e}();function I(e){return e instanceof O&&1&e.s}function C(e,t,n){var r,o,i=-1;return function u(s){try{for(;++i<e.length&&(!n||!n());)if((s=t(i))&&s.then){if(!I(s))return void s.then(u,o||(o=D.bind(null,r=new O,2)));s=s.v}r?D(r,1,s):r=s}catch(e){D(r||(r=new O),2,e)}}(),r}function H(e,t,n){for(var r;;){var o=e();if(I(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!I(i)){r=1;break}i=i.s}if(t){var u=t();if(u&&u.then&&!I(u)){r=2;break}}}var s=new O,c=D.bind(null,s,2);return(0===r?o.then(a):1===r?i.then(l):u.then(f)).then(void 0,c),s;function l(r){i=r;do{if(t&&(u=t())&&u.then&&!I(u))return void u.then(f).then(void 0,c);if(!(o=e())||I(o)&&!o.v)return void D(s,1,i);if(o.then)return void o.then(a).then(void 0,c);I(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):D(s,1,i)}function f(){(o=e())?o.then?o.then(a).then(void 0,c):a(o):D(s,1,i)}}function z(e,t={}){const n=this,r=this,d=function(e,t,r=!1){try{function o(){function o(o){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,J)).then(function(){return r?void 0:Promise.resolve(Z.afterStep(n)).then(function(e){})})}return r?o():Promise.resolve(Z.beforeStep(n)).then(o)}const i=function(){if(X.frozen)return Promise.resolve(new Promise(e=>{n.unfreeze=()=>{X.frozen=!1,e()}})).then(function(){})}();return Promise.resolve(i&&i.then?i.then(o):o())}catch(e){return Promise.reject(e)}},w=()=>M(F),E=e=>function(e){let{speed:t,deleteSpeed:n,lifeLike:r}=e;return n=null!==n?n:t/3,r?[T(t,j(t)),T(n,j(n))]:[t,n]}(Z)[e],D=(e,t=0)=>e?E(t):0,O=(e,t)=>(ee.add(e),((e={})=>{let t=e.delay;t&&ee.add([[q,t]])})(t),this),I=()=>(e=>M(e)?u(e.value):c(e,y(".ti-cursor",e),!0))(F),z=(e={})=>[[_,e],[_,Z]],A=e=>{let t=Z.nextStringDelay;ee.add([[q,t[0]],...e,[q,t[1]]])},B=e=>{te&&(ne.classList.toggle("disabled",e),ne.classList.toggle("with-delay",!e))},R=function(){try{let e;X.started=!0;let t=ee.getItems();const n=function(e,n){try{var o=function(){function e(){return X.completed=!0,Promise.resolve(Z.afterComplete(r)).then(function(){if(!Z.loop)throw"";let e=Z.loopDelay;d(function(){try{return Promise.resolve(function(e){try{function t(t){return ee.reset(),ee.set(0,[q,e,{}]),Promise.resolve(Y({num:null})).then(function(){})}return Promise.resolve(K?Promise.resolve(V({value:K})).then(t):t())}catch(e){return Promise.reject(e)}}(e[0])).then(function(){R()})}catch(e){return Promise.reject(e)}},e[1])})}const n=C(t,function(e){let n=t[e],o=n[2];return o.freezeCursor&&B(!0),Promise.resolve(n[0].call(r,n[1],o)).then(function(){ee.setMeta(e,{executed:!0}),B(!1)})});return n&&n.then?n.then(e):e()}()}catch(e){return}return o&&o.then?o.then(void 0,function(){}):o}();return Promise.resolve(n&&n.then?n.then(function(t){return e?t:r}):e?n:r)}catch(e){return Promise.reject(e)}},q=(e=0)=>d(()=>{},e),V=function({value:e,to:t="START",instant:n=!1}){try{let r=P({el:F,move:e,cursorPos:K,to:t}),o=()=>{K+=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)})(F,I(),ne,K)};return Promise.resolve(d(function(){try{let e=0;const t=H(function(){return e<Math.abs(r)},function(){return e++},function(){return n?void o():Promise.resolve(d(o,E(0))).then(function(e){})});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(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 u(){return n?void 0:Promise.resolve(Z.afterString(e,r)).then(function(e){})}const s=C(e,function(n){return t?void i(e[n]):Promise.resolve(d(()=>{i(e[n])},E(0))).then(function(e){})});return s&&s.then?s.then(u):u()}const i=e=>L(F,e,ne,K);return Promise.resolve(n?o():Promise.resolve(Z.beforeString(e,r)).then(o))}catch(e){return Promise.reject(e)}},D(t),!0)},_=function(e){try{return Z=i(Z,e),Promise.resolve()}catch(e){return Promise.reject(e)}},Q=function(){try{return w()?(F.value="",Promise.resolve()):(I().forEach(e=>{k(e)}),Promise.resolve())}catch(e){return Promise.reject(e)}},Y=function({num:e=null,instant:t=!1,to:n="START"}){try{return Promise.resolve(d(function(){try{let r=p(e)?e:P({el:F,move:e,cursorPos:K,to:n});const o=()=>{let e=I();var t;e.length&&(w()?F.value=F.value.slice(0,-1):(k(e[K]),t=ne,y("*",F,!0).forEach(e=>{if(!e.innerHTML&&"BR"!==e.tagName&&!e.isSameNode(t)){let t=e;for(;1===t.parentElement.childNodes.length;)t=t.parentElement;k(t)}})))};let i=0;const u=H(function(){return i<r},function(){return i++},function(){return t?void o():Promise.resolve(d(o,E(1))).then(function(e){})});return Promise.resolve(u&&u.then?u.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},D(t,1))).then(function(){const t=function(){if(null===e&&I().length-1>0)return Promise.resolve(Y({num:null})).then(function(){})}();if(t&&t.then)return t.then(function(){})})}catch(e){return Promise.reject(e)}};this.break=function(e){const t=l(h("BR"));return O([[U,{chars:[t],silent:!0}]],e)},this.delete=function(e=null,t={}){e=N(e);let n=z(t),r=e,{instant:o,to:i}=t;return O([n[0],[Y,{num:r,instant:o,to:i},W],n[1]],t)},this.empty=function(e={}){return O([[Q]],e)},this.exec=function(e,t){let n=z(t);return O([n[0],[e,null],n[1]],t)},this.move=function(e,t={}){e=N(e);let n=z(t),{instant:r,to:o}=t;return O([n[0],[V,{value:null===e?"":e,to:o,instant:r},W],n[1]],t)},this.options=function(e){return e=N(e),O([[_,e]],e)},this.pause=function(e,t={}){return O([[q,N(e)]],t)},this.type=function(e,t={}){e=N(e);let n=z(t),r=f(e,Z.html),{instant:o}=t;return O([n[0],[U,{chars:r,instant:o},W],n[1]],t)},this.is=function(e){return X[e]},this.destroy=function(e=!0){J.forEach(e=>clearTimeout(e)),J=[],N(e)&&k(ne),X.destroyed=!0},this.freeze=function(){X.frozen=!0},this.unfreeze=function(){},this.reset=function(){!this.is("destroyed")&&this.destroy(),ee.reset(),K=0;for(let e in X)X[e]=!1;return F[w()?"value":"innerHTML"]="",this},this.go=function(){return X.started?this:(function(){try{!w()&&F.appendChild(ne),te?(((e,t,n)=>{let r="[data-typeit-id='"+e+"'] .ti-cursor",o=getComputedStyle(n),i=Object.entries(x).reduce((e,[t,n])=>e+" "+t+": var(--ti-"+t+", "+(n||o[t])+");","");m("@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)})($,Z,F),Promise.resolve()):Promise.resolve()}catch(e){return Promise.reject(e)}}(),Z.waitUntilVisible?(((e,t)=>{new IntersectionObserver((n,r)=>{n.forEach(n=>{n.isIntersecting&&(t(),r.unobserve(e))})},{threshold:1}).observe(e)})(F,R.bind(this)),this):(R(),this))},this.getQueue=function(){return ee},this.getOptions=function(){return Z},this.getElement=function(){return F};let F="string"==typeof(G=e)?y(G):G;var G;let J=[],K=0,W={freezeCursor:!0},X=i({},g),Z=i(b,t);Z=i(Z,{html:!w()&&Z.html,nextStringDelay:S(Z.nextStringDelay),loopDelay:S(Z.loopDelay)});let $=Math.random().toString().substring(2,9),ee=function(e){const t=function(e){return n=n.concat(e.map(e=>o.map((t,n)=>e[n]?e[n]:t))),this};let n=[];return t(e),{add:t,set:function(e,t){n[e]=t},reset:function(){n=n.map(e=>(e[2].executed=!1,e))},getItems:function(){return n.filter(e=>!e[2].executed)},setMeta:function(e,t){n[e][2]=i(n[e][2],t)}}}([[q,Z.startDelay]]);F.dataset.typeitId=$,m("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}");let te=Z.cursor&&!w(),ne=(()=>{if(w())return;let e=h("span");return e.className="ti-cursor",te?(e.innerHTML=s(Z.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)})();var re;Z.strings=(e=>{let t=F.innerHTML;return t?(F.innerHTML="",Z.startDelete?(a(t).forEach(e=>{L(F,e,ne,K)}),A([[Y,{num:null}]]),e):t.trim().split(/<br(?:\s*?)(?:\/)?>/).concat(e)):e})(v(re=Z.strings)?re:[re]),Z.strings.length&&(()=>{let e=Z.strings.filter(e=>!!e);e.forEach((t,n)=>{let r=f(t,Z.html);if(ee.add([[U,{chars:r},W]]),n+1===e.length)return;const o=Z.breakLines?[[U,{chars:[l(h("BR"))],silent:!0},W]]:[[Y,{num:r.length},W]];A(o)})})()}var A=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],B=["options","as","children","getBeforeInit","getAfterInit"],R=n.useRef,q=n.useEffect,V=n.useState,U=n.useMemo,_=function(e){var t=V(!0),o=t[0],i=t[1],u=R(null),s=e.options,c=e.as,l=e.children,a=e.getBeforeInit,f=e.getAfterInit,h=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,B),d=c,m=U(function(){return A.indexOf(d.toLowerCase())>-1},[d]);return q(function(){l&&(s.strings=u.current.innerHTML),i(!1)},[]),q(function(){if(!o){var e=new z(u.current,r({},s));return(e=a(e)).go(),e=f(e),function(){e.destroy()}}},[o]),n.createElement("div",{style:{opacity:o?0:1}},m?n.createElement(d,r({ref:u},h)):n.createElement(d,r({ref:u},h),o&&l))};return _.defaultProps={as:"span",options:{},getBeforeInit:function(e){return e},getAfterInit:function(e){return e}},_});
{
"name": "typeit-react",
"version": "2.0.0",
"version": "2.0.1",
"description": "React component for the most versatile JavaScript animated typing utility on the planet.",

@@ -52,3 +52,3 @@ "homepage": "https://typeitjs.com",

"prettier": "^2.3.2",
"typeit": "^8.0.0",
"typeit": "^8.0.1",
"typescript": "^4.3.5"

@@ -55,0 +55,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc