kute.js/dist/kute.esm.min.js
thednp 0b7fd91bab Changes, lots of them:
* Updated SVGPathCommander to make use of the new features, the SVG morph components can now process paths in Node.js
* svgCubicMorph component now can morph lines properly, as shown in the updated demo
* svgMorph component also updated
* documentation updates for more clarity with the morph components
2020-09-23 18:59:39 +00:00

3 lines
38 KiB
JavaScript

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