kute.js/dist/kute.esm.min.js
2020-06-20 09:23:25 +00:00

3 lines
34 KiB
JavaScript

// KUTE.js Standard v2.0.6 | thednp © 2020 | MIT-License
var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function r(t,e,n){return(t=+t)+(e-=t)*n}var i={numbers:r,units:function(t,e,n,r){return(t=+t)+(e-=t)*r+n},arrays:function(t,e,n){for(var r=[],i=0,a=e.length;i<a;i++)r[i]=(1e3*(t[i]+(e[i]-t[i])*n)>>0)/1e3;return r}},a={},s={};"undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?s.now=function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now&&(s.now=self.performance.now.bind(self.performance));var o=0,u=function(t){for(var n=0;n<e.length;)e[n].update(t)?n++:e.splice(n,1);o=requestAnimationFrame(u)};function l(){setTimeout((function(){if(!e.length&&o){for(var n in cancelAnimationFrame(o),o=null,a)if("function"==typeof a[n])t[n]&&delete t[n];else for(var r in a[n])t[r]&&delete t[r];for(var s in i)t[s]&&delete t[s]}}),64)}var c={Tick:o,Ticker:u,Tweens:e,Time:s};for(var p in c)t[p]||(t[p]="Time"===p?s.now:c[p]);n._KUTE=t;var h={},f={},v={duration:700,delay:0,easing:"linear"},d={},g={},m={},y={},w={},b={supportedProperties:h,defaultValues:f,defaultOptions:v,prepareProperty:d,prepareStart:g,crossCheck:m,onStart:a,onComplete:y,linkProperty:w},_={},x={};function S(t){return e.push(t)}function T(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}function E(){var e=this,n=function(n){var r=w[n],i=h[n];for(var a in r)if("function"==typeof r[a]&&Object.keys(e.valuesEnd).some((function(t){return i&&i.includes(t)||"attr"===t&&Object.keys(e.valuesEnd[t]).some((function(t){return i&&i.includes(t)}))})))!t[a]&&(t[a]=r[a]);else for(var s in e.valuesEnd)for(var o in e.valuesEnd[s])if("function"==typeof r[o])!t[o]&&(t[o]=r[o]);else for(var u in r[a])r[o]&&"function"==typeof r[o][u]&&!t[u]&&(t[u]=r[o][u])};for(var r in w)n(r)}var C={add:S,remove:T,getAll:function(){return e},removeAll:function(){e.length=0},stop:l,linkInterpolation:E};function I(t){if(t.style){var e=t.style.cssText.replace(/\s/g,"").split(";"),n={},r=["translate3d","translate","scale3d","skew"];return e.map((function(t){/transform/i.test(t)&&t.split(":")[1].split(")").map((function(t){var e=t.split("("),i=e[0],a=e[1];/matrix/.test(i)||(n[i]=r.includes(i)?a.split(","):a)}))})),n}}function A(t,e){var n=t.style,r=getComputedStyle(t)||t.currentStyle,i=n[e]&&!/auto|initial|none|unset/.test(n[e])?n[e]:r[e];if("transform"!==e&&(e in r||e in n))return i||f[e]}function M(t,e){var n="start"===e?this.valuesStart:this.valuesEnd;for(var r in d){var i=d[r],a=h[r];for(var s in i){var o={};for(var u in t)f[u]&&i[u]?n[u]=i[u].call(this,u,t[u]):!f[s]&&"transform"===s&&a.includes(u)?o[u]=t[u]:!f[s]&&a&&a.includes(u)&&(n[u]=i[s].call(this,u,t[u]));Object.keys&&Object.keys(o).length&&(n[s]=i[s].call(this,s,o))}}}function k(){var t={},e=I(this.element);for(var n in this.valuesStart)for(var r in g){var i=g[r];for(var a in i)(a===n&&i[n]||h[r]&&h[r].includes(n))&&(t[n]=i[a].call(this,n,this.valuesStart[n]))}for(var s in e)s in this.valuesStart||(t[s]=e[s]||f[s]);this.valuesStart={},M.call(this,t,"start")}var O={getInlineStyle:I,getStyleForProperty:A,getStartValues:k,prepareObject:M},L=function(t,e,n,r,i){var a=this;this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by;var s=function(t){return a.sampleCurveY(a.solveCurveX(t))};return Object.defineProperty(s,"name",{writable:!0}),s.name=i||"cubic-bezier("+[t,e,n,r]+")",s};L.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},L.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},L.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},L.prototype.solveCurveX=function(t){var e,n,r,i,a,s;for(r=t,s=0;s<32;s++){if(i=this.sampleCurveX(r)-t,Math.abs(i)<1e-5)return r;if(a=this.sampleCurveDerivativeX(r),Math.abs(a)<1e-5)break;r-=i/a}if((r=t)<(e=0))return e;if(r>(n=1))return n;for(;e<n;){if(i=this.sampleCurveX(r),Math.abs(i-t)<1e-5)return r;t>i?e=r:n=r,r=.5*(n-e)+e}return r};var P={},j={linear:new L(0,0,1,1,"linear"),easingSinusoidalIn:new L(.47,0,.745,.715,"easingSinusoidalIn"),easingSinusoidalOut:new L(.39,.575,.565,1,"easingSinusoidalOut"),easingSinusoidalInOut:new L(.445,.05,.55,.95,"easingSinusoidalInOut"),easingQuadraticIn:new L(.55,.085,.68,.53,"easingQuadraticIn"),easingQuadraticOut:new L(.25,.46,.45,.94,"easingQuadraticOut"),easingQuadraticInOut:new L(.455,.03,.515,.955,"easingQuadraticInOut"),easingCubicIn:new L(.55,.055,.675,.19,"easingCubicIn"),easingCubicOut:new L(.215,.61,.355,1,"easingCubicOut"),easingCubicInOut:new L(.645,.045,.355,1,"easingCubicInOut"),easingQuarticIn:new L(.895,.03,.685,.22,"easingQuarticIn"),easingQuarticOut:new L(.165,.84,.44,1,"easingQuarticOut"),easingQuarticInOut:new L(.77,0,.175,1,"easingQuarticInOut"),easingQuinticIn:new L(.755,.05,.855,.06,"easingQuinticIn"),easingQuinticOut:new L(.23,1,.32,1,"easingQuinticOut"),easingQuinticInOut:new L(.86,0,.07,1,"easingQuinticInOut"),easingExponentialIn:new L(.95,.05,.795,.035,"easingExponentialIn"),easingExponentialOut:new L(.19,1,.22,1,"easingExponentialOut"),easingExponentialInOut:new L(1,0,0,1,"easingExponentialInOut"),easingCircularIn:new L(.6,.04,.98,.335,"easingCircularIn"),easingCircularOut:new L(.075,.82,.165,1,"easingCircularOut"),easingCircularInOut:new L(.785,.135,.15,.86,"easingCircularInOut"),easingBackIn:new L(.6,-.28,.735,.045,"easingBackIn"),easingBackOut:new L(.175,.885,.32,1.275,"easingBackOut"),easingBackInOut:new L(.68,-.55,.265,1.55,"easingBackInOut")};function U(t,e){try{return e?t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array&&t.every((function(t){return t instanceof Element}))?t:document.querySelectorAll(t):t instanceof Element||t===window?t:document.querySelector(t)}catch(e){console.error("KUTE.js - Element(s) not found: "+t+".")}}P.processEasing=function(t){if("function"==typeof t)return t;if("function"==typeof j[t])return j[t];if(/bezier/.test(t)){var e=t.replace(/bezier|\s|\(|\)/g,"").split(",");return new L(1*e[0],1*e[1],1*e[2],1*e[3])}return/elastic|bounce/i.test(t)&&console.warn("KUTE.js - CubicBezier doesn't support "+t+" easing."),j.linear};var F=function(e,n,r,i){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,i=i||{},this._resetStart=i.resetStart||0,this._easing="function"==typeof i.easing?i.easing:P.processEasing(i.easing),this._duration=i.duration||v.duration,this._delay=i.delay||v.delay,i){var o="_"+s;o in this||(this[o]=i[s])}var u=this._easing.name;return a[u]||(a[u]=function(e){!t[e]&&e===this._easing.name&&(t[e]=this._easing)}),this};F.prototype.start=function(e){if(S(this),this.playing=!0,this._startTime=e||t.Time(),this._startTime+=this._delay,!this._startFired){for(var n in this._onStart&&this._onStart.call(this),a)if("function"==typeof a[n])a[n].call(this,n);else for(var r in a[n])a[n][r].call(this,r);E.call(this),this._startFired=!0}return!o&&u(),this},F.prototype.stop=function(){return this.playing&&(T(this),this.playing=!1,this._onStop&&this._onStop.call(this),this.close()),this},F.prototype.close=function(){for(var t in y)for(var e in y[t])y[t][e].call(this,e);this._startFired=!1,l.call(this)},F.prototype.chain=function(t){return this._chain=[],this._chain=t.length?t:this._chain.concat(t),this},F.prototype.stopChainedTweens=function(){this._chain&&this._chain.length&&this._chain.map((function(t){return t.stop()}))},F.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())<this._startTime&&this.playing)return!0;for(var i in n=(e-this._startTime)/this._duration,n=0===this._duration||n>1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1)},P.tween=F,v.repeat=0,v.repeatDelay=0,v.yoyo=!1,v.resetStart=!1;var N=function(e){function n(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];e.apply(this,t),this.valuesStart={},this.valuesEnd={};var r=t[1],i=t[2];if(M.call(this,i,"end"),this._resetStart?this.valuesStart=r:M.call(this,r,"start"),!this._resetStart)for(var a in m)for(var s in m[a])m[a][s].call(this,s);this.paused=!1,this._pauseTime=null;var o=t[3];return this._repeat=o.repeat||v.repeat,this._repeatDelay=o.repeatDelay||v.repeatDelay,this._repeatOption=this._repeat,this.valuesRepeat={},this._yoyo=o.yoyo||v.yoyo,this._reversed=!1,this}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.start=function(t){if(this._resetStart)for(var n in this.valuesStart=this._resetStart,k.call(this),m)for(var r in m[n])m[n][r].call(this,r);if(this.paused=!1,this._yoyo)for(var i in this.valuesEnd)this.valuesRepeat[i]=this.valuesStart[i];return e.prototype.start.call(this,t),this},n.prototype.stop=function(){return e.prototype.stop.call(this),!this.paused&&this.playing&&(this.paused=!1,this.stopChainedTweens()),this},n.prototype.close=function(){return e.prototype.close.call(this),this._repeatOption>0&&(this._repeat=this._repeatOption),this._yoyo&&!0===this._reversed&&(this.reverse(),this._reversed=!1),this},n.prototype.resume=function(){return this.paused&&this.playing&&(this.paused=!1,void 0!==this._onResume&&this._onResume.call(this),this._startTime+=t.Time()-this._pauseTime,S(this),!o&&u()),this},n.prototype.pause=function(){return!this.paused&&this.playing&&(T(this),this.paused=!0,this._pauseTime=t.Time(),void 0!==this._onPause&&this._onPause.call(this)),this},n.prototype.reverse=function(){for(var t in this.valuesEnd){var e=this.valuesRepeat[t];this.valuesRepeat[t]=this.valuesEnd[t],this.valuesEnd[t]=e,this.valuesStart[t]=this.valuesRepeat[t]}},n.prototype.update=function(e){var n,r;if((e=void 0!==e?e:t.Time())<this._startTime&&this.playing)return!0;for(var i in n=(e-this._startTime)/this._duration,n=0===this._duration||n>1?1:n,r=this._easing(n),this.valuesEnd)t[i](this.element,this.valuesStart[i],this.valuesEnd[i],r);return this._onUpdate&&this._onUpdate.call(this),1!==n||(this._repeat>0?(isFinite(this._repeat)&&this._repeat--,this._startTime=isFinite(this._repeat)&&this._yoyo&&!this._reversed?e+this._repeatDelay:e,this._yoyo&&(this._reversed=!this._reversed,this.reverse()),!0):(this._onComplete&&this._onComplete.call(this),this.playing=!1,this.close(),void 0!==this._chain&&this._chain.length&&this._chain.map((function(t){return t.start()})),!1))},n}(F);P.tween=N;var H=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in v)&&(v.offset=0),(r=r||{}).delay=r.delay||v.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||v.offset):r.delay,t instanceof Element?i.tweens.push(new P.tween(t,e,n,a[s])):console.error("KUTE.js - "+t+" not instanceof [Element]")})),this.length=this.tweens.length,this};H.prototype.start=function(e){return e=void 0===e?t.Time():e,this.tweens.map((function(t){return t.start(e)})),this},H.prototype.stop=function(){return this.tweens.map((function(t){return t.stop(time)})),this},H.prototype.pause=function(){return this.tweens.map((function(t){return t.pause(time)})),this},H.prototype.resume=function(){return this.tweens.map((function(t){return t.resume(time)})),this},H.prototype.chain=function(t){var e=this.tweens[this.length-1];if(t instanceof H)e.chain(t.tweens);else{if(!(t instanceof P.tween))throw new TypeError("KUTE.js - invalid chain value");e.chain(t)}return this},H.prototype.playing=function(){return this.tweens.some((function(t){return t.playing}))},H.prototype.removeTweens=function(){this.tweens=[]},H.prototype.getMaxDuration=function(){var t=[];return this.tweens.forEach((function(e){t.push(e._duration+e._delay+e._repeat*e._repeatDelay)})),Math.max(t)};var D=function(t){try{t.component in h?console.error("KUTE.js - "+t.component+" already registered"):t.property in f?console.error("KUTE.js - "+t.property+" already registered"):this.setComponent(t)}catch(t){console.error(t)}};function V(t,e){for(var n,r=parseInt(t)||0,i=["px","%","deg","rad","em","rem","vh","vw"],a=0;a<i.length;a++)if("string"==typeof t&&t.includes(i[a])){n=i[a];break}return{v:r,u:n=void 0!==n?n:e?"deg":"px"}}function z(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,i,a){t.style[e]=(a>.99||a<.01?(10*r(n,i,a)>>0)/10:r(n,i,a)>>0)+"px"})}D.prototype.setComponent=function(t){var e=t.component,n={prepareProperty:d,prepareStart:g,onStart:a,onComplete:y,crossCheck:m},r=t.category,s=t.property,o=t.properties&&t.properties.length||t.subProperties&&t.subProperties.length;if(h[e]=t.properties||t.subProperties||t.property,"defaultValue"in t)f[s]=t.defaultValue,this.supports=s+" property";else if(t.defaultValues){for(var u in t.defaultValues)f[u]=t.defaultValues[u];this.supports=(o||s)+" "+(s||r)+" properties"}if(t.defaultOptions)for(var l in t.defaultOptions)v[l]=t.defaultOptions[l];if(t.functions)for(var c in n)if(c in t.functions)if("function"==typeof t.functions[c])!n[c][e]&&(n[c][e]={}),!n[c][e][r||s]&&(n[c][e][r||s]=t.functions[c]);else for(var p in t.functions[c])!n[c][e]&&(n[c][e]={}),!n[c][e][p]&&(n[c][e][p]=t.functions[c][p]);if(t.Interpolate){for(var b in t.Interpolate){var x=t.Interpolate[b];if("function"!=typeof x||i[b])for(var S in x)"function"!=typeof x[S]||i[b]||(i[b]=x[S]);else i[b]=x}w[e]=t.Interpolate}if(t.Util)for(var T in t.Util)!_[T]&&(_[T]=t.Util[T]);return this};var Q=["top","left","width","height"],R={};Q.map((function(t){return R[t]=z}));var X={component:"essentialBoxModel",category:"boxModel",properties:Q,defaultValues:{top:0,left:0,width:0,height:0},Interpolate:{numbers:r},functions:{prepareStart:function(t){return A(this.element,t)||f[t]},prepareProperty:function(t,e){var n=V(e),r="height"===t?"offsetHeight":"offsetWidth";return"%"===n.u?n.v*this.element[r]/100:n.v},onStart:R},Util:{trueDimension:V}};function B(t){if(/rgb|rgba/.test(t)){var e=t.replace(/\s|\)/,"").split("(")[1].split(","),n=e[3]?e[3]:null;return n?{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(n)}:{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}if(/^#/.test(t)){var r=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,r){return e+e+n+n+r+r}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}(t);return{r:r.r,g:r.g,b:r.b}}if(/transparent|none|initial|inherit/.test(t))return{r:0,g:0,b:0,a:0};if(!/^#|^rgb/.test(t)){var i=document.getElementsByTagName("head")[0];i.style.color=t;var a=getComputedStyle(i,null).color;return a=/rgb/.test(a)?a.replace(/[^\d,]/g,"").split(","):[0,0,0],i.style.color="",{r:parseInt(a[0]),g:parseInt(a[1]),b:parseInt(a[2])}}}function K(t,e,n){var i,a={};for(i in e)a[i]="a"!==i?r(t[i],e[i],n)>>0||0:t[i]&&e[i]?(100*r(t[i],e[i],n)>>0)/100:null;return a.a?"rgba("+a.r+","+a.g+","+a.b+","+a.a+")":"rgb("+a.r+","+a.g+","+a.b+")"}function q(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=K(n,r,i)})}x.BoxModelEssential=X;var Y=["color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],Z={};Y.forEach((function(t){Z[t]="#000"}));var $={};Y.map((function(t){return $[t]=q}));var W={component:"colorProperties",category:"colors",properties:Y,defaultValues:Z,Interpolate:{numbers:r,colors:K},functions:{prepareStart:function(t,e){return A(this.element,t)||f[t]},prepareProperty:function(t,e){return B(e)},onStart:$},Util:{trueColor:B}};x.ColorProperties=W;var G={},J=["fill","stroke","stop-color"];function tt(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var et={prepareStart:function(t,e){var n={};for(var r in e){var i=tt(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=J.includes(i)?a||"rgba(0,0,0,0)":a||(/opacity/i.test(r)?1:0)}return n},prepareProperty:function(t,e){var n={};for(var i in e){var s=tt(i),o=/(%|[a-z]+)$/,u=this.element.getAttribute(s.replace(/_+[a-z]+/,""));if(J.includes(s))a.htmlAttributes[s]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in G)&&(G[e]=function(t,e,n,r,i){t.setAttribute(e,K(n,r,i))})},n[s]=B(e[i])||f.htmlAttributes[i];else if(null!==u&&o.test(u)){var l=V(u).u||V(e[i]).u,c=/%/.test(l)?"_percent":"_"+l;a.htmlAttributes[s+c]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in G)&&(G[e]=function(t,e,n,i,a){var s=e.replace(c,"");t.setAttribute(s,(1e3*r(n.v,i.v,a)>>0)/1e3+i.u)})},n[s+c]=V(e[i])}else o.test(e[i])&&null!==u&&(null===u||o.test(u))||(a.htmlAttributes[s]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in G)&&(G[e]=function(t,e,n,i,a){t.setAttribute(e,(1e3*r(n,i,a)>>0)/1e3)})},n[s]=parseFloat(e[i]))}return n},onStart:{attr:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(e,n,r,i){for(var a in r)t.attributes[a](e,a,n[a],r[a],i)})},attributes:function(e){!t[e]&&this.valuesEnd.attr&&(t[e]=G)}}},nt={component:"htmlAttributes",property:"attr",subProperties:["fill","stroke","stop-color","fill-opacity","stroke-opacity"],defaultValue:{fill:"rgb(0,0,0)",stroke:"rgb(0,0,0)","stop-color":"rgb(0,0,0)",opacity:1,"stroke-opacity":1,"fill-opacity":1},Interpolate:{numbers:r,colors:K},functions:et,Util:{replaceUppercase:tt,trueColor:B,trueDimension:V}};x.HTMLAttributes=nt;var rt={prepareStart:function(t){return A(this.element,t)},prepareProperty:function(t,e){return parseFloat(e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,n,i,a){t.style[e]=(1e3*r(n,i,a)>>0)/1e3})}},it={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:r},functions:rt};x.OpacityProperty=it;var at=String("abcdefghijklmnopqrstuvwxyz").split(""),st=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),ot=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),ut=String("0123456789").split(""),lt=at.concat(st,ut),ct=lt.concat(ot),pt={alpha:at,upper:st,symbols:ot,numeric:ut,alphanumeric:lt,all:ct},ht={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in pt?pt[n]:n&&n.length?n:pt[v.textChars];t[e]=function(t,e,n,i){var a="",s="",o=e.substring(0),u=n.substring(0),l=r[Math.random()*r.length>>0];" "===e?(s=u.substring(Math.min(i*u.length,u.length)>>0,0),t.innerHTML=i<1?s+l:""===n?" ":n):" "===n?(a=o.substring(0,Math.min((1-i)*o.length,o.length)>>0),t.innerHTML=i<1?a+l:""===n?" ":n):(a=o.substring(o.length,Math.min(i*o.length,o.length)>>0),s=u.substring(0,Math.min(i*u.length,u.length)>>0),t.innerHTML=i<1?s+l+a:""===n?" ":n)}}},number:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,i){t.innerHTML=r(e,n,i)>>0})}};function ft(t,e){var n,r;if("string"==typeof t)return(r=document.createElement("SPAN")).innerHTML=t,r.className=e,r;if(!t.children.length||t.children.length&&t.children[0].className!==e){var i=t.innerHTML;(n=document.createElement("SPAN")).className=e,n.innerHTML=i,t.appendChild(n),t.innerHTML=n.outerHTML}else t.children.length&&t.children[0].className===e&&(n=t.children[0]);return n}function vt(t,e){var n=[];if(t.children.length){for(var r,i=[],a=t.innerHTML,s=0,o=t.children.length,u=void 0,l=void 0,c=void 0;s<o;s++)l=(u=t.children[s]).outerHTML,""!==(r=a.split(l))[0]?(c=ft(r[0],e),i.push(c),a=a.replace(r[0],"")):""!==r[1]&&(c=ft(r[1].split("<")[0],e),i.push(c),a=a.replace(r[0].split("<")[0],"")),!u.classList.contains(e)&&u.classList.add(e),i.push(u),a=a.replace(l,"");if(""!==a){var p=ft(a,e);i.push(p)}n=n.concat(i)}else n=n.concat([ft(t,e)]);return n}var dt={component:"textWriteProperties",category:"textWrite",properties:["text","number"],defaultValues:{text:" ",numbers:"0"},defaultOptions:{textChars:"alpha"},Interpolate:{numbers:r},functions:{prepareStart:function(t,e){return this.element.innerHTML},prepareProperty:function(t,e){return"number"===t?parseFloat(e):""===e?" ":e},onStart:ht},Util:{charSet:pt,createTextTweens:function(t,e,n){if(!t.playing){(n=n||{}).duration="auto"===n.duration?"auto":isFinite(1*n.duration)?1*n.duration:1e3;var r=function(t,e){var n=vt(t,"text-part"),r=vt(ft(e),"text-part");return t.innerHTML="",t.innerHTML+=n.map((function(t){return t.className+=" oldText",t.outerHTML})).join(""),t.innerHTML+=r.map((function(t){return t.className+=" newText",t.outerHTML.replace(t.innerHTML,"")})).join(""),[n,r]}(t,e),i=r[0],a=r[1],s=[].slice.call(t.getElementsByClassName("oldText")).reverse(),o=[].slice.call(t.getElementsByClassName("newText")),u=[],l=0;return(u=(u=u.concat(s.map((function(t,e){return n.duration="auto"===n.duration?75*i[e].innerHTML.length:n.duration,n.delay=l,n.onComplete=null,l+=n.duration,new P.tween(t,{text:t.innerHTML},{text:""},n)})))).concat(o.map((function(r,i){return n.duration="auto"===n.duration?75*a[i].innerHTML.length:n.duration,n.delay=l,n.onComplete=i===a.length-1?function(){t.innerHTML=e,t.playing=!1}:null,l+=n.duration,new P.tween(r,{text:""},{text:a[i].innerHTML},n)})))).start=function(){!t.playing&&u.map((function(t){return t.start()}))&&(t.playing=!0)},u}}}};function gt(t,e,n,r){return"perspective("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"}function mt(t,e,n,r){for(var i=[],a=0;a<3;a++)i[a]=(t[a]||e[a]?(1e3*(t[a]+(e[a]-t[a])*r)>>0)/1e3:0)+n;return"translate3d("+i.join(",")+")"}function yt(t,e,n,r){var i="";return i+=t[0]||e[0]?"rotateX("+(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3+n+")":"",i+=t[1]||e[1]?"rotateY("+(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3+n+")":"",i+=t[2]||e[2]?"rotateZ("+(1e3*(t[2]+(e[2]-t[2])*r)>>0)/1e3+n+")":""}function wt(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","translate("+i.join(",")+")"}function bt(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"}function _t(t,e,n,r){var i=[];return i[0]=(t[0]===e[0]?e[0]:(1e3*(t[0]+(e[0]-t[0])*r)>>0)/1e3)+n,i[1]=t[1]||e[1]?(t[1]===e[1]?e[1]:(1e3*(t[1]+(e[1]-t[1])*r)>>0)/1e3)+n:"0","skew("+i.join(",")+")"}function xt(t,e,n){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}x.TextWriteProperties=dt;var St={component:"transformFunctions",property:"transform",subProperties:["perspective","translate3d","translateX","translateY","translateZ","translate","rotate3d","rotateX","rotateY","rotateZ","rotate","skewX","skewY","skew","scale"],defaultValues:{perspective:400,translate3d:[0,0,0],translateX:0,translateY:0,translateZ:0,translate:[0,0],rotate3d:[0,0,0],rotateX:0,rotateY:0,rotateZ:0,rotate:0,skewX:0,skewY:0,skew:[0,0],scale:1},functions:{prepareStart:function(t,e){var n=I(this.element);return n[t]?n[t]:f[t]},prepareProperty:function(t,e){var n=["X","Y","Z"],r=[],i=[],a=[],s={},o=["translate3d","translate","rotate3d","skew"];for(var u in e)if(o.includes(u)){var l="object"==typeof e[u]?e[u].map((function(t){return parseInt(t)})):[parseInt(e[u]),0];s[u]="skew"===u||"translate"===u?[l[0]||0,l[1]||0]:[l[0]||0,l[1]||0,l[2]||0]}else if(/[XYZ]/.test(u)){for(var c=u.replace(/[XYZ]/,""),p="skew"===c?c:c+"3d",h="translate"===c?r:"rotate"===c?i:"skew"===c?a:{},f=0;f<3;f++){var v=n[f];h[f]=""+c+v in e?parseInt(e[""+c+v]):0}s[p]=h}else s[u]="scale"===u?parseFloat(e[u]):parseInt(e[u]);return s},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,n,r,i){t.style[e]=(n.perspective||r.perspective?gt(n.perspective,r.perspective,"px",i):"")+(n.translate3d?mt(n.translate3d,r.translate3d,"px",i):"")+(n.translate?wt(n.translate,r.translate,"px",i):"")+(n.rotate3d?yt(n.rotate3d,r.rotate3d,"deg",i):"")+(n.rotate||r.rotate?bt(n.rotate,r.rotate,"deg",i):"")+(n.skew?_t(n.skew,r.skew,"deg",i):"")+(n.scale||r.scale?xt(n.scale,r.scale,i):"")})},crossCheck:function(t){this.valuesEnd[t]&&this.valuesEnd[t]&&this.valuesEnd[t].perspective&&!this.valuesStart[t].perspective&&(this.valuesStart[t].perspective=this.valuesEnd[t].perspective)}},Interpolate:{perspective:gt,translate3d:mt,rotate3d:yt,translate:wt,rotate:bt,scale:xt,skew:_t}};function Tt(t,e){return parseFloat(t)/100*e}function Et(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function Ct(t){var e=t.getAttribute("points").split(" "),n=0;if(e.length>1){var r=function(t){var e=t.split(",");if(2==e.length&&!isNaN(e[0])&&!isNaN(e[1]))return[parseFloat(e[0]),parseFloat(e[1])]},i=function(t,e){return null!=t&&null!=e?Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)):0};if(e.length>2)for(var a=0;a<e.length-1;a++)n+=i(r(e[a]),r(e[a+1]));n+="polygon"===t.tagName?i(r(e[0]),r(e[e.length-1])):0}return n}function It(t){var e=t.getAttribute("x1"),n=t.getAttribute("x2"),r=t.getAttribute("y1"),i=t.getAttribute("y2");return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-r,2))}function At(t){var e=t.getAttribute("r");return 2*Math.PI*e}function Mt(t){var e=2*t.getAttribute("rx"),n=2*t.getAttribute("ry");return Math.sqrt(.5*(e*e+n*n))*(2*Math.PI)/2}function kt(t){return/rect/.test(t.tagName)?Et(t):/circle/.test(t.tagName)?At(t):/ellipse/.test(t.tagName)?Mt(t):/polygon|polyline/.test(t.tagName)?Ct(t):/line/.test(t.tagName)?It(t):void 0}function Ot(t,e){var n,r,i,a,s=/path|glyph/.test(t.tagName)?t.getTotalLength():kt(t);return e instanceof Object?e:("string"==typeof e?(e=e.split(/\,|\s/),n=/%/.test(e[0])?Tt(e[0].trim(),s):parseFloat(e[0]),r=/%/.test(e[1])?Tt(e[1].trim(),s):parseFloat(e[1])):void 0===e&&(a=parseFloat(A(t,"stroke-dashoffset")),i=A(t,"stroke-dasharray").split(/\,/),n=0-a,r=parseFloat(i[0])+n||s),{s:n,e:r,l:s})}x.TransformFunctions=St;var Lt={prepareStart:function(){return Ot(this.element)},prepareProperty:function(t,e){return Ot(this.element,e)},onStart:function(e){e in this.valuesEnd&&!t[e]&&(t[e]=function(t,e,n,i){var a=(100*e.l>>0)/100,s=0-(100*r(e.s,n.s,i)>>0)/100,o=(100*r(e.e,n.e,i)>>0)/100+s;t.style.strokeDashoffset=s+"px",t.style.strokeDasharray=(100*(o<1?0:o)>>0)/100+"px, "+a+"px"})}},Pt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:r},functions:Lt,Util:{getRectLength:Et,getPolyLength:Ct,getLineLength:It,getCircleLength:At,getEllipseLength:Mt,getTotalLength:kt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:Ot,percent:Tt}};function jt(t,e,n,r){for(var i=[],a=0;a<n;a++){i[a]=[];for(var s=0;s<2;s++)i[a].push((1e3*(t[a][s]+(e[a][s]-t[a][s])*r)>>0)/1e3)}return i}x.SVGDraw=Pt;var Ut="Invalid path value";function Ft(t){return"number"==typeof t&&isFinite(t)}function Nt(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function Ht(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}function Dt(t,e){return Nt(t,e)<1e-9}var Vt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},zt=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function Qt(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&zt.indexOf(t)>=0}function Rt(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}function Xt(t){return 97==(32|t)}function Bt(t){return t>=48&&t<=57}function Kt(t){return t>=48&&t<=57||43===t||45===t||46===t}function qt(t){this.index=0,this.path=t,this.max=t.length,this.result=[],this.param=0,this.err="",this.segmentStart=0,this.data=[]}function Yt(t){for(;t.index<t.max&&Qt(t.path.charCodeAt(t.index));)t.index++}function Zt(t){var e=t.path.charCodeAt(t.index);return 48===e?(t.param=0,void t.index++):49===e?(t.param=1,void t.index++):void(t.err="KUTE.js - "+Ut)}function $t(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err="KUTE.js - "+Ut;else if(43!==(e=t.path.charCodeAt(r))&&45!==e||(e=++r<i?t.path.charCodeAt(r):0),Bt(e)||46===e){if(46!==e){if(a=48===e,e=++r<i?t.path.charCodeAt(r):0,a&&r<i&&e&&Bt(e))return void(t.err="KUTE.js - "+Ut);for(;r<i&&Bt(t.path.charCodeAt(r));)r++,s=!0;e=r<i?t.path.charCodeAt(r):0}if(46===e){for(u=!0,r++;Bt(t.path.charCodeAt(r));)r++,o=!0;e=r<i?t.path.charCodeAt(r):0}if(101===e||69===e){if(u&&!s&&!o)return void(t.err="KUTE.js - "+Ut);if(43!==(e=++r<i?t.path.charCodeAt(r):0)&&45!==e||r++,!(r<i&&Bt(t.path.charCodeAt(r))))return void(t.err="KUTE.js - "+Ut);for(;r<i&&Bt(t.path.charCodeAt(r));)r++}t.index=r,t.param=parseFloat(t.path.slice(n,r))+0}else t.err="KUTE.js - "+Ut}function Wt(t){var e,n;n=(e=t.path[t.segmentStart]).toLowerCase();var r=t.data;if("m"===n&&r.length>2&&(t.result.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.result.push([e].concat(r));else for(;r.length>=Vt[n]&&(t.result.push([e].concat(r.splice(0,Vt[n]))),Vt[n]););}function Gt(t){var e,n,r,i,a,s=t.max;if(t.segmentStart=t.index,n=Xt(e=t.path.charCodeAt(t.index)),Rt(e))if(i=Vt[t.path[t.index].toLowerCase()],t.index++,Yt(t),t.data=[],i){for(r=!1;;){for(a=i;a>0;a--){if(!n||3!==a&&4!==a?$t(t):Zt(t),t.err.length)return;t.data.push(t.param),Yt(t),r=!1,t.index<s&&44===t.path.charCodeAt(t.index)&&(t.index++,Yt(t),r=!0)}if(!r){if(t.index>=t.max)break;if(!Kt(t.path.charCodeAt(t.index)))break}}Wt(t)}else Wt(t);else t.err="KUTE.js - "+Ut}function Jt(t){var e=new qt(t),n=e.max;for(Yt(e);e.index<n&&!e.err.length;)Gt(e);return e.err.length?e.result=[]:e.result.length&&("mM".indexOf(e.result[0][0])<0?(e.err="KUTE.js - "+Ut,e.result=[]):e.result[0][0]="M"),{err:e.err,segments:e.result}}var te=function t(e){if(!(this instanceof t))return new t(e);var n=Jt(e);this.segments=n.segments,this.err=n.err};function ee(t){return t.toString().split("M").map((function(t,e){return t=t.trim(),e&&t?"M"+t:t})).filter((function(t){return t}))}function ne(t,e){var n=new te(t).abs();return re(n)||ie(n,e)}function re(t){var e=t.segments||[],n=[];if(!e.length||"M"!==e[0][0])return!1;for(var r=0;r<e.length;r++){var i=e[r],a=i[0],s=i[1],o=i[2];if("M"===a&&r||"Z"===a)break;if("M"===a||"L"===a)n.push([s,o]);else if("H"===a)n.push([s,n[n.length-1][1]]);else{if("V"!==a)return!1;n.push([n[n.length-1][0],s])}}return!!n.length&&{ring:n}}function ie(t,e){var n,r,i=ee(t)[0],a=[],s=3;if(!i)throw new TypeError(Ut);n=(r=ae(i)).getTotalLength(),e&&Ft(e)&&e>0&&(s=Math.max(s,Math.ceil(n/e)));for(var o=0;o<s;o++){var u=r.getPointAtLength(n*o/s);a.push([u.x,u.y])}return{ring:a,skipBisect:!0}}function ae(t){try{var e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttributeNS(null,"d",t),e}catch(t){}return!1}function se(t,e){for(var n,r,i,a=t.length,s=1/0,o=function(i){r=0,e.forEach((function(e,n){var s=Nt(t[(i+n)%a],e);r+=s*s})),r<s&&(s=r,n=i)},u=0;u<a;u++)o(u);n&&(i=t.splice(0,n),t.splice.apply(t,[t.length,0].concat(i)))}function oe(t){for(var e,n,r=-1,i=t.length,a=t[i-1],s=a[0],o=a[1],u=0;++r<i;)e=s,n=o,e-=s=(a=t[r])[0],n-=o=a[1],u+=Math.sqrt(e*e+n*n);return u}function ue(t){for(var e,n=-1,r=t.length,i=t[r-1],a=0;++n<r;)e=i,i=t[n],a+=e[1]*i[0]-e[0]*i[1];return a/2}function le(t,e){for(var n=t.length+e,r=oe(t)/e,i=0,a=0,s=r/2;t.length<n;){var o=t[i],u=t[(i+1)%t.length],l=Nt(o,u);s<=a+l?(t.splice(i+1,0,l?Ht(o,u,(s-a)/l):o.slice(0)),s+=r):(a+=l,i++)}}function ce(t,e){void 0===e&&(e=1/0);for(var n=0;n<t.length;n++)for(var r=t[n],i=n===t.length-1?t[0]:t[n+1];Nt(r,i)>e;)i=Ht(r,i,.5),t.splice(n+1,0,i)}function pe(t,e){var n,r;if("string"==typeof t){var i=ne(t,e);t=i.ring,r=i.skipBisect}else if(!Array.isArray(t))throw new TypeError(Ut);if(!he(n=t.slice(0)))throw new TypeError(Ut);return n.length>1&&Dt(n[0],n[n.length-1])&&n.pop(),ue(n)>0&&n.reverse(),!r&&e&&Ft(e)&&e>0&&ce(n,e),n}function he(t){return t.every((function(t){return Array.isArray(t)&&t.length>=2&&Ft(t[0])&&Ft(t[1])}))}function fe(t,e,n){var r=pe(t,n=n||v.morphPrecision),i=pe(e,n),a=r.length-i.length;return le(r,a<0?-1*a:0),le(i,a>0?a:0),se(r,i),[r,i]}te.prototype.iterate=function(t){var e,n=this.segments,r={},i=!1,a=0,s=0,o=0,u=0;return n.map((function(e,n){var l=t(e,n,a,s);Array.isArray(l)&&(r[n]=l,i=!0);var c=e[0]===e[0].toLowerCase();switch(e[0]){case"m":case"M":return a=e[1]+(c?a:0),s=e[2]+(c?s:0),o=a,void(u=s);case"h":case"H":return void(a=e[1]+(c?a:0));case"v":case"V":return void(s=e[1]+(c?s:0));case"z":case"Z":return a=o,void(s=u);default:a=e[e.length-2]+(c?a:0),s=e[e.length-1]+(c?s:0)}})),i?(e=[],n.map((function(t,n){void 0!==r[n]?r[n].map((function(t){e.push(t)})):e.push(t)})),this.segments=e,this):this},te.prototype.abs=function(){return this.iterate((function(t,e,n,r){var i,a=t[0],s=a.toUpperCase();if(a!==s)switch(t[0]=s,a){case"v":return void(t[1]+=r);case"a":return t[6]+=n,void(t[7]+=r);default:for(i=1;i<t.length;i++)t[i]+=i%2?n:r}}),!0),this},te.prototype.toString=function(){var t,e,n=this,r=[];return this.segments.map((function(i,a){e=i[0],t=a>0&&"m"!==e&&"M"!==e&&e===n.segments[a-1][0],r=r.concat(t?i.slice(1):i)})),r.join(" ").replace(/ ?([achlmqrstvz]) ?/gi,"$1").replace(/ \-/g,"-").replace(/zm/g,"z m")};var ve={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof Element?e:/^\.|^\#/.test(e)?U(e):null,i=new RegExp("\\n","ig");return"object"==typeof e&&e.pathArray?e:(r&&/path|glyph/.test(r.tagName)?n.original=r.getAttribute("d").replace(i,""):!r&&/[a-z][^a-z]*/gi.test(e)&&(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i,a=e.pathArray,s=n.pathArray,o=s.length;i=1===r?n.original:"M"+jt(a,s,o,r).join("L")+"Z",t.setAttribute("d",i)})},crossCheck:function(t){if(this.valuesEnd[t]){var e=this.valuesStart[t].pathArray,n=this.valuesEnd[t].pathArray;if(!e||!n||e&&n&&e.length!==n.length){var r=fe(this.valuesStart[t].original,this.valuesEnd[t].original,this._morphPrecision?parseInt(this._morphPrecision):v.morphPrecision);this.valuesStart[t].pathArray=r[0],this.valuesEnd[t].pathArray=r[1]}}}},de={component:"svgMorph",property:"path",defaultValue:[],Interpolate:jt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:ve,Util:{INVALID_INPUT:Ut,isFiniteNumber:Ft,distance:Nt,pointAlong:Ht,samePoint:Dt,paramCounts:Vt,SPECIAL_SPACES:zt,isSpace:Qt,isCommand:Rt,isArc:Xt,isDigit:Bt,isDigitStart:Kt,State:qt,skipSpaces:Yt,scanFlag:Zt,scanParam:$t,finalizeSegment:Wt,scanSegment:Gt,pathParse:Jt,SvgPath:te,split:ee,pathStringToRing:ne,exactRing:re,approximateRing:ie,measure:ae,rotateRing:se,polygonLength:oe,polygonArea:ue,addPoints:le,bisect:ce,normalizeRing:pe,validRing:he,getInterpolationPoints:fe}};for(var ge in x.SVGMorph=de,x){var me=x[ge];x[ge]=new D(me)}var ye={Animation:D,Components:x,Tween:N,fromTo:function(t,e,n,r){return r=r||{},new P.tween(U(t),e,n,r)},to:function(t,e,n){return(n=n||{}).resetStart=e,new P.tween(U(t),e,e,n)},TweenCollection:H,allFromTo:function(t,e,n,r){return r=r||{},new H(U(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new H(U(t,!0),e,e,n)},Objects:b,Util:_,Easing:j,CubicBezier:L,Render:c,Interpolate:i,Process:O,Internals:C,Selector:U,Version:"2.0.6"};export default ye;