/*! * VERSION: 0.5.2 * DATE: 2019-02-07 * UPDATES AND DOCS AT: http://greensock.com * * @license Copyright (c) 2008-2019, GreenSock. All rights reserved. * ScrambleTextPlugin is a Club GreenSock membership benefit; You must have a valid membership to use * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details. * This work is subject to the software agreement that was issued with your membership. * * @author: Jack Doyle, jack@greensock.com */ var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var a=/(^\s+|\s+$)/g,b=/\s+/g,c=function(a){var b=a.nodeType,d="";if(1===b||9===b||11===b){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)d+=c(a)}else if(3===b||4===b)return a.nodeValue;return d},d=function(a,b){for(var c=b.length,d="";--a>-1;)d+=b[Math.random()*c|0];return d},e=function(a){this.chars=i(a),this.sets=[],this.length=50;var b;for(b=0;20>b;b++)this.sets[b]=d(80,this.chars);this.grow=function(a){for(b=0;20>b;b++)this.sets[b]+=d(a-this.length,this.chars);this.length=a}},f="[-]|�[�-�]|�[�-�]|[⚔-⚗]|�[�-�]|[�-�][�-�]",g=new RegExp(f),h=new RegExp(f+"|.","g"),i=function(b,c,d){return d&&(b=b.replace(a,"")),""!==c&&c||!g.test(b)?b.split(c||""):b.match(h)},j="ABCDEFGHIJKLMNOPQRSTUVWXYZ",k=j.toLowerCase(),l={upperCase:new e(j),lowerCase:new e(k),upperAndLowerCase:new e(j+k)},m=_gsScope._gsDefine.plugin({propName:"scrambleText",version:"0.5.2",API:2,overwriteProps:["scrambleText","text"],init:function(a,d,f,h){if(this._prop="innerHTML"in a?"innerHTML":"textContent"in a?"textContent":0,!this._prop)return!1;"function"==typeof d&&(d=d(h,a)),this._target=a,"object"!=typeof d&&(d={text:d});var j,k,m,n,o=d.text||d.value,p=d.trim!==!1;return this._delimiter=j=d.delimiter||"",this._original=i(c(a).replace(b," ").split(" ").join(""),j,p),("{original}"===o||o===!0||null==o)&&(o=this._original.join(j)),this._text=i((o||"").replace(b," "),j,p),this._hasClass=!1,"string"==typeof d.newClass&&(this._newClass=d.newClass,this._hasClass=!0),"string"==typeof d.oldClass&&(this._oldClass=d.oldClass,this._hasClass=!0),n=""===j,this._textHasEmoji=g.test(this._text.join(j))&&n,this._charsHaveEmoji=!!d.chars&&g.test(d.chars),this._length=n?this._original.length:this._original.join(j).length,this._lengthDif=(n?this._text.length:this._text.join(j).length)-this._length,this._fillChar=d.fillChar||d.chars&&-1!==d.chars.indexOf(" ")?" ":"",this._charSet=m=l[d.chars||"upperCase"]||new e(d.chars),this._speed=.016/(d.speed||1),this._prevScrambleTime=0,this._setIndex=20*Math.random()|0,k=this._length+Math.max(this._lengthDif,0),k>m.length&&m.grow(k),this._chars=m.sets[this._setIndex],this._revealDelay=d.revealDelay||0,this._tweenLength=d.tweenLength!==!1,this._tween=f,this._rightToLeft=!!d.rightToLeft,!0},set:function(a){var b,c,d,e,f,g,h,j,k,l=this._text.length,m=this._delimiter,n=this._tween._time,o=n-this._prevScrambleTime;this._revealDelay&&(this._tween.vars.runBackwards&&(n=this._tween._duration-n),a=0===n?0:na?a=0:a>1&&(a=1),this._rightToLeft&&(a=1-a),b=a*l+.5|0,a?((o>this._speed||o<-this._speed)&&(this._setIndex=(this._setIndex+(19*Math.random()|0))%20,this._chars=this._charSet.sets[this._setIndex],this._prevScrambleTime+=o),e=this._chars):e=this._original.join(m),this._rightToLeft?1!==a||!this._tween.vars.runBackwards&&"isFromStart"!==this._tween.data?(h=this._text.slice(b).join(m),d=this._charsHaveEmoji?i(e).slice(0,this._length+(this._tweenLength?1-a*a*a:1)*this._lengthDif-(this._textHasEmoji?i(h):h).length+.5|0).join(""):e.substr(0,this._length+(this._tweenLength?1-a*a*a:1)*this._lengthDif-(this._textHasEmoji?i(h):h).length+.5|0),e=h):(d="",e=this._original.join(m)):(d=this._text.slice(0,b).join(m),c=(this._textHasEmoji?i(d):d).length,e=this._charsHaveEmoji?i(e).slice(c,this._length+(this._tweenLength?1-(a=1-a)*a*a*a:1)*this._lengthDif+.5|0).join(""):e.substr(c,this._length+(this._tweenLength?1-(a=1-a)*a*a*a:1)*this._lengthDif-c+.5|0)),this._hasClass?(j=this._rightToLeft?this._oldClass:this._newClass,k=this._rightToLeft?this._newClass:this._oldClass,f=j&&0!==b,g=k&&b!==l,h=(f?"":"")+d+(f?"":"")+(g?"":"")+m+e+(g?"":"")):h=d+m+e,this._target[this._prop]=" "===this._fillChar&&-1!==h.indexOf(" ")?h.split(" ").join("  "):h}}),n=m.prototype;n._newClass=n._oldClass="";for(n in l)l[n.toLowerCase()]=l[n],l[n.toUpperCase()]=l[n]}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a){"use strict";var b=function(){return(_gsScope.GreenSockGlobals||_gsScope)[a]};"undefined"!=typeof module&&module.exports?(require("../TweenLite.min.js"),module.exports=b()):"function"==typeof define&&define.amd&&define(["TweenLite"],b)}("ScrambleTextPlugin");