/*! For license information please see p5.bezier.min.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.initBezier=e():t.initBezier=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>P});var n={1:.1,2:.02,3:.001,4:5e-4,5:2e-4},i=[1],o={};function r(t){return i[t]}function s(t,e){return 0===e||e===t?1:o[t][e]}!function(t){for(var e=i.length;e<=t;e++)i[e]=e*i[e-1]}(161),function(t){for(var e=2;e<=t;e++){o[e]={};for(var n=1;n5||!Number.isInteger(t)?(l||(l=!0,window.console.warn("[p5.bezier] Smoothness should be an integer between 1 and 5")),Math.round(Math.max(1,Math.min(5,t)))):t}var f=function(){function t(t){this.m=Math.pow(2,31)-1,this.a=1103515245,this.c=12345,this.state=t}return t.prototype.r=function(){return this.state=(this.a*this.state+this.c)%this.m,this.state/this.m},t.prototype.next=function(t,e){return Math.floor(this.r()*(e-t+1))+t},t}();function v(t,e){void 0===e&&(e=!1);var n=160-(e?3:0);if(t.length<=n)return d(t);var i=t.length-n,o=new f(1234),r=new Set;return h([],new Array(i),!0).map((function(t,e){for(var i=o.next(5+e,n-5+e);r.has(i);)i=o.next(5+e,n-5+e);r.add(i)})),d(t.filter((function(t,e){return!r.has(e)})))}function d(t){return t.map((function(t){return t.slice()}))}function b(t){var e=t.length;if(0===e)return[];var n=t[0],i=t[e-1];if(1===e)return d([n]);var o=t[1],r=t[e-2];return d([[2*i[0]-r[0],2*i[1]-r[1]],[2*n[0]-o[0],2*n[1]-o[1]],n])}var x=function(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o.001&&(this.increment=.001,window.console.warn("[p5.bezier] Smoothness set to 3 for a dashed curve"));var s,h,a,c,l,p=t.map(Math.abs),f=p[0],v=p[1],d=!0,b=this.vertexList[0],x=1,y=b,m=0,g=f;for(this.b.ctx.save(),this.b.ctx.fillStyle="rgba(0, 0, 0, 0)",this.b.beginPath(),(e=this.b).moveTo.apply(e,b);x=g;)h=P,a=g/m,c=void 0,l=void 0,c=(s=y).length,l=h.length,y=2===c&&2===l?[s[0]+(h[0]-s[0])*a,s[1]+(h[1]-s[1])*a]:3===c&&3===l?[s[0]+(h[0]-s[0])*a,s[1]+(h[1]-s[1])*a,s[2]+(h[2]-s[2])*a]:h,d?(n=this.b).lineTo.apply(n,y):(i=this.b).moveTo.apply(i,y),m-=g,g=(d=!d)?f:v;d?(o=this.b).lineTo.apply(o,P):(r=this.b).moveTo.apply(r,P),g-=this._distVertex(y,P),y=b=P,x++}u(this.b),this.b.ctx.restore()},t.prototype.update=function(t){if(t.length!==this.controlPoints.length)throw new Error("[p5.bezier] The number of control points changed");this.controlPoints.every((function(e,n){return e===t[n]}))||(this.controlPoints=t,this._buildVertexList())},t.prototype.move=function(e,n,i,o,r){if(void 0===i&&(i=null),void 0===o&&(o=!0),null===i&&3===this.dimension)throw new Error("[p5.bezier] X, Y, and Z are needed to move a 3D curve");var s=[e,n];null!==i&&s.push(i);var h=this.vertexList.map((function(t){return t.slice()})),a=new t(this.controlPoints,this.closeType,this.increment,this.b,h);return a.vertexList=a.vertexList.map((function(t){return t.map((function(t,e){return t+s[e]}))})),o&&a.draw(r),a},t.prototype.shortest=function(t,e,n){var i=this;void 0===n&&(n=0);var o=[0,0,0],r=Number.POSITIVE_INFINITY;return this.vertexList.map((function(s){var h=i._distVertex(s,[t,e,n]);r>h&&(r=h,o=x([],s,!0))})),o},t}();const P=function(t){return new m(t)};return e=e.default})())); //# sourceMappingURL=p5.bezier.min.js.map