import{warning as t}from"../../../../../hey-listen/dist/hey-listen.es.js";import{clamp as r}from"../../utils/clamp.js";var n=.01,e=10,i=.05,o=1;function a(n){var e,i,o=n.duration,a=void 0===o?800:o,u=n.bounce,f=void 0===u?.25:u,p=n.velocity,v=void 0===p?0:p,h=n.mass,c=void 0===h?1:h;t(a<=1e4,"Spring duration must be 10 seconds or less");var d=1-f;d=r(.05,1,d),a=r(.01,10,a/1e3),d<1?(e=function(t){var r=t*d,n=r*a;return.001-(r-v)/s(t,d)*Math.exp(-n)},i=function(t){var r=t*d*a,n=r*v+v,i=Math.pow(d,2)*Math.pow(t,2)*a,o=Math.exp(-r),u=s(Math.pow(t,2),d);return(.001-e(t)>0?-1:1)*((n-i)*o)/u}):(e=function(t){return Math.exp(-t*a)*((t-v)*a+1)-.001},i=function(t){return Math.exp(-t*a)*(a*a*(v-t))});var M=function(t,r,n){for(var e=n,i=1;i<12;i++)e-=t(e)/r(e);return e}(e,i,5/a);if(isNaN(M))return{stiffness:100,damping:10};var m=Math.pow(M,2)*c;return{stiffness:m,damping:2*d*Math.sqrt(c*m)}}function s(t,r){return t*Math.sqrt(1-r*r)}export{s as calcAngularFreq,a as findSpring,o as maxDamping,e as maxDuration,i as minDamping,n as minDuration};
//# sourceMappingURL=find-spring.js.map
