kute.js/demo/src/kute.min.js
thednp bfc3fabc92 Changes:
* updated SVGPathCommander
* fixed small typo issue with SVGDraw
* version bump
2021-01-09 13:31:00 +00:00

3 lines
38 KiB
JavaScript

// KUTE.js Standard v2.1.0 | thednp © 2021 | MIT-License
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).KUTE=e()}(this,(function(){"use strict";var t={},e=[],n="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r={},i={},a={};a.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,i)if("function"==typeof i[n])t[n]&&delete t[n];else for(var a in i[n])t[a]&&delete t[a];for(var o in r)t[o]&&delete t[o]}}),64)}var l={Tick:s,Ticker:o,Tweens:e,Time:a};for(var c in l)t[c]||(t[c]="Time"===c?a.now:l[c]);n._KUTE=t;var p={},h={},f={duration:700,delay:0,easing:"linear"},d={},v={},g={},y={},m={},x={supportedProperties:p,defaultValues:h,defaultOptions:f,prepareProperty:d,prepareStart:v,crossCheck:g,onStart:i,onComplete:y,linkProperty:m},b={},w={};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],i=p[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 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("("),i=e[0],a=e[1];/matrix/.test(i)||(n[i]=r.includes(i)?a.split(","):a)}))})),n}}function I(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||h[e]}function A(t,e){var n="start"===e?this.valuesStart:this.valuesEnd;for(var r in d){var i=d[r],a=p[r];for(var s in i){var o={};for(var u in t)h[u]&&i[u]?n[u]=i[u].call(this,u,t[u]):!h[s]&&"transform"===s&&a.includes(u)?o[u]=t[u]:h[u]||"transform"!==u?!h[s]&&a&&a.includes(u)&&(n[u]=i[s].call(this,u,t[u])):n[u]=t[u];Object.keys&&Object.keys(o).length&&(n[s]=i[s].call(this,s,o))}}}function E(){var t={},e=S(this.element);for(var n in this.valuesStart)for(var r in v){var i=v[r];for(var a in i)(a===n&&i[n]||p[r]&&p[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]||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,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};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,i,a,s,o=1e-5;for(r=t,s=0;s<32;s++){if(i=this.sampleCurveX(r)-t,Math.abs(i)<o)return r;if(a=this.sampleCurveDerivativeX(r),Math.abs(a)<o)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)<o)return r;t>i?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 i)if("function"==typeof i[t])i[t].call(this,t);else for(var e in i[t])i[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,a){for(var s in this.element=e,this.playing=!1,this._startTime=null,this._startFired=!1,this.valuesEnd=r,this.valuesStart=n,a=a||{},this._resetStart=a.resetStart||0,this._easing="function"==typeof a.easing?a.easing:L.processEasing(a.easing),this._duration=a.duration||f.duration,this._delay=a.delay||f.delay,a){var o="_"+s;o in this||(this[o]=a[s])}var u=this._easing.name;return i[u]||(i[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 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)},L.tween=N,f.repeat=0,f.repeatDelay=0,f.yoyo=!1,f.resetStart=!1;var j=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(A.call(this,i,"end"),this._resetStart?this.valuesStart=r:A.call(this,r,"start"),!this._resetStart)for(var a in g)for(var s in g[a])g[a][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 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),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 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}(N);L.tween=j;var H=function(t,e,n,r){var i=this;this.tweens=[],!("offset"in f)&&(f.offset=0),(r=r||{}).delay=r.delay||f.delay;var a=[];return Array.from(t).map((function(t,s){a[s]=r||{},a[s].delay=s>0?r.delay+(r.offset||f.offset):r.delay,t instanceof Element?i.tweens.push(new L.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 L.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 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,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 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,i){t.style[e]=(i>.99||i<.01?(10*Q(n,r,i)>>0)/10:Q(n,r,i)>>0)+"px"})}F.prototype.setComponent=function(t){var e=this,n=t.component,a={prepareProperty:d,prepareStart:v,onStart:i,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 a)if(x in t.functions)if("function"==typeof t.functions[x])!a[x][n]&&(a[x][n]={}),!a[x][n][s||o]&&(a[x][n][s||o]=t.functions[x]);else for(var w in t.functions[x])!a[x][n]&&(a[x][n]={}),!a[x][n][w]&&(a[x][n][w]=t.functions[x][w]);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)!b[T]&&(b[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 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 z(t,e,n){var r,i={},a=",";for(r in e)i[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 i.a?"rgba("+i.r+a+i.g+a+i.b+a+i.a+")":"rgb("+i.r+a+i.g+a+i.b+")"}function Y(e){this.valuesEnd[e]&&!t[e]&&(t[e]=function(t,n,r,i){t.style[e]=z(n,r,i)})}w.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}};w.ColorProperties=G;var J={},tt="htmlAttributes",et=["fill","stroke","stop-color"];function nt(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()}var rt={prepareStart:function(t,e){var n={};for(var r in e){var i=nt(r).replace(/_+[a-z]+/,""),a=this.element.getAttribute(i);n[i]=et.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 r in e){var a=nt(r),s=/(%|[a-z]+)$/,o=this.element.getAttribute(a.replace(/_+[a-z]+/,""));if(et.includes(a))i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,z(n,r,i))})},n[a]=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;i.htmlAttributes[a+l]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){var a=e.replace(l,"");t.setAttribute(a,(1e3*Q(n.v,r.v,i)>>0)/1e3+r.u)})},n[a+l]=U(e[r])}else s.test(e[r])&&null!==o&&(null===o||s.test(o))||(i.htmlAttributes[a]=function(e){this.valuesEnd[t]&&this.valuesEnd[t][e]&&!(e in J)&&(J[e]=function(t,e,n,r,i){t.setAttribute(e,(1e3*Q(n,r,i)>>0)/1e3)})},n[a]=parseFloat(e[r]))}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]=J)}}},it={component:tt,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:rt,Util:{replaceUppercase:nt,trueColor:Z,trueDimension:U}};w.HTMLAttributes=it;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,i){t.style[e]=(1e3*Q(n,r,i)>>0)/1e3})}},st={component:"opacityProperty",property:"opacity",defaultValue:1,Interpolate:{numbers:Q},functions:at};w.OpacityProperty=st;var ot=String("abcdefghijklmnopqrstuvwxyz").split(""),ut=String("abcdefghijklmnopqrstuvwxyz").toUpperCase().split(""),lt=String("~!@#$%^&*()_+{}[];'<>,./?=-").split(""),ct=String("0123456789").split(""),pt=ot.concat(ut,ct),ht=pt.concat(lt),ft={alpha:ot,upper:ut,symbols:lt,numeric:ct,alphanumeric:pt,all:ht},dt={text:function(e){if(!t[e]&&this.valuesEnd[e]){var n=this._textChars,r=n in ft?ft[n]:n&&n.length?n:ft[f.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,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 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 gt(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=vt(r[0],e),i.push(c),a=a.replace(r[0],"")):""!==r[1]&&(c=vt(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=vt(a,e);i.push(p)}n=n.concat(i)}else n=n.concat([vt(t,e)]);return n}var yt={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:dt},Util:{charSet:ft,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=gt(t,"text-part"),r=gt(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),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 L.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 L.tween(r,{text:""},{text:a[i].innerHTML},n)})))).start=function(){!t.playing&&u.map((function(t){return t.start()}))&&(t.playing=!0)},u}}}};function mt(t,e,n,r){return"perspective("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"}function xt(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 bt(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){return"scale("+(1e3*(t+(e-t)*n)>>0)/1e3+")"}function Mt(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(",")+")"}w.TextWriteProperties=yt;var _t={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={},i=[],a=[],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?i:"rotate"===c?a:"skew"===c?s:{},d=0;d<h;d++){var v=n[d];f[d]=""+c+v in e?parseInt(e[""+c+v]):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,i){t.style[e]=(n.perspective||r.perspective?mt(n.perspective,r.perspective,"px",i):"")+(n.translate3d?xt(n.translate3d,r.translate3d,"px",i):"")+(n.rotate3d?bt(n.rotate3d,r.rotate3d,"deg",i):"")+(n.skew?Mt(n.skew,r.skew,"deg",i):"")+(n.scale||r.scale?wt(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:mt,translate3d:xt,rotate3d:bt,translate:function(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(",")+")"},rotate:function(t,e,n,r){return"rotate("+(1e3*(t+(e-t)*r)>>0)/1e3+n+")"},scale:wt,skew:Mt}};function Ct(t,e){return parseFloat(t)/100*e}function Tt(t){return 2*t.getAttribute("width")+2*t.getAttribute("height")}function St(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 Et(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"===t.tagName?Tt(t):"circle"===t.tagName?At(t):"ellipse"===t.tagName?Et(t):["polygon","polyline"].indexOf(t.tagName)>-1?St(t):"line"===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])?Ct(e[0].trim(),s):parseFloat(e[0]),r=/%/.test(e[1])?Ct(e[1].trim(),s):parseFloat(e[1])):void 0===e&&(a=parseFloat(I(t,"stroke-dashoffset")),i=I(t,"stroke-dasharray").split(/\,/),n=0-a,r=parseFloat(i[0])+n||s),{s:n,e:r,l:s})}w.TransformFunctions=_t;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,r){var i=(100*e.l>>0)/100,a=0-(100*Q(e.s,n.s,r)>>0)/100,s=(100*Q(e.e,n.e,r)>>0)/100+a;t.style.strokeDashoffset=a+"px",t.style.strokeDasharray=(100*(s<1?0:s)>>0)/100+"px, "+i+"px"})}},Pt={component:"svgDraw",property:"draw",defaultValue:"0% 0%",Interpolate:{numbers:Q},functions:Lt,Util:{getRectLength:Tt,getPolyLength:St,getLineLength:It,getCircleLength:At,getEllipseLength:Et,getTotalLength:kt,resetDraw:function(t){t.style.strokeDashoffset="",t.style.strokeDasharray=""},getDraw:Ot,percent:Ct}};function Vt(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}w.SVGDraw=Pt;var qt=3;function Nt(t){return t.map((function(t){return Array.isArray(t)?Nt(t):isNaN(+t)?t:+t}))}function jt(t,e){var n=isNaN(+e)?qt:+e;return n?t.map((function(t){return t.map((function(t,e){var r=+t,i=Math.pow(10,n);return r?r%1==0?r:Math.round(r*i)/i:t}))})):Nt(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 Ft={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Ut(t){return Array.isArray(t)&&t.every((function(t){var e=t[0].toLowerCase();return Ft[e]===t.length-1&&/[achlmrqstvz]/g.test(e)}))}function Qt(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>=Ft[n]&&(t.segments.push([e].concat(r.splice(0,Ft[n]))),Ft[n]););}var Dt="Invalid path value";function Rt(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=Dt+": invalid Arc flag "+e)}function Xt(t){return t>=48&&t<=57}function Bt(t){var e,n=t.index,r=n,i=t.max,a=!1,s=!1,o=!1,u=!1;if(r>=i)t.err=Dt+": missing param "+t.pathValue[r];else if(43!==(e=t.pathValue.charCodeAt(r))&&45!==e||(e=++r<i?t.pathValue.charCodeAt(r):0),Xt(e)||46===e){if(46!==e){if(a=48===e,e=++r<i?t.pathValue.charCodeAt(r):0,a&&r<i&&e&&Xt(e))return void(t.err=Dt+": "+t.pathValue[n]+" illegal number");for(;r<i&&Xt(t.pathValue.charCodeAt(r));)r++,s=!0;e=r<i?t.pathValue.charCodeAt(r):0}if(46===e){for(u=!0,r++;Xt(t.pathValue.charCodeAt(r));)r++,o=!0;e=r<i?t.pathValue.charCodeAt(r):0}if(101===e||69===e){if(u&&!s&&!o)return void(t.err=Dt+": "+t.pathValue[r]+" invalid float exponent");if(43!==(e=++r<i?t.pathValue.charCodeAt(r):0)&&45!==e||r++,!(r<i&&Xt(t.pathValue.charCodeAt(r))))return void(t.err=Dt+": "+t.pathValue[r]+" invalid float exponent");for(;r<i&&Xt(t.pathValue.charCodeAt(r));)r++}t.index=r,t.param=+t.pathValue.slice(n,r)}else t.err=Dt+": "+t.pathValue[r]+" not number"}function Zt(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 Yt(t){var e,n,r,i,a=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=Ft[t.pathValue[t.index].toLowerCase()],t.index++,Zt(t),t.data=[],r){for(n=!1;;){for(i=r;i>0;i--){if(97!=(32|e)||3!==i&&4!==i?Bt(t):Rt(t),t.err.length)return;t.data.push(t.param),Zt(t),n=!1,t.index<a&&44===t.pathValue.charCodeAt(t.index)&&(t.index++,Zt(t),n=!0)}if(!n){if(t.index>=t.max)break;if(!zt(t.pathValue.charCodeAt(t.index)))break}}Qt(t)}else Qt(t);else t.err=Dt+": "+t.pathValue[t.index]+" not a path command"}function Kt(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 $t(t,e){if(Ut(n=t)&&n.every((function(t){return t[0]===t[0].toUpperCase()})))return Nt(t);var n;t=function(t,e){if(Ut(t))return Nt(t);var n=new Kt(t);for(Zt(n);n.index<n.max&&!n.err.length;)Yt(n);return n.err.length?n.segments=[]:n.segments.length&&("mM".indexOf(n.segments[0][0])<0?(n.err=Dt+": missing M/m",n.segments=[]):n.segments[0][0]="M"),jt(n.segments,e)}(t);var r=[],i=0,a=0,s=0,o=0,u=0,l=t.length,c="",p=[],h=0,f=[];"M"===t[0][0]&&(i=+t[0][1],a=+t[0][2],s=i,o=a,u++,r[0]=["M",i,a]);for(var d=u;d<l;d++){if(c=(p=t[d])[0],r.push(f=[]),c!==c.toUpperCase())switch(f[0]=c.toUpperCase(),f[0]){case"A":p.slice(1,-2).concat([+p[6]+i,+p[7]+a]).map((function(t){return f.push(t)}));break;case"V":f[1]=+p[1]+a;break;case"H":f[1]=+p[1]+i;break;case"M":s=+p[1]+i,o=+p[2]+a;default:p.map((function(t,e){return e&&f.push(+t+(e%2?i:a))}))}else p.map((function(t){return f.push(t)}));switch(h=f.length,f[0]){case"Z":i=s,a=o;break;case"H":i=+f[1];break;case"V":a=+f[1];break;case"M":s=+f[h-2],o=+f[h-1];default:i=+f[h-2],a=+f[h-1]}}return jt(r,e)}function Wt(t,e,n){var r,i;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 i=function(t,e,n,r,i){return"CS".indexOf(i)>-1?{x1:2*t-n,y1:2*e-r}:{x1:t,y1:e}}(e.x1,e.y1,e.x2,e.y2,n),e.x1=i.x1,e.y1=i.y1,["C",i.x1,i.y1].concat(t.slice(1));case"T":return r=function(t,e,n,r,i){return"QT".indexOf(i)>-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 Gt(t,e){if(function(t){return Array.isArray(t)&&t.every((function(t){var e=t[0].toLowerCase();return Ft[e]===t.length-1&&/[ACLMQZ]/.test(t[0])}))}(t))return Nt(t);for(var n,r,i={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},a=[],s="",o="",u=(t=$t(t)).length,l=0;l<u;l++)s=t[l][0],a[l]=s,l&&(o=a[l-1]),t[l]=Wt(t[l],i,o),r=(n=t[l]).length,i.x1=+n[r-2],i.y1=+n[r-1],i.x2=+n[r-4]||i.x1,i.y2=+n[r-3]||i.y1;return jt(t,e)}function Jt(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function te(t,e,n,r,i,a,s,o,u,l){var c,p,h,f,d,v=120*Math.PI/180,g=Math.PI/180*(i||0),y=[];if(l)p=l[0],h=l[1],f=l[2],d=l[3];else{t=(c=Jt(t,e,-g)).x,e=c.y;var m=(t-(o=(c=Jt(o,u,-g)).x))/2,x=(e-(u=c.y))/2,b=m*m/(n*n)+x*x/(r*r);b>1&&(n*=b=Math.sqrt(b),r*=b);var w=n*n,M=r*r,_=(a==s?-1:1)*Math.sqrt(Math.abs((w*M-w*x*x-M*m*m)/(w*x*x+M*m*m)));f=_*n*x/r+(t+o)/2,d=_*-r*m/n+(e+u)/2,p=Math.asin(((e-d)/r).toFixed(9)),h=Math.asin(((u-d)/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)>v){var T=h,S=o,I=u;h=p+v*(s&&h>p?1:-1),o=f+n*Math.cos(h),u=d+r*Math.sin(h),y=te(o,u,n,r,i,0,s,S,I,[h,T,f,d])}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],j=[o+P*O,u-V*k],H=[o,u];return N[0]=2*q[0]-N[0],N[1]=2*q[1]-N[1],l?[N,j,H].concat(y):(y=[N,j,H].concat(y).join().split(",")).map((function(t,e){return e%2?Jt(y[e-1],t,g).y:Jt(t,y[e+1],g).x}))}function ee(t,e,n,r,i,a){var s=1/3,o=2/3;return[s*t+o*n,s*e+o*r,s*i+o*n,s*a+o*r,i,a]}function ne(t,e,n,r,i,a,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*i+Math.pow(u,3)*s,y:Math.pow(l,3)*e+3*Math.pow(l,2)*u*r+3*l*u*u*a+Math.pow(u,3)*o}}function re(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}function ie(t,e,n,r){var i=.5,a=[t,e],s=[n,r],o=re(a,s,i),u=re(s,o,i),l=re(o,u,i),c=re(u,l,i),p=re(l,c,i),h=ne.apply(0,a.concat(o,l,p,i)),f=ne.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(te.apply(0,[e.x1,e.y1].concat(t.slice(1))));case"Q":return e.qx=t[1],e.qy=t[2],["C"].concat(ee.apply(0,[e.x1,e.y1].concat(t.slice(1))));case"L":return["C"].concat(ie(e.x1,e.y1,t[1],t[2]));case"Z":return["C"].concat(ie(e.x1,e.y1,e.x,e.y))}return t}function se(t,e){if(function(t){return Ut(t)&&t.slice(1).every((function(t){return"C"===t[0]}))}(t))return Nt(t);for(var n,r,i={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},a=[],s="",o=(t=Gt(t)).length,u=0;u<o;u++)t[u]&&(s=t[u][0]),a[u]=s,t[u]=ae(t[u],i),Ht(t,a,u),o=t.length,r=(n=t[u]).length,i.x1=+n[r-2],i.y1=+n[r-1],i.x2=+n[r-4]||i.x1,i.y2=+n[r-3]||i.y1;return jt(t,e)}function oe(t){return t.map((function(t){return t[0].concat(t.slice(1).join(" "))})).join("")}function ue(t,e,n,r,i){return i*(i*(-3*t+9*e-9*n+3*r)+6*t-12*e+6*n)-3*t+3*e}function le(t,e,n,r,i,a,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,d=[.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,v){p=ue(t,n,i,s,c=l*u+l),h=ue(e,r,a,o,c),f+=d[v]*Math.sqrt(p*p+h*h)})),l*f}function ce(t){var e=0;return se(t).map((function(t,n,r){e+="M"!==t[0]?le.apply(0,r[n-1].slice(-2).concat(t.slice(1))):0})),e}function pe(t,e){var n,r,i=0;return se(t).map((function(t,a,s){return r=a?s[a-1].slice(-2).concat(t.slice(1)):t.slice(1),n=a?le.apply(0,r):0,i+=n,0===a?{x:r[0],y:r[1]}:i>e&&e>i-n?ne.apply(0,r.concat(1-(i-e)/n)):null})).filter((function(t){return t})).slice(-1)[0]}function he(t,e,n,r,i,a,s,o){return 3*((o-e)*(n+i)-(s-t)*(r+a)+r*(t-i)-n*(e-a)+o*(i+t/3)-s*(a+e/3))/20}function fe(t){return function(t){var e=0,n=0,r=0,i=0,a=0;return se(t).map((function(t){var s;switch(t[0]){case"M":case"Z":return r="M"===t[0]?t[1]:r,i="M"===t[0]?t[2]:i,e=r,n=i,0;default:return a=he.apply(0,[e,n].concat(t.slice(1))),s=t.slice(-2),e=s[0],n=s[1],a}})).reduce((function(t,e){return t+e}),0)}(se(t))>=0}function de(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+de(t[r-1],n):0}),0)}function ge(t,e){var n=Gt(t,0);return function(t){var e=[],n=[],r="",i=t.length,a=0;if(!t.length||"M"!==t[0][0])return!1;for(var s=0;s<i&&!("M"===(r=(n=t[s])[0])&&s||"Z"===r);s++){if(!("ML".indexOf(r)>-1))return!1;e.push([n[1],n[2]])}return a=ve(e),!!i&&{ring:e,pathLength:a}}(n)||ye(n,e)}function ye(t,e){var n,r,i=se((r=oe(t),oe($t(r,0)).replace(/(m|M)/g,"|$1").split("|").map((function(t){return t.trim()})).filter((function(t){return t})))[0],4),a=ce(i),s=[],o=3;e&&!isNaN(e)&&+e>0&&(o=Math.max(o,Math.ceil(a/e)));for(var u=0;u<o;u++)n=pe(i,a*u/o),s.push([n.x,n.y]);return fe(i)||s.reverse(),{pathLength:a,ring:s,skipBisect:!0}}function me(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=de(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 xe(t,e){for(var n,r,i,a=t.length+e,s=ve(t)/e,o=0,u=0,l=s/2;t.length<a;)l<=u+(i=de(n=t[o],r=t[(o+1)%t.length]))?(t.splice(o+1,0,i?re(n,r,(l-u)/i):n.slice(0)),l+=s):(u+=i,o++)}function be(t,e){void 0===e&&(e=1/0);for(var n=[],r=[],i=0;i<t.length;i++)for(n=t[i],r=i===t.length-1?t[0]:t[i+1];de(n,r)>e;)r=re(n,r,.5),t.splice(i+1,0,r)}function we(t,e){var n,r,i;if("string"==typeof t){var a=ge(t,e);t=a.ring,r=a.skipBisect,i=a.pathLength}else if(!Array.isArray(t))throw Dt;if((n=t.slice(0)).pathLength=i,!Me(n))throw Dt;return n.length>1&&de(n[0],n[n.length-1])<1e-9&&n.pop(),!r&&e&&!isNaN(e)&&+e>0&&be(n,e),n}function Me(t){return Array.isArray(t)&&t.every((function(t){return Array.isArray(t)&&2===t.length&&!isNaN(t[0])&&!isNaN(t[1])}))}function _e(t,e,n){var r=we(t,n=n||f.morphPrecision),i=we(e,n),a=r.length-i.length;return xe(r,a<0?-1*a:0),xe(i,a>0?a:0),me(r,i),[jt(r),jt(i)]}var Ce={prepareStart:function(t){return this.element.getAttribute("d")},prepareProperty:function(t,e){var n={},r=e instanceof SVGElement?e:/^\.|^\#/.test(e)?V(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||"string"!=typeof e||(n.original=e.replace(i,"")),n)},onStart:function(e){!t[e]&&this.valuesEnd[e]&&(t[e]=function(t,e,n,r){var i=e.pathArray,a=n.pathArray,s=a.length;t.setAttribute("d",1===r?n.original:"M"+Vt(i,a,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=_e(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]}}}},Te={component:"svgMorph",property:"path",defaultValue:[],Interpolate:Vt,defaultOptions:{morphPrecision:10,morphIndex:0},functions:Ce,Util:{addPoints:xe,bisect:be,normalizeRing:we,validRing:Me,getInterpolationPoints:_e,pathStringToRing:ge,distanceSquareRoot:de,midPoint:re,approximateRing:ye,rotateRing:me,pathToString:oe,pathToCurve:se,getPathLength:ce,getPointAtLength:pe,getDrawDirection:fe,roundPath:jt}};for(var Se in w.SVGMorph=Te,w){var Ie=w[Se];w[Se]=new F(Ie)}return{Animation:F,Components:w,Tween:j,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:H,allFromTo:function(t,e,n,r){return r=r||{},new H(V(t,!0),e,n,r)},allTo:function(t,e,n){return(n=n||{}).resetStart=e,new H(V(t,!0),e,e,n)},Objects:x,Util:b,Easing:P,CubicBezier:O,Render:l,Interpolate:r,Process:k,Internals:T,Selector:V,Version:"2.1.0"}}));