-
Notifications
You must be signed in to change notification settings - Fork 0
/
MorphSVGPlugin.min.js
11 lines (9 loc) · 16.1 KB
/
MorphSVGPlugin.min.js
1
2
3
4
5
6
7
8
9
10
/*!
* MorphSVGPlugin 3.6.0
* https://greensock.com
*
* @license Copyright 2021, GreenSock. All rights reserved.
* Subject to the terms at https://greensock.com/standard-license or for Club GreenSock members, the agreement issued with that membership.
* @author: Jack Doyle, jack@greensock.com
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,function(t){"use strict";function m(t){return"string"==typeof t}var x=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,N=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,b=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,n=/(^[#\.][a-z]|[a-y][a-z])/i,B=Math.PI/180,D=Math.sin,E=Math.cos,k=Math.abs,$=Math.sqrt,h=function _isNumber(t){return"number"==typeof t},s=function _round(t){return Math.round(1e5*t)/1e5||0};function reverseSegment(t){var e,r=0;for(t.reverse();r<t.length;r+=2)e=t[r],t[r]=t[r+1],t[r+1]=e;t.reversed=!t.reversed}var A={rect:"rx,ry,x,y,width,height",circle:"r,cx,cy",ellipse:"rx,ry,cx,cy",line:"x1,x2,y1,y2"};function convertToPath(t,e){var r,n,a,o,i,h,s,l,g,c,p,u,f,d,_,P,v,m,y,w,M,x,T=t.tagName.toLowerCase(),b=.552284749831;return"path"!==T&&t.getBBox?(h=function _createPath(t,e){var r,n=document.createElementNS("http://www.w3.org/2000/svg","path"),a=[].slice.call(t.attributes),o=a.length;for(e=","+e+",";-1<--o;)r=a[o].nodeName.toLowerCase(),e.indexOf(","+r+",")<0&&n.setAttributeNS(null,r,a[o].nodeValue);return n}(t,"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"),x=function _attrToObj(t,e){for(var r=e?e.split(","):[],n={},a=r.length;-1<--a;)n[r[a]]=+t.getAttribute(r[a])||0;return n}(t,A[T]),"rect"===T?(o=x.rx,i=x.ry||o,n=x.x,a=x.y,c=x.width-2*o,p=x.height-2*i,r=o||i?"M"+(P=(d=(f=n+o)+c)+o)+","+(m=a+i)+" V"+(y=m+p)+" C"+[P,w=y+i*b,_=d+o*b,M=y+i,d,M,d-(d-f)/3,M,f+(d-f)/3,M,f,M,u=n+o*(1-b),M,n,w,n,y,n,y-(y-m)/3,n,m+(y-m)/3,n,m,n,v=a+i*(1-b),u,a,f,a,f+(d-f)/3,a,d-(d-f)/3,a,d,a,_,a,P,v,P,m].join(",")+"z":"M"+(n+c)+","+a+" v"+p+" h"+-c+" v"+-p+" h"+c+"z"):"circle"===T||"ellipse"===T?(l="circle"===T?(o=i=x.r)*b:(o=x.rx,(i=x.ry)*b),r="M"+((n=x.cx)+o)+","+(a=x.cy)+" C"+[n+o,a+l,n+(s=o*b),a+i,n,a+i,n-s,a+i,n-o,a+l,n-o,a,n-o,a-l,n-s,a-i,n,a-i,n+s,a-i,n+o,a-l,n+o,a].join(",")+"z"):"line"===T?r="M"+x.x1+","+x.y1+" L"+x.x2+","+x.y2:"polyline"!==T&&"polygon"!==T||(r="M"+(n=(g=(t.getAttribute("points")+"").match(N)||[]).shift())+","+(a=g.shift())+" L"+g.join(","),"polygon"===T&&(r+=","+n+","+a+"z")),h.setAttribute("d",rawPathToString(h._gsRawPath=stringToRawPath(r))),e&&t.parentNode&&(t.parentNode.insertBefore(h,t),t.parentNode.removeChild(t)),h):t}function arcToSegment(t,e,r,n,a,o,i,h,s){if(t!==h||e!==s){r=k(r),n=k(n);var l=a%360*B,g=E(l),c=D(l),p=Math.PI,u=2*p,f=(t-h)/2,d=(e-s)/2,_=g*f+c*d,P=-c*f+g*d,v=_*_,m=P*P,y=v/(r*r)+m/(n*n);1<y&&(r=$(y)*r,n=$(y)*n);var w=r*r,M=n*n,x=(w*M-w*m-M*v)/(w*m+M*v);x<0&&(x=0);var T=(o===i?-1:1)*$(x),b=r*P/n*T,S=-n*_/r*T,N=g*b-c*S+(t+h)/2,z=c*b+g*S+(e+s)/2,A=(_-b)/r,R=(P-S)/n,O=(-_-b)/r,j=(-P-S)/n,Y=A*A+R*R,C=(R<0?-1:1)*Math.acos(A/$(Y)),F=(A*j-R*O<0?-1:1)*Math.acos((A*O+R*j)/$(Y*(O*O+j*j)));isNaN(F)&&(F=p),!i&&0<F?F-=u:i&&F<0&&(F+=u),C%=u,F%=u;var V,I=Math.ceil(k(F)/(u/4)),L=[],X=F/I,U=4/3*D(X/2)/(1+E(X/2)),G=g*r,Q=c*r,q=c*-n,H=g*n;for(V=0;V<I;V++)_=E(a=C+V*X),P=D(a),A=E(a+=X),R=D(a),L.push(_-U*P,P+U*_,A+U*R,R-U*A,A,R);for(V=0;V<L.length;V+=2)_=L[V],P=L[V+1],L[V]=_*G+P*q+N,L[V+1]=_*Q+P*H+z;return L[V-2]=h,L[V-1]=s,L}}function stringToRawPath(t){function uc(t,e,r,n){g=(r-t)/3,c=(n-e)/3,h.push(t+g,e+c,r-g,n-c,r,n)}var e,r,n,a,o,i,h,s,l,g,c,p,u,f,d,_=(t+"").replace(b,function(t){var e=+t;return e<1e-4&&-1e-4<e?0:e}).match(x)||[],P=[],v=0,m=0,y=_.length,w=0,M="ERROR: malformed path: "+t;if(!t||!isNaN(_[0])||isNaN(_[1]))return console.log(M),P;for(e=0;e<y;e++)if(u=o,isNaN(_[e])?i=(o=_[e].toUpperCase())!==_[e]:e--,n=+_[e+1],a=+_[e+2],i&&(n+=v,a+=m),e||(s=n,l=a),"M"===o)h&&(h.length<8?--P.length:w+=h.length),v=s=n,m=l=a,h=[n,a],P.push(h),e+=2,o="L";else if("C"===o)i||(v=m=0),(h=h||[0,0]).push(n,a,v+1*_[e+3],m+1*_[e+4],v+=1*_[e+5],m+=1*_[e+6]),e+=6;else if("S"===o)g=v,c=m,"C"!==u&&"S"!==u||(g+=v-h[h.length-4],c+=m-h[h.length-3]),i||(v=m=0),h.push(g,c,n,a,v+=1*_[e+3],m+=1*_[e+4]),e+=4;else if("Q"===o)g=v+2/3*(n-v),c=m+2/3*(a-m),i||(v=m=0),v+=1*_[e+3],m+=1*_[e+4],h.push(g,c,v+2/3*(n-v),m+2/3*(a-m),v,m),e+=4;else if("T"===o)g=v-h[h.length-4],c=m-h[h.length-3],h.push(v+g,m+c,n+2/3*(v+1.5*g-n),a+2/3*(m+1.5*c-a),v=n,m=a),e+=2;else if("H"===o)uc(v,m,v=n,m),e+=1;else if("V"===o)uc(v,m,v,m=n+(i?m-v:0)),e+=1;else if("L"===o||"Z"===o)"Z"===o&&(n=s,a=l,h.closed=!0),("L"===o||.5<k(v-n)||.5<k(m-a))&&(uc(v,m,n,a),"L"===o&&(e+=2)),v=n,m=a;else if("A"===o){if(f=_[e+4],d=_[e+5],g=_[e+6],c=_[e+7],r=7,1<f.length&&(f.length<3?(c=g,g=d,r--):(c=d,g=f.substr(2),r-=2),d=f.charAt(1),f=f.charAt(0)),p=arcToSegment(v,m,+_[e+1],+_[e+2],+_[e+3],+f,+d,(i?v:0)+1*g,(i?m:0)+1*c),e+=r,p)for(r=0;r<p.length;r++)h.push(p[r]);v=h[h.length-2],m=h[h.length-1]}else console.log(M);return(e=h.length)<6?(P.pop(),e=0):h[0]===h[e-2]&&h[1]===h[e-1]&&(h.closed=!0),P.totalPoints=w+e,P}function rawPathToString(t){h(t[0])&&(t=[t]);var e,r,n,a,o="",i=t.length;for(r=0;r<i;r++){for(a=t[r],o+="M"+s(a[0])+","+s(a[1])+" C",e=a.length,n=2;n<e;n++)o+=s(a[n++])+","+s(a[n++])+" "+s(a[n++])+","+s(a[n++])+" "+s(a[n++])+","+s(a[n])+" ";a.closed&&(o+="z")}return o}function y(){return r||"undefined"!=typeof window&&(r=window.gsap)&&r.registerPlugin&&r}function z(t){return"function"==typeof t}function M(t){return console&&console.warn(t)}function O(t){var e,r=t.length,n=0,a=0;for(e=0;e<r;e++)n+=t[e++],a+=t[e];return[n/(r/2),a/(r/2)]}function P(t){var e,r,n,a=t.length,o=t[0],i=o,h=t[1],s=h;for(n=6;n<a;n+=6)o<(e=t[n])?o=e:e<i&&(i=e),h<(r=t[n+1])?h=r:r<s&&(s=r);return t.centerX=(o+i)/2,t.centerY=(h+s)/2,t.size=(o-i)*(h-s)}function Q(t,e){void 0===e&&(e=3);for(var r,n,a,o,i,h,s,l,g,c,p,u,f,d,_,P,v=t.length,m=t[0][0],y=m,w=t[0][1],M=w,x=1/e;-1<--v;)for(r=(i=t[v]).length,o=6;o<r;o+=6)for(g=i[o],c=i[o+1],p=i[o+2]-g,d=i[o+3]-c,u=i[o+4]-g,_=i[o+5]-c,f=i[o+6]-g,P=i[o+7]-c,h=e;-1<--h;)m<(n=((s=x*h)*s*f+3*(l=1-s)*(s*u+l*p))*s+g)?m=n:n<y&&(y=n),w<(a=(s*s*P+3*l*(s*_+l*d))*s+c)?w=a:a<M&&(M=a);return t.centerX=(m+y)/2,t.centerY=(w+M)/2,t.left=y,t.width=m-y,t.top=M,t.height=w-M,t.size=(m-y)*(w-M)}function R(t,e){return e.length-t.length}function S(t,e){var r=t.size||P(t),n=e.size||P(e);return Math.abs(n-r)<(r+n)/20?e.centerX-t.centerX||e.centerY-t.centerY:n-r}function T(t,e){var r,n,a=t.slice(0),o=t.length,i=o-2;for(e|=0,r=0;r<o;r++)n=(r+e)%i,t[r++]=a[n],t[r]=a[1+n]}function U(t,e,r,n,a){var o,i,h,s,l=t.length,g=0,c=l-2;for(r*=6,i=0;i<l;i+=6)s=t[o=(i+r)%c]-(e[i]-n),h=t[1+o]-(e[i+1]-a),g+=_(h*h+s*s);return g}function V(t,e,r){var n,a,o,i=t.length,h=O(t),s=O(e),l=s[0]-h[0],g=s[1]-h[1],c=U(t,e,0,l,g),p=0;for(o=6;o<i;o+=6)(a=U(t,e,o/6,l,g))<c&&(c=a,p=o);if(r)for(reverseSegment(n=t.slice(0)),o=6;o<i;o+=6)(a=U(n,e,o/6,l,g))<c&&(c=a,p=-o);return p/6}function W(t,e,r){for(var n,a,o,i,h,s,l=t.length,g=1e20,c=0,p=0;-1<--l;)for(s=(n=t[l]).length,h=0;h<s;h+=6)a=n[h]-e,o=n[h+1]-r,(i=_(a*a+o*o))<g&&(g=i,c=n[h],p=n[h+1]);return[c,p]}function X(t,e,r,n,a,o){var i,h,s,l,g=e.length,c=0,p=Math.min(t.size||P(t),e[r].size||P(e[r]))*n,u=1e20,f=t.centerX+a,d=t.centerY+o;for(i=r;i<g&&!((e[i].size||P(e[i]))<p);i++)h=e[i].centerX-f,s=e[i].centerY-d,(l=_(h*h+s*s))<u&&(c=i,u=l);return l=e[c],e.splice(c,1),l}function Y(t,e){var r,n,a,o,i,h,s,l,g,c,p,u,f,d,_=0,P=t.length,v=e/((P-2)/6);for(f=2;f<P;f+=6)for(_+=v;.999999<_;)r=t[f-2],n=t[f-1],a=t[f],o=t[f+1],i=t[f+2],h=t[f+3],s=t[f+4],l=t[f+5],g=r+(a-r)*(d=1/((Math.floor(_)||1)+1)),g+=((p=a+(i-a)*d)-g)*d,p+=(i+(s-i)*d-p)*d,c=n+(o-n)*d,c+=((u=o+(h-o)*d)-c)*d,u+=(h+(l-h)*d-u)*d,t.splice(f,4,r+(a-r)*d,n+(o-n)*d,g,c,g+(p-g)*d,c+(u-c)*d,p,u,i+(s-i)*d,h+(l-h)*d),f+=6,P+=6,_--;return t}function Z(t,e,r,n,a){var o,i,h,s,l,g,c,p=e.length-t.length,u=0<p?e:t,f=0<p?t:e,d=0,_="complexity"===n?R:S,v="position"===n?0:"number"==typeof n?n:.8,m=f.length,y="object"==typeof r&&r.push?r.slice(0):[r],w="reverse"===y[0]||y[0]<0,x="log"===r;if(f[0]){if(1<u.length&&(t.sort(_),e.sort(_),u.size||Q(u),f.size||Q(f),g=u.centerX-f.centerX,c=u.centerY-f.centerY,_===S))for(m=0;m<f.length;m++)u.splice(m,0,X(f[m],u,m,v,g,c));if(p)for(p<0&&(p=-p),u[0].length>f[0].length&&Y(f[0],(u[0].length-f[0].length)/6|0),m=f.length;d<p;)u[m].size||P(u[m]),s=(h=W(f,u[m].centerX,u[m].centerY))[0],l=h[1],f[m++]=[s,l,s,l,s,l,s,l],f.totalPoints+=8,d++;for(m=0;m<t.length;m++)o=e[m],i=t[m],(p=o.length-i.length)<0?Y(o,-p/6|0):0<p&&Y(i,p/6|0),w&&!1!==a&&!i.reversed&&reverseSegment(i),(r=y[m]||0===y[m]?y[m]:"auto")&&(i.closed||Math.abs(i[0]-i[i.length-2])<.5&&Math.abs(i[1]-i[i.length-1])<.5?"auto"===r||"log"===r?(y[m]=r=V(i,o,!m||!1===a),r<0&&(w=!0,reverseSegment(i),r=-r),T(i,6*r)):"reverse"!==r&&(m&&r<0&&reverseSegment(i),T(i,6*(r<0?-r:r))):!w&&("auto"===r&&Math.abs(o[0]-i[0])+Math.abs(o[1]-i[1])+Math.abs(o[o.length-2]-i[i.length-2])+Math.abs(o[o.length-1]-i[i.length-1])>Math.abs(o[0]-i[i.length-2])+Math.abs(o[1]-i[i.length-1])+Math.abs(o[o.length-2]-i[0])+Math.abs(o[o.length-1]-i[1])||r%2)?(reverseSegment(i),y[m]=-1,w=!0):"auto"===r?y[m]=0:"reverse"===r&&(y[m]=-1),i.closed!==o.closed&&(i.closed=o.closed=!1));return x&&M("shapeIndex:["+y.join(",")+"]"),t.shapeIndex=y}}function aa(t,e){var r,n,a,o,i,h,s,l=0,g=parseFloat(t[0]),c=parseFloat(t[1]),p=g+","+c+" ";for(r=.5*e/(.5*(a=t.length)-1),n=0;n<a-2;n+=2){if(l+=r,h=parseFloat(t[n+2]),s=parseFloat(t[n+3]),.999999<l)for(i=1/(Math.floor(l)+1),o=1;.999999<l;)p+=(g+(h-g)*i*o).toFixed(2)+","+(c+(s-c)*i*o).toFixed(2)+" ",l--,o++;p+=h+","+s+" ",g=h,c=s}return p}function ba(t){var e=t[0].match(G)||[],r=t[1].match(G)||[],n=r.length-e.length;0<n?t[0]=aa(e,n):t[1]=aa(r,-n)}function ca(e){return isNaN(e)?ba:function(t){ba(t),t[1]=function _offsetPoints(t,e){if(!e)return t;var r,n,a,o=t.match(G)||[],i=o.length,h="";for(r="reverse"===e?(n=i-1,-2):(n=(2*(parseInt(e,10)||0)+1+100*i)%i,2),a=0;a<i;a+=2)h+=o[n-1]+","+o[n]+" ",n=(n+r)%i;return h}(t[1],parseInt(e,10))}}function ea(t,e){for(var r,n,a,o,i,h,s,l,g,c,p,u,f=t.length,d=.2*(e||1);-1<--f;){for(p=(n=t[f]).isSmooth=n.isSmooth||[0,0,0,0],u=n.smoothData=n.smoothData||[0,0,0,0],p.length=4,l=n.length-2,s=6;s<l;s+=6)a=n[s]-n[s-2],o=n[s+1]-n[s-1],i=n[s+2]-n[s],h=n[s+3]-n[s+1],g=w(o,a),c=w(h,i),(r=Math.abs(g-c)<d)&&(u[s-2]=g,u[s+2]=c,u[s-1]=_(a*a+o*o),u[s+3]=_(i*i+h*h)),p.push(r,r,0,0,r,r);n[l]===n[0]&&n[1+l]===n[1]&&(a=n[0]-n[l-2],o=n[1]-n[l-1],i=n[2]-n[0],h=n[3]-n[1],g=w(o,a),c=w(h,i),Math.abs(g-c)<d&&(u[l-2]=g,u[2]=c,u[l-1]=_(a*a+o*o),u[3]=_(i*i+h*h),p[l-2]=p[l-1]=!0))}return t}function fa(t){var e=t.trim().split(" ");return{x:(~t.indexOf("left")?0:~t.indexOf("right")?100:isNaN(parseFloat(e[0]))?50:parseFloat(e[0]))/100,y:(~t.indexOf("top")?0:~t.indexOf("bottom")?100:isNaN(parseFloat(e[1]))?50:parseFloat(e[1]))/100}}function ia(t,e,r,n){var a,o,i=this._origin,h=this._eOrigin,s=t[r]-i.x,l=t[r+1]-i.y,g=_(s*s+l*l),c=w(l,s);return s=e[r]-h.x,l=e[r+1]-h.y,o=function _shortAngle(t){return t!==t%p?t+(t<0?u:-u):t}(a=w(l,s)-c),!n&&F&&Math.abs(o+F.ca)<f&&(n=F),this._anchorPT=F={_next:this._anchorPT,t:t,sa:c,ca:n&&o*n.ca<0&&Math.abs(o)>d?a:o,sl:g,cl:_(s*s+l*l)-g,i:r}}function ja(t){r=y(),a=a||r&&r.plugins.morphSVG,r&&a?(C=r.utils.toArray,a.prototype._tweenRotation=ia,I=1):t&&M("Please gsap.registerPlugin(MorphSVGPlugin)")}var r,C,F,I,a,w=Math.atan2,j=Math.cos,L=Math.sin,_=Math.sqrt,p=Math.PI,u=2*p,f=.3*p,d=.7*p,G=/[-+=\.]*\d+[\.e\-\+]*\d*[e\-\+]*\d*/gi,q=/(^[#\.][a-z]|[a-y][a-z])/i,H=/[achlmqstvz]/i,J="Use MorphSVGPlugin.convertToPath() to convert to a path before morphing.",K={version:"3.6.0",name:"morphSVG",rawVars:1,register:function register(t,e){r=t,a=e,ja()},init:function init(t,e,r,n,a){if(I||ja(1),!e)return M("invalid shape"),!1;var o,i,h,s,l,g,c,p,u,f,d,_,P,v,m,y,w,x,T,b,S,N;if(z(e)&&(e=e.call(r,n,t,a)),"string"==typeof e||e.getBBox||e[0])e={shape:e};else if("object"==typeof e){for(i in o={},e)o[i]=z(e[i])&&"render"!==i?e[i].call(r,n,t,a):e[i];e=o}var A=t.nodeType?window.getComputedStyle(t):{},R=A.fill+"",O=!("none"===R||"0"===(R.match(G)||[])[3]||"evenodd"===A.fillRule),j=(e.origin||"50 50").split(",");if(l="POLYLINE"===(o=(t.nodeName+"").toUpperCase())||"POLYGON"===o,"PATH"!==o&&!l&&!e.prop)return M("Cannot morph a <"+o+"> element. "+J),!1;if(i="PATH"===o?"d":"points",!e.prop&&!z(t.setAttribute))return!1;if(s=function _parseShape(t,e,r){var n,a;return(!("string"==typeof t)||q.test(t)||(t.match(G)||[]).length<3)&&((n=C(t)[0])?(a=(n.nodeName+"").toUpperCase(),e&&"PATH"!==a&&(n=convertToPath(n,!1),a="PATH"),t=n.getAttribute("PATH"===a?"d":"points")||"",n===r&&(t=n.getAttributeNS(null,"data-original")||t)):(M("WARNING: invalid morph to: "+t),t=!1)),t}(e.shape||e.d||e.points||"","d"===i,t),l&&H.test(s))return M("A <"+o+"> cannot accept path data. "+J),!1;if(g=e.shapeIndex||0===e.shapeIndex?e.shapeIndex:"auto",c=e.map||K.defaultMap,this._prop=e.prop,this._render=e.render||K.defaultRender,this._apply="updateTarget"in e?e.updateTarget:K.defaultUpdateTarget,this._rnd=Math.pow(10,isNaN(e.precision)?2:+e.precision),this._tween=r,s){if(this._target=t,w="object"==typeof e.precompile,f=this._prop?t[this._prop]:t.getAttribute(i),this._prop||t.getAttributeNS(null,"data-original")||t.setAttributeNS(null,"data-original",f),"d"===i||this._prop){if(f=stringToRawPath(w?e.precompile[0]:f),d=stringToRawPath(w?e.precompile[1]:s),!w&&!Z(f,d,g,c,O))return!1;for("log"!==e.precompile&&!0!==e.precompile||M('precompile:["'+rawPathToString(f)+'","'+rawPathToString(d)+'"]'),(S="linear"!==(e.type||K.defaultType))&&(f=ea(f,e.smoothTolerance),d=ea(d,e.smoothTolerance),f.size||Q(f),d.size||Q(d),b=fa(j[0]),this._origin=f.origin={x:f.left+b.x*f.width,y:f.top+b.y*f.height},j[1]&&(b=fa(j[1])),this._eOrigin={x:d.left+b.x*d.width,y:d.top+b.y*d.height}),this._rawPath=t._gsRawPath=f,P=f.length;-1<--P;)for(m=f[P],y=d[P],p=m.isSmooth||[],u=y.isSmooth||[],v=m.length,_=F=0;_<v;_+=2)y[_]===m[_]&&y[_+1]===m[_+1]||(S?p[_]&&u[_]?(x=m.smoothData,T=y.smoothData,N=_+(_===v-4?7-v:5),this._controlPT={_next:this._controlPT,i:_,j:P,l1s:x[_+1],l1c:T[_+1]-x[_+1],l2s:x[N],l2c:T[N]-x[N]},h=this._tweenRotation(m,y,_+2),this._tweenRotation(m,y,_,h),this._tweenRotation(m,y,N-1,h),_+=4):this._tweenRotation(m,y,_):(h=this.add(m,_,m[_],y[_]),h=this.add(m,_+1,m[_+1],y[_+1])||h))}else h=this.add(t,"setAttribute",t.getAttribute(i)+"",s+"",n,a,0,ca(g),i);S&&(this.add(this._origin,"x",this._origin.x,this._eOrigin.x),h=this.add(this._origin,"y",this._origin.y,this._eOrigin.y)),h&&(this._props.push("morphSVG"),h.end=s,h.endProp=i)}return 1},render:function render(t,e){for(var r,n,a,o,i,h,s,l,g,c,p,u,f=e._rawPath,d=e._controlPT,_=e._anchorPT,P=e._rnd,v=e._target,m=e._pt;m;)m.r(t,m.d),m=m._next;if(1===t&&e._apply)for(m=e._pt;m;)m.end&&(e._prop?v[e._prop]=m.end:v.setAttribute(m.endProp,m.end)),m=m._next;else if(f){for(;_;)i=_.sa+t*_.ca,o=_.sl+t*_.cl,_.t[_.i]=e._origin.x+j(i)*o,_.t[_.i+1]=e._origin.y+L(i)*o,_=_._next;for(n=t<.5?2*t*t:(4-2*t)*t-1;d;)u=(h=d.i)+(h===(a=f[d.j]).length-4?7-a.length:5),i=w(a[u]-a[h+1],a[u-1]-a[h]),c=L(i),p=j(i),l=a[h+2],g=a[h+3],o=d.l1s+n*d.l1c,a[h]=l-p*o,a[h+1]=g-c*o,o=d.l2s+n*d.l2c,a[u-1]=l+p*o,a[u]=g+c*o,d=d._next;if(v._gsRawPath=f,e._apply){for(r="",s=0;s<f.length;s++)for(o=(a=f[s]).length,r+="M"+(a[0]*P|0)/P+" "+(a[1]*P|0)/P+" C",h=2;h<o;h++)r+=(a[h]*P|0)/P+" ";e._prop?v[e._prop]=r:v.setAttribute("d",r)}}e._render&&f&&e._render.call(e._tween,f,v)},kill:function kill(){this._pt=this._rawPath=0},getRawPath:function getRawPath(t){var e,r=(t=m(t)&&n.test(t)&&document.querySelector(t)||t).getAttribute?t:0;return r&&(t=t.getAttribute("d"))?(r._gsPath||(r._gsPath={}),(e=r._gsPath[t])&&!e._dirty?e:r._gsPath[t]=stringToRawPath(t)):t?m(t)?stringToRawPath(t):h(t[0])?[t]:t:console.warn("Expecting a <path> element or an SVG path data string")},stringToRawPath:stringToRawPath,rawPathToString:rawPathToString,pathFilter:function _pathFilter(t,e,r,n,a){var o=stringToRawPath(t[0]),i=stringToRawPath(t[1]);Z(o,i,e||0===e?e:"auto",r,a)&&(t[0]=rawPathToString(o),t[1]=rawPathToString(i),"log"!==n&&!0!==n||M('precompile:["'+t[0]+'","'+t[1]+'"]'))},pointsFilter:ba,getTotalSize:Q,equalizeSegmentQuantity:Z,convertToPath:function convertToPath$1(t,e){return C(t).map(function(t){return convertToPath(t,!1!==e)})},defaultType:"linear",defaultUpdateTarget:!0,defaultMap:"size"};y()&&r.registerPlugin(K),t.MorphSVGPlugin=K,t.default=K;if (typeof(window)==="undefined"||window!==t){Object.defineProperty(t,"__esModule",{value:!0})} else {delete t.default}});