Files
Foundry-VTT-Docker/resources/app/public/scripts/greensock/dist/MorphSVGPlugin.min.js

12 lines
16 KiB
JavaScript
Raw Normal View History

2025-01-04 00:34:03 +01:00
/*!
* MorphSVGPlugin 3.11.0
* https://greensock.com
*
* @license Copyright 2022, GreenSock. All rights reserved.
* This plugin is a membership benefit of Club GreenSock and is only authorized for use in sites/apps/products developed by individuals/companies with an active Club GreenSock membership. See https://greensock.com/club
* @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,J=Math.sqrt,s=function _isNumber(t){return"number"==typeof t},h=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,s,h,l,g,c,p,u,f,d,_,P,m,v,y,w,M,x,T=t.tagName.toLowerCase(),b=.552284749831;return"path"!==T&&t.getBBox?(s=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)+","+(v=a+i)+" V"+(y=v+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-v)/3,n,v+(y-v)/3,n,v,n,m=a+i*(1-b),u,a,f,a,f+(d-f)/3,a,d-(d-f)/3,a,d,a,_,a,P,m,P,v].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+(h=o*b),a+i,n,a+i,n-h,a+i,n-o,a+l,n-o,a,n-o,a-l,n-h,a-i,n,a-i,n+h,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")),s.setAttribute("d",rawPathToString(s._gsRawPath=stringToRawPath(r))),e&&t.parentNode&&(t.parentNode.insertBefore(s,t),t.parentNode.removeChild(t)),s):t}function arcToSegment(t,e,r,n,a,o,i,s,h){if(t!==s||e!==h){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-s)/2,d=(e-h)/2,_=g*f+c*d,P=-c*f+g*d,m=_*_,v=P*P,y=m/(r*r)+v/(n*n);1<y&&(r=J(y)*r,n=J(y)*n);var w=r*r,M=n*n,x=(w*M-w*v-M*m)/(w*v+M*m);x<0&&(x=0);var T=(o===i?-1:1)*J(x),b=r*P/n*T,S=-n*_/r*T,N=g*b-c*S+(t+s)/2,z=c*b+g*S+(e+h)/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/J(Y)),I=(A*j-R*O<0?-1:1)*Math.acos((A*O+R*j)/J(Y*(O*O+j*j)));isNaN(I)&&(I=p),!i&&0<I?I-=u:i&&I<0&&(I+=u),C%=u,I%=u;var V,F=Math.ceil(k(I)/(u/4)),L=[],X=I/F,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<F;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]=s,L[V-1]=h,L}}function stringToRawPath(t){function uc(t,e,r,n){g=(r-t)/3,c=(n-e)/3,s.push(t+g,e+c,r-g,n-c,r,n)}var e,r,n,a,o,i,s,h,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=[],m=0,v=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+=m,a+=v),e||(h=n,l=a),"M"===o)s&&(s.length<8?--P.length:w+=s.length),m=h=n,v=l=a,s=[n,a],P.push(s),e+=2,o="L";else if("C"===o)i||(m=v=0),(s=s||[0,0]).push(n,a,m+1*_[e+3],v+1*_[e+4],m+=1*_[e+5],v+=1*_[e+6]),e+=6;else if("S"===o)g=m,c=v,"C"!==u&&"S"!==u||(g+=m-s[s.length-4],c+=v-s[s.length-3]),i||(m=v=0),s.push(g,c,n,a,m+=1*_[e+3],v+=1*_[e+4]),e+=4;else if("Q"===o)g=m+2/3*(n-m),c=v+2/3*(a-v),i||(m=v=0),m+=1*_[e+3],v+=1*_[e+4],s.push(g,c,m+2/3*(n-m),v+2/3*(a-v),m,v),e+=4;else if("T"===o)g=m-s[s.length-4