UNPKG

canvas-sketch-util-umd

Version:

Utilities for sketching in Canvas, WebGL and generative art

1 lines 166 kB
Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var n={exports:{}};!function(t){var r=256,n=[],a=void 0===e?window:e,i=Math.pow(r,6),o=Math.pow(2,52),f=2*o,u=255,s=Math.random;function c(e){var t,n=e.length,a=this,i=0,o=a.i=a.j=0,f=a.S=[];for(n||(e=[n++]);i<r;)f[i]=i++;for(i=0;i<r;i++)f[i]=f[o=u&o+e[i%n]+(t=f[i])],f[o]=t;(a.g=function(e){for(var t,n=0,i=a.i,o=a.j,f=a.S;e--;)t=f[i=u&i+1],n=n*r+f[u&(f[i]=f[o=u&o+t])+(f[o]=t)];return a.i=i,a.j=o,n})(r)}function l(e,t){var r,n=[],a=(typeof e)[0];if(t&&"o"==a)for(r in e)try{n.push(l(e[r],t-1))}catch(e){}return n.length?n:"s"==a?e:e+"\0"}function h(e,t){for(var r,n=e+"",a=0;a<n.length;)t[u&a]=u&(r^=19*t[u&a])+n.charCodeAt(a++);return d(t)}function p(e){try{return a.crypto.getRandomValues(e=new Uint8Array(r)),d(e)}catch(e){return[+new Date,a,a.navigator&&a.navigator.plugins,a.screen,d(n)]}}function d(e){return String.fromCharCode.apply(0,e)}t.exports=function(e,a){if(a&&!0===a.global)return a.global=!1,Math.random=t.exports(e,a),a.global=!0,Math.random;var u=a&&a.entropy||!1,s=[];h(l(u?[e,d(n)]:0 in arguments?e:p(),3),s);var m=new c(s);return h(d(m.S),n),function(){for(var e=m.g(6),t=i,n=0;e<o;)e=(e+n)*r,t*=r,n=m.g(1);for(;e>=f;)e/=2,t/=2,n>>>=1;return(e+n)/t}},t.exports.resetGlobal=function(){Math.random=s},h(Math.random(),n)}(n);var a={exports:{}};!function(e,t){!function(){var r=.5*(Math.sqrt(3)-1),n=(3-Math.sqrt(3))/6,a=1/6,i=(Math.sqrt(5)-1)/4,o=(5-Math.sqrt(5))/20;function f(e){var t;t="function"==typeof e?e:e?function(){var e=0,t=0,r=0,n=1,a=s();e=a(" "),t=a(" "),r=a(" ");for(var i=0;i<arguments.length;i++)(e-=a(arguments[i]))<0&&(e+=1),(t-=a(arguments[i]))<0&&(t+=1),(r-=a(arguments[i]))<0&&(r+=1);return a=null,function(){var a=2091639*e+2.3283064365386963e-10*n;return e=t,t=r,r=a-(n=0|a)}}(e):Math.random,this.p=u(t),this.perm=new Uint8Array(512),this.permMod12=new Uint8Array(512);for(var r=0;r<512;r++)this.perm[r]=this.p[255&r],this.permMod12[r]=this.perm[r]%12}function u(e){var t,r=new Uint8Array(256);for(t=0;t<256;t++)r[t]=t;for(t=0;t<255;t++){var n=t+~~(e()*(256-t)),a=r[t];r[t]=r[n],r[n]=a}return r}function s(){var e=4022871197;return function(t){t=t.toString();for(var r=0;r<t.length;r++){var n=.02519603282416938*(e+=t.charCodeAt(r));n-=e=n>>>0,e=(n*=e)>>>0,e+=4294967296*(n-=e)}return 2.3283064365386963e-10*(e>>>0)}}f.prototype={grad3:new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),grad4:new Float32Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]),noise2D:function(e,t){var a,i,o=this.permMod12,f=this.perm,u=this.grad3,s=0,c=0,l=0,h=(e+t)*r,p=Math.floor(e+h),d=Math.floor(t+h),m=(p+d)*n,b=e-(p-m),v=t-(d-m);b>v?(a=1,i=0):(a=0,i=1);var g=b-a+n,y=v-i+n,x=b-1+2*n,w=v-1+2*n,k=255&p,M=255&d,A=.5-b*b-v*v;if(A>=0){var _=3*o[k+f[M]];s=(A*=A)*A*(u[_]*b+u[_+1]*v)}var S=.5-g*g-y*y;if(S>=0){var E=3*o[k+a+f[M+i]];c=(S*=S)*S*(u[E]*g+u[E+1]*y)}var T=.5-x*x-w*w;if(T>=0){var j=3*o[k+1+f[M+1]];l=(T*=T)*T*(u[j]*x+u[j+1]*w)}return 70*(s+c+l)},noise3D:function(e,t,r){var n,i,o,f,u,s,c,l,h,p,d=this.permMod12,m=this.perm,b=this.grad3,v=.3333333333333333*(e+t+r),g=Math.floor(e+v),y=Math.floor(t+v),x=Math.floor(r+v),w=(g+y+x)*a,k=e-(g-w),M=t-(y-w),A=r-(x-w);k>=M?M>=A?(u=1,s=0,c=0,l=1,h=1,p=0):k>=A?(u=1,s=0,c=0,l=1,h=0,p=1):(u=0,s=0,c=1,l=1,h=0,p=1):M<A?(u=0,s=0,c=1,l=0,h=1,p=1):k<A?(u=0,s=1,c=0,l=0,h=1,p=1):(u=0,s=1,c=0,l=1,h=1,p=0);var _=k-u+a,S=M-s+a,E=A-c+a,T=k-l+2*a,j=M-h+2*a,D=A-p+2*a,C=k-1+.5,O=M-1+.5,P=A-1+.5,F=255&g,z=255&y,B=255&x,L=.6-k*k-M*M-A*A;if(L<0)n=0;else{var I=3*d[F+m[z+m[B]]];n=(L*=L)*L*(b[I]*k+b[I+1]*M+b[I+2]*A)}var R=.6-_*_-S*S-E*E;if(R<0)i=0;else{var q=3*d[F+u+m[z+s+m[B+c]]];i=(R*=R)*R*(b[q]*_+b[q+1]*S+b[q+2]*E)}var G=.6-T*T-j*j-D*D;if(G<0)o=0;else{var H=3*d[F+l+m[z+h+m[B+p]]];o=(G*=G)*G*(b[H]*T+b[H+1]*j+b[H+2]*D)}var N=.6-C*C-O*O-P*P;if(N<0)f=0;else{var U=3*d[F+1+m[z+1+m[B+1]]];f=(N*=N)*N*(b[U]*C+b[U+1]*O+b[U+2]*P)}return 32*(n+i+o+f)},noise4D:function(e,t,r,n){var a,f,u,s,c,l,h,p,d,m,b,v,g,y,x,w,k,M=this.perm,A=this.grad4,_=(e+t+r+n)*i,S=Math.floor(e+_),E=Math.floor(t+_),T=Math.floor(r+_),j=Math.floor(n+_),D=(S+E+T+j)*o,C=e-(S-D),O=t-(E-D),P=r-(T-D),F=n-(j-D),z=0,B=0,L=0,I=0;C>O?z++:B++,C>P?z++:L++,C>F?z++:I++,O>P?B++:L++,O>F?B++:I++,P>F?L++:I++;var R=C-(l=z>=3?1:0)+o,q=O-(h=B>=3?1:0)+o,G=P-(p=L>=3?1:0)+o,H=F-(d=I>=3?1:0)+o,N=C-(m=z>=2?1:0)+2*o,U=O-(b=B>=2?1:0)+2*o,W=P-(v=L>=2?1:0)+2*o,V=F-(g=I>=2?1:0)+2*o,Q=C-(y=z>=1?1:0)+3*o,Y=O-(x=B>=1?1:0)+3*o,$=P-(w=L>=1?1:0)+3*o,X=F-(k=I>=1?1:0)+3*o,J=C-1+4*o,Z=O-1+4*o,K=P-1+4*o,ee=F-1+4*o,te=255&S,re=255&E,ne=255&T,ae=255&j,ie=.6-C*C-O*O-P*P-F*F;if(ie<0)a=0;else{var oe=M[te+M[re+M[ne+M[ae]]]]%32*4;a=(ie*=ie)*ie*(A[oe]*C+A[oe+1]*O+A[oe+2]*P+A[oe+3]*F)}var fe=.6-R*R-q*q-G*G-H*H;if(fe<0)f=0;else{var ue=M[te+l+M[re+h+M[ne+p+M[ae+d]]]]%32*4;f=(fe*=fe)*fe*(A[ue]*R+A[ue+1]*q+A[ue+2]*G+A[ue+3]*H)}var se=.6-N*N-U*U-W*W-V*V;if(se<0)u=0;else{var ce=M[te+m+M[re+b+M[ne+v+M[ae+g]]]]%32*4;u=(se*=se)*se*(A[ce]*N+A[ce+1]*U+A[ce+2]*W+A[ce+3]*V)}var le=.6-Q*Q-Y*Y-$*$-X*X;if(le<0)s=0;else{var he=M[te+y+M[re+x+M[ne+w+M[ae+k]]]]%32*4;s=(le*=le)*le*(A[he]*Q+A[he+1]*Y+A[he+2]*$+A[he+3]*X)}var pe=.6-J*J-Z*Z-K*K-ee*ee;if(pe<0)c=0;else{var de=M[te+1+M[re+1+M[ne+1+M[ae+1]]]]%32*4;c=(pe*=pe)*pe*(A[de]*J+A[de+1]*Z+A[de+2]*K+A[de+3]*ee)}return 27*(a+f+u+s+c)}},f._buildPermutationTable=u,t.SimplexNoise=f,e.exports=f}()}(a,a.exports);var i=function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]},o=n.exports,f=a.exports,u=i;var s=function e(t){t=u(t,null);var r,n,a,i=Math.random,s=null,c=!1;return l(t),{value:h,createRandom:function(t){return e(t)},setSeed:l,getSeed:function(){return r},getRandomSeed:function(){return String(Math.floor(1e6*Math.random()))},valueNonZero:function(){var e=0;for(;0===e;)e=h();return e},permuteNoise:function(){a=p()},noise1D:function(e,t,r){if(!isFinite(e))throw new TypeError("x component for noise() must be finite");return t=u(t,1),(r=u(r,1))*a.noise2D(e*t,0)},noise2D:function(e,t,r,n){if(!isFinite(e))throw new TypeError("x component for noise() must be finite");if(!isFinite(t))throw new TypeError("y component for noise() must be finite");return r=u(r,1),(n=u(n,1))*a.noise2D(e*r,t*r)},noise3D:function(e,t,r,n,i){if(!isFinite(e))throw new TypeError("x component for noise() must be finite");if(!isFinite(t))throw new TypeError("y component for noise() must be finite");if(!isFinite(r))throw new TypeError("z component for noise() must be finite");return n=u(n,1),(i=u(i,1))*a.noise3D(e*n,t*n,r*n)},noise4D:function(e,t,r,n,i,o){if(!isFinite(e))throw new TypeError("x component for noise() must be finite");if(!isFinite(t))throw new TypeError("y component for noise() must be finite");if(!isFinite(r))throw new TypeError("z component for noise() must be finite");if(!isFinite(n))throw new TypeError("w component for noise() must be finite");return i=u(i,1),(o=u(o,1))*a.noise4D(e*i,t*i,r*i,n*i)},sign:function(){return d()?1:-1},boolean:d,chance:function(e){if("number"!=typeof(e=u(e,.5)))throw new TypeError("expected n to be a number");return h()<e},range:m,rangeFloor:b,pick:function(e){return 0===e.length?void 0:e[b(0,e.length)]},shuffle:function(e){if(!Array.isArray(e))throw new TypeError("Expected Array, got "+typeof e);var t,r,n=e.length,a=e.slice();for(;n;)t=Math.floor(h()*n--),r=a[n],a[n]=a[t],a[t]=r;return a},onCircle:v,insideCircle:function(e,t){e=u(e,1),v(1,t=t||[]);var r=e*Math.sqrt(h());return t[0]*=r,t[1]*=r,t},onSphere:function(e,t){e=u(e,1),t=t||[];var r=h()*Math.PI*2,n=2*h()-1,a=r,i=Math.acos(n);return t[0]=e*Math.sin(i)*Math.cos(a),t[1]=e*Math.sin(i)*Math.sin(a),t[2]=e*Math.cos(i),t},insideSphere:function(e,t){e=u(e,1),t=t||[];var r=h()*Math.PI*2,n=2*h()-1,a=h(),i=r,o=Math.acos(n),f=e*Math.cbrt(a);return t[0]=f*Math.sin(o)*Math.cos(i),t[1]=f*Math.sin(o)*Math.sin(i),t[2]=f*Math.cos(o),t},quaternion:function(e){e=e||[];var t=h(),r=h(),n=h(),a=Math.sqrt(1-t),i=Math.sqrt(t),o=2*Math.PI*r,f=2*Math.PI*n,u=Math.sin(o)*a,s=Math.cos(o)*a,c=Math.sin(f)*i,l=Math.cos(f)*i;return e[0]=u,e[1]=s,e[2]=c,e[3]=l,e},weighted:y,weightedSet:function(e){return 0===(e=e||[]).length?null:e[g(e)].value},weightedSetIndex:g,gaussian:function(e,t){if(e=u(e,0),t=u(t,1),c){c=!1;var r=s;return s=null,e+t*r}var n=0,a=0,i=0;do{n=2*h()-1,a=2*h()-1,i=n*n+a*a}while(i>=1||0===i);var o=Math.sqrt(-2*Math.log(i)/i);return s=a*o,c=!0,e+t*(n*o)}};function l(e,t){"number"==typeof e||"string"==typeof e?n=o(r=e,t):(r=void 0,n=i),a=p(),s=null,c=!1}function h(){return n()}function p(){return new f(n)}function d(){return h()>.5}function m(e,t){if(void 0===t&&(t=e,e=0),"number"!=typeof e||"number"!=typeof t)throw new TypeError("Expected all arguments to be numbers");return h()*(t-e)+e}function b(e,t){if(void 0===t&&(t=e,e=0),"number"!=typeof e||"number"!=typeof t)throw new TypeError("Expected all arguments to be numbers");return Math.floor(m(e,t))}function v(e,t){e=u(e,1),t=t||[];var r=2*h()*Math.PI;return t[0]=e*Math.cos(r),t[1]=e*Math.sin(r),t}function g(e){return 0===(e=e||[]).length?-1:y(e.map((function(e){return e.weight})))}function y(e){if(0===(e=e||[]).length)return-1;var t,r=0;for(t=0;t<e.length;t++)r+=e[t];if(r<=0)throw new Error("Weights must sum to > 0");var n=h()*r;for(t=0;t<e.length;t++){if(n<e[t])return t;n-=e[t]}return 0}}(),c=function(e,t,r){if("number"!=typeof t||"number"!=typeof r)throw new TypeError('Must specify "to" and "from" arguments as numbers');if(t>r){var n=t;t=r,r=n}var a=r-t;if(0===a)return r;return e-a*Math.floor((e-t)/a)};var l=i,h=c,p=Number.EPSILON;function d(e,t,r){return t<r?e<t?t:e>r?r:e:e<r?r:e>t?t:e}function m(e,t,r){return e*(1-r)+t*r}function v(e,t,r){return Math.abs(e-t)<p?0:(r-e)/(t-e)}function y(e,t){return t=l(t,0),"number"==typeof e&&isFinite(e)?e:t}function x(e){if("number"!=typeof e)throw new TypeError("Expected dims argument");return function(t,r){var n;r=l(r,0),null==t?n=r:"number"==typeof t&&isFinite(t)&&(n=t);var a,i=[];if(null==n)for(a=0;a<e;a++)i[a]=y(t[a],r);else for(a=0;a<e;a++)i[a]=n;return i}}function w(e,t,r,n){if(n=n||[],e.length!==t.length)throw new TypeError("min and max array are expected to have the same length");for(var a=0;a<e.length;a++)n[a]=m(e[a],t[a],r);return n}function k(e,t){if("number"!=typeof(e=l(e,0)))throw new TypeError("Expected n argument to be a number");for(var r=[],n=0;n<e;n++)r.push(t);return r}function M(e,t){return(e%t+t)%t}function A(e,t,r,n){return m(e,t,1-Math.exp(-r*n))}var _={mod:M,fract:function(e){return e-Math.floor(e)},sign:function(e){return e>0?1:e<0?-1:0},degToRad:function(e){return e*Math.PI/180},radToDeg:function(e){return 180*e/Math.PI},wrap:h,pingPong:function(e,t){return e=M(e,2*t),t-Math.abs(e-t)},linspace:function(e,t){if("number"!=typeof(e=l(e,0)))throw new TypeError("Expected n argument to be a number");"boolean"==typeof(t=t||{})&&(t={endpoint:!0});var r=l(t.offset,0);return t.endpoint?k(e).map((function(t,n){return e<=1?0:(n+r)/(e-1)})):k(e).map((function(t,n){return(n+r)/e}))},lerp:m,lerpArray:w,inverseLerp:v,lerpFrames:function(e,t,r){t=d(t,0,1);var n=e.length-1,a=t*n,i=Math.floor(a),o=a-i,f=Math.min(i+1,n),u=e[i%e.length],s=e[f%e.length];if("number"==typeof u&&"number"==typeof s)return m(u,s,o);if(Array.isArray(u)&&Array.isArray(s))return w(u,s,o,r);throw new TypeError("Mismatch in value type of two array elements: "+i+" and "+f)},clamp:d,clamp01:function(e){return d(e,0,1)},smoothstep:function(e,t,r){var n=d(v(e,t,r),0,1);return n*n*(3-2*n)},damp:A,dampArray:function(e,t,r,n,a){a=a||[];for(var i=0;i<e.length;i++)a[i]=A(e[i],t[i],r,n);return a},mapRange:function(e,t,r,n,a,i){if(Math.abs(t-r)<p)return n;var o=(e-t)/(r-t)*(a-n)+n;return i&&(a<n?o<a?o=a:o>n&&(o=n):o>a?o=a:o<n&&(o=n)),o},expand2D:x(2),expand3D:x(3),expand4D:x(4)},S={},E={exports:{}},T=i,j=["mm","cm","m","pc","pt","in","ft","px"],D={m:{system:"metric",factor:1},cm:{system:"metric",factor:.01},mm:{system:"metric",factor:.001},pt:{system:"imperial",factor:1/72},pc:{system:"imperial",factor:1/6},in:{system:"imperial",factor:1},ft:{system:"imperial",factor:12}};const C={metric:{unit:"m",ratio:1/.0254},imperial:{unit:"in",ratio:.0254}};E.exports=function(e,t,r,n){if("number"!=typeof e||!isFinite(e))throw new Error("Value must be a finite number");if(!t||!r)throw new Error("Must specify from and to units");var a=T((n=n||{}).pixelsPerInch,96),i=n.precision,o=!1!==n.roundPixel;if(t=t.toLowerCase(),r=r.toLowerCase(),-1===j.indexOf(t))throw new Error('Invalid from unit "'+t+'", must be one of: '+j.join(", "));if(-1===j.indexOf(r))throw new Error('Invalid from unit "'+r+'", must be one of: '+j.join(", "));if(t===r)return e;var f=1,u=1,s=!1;"px"===t&&(u=1/a,t="in"),"px"===r&&(s=!0,f=a,r="in");var c=D[t],l=D[r],h=e*c.factor*u;c.system!==l.system&&(h*=C[c.system].ratio);var p=h/l.factor*f;return s&&o?p=Math.round(p):"number"==typeof i&&isFinite(i)&&(p=function(e,t){return Number(Math.round(e+"e"+t)+"e-"+t)}(p,i)),p},E.exports.units=j;var O=Math.PI,P=2*O,F=P-1e-6;function z(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function B(){return new z}z.prototype=B.prototype={constructor:z,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,r,n){this._+="Q"+ +e+","+ +t+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(e,t,r,n,a,i){this._+="C"+ +e+","+ +t+","+ +r+","+ +n+","+(this._x1=+a)+","+(this._y1=+i)},arcTo:function(e,t,r,n,a){e=+e,t=+t,r=+r,n=+n,a=+a;var i=this._x1,o=this._y1,f=r-e,u=n-t,s=i-e,c=o-t,l=s*s+c*c;if(a<0)throw new Error("negative radius: "+a);if(null===this._x1)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(l>1e-6)if(Math.abs(c*f-u*s)>1e-6&&a){var h=r-i,p=n-o,d=f*f+u*u,m=h*h+p*p,b=Math.sqrt(d),v=Math.sqrt(l),g=a*Math.tan((O-Math.acos((d+l-m)/(2*b*v)))/2),y=g/v,x=g/b;Math.abs(y-1)>1e-6&&(this._+="L"+(e+y*s)+","+(t+y*c)),this._+="A"+a+","+a+",0,0,"+ +(c*h>s*p)+","+(this._x1=e+x*f)+","+(this._y1=t+x*u)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,r,n,a,i){e=+e,t=+t,i=!!i;var o=(r=+r)*Math.cos(n),f=r*Math.sin(n),u=e+o,s=t+f,c=1^i,l=i?n-a:a-n;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+u+","+s:(Math.abs(this._x1-u)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+u+","+s),r&&(l<0&&(l=l%P+P),l>F?this._+="A"+r+","+r+",0,1,"+c+","+(e-o)+","+(t-f)+"A"+r+","+r+",0,1,"+c+","+(this._x1=u)+","+(this._y1=s):l>1e-6&&(this._+="A"+r+","+r+",0,"+ +(l>=O)+","+c+","+(this._x1=e+r*Math.cos(a))+","+(this._y1=t+r*Math.sin(a))))},rect:function(e,t,r,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var L=t(Object.freeze({__proto__:null,path:B}));function I(e){return[e[0],e[1]]}function R(e,t){return[e,t]}var q=function(e){var t="number"==typeof(e=e||{}).recursion?e.recursion:8,r="number"==typeof e.epsilon?e.epsilon:1.1920929e-7,n="number"==typeof e.pathEpsilon?e.pathEpsilon:1,a="number"==typeof e.angleEpsilon?e.angleEpsilon:.01,i=e.angleTolerance||0,o=e.cuspLimit||0;return function(e,t,r,a,i,o){o||(o=[]);var u=n/(i="number"==typeof i?i:1);return function(e,t,r,n,a,i){a.push(I(e));var o=e[0],u=e[1],s=t[0],c=t[1],l=r[0],h=r[1],p=n[0],d=n[1];f(o,u,s,c,l,h,p,d,a,i,0),a.push(I(n))}(e,t,r,a,o,u*=u),o};function f(e,n,u,s,c,l,h,p,d,m,b){if(!(b>t)){var v=Math.PI,g=(e+u)/2,y=(n+s)/2,x=(u+c)/2,w=(s+l)/2,k=(c+h)/2,M=(l+p)/2,A=(g+x)/2,_=(y+w)/2,S=(x+k)/2,E=(w+M)/2,T=(A+S)/2,j=(_+E)/2;if(b>0){var D,C,O=h-e,P=p-n,F=Math.abs((u-h)*P-(s-p)*O),z=Math.abs((c-h)*P-(l-p)*O);if(F>r&&z>r){if((F+z)*(F+z)<=m*(O*O+P*P)){if(i<a)return void d.push(R(T,j));var B=Math.atan2(l-s,c-u);if((D=Math.abs(B-Math.atan2(s-n,u-e)))>=v&&(D=2*v-D),(C=Math.abs(Math.atan2(p-l,h-c)-B))>=v&&(C=2*v-C),D+C<i)return void d.push(R(T,j));if(0!==o){if(D>o)return void d.push(R(u,s));if(C>o)return void d.push(R(c,l))}}}else if(F>r){if(F*F<=m*(O*O+P*P)){if(i<a)return void d.push(R(T,j));if((D=Math.abs(Math.atan2(l-s,c-u)-Math.atan2(s-n,u-e)))>=v&&(D=2*v-D),D<i)return d.push(R(u,s)),void d.push(R(c,l));if(0!==o&&D>o)return void d.push(R(u,s))}}else if(z>r){if(z*z<=m*(O*O+P*P)){if(i<a)return void d.push(R(T,j));if((D=Math.abs(Math.atan2(p-l,h-c)-Math.atan2(l-s,c-u)))>=v&&(D=2*v-D),D<i)return d.push(R(u,s)),void d.push(R(c,l));if(0!==o&&D>o)return void d.push(R(c,l))}}else if((O=T-(e+h)/2)*O+(P=j-(n+p)/2)*P<=m)return void d.push(R(T,j))}f(e,n,g,y,A,_,T,j,d,m,b+1),f(T,j,S,E,k,M,h,p,d,m,b+1)}}}(),G=function(e){var t=0,r=0,n=0,a=0;return e.map((function(e){var i=(e=e.slice())[0],o=i.toUpperCase();if(i!=o)switch(e[0]=o,i){case"a":e[6]+=n,e[7]+=a;break;case"v":e[1]+=a;break;case"h":e[1]+=n;break;default:for(var f=1;f<e.length;)e[f++]+=n,e[f++]+=a}switch(o){case"Z":n=t,a=r;break;case"H":n=e[1];break;case"V":a=e[1];break;case"M":n=t=e[1],a=r=e[2];break;default:n=e[e.length-2],a=e[e.length-1]}return e}))};var H=Math.PI,N=$(120),U=function(e){for(var t,r=[],n=0,a=0,i=0,o=0,f=null,u=null,s=0,c=0,l=0,h=e.length;l<h;l++){var p=e[l],d=p[0];switch(d){case"M":i=p[1],o=p[2];break;case"A":(p=Q(s,c,p[1],p[2],$(p[3]),p[4],p[5],p[6],p[7])).unshift("C"),p.length>7&&(r.push(p.splice(0,7)),p.unshift("C"));break;case"S":var m=s,b=c;"C"!=t&&"S"!=t||(m+=m-n,b+=b-a),p=["C",m,b,p[1],p[2],p[3],p[4]];break;case"T":"Q"==t||"T"==t?(f=2*s-f,u=2*c-u):(f=s,u=c),p=V(s,c,f,u,p[1],p[2]);break;case"Q":f=p[1],u=p[2],p=V(s,c,p[1],p[2],p[3],p[4]);break;case"L":p=W(s,c,p[1],p[2]);break;case"H":p=W(s,c,p[1],c);break;case"V":p=W(s,c,s,p[1]);break;case"Z":p=W(s,c,i,o)}t=d,s=p[p.length-2],c=p[p.length-1],p.length>4?(n=p[p.length-4],a=p[p.length-3]):(n=s,a=c),r.push(p)}return r};function W(e,t,r,n){return["C",e,t,r,n,r,n]}function V(e,t,r,n,a,i){return["C",e/3+2/3*r,t/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}function Q(e,t,r,n,a,i,o,f,u,s){if(s)y=s[0],x=s[1],v=s[2],g=s[3];else{var c=Y(e,t,-a);e=c.x,t=c.y;var l=(e-(f=(c=Y(f,u,-a)).x))/2,h=(t-(u=c.y))/2,p=l*l/(r*r)+h*h/(n*n);p>1&&(r*=p=Math.sqrt(p),n*=p);var d=r*r,m=n*n,b=(i==o?-1:1)*Math.sqrt(Math.abs((d*m-d*h*h-m*l*l)/(d*h*h+m*l*l)));b==1/0&&(b=1);var v=b*r*h/n+(e+f)/2,g=b*-n*l/r+(t+u)/2,y=Math.asin(((t-g)/n).toFixed(9)),x=Math.asin(((u-g)/n).toFixed(9));(y=e<v?H-y:y)<0&&(y=2*H+y),(x=f<v?H-x:x)<0&&(x=2*H+x),o&&y>x&&(y-=2*H),!o&&x>y&&(x-=2*H)}if(Math.abs(x-y)>N){var w=x,k=f,M=u;x=y+N*(o&&x>y?1:-1);var A=Q(f=v+r*Math.cos(x),u=g+n*Math.sin(x),r,n,a,0,o,k,M,[x,w,v,g])}var _=Math.tan((x-y)/4),S=4/3*r*_,E=4/3*n*_,T=[2*e-(e+S*Math.sin(y)),2*t-(t-E*Math.cos(y)),f+S*Math.sin(x),u-E*Math.cos(x),f,u];if(s)return T;A&&(T=T.concat(A));for(var j=0;j<T.length;){var D=Y(T[j],T[j+1],a);T[j++]=D.x,T[j++]=D.y}return T}function Y(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function $(e){return e*(H/180)}var X=q,J=G,Z=U,K=function(e,t){return e[0]=t[0],e[1]=t[1],e};function ee(e,t,r){return e[0]=t,e[1]=r,e}var te=[0,0],re=[0,0],ne=[0,0];var ae=function(e){var t=[];return e.replace(oe,(function(e,r,n){var a=r.toLowerCase();for(n=function(e){var t=e.match(fe);return t?t.map(Number):[]}(n),"m"==a&&n.length>2&&(t.push([r].concat(n.splice(0,2))),a="l",r="m"==r?"l":"L");;){if(n.length==ie[a])return n.unshift(r),t.push(n);if(n.length<ie[a])throw new Error("malformed path data");t.push([r].concat(n.splice(0,ie[a])))}})),t},ie={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},oe=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var fe=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var ue=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,f=e[Symbol.iterator]();!(n=(o=f.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&f.return&&f.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},se=2*Math.PI,ce=function(e,t,r,n,a,i,o){var f=e.x,u=e.y;return{x:n*(f*=t)-a*(u*=r)+i,y:a*f+n*u+o}},le=function(e,t){var r=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:4/3*Math.tan(t/4),n=Math.cos(e),a=Math.sin(e),i=Math.cos(e+t),o=Math.sin(e+t);return[{x:n-a*r,y:a+n*r},{x:i+o*r,y:o-i*r},{x:i,y:o}]},he=function(e,t,r,n){var a=e*r+t*n;return a>1&&(a=1),a<-1&&(a=-1),(e*n-t*r<0?-1:1)*Math.acos(a)},pe=function(e){for(var t,r=[],n=0,a=0,i=0,o=0,f=null,u=null,s=0,c=0,l=0,h=e.length;l<h;l++){var p=e[l],d=p[0];switch(d){case"M":i=p[1],o=p[2];break;case"A":var m=de({px:s,py:c,cx:p[6],cy:p[7],rx:p[1],ry:p[2],xAxisRotation:p[3],largeArcFlag:p[4],sweepFlag:p[5]});if(!m.length)continue;for(var b,v=0;v<m.length;v++)b=m[v],p=["C",b.x1,b.y1,b.x2,b.y2,b.x,b.y],v<m.length-1&&r.push(p);break;case"S":var g=s,y=c;"C"!=t&&"S"!=t||(g+=g-n,y+=y-a),p=["C",g,y,p[1],p[2],p[3],p[4]];break;case"T":"Q"==t||"T"==t?(f=2*s-f,u=2*c-u):(f=s,u=c),p=be(s,c,f,u,p[1],p[2]);break;case"Q":f=p[1],u=p[2],p=be(s,c,p[1],p[2],p[3],p[4]);break;case"L":p=me(s,c,p[1],p[2]);break;case"H":p=me(s,c,p[1],c);break;case"V":p=me(s,c,s,p[1]);break;case"Z":p=me(s,c,i,o)}t=d,s=p[p.length-2],c=p[p.length-1],p.length>4?(n=p[p.length-4],a=p[p.length-3]):(n=s,a=c),r.push(p)}return r},de=t(Object.freeze({__proto__:null,default:function(e){var t=e.px,r=e.py,n=e.cx,a=e.cy,i=e.rx,o=e.ry,f=e.xAxisRotation,u=void 0===f?0:f,s=e.largeArcFlag,c=void 0===s?0:s,l=e.sweepFlag,h=void 0===l?0:l,p=[];if(0===i||0===o)return[];var d=Math.sin(u*se/360),m=Math.cos(u*se/360),b=m*(t-n)/2+d*(r-a)/2,v=-d*(t-n)/2+m*(r-a)/2;if(0===b&&0===v)return[];i=Math.abs(i),o=Math.abs(o);var g=Math.pow(b,2)/Math.pow(i,2)+Math.pow(v,2)/Math.pow(o,2);g>1&&(i*=Math.sqrt(g),o*=Math.sqrt(g));var y=function(e,t,r,n,a,i,o,f,u,s,c,l){var h=Math.pow(a,2),p=Math.pow(i,2),d=Math.pow(c,2),m=Math.pow(l,2),b=h*p-h*m-p*d;b<0&&(b=0),b/=h*m+p*d;var v=(b=Math.sqrt(b)*(o===f?-1:1))*a/i*l,g=b*-i/a*c,y=s*v-u*g+(e+r)/2,x=u*v+s*g+(t+n)/2,w=(c-v)/a,k=(l-g)/i,M=(-c-v)/a,A=(-l-g)/i,_=he(1,0,w,k),S=he(w,k,M,A);return 0===f&&S>0&&(S-=se),1===f&&S<0&&(S+=se),[y,x,_,S]}(t,r,n,a,i,o,c,h,d,m,b,v),x=ue(y,4),w=x[0],k=x[1],M=x[2],A=x[3],_=Math.abs(A)/(se/4);Math.abs(1-_)<1e-7&&(_=1);var S=Math.max(Math.ceil(_),1);A/=S;for(var E=0;E<S;E++)p.push(le(M,A)),M+=A;return p.map((function(e){var t=ce(e[0],i,o,m,d,w,k),r=t.x,n=t.y,a=ce(e[1],i,o,m,d,w,k),f=a.x,u=a.y,s=ce(e[2],i,o,m,d,w,k);return{x1:r,y1:n,x2:f,y2:u,x:s.x,y:s.y}}))}}));function me(e,t,r,n){return["C",e,t,r,n,r,n]}function be(e,t,r,n,a,i){return["C",e/3+2/3*r,t/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}var ve={},ge={exports:{}};!function(e){var t=function(){function e(e,t){return null!=t&&e instanceof t}var t,r,n;try{t=Map}catch(e){t=function(){}}try{r=Set}catch(e){r=function(){}}try{n=Promise}catch(e){n=function(){}}function a(i,f,u,s,c){"object"==typeof f&&(u=f.depth,s=f.prototype,c=f.includeNonEnumerable,f=f.circular);var l=[],h=[],p="undefined"!=typeof Buffer;return void 0===f&&(f=!0),void 0===u&&(u=1/0),function i(u,d){if(null===u)return null;if(0===d)return u;var m,b;if("object"!=typeof u)return u;if(e(u,t))m=new t;else if(e(u,r))m=new r;else if(e(u,n))m=new n((function(e,t){u.then((function(t){e(i(t,d-1))}),(function(e){t(i(e,d-1))}))}));else if(a.__isArray(u))m=[];else if(a.__isRegExp(u))m=new RegExp(u.source,o(u)),u.lastIndex&&(m.lastIndex=u.lastIndex);else if(a.__isDate(u))m=new Date(u.getTime());else{if(p&&Buffer.isBuffer(u))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(u.length):new Buffer(u.length),u.copy(m),m;e(u,Error)?m=Object.create(u):void 0===s?(b=Object.getPrototypeOf(u),m=Object.create(b)):(m=Object.create(s),b=s)}if(f){var v=l.indexOf(u);if(-1!=v)return h[v];l.push(u),h.push(m)}for(var g in e(u,t)&&u.forEach((function(e,t){var r=i(t,d-1),n=i(e,d-1);m.set(r,n)})),e(u,r)&&u.forEach((function(e){var t=i(e,d-1);m.add(t)})),u){var y;b&&(y=Object.getOwnPropertyDescriptor(b,g)),y&&null==y.set||(m[g]=i(u[g],d-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);for(g=0;g<x.length;g++){var w=x[g];(!(M=Object.getOwnPropertyDescriptor(u,w))||M.enumerable||c)&&(m[w]=i(u[w],d-1),M.enumerable||Object.defineProperty(m,w,{enumerable:!1}))}}if(c){var k=Object.getOwnPropertyNames(u);for(g=0;g<k.length;g++){var M,A=k[g];(M=Object.getOwnPropertyDescriptor(u,A))&&M.enumerable||(m[A]=i(u[A],d-1),Object.defineProperty(m,A,{enumerable:!1}))}}return m}(i,u)}function i(e){return Object.prototype.toString.call(e)}function o(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return a.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},a.__objToStr=i,a.__isDate=function(e){return"object"==typeof e&&"[object Date]"===i(e)},a.__isArray=function(e){return"object"==typeof e&&"[object Array]"===i(e)},a.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===i(e)},a.__getRegExpFlags=o,a}();e.exports&&(e.exports=t)}(ge);var ye={};ye.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n};var xe=ge.exports,we=ye.squaredDistance;function ke(e,t,r){var n=Math.min(t,r),a=Math.max(t,r),i=(e=e.slice())[n],o=e[a],f=i.concat(o.slice(1));return e.splice(a,1),e.splice(n,1,f),e}ve.sort=function(e){if(!(e=xe(e)).length)return e;var t=[];for(t.push(e[0]),e=e.slice(1);e.length;){var r=t[t.length-1],n=r[r.length-1],a=e.reduce((function(e,t,r){var a=t[0],i=t[t.length-1],o=we(n,a),f=we(n,i);return e?o<e.distance?{idx:r,distance:o,reverse:!1}:f<e.distance?{idx:r,distance:f,reverse:!0}:e:{idx:r,distance:Math.min(o,f),reverse:f<o}}),null),i=a.idx,o=a.reverse,f=e.splice(i,1)[0].slice();o&&f.reverse(),t.push(f)}return t},ve.merge=function(e,t){var r=(t=null!=t?t:.05)*t;e=xe(e);for(var n=1;n<e.length;n++){var a=e[n-1],i=e[n];we(i[0],a[a.length-1])<r&&(e=ke(e,n-1,n),n-=1)}return e};var Me={exports:{}},Ae=_e;function _e(e,t,r){var n,a,i,o,f,u=e.length,s=Ee(e[0],t),c=[];for(r||(r=[]),n=1;n<u;n++){for(a=e[n-1],o=f=Ee(i=e[n],t);;){if(!(s|o)){c.push(a),o!==f?(c.push(i),n<u-1&&(r.push(c),c=[])):n===u-1&&c.push(i);break}if(s&o)break;s?s=Ee(a=Se(a,i,s,t),t):o=Ee(i=Se(a,i,o,t),t)}s=f}return c.length&&r.push(c),r}function Se(e,t,r,n){return 8&r?[e[0]+(t[0]-e[0])*(n[3]-e[1])/(t[1]-e[1]),n[3]]:4&r?[e[0]+(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1]),n[1]]:2&r?[n[2],e[1]+(t[1]-e[1])*(n[2]-e[0])/(t[0]-e[0])]:1&r?[n[0],e[1]+(t[1]-e[1])*(n[0]-e[0])/(t[0]-e[0])]:null}function Ee(e,t){var r=0;return e[0]<t[0]?r|=1:e[0]>t[2]&&(r|=2),e[1]<t[1]?r|=4:e[1]>t[3]&&(r|=8),r}_e.polyline=_e,_e.polygon=function(e,t){var r,n,a,i,o,f,u;for(n=1;n<=8;n*=2){for(r=[],a=e[e.length-1],i=!(Ee(a,t)&n),o=0;o<e.length;o++)f=e[o],(u=!(Ee(f,t)&n))!==i&&r.push(Se(a,f,n,t)),u&&r.push(f),a=f,i=u;if(!(e=r).length)break}return r};var Te=Math.abs,je=Math.min;function De(e,t,r,n){var a=Te(e-t);return null==r&&(r=De.DBL_EPSILON),null==n&&(n=r),a<=r||(a<=n*je(Te(e),Te(t))||e===t)}De.FLT_EPSILON=1.1920929e-7,De.DBL_EPSILON=2220446049250313e-31;var Ce=De,Oe=Object.prototype.toString,Pe=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===Oe.call(e.buffer)||Array.isArray(e)};var Fe=Math.abs,ze=Math.min;function Be(e,t,r,n){var a=Fe(e-t);return a<=r||(a<=n*ze(Fe(e),Fe(t))||e===t)}Be.FLT_EPSILON=1.1920929e-7,Be.DBL_EPSILON=2220446049250313e-31;var Le=Pe,Ie=Be,Re=function(e,t,r,n){return!!(e&&t&&Le(e)&&Le(t))&&(e.length===t.length&&("number"!=typeof r&&(r=Ie.FLT_EPSILON),"number"!=typeof n&&(n=r),Array.prototype.slice.call(e).every((function(e,a){var i=t[a];return e===i||Ie(e,i,r,n)}))))},qe=Ce,Ge=function(e,t,r,n,a){return function(e,t,r,n,a,i,o,f){null==f&&(f=[]);var u,s,c,l,h,p=He(e,t,a,i,o),d=He(r,n,a,i,o);if(p&&d)return f.push([e,t]),f.push([r,n]),!0;if(p||d){c=function(e,t,r,n,a,i){var o=r-e,f=n-t,u=(o*(a-e)+f*(i-t))/(o*o+f*f);return[e+u*o,t+u*f]}(e,t,r,n,a,i),u=Ne(l=c[0],h=c[1],a,i),s=Math.sqrt(o*o-u*u);var m=p?[e,t]:[r,n],b=p?Ue(l,h,r,n,s):Ue(l,h,e,t,s);return qe(m[0],b[0])&&qe(m[1],b[1])?(f.push(m),!0):(f.push(m),f.push(b),!0)}return c=function(e,t,r,n,a,i){var o=r-e,f=n-t,u=o*(a-e)+f*(i-t);if(u<=0)return[e,t];var s=o*o+f*f;if(s<=u)return[r,n];var c=u/s;return[e+c*o,t+c*f]}(e,t,r,n,a,i),l=c[0],h=c[1],!(qe(e,l)&&qe(t,h)||qe(r,l)&&qe(n,h))&&(!((u=Ne(l,h,a,i))>o)&&(qe(u,o)?(f.push([l,h]),!0):qe(u,0)?(f.push(Ue(a,i,e,t,o)),f.push(Ue(a,i,r,n,o)),!0):(s=Math.sqrt(o*o-u*u),f.push(Ue(l,h,e,t,s)),f.push(Ue(l,h,r,n,s)),!0)))}(e[0],e[1],t[0],t[1],r[0],r[1],n,a)};function He(e,t,r,n,a){return(i=r-e)*i+(o=n-t)*o<=a*a;var i,o}function Ne(e,t,r,n){var a=e-r,i=t-n;return Math.sqrt(a*a+i*i)}function Ue(e,t,r,n,a){var i=a/Ne(e,t,r,n);return[e+i*(r-e),t+i*(n-t)]}var We=Ce,Ve=function(e,t,r,n,a){null==a&&(a=[]);var i,o=Qe(t[0]-e[0])+Qe(t[1]-e[1]),f=2*((t[0]-e[0])*(e[0]-r[0])+(t[1]-e[1])*(e[1]-r[1])),u=Qe(r[0])+Qe(r[1])+Qe(e[0])+Qe(e[1])-2*(r[0]*e[0]+r[1]*e[1])-Qe(n),s=f*f-4*o*u;if(s<0)return!1;if(We(s,0))return i=-f/(2*o),a.push([e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])]),!0;if(s>0){var c=Math.sqrt(s);return i=(-f+c)/(2*o),a.push([e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])]),i=(-f-c)/(2*o),a.push([e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])]),!0}return null};function Qe(e){return e*e}!function(e){var t=Ae,r=Ce,n=Re,a=ge.exports,i=ye.squaredDistance;e.exports.arePointsCollinear=function(e,t,n){var a=e[0],i=e[1],o=t[0],f=t[1],u=n[0],s=n[1];return r((i-f)*(a-u),(i-s)*(a-o))},e.exports.removeDuplicatePoints=function(e){for(var t,r=[],i=0;i<e.length;i++){var o=e[i];t&&n(t,o)||(r.push(o),t=o)}return a(r)},e.exports.removeCollinearPoints=function(t){for(var r=[],n=a(t);n.length>=3;){var o=n[0],f=n[1],u=n[2],s=e.exports.arePointsCollinear(o,f,u);if(s)i(o,f)>i(o,u)&&(s=!1);if(s)n.splice(1,1);else for(var c=0;c<1;c++)r.push(n.shift())}for(;n.length;)r.push(n.shift());return r},e.exports.clipSegmentToCircle=Ge,e.exports.clipLineToCircle=Ve,e.exports.clipPolylinesToBox=function(e,r,n,a){if(!Array.isArray(r)||2!==r.length&&4!==r.length)throw new Error("Expected box to either be format [ minPoint, maxPoint ] or [ minX, minY, maxX, maxY ]");if(2===r.length){var i=r[0],o=r[1];r=[i[0],i[1],o[0],o[1]]}return a=!1!==a,(n=Boolean(n))?e.map((function(e){var n=t.polygon(e,r);return a&&n.length>2&&n.push(n[0]),n})).filter((function(e){return e.length>0})):e.map((function(e){return t.polyline(e,r)})).reduce((function(e,t){return e.concat(t)}),[])},e.exports.createHatchLines=function(e,t,r,n){if(!Array.isArray(e)||2!==e.length&&4!==e.length)throw new Error("Expected box to either be format [ minPoint, maxPoint ] or [ minX, minY, maxX, maxY ]");if(2===e.length){var a=e[0],i=e[1];e=[a[0],a[1],i[0],i[1]]}null==t&&(t=-Math.PI/4);null==r&&(r=.5);null==n&&(n=[]);if(0===(r=Math.abs(r)))throw new Error("cannot use a spacing of zero as it will run an infinite loop!");var o=e[0],f=e[1],u=e[2],s=e[3],c=u-o,l=s-f;if(0===c||0===l)return n;var h=Math.sqrt(c*c+l*l)/2,p=Math.PI/2-t,d=Math.cos(p),m=Math.sin(p),b=o+c/2,v=f+l/2,g=-h;for(;g<=h;){var y=b+g*d+h*m,x=v+g*m-h*d,w=b+g*d-h*m,k=v+g*m+h*d;g+=r,y<o&&w<o||y>u&&w>u||(x<f&&k<f||x>s&&k>s||n.push([[y,x],[w,k]]))}return n},e.exports.getBounds=function(e){var t=e.length;if(0===t)throw new Error("Expected points to be a non-empty array");for(var r=e[0].length,n=e[0].slice(),a=e[0].slice(),i=1;i<t;++i)for(var o=e[i],f=0;f<r;++f){var u=o[f];n[f]=Math.min(n[f],u),a[f]=Math.max(a[f],u)}return[n,a]}}(Me);var Ye=i,$e=E.exports,Xe=L,Je=function(e,t){var r=[],n=[],a=[0,0];return Z(J(e)).forEach((function(e,i,o){if("M"===e[0])K(a,e.slice(1)),n.length>0&&(r.push(n),n=[]);else{if("C"!==e[0])throw new Error("illegal type in SVG: "+e[0]);!function(e,t,r,n){X(r,ee(te,n[1],n[2]),ee(re,n[3],n[4]),ee(ne,n[5],n[6]),t,e)}(n,t,a,e),ee(a,e[5],e[6])}})),n.length>0&&r.push(n),r},Ze=ae,Ke=G,et=pe,tt=ve,rt=Me.exports;function nt(e,t){var r=ut(e,t=t||{});return(Array.isArray(r)?r:[r]).filter(Boolean)}function at(e,t){var r;if(null!=(t=t||{}).curveResolution&&isFinite(t.curveResolution)&&"number"==typeof t.curveResolution)r=t.curveResolution;else{var n=t.units||"px";r=Math.max(1,$e(4,n,"px"))}var a=[];return st(e,(function(e){if("string"==typeof e){var t=Ze(e);Je(t,r).forEach((function(e){a.push(e)}))}else{var n=e.map((function(e){return[e[0]||0,e[1]||0]}));a.push(n)}})),a}function it(e,t){var r=(t=t||{}).width,n=t.height;if(void 0===r||void 0===n)throw new Error('Must specify "width" and "height" options');var a="px",i=t.units||a,o={units:i,viewUnits:"px",roundPixel:!1,precision:Ye(t.precision,5),pixelsPerInch:90};if(e=at(e,Object.assign({},o,{curveResolution:t.curveResolution||void 0})),t.optimize){var f="object"==typeof t.optimize?t.optimize:{sort:!0,merge:!0,removeDuplicates:!0,removeCollinear:!0},u=!1!==f.sort,s=!1!==f.merge,c=!1!==f.removeDuplicates,l=!1!==f.removeCollinear;if(c&&(e=e.map((function(e){return rt.removeDuplicatePoints(e)}))),l&&(e=e.map((function(e){return rt.removeCollinearPoints(e)}))),u&&(e=tt.sort(e)),s){var h=null!=f.mergeThreshold?f.mergeThreshold:$e(.25,"mm",i,{pixelsPerInch:90});e=tt.merge(e,h)}}var p=nt(e,o),d=$e(r,i,a,o).toString(),m=$e(n,i,a,o).toString(),b=t.fillStyle||"none",v=t.strokeStyle||"black",g=t.lineWidth,y=t.lineJoin,x=t.lineCap;void 0===g&&(g=$e(.03,"cm",i,o).toString());var w=p.map((function(e){return" <path "+ot([["d",e]])+" />"})).join("\n");return['<?xml version="1.0" standalone="no"?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ',' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">','<svg width="'+r+i+'" height="'+n+i+'"',' xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+d+" "+m+'">'," <g "+ot([["fill",b],["stroke",v],["stroke-width",g+""+i],!!y&&["stroke-linejoin",y],!!x&&["stroke-linecap",x]])+">",w," </g>","</svg>"].join("\n")}function ot(e){return e.filter(Boolean).map((function(e){return e[0]+'="'+e[1]+'"'})).join(" ")}function ft(e,t){var r=(t=t||{}).context;if(!r)throw new Error('Must specify "context" options');var n=t.units||"px",a=t.width,i=t.height;if(void 0===a||void 0===i)throw new Error('Must specify "width" and "height" options');var o=t.lineWidth;return void 0===o&&(o=$e(.03,"cm",n,{roundPixel:!1,pixelsPerInch:90})),r.clearRect(0,0,a,i),r.fillStyle=t.background||"white",r.fillRect(0,0,a,i),r.strokeStyle=t.foreground||t.strokeStyle||"black",r.lineWidth=o,r.lineJoin=t.lineJoin||"miter",r.lineCap=t.lineCap||"butt",st(e,(function(e){r.beginPath(),"string"==typeof e?ct(r,e):e.forEach((function(e){r.lineTo(e[0],e[1])})),r.stroke()})),[r.canvas,{data:it(e,t),extension:".svg"}]}function ut(e,t){return ht(e)?"":"string"==typeof e?e:pt(e)?e.toString():dt(e)?lt(e,t):Array.isArray(e)?e.map((function(e){return ut(e,t)})).reduce((function(e,t){return e.concat(t)}),[]):""}function st(e,t){ht(e)||("string"==typeof e||pt(e)?t(e.toString()):dt(e)?t(e):Array.isArray(e)&&e.forEach((function(e){return st(e,t)})))}function ct(e,t){for(var r=et(Ke(Ze(t))),n=0;n<r.length;n++){var a=r[n],i=a[0];if("M"===i)e.moveTo(a[1],a[2]);else{if("C"!==i)throw new Error('Illegal type "'+i+'" in SVG commands');e.bezierCurveTo(a[1],a[2],a[3],a[4],a[5],a[6])}}}function lt(e,t){var r=(t=t||{}).units||"px",n=t.viewUnits||r,a=[],i={roundPixel:!1,precision:Ye(t.precision,5),pixelsPerInch:90};return e.forEach((function(e,t){var o=0===t?"M":"L",f=$e(e[0],r,n,i).toString(),u=$e(e[1],r,n,i).toString();a.push(o+f+" "+u)})),a.join(" ")}function ht(e){return!e||Array.isArray(e)&&0===e.length}function pt(e){return"object"==typeof e&&e&&!Array.isArray(e)}function dt(e){return!(!e||!Array.isArray(e)||0===e.length)&&(t=e[0],Array.isArray(t)&&t.length>=2&&t.every((function(e){return"number"==typeof e})));var t}S.createPath=function(e){var t=Xe.path();"function"==typeof e&&e(t);return t.lineTo=r(t.lineTo),t.quadraticCurveTo=r(t.quadraticCurveTo),t.bezierCurveTo=r(t.bezierCurveTo),t;function r(e){return function(){var r=Array.prototype.slice.call(arguments);return null==t._x1&&null==t._y1&&t.moveTo(r[0],r[1]),e.apply(t,r)}}},S.pathsToSVGPaths=nt,S.pathsToPolylines=at,S.pathsToSVG=it,S.renderPaths=ft,S.convertToSVGPath=ut,S.eachPath=st,S.drawSVGPath=ct,S.polylineToSVGPath=lt,S.polylinesToSVG=function(e,t){if(!Array.isArray(e))throw new Error("Expected array of arrays for polylines");return console.warn("polylinesToSVG is deprecated, use pathsToSVG instead which has the same functionality"),it(e,t)},S.renderPolylines=function(e,t){if(!Array.isArray(e))throw new Error("Expected array of arrays for polylines");return console.warn("renderPolylines is deprecated, use renderPaths instead which has the same functionality"),ft(e,t)};var mt={exports:{}};mt.exports=function(){var e=function(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array||e instanceof Uint8ClampedArray},t=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]=t[r[n]];return e},r="\n";function n(e){return"undefined"!=typeof atob?atob(e):"base64:"+e}function a(e){var t=new Error("(regl) "+e);throw console.error(t),t}function i(e,t){e||a(t)}function o(e){return e?": "+e:""}function f(e,t,r){e in t||a("unknown parameter ("+e+")"+o(r)+". possible values: "+Object.keys(t).join())}function u(t,r){e(t)||a("invalid parameter type"+o(r)+". must be a typed array")}function s(e,t,r){typeof e!==t&&a("invalid parameter type"+o(r)+". expected "+t+", got "+typeof e)}function c(e,t){e>=0&&(0|e)===e||a("invalid parameter type, ("+e+")"+o(t)+". must be a nonnegative integer")}function l(e,t,r){t.indexOf(e)<0&&a("invalid value"+o(r)+". must be one of: "+t)}var h=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function p(e){Object.keys(e).forEach((function(e){h.indexOf(e)<0&&a('invalid regl constructor argument "'+e+'". must be one of '+h)}))}function d(e,t){for(e+="";e.length<t;)e=" "+e;return e}function m(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function b(e,t){this.number=e,this.line=t,this.errors=[]}function v(e,t,r){this.file=e,this.line=t,this.message=r}function g(){var e=new Error,t=(e.stack||e).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);return n?n[1]:"unknown"}function y(){var e=new Error,t=(e.stack||e).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return n?n[1]:"unknown"}function x(e,t){var r=e.split("\n"),a=1,i=0,o={unknown:new m,0:new m};o.unknown.name=o[0].name=t||g(),o.unknown.lines.push(new b(0,""));for(var f=0;f<r.length;++f){var u=r[f],s=/^\s*\#\s*(\w+)\s+(.+)\s*$/.exec(u);if(s)switch(s[1]){case"line":var c=/(\d+)(\s+\d+)?/.exec(s[2]);c&&(a=0|c[1],c[2]&&((i=0|c[2])in o||(o[i]=new m)));break;case"define":var l=/SHADER_NAME(_B64)?\s+(.*)$/.exec(s[2]);l&&(o[i].name=l[1]?n(l[2]):l[2])}o[i].lines.push(new b(a++,u))}return Object.keys(o).forEach((function(e){var t=o[e];t.lines.forEach((function(e){t.index[e.number]=e}))})),o}function w(e){var t=[];return e.split("\n").forEach((function(e){if(!(e.length<5)){var r=/^ERROR\:\s+(\d+)\:(\d+)\:\s*(.*)$/.exec(e);r?t.push(new v(0|r[1],0|r[2],r[3].trim())):e.length>0&&t.push(new v("unknown",0,e))}})),t}function k(e,t){t.forEach((function(t){var r=e[t.file];if(r){var n=r.index[t.line];if(n)return n.errors.push(t),void(r.hasErrors=!0)}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)}))}function M(e,t,n,a,o){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(t),u=a===e.FRAGMENT_SHADER?"fragment":"vertex";D(n,"string",u+" shader source must be a string",o);var s=x(n,o),c=w(f);k(s,c),Object.keys(s).forEach((function(e){var t=s[e];if(t.hasErrors){var n=[""],a=[""];i("file number "+e+": "+t.name+"\n","color:red;text-decoration:underline;font-weight:bold"),t.lines.forEach((function(e){if(e.errors.length>0){i(d(e.number,4)+"| ","background-color:yellow; font-weight:bold"),i(e.line+r,"color:red; background-color:yellow; font-weight:bold");var t=0;e.errors.forEach((function(n){var a=n.message,o=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(o){var f=o[1];a=o[2],"assign"===f&&(f="="),t=Math.max(e.line.indexOf(f,t),0)}else t=0;i(d("| ",6)),i(d("^^^",t+3)+r,"font-weight:bold"),i(d("| ",6)),i(a+r,"font-weight:bold")})),i(d("| ",6)+r)}else i(d(e.number,4)+"| "),i(e.line+r,"color:red")})),"undefined"==typeof document||window.chrome?console.log(n.join("")):(a[0]=n.join("%c"),console.log.apply(console,a))}function i(e,t){n.push(e),a.push(t||"")}})),i.raise("Error compiling "+u+" shader, "+s[0].name)}}function A(e,t,n,a,o){if(!e.getProgramParameter(t,e.LINK_STATUS)){var f=e.getProgramInfoLog(t),u=x(n,o),s='Error linking program with vertex shader, "'+x(a,o)[0].name+'", and fragment shader "'+u[0].name+'"';"undefined"!=typeof document?console.log("%c"+s+r+"%c"+f,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(s+r+f),i.raise(s)}}function _(e){e._commandRef=g()}function S(e,t,r,n){function a(e){return e?n.id(e):0}function i(e,t){Object.keys(t).forEach((function(t){e[n.id(t)]=!0}))}_(e),e._fragId=a(e.static.frag),e._vertId=a(e.static.vert);var o=e._uniformSet={};i(o,t.static),i(o,t.dynamic);var f=e._attributeSet={};i(f,r.static),i(f,r.dynamic),e._hasCount="count"in e.static||"count"in e.dynamic||"elements"in e.static||"elements"in e.dynamic}function E(e,t){var r=y();a(e+" in command "+(t||g())+("unknown"===r?"":" called from "+r))}function T(e,t,r){e||E(t,r||g())}function j(e,t,r,n){e in t||E("unknown parameter ("+e+")"+o(r)+". possible values: "+Object.keys(t).join(),n||g())}function D(e,t,r,n){typeof e!==t&&E("invalid parameter type"+o(r)+". expected "+t+", got "+typeof e,n||g())}function C(e){e()}function O(e,t,r){e.texture?l(e.texture._texture.internalformat,t,"unsupported texture format for attachment"):l(e.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}var P=33071,F=9728,z=9984,B=9985,L=9986,I=9987,R=5121,q=5122,G=5123,H=5124,N=5125,U=5126,W=32819,V=32820,Q=33635,Y=34042,$=36193,X={};function J(e,t){return e===V||e===W||e===Q?2:e===Y?4:X[e]*t}function Z(e){return!(e&e-1||!e)}function K(e,t,r){var n,a=t.width,o=t.height,f=t.channels;i(a>0&&a<=r.maxTextureSize&&o>0&&o<=r.maxTextureSize,"invalid texture shape"),e.wrapS===P&&e.wrapT===P||i(Z(a)&&Z(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===t.mipmask?1!==a&&1!==o&&i(e.minFilter!==z&&e.minFilter!==L&&e.minFilter!==B&&e.minFilter!==I,"min filter requires mipmap"):(i(Z(a)&&Z(o),"texture must be a square power of 2 to support mipmapping"),i(t.mipmask===(a<<1)-1,"missing or incomplete mipmap data")),t.type===U&&(r.extensions.indexOf("oes_texture_float_linear")<0&&i(e.minFilter===F&&e.magFilter===F,"filter not supported, must enable oes_texture_float_linear"),i(!e.genMipmaps,"mipmap generation not supported with float textures"));var u=t.images;for(n=0;n<16;++n)if(u[n]){var s=a>>n,c=o>>n;i(t.mipmask&1<<n,"missing mipmap data");var l=u[n];if(i(l.width===s&&l.height===c,"invalid shape for mip images"),i(l.format===t.format&&l.internalformat===t.internalformat&&l.type===t.type,"incompatible type for mip image"),l.compressed);else if(l.data){var h=Math.ceil(J(l.type,f)*s/l.unpackAlignment)*l.unpackAlignment;i(l.data.byteLength===h*c,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else e.genMipmaps||i(0==(t.mipmask&1<<n),"extra mipmap data");t.compressed&&i(!e.genMipmaps,"mipmap generation for compressed images not supported")}function ee(e,t,r,n){var a=e.width,o=e.height,f=e.channels;i(a>0&&a<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),i(a===o,"cube map must be square"),i(t.wrapS===P&&t.wrapT===P,"wrap mode not supported by cube map");for(var u=0;u<r.length;++u){var s=r[u];i(s.width===a&&s.height===o,"inconsistent cube map face shape"),t.genMipmaps&&(i(!s.compressed,"can not generate mipmap for compressed textures"),i(1===s.mipmask,"can not specify mipmaps and generate mipmaps"));for(var c=s.images,l=0;l<16;++l){var h=c[l];if(h){var p=a>>l,d=o>>l;i(s.mipmask&1<<l,"missing mipmap data"),i(h.width===p&&h.height===d,"invalid shape for mip images"),i(h.format===e.format&&h.internalformat===e.internalformat&&h.type===e.type,"incompatible type for mip image"),h.compressed||(h.data?i(h.data.byteLength===p*d*Math.max(J(h.type,f),h.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):h.element||h.copy)}}}}X[5120]=X[R]=1,X[q]=X[G]=X[$]=X[Q]=X[W]=X[V]=2,X[H]=X[N]=X[U]=X[Y]=4;var te=t(i,{optional:C,raise:a,commandRaise:E,command:T,parameter:f,commandParameter:j,constructor:p,type:s,commandType:D,isTypedArray:u,nni:c,oneOf:l,shaderError:M,linkError:A,callSite:y,saveCommandRef:_,saveDrawInfo:S,framebufferFormat:O,guessCommand:g,texture2D:K,textureCube:ee}),re=0,ne=0;function ae(e,t){this.id=re++,this.type=e,this.data=t}function ie(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function oe(e){if(0===e.length)return[];var t=e.charAt(0),r=e.charAt(e.length-1);if(e.length>1&&t===r&&('"'===t||"'"===t))return['"'+ie(e.substr(1,e.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(n)return oe(e.substr(0,n.index)).concat(oe(n[1])).concat(oe(e.substr(n.index+n[0].length)));var a=e.split(".");if(1===a.length)return['"'+ie(e)+'"'];for(var i=[],o=0;o<a.length;++o)i=i.concat(oe(a[o]));return i}function fe(e){return"["+oe(e).join("][")+"]"}function ue(e,t){return new ae(e,fe(t+""))}function se(e){return"function"==typeof e&&!e._reglType||e instanceof ae}function ce(e,t){return"function"==typeof e?new ae(ne,e):e}var le={DynamicVariable:ae,define:ue,isDynamic:se,unbox:ce,accessor:fe},he={next:"function"==typeof requestAnimationFrame?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:"function"==typeof cancelAnimationFrame?function(e){return cancelAnimationFrame(e)}:clearTimeout},pe="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function de(){var e={"":0},t=[""];return{id:function(r){var n=e[r];return n||(n=e[r]=t.length,t.push(r),n)},str:function(e){return t[e]}}}function me(e,r,n){var a=document.createElement("canvas");function i(){var r=window.innerWidth,i=window.innerHeight;if(e!==document.body){var o=e.getBoundingClientRect();r=o.right-o.left,i=o.bottom-o.top}a.width=n*r,a.height=n*i,t(a.style,{width:r+"px",height:i+"px"})}function o(){window.removeEventListener("resize",i),e.removeChild(a)}return t(a.style,{border:0,margin:0,padding:0,top:0,left:0}),e.appendChild(a),e===document.body&&(a.style.position="absolute",t(e.style,{margin:0,padding:0})),window.addEventListener("resize",i,!1),i(),{canvas:a,onDestroy:o}}function be(e,t){function r(r){try{return e.getContext(r,t)}catch(e){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}function ve(e){return"string"==typeof e.nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect}function ge(e){return"function"==typeof e.drawArrays||"function"==typeof e.drawElements}function ye(e){return"string"==typeof e?e.split():(te(Array.isArray(e),"invalid extension array"),e)}function xe(e){return"string"==typeof e?(te("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(e)):e}function we(e){var t,r,n,a,i=e||{},o={},f=[],u=[],s="undefined"==typeof window?1:window.devicePixelRatio,c=!1,l=function(e){e&&te.raise(e)},h=function(){};if("string"==typeof i?(te("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),t=document.querySelector(i),te(t,"invalid query string for element")):"object"==typeof i?ve(i)?t=i:ge(i)?n=(a=i).canvas:(te.constructor(i),"gl"in i?a=i.gl:"canvas"in i?n=xe(i.canvas):"container"in i&&(r=xe(i.container)),"attributes"in i&&(o=i.attributes,te.type(o,"object","invalid context attributes")),"extensions"in i&&(f=ye(i.extensions)),"optionalExtensions"in i&&(u=ye(i.optionalExtensions)),"onDone"in i&&(te.type(i.onDone,"function","invalid or missing onDone callback"),l=i.onDone),"profile"in i&&(c=!!i.profile),"pixelRatio"in i&&(s=+i.pixelRatio,te(s>0,"invalid pixel ratio"))):te.raise("invalid arguments to regl"),t&&("canvas"===t.nodeName.toLowerCase()?n=t:r=t),!a){if(!n){te("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var p=me(r||document.body,l,s);if(!p)return null;n=p.canvas,h=p.onDestroy}a=be(n,o)}return a?{gl:a,canvas:n,container:r,extensions:f,optionalExtensions:u,pixelRatio:s,profile:c,onDone:l,onDestroy:h}:(h(),l("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function ke(e,t){var r={};function n(t){te.type(t,"string","extension name must be string");var n,a=t.toLowerCase();try{n=r[a]=e.getExtension(a)}catch(e){}return!!n}for(var a=0;a<t.extensions.length;++a){var i=t.extensions[a];if(!n(i))return t.onDestroy(),t.onDone('"'+i+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return t.optionalExtensions.forEach(n),{extensions:r,restore:function(){Object.keys(r).forEach((function(e){if(!n(e))throw new Error("(regl): error restoring extension "+e)}))}}}function Me(e,t){for(var r=Array(e),n=0;n<e;++n)r[n]=t(n);return r}var Ae=5120,_e=5121,Se=5122,Ee=5123,Te=5124,je=5125,De=5126;function Ce(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}function Oe(e){var t,r;return t=(e>65535)<<4,t|=r=((e>>>=t)>255)<<3,t|=r=((e>>>=r)>15)<<2,(t|=r=((e>>>=r)>3)<<1)|(e>>>=r)>>1}fu