diff --git a/experiments/ribbon01/dist/bundle.js b/experiments/ribbon01/dist/bundle.js index d9d78dc5..6306eab3 100644 --- a/experiments/ribbon01/dist/bundle.js +++ b/experiments/ribbon01/dist/bundle.js @@ -1,2 +1,2 @@ /*! For license information please see bundle.js.LICENSE.txt */ -(()=>{var t,e,n={427:t=>{"use strict";t.exports=function(){try{return!!new Blob}catch(t){return!1}}()},42:(t,e,n)=>{"use strict";var r=n(187).EventEmitter;function o(){r.call(this),this.setMaxListeners(20)}o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.off=function(t,e){return e?this.removeListener(t,e):t?this.removeAllListeners(t):this.removeAllListeners()},t.exports=o},622:(t,e,n)=>{"use strict";var r=n(42),o=n(388),i=0;t.exports=function t(e){var n,a={},s=[],u=[],c=0,h=0,l={},f=function(r){return Array.isArray(r)?(r.forEach(f),n):((i=r.assets&&Array.isArray(r.assets)?t(d(r,e)):o(d(r,e))).once("destroy",m),u.push(i),l[i.id]=i,n);var i},_=function(t){return arguments.length?a[t]?a[t]:l[t]:s},d=function(t,e){return"string"==typeof t&&(t={url:t}),void 0===t.isTouchLocked&&(t.isTouchLocked=e.isTouchLocked),void 0===t.blob&&(t.blob=e.blob),void 0===t.basePath&&(t.basePath=e.basePath),t.id=t.id||t.url||String(++i),t.type=t.type||(n=t.url)&&n.split("?")[0].split(".").pop().toLowerCase(),t.crossOrigin=t.crossOrigin||e.crossOrigin,t.webAudioContext=t.webAudioContext||e.webAudioContext,t.log=e.log,t;var n},E=function(t){var e=c+t;n.emit("progress",e/h)},v=function(t,e,r){Array.isArray(t)&&(t={id:e,file:t,type:r}),c++,n.emit("progress",c/h),a[t.id]=t.file,s.push(t),n.emit("childcomplete",t),x()},p=function(t){h--,n.listeners("error").length?n.emit("error",t):console.error(t),x()},m=function(t){l[t]=null,delete l[t],a[t]=null,delete a[t],s.some((function(e,n){if(e.id===t)return s.splice(n,1),!0}))},x=function(){c>=h&&n.emit("complete",s,a,e.id,"group")};return n=Object.create(r.prototype,{_events:{value:{}},id:{get:function(){return e.id}},add:{value:f},start:{value:function(){return h=u.length,u.forEach((function(t){t.on("progress",E).once("complete",v).once("error",p).start()})),u=[],n}},get:{value:_},find:{value:function(t){if(_(t))return _(t);var e=null;return Object.keys(l).some((function(n){return!!(e=l[n].find&&l[n].find(t))})),e}},getLoader:{value:function(t){return l[t]}},loaded:{get:function(){return c>=h}},file:{get:function(){return s}},destroy:{value:function(){for(;u.length;)u.pop().destroy();return n.off("error"),n.off("progress"),n.off("complete"),s=[],a={},e.webAudioContext=null,h=0,c=0,Object.keys(l).forEach((function(t){l[t].destroy()})),l={},n.emit("destroy",n.id),n}}}),e=d(e||{},{basePath:"",blob:!1,touchLocked:!1,crossOrigin:null,webAudioContext:null,log:!1}),Array.isArray(e.assets)&&f(e.assets),n}},370:(t,e,n)=>{"use strict";var r=n(622);r.stats=n(795),t.exports=r},388:(t,e,n)=>{"use strict";var r=n(42),o=n(427),i=n(795);t.exports=function(t){var e,n,a,s,u,c,h=t.id,l=t.basePath||"",f=t.url,_=t.type,d=t.crossOrigin,E=t.isTouchLocked,v=t.blob&&o,p=t.webAudioContext,m=t.log,x=function(t){t&&(c={id:h,file:t,type:_},e.emit("progress",1),e.emit("complete",c,h,_),I())},T=function(t,e){n=e||R,(a=new XMLHttpRequest).open("GET",l+f,!0),a.responseType=t,a.addEventListener("progress",M),a.addEventListener("load",n),a.addEventListener("error",P),a.send()},M=function(t){t.lengthComputable&&e.emit("progress",t.loaded/t.total)},R=function(){A()&&x(a.response)},A=function(){return a&&a.status<400?(i.update(a,s,f,m),!0):(P(a&&a.statusText),!1)},g=function(){a=new Image,d&&(a.crossOrigin="anonymous"),a.addEventListener("error",P,!1),a.addEventListener("load",b,!1),a.src=l+f},b=function(t){window.clearTimeout(u),t||!a.error&&a.readyState?x(a):P()},L=function(){T("blob",(function(){A()&&((a=new Image).addEventListener("error",P,!1),a.addEventListener("load",S,!1),a.src=window.URL.createObjectURL(a.response))}))},S=function(){window.URL.revokeObjectURL(a.src),x(a)},C=function(){T("arraybuffer",(function(){A()&&p.decodeAudioData(a.response,(function(t){a=null,x(t)}),(function(t){P(t)}))}))},N=function(t){a=document.createElement(t),E||(window.clearTimeout(u),u=window.setTimeout(b,2e3),a.addEventListener("canplaythrough",b,!1)),a.addEventListener("error",P,!1),a.preload="auto",a.src=l+f,a.load(),E&&x(a)},P=function(t){window.clearTimeout(u);var n=t;a&&a.tagName&&a.error?n="MediaError: "+["","ABORTED","NETWORK","DECODE","SRC_NOT_SUPPORTED"][a.error.code]+" "+a.src:a&&a.statusText?n=a.statusText:t&&t.message?n=t.message:t&&t.type&&(n=t.type),e.emit("error",'Error loading "'+l+f+'" '+n),y()},I=function(){e.off("error"),e.off("progress"),e.off("complete"),a&&(a.removeEventListener("progress",M),a.removeEventListener("load",n),a.removeEventListener("error",P),a.removeEventListener("load",b),a.removeEventListener("canplaythrough",b),a.removeEventListener("load",S))},y=function(){I(),a&&a.abort&&a.readyState<4&&a.abort(),a=null,p=null,c=null,window.clearTimeout(u),e.emit("destroy",h)};return e=Object.create(r.prototype,{_events:{value:{}},id:{value:t.id},start:{value:function(){switch(s=Date.now(),_){case"json":T("json",(function(){if(A()){var t=a.response;"string"==typeof t&&(t=JSON.parse(t)),x(t)}}));break;case"jpg":case"png":case"gif":case"webp":case"svg":v?L():g();break;case"mp3":case"ogg":case"opus":case"wav":case"m4a":p?C():N("audio");break;case"ogv":case"mp4":case"webm":case"hls":v?T("blob"):N("video");break;case"bin":case"binary":T("arraybuffer");break;case"txt":case"text":T("text");break;default:throw"AssetsLoader ERROR: Unknown type for file with URL: "+l+f+" ("+_+")"}}},loaded:{get:function(){return!!c}},file:{get:function(){return c}},destroy:{value:y}})}},795:t=>{"use strict";t.exports={mbs:0,secs:0,update:function(t,e,n,r){var o,i=t.getAllResponseHeaders();if(i){var a=i.match(/content-length: (\d+)/i);a&&a.length&&(o=a[1])}if(o){var s=(o=parseInt(o,10))/1024/1024,u=(Date.now()-e)/1e3;this.secs+=u,this.mbs+=s,r&&this.log(n,s,u)}else r&&console.warn.call(console,"Can't get Content-Length:",n)},log:function(t,e,n){if(t){var r="File loaded: "+t.substr(t.lastIndexOf("/")+1)+" size:"+e.toFixed(2)+"mb time:"+n.toFixed(2)+"s speed:"+(e/n).toFixed(2)+"mbps";console.log.call(console,r)}var o="Total loaded: "+this.mbs.toFixed(2)+"mb time:"+this.secs.toFixed(2)+"s speed:"+this.getMbps().toFixed(2)+"mbps";console.log.call(console,o)},getMbps:function(){return this.mbs/this.secs}}},187:t=>{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}E(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&E(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var o,i,a,c;if(s(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),a=i[e]),void 0===a)a=i[e]=n,++t._eventsCount;else if("function"==typeof a?a=i[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=u(t))>0&&a.length>o&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,c=h,console&&console.warn&&console.warn(c)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function f(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,h=d(u,c);for(n=0;n=0;i--)if(n[i]===e||n[i].listener===e){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},i.prototype.listeners=function(t){return f(this,t,!0)},i.prototype.rawListeners=function(t){return f(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},i.prototype.listenerCount=_,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},685:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ARRAY_TYPE:()=>o,EPSILON:()=>r,RANDOM:()=>i,equals:()=>c,setMatrixArrayType:()=>a,toRadian:()=>u});var r=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array,i=Math.random;function a(t){o=t}var s=Math.PI/180;function u(t){return t*s}function c(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},720:(t,e,n)=>{"use strict";n.r(e),n.d(e,{glMatrix:()=>u,mat2:()=>r,mat2d:()=>o,mat3:()=>at,mat4:()=>st,quat:()=>a,quat2:()=>s,vec2:()=>Cn,vec3:()=>ut,vec4:()=>i});var r={};n.r(r),n.d(r,{LDU:()=>L,add:()=>S,adjoint:()=>p,clone:()=>h,copy:()=>l,create:()=>c,determinant:()=>m,equals:()=>P,exactEquals:()=>N,frob:()=>b,fromRotation:()=>R,fromScaling:()=>A,fromValues:()=>_,identity:()=>f,invert:()=>v,mul:()=>w,multiply:()=>x,multiplyScalar:()=>I,multiplyScalarAndAdd:()=>y,rotate:()=>T,scale:()=>M,set:()=>d,str:()=>g,sub:()=>O,subtract:()=>C,transpose:()=>E});var o={};n.r(o),n.d(o,{add:()=>$,clone:()=>U,copy:()=>D,create:()=>F,determinant:()=>z,equals:()=>rt,exactEquals:()=>nt,frob:()=>Q,fromRotation:()=>k,fromScaling:()=>q,fromTranslation:()=>Z,fromValues:()=>G,identity:()=>B,invert:()=>X,mul:()=>ot,multiply:()=>H,multiplyScalar:()=>tt,multiplyScalarAndAdd:()=>et,rotate:()=>Y,scale:()=>j,set:()=>V,str:()=>K,sub:()=>it,subtract:()=>J,translate:()=>W});var i={};n.r(i),n.d(i,{add:()=>dt,ceil:()=>mt,clone:()=>ht,copy:()=>ft,create:()=>ct,cross:()=>wt,dist:()=>Wt,distance:()=>bt,div:()=>jt,divide:()=>pt,dot:()=>yt,equals:()=>Xt,exactEquals:()=>Vt,floor:()=>xt,forEach:()=>Kt,fromValues:()=>lt,inverse:()=>Pt,len:()=>qt,length:()=>St,lerp:()=>Ot,max:()=>Mt,min:()=>Tt,mul:()=>Yt,multiply:()=>vt,negate:()=>Nt,normalize:()=>It,random:()=>Ft,round:()=>Rt,scale:()=>At,scaleAndAdd:()=>gt,set:()=>_t,sqrDist:()=>kt,sqrLen:()=>Zt,squaredDistance:()=>Lt,squaredLength:()=>Ct,str:()=>Gt,sub:()=>Ht,subtract:()=>Et,transformMat4:()=>Ut,transformQuat:()=>Dt,zero:()=>Bt});var a={};n.r(a),n.d(a,{add:()=>Se,calculateW:()=>ae,clone:()=>Ae,conjugate:()=>_e,copy:()=>be,create:()=>Qt,dot:()=>Pe,equals:()=>Be,exactEquals:()=>De,exp:()=>se,fromEuler:()=>Ee,fromMat3:()=>de,fromValues:()=>ge,getAngle:()=>ee,getAxisAngle:()=>te,identity:()=>$t,invert:()=>fe,len:()=>we,length:()=>ye,lerp:()=>Ie,ln:()=>ue,mul:()=>Ce,multiply:()=>ne,normalize:()=>Ue,pow:()=>ce,random:()=>le,rotateX:()=>re,rotateY:()=>oe,rotateZ:()=>ie,rotationTo:()=>Ge,scale:()=>Ne,set:()=>Le,setAxes:()=>Xe,setAxisAngle:()=>Jt,slerp:()=>he,sqlerp:()=>Ve,sqrLen:()=>Fe,squaredLength:()=>Oe,str:()=>ve});var s={};n.r(s),n.d(s,{add:()=>fn,clone:()=>He,conjugate:()=>xn,copy:()=>Ke,create:()=>ze,dot:()=>vn,equals:()=>Sn,exactEquals:()=>Ln,fromMat4:()=>Ze,fromRotation:()=>qe,fromRotationTranslation:()=>We,fromRotationTranslationValues:()=>je,fromTranslation:()=>ke,fromValues:()=>Ye,getDual:()=>tn,getReal:()=>Je,getTranslation:()=>rn,identity:()=>Qe,invert:()=>mn,len:()=>Mn,length:()=>Tn,lerp:()=>pn,mul:()=>dn,multiply:()=>_n,normalize:()=>gn,rotateAroundAxis:()=>ln,rotateByQuatAppend:()=>cn,rotateByQuatPrepend:()=>hn,rotateX:()=>an,rotateY:()=>sn,rotateZ:()=>un,scale:()=>En,set:()=>$e,setDual:()=>nn,setReal:()=>en,sqrLen:()=>An,squaredLength:()=>Rn,str:()=>bn,translate:()=>on});var u=n(685);function c(){var t=new u.ARRAY_TYPE(4);return u.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function h(t){var e=new u.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function f(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function _(t,e,n,r){var o=new u.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o}function d(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t}function E(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function v(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*i-o*r;return a?(a=1/a,t[0]=i*a,t[1]=-r*a,t[2]=-o*a,t[3]=n*a,t):null}function p(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t}function m(t){return t[0]*t[3]-t[2]*t[1]}function x(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=r*c+i*h,t[3]=o*c+a*h,t}function T(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*s,t[1]=o*u+a*s,t[2]=r*-s+i*u,t[3]=o*-s+a*u,t}function M(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1];return t[0]=r*s,t[1]=o*s,t[2]=i*u,t[3]=a*u,t}function R(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t}function A(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function g(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function b(t){return Math.hypot(t[0],t[1],t[2],t[3])}function L(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]}function S(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function C(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function N(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function P(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],c=e[2],h=e[3];return Math.abs(n-a)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-c)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-h)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))}function I(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function y(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}var w=x,O=C;function F(){var t=new u.ARRAY_TYPE(6);return u.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function U(t){var e=new u.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function D(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function B(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function G(t,e,n,r,o,i){var a=new u.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=n,a[3]=r,a[4]=o,a[5]=i,a}function V(t,e,n,r,o,i,a){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t}function X(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=n*i-r*o;return u?(u=1/u,t[0]=i*u,t[1]=-r*u,t[2]=-o*u,t[3]=n*u,t[4]=(o*s-i*a)*u,t[5]=(r*a-n*s)*u,t):null}function z(t){return t[0]*t[3]-t[1]*t[2]}function H(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1],l=n[2],f=n[3],_=n[4],d=n[5];return t[0]=r*c+i*h,t[1]=o*c+a*h,t[2]=r*l+i*f,t[3]=o*l+a*f,t[4]=r*_+i*d+s,t[5]=o*_+a*d+u,t}function Y(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+i*c,t[1]=o*h+a*c,t[2]=r*-c+i*h,t[3]=o*-c+a*h,t[4]=s,t[5]=u,t}function j(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=o*c,t[2]=i*h,t[3]=a*h,t[4]=s,t[5]=u,t}function W(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=r*c+i*h+s,t[5]=o*c+a*h+u,t}function k(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t}function q(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function Z(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function K(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function Q(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function $(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t}function J(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}function tt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t}function et(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t}function nt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function rt(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],c=e[0],h=e[1],l=e[2],f=e[3],_=e[4],d=e[5];return Math.abs(n-c)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(r-h)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(o-l)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))&&Math.abs(i-f)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(a-_)<=u.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-d)<=u.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))}var ot=H,it=J,at=n(600),st=n(975),ut=n(160);function ct(){var t=new u.ARRAY_TYPE(4);return u.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ht(t){var e=new u.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function lt(t,e,n,r){var o=new u.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o}function ft(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function _t(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t}function dt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function Et(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function vt(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function pt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function mt(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function xt(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function Tt(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function Mt(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function Rt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function At(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function gt(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}function bt(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return Math.hypot(n,r,o,i)}function Lt(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return n*n+r*r+o*o+i*i}function St(t){var e=t[0],n=t[1],r=t[2],o=t[3];return Math.hypot(e,n,r,o)}function Ct(t){var e=t[0],n=t[1],r=t[2],o=t[3];return e*e+n*n+r*r+o*o}function Nt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function Pt(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function It(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*n+r*r+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=o*a,t[3]=i*a,t}function yt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function wt(t,e,n,r){var o=n[0]*r[1]-n[1]*r[0],i=n[0]*r[2]-n[2]*r[0],a=n[0]*r[3]-n[3]*r[0],s=n[1]*r[2]-n[2]*r[1],u=n[1]*r[3]-n[3]*r[1],c=n[2]*r[3]-n[3]*r[2],h=e[0],l=e[1],f=e[2],_=e[3];return t[0]=l*c-f*u+_*s,t[1]=-h*c+f*a-_*i,t[2]=h*u-l*a+_*o,t[3]=-h*s+l*i-f*o,t}function Ot(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=e[3];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t[3]=s+r*(n[3]-s),t}function Ft(t,e){var n,r,o,i,a,s;e=e||1;do{a=(n=2*u.RANDOM()-1)*n+(r=2*u.RANDOM()-1)*r}while(a>=1);do{s=(o=2*u.RANDOM()-1)*o+(i=2*u.RANDOM()-1)*i}while(s>=1);var c=Math.sqrt((1-a)/s);return t[0]=e*n,t[1]=e*r,t[2]=e*o*c,t[3]=e*i*c,t}function Ut(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3];return t[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,t[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,t[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,t[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,t}function Dt(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],s=n[1],u=n[2],c=n[3],h=c*r+s*i-u*o,l=c*o+u*r-a*i,f=c*i+a*o-s*r,_=-a*r-s*o-u*i;return t[0]=h*c+_*-a+l*-u-f*-s,t[1]=l*c+_*-s+f*-a-h*-u,t[2]=f*c+_*-u+h*-s-l*-a,t[3]=e[3],t}function Bt(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Gt(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Vt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Xt(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],c=e[2],h=e[3];return Math.abs(n-a)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-c)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-h)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))}var zt,Ht=Et,Yt=vt,jt=pt,Wt=bt,kt=Lt,qt=St,Zt=Ct,Kt=(zt=ct(),function(t,e,n,r,o,i){var a,s;for(e||(e=4),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;au.EPSILON?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function ee(t,e){var n=Pe(t,e);return Math.acos(2*n*n-1)}function ne(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+a*s+o*c-i*u,t[1]=o*h+a*u+i*s-r*c,t[2]=i*h+a*c+r*u-o*s,t[3]=a*h-r*s-o*u-i*c,t}function re(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=i*u-o*s,t[3]=a*u-r*s,t}function oe(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u-i*s,t[1]=o*u+a*s,t[2]=i*u+r*s,t[3]=a*u-o*s,t}function ie(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+o*s,t[1]=o*u-r*s,t[2]=i*u+a*s,t[3]=a*u-i*s,t}function ae(t,e){var n=e[0],r=e[1],o=e[2];return t[0]=n,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-o*o)),t}function se(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=Math.sqrt(n*n+r*r+o*o),s=Math.exp(i),u=a>0?s*Math.sin(a)/a:0;return t[0]=n*u,t[1]=r*u,t[2]=o*u,t[3]=s*Math.cos(a),t}function ue(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=Math.sqrt(n*n+r*r+o*o),s=a>0?Math.atan2(a,i)/a:0;return t[0]=n*s,t[1]=r*s,t[2]=o*s,t[3]=.5*Math.log(n*n+r*r+o*o+i*i),t}function ce(t,e,n){return ue(t,e),Ne(t,t,n),se(t,t),t}function he(t,e,n,r){var o,i,a,s,c,h=e[0],l=e[1],f=e[2],_=e[3],d=n[0],E=n[1],v=n[2],p=n[3];return(i=h*d+l*E+f*v+_*p)<0&&(i=-i,d=-d,E=-E,v=-v,p=-p),1-i>u.EPSILON?(o=Math.acos(i),a=Math.sin(o),s=Math.sin((1-r)*o)/a,c=Math.sin(r*o)/a):(s=1-r,c=r),t[0]=s*h+c*d,t[1]=s*l+c*E,t[2]=s*f+c*v,t[3]=s*_+c*p,t}function le(t){var e=u.RANDOM(),n=u.RANDOM(),r=u.RANDOM(),o=Math.sqrt(1-e),i=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*n),t[1]=o*Math.cos(2*Math.PI*n),t[2]=i*Math.sin(2*Math.PI*r),t[3]=i*Math.cos(2*Math.PI*r),t}function fe(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*n+r*r+o*o+i*i,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-o*s,t[3]=i*s,t}function _e(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function de(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var i=(o+1)%3,a=(o+2)%3;n=Math.sqrt(e[3*o+o]-e[3*i+i]-e[3*a+a]+1),t[o]=.5*n,n=.5/n,t[3]=(e[3*i+a]-e[3*a+i])*n,t[i]=(e[3*i+o]+e[3*o+i])*n,t[a]=(e[3*a+o]+e[3*o+a])*n}return t}function Ee(t,e,n,r){var o=.5*Math.PI/180;e*=o,n*=o,r*=o;var i=Math.sin(e),a=Math.cos(e),s=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=i*u*h-a*s*c,t[1]=a*s*h+i*u*c,t[2]=a*u*c-i*s*h,t[3]=a*u*h+i*s*c,t}function ve(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var pe,me,xe,Te,Me,Re,Ae=ht,ge=lt,be=ft,Le=_t,Se=dt,Ce=ne,Ne=At,Pe=yt,Ie=Ot,ye=St,we=ye,Oe=Ct,Fe=Oe,Ue=It,De=Vt,Be=Xt,Ge=(pe=ut.create(),me=ut.fromValues(1,0,0),xe=ut.fromValues(0,1,0),function(t,e,n){var r=ut.dot(e,n);return r<-.999999?(ut.cross(pe,me,e),ut.len(pe)<1e-6&&ut.cross(pe,xe,e),ut.normalize(pe,pe),Jt(t,pe,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(ut.cross(pe,e,n),t[0]=pe[0],t[1]=pe[1],t[2]=pe[2],t[3]=1+r,Ue(t,t))}),Ve=(Te=Qt(),Me=Qt(),function(t,e,n,r,o,i){return he(Te,e,o,i),he(Me,n,r,i),he(t,Te,Me,2*i*(1-i)),t}),Xe=(Re=at.create(),function(t,e,n,r){return Re[0]=n[0],Re[3]=n[1],Re[6]=n[2],Re[1]=r[0],Re[4]=r[1],Re[7]=r[2],Re[2]=-e[0],Re[5]=-e[1],Re[8]=-e[2],Ue(t,de(t,Re))});function ze(){var t=new u.ARRAY_TYPE(8);return u.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function He(t){var e=new u.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function Ye(t,e,n,r,o,i,a,s){var c=new u.ARRAY_TYPE(8);return c[0]=t,c[1]=e,c[2]=n,c[3]=r,c[4]=o,c[5]=i,c[6]=a,c[7]=s,c}function je(t,e,n,r,o,i,a){var s=new u.ARRAY_TYPE(8);s[0]=t,s[1]=e,s[2]=n,s[3]=r;var c=.5*o,h=.5*i,l=.5*a;return s[4]=c*r+h*n-l*e,s[5]=h*r+l*t-c*n,s[6]=l*r+c*e-h*t,s[7]=-c*t-h*e-l*n,s}function We(t,e,n){var r=.5*n[0],o=.5*n[1],i=.5*n[2],a=e[0],s=e[1],u=e[2],c=e[3];return t[0]=a,t[1]=s,t[2]=u,t[3]=c,t[4]=r*c+o*u-i*s,t[5]=o*c+i*a-r*u,t[6]=i*c+r*s-o*a,t[7]=-r*a-o*s-i*u,t}function ke(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function qe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Ze(t,e){var n=Qt();st.getRotation(n,e);var r=new u.ARRAY_TYPE(3);return st.getTranslation(r,e),We(t,n,r),t}function Ke(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Qe(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function $e(t,e,n,r,o,i,a,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t}var Je=be;function tn(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var en=be;function nn(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function rn(t,e){var n=e[4],r=e[5],o=e[6],i=e[7],a=-e[0],s=-e[1],u=-e[2],c=e[3];return t[0]=2*(n*c+i*a+r*u-o*s),t[1]=2*(r*c+i*s+o*a-n*u),t[2]=2*(o*c+i*u+n*s-r*a),t}function on(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=.5*n[0],u=.5*n[1],c=.5*n[2],h=e[4],l=e[5],f=e[6],_=e[7];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=a*s+o*c-i*u+h,t[5]=a*u+i*s-r*c+l,t[6]=a*c+r*u-o*s+f,t[7]=-r*s-o*u-i*c+_,t}function an(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return re(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function sn(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return oe(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function un(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return ie(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function cn(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],h=e[3];return t[0]=s*a+h*r+u*i-c*o,t[1]=u*a+h*o+c*r-s*i,t[2]=c*a+h*i+s*o-u*r,t[3]=h*a-s*r-u*o-c*i,s=e[4],u=e[5],c=e[6],h=e[7],t[4]=s*a+h*r+u*i-c*o,t[5]=u*a+h*o+c*r-s*i,t[6]=c*a+h*i+s*o-u*r,t[7]=h*a-s*r-u*o-c*i,t}function hn(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+a*s+o*c-i*u,t[1]=o*h+a*u+i*s-r*c,t[2]=i*h+a*c+r*u-o*s,t[3]=a*h-r*s-o*u-i*c,s=n[4],u=n[5],c=n[6],h=n[7],t[4]=r*h+a*s+o*c-i*u,t[5]=o*h+a*u+i*s-r*c,t[6]=i*h+a*c+r*u-o*s,t[7]=a*h-r*s-o*u-i*c,t}function ln(t,e,n,r){if(Math.abs(r)0){n=Math.sqrt(n);var r=e[0]/n,o=e[1]/n,i=e[2]/n,a=e[3]/n,s=e[4],u=e[5],c=e[6],h=e[7],l=r*s+o*u+i*c+a*h;t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=(s-r*l)/n,t[5]=(u-o*l)/n,t[6]=(c-i*l)/n,t[7]=(h-a*l)/n}return t}function bn(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function Ln(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function Sn(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],c=t[6],h=t[7],l=e[0],f=e[1],_=e[2],d=e[3],E=e[4],v=e[5],p=e[6],m=e[7];return Math.abs(n-l)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(r-f)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-_)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(i-d)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-E)<=u.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-v)<=u.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(c-p)<=u.EPSILON*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(h-m)<=u.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))}var Cn=n(437)},600:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>C,adjoint:()=>_,clone:()=>a,copy:()=>s,create:()=>o,determinant:()=>d,equals:()=>w,exactEquals:()=>y,frob:()=>S,fromMat2d:()=>R,fromMat4:()=>i,fromQuat:()=>A,fromRotation:()=>T,fromScaling:()=>M,fromTranslation:()=>x,fromValues:()=>u,identity:()=>h,invert:()=>f,mul:()=>O,multiply:()=>E,multiplyScalar:()=>P,multiplyScalarAndAdd:()=>I,normalFromMat4:()=>g,projection:()=>b,rotate:()=>p,scale:()=>m,set:()=>c,str:()=>L,sub:()=>F,subtract:()=>N,translate:()=>v,transpose:()=>l});var r=n(685);function o(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function a(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function u(t,e,n,o,i,a,s,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=o,h[4]=i,h[5]=a,h[6]=s,h[7]=u,h[8]=c,h}function c(t,e,n,r,o,i,a,s,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t}function h(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function l(t,e){if(t===e){var n=e[1],r=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function f(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=h*a-s*c,f=-h*i+s*u,_=c*i-a*u,d=n*l+r*f+o*_;return d?(d=1/d,t[0]=l*d,t[1]=(-h*r+o*c)*d,t[2]=(s*r-o*a)*d,t[3]=f*d,t[4]=(h*n-o*u)*d,t[5]=(-s*n+o*i)*d,t[6]=_*d,t[7]=(-c*n+r*u)*d,t[8]=(a*n-r*i)*d,t):null}function _(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8];return t[0]=a*h-s*c,t[1]=o*c-r*h,t[2]=r*s-o*a,t[3]=s*u-i*h,t[4]=n*h-o*u,t[5]=o*i-n*s,t[6]=i*c-a*u,t[7]=r*u-n*c,t[8]=n*a-r*i,t}function d(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return e*(c*i-a*u)+n*(-c*o+a*s)+r*(u*o-i*s)}function E(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=n[0],_=n[1],d=n[2],E=n[3],v=n[4],p=n[5],m=n[6],x=n[7],T=n[8];return t[0]=f*r+_*a+d*c,t[1]=f*o+_*s+d*h,t[2]=f*i+_*u+d*l,t[3]=E*r+v*a+p*c,t[4]=E*o+v*s+p*h,t[5]=E*i+v*u+p*l,t[6]=m*r+x*a+T*c,t[7]=m*o+x*s+T*h,t[8]=m*i+x*u+T*l,t}function v(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=n[0],_=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=f*r+_*a+c,t[7]=f*o+_*s+h,t[8]=f*i+_*u+l,t}function p(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=Math.sin(n),_=Math.cos(n);return t[0]=_*r+f*a,t[1]=_*o+f*s,t[2]=_*i+f*u,t[3]=_*a-f*r,t[4]=_*s-f*o,t[5]=_*u-f*i,t[6]=c,t[7]=h,t[8]=l,t}function m(t,e,n){var r=n[0],o=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function x(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function T(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function M(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function R(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function A(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,l=r*s,f=o*a,_=o*s,d=o*u,E=i*a,v=i*s,p=i*u;return t[0]=1-l-d,t[3]=h-p,t[6]=f+v,t[1]=h+p,t[4]=1-c-d,t[7]=_-E,t[2]=f-v,t[5]=_+E,t[8]=1-c-l,t}function g(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],v=e[14],p=e[15],m=n*s-r*a,x=n*u-o*a,T=n*c-i*a,M=r*u-o*s,R=r*c-i*s,A=o*c-i*u,g=h*E-l*d,b=h*v-f*d,L=h*p-_*d,S=l*v-f*E,C=l*p-_*E,N=f*p-_*v,P=m*N-x*C+T*S+M*L-R*b+A*g;return P?(P=1/P,t[0]=(s*N-u*C+c*S)*P,t[1]=(u*L-a*N-c*b)*P,t[2]=(a*C-s*L+c*g)*P,t[3]=(o*C-r*N-i*S)*P,t[4]=(n*N-o*L+i*b)*P,t[5]=(r*L-n*C-i*g)*P,t[6]=(E*A-v*R+p*M)*P,t[7]=(v*T-d*A-p*x)*P,t[8]=(d*R-E*T+p*m)*P,t):null}function b(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function L(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function S(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function C(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function N(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function P(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function I(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t}function y(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function w(t,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],c=t[6],h=t[7],l=t[8],f=e[0],_=e[1],d=e[2],E=e[3],v=e[4],p=e[5],m=e[6],x=e[7],T=e[8];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-E)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-v)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-p)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(c-m)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(h-x)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(l-T)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(T))}var O=E,F=N},975:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>k,adjoint:()=>f,clone:()=>i,copy:()=>a,create:()=>o,determinant:()=>_,equals:()=>$,exactEquals:()=>Q,frob:()=>W,fromQuat:()=>O,fromQuat2:()=>C,fromRotation:()=>A,fromRotationTranslation:()=>S,fromRotationTranslationScale:()=>y,fromRotationTranslationScaleOrigin:()=>w,fromScaling:()=>R,fromTranslation:()=>M,fromValues:()=>s,fromXRotation:()=>g,fromYRotation:()=>b,fromZRotation:()=>L,frustum:()=>F,getRotation:()=>I,getScaling:()=>P,getTranslation:()=>N,identity:()=>c,invert:()=>l,lookAt:()=>H,mul:()=>J,multiply:()=>d,multiplyScalar:()=>Z,multiplyScalarAndAdd:()=>K,ortho:()=>X,orthoNO:()=>V,orthoZO:()=>z,perspective:()=>D,perspectiveFromFieldOfView:()=>G,perspectiveNO:()=>U,perspectiveZO:()=>B,rotate:()=>p,rotateX:()=>m,rotateY:()=>x,rotateZ:()=>T,scale:()=>v,set:()=>u,str:()=>j,sub:()=>tt,subtract:()=>q,targetTo:()=>Y,translate:()=>E,transpose:()=>h});var r=n(685);function o(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function i(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function s(t,e,n,o,i,a,s,u,c,h,l,f,_,d,E,v){var p=new r.ARRAY_TYPE(16);return p[0]=t,p[1]=e,p[2]=n,p[3]=o,p[4]=i,p[5]=a,p[6]=s,p[7]=u,p[8]=c,p[9]=h,p[10]=l,p[11]=f,p[12]=_,p[13]=d,p[14]=E,p[15]=v,p}function u(t,e,n,r,o,i,a,s,u,c,h,l,f,_,d,E,v){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t[9]=h,t[10]=l,t[11]=f,t[12]=_,t[13]=d,t[14]=E,t[15]=v,t}function c(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function h(t,e){if(t===e){var n=e[1],r=e[2],o=e[3],i=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function l(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],v=e[14],p=e[15],m=n*s-r*a,x=n*u-o*a,T=n*c-i*a,M=r*u-o*s,R=r*c-i*s,A=o*c-i*u,g=h*E-l*d,b=h*v-f*d,L=h*p-_*d,S=l*v-f*E,C=l*p-_*E,N=f*p-_*v,P=m*N-x*C+T*S+M*L-R*b+A*g;return P?(P=1/P,t[0]=(s*N-u*C+c*S)*P,t[1]=(o*C-r*N-i*S)*P,t[2]=(E*A-v*R+p*M)*P,t[3]=(f*R-l*A-_*M)*P,t[4]=(u*L-a*N-c*b)*P,t[5]=(n*N-o*L+i*b)*P,t[6]=(v*T-d*A-p*x)*P,t[7]=(h*A-f*T+_*x)*P,t[8]=(a*C-s*L+c*g)*P,t[9]=(r*L-n*C-i*g)*P,t[10]=(d*R-E*T+p*m)*P,t[11]=(l*T-h*R-_*m)*P,t[12]=(s*b-a*S-u*g)*P,t[13]=(n*S-r*b+o*g)*P,t[14]=(E*x-d*M-v*m)*P,t[15]=(h*M-l*x+f*m)*P,t):null}function f(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],v=e[14],p=e[15];return t[0]=s*(f*p-_*v)-l*(u*p-c*v)+E*(u*_-c*f),t[1]=-(r*(f*p-_*v)-l*(o*p-i*v)+E*(o*_-i*f)),t[2]=r*(u*p-c*v)-s*(o*p-i*v)+E*(o*c-i*u),t[3]=-(r*(u*_-c*f)-s*(o*_-i*f)+l*(o*c-i*u)),t[4]=-(a*(f*p-_*v)-h*(u*p-c*v)+d*(u*_-c*f)),t[5]=n*(f*p-_*v)-h*(o*p-i*v)+d*(o*_-i*f),t[6]=-(n*(u*p-c*v)-a*(o*p-i*v)+d*(o*c-i*u)),t[7]=n*(u*_-c*f)-a*(o*_-i*f)+h*(o*c-i*u),t[8]=a*(l*p-_*E)-h*(s*p-c*E)+d*(s*_-c*l),t[9]=-(n*(l*p-_*E)-h*(r*p-i*E)+d*(r*_-i*l)),t[10]=n*(s*p-c*E)-a*(r*p-i*E)+d*(r*c-i*s),t[11]=-(n*(s*_-c*l)-a*(r*_-i*l)+h*(r*c-i*s)),t[12]=-(a*(l*v-f*E)-h*(s*v-u*E)+d*(s*f-u*l)),t[13]=n*(l*v-f*E)-h*(r*v-o*E)+d*(r*f-o*l),t[14]=-(n*(s*v-u*E)-a*(r*v-o*E)+d*(r*u-o*s)),t[15]=n*(s*f-u*l)-a*(r*f-o*l)+h*(r*u-o*s),t}function _(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],_=t[12],d=t[13],E=t[14],v=t[15];return(e*a-n*i)*(l*v-f*E)-(e*s-r*i)*(h*v-f*d)+(e*u-o*i)*(h*E-l*d)+(n*s-r*a)*(c*v-f*_)-(n*u-o*a)*(c*E-l*_)+(r*u-o*s)*(c*d-h*_)}function d(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],_=e[10],d=e[11],E=e[12],v=e[13],p=e[14],m=e[15],x=n[0],T=n[1],M=n[2],R=n[3];return t[0]=x*r+T*s+M*l+R*E,t[1]=x*o+T*u+M*f+R*v,t[2]=x*i+T*c+M*_+R*p,t[3]=x*a+T*h+M*d+R*m,x=n[4],T=n[5],M=n[6],R=n[7],t[4]=x*r+T*s+M*l+R*E,t[5]=x*o+T*u+M*f+R*v,t[6]=x*i+T*c+M*_+R*p,t[7]=x*a+T*h+M*d+R*m,x=n[8],T=n[9],M=n[10],R=n[11],t[8]=x*r+T*s+M*l+R*E,t[9]=x*o+T*u+M*f+R*v,t[10]=x*i+T*c+M*_+R*p,t[11]=x*a+T*h+M*d+R*m,x=n[12],T=n[13],M=n[14],R=n[15],t[12]=x*r+T*s+M*l+R*E,t[13]=x*o+T*u+M*f+R*v,t[14]=x*i+T*c+M*_+R*p,t[15]=x*a+T*h+M*d+R*m,t}function E(t,e,n){var r,o,i,a,s,u,c,h,l,f,_,d,E=n[0],v=n[1],p=n[2];return e===t?(t[12]=e[0]*E+e[4]*v+e[8]*p+e[12],t[13]=e[1]*E+e[5]*v+e[9]*p+e[13],t[14]=e[2]*E+e[6]*v+e[10]*p+e[14],t[15]=e[3]*E+e[7]*v+e[11]*p+e[15]):(r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],_=e[10],d=e[11],t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=h,t[8]=l,t[9]=f,t[10]=_,t[11]=d,t[12]=r*E+s*v+l*p+e[12],t[13]=o*E+u*v+f*p+e[13],t[14]=i*E+c*v+_*p+e[14],t[15]=a*E+h*v+d*p+e[15]),t}function v(t,e,n){var r=n[0],o=n[1],i=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function p(t,e,n,o){var i,a,s,u,c,h,l,f,_,d,E,v,p,m,x,T,M,R,A,g,b,L,S,C,N=o[0],P=o[1],I=o[2],y=Math.hypot(N,P,I);return y0?(n[0]=2*(u*s+l*o+c*a-h*i)/f,n[1]=2*(c*s+l*i+h*o-u*a)/f,n[2]=2*(h*s+l*a+u*i-c*o)/f):(n[0]=2*(u*s+l*o+c*a-h*i),n[1]=2*(c*s+l*i+h*o-u*a),n[2]=2*(h*s+l*a+u*i-c*o)),S(t,e,n),t}function N(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function P(t,e){var n=e[0],r=e[1],o=e[2],i=e[4],a=e[5],s=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.hypot(n,r,o),t[1]=Math.hypot(i,a,s),t[2]=Math.hypot(u,c,h),t}function I(t,e){var n=new r.ARRAY_TYPE(3);P(n,e);var o=1/n[0],i=1/n[1],a=1/n[2],s=e[0]*o,u=e[1]*i,c=e[2]*a,h=e[4]*o,l=e[5]*i,f=e[6]*a,_=e[8]*o,d=e[9]*i,E=e[10]*a,v=s+l+E,p=0;return v>0?(p=2*Math.sqrt(v+1),t[3]=.25*p,t[0]=(f-d)/p,t[1]=(_-c)/p,t[2]=(u-h)/p):s>l&&s>E?(p=2*Math.sqrt(1+s-l-E),t[3]=(f-d)/p,t[0]=.25*p,t[1]=(u+h)/p,t[2]=(_+c)/p):l>E?(p=2*Math.sqrt(1+l-s-E),t[3]=(_-c)/p,t[0]=(u+h)/p,t[1]=.25*p,t[2]=(f+d)/p):(p=2*Math.sqrt(1+E-s-l),t[3]=(u-h)/p,t[0]=(_+c)/p,t[1]=(f+d)/p,t[2]=.25*p),t}function y(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=e[3],u=o+o,c=i+i,h=a+a,l=o*u,f=o*c,_=o*h,d=i*c,E=i*h,v=a*h,p=s*u,m=s*c,x=s*h,T=r[0],M=r[1],R=r[2];return t[0]=(1-(d+v))*T,t[1]=(f+x)*T,t[2]=(_-m)*T,t[3]=0,t[4]=(f-x)*M,t[5]=(1-(l+v))*M,t[6]=(E+p)*M,t[7]=0,t[8]=(_+m)*R,t[9]=(E-p)*R,t[10]=(1-(l+d))*R,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function w(t,e,n,r,o){var i=e[0],a=e[1],s=e[2],u=e[3],c=i+i,h=a+a,l=s+s,f=i*c,_=i*h,d=i*l,E=a*h,v=a*l,p=s*l,m=u*c,x=u*h,T=u*l,M=r[0],R=r[1],A=r[2],g=o[0],b=o[1],L=o[2],S=(1-(E+p))*M,C=(_+T)*M,N=(d-x)*M,P=(_-T)*R,I=(1-(f+p))*R,y=(v+m)*R,w=(d+x)*A,O=(v-m)*A,F=(1-(f+E))*A;return t[0]=S,t[1]=C,t[2]=N,t[3]=0,t[4]=P,t[5]=I,t[6]=y,t[7]=0,t[8]=w,t[9]=O,t[10]=F,t[11]=0,t[12]=n[0]+g-(S*g+P*b+w*L),t[13]=n[1]+b-(C*g+I*b+O*L),t[14]=n[2]+L-(N*g+y*b+F*L),t[15]=1,t}function O(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,l=r*s,f=o*a,_=o*s,d=o*u,E=i*a,v=i*s,p=i*u;return t[0]=1-l-d,t[1]=h+p,t[2]=f-v,t[3]=0,t[4]=h-p,t[5]=1-c-d,t[6]=_+E,t[7]=0,t[8]=f+v,t[9]=_-E,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function F(t,e,n,r,o,i,a){var s=1/(n-e),u=1/(o-r),c=1/(i-a);return t[0]=2*i*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*u,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(o+r)*u,t[10]=(a+i)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*c,t[15]=0,t}function U(t,e,n,r,o){var i,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=(o+r)*i,t[14]=2*o*r*i):(t[10]=-1,t[14]=-2*r),t}var D=U;function B(t,e,n,r,o){var i,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=o*i,t[14]=o*r*i):(t[10]=-1,t[14]=-r),t}function G(t,e,n,r){var o=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(o+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(o-i)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function V(t,e,n,r,o,i,a){var s=1/(e-n),u=1/(r-o),c=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(o+r)*u,t[14]=(a+i)*c,t[15]=1,t}var X=V;function z(t,e,n,r,o,i,a){var s=1/(e-n),u=1/(r-o),c=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(o+r)*u,t[14]=i*c,t[15]=1,t}function H(t,e,n,o){var i,a,s,u,h,l,f,_,d,E,v=e[0],p=e[1],m=e[2],x=o[0],T=o[1],M=o[2],R=n[0],A=n[1],g=n[2];return Math.abs(v-R)0&&(h*=_=1/Math.sqrt(_),l*=_,f*=_);var d=u*f-c*l,E=c*h-s*f,v=s*l-u*h;return(_=d*d+E*E+v*v)>0&&(d*=_=1/Math.sqrt(_),E*=_,v*=_),t[0]=d,t[1]=E,t[2]=v,t[3]=0,t[4]=l*v-f*E,t[5]=f*d-h*v,t[6]=h*E-l*d,t[7]=0,t[8]=h,t[9]=l,t[10]=f,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t}function j(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function W(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function k(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function q(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function Z(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function K(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function Q(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function $(t,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],c=t[6],h=t[7],l=t[8],f=t[9],_=t[10],d=t[11],E=t[12],v=t[13],p=t[14],m=t[15],x=e[0],T=e[1],M=e[2],R=e[3],A=e[4],g=e[5],b=e[6],L=e[7],S=e[8],C=e[9],N=e[10],P=e[11],I=e[12],y=e[13],w=e[14],O=e[15];return Math.abs(n-x)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-T)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-M)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(a-R)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(R))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-b)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(h-L)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(l-S)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(f-C)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(_-N)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(N))&&Math.abs(d-P)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(E-I)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(I))&&Math.abs(v-y)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(y))&&Math.abs(p-w)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(w))&&Math.abs(m-O)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(O))}var J=d,tt=q},437:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>c,angle:()=>U,ceil:()=>_,clone:()=>i,copy:()=>s,create:()=>o,cross:()=>C,dist:()=>W,distance:()=>T,div:()=>j,divide:()=>f,dot:()=>S,equals:()=>V,exactEquals:()=>G,floor:()=>d,forEach:()=>Z,fromValues:()=>a,inverse:()=>b,len:()=>z,length:()=>R,lerp:()=>N,max:()=>v,min:()=>E,mul:()=>Y,multiply:()=>l,negate:()=>g,normalize:()=>L,random:()=>P,rotate:()=>F,round:()=>p,scale:()=>m,scaleAndAdd:()=>x,set:()=>u,sqrDist:()=>k,sqrLen:()=>q,squaredDistance:()=>M,squaredLength:()=>A,str:()=>B,sub:()=>H,subtract:()=>h,transformMat2:()=>I,transformMat2d:()=>y,transformMat3:()=>w,transformMat4:()=>O,zero:()=>D});var r=n(685);function o(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function i(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function a(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n}function s(t,e){return t[0]=e[0],t[1]=e[1],t}function u(t,e,n){return t[0]=e,t[1]=n,t}function c(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function h(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function l(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function f(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function _(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function d(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function E(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function v(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function p(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function m(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function x(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function T(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function M(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function R(t){var e=t[0],n=t[1];return Math.hypot(e,n)}function A(t){var e=t[0],n=t[1];return e*e+n*n}function g(t,e){return t[0]=-e[0],t[1]=-e[1],t}function b(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function L(t,e){var n=e[0],r=e[1],o=n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t}function S(t,e){return t[0]*e[0]+t[1]*e[1]}function C(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}function N(t,e,n,r){var o=e[0],i=e[1];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t}function P(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function I(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o,t[1]=n[1]*r+n[3]*o,t}function y(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o+n[4],t[1]=n[1]*r+n[3]*o+n[5],t}function w(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[3]*o+n[6],t[1]=n[1]*r+n[4]*o+n[7],t}function O(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[4]*o+n[12],t[1]=n[1]*r+n[5]*o+n[13],t}function F(t,e,n,r){var o=e[0]-n[0],i=e[1]-n[1],a=Math.sin(r),s=Math.cos(r);return t[0]=o*s-i*a+n[0],t[1]=o*a+i*s+n[1],t}function U(t,e){var n=t[0],r=t[1],o=e[0],i=e[1],a=Math.sqrt(n*n+r*r)*Math.sqrt(o*o+i*i),s=a&&(n*o+r*i)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function D(t){return t[0]=0,t[1]=0,t}function B(t){return"vec2("+t[0]+", "+t[1]+")"}function G(t,e){return t[0]===e[0]&&t[1]===e[1]}function V(t,e){var n=t[0],o=t[1],i=e[0],a=e[1];return Math.abs(n-i)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(o-a)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(a))}var X,z=R,H=h,Y=l,j=f,W=T,k=M,q=A,Z=(X=o(),function(t,e,n,r,o,i){var a,s;for(e||(e=2),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;a{"use strict";n.r(e),n.d(e,{add:()=>h,angle:()=>G,bezier:()=>I,ceil:()=>d,clone:()=>i,copy:()=>u,create:()=>o,cross:()=>C,dist:()=>q,distance:()=>M,div:()=>k,divide:()=>_,dot:()=>S,equals:()=>H,exactEquals:()=>z,floor:()=>E,forEach:()=>$,fromValues:()=>s,hermite:()=>P,inverse:()=>b,len:()=>K,length:()=>a,lerp:()=>N,max:()=>p,min:()=>v,mul:()=>W,multiply:()=>f,negate:()=>g,normalize:()=>L,random:()=>y,rotateX:()=>U,rotateY:()=>D,rotateZ:()=>B,round:()=>m,scale:()=>x,scaleAndAdd:()=>T,set:()=>c,sqrDist:()=>Z,sqrLen:()=>Q,squaredDistance:()=>R,squaredLength:()=>A,str:()=>X,sub:()=>j,subtract:()=>l,transformMat3:()=>O,transformMat4:()=>w,transformQuat:()=>F,zero:()=>V});var r=n(685);function o(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function i(t){var e=new r.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function a(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function s(t,e,n){var o=new r.ARRAY_TYPE(3);return o[0]=t,o[1]=e,o[2]=n,o}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function c(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function h(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function l(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function f(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function _(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function d(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function E(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function v(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function p(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function m(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function x(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function T(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function M(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return Math.hypot(n,r,o)}function R(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return n*n+r*r+o*o}function A(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function g(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function b(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function L(t,e){var n=e[0],r=e[1],o=e[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function S(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function C(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],s=n[1],u=n[2];return t[0]=o*u-i*s,t[1]=i*a-r*u,t[2]=r*s-o*a,t}function N(t,e,n,r){var o=e[0],i=e[1],a=e[2];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t}function P(t,e,n,r,o,i){var a=i*i,s=a*(2*i-3)+1,u=a*(i-2)+i,c=a*(i-1),h=a*(3-2*i);return t[0]=e[0]*s+n[0]*u+r[0]*c+o[0]*h,t[1]=e[1]*s+n[1]*u+r[1]*c+o[1]*h,t[2]=e[2]*s+n[2]*u+r[2]*c+o[2]*h,t}function I(t,e,n,r,o,i){var a=1-i,s=a*a,u=i*i,c=s*a,h=3*i*s,l=3*u*a,f=u*i;return t[0]=e[0]*c+n[0]*h+r[0]*l+o[0]*f,t[1]=e[1]*c+n[1]*h+r[1]*l+o[1]*f,t[2]=e[2]*c+n[2]*h+r[2]*l+o[2]*f,t}function y(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,o=2*r.RANDOM()-1,i=Math.sqrt(1-o*o)*e;return t[0]=Math.cos(n)*i,t[1]=Math.sin(n)*i,t[2]=o*e,t}function w(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,t[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,t[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,t}function O(t,e,n){var r=e[0],o=e[1],i=e[2];return t[0]=r*n[0]+o*n[3]+i*n[6],t[1]=r*n[1]+o*n[4]+i*n[7],t[2]=r*n[2]+o*n[5]+i*n[8],t}function F(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],h=o*c-i*u,l=i*s-r*c,f=r*u-o*s,_=o*f-i*l,d=i*h-r*f,E=r*l-o*h,v=2*a;return h*=v,l*=v,f*=v,_*=2,d*=2,E*=2,t[0]=s+h+_,t[1]=u+l+d,t[2]=c+f+E,t}function U(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function D(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function B(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function G(t,e){var n=t[0],r=t[1],o=t[2],i=e[0],a=e[1],s=e[2],u=Math.sqrt(n*n+r*r+o*o)*Math.sqrt(i*i+a*a+s*s),c=u&&S(t,e)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function V(t){return t[0]=0,t[1]=0,t[2]=0,t}function X(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function z(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function H(t,e){var n=t[0],o=t[1],i=t[2],a=e[0],s=e[1],u=e[2];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-s)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(s))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))}var Y,j=l,W=f,k=_,q=M,Z=R,K=a,Q=A,$=(Y=o(),function(t,e,n,r,o,i){var a,s;for(e||(e=3),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;a{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var a,s,u=o(t),c=1;c{"use strict";n.d(e,{Z:()=>x});let r=window,o=60,i=performance.now(),a=0,s=0,u=i;const c=[],h=[],l=[],f=[];let _=[],d=[],E=-1,v=0;function p(){!function(){let t,e=0,n=1e3/o,r=0;for(e=0;e0;)t=_.pop(),t.func(t.args);let E=performance.now();for(s=(E-i)/1e3,a=E-u,e=0;et.delay&&(t.func(t.args),h.splice(e,1));for(E=performance.now();l.length>0;){if(t=l.shift(),r=performance.now(),!(r-E0;)t=f.shift(),r=performance.now(),r-E-1&&window.cancelAnimationFrame(E),r=t,p()},setFrameRate:function(t){o=t},getElapsedTime:function(){return s},getDeltaTime:function(){return a}};const x=m},247:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r={usePostEffect:!0,colorIndex:1,numSets:8,numParticles:128,autoSave:!1,showThumbnail:!1,margin:100,thumbnailSize:256,background:[22,22,22]}},855:(t,e,n)=>{"use strict";n.d(e,{Ag:()=>U,hG:()=>D,nu:()=>B,QA:()=>X,Cg:()=>z,Wu:()=>q,SY:()=>W,uL:()=>w,GL:()=>T,fy:()=>y,v6:()=>G,l:()=>$,Kj:()=>b,xs:()=>tt,jz:()=>V,F7:()=>et});var r=n(187),o=n.n(r),i=n(418),a=n.n(i),s=n(685);function u(t,e){const n=t.getExtension(e);if(!n)return!1;const r=e.split("_")[0],o=new RegExp(`${r}$`);for(const e in n)if("function"==typeof n[e]){const r=e.replace(o,"");e.substring&&(t[r]=n[e].bind(n))}return!0}const c=["EXT_shader_texture_lod","EXT_sRGB","EXT_frag_depth","OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear","OES_standard_derivatives","OES_element_index_uint","EXT_texture_filter_anisotropic","EXT_color_buffer_half_float","OES_vertex_array_object","WEBGL_depth_texture","ANGLE_instanced_arrays","WEBGL_color_buffer_float","WEBGL_draw_buffers","EXT_color_buffer_float"],h=(()=>{let t=!1;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(t=!0),t})(),l=(t,e)=>{if("number"==typeof t)return s.equals(t,e);if(t.length!==e.length)return!1;let n=!0;return t.forEach(((t,r)=>{n=s.equals(t,e[r])&&n})),n},f=t=>{let e,n;return t.touches?(e=t.touches[0].pageX,n=t.touches[0].pageY):(e=t.clientX,n=t.clientY),{x:e,y:n}},_={ACTIVE_ATTRIBUTES:35721,ACTIVE_ATTRIBUTE_MAX_LENGTH:35722,ACTIVE_TEXTURE:34016,ACTIVE_UNIFORMS:35718,ACTIVE_UNIFORM_MAX_LENGTH:35719,ALIASED_LINE_WIDTH_RANGE:33902,ALIASED_POINT_SIZE_RANGE:33901,ALPHA:6406,ALPHA_BITS:3413,ALWAYS:519,ARRAY_BUFFER:34962,ARRAY_BUFFER_BINDING:34964,ATTACHED_SHADERS:35717,BACK:1029,BLEND:3042,BLEND_COLOR:32773,BLEND_DST_ALPHA:32970,BLEND_DST_RGB:32968,BLEND_EQUATION:32777,BLEND_EQUATION_ALPHA:34877,BLEND_EQUATION_RGB:32777,BLEND_SRC_ALPHA:32971,BLEND_SRC_RGB:32969,BLUE_BITS:3412,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,BROWSER_DEFAULT_WEBGL:37444,BUFFER_SIZE:34660,BUFFER_USAGE:34661,BYTE:5120,CCW:2305,CLAMP_TO_EDGE:33071,COLOR_ATTACHMENT0:36064,COLOR_BUFFER_BIT:16384,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,COMPILE_STATUS:35713,COMPRESSED_TEXTURE_FORMATS:34467,CONSTANT_ALPHA:32771,CONSTANT_COLOR:32769,CONTEXT_LOST_WEBGL:37442,CULL_FACE:2884,CULL_FACE_MODE:2885,CURRENT_PROGRAM:35725,CURRENT_VERTEX_ATTRIB:34342,CW:2304,DECR:7683,DECR_WRAP:34056,DELETE_STATUS:35712,DEPTH_ATTACHMENT:36096,DEPTH_BITS:3414,DEPTH_BUFFER_BIT:256,DEPTH_CLEAR_VALUE:2931,DEPTH_COMPONENT:6402,RED:6403,DEPTH_COMPONENT16:33189,DEPTH_FUNC:2932,DEPTH_RANGE:2928,DEPTH_STENCIL:34041,DEPTH_STENCIL_ATTACHMENT:33306,DEPTH_TEST:2929,DEPTH_WRITEMASK:2930,DITHER:3024,DONT_CARE:4352,DST_ALPHA:772,DST_COLOR:774,DYNAMIC_DRAW:35048,ELEMENT_ARRAY_BUFFER:34963,ELEMENT_ARRAY_BUFFER_BINDING:34965,EQUAL:514,FASTEST:4353,FLOAT:5126,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,FRAGMENT_SHADER:35632,FRAMEBUFFER:36160,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_BINDING:36006,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_UNSUPPORTED:36061,FRONT:1028,FRONT_AND_BACK:1032,FRONT_FACE:2886,FUNC_ADD:32774,FUNC_REVERSE_SUBTRACT:32779,FUNC_SUBTRACT:32778,GENERATE_MIPMAP_HINT:33170,GEQUAL:518,GREATER:516,GREEN_BITS:3411,HALF_FLOAT:36193,HIGH_FLOAT:36338,HIGH_INT:36341,INCR:7682,INCR_WRAP:34055,INFO_LOG_LENGTH:35716,INT:5124,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,INVALID_ENUM:1280,INVALID_FRAMEBUFFER_OPERATION:1286,INVALID_OPERATION:1282,INVALID_VALUE:1281,INVERT:5386,KEEP:7680,LEQUAL:515,LESS:513,LINEAR:9729,LINEAR_MIPMAP_LINEAR:9987,LINEAR_MIPMAP_NEAREST:9985,LINES:1,LINE_LOOP:2,LINE_STRIP:3,LINE_WIDTH:2849,LINK_STATUS:35714,LOW_FLOAT:36336,LOW_INT:36339,LUMINANCE:6409,LUMINANCE_ALPHA:6410,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_CUBE_MAP_TEXTURE_SIZE:34076,MAX_FRAGMENT_UNIFORM_VECTORS:36349,MAX_RENDERBUFFER_SIZE:34024,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_TEXTURE_SIZE:3379,MAX_VARYING_VECTORS:36348,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VIEWPORT_DIMS:3386,MEDIUM_FLOAT:36337,MEDIUM_INT:36340,MIRRORED_REPEAT:33648,NEAREST:9728,NEAREST_MIPMAP_LINEAR:9986,NEAREST_MIPMAP_NEAREST:9984,NEVER:512,NICEST:4354,NONE:0,NOTEQUAL:517,NO_ERROR:0,NUM_COMPRESSED_TEXTURE_FORMATS:34466,ONE:1,ONE_MINUS_CONSTANT_ALPHA:32772,ONE_MINUS_CONSTANT_COLOR:32770,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,OUT_OF_MEMORY:1285,PACK_ALIGNMENT:3333,POINTS:0,POLYGON_OFFSET_FACTOR:32824,POLYGON_OFFSET_FILL:32823,POLYGON_OFFSET_UNITS:10752,RED_BITS:3410,RENDERBUFFER:36161,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_BINDING:36007,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_STENCIL_SIZE:36181,RENDERBUFFER_WIDTH:36162,RENDERER:7937,REPEAT:10497,REPLACE:7681,RGB:6407,RGB5_A1:32855,RGB565:36194,RGBA:6408,RGBA4:32854,SAMPLER_2D:35678,SAMPLER_CUBE:35680,SAMPLES:32937,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_BUFFERS:32936,SAMPLE_COVERAGE:32928,SAMPLE_COVERAGE_INVERT:32939,SAMPLE_COVERAGE_VALUE:32938,SCISSOR_BOX:3088,SCISSOR_TEST:3089,SHADER_COMPILER:36346,SHADER_SOURCE_LENGTH:35720,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,SHORT:5122,SRC_ALPHA:770,SRC_ALPHA_SATURATE:776,SRC_COLOR:768,STATIC_DRAW:35044,STENCIL_ATTACHMENT:36128,STENCIL_BACK_FAIL:34817,STENCIL_BACK_FUNC:34816,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,STENCIL_BITS:3415,STENCIL_BUFFER_BIT:1024,STENCIL_CLEAR_VALUE:2961,STENCIL_FAIL:2964,STENCIL_FUNC:2962,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_TEST:2960,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STREAM_DRAW:35040,SUBPIXEL_BITS:3408,TEXTURE:5890,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,TEXTURE_2D:3553,TEXTURE_BINDING_2D:32873,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP:34067,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,UNPACK_ALIGNMENT:3317,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNSIGNED_BYTE:5121,UNSIGNED_INT:5125,UNSIGNED_SHORT:5123,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,VALIDATE_STATUS:35715,VENDOR:7936,VERSION:7938,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_SHADER:35633,VIEWPORT:2978,ZERO:0,R8:33321},d={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6403:"RED",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33321:"R8",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36193:"HALF_FLOAT",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},E={alpha:!1,depth:!0,premultipliedAlpha:!1};var v=n(975),p=n(600);let m=0;function x(){let t,e,n=[0,0,0,0],r=0,o=0,i=0,s=(()=>{const t=document.createElement("canvas");return!(!t.getContext("experimental-webgl2")&&!t.getContext("webgl2"))})(),f=h;const x=v.create(),M=v.create(),R=v.create(),A=p.create(),g=v.create(),b=p.create();this.id="WebGLContext"+m++,this.canvas,this.gl,this.CONTEXT_LOST="contextLost",this.CONTEXT_RESTORED="contextRestored",this.shaderCount=0,this.bufferCount=0,this.textureCount=0,this.frameBufferCount=0,this.maxAnisotropy=0,this.multiRenderTargetSupport=!1,this.maxMultiRenderTargets=0,this.init=function(t,e={}){const n=a()({},E,e);if(void 0!==t){if(t instanceof HTMLCanvasElement){this.canvas=t;let r=s?"webgl2":"webgl";e.webgl1&&(r="webgl",s=!1),this.gl=t.getContext(r,n)}else window.WebGL2RenderingContext&&t instanceof WebGL2RenderingContext?(s=!0,this.gl=t,this.canvas=t.canvas):t instanceof WebGLRenderingContext?(s=!1,this.gl=t,this.canvas=t.canvas):console.error("The source has to be one of the following : Canvas, WebGLRenderingContext or WebGL2RenderingContext");this.canvas.addEventListener("webglcontextlost",S),this.canvas.addEventListener("webglcontextrestored",C),this.extensions=(t=>{const{gl:e}=t,n=window.WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,r={};c.forEach((t=>{r[t]=e.getExtension(t)})),n||(r.OES_vertex_array_object||console.error("OES_vertex_array_object extension is not supported"),u(e,"OES_vertex_array_object"),u(e,"ANGLE_instanced_arrays"),u(e,"WEBGL_draw_buffers"));const o=r.EXT_texture_filter_anisotropic;if(o&&(t.maxAnisotropy=e.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),t.multiRenderTargetSupport=!!t.gl.drawBuffers,t.multiRenderTargetSupport){const n=t.gl.MAX_DRAW_BUFFERS||r.WEBGL_draw_buffers.MAX_DRAW_BUFFERS_WEBGL;t.maxMultiRenderTargets=e.getParameter(n)}return r})(this),(t=>{for(const e in _)t[e]?console.log("already exist : ",e):t[e]=_[e];if(t.webgl2){const e=/^[^a-z]*$/;for(const n in t.gl)e.test(n)&&-1===n.indexOf("FLOAT")&&(t[n]=t.gl[n],_[n]=t.gl[n],d[t[n]]=n)}})(this),this.setSize(this.canvas.width,this.canvas.height),this.enable(this.BLEND),this.enableAlphaBlending(),this.enable(this.DEPTH_TEST),this.enable(this.CULL_FACE),this.cullFace(T.BACK)}else{const t=document.createElement("canvas");this.init(t,n)}},this.clear=function(t=0,e=0,n=0,r=0){const{gl:o}=this;o.clearColor(t,e,n,r),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT)},this.setSize=function(t,e){o=Math.floor(t),i=Math.floor(e),this.canvas.width=o,this.canvas.height=i,r=o/i,this.viewport(0,0,o,i)},this.viewport=function(t,e,r,o){l(n,[t,e,r,o])||(n=[t,e,r,o],this.gl.viewport(t,e,r,o))},this.getViewport=function(){return n},this.getAspectRatio=function(){return r},this.enable=function(t){this.gl.enable(t)},this.disable=function(t){this.gl.disable(t)},this.cullFace=function(t){this.gl.cullFace(t)},this.enableAlphaBlending=function(){const{gl:t}=this;t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)},this.enableAdditiveBlending=function(){const{gl:t}=this;t.blendFunc(t.ONE,t.ONE)},this.setMatrices=function(t){e=t,this.setModelMatrix(M)},this.setModelMatrix=function(t){v.copy(R,t),void 0!==e&&(v.multiply(x,e.viewMatrix,R),p.fromMat4(A,x),p.invert(A,A),p.transpose(A,A),p.fromMat4(b,x),p.invert(b,b),v.invert(g,e.viewMatrix))},this.useShader=function(e){t=e,this.shaderProgram=e.shaderProgram,this.gl.useProgram(this.shaderProgram)},this.draw=function(e){if(e.length)return void e.forEach((t=>this.draw(t)));L(),t.updateUniforms(),e.bind(this);const{drawType:n}=e,{gl:r}=this;e.isInstanced?r.drawElementsInstanced(e.drawType,e.numItems,r.UNSIGNED_INT,0,e.numInstance):n===r.POINTS?r.drawArrays(n,0,e.vertexSize):r.drawElements(n,e.numItems,r.UNSIGNED_INT,0),e.unbind()},this.getCamera=function(){return e},this.destroy=function(t=!0){this.gl.getExtension("WEBGL_lose_context").loseContext(),t&&void 0!==this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)},this.__defineGetter__("width",(function(){return o})),this.__defineGetter__("height",(function(){return i})),this.__defineGetter__("webgl2",(function(){return s})),this.__defineGetter__("isMobile",(function(){return f})),this.__defineGetter__("aspectRatio",(function(){return r}));const L=()=>{void 0!==e&&(t.uniform("uProjectionMatrix","mat4",e.projectionMatrix),t.uniform("uViewMatrix","mat4",e.viewMatrix),t.uniform("uNormalMatrix","mat3",A),t.uniform("uModelViewMatrixInverse","mat3",b)),t.uniform("uModelMatrix","mat4",R)},S=()=>{this.emit(this.CONTEXT_LOST)},C=()=>{this.emit(this.CONTEXT_RESTORED)}}x.prototype=Object.assign(Object.create(o().prototype),{constructor:x});const T=new x,M={float:"uniform1f",vec2:"uniform2fv",vec3:"uniform3fv",vec4:"uniform4fv",int:"uniform1i",ivec2:"uniform2i",ivec3:"uniform3i",ivec4:"uniform4i",mat2:"uniformMatrix2fv",mat3:"uniformMatrix3fv",mat4:"uniformMatrix4fv"},R=t=>"number"==typeof t?t:t.slice?t.slice(0):new Float32Array(t),A=t=>"object"==typeof t?function(t){return 9===t.length?"mat3":16===t.length?"mat4":`vec${t.length}`}(t):"float";function g(t,e){let n;this.vertexShader=t||"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\n\nvoid main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n}",this.fragmentShader=e||"precision highp float;\n#define GLSLIFY 1\n// varying vec2 vTextureCoord;\n\nvoid main(void) {\n gl_FragColor = vec4(1.0);\n}",this.shaderProgram;let r={};this.bind=function(t){if(void 0===t||void 0===n||t===n){if(n=t||T,!this.shaderProgram){const t=o(this.vertexShader,!0),e=o(this.fragmentShader,!1);i(t,e)}n.useShader(this)}else console.error("this shader has been bind to a different WebGL Rendering Context",n.id)},this.uniform=function(t,e,n){let o,i;void 0===n?(i=A(e),o=e):(i=e,o=n);const a=M[i];if(r[t]){const e=r[t];l(e.value,o)||(e.value=R(o),e.changed=!0)}else r[t]={type:i,uniformType:a,value:R(o),changed:!0};return this},this.updateUniforms=function(){if(!n)return void console.warn("No WebGL Context has been set yet, please call shader.bind() first");const{gl:t}=n;for(let e in r){const n=r[e];if(n.changed){const r=e;n.uniformLoc||(n.uniformLoc=t.getUniformLocation(this.shaderProgram,r));const{uniformLoc:o,uniformType:i,value:a}=n;null!==o&&(-1===i.indexOf("Matrix")?t[i](o,a):t[i](o,!1,a)),n.changed=!1}}},this.destroy=function(){const{gl:t}=n;t.deleteProgram(this.shaderProgram),n.shaderCount--};const o=(t,e)=>{const{gl:r}=n,o=e?n.VERTEX_SHADER:n.FRAGMENT_SHADER,i=r.createShader(o);return r.shaderSource(i,t),r.compileShader(i),r.getShaderParameter(i,r.COMPILE_STATUS)?i:(console.warn("Error in Shader : ",r.getShaderInfoLog(i)),console.log((t=>{const e=t.split("\n");for(let t=0;t{const{gl:r}=n;this.shaderProgram=r.createProgram(),r.attachShader(this.shaderProgram,t),r.attachShader(this.shaderProgram,e),r.deleteShader(t),r.deleteShader(e),r.linkProgram(this.shaderProgram),n.shaderCount++}}function b(t=_.TRIANGLES){this.drawType=t,this.numItems=0;let e,n,r,o,i,a=[],s=[],u=[],c=!0,h=!1,l=0;this.bufferData=function(t,e,n,r=_.STATIC_DRAW,o=!1){let i,a=[];if("number"==typeof t[0]){if(i=t,void 0===n)return console.error("Missing element size for flatten data :",e),this;for(let t=0;t{for(let n=0;ne.name===t))},this.getAttributes=function(){return a},this.getSource=function(t){const e=this.getAttribute(t);return e?e.source:[]},this.generateFaces=function(){let t,e,n,o,i,a;u=[];const{vertices:s}=this;for(let c=0;c{t.deleteBuffer(e.buffer),e.source=[],e.dataArray=[],i.bufferCount--})),o&&(t.deleteBuffer(o),i.bufferCount--),t.deleteVertexArray(e),a=[],r=[],s=[]},this.__defineGetter__("vertices",(function(){return this.getSource("aVertexPosition")})),this.__defineGetter__("coords",(function(){return this.getSource("aTextureCoord")})),this.__defineGetter__("normal",(function(){return this.getSource("aNormal")})),this.__defineGetter__("indices",(function(){return r})),this.__defineGetter__("faces",(function(){return u})),this.__defineGetter__("isInstanced",(function(){return h})),this.__defineGetter__("numInstance",(function(){return l}));const f=(t,e,n,r,o=_.STATIC_DRAW,i=!1)=>{const u=o;h=i||h;const c=new Float32Array(t),l=this.getAttribute(n);return l?(l.itemSize=r,l.dataArray=c,l.source=e):a.push({name:n,source:e,itemSize:r,usage:u,dataArray:c,isInstanced:i}),s.push(n),this},d=()=>{const{shaderProgram:t,gl:n}=i;0!=s.length&&(e||(e=n.createVertexArray()),n.bindVertexArray(e),a.forEach((e=>{if(-1!==s.indexOf(e.name)){const r=function(t,e){let n;const{gl:r}=e;return void 0!==t.buffer?n=t.buffer:(n=r.createBuffer(),t.buffer=n,e.bufferCount++),n}(e,i);n.bindBuffer(n.ARRAY_BUFFER,r),n.bufferData(n.ARRAY_BUFFER,e.dataArray,e.usage);const o=((t,e,n)=>(void 0===e.cacheAttribLoc&&(e.cacheAttribLoc={}),void 0===e.cacheAttribLoc[n]&&(e.cacheAttribLoc[n]=t.getAttribLocation(e,n)),e.cacheAttribLoc[n]))(n,t,e.name);o>=0&&(n.enableVertexAttribArray(o),n.vertexAttribPointer(o,e.itemSize,n.FLOAT,!1,0,0)),e.attrPosition=o,e.isInstanced&&n.vertexAttribDivisor(o,1)}})),E(),n.bindVertexArray(null),c=!1,s=[])},E=()=>{const{gl:t}=i;c&&(o||(o=t.createBuffer(),i.bufferCount++),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,n))}}const L=t=>0!==t&&!(t&t-1);class S{constructor(t){this._value=t}set(t,e=1){this._value=this._value,this._value=0===e?this._value&0<>=t,1===e}reset(t){this._value=t}get value(){return this._value}}const C="This browser doesn't support multi render targets : WEBGL_draw_buffers",N="This framebuffer has been bind to a different WebGL Rendering Context",P="This texture has been bind to a different WebGL Rendering Context",I=(t,e="")=>{console.error(t,e)};class y{constructor(t,e={},n=0,r=0){if(this._fromWebGLTexture=!1,t instanceof WebGLTexture)this._texture=t,this._fromWebGLTexture=!0;else{if(this._source=t,this._isHtmlElement=(t=>t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)(this._source),!this._isHtmlElement&&t&&!((t,e)=>{let n=!0;return"Array"===t.constructor.name&&(console.error("Please convert texture source to Unit8Array or Float32Array"),n=!1),void 0===e.type&&"Uint8Array"!==t.constructor.name&&console.error("Using none Unit8Array, pleaes specify type in the texture parameters"),n})(t,e))return;this._getDimension(t,n,r),this._params=function(t,e,n){if(!t.minFilter){let r=_.LINEAR;e&&e&&L(e)&&L(n)&&(r=_.NEAREST_MIPMAP_LINEAR),t.minFilter=r}return t.mipmap=void 0===t.mipmap||t.mipmap,t.magFilter=t.magFilter||_.LINEAR,t.wrapS=t.wrapS||_.CLAMP_TO_EDGE,t.wrapT=t.wrapT||_.CLAMP_TO_EDGE,t.internalFormat=t.internalFormat||_.RGBA,t.format=t.format||_.RGBA,t.premultiplyAlpha=void 0!==t.premultiplyAlpha&&t.premultiplyAlpha,t.level=t.level||0,t.type=t.type||_.UNSIGNED_BYTE,t}(e,this._width,this._height),this._checkMipmap()}this._parametersState=new S(0)}bind(t,e){if(void 0!==e&&void 0!==this.GL&&e!==this.GL)return void I(P,this.GL.id);this.GL=e||T;const{gl:n}=this.GL;this._fromWebGLTexture||this.createTexture(this.GL),n.activeTexture(n.TEXTURE0+t),n.bindTexture(n.TEXTURE_2D,this._texture),this._checkParameters()}createTexture(t){void 0===t||void 0===this.GL||t===this.GL?(this.GL=t||T,this._texture||(((t,e)=>{t.webgl2&&(e.type===_.HALF_FLOAT?(e.type=t.gl.HALF_FLOAT,e.internalFormat=_.RGBA16F):e.type===_.FLOAT&&(e.internalFormat=_.RGBA32F))})(this.GL,this._params),this._uploadTexture())):I(P,this.GL.id)}updateTexture(t,e){this.GL=e||T,this._source=t,this._uploadTexture()}generateMipmap(){if(!this._generateMipmap)return;const{gl:t}=this.GL;t.bindTexture(t.TEXTURE_2D,this._texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){const{gl:t}=this.GL;t.deleteTexture(this._texture),this.GL.textureCount--}showProperties(){console.log("Dimension :",this._width,this._height);for(const t in this._params)console.log(t,d[this._params[t]]||this._params[t])}_uploadTexture(){const{gl:t}=this.GL;this._texture||(this._texture=t.createTexture(),this.GL.textureCount++),t.bindTexture(t.TEXTURE_2D,this._texture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._isHtmlElement&&!this.GL.webgl2?t.texImage2D(t.TEXTURE_2D,0,this._params.internalFormat,this._params.format,this._params.type,this._source):t.texImage2D(t.TEXTURE_2D,0,this._params.internalFormat,this._width,this._height,0,this._params.format,this._params.type,this._source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this._params.magFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this._params.minFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._params.wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._params.wrapT),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha),this._generateMipmap&&t.generateMipmap(t.TEXTURE_2D)}_checkParameters(){const{gl:t}=this.GL;this._parametersState.value>0&&(this._parametersState.get(0)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this._params.minFilter):this._parametersState.get(1)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this._params.magFilter):this._parametersState.get(2)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._params.wrapS):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._params.wrapT)),this._parametersState.reset(0)}_getDimension(t,e,n){t?(this._width=t.width||t.videoWidth,this._height=t.height||t.videoWidth,this._width=this._width||e,this._height=this._height||n,this._width&&this._height||(this._width=this._height=Math.sqrt(t.length/4))):(this._width=e,this._height=n)}_checkMipmap(){this._generateMipmap=this._params.mipmap,L(this._width)&&L(this._height)||(this._generateMipmap=!1),-1===d[this._params.minFilter].indexOf("MIPMAP")&&(this._generateMipmap=!1)}get texture(){return this._texture}set minFilter(t){this._params.minFilter=t,this._parametersState.set(0,1)}get minFilter(){return this._params.minFilter}set magFilter(t){this._params.magFilter=t,this._parametersState.set(1,1)}get magFilter(){return this._params.magFilter}set wrapS(t){this._params.wrapS=t,this._parametersState.set(2,1)}get wrapS(){return this._params.wrapS}set wrapT(t){this._params.wrapT=t,this._parametersState.set(3,1)}get wrapT(){return this._params.wrapT}get width(){return this._width}get height(){return this._height}get glTexture(){return this._texture}}function w(t,e,n={},r=1){let o,i;const a=t,s=e,u=n,c=r,h=[];let l;this.bind=function(t,e=!0){if(void 0!==t&&void 0!==o&&t!==o)return void I(N,o.id);o=t||T;const{gl:n}=o;c>1&&!o.multiRenderTargetSupport&&I(C,o.id),i||f(),e&&o.viewport(0,0,a,s),n.bindFramebuffer(n.FRAMEBUFFER,i)},this.unbind=function(t=!0){t&&o.viewport(0,0,o.width,o.height);const{gl:e}=o;e.bindFramebuffer(e.FRAMEBUFFER,null),h.forEach((t=>{t.generateMipmap()}))},this.getTexture=function(t=0){return h[t]},this.destroy=function(){const{gl:t}=o;h.forEach((t=>t.destroy())),l.destroy(),t.deleteFramebuffer(i),o.frameBufferCount--};const f=()=>{d();const{gl:t}=o;i=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,i),o.frameBufferCount++;const e=o.webgl2?t.DRAW_FRAMEBUFFER:t.FRAMEBUFFER,n=[];for(let r=0;r{for(let t=0;t{const i=Object.assign({},u);n||(n=t),i.internalFormat=t||_.RGBA,i.format=n||_.RGBA,i.type=e||i.type,Object.assign(i,r);const c=new y(null,i,a,s);return c.createTexture(o),c};this.__defineGetter__("texture",(function(){return h[0]})),this.__defineGetter__("depthTexture",(function(){return l})),this.__defineGetter__("width",(function(){return a})),this.__defineGetter__("height",(function(){return s}))}var O=n(160);class F{constructor(){this._mtx=v.create(),this._mtxView=v.create(),this._mtxProj=v.create(),this._near=0,this._far=0,this._lookDir=O.create()}lookAt(t,e,n=[0,1,0]){v.lookAt(this._mtxView,t,e,n)}setFromViewProjection(t,e){v.copy(this._mtxView,t),v.copy(this._mtxProj,e)}setViewMatrix(t){v.copy(this._mtxView,t)}setProjectionMatrix(t){v.copy(this._mtxProj,t)}_updateMatrices(){}get viewMatrix(){return v.mul(this._mtx,this._mtxProj,this._mtxView),this._mtx}get viewMatrix(){return this._mtxView}get view(){return this._mtxView}get projectionMatrix(){return this._mtxProj}get projection(){return this._mtxProj}get position(){const t=v.create();return v.invert(t,this._mtxView),[t[12],t[13],t[14]]}get direction(){const t=p.create();return p.fromMat4(t,this._mtxView),p.transpose(t,t),O.transformMat3(this._lookDir,[0,0,-1],t),O.normalize(this._lookDir,this._lookDir),this._lookDir}set near(t){this._near=t,this._updateMatrices()}get near(){return this._near}set far(t){this._far=t,this._updateMatrices()}get far(){return this._far}}class U extends F{constructor(t,e,n,r,o=.1,i=100){super(),this._left=0,this._right=0,this._top=0,this._bottom=0,this.ortho(t,e,n,r,o,i)}ortho(t,e,n,r,o=.1,i=100){this.left=t,this.right=e,this.top=n,this.bottom=r,v.ortho(this._mtxProj,t,e,r,n,o,i),this._left=t,this._right=e,this._top=n,this._bottom=r,this._near=o,this._far=i}_updateMatrices(){this.ortho(this._left,this._right,this._top,this._bottom,this._near,this._far)}}class D{constructor(t){return this._GL=t||T,this._uniforms={},this._uniformTextures=[],this._fbo,this._clearColor={r:0,g:0,b:0,a:0},this}setClearColor(t=0,e=0,n=0,r=0){return this._clearColor.r=t,this._clearColor.g=e,this._clearColor.b=n,this._clearColor.a=r,this}useProgram(t,e){return this._shader=t instanceof g?t:new g(t,e),this}setMesh(t){return this._mesh=t,this}createMesh(t){return this._mesh=new b(t),this}bufferVertex(t){return this._mesh||(this._mesh=new b),this._mesh.bufferVertex(t),this}bufferTexCoord(t){return this._mesh||(this._mesh=new b),this._mesh.bufferTexCoord(t),this}bufferNormal(t){return this._mesh||(this._mesh=new b),this._mesh.bufferNormal(t),this}bufferIndex(t){return this._mesh||(this._mesh=new b),this._mesh.bufferIndex(t),this}bufferInstance(t,e){return this._mesh?(this._mesh.bufferInstance(t,e),this):(console.warn("Need to create mesh first"),this)}bufferData(t,e){return this._mesh||(this._mesh=new b),this._mesh.bufferData(t,e),this}uniform(t,e,n){const r=t;let o,i;return void 0===n?(i=A(e),o=e):(i=e,o=n),this._uniforms[r]={type:i,value:o},this}uniformTexture(t,e,n){return this.bindTexture(t,e,n)}bindTexture(t,e,n){return void 0!==n?this._uniformTextures[n]={name:t,texture:e}:(console.log("no index",t),this._uniformTextures.push({name:t,texture:e})),this}bindFrameBuffer(t){return this._fbo=t,this}draw(){if(this._shader){if(this._mesh){if(this._fbo){const{r:t,g:e,b:n,a:r}=this._clearColor;this._fbo.bind(this._GL),this._GL.clear(t,e,n,r)}this._shader.bind(this._GL);for(const t in this._uniforms){const e=this._uniforms[t];this._shader.uniform(t,e.type,e.value)}return this._uniformTextures.forEach(((t,e)=>{void 0!==t&&(this._shader.uniform(t.name,"int",e),t.texture.bind(e,this._GL))})),this._GL.draw(this._mesh),this._fbo&&this._fbo.unbind(),this}console.warn("No Mesh assigned for draw call")}else console.warn("No GLShader assigned for draw call")}get shader(){return this._shader}get framebuffer(){return this._fbo}}class B extends D{constructor(t){super(t);const e=this._GL,n=1e3,r=[[-n,0,0],[n,0,0],[0,-n,0],[0,n,0],[0,0,-n],[0,0,n]];this.createMesh(e.LINES).bufferVertex(r).bufferData([[1,0,0],[1,0,0],[0,1,0],[0,1,0],[0,0,1],[0,0,1]],"aColor").bufferIndex([0,1,2,3,4,5]).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec3 aColor;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nout vec3 vColor;\n\nvoid main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);\n vColor = aColor;\n}","#version 300 es\nprecision highp float;\n#define GLSLIFY 1\nin vec3 vColor;\nuniform float uOpacity;\nout vec4 oColor;\n\nvoid main(void) {\n oColor = vec4(vColor, uOpacity);\n}"),this.opacity=.75}draw(){this.uniform("uOpacity",this.opacity),super.draw()}}const G={plane:(t,e,n,r="xy")=>{const o=[],i=[],a=[],s=[],u=t/n,c=e/n,h=1/n,l=.5*-t,f=.5*-e;let _=0;for(let t=0;t{const o=t/2,i=(e=e||t)/2,a=(n=n||t)/2,s=[],u=[],c=[],h=[];let l=0;return s.push([-o,i,-a]),s.push([o,i,-a]),s.push([o,-i,-a]),s.push([-o,-i,-a]),h.push([0,0,-1]),h.push([0,0,-1]),h.push([0,0,-1]),h.push([0,0,-1]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,-a]),s.push([o,i,a]),s.push([o,-i,a]),s.push([o,-i,-a]),h.push([1,0,0]),h.push([1,0,0]),h.push([1,0,0]),h.push([1,0,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,a]),s.push([-o,i,a]),s.push([-o,-i,a]),s.push([o,-i,a]),h.push([0,0,1]),h.push([0,0,1]),h.push([0,0,1]),h.push([0,0,1]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([-o,i,a]),s.push([-o,i,-a]),s.push([-o,-i,-a]),s.push([-o,-i,a]),h.push([-1,0,0]),h.push([-1,0,0]),h.push([-1,0,0]),h.push([-1,0,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,-a]),s.push([-o,i,-a]),s.push([-o,i,a]),s.push([o,i,a]),h.push([0,1,0]),h.push([0,1,0]),h.push([0,1,0]),h.push([0,1,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,-i,a]),s.push([-o,-i,a]),s.push([-o,-i,-a]),s.push([o,-i,-a]),h.push([0,-1,0]),h.push([0,-1,0]),h.push([0,-1,0]),h.push([0,-1,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),r&&c.reverse(),(new b).bufferVertex(s).bufferTexCoord(u).bufferIndex(c).bufferNormal(h)},sphere:(t,e,n=!1)=>{const r=[],o=[],i=[],a=[],s=1/e;let u=0;function c(n,r,o=!1){const i=n/e*Math.PI-.5*Math.PI,a=r/e*Math.PI*2,s=o?1:t,u=[];u[1]=Math.sin(i)*s;const c=Math.cos(i)*s;u[0]=Math.cos(a)*c,u[2]=Math.sin(a)*c;const h=1e4;return u[0]=Math.floor(u[0]*h)/h,u[1]=Math.floor(u[1]*h)/h,u[2]=Math.floor(u[2]*h)/h,u}for(let t=0;t(new b).bufferData([[-1,-1],[-1,4],[4,-1]],"aPosition",2).bufferIndex([2,1,0])},V={simpleColorFrag:"#version 300 es\nprecision highp float;\n#define GLSLIFY 1\n\nuniform vec3 uColor;\nuniform float uOpacity;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor = vec4(uColor, uOpacity);\n}",copyFrag:"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\n\nout vec4 oColor;\n\nvoid main(void) {\n oColor = texture(uMap, vTextureCoord);\n}",bigTriangleVert:"#version 300 es\n\nprecision mediump float;\n#define GLSLIFY 1\nin vec2 aPosition;\nout vec2 vTextureCoord;\n\nvoid main(void) {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n vTextureCoord = aPosition * .5 + .5;\n}",generalVert:"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec3 uTranslate;\nuniform vec3 uScale;\nuniform vec3 uRotation;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nvoid main(void) {\n vec3 pos = aVertexPosition * uScale;\n pos.yz = rotate(pos.yz, uRotation.x);\n pos.xz = rotate(pos.xz, uRotation.y);\n pos.xy = rotate(pos.xy, uRotation.z);\n pos += uTranslate;\n\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(pos, 1.0);\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n}"};class X extends D{constructor(t){super(t),this.setMesh(G.sphere(1,12)).useProgram(V.generalVert,V.simpleColorFrag).uniform("uRotation",[0,0,0])}draw(t,e=[1,1,1],n=[1,1,1],r=1){this.uniform("uTranslate",t).uniform("uScale",e).uniform("uColor",n).uniform("uOpacity",r),super.draw(0)}}class z extends D{constructor(t){super(t),this.setMesh(G.bigTriangle()).useProgram(V.bigTriangleVert,V.copyFrag)}draw(t){this.bindTexture("texture",t,0),super.draw(0)}}const{mat4:H,vec4:Y}=n(720);class j{constructor(t,e,n,r={},o=1){this._fbos=[];for(let i=0;ithis._update()))}_update(){this._checkLimit(),this._value+=(this._targetValue-this._value)*this.easing,Math.abs(this._targetValue-this._value)<1e-4&&(this._value=this._targetValue)}setTo(t){this._targetValue=this._value=t}add(t){this._targetValue+=t}limit(t,e){t>e?this.limit(e,t):(this._min=t,this._max=e,this._checkLimit())}_checkLimit(){void 0!==this._min&&this._targetValuethis._max&&(this._targetValue=this._max)}destroy(){k.Z.removeEF(this._efIndex)}set value(t){this._targetValue=t}get value(){return this._value}get targetValue(){return this._targetValue}}const Z=function(t,e){const n=e||{};return t.touches?(n.x=t.touches[0].pageX,n.y=t.touches[0].pageY):(n.x=t.clientX,n.y=t.clientY),n};class K{#t=!1;#e=!1;#n=!1;#r=!1;#o;#i={};#a={};#s=v.create();#u=v.create();#c=v.create();#h=v.create();#l=O.create();#f=O.create();#_=O.fromValues(0,1,0);radius=new q(0);rx=new q(0);ry=new q(0);#d=0;#E=0;constructor(t,e=5,n=window){this.#o=t,this.radius.setTo(e),this.#f=[0,0,this.radius],this.rx.limit(-Math.PI/2+.01,Math.PI/2-.01),n.addEventListener("mousewheel",this._onWheel),n.addEventListener("DOMMouseScroll",this._onWheel),n.addEventListener("mousedown",this._onDown),n.addEventListener("mousemove",this._onMove),window.addEventListener("mouseup",this._onUp),n.addEventListener("touchstart",this._onDown),n.addEventListener("touchmove",this._onMove),window.addEventListener("touchend",this._onUp),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.update(),k.Z.addEF(this._loop)}lock(t=!0){this.#t=t,this.#e=t,this.#r=!1}lockZoom(t=!0){this.#e=t}lockRotation(t=!0){this.#t=t}update(){O.set(this.#f,0,0,this.radius.value),O.rotateX(this.#f,this.#f,[0,0,0],this.rx.value),O.rotateY(this.#f,this.#f,[0,0,0],this.ry.value),v.lookAt(this.#s,this.#f,this.#l,this.#_),v.invert(this.#u,this.#s),v.mul(this.#s,this.#s,this.#h),v.mul(this.#s,this.#s,this.#c),this.#o?.setViewMatrix(this.#s)}_onDown=t=>{this.#t||(this.#r=!0,Z(t,this.#i),Z(t,this.#a),this.#d=this.rx.targetValue,this.#E=this.ry.targetValue,v.identity(this.#c))};_onMove=t=>{if(this.#t)return;if(!this.#r)return;if(Z(t,this.#i),t.shiftKey){const t=[this.#i.x-this.#a.x,-(this.#i.y-this.#a.y),0];return O.transformMat4(t,t,this.#u),O.scale(t,t,.01),v.identity(this.#c,this.#c),void v.translate(this.#c,this.#c,t)}const e=this.#i.x-this.#a.x;this.ry.value=.01*-e+this.#E;const n=this.#i.y-this.#a.y;this.rx.value=.01*-n+this.#d};_onUp=()=>{this.#r=!1,this.#n&&(v.mul(this.#h,this.#h,this.#c),v.identity(this.#c))};_onWheel=t=>{if(this.#e)return;const e=t.wheelDelta,n=t.detail;let r=0;r=n?e?e/n/40*n>0?1:-1:-n/3:e/120,this.radius.add(2*-r),this.radius.targetValue<0&&(this.radius.value=1e-4)};_onKeyDown=t=>{t.code.indexOf("Shift")>-1&&(this.#n=!0)};_onKeyUp=t=>{"Shift"===t.key&&(v.mul(this.#h,this.#h,this.#c),v.identity(this.#c)),this.#n=!1};_loop=()=>{this.update()}}function Q(t,e){this.origin=t,this.direction=e;const n=O.create(),r=O.create(),o=O.create(),i=O.create(),a=O.create(),s=O.create(),u=O.create(),c=O.create();this.at=function(t){return O.copy(i,this.direction),O.scale(i,i,t),O.add(i,i,this.origin),i},this.lookAt=function(t){O.sub(this.direction,t,this.origin),O.normalize(this.origin,this.origin)},this.closestPointToPoint=function(t){const e=O.create();O.sub(t,this.origin);const n=O.dot(e,this.direction);return n<0?O.clone(this.origin):(O.copy(e,this.direction),O.scale(e,e,n),O.add(e,e,this.origin),e)},this.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},this.distanceSqToPoint=function(t){const e=O.create();O.sub(e,t,this.origin);const n=O.dot(e,this.direction);return n<0?O.squaredDistance(this.origin,t):(O.copy(e,this.direction),O.scale(e,e,n),O.add(e,e,this.origin),O.squaredDistance(e,t))},this.intersectsSphere=function(t,e){return this.distanceToPoint(t)<=e},this.intersectSphere=function(t,e){const n=O.create();O.sub(n,t,this.origin);const r=O.dot(n,this.direction),o=O.dot(n,n)-r*r,i=e*e;if(o>i)return null;const a=Math.sqrt(i-o),s=r-a,u=r+a;return s<0&&u<0?null:s<0?this.at(u):this.at(s)},this.intersectTriangle=function(t,e,i,h=!0){O.copy(n,t),O.copy(r,e),O.copy(o,i),O.sub(a,r,n),O.sub(s,o,n),O.cross(u,a,s);let l,f=O.dot(this.direction,u);if(f>0){if(h)return null;l=1}else{if(!(f<0))return null;l=-1,f=-f}O.sub(c,this.origin,n),O.cross(s,c,s);const _=l*O.dot(this.direction,s);if(_<0)return null;O.cross(a,a,c);const d=l*O.dot(this.direction,a);if(d<0)return null;if(_+d>f)return null;const E=-l*O.dot(c,u);return E<0?null:this.at(E/f)}}class $ extends(o()){constructor(t,e,n,r=!1,o=window){super(),this._mesh=t,this._mesh.generateFaces(),this._camera=e,this.faceVertices=t.faces.map((t=>t.vertices)),this.clickTolerance=8,this._ray=new Q([0,0,0],[0,0,-1]),this._hit=O.fromValues(-999,-999,-999),this._lastPos,this._firstPos,this.modelMatrix=v.create(),this.resolution=n||[window.innerWidth,window.innerHeight],this._listenerTarget=o,this._skippingMove=r,this._onMoveBind=t=>this._onMove(t),this._onDownBind=t=>this._onDown(t),this._onUpBind=()=>this._onUp(),this.connect()}connect(){this._listenerTarget.addEventListener("mousedown",this._onDownBind),this._listenerTarget.addEventListener("mousemove",this._onMoveBind),this._listenerTarget.addEventListener("mouseup",this._onUpBind)}disconnect(){this._listenerTarget.removeEventListener("mousedown",this._onDownBind),this._listenerTarget.removeEventListener("mousemove",this._onMoveBind),this._listenerTarget.removeEventListener("mouseup",this._onUpBind)}_checkHit(t="onHit"){const e=this._camera;if(!e)return;const n=this._lastPos.x/this.resolution[0]*2-1,r=-this._lastPos.y/this.resolution[1]*2+1;let o;e.generateRay([n,r,0],this._ray);const i=O.create(),a=O.create(),s=O.create();let u=0;const c=(t,e)=>{O.transformMat4(e,t,this.modelMatrix)};for(let t=0;tthis.resize())),this._efIndex=k.Z.addEF((()=>this._loop()))}stop(){this._isRunning=!1}resume(){this._isRunning=!0}_initTextures(){}_initViews(){}update(){}render(){}_loop(){this._isRunning&&(this.update(),this._GL.viewport(0,0,this._GL.width,this._GL.height),this._GL.setMatrices(this.camera),this.render())}resize(){this._GL.setSize(window.innerWidth,window.innerHeight),this.camera.setAspectRatio(this._GL.aspectRatio)}}const et=t=>{const e=t.split("\n"),n=[],r=[],o=[],i=[],a=[],s=[],u=[];let c,h=0;const l=/v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,f=/vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,_=/vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,d=/f( +-?\d+)( +-?\d+)( +-?\d+)( +-?\d+)?/,E=/f( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))?/,v=/f( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))?/,p=/f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/;function m(t){const e=parseInt(t);return 3*(e>=0?e-1:e+i.length/3)}function x(t){const e=parseInt(t);return 3*(e>=0?e-1:e+a.length/3)}function T(t){const e=parseInt(t);return 2*(e>=0?e-1:e+s.length/2)}function M(t,e,r){n.push([i[t],i[t+1],i[t+2]]),n.push([i[e],i[e+1],i[e+2]]),n.push([i[r],i[r+1],i[r+2]]),u.push(3*h+0),u.push(3*h+1),u.push(3*h+2),h++}function R(t,e,n){r.push([s[t],s[t+1]]),r.push([s[e],s[e+1]]),r.push([s[n],s[n+1]])}function A(t,e,n){o.push([a[t],a[t+1],a[t+2]]),o.push([a[e],a[e+1],a[e+2]]),o.push([a[n],a[n+1],a[n+2]])}function g(t,e,n,r,o,i,a,s,u,c,h,l){let f,_=m(t),d=m(e),E=m(n);void 0===r?M(_,d,E):(f=m(r),M(_,d,f),M(d,E,f)),void 0!==o&&(_=T(o),d=T(i),E=T(a),void 0===r?R(_,d,E):(f=T(s),R(_,d,f),R(d,E,f))),void 0!==u&&(_=x(u),d=x(c),E=x(h),void 0===r?A(_,d,E):(f=x(l),A(_,d,f),A(d,E,f)))}for(let t=0;t{const e=t.normals.length>0,n=t.coords.length>0;let r;if(t.positions.length>65535){const o=[];let i=0;const a={};for(a.positions=t.positions.concat(),a.coords=t.coords.concat(),a.indices=t.indices.concat(),a.normals=t.normals.concat();t.indices.length>0;){const s=Math.min(65535,t.positions.length),u=t.indices.splice(0,s),c=[],h=[],l=[];let f,_=0;for(let t=0;t_&&(_=u[t]),f=u[t],c.push(a.positions[f]),n&&h.push(a.coords[f]),e&&l.push(a.normals[f]),u[t]-=i;i=_+1,r=new b,r.bufferVertex(c),n&&r.bufferTexCoord(h),r.bufferIndex(u),e&&r.bufferNormal(l),o.push(r)}return o}return r=new b,r.bufferVertex(t.positions),n&&r.bufferTexCoord(t.coords),r.bufferIndex(t.indices),e&&r.bufferNormal(t.normals),r};n(643)},643:()=>{Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function t(){var e=isNaN(arguments[0])?1:Number(arguments[0]);return e?Array.prototype.reduce.call(this,(function(n,r){return Array.isArray(r)?n.push.apply(n,t.call(r,e-1)):n.push(r),n}),[]):Array.prototype.slice.call(this)},writable:!0})},297:()=>{let t="123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";var e="oo"+Array(49).fill(0).map((e=>t[Math.random()*t.length|0])).join("");let n=e.slice(2),r=new RegExp(".{"+(e.length/4|0)+"}","g"),o=n.match(r).map((e=>{return(n=e).split("").reduce(((e,r,o)=>e+t.indexOf(r)*Math.pow(t.length,n.length-o-1)),0);var n}));window.fxhash=e,window.fxrand=((t,e,n,r)=>()=>{var o=((t|=0)+(e|=0)|0)+(r|=0)|0;return r=r+1|0,t=e^e>>>9,e=(n|=0)+(n<<3)|0,n=(n=n<<21|n>>>11)+o|0,(o>>>0)/4294967296})(...o)},619:(t,e,n)=>{"use strict";n.d(e,{Ag:()=>s,jE:()=>_,Gv:()=>a,H:()=>u,ei:()=>l,MX:()=>c,Iy:()=>h,Ak:()=>r,CW:()=>f});const r=(t,e="data",n=!0)=>{var r=n?JSON.stringify(t,null,4):JSON.stringify(t),i=o(r),a=new Blob([i],{type:"application/octet-stream"}),s=URL.createObjectURL(a),u=document.createElement("a");u.setAttribute("href",s),u.setAttribute("download",`${e}.json`);var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),u.dispatchEvent(c)},o=t=>{for(var e=[],n=0;n[t,.99*t,.96*t],s=Math.PI/180,u=t=>{console.error(t)},c=(t,e)=>void 0===t?fxrand():void 0===e?fxrand()*t:t+(e-t)*fxrand(),h=(t,e)=>Math.floor(c(t,e)),l=t=>t[h(t.length)],f=(t,e,n)=>{var r=Math.max(0,Math.min(1,(n-t)/(e-t)));return r*r*(3-2*r)},_=i.fromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1)}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.m=n,o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,n)=>(o.f[n](t,e),e)),[])),o.u=t=>t+".bundle.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="fxhash-boilerplate-webpack:",o.l=(n,r,i,a)=>{if(t[n])t[n].push(r);else{var s,u;if(void 0!==i)for(var c=document.getElementsByTagName("script"),h=0;h{s.onerror=s.onload=null,clearTimeout(_);var o=t[n];if(delete t[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((t=>t(r))),e)return e(r)},_=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),u&&document.head.appendChild(s)}},o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");n.length&&(t=n[n.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{var t={179:0};o.f.j=(e,n)=>{var r=o.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,o)=>r=t[e]=[n,o]));n.push(r[2]=i);var a=o.p+o.u(e),s=new Error;o.l(a,(n=>{if(o.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,[a,s,u]=n,c=0;if(a.some((e=>0!==t[e]))){for(r in s)o.o(s,r)&&(o.m[r]=s[r]);u&&u(o)}for(e&&e(n);c{"use strict";var t=o(247),e=(o(297),o(855)),n=o(619);let r;const i=t=>{r=t.map((({id:t,file:n,type:r})=>{const o=n;let i;switch(r){case"jpg":case"png":i=new e.fy(n);break;case"text":i=(0,e.F7)(n)}return{id:t,source:o,type:r,file:i}})),console.table(r)},a=t=>{const e=r.find((e=>e.id===t));return e?e.file:null};var s=o(51),u=o(160),c=o(975),h=o(437);class l extends e.hG{constructor(){super();const{numParticles:r}=t.Z,o=[],i=[],a=[],s=[],c=[],h=()=>{const t=2*Math.sqrt((0,n.MX)());return u.random([0,0,0],t)};for(let t=0;t 0.5)\n // discard;\n\n vec2 uv = gl_PointCoord.xy - 0.5;\n uv = abs(rotate(uv, PI / 4.0 * step(vRandom.z, 0.5)));\n float t = 0.1;\n float tx = smoothstep(t + 0.01, t, uv.x);\n float ty = smoothstep(t + 0.01, t, uv.y);\n\n float alpha = max(tx, ty);\n\n if(alpha < 0.9) discard;\n\n oColor = vec4(vColor, 1.0) * 0.15;\n}")}}class _ extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\n#define NUM_LINES 40\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform sampler2D uPosMap;\nuniform sampler2D uVelMap;\nuniform sampler2D uExtraMap;\nuniform sampler2D uDataMap;\nuniform sampler2D uPosOrgMap;\nuniform sampler2D uFluidMap;\nuniform sampler2D uDensityMap;\n\nuniform float uTime;\nuniform float uNoiseScale;\nuniform float uSpeed;\nuniform vec3 uTouch;\nuniform vec3 uCenter;\nuniform float uOffset;\nuniform float uLifeDecrease;\n\nlayout (location = 0) out vec4 oFragColor0;\nlayout (location = 1) out vec4 oFragColor1;\nlayout (location = 2) out vec4 oFragColor2;\nlayout (location = 3) out vec4 oFragColor3;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nmat4 rotationMatrix(vec3 axis, float angle) {\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n \n return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,\n 0.0, 0.0, 0.0, 1.0);\n}\n\nvec3 rotate(vec3 v, vec3 axis, float angle) {\n\tmat4 m = rotationMatrix(axis, angle);\n\treturn (m * vec4(v, 1.0)).xyz;\n}\n\n// snoise.glsl\nvec4 permute_1(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt_1(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise_1(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D_1 = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_1 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_1;\n vec3 i1 = min( g_1.xyz, l.zxy );\n vec3 i2 = max( g_1.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute_1( permute_1( permute_1( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D_1.wyz - D_1.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1_1 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0_1 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1_1.xy,h.z);\n vec3 p3 = vec3(a1_1.zw,h.w);\n \n vec4 norm = taylorInvSqrt_1(vec4(dot(p0_1,p0_1), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0_1 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0_1,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise_1(float x, float y, float z){\n return snoise_1(vec3(x, y, z));\n}\n\n// curlNoise.glsl\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\n// snoise.glsl\nvec4 permute_0(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt_0(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise_0(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D_0 = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_0 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_0;\n vec3 i1 = min( g_0.xyz, l.zxy );\n vec3 i2 = max( g_0.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute_0( permute_0( permute_0( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D_0.wyz - D_0.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1_0 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0_0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1_0.xy,h.z);\n vec3 p3 = vec3(a1_0.zw,h.w);\n \n vec4 norm = taylorInvSqrt_0(vec4(dot(p0_0,p0_0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0_0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0_0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise_0(float x, float y, float z){\n return snoise_0(vec3(x, y, z));\n}\n\nvec3 snoiseVec3( vec3 x ){\n\n\tfloat s = snoise_0(vec3( x ));\n\tfloat s1 = snoise_0(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 ));\n\tfloat s2 = snoise_0(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 ));\n\tvec3 c = vec3( s , s1 , s2 );\n\treturn c;\n\n}\n\nvec3 curlNoise( vec3 p ){\n\t\n\tconst float e = .1;\n\tvec3 dx = vec3( e , 0.0 , 0.0 );\n\tvec3 dy = vec3( 0.0 , e , 0.0 );\n\tvec3 dz = vec3( 0.0 , 0.0 , e );\n\n\tvec3 p_x0 = snoiseVec3( p - dx );\n\tvec3 p_x1 = snoiseVec3( p + dx );\n\tvec3 p_y0 = snoiseVec3( p - dy );\n\tvec3 p_y1 = snoiseVec3( p + dy );\n\tvec3 p_z0 = snoiseVec3( p - dz );\n\tvec3 p_z1 = snoiseVec3( p + dz );\n\n\tfloat x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;\n\tfloat y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;\n\tfloat z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;\n\n\tconst float divisor = 1.0 / ( 2.0 * e );\n\treturn normalize( vec3( x , y , z ) * divisor );\n\n}\n\n#define PI 3.1415926535897932384626433832795\n\nvoid main(void) {\n vec3 pos = texture(uPosMap, vTextureCoord).xyz;\n vec3 vel = texture(uVelMap, vTextureCoord).xyz;\n vec3 extra = texture(uExtraMap, vTextureCoord).xyz;\n vec3 data = texture(uDataMap, vTextureCoord).xyz;\n\n float posOffset = snoise_1(vec3(pos + uTime * 5.5)) * .5 + .5;\n posOffset = mix(2.2, 2.0, posOffset) * 0.1 * uNoiseScale;\n\n vec3 acc = vec3(0.0);\n vec3 noise = curlNoise(pos * posOffset - uTime * 0.3);\n acc += noise;\n\n vec3 dir;\n float f;\n\n f = 0.25;\n float maxRadius = mix(2.0, 2.2, extra.z) - f;\n maxRadius += step(2.0, uSpeed) * (0.5 + f);\n float d = distance(pos, uCenter);\n\n // pulling force\n dir = -normalize(pos - uCenter);\n f = smoothstep(maxRadius - 1.0, maxRadius, d);\n acc += dir * f * 2.0;\n \n\n // repel to touch\n d = distance(pos, uTouch);\n f = smoothstep(5.0, 3.0, d);\n dir = normalize(pos - uTouch);\n\n float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.1;\n t = sin(t * PI);\n t = smoothstep(-0.5, 1.0, t);\n acc -= dir * f * 4.0/uSpeed * t;\n \n float speed = mix(2.0, 3.0, extra.x);\n // float speed = mix(2.0, 4.0, extra.x);\n\n t = fract(extra.x + extra.y );\n if( t < 0.01) speed *= mix(4.0, 8.0, t);\n vel += acc * speed * 0.0002 * uSpeed;\n\n pos += vel;\n vel *= .96;\n\n oFragColor0 = vec4(pos, 1.0);\n oFragColor1 = vec4(vel, 1.0);\n oFragColor2 = vec4(extra, 1.0);\n oFragColor3 = vec4(data, 1.0);\n}").setClearColor(0,0,0,0)}}class d extends e.hG{constructor(){super();const{numParticles:r,numSets:o}=t.Z,i=parseInt(o),a=[],s=[],u=[],c=[];let h=0;const l=(t,e)=>{const{pos:n,normal:r}=((t,e)=>{const n=2*Math.PI/3*e,r=Math.cos(n),o=Math.sin(n);return{pos:[t,.015*o,.015*r],normal:[0,o,r]}})(t,e);a.push(n),u.push(r),s.push([t/i,e/3])},f=i*i;for(let t=0;t 0.5) discard;\n // shadow\n vec4 shadowCoord = vShadowCoord / vShadowCoord.w;\n\tfloat s = samplePCF3x3(shadowCoord);\n s = mix(s, 1.0, .6);\n\n float d = diffuse(vNormal, uLight, .3);\n vec3 color = vColor * d * s;\n color = smoothstep(vec3(0.0), vec3(1.0), color) * 1.2;\n\n oColor = vec4(color, 1.0);\n}").uniform("uTotal",f).uniform("uNumSets",i)}}class E extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform float uRatio;\nout vec4 oColor;\n\nvoid main(void) {\n if(vTextureCoord.x > .5) discard;\n float n = texture(uMap, vTextureCoord * 4.0).r; \n\n vec2 uv = vTextureCoord - .5;\n if(uRatio > 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n }\n\n float d = length(uv);\n d = smoothstep(0.2, 0.8, d);\n d = mix(d, 1.0, .1);\n d += n * 0.2;\n\n // n = mix(0.8, 1.0, n);\n n *= 0.2;\n\n float t = distance(uv, vec2(-0.5*uRatio, 0.5));\n t = smoothstep(1.0, 2.5, t);\n\n d += t * 1.5;\n \n\n oColor = vec4(vec3(n), d * .3);\n // oColor = vec4(vec3(t), 1.0);\n\n // oColor = vec4(vTextureCoord, 0.0, 1.0);\n}")}}class v extends e.hG{constructor(){super(),this.setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMapCurr;\nuniform sampler2D uMapPrev;\nuniform float uRatio;\nuniform float uColorOffset;\n\nout vec4 oColor;\n\nvoid main(void) {\n vec2 uv = vTextureCoord - .5;\n if(uRatio < 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n } \n\n float d = length(uv);\n d = smoothstep(0.6, 0.2, d);\n\n uv += 0.5;\n // vec4 color = texture(uMap, uv);\n vec4 colorCurr = texture( uMapCurr, uv );\n vec4 colorPrev = texture( uMapPrev, uv );\n vec4 color = mix(colorPrev, colorCurr, uColorOffset);\n\n color.rgb *= mix(0.7, 1.0, d);\n\n vec3 colorAdjusted = smoothstep(vec3(0.0), vec3(1.0), color.rgb);\n color.rgb = mix(color.rgb, colorAdjusted, 0.5);\n\n oColor = color;\n}")}}class p extends e.hG{constructor(){super();const t=e.v6.plane(30,30,1,"xz");this.setMesh(t).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uShadowMatrix;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\nout vec4 vShadowCoord;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nmat4 rotationMatrix(vec3 axis, float angle) {\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n \n return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,\n 0.0, 0.0, 0.0, 1.0);\n}\n\nvec3 rotate(vec3 v, vec3 axis, float angle) {\n\tmat4 m = rotationMatrix(axis, angle);\n\treturn (m * vec4(v, 1.0)).xyz;\n}\n\nvoid main(void) {\n vec3 pos = aVertexPosition;\n pos.y -= 4.0;\n\n vec4 wsPos = uModelMatrix * vec4(pos, 1.0);\n gl_Position = uProjectionMatrix * uViewMatrix * wsPos;\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n\n vShadowCoord = uShadowMatrix * wsPos;\n}","#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nin vec4 vShadowCoord;\n\nuniform sampler2D uMap;\nuniform sampler2D uDepthMap;\nout vec4 oColor;\n\nfloat samplePCF3x3( vec4 sc )\n{\n const int s = 2;\n float shadow = 0.0;\n\n float bias = 0.005;\n float threshold = sc.z - bias;\n\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s, s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0, s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s, s) ).r);\n return shadow/9.0;\n}\n\nvoid main(void) {\n // shadow\n vec4 shadowCoord = vShadowCoord / vShadowCoord.w;\n\n\tfloat s = 1.0 -samplePCF3x3(shadowCoord);\n\n if(shadowCoord.x < 0.0 ||shadowCoord.x > 1.0 ||\n shadowCoord.y < 0.0 ||shadowCoord.y > 1.0) {\n s = 0.0;\n }\n\n if(shadowCoord.z > 1.0) {\n s = 0.0;\n }\n\n oColor = vec4(vec3(0.0), s * 0.15);\n}")}}class m extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\n#define LUT_FLIP_Y 1\n\nprecision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D uMap; // Normal texture\nuniform sampler2D uBlurMap; // Blurred texture\nuniform sampler2D uDepthMap; // Depth texture\nuniform sampler2D uNoiseMap; // noise texture\nuniform sampler2D uLookupMap; // lookup texture\n\nuniform float uFocus; // Focus distance\nuniform float uNear; // Camera near plane\nuniform float uFar; // Camera far plane\nuniform float uRatio;\n\nin vec2 vTextureCoord;\nout vec4 oColor;\n\nfloat normalizeDepth(float depth) {\n return (2.0 * uNear) / (uFar + uNear - depth * (uFar - uNear));\n}\n\nvec4 lookup(in vec4 textureColor, in sampler2D lookupTable, float strength) {\n #ifndef LUT_NO_CLAMP\n textureColor = clamp(textureColor, 0.0, 1.0);\n #endif\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n #ifdef LUT_FLIP_Y\n texPos1.y = 1.0-texPos1.y;\n #endif\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n #ifdef LUT_FLIP_Y\n texPos2.y = 1.0-texPos2.y;\n #endif\n\n lowp vec4 newColor1 = texture(lookupTable, texPos1);\n lowp vec4 newColor2 = texture(lookupTable, texPos2);\n\n lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return mix(textureColor, newColor, strength);\n}\n\nvec4 lookup(in vec4 textureColor, in sampler2D lookupTable) {\n return lookup(textureColor, lookupTable, 1.0);\n}\n\nvoid main() {\n float depth = texture(uDepthMap, vTextureCoord).r;\n float normalizedDepth = normalizeDepth(depth);\n\n // Calculate blur amount based on depth difference\n float blurAmount = abs(normalizedDepth - uFocus);\n // blurAmount = clamp(blurAmount, 0.0, 1.0);\n blurAmount = smoothstep(0.2, 0.4, blurAmount);\n blurAmount = pow(blurAmount, 1.5);\n // blurAmount = smoothstep(0.0, 0.7, blurAmount);\n\n float t = 0.05;\n blurAmount = smoothstep(uFocus - t, uFocus + t, normalizedDepth);\n\n vec2 uv = vTextureCoord - .5;\n if(uRatio < 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n }\n\n float distCenter = length(uv);\n float v = smoothstep(0.6, 0.2, distCenter);\n v = mix(.8, 1.2, v);\n\n float d = smoothstep(0.5, 0.2, distCenter);\n blurAmount = mix(0.0, blurAmount, d);\n\n vec4 sharpColor = texture(uMap, vTextureCoord);\n vec4 blurredColor = texture(uBlurMap, vTextureCoord);\n\n // Mix based on blur amount\n vec4 color = mix(sharpColor, blurredColor, blurAmount);\n color.rgb *= v;\n float n = texture(uNoiseMap, vTextureCoord).r;\n\n d = smoothstep(0.1, 0.7, distCenter);\n color.rgb += n * d * 0.15;\n\n // highlight / shadow\n d = 0.1;\n t = distance(uv, vec2(-d, d) * vec2(uRatio, 1.0));\n t = smoothstep(0.25, 0.8, t);\n color.rgb *= mix(1.0, 0.5, t);\n\n color.rgb = pow(color.rgb, vec3(0.75));\n // color.rgb = pow(color.rgb + 0.2, vec3(1.75));\n color = lookup(color, uLookupMap, 0.25);\n oColor = color;\n}\n")}}class x extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\n\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform float rtWidth;\nuniform float rtHeight;\n\nout vec4 oColor;\n\nfloat FXAA_SUBPIX_SHIFT = 1.0/4.0;\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#define FXAA_SPAN_MAX 8.0\n\nvec4 applyFXAA(vec2 fragCoord, sampler2D tex) {\n vec4 color;\n vec2 inverseVP = vec2(1.0 / rtWidth, 1.0 / rtHeight);\n vec3 rgbNW = texture(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;\n vec3 rgbNE = texture(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;\n vec3 rgbSW = texture(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;\n vec3 rgbSE = texture(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;\n vec3 rgbM = texture(tex, fragCoord * inverseVP).xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n //return texture(tex, fragCoord);\n //return vec4(fragCoord, 0.0, 1.0);\n //return vec4(rgbM, 1.0);\n\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, 1.0);\n else\n color = vec4(rgbB, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 posPos = vec4(.0);\n\n\tvec2 rcpFrame = vec2(1.0/rtWidth, 1.0/rtHeight);\n\n \tposPos.xy = vTextureCoord.xy;\n \tposPos.zw = vTextureCoord.xy - (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));\n\n \toColor = applyFXAA(vTextureCoord * vec2(rtWidth, rtHeight), uMap);\n}")}}class T extends e.hG{constructor(){super();const t=[],r=[],o=[];let i=500;for(;i--;)t.push([(0,n.MX)(-10,10),(0,n.MX)(-10,10),.5*(0,n.MX)(-10,10)]),r.push([(0,n.MX)(),(0,n.MX)(),(0,n.MX)()]),o.push(i);const a=new e.Kj(e.GL.POINTS).bufferVertex(t).bufferNormal(r).bufferIndex(o);this.setMesh(a).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform vec2 uViewport;\nuniform float uTime;\nuniform float uBound;\n\nout vec2 vTextureCoord;\nout vec3 vExtra;\nout vec3 vColor;\n\nfloat particleSize(vec4 screenPos, mat4 mtxProj, vec2 viewport, float radius) {\n\treturn viewport.y * mtxProj[1][1] * radius / screenPos.w;\n}\n\n// snoise.glsl\nvec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_0 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_0;\n vec3 i1 = min( g_0.xyz, l.zxy );\n vec3 i2 = max( g_0.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute( permute( permute( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise(float x, float y, float z){\n return snoise(vec3(x, y, z));\n}\n\n#define radius 0.015\n\nvoid main(void) {\n vec3 pos = aVertexPosition;\n\n vec3 vel = mix(aNormal, vec3(1.0), .5);\n vel.z *= 0.1;\n float speed = mix(0.5, 3.0, aNormal.x) * 0.2;\n\n pos += vel * uTime * speed;\n pos = mod(pos + uBound, uBound * 2.0) - uBound;\n\n float scaleBound = 1.0;\n float scale = abs(pos.x) / uBound;\n scaleBound *= smoothstep(1.0, .9, scale);\n scale = abs(pos.y) / uBound;\n scaleBound *= smoothstep(1.0, .9, scale);\n\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(pos, 1.0);\n\n vExtra = aNormal;\n\n scale = mix(0.5, 2.0, aNormal.x) * scaleBound;\n\n gl_PointSize = particleSize(gl_Position, uProjectionMatrix, uViewport, radius * scale);\n\n // color \n float g = mix(0.15, 1.0, aNormal.z);\n vColor = vec3(g);\n}","#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nin vec3 vExtra;\nin vec3 vColor;\n\nout vec4 oColor;\n\nvoid main(void) {\n float d = distance(gl_PointCoord, vec2(0.5));\n d = smoothstep(0.5, 0.49, d);\n oColor = vec4(vColor, .2) * d;\n}").uniform("uBound",10)}}let M,R,A;const g="#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform vec2 uDirection;\nuniform vec2 uResolution;\n\nout vec4 oColor;\n\nvec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n\tvec4 color = vec4(0.0);\n\tvec2 off1 = vec2(1.3846153846) * direction;\n\tvec2 off2 = vec2(3.2307692308) * direction;\n\tcolor += texture(image, uv) * 0.2270270270;\n\tcolor += texture(image, uv + (off1 / resolution)) * 0.3162162162;\n\tcolor += texture(image, uv - (off1 / resolution)) * 0.3162162162;\n\tcolor += texture(image, uv + (off2 / resolution)) * 0.0702702703;\n\tcolor += texture(image, uv - (off2 / resolution)) * 0.0702702703;\n\treturn color;\n}\n\nvoid main(void) {\n oColor = blur9(uMap, vTextureCoord, uResolution, uDirection);\n}";let b,L,S={};function C(t,n="default"){const r=2048;if(!S[n]){const o=new e.SY(r,r,{minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR});S[n]=o;const i=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,g).setClearColor(0,0,0,1),a=7;for(let e=0;e8&&(c=250),setTimeout((()=>{this.lengthScale.easing=.02,this.lengthScale.value=-.2,this.lengthScale.value=.15}),1500),setTimeout((()=>{this.speed.value=.1}),300+c),setTimeout((()=>{this.lengthScale.easing=.03,this.lengthScale.easing=.04,this.lengthScale.value=1}),2200+c),setTimeout((()=>this.pulse()),2500+c)}_initTextures(){this.resize();const{numParticles:r,numSets:o}=t.Z,i={minFilter:e.GL.NEAREST,magFilter:e.GL.NEAREST,type:e.GL.FLOAT},s={minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR};this._fbo=new e.SY(r,r,i,4),this._fboRender=new e.uL(e.GL.width,e.GL.height),this._fboCompose=new e.uL(e.GL.width,e.GL.height);let u=r*o;this._fboPos=new e.uL(u,u,i),this._fboPos.bind(),e.GL.clear(0,0,0,1),this._fboPos.unbind(),u=2048,this._fboShadow=new e.uL(u,u,s),this._fboShadowFloor=new e.uL(u,u,s),this._textureNoise=(R||(R=new e.uL(e.GL.width,e.GL.height,{wrapS:e.GL.MIRRORED_REPEAT,wrapT:e.GL.MIRRORED_REPEAT}),A=(0,n.MX)(1e3),M=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\nprecision highp float;\n#define GLSLIFY 1\n\nin vec2 vTextureCoord;\nout vec4 outColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\n\nuint Rand(uint x) {\n x ^= x >> 16;\n x *= 0x7feb352dU;\n x ^= x >> 15;\n x *= 0x846ca68bU;\n x ^= x >> 16;\n return x;\n}\n\nuint HilbertIndex(uvec2 p) {\n uint i = 0u;\n for(uint l = 0x4000u; l > 0u; l >>= 1u) {\n uvec2 r = min(p & l, 1u);\n \n i = (i << 2u) | ((r.x * 3u) ^ r.y); \n p = r.y == 0u ? (0x7FFFu * r.x) ^ p.yx : p;\n }\n return i;\n}\n\nuint ReverseBits(uint x) {\n x = ((x & 0xaaaaaaaau) >> 1) | ((x & 0x55555555u) << 1);\n x = ((x & 0xccccccccu) >> 2) | ((x & 0x33333333u) << 2);\n x = ((x & 0xf0f0f0f0u) >> 4) | ((x & 0x0f0f0f0fu) << 4);\n x = ((x & 0xff00ff00u) >> 8) | ((x & 0x00ff00ffu) << 8);\n return (x >> 16) | (x << 16);\n}\n\n// from: https://psychopath.io/post/2021_01_30_building_a_better_lk_hash\nuint OwenHash(uint x, uint seed) { // seed is any random number\n x ^= x * 0x3d20adeau;\n x += seed;\n x *= (seed >> 16) | 1u;\n x ^= x * 0x05526c56u;\n x ^= x * 0x53a22864u;\n return x;\n}\n\n// adapted from: https://www.shadertoy.com/view/MslGR8\nfloat ReshapeUniformToTriangle(float v) {\n v = v * 2.0 - 1.0;\n v = sign(v) * (1.0 - sqrt(max(0.0, 1.0 - abs(v)))); // [-1, 1], max prevents NaNs\n return v + 0.5; // [-0.5, 1.5]\n}\n\nvoid main() {\n float scale = 10.0;\n uint m = HilbertIndex(uvec2(uResolution * vTextureCoord * scale)); // map pixel coords to hilbert curve index\n m = OwenHash(ReverseBits(m), 0xe7843fbfu); // owen-scramble hilbert index\n m = OwenHash(ReverseBits(m), 0x8d8fb1e0u); // map hilbert index to sobol sequence and owen-scramble\n float mask = float(ReverseBits(m)) / 4294967296.0; // convert to float\n\n outColor = vec4(vec3(mask), 1.0);\n}\n").setClearColor(0,0,0,1).bindFrameBuffer(R).uniform("uTime",A).uniform("uResolution",[e.GL.width,e.GL.height])),M.draw(),A+=.01,R.texture),this._textureColor=a(`color${t.Z.colorIndex}`),this._textureColor.minFilter=this._textureColor.magFilter=e.GL.NEAREST,this._textureLookup=a("lookup"),this._textureLookup.minFilter=this._textureLookup.magFilter=e.GL.NEAREST,this._index=0}_initViews(){this._dAxis=new e.nu,this._dCopy=new e.Cg,this._dBall=new e.QA,this._drawCover=new E,this._drawBackground=new v,this._drawFloor=new p,this._drawFlowParticles=new T,this._drawFxaa=new x,this._drawCompose=(new m).setClearColor(0,0,0,0).bindFrameBuffer(this._fboCompose),(new l).bindFrameBuffer(this._fbo.read).draw(),this._drawSim=new _,this._drawParticles=new f,this._drawRibbon=new d}updateColor(){this._prevColorIndex=this._currColorIndex,this._currColorIndex=t.Z.colorIndex,this.switchColor()}switchColor(){this._texColorCurr=a(`color${this._currColorIndex}`),this._texColorPrev=a(`color${this._prevColorIndex}`),this._bgCurr=C(this._texColorCurr,`color${this._currColorIndex}`),this._bgPrev=C(this._texColorPrev,`color${this._prevColorIndex}`),this._colorOffset.setTo(0),this._colorOffset.value=1}_initHit(){const t=e.v6.plane(12.5,12.5/e.GL.aspectRatio,1);this._hitTestor=new e.l(t,this.camera),this._hitTestor.on("onHit",(t=>{u.copy(this._hit,t.hit)})),this._hitTestor.on("onUp",(()=>{this._hit=[999,999,999]}))}update(){this._length=.45*Math.sin(.85*s.Z.getElapsedTime())+.55,this._drawSim.bindFrameBuffer(this._fbo.write).bindTexture("uPosMap",this._fbo.read.getTexture(0),0).bindTexture("uVelMap",this._fbo.read.getTexture(1),1).bindTexture("uExtraMap",this._fbo.read.getTexture(2),2).bindTexture("uDataMap",this._fbo.read.getTexture(3),3).uniform("uTime",s.Z.getElapsedTime()+this._seedTime).uniform("uSpeed",this.speed.value).uniform("uTouch",this._hit).uniform("uNoiseScale",this.noiseScale).uniform("uCenter",this._center).draw(),this._fbo.swap();const{numParticles:n,numSets:r}=t.Z,o=parseInt(r),i=this._index%o,a=Math.floor(this._index/o);this._index++,this._index>=o*o&&(this._index=0),e.GL.disable(e.GL.DEPTH_TEST),this._fboPos.bind(),e.GL.viewport(i*n,a*n,n,n),this._dCopy.draw(this._fbo.read.getTexture(0)),this._fboPos.unbind(),e.GL.enable(e.GL.DEPTH_TEST),this._updateShadowMap(!1)}_updateShadowMap(){this._fboShadow.bind(),e.GL.clear(0,0,0,1),e.GL.setMatrices(this._cameraLight),this._renderRibbon(!1),this._fboShadow.unbind(),this._fboShadowFloor.bind(),e.GL.clear(0,0,0,1),e.GL.setMatrices(this._cameraFloorShadow),this._renderRibbon(!1),this._fboShadowFloor.unbind()}_renderRibbon(t=!1){const r=t?this._fboShadow.depthTexture:this._fbo.read.getTexture(0);this._drawRibbon.bindTexture("uPosMap",this._fboPos.texture,0).bindTexture("uDepthMap",r,1).bindTexture("uColorMapCurr",this._texColorCurr,2).bindTexture("uColorMapPrev",this._texColorPrev,3).uniform("uColorOffset",this._colorOffset.value).uniform("uIndex",this._index).uniform("uLight",this._lightPosition).uniform("uShadowMatrix",this.mtxShadow).uniform("uColor",(0,n.Gv)(1)).uniform("uTime",s.Z.getElapsedTime()).uniform("uLengthOffset",this.lengthScale.value).uniform("uTouch",this._hit).draw(),this._drawParticles.bindTexture("uPosMap",this._fbo.read.getTexture(0),0).bindTexture("uColorMapCurr",this._texColorCurr,2).bindTexture("uColorMapPrev",this._texColorPrev,3).uniform("uColorOffset",this._colorOffset.value).uniform("uViewport",[e.GL.width,e.GL.height]).draw()}render(){let r=t.Z.usePostEffect,o=.91;if(e.GL.clear(...(0,n.Gv)(o),1),e.GL.setMatrices(this.camera),e.GL.disable(e.GL.DEPTH_TEST),r&&(this._fboRender.bind(),e.GL.clear(0,0,0,0)),this._drawBackground.bindTexture("uMapCurr",this._bgCurr,0).bindTexture("uMapPrev",this._bgPrev,1).uniform("uRatio",e.GL.aspectRatio).uniform("uColorOffset",this._colorOffset.value).draw(),e.GL.enable(e.GL.DEPTH_TEST),o=.2,this._drawFloor.bindTexture("uDepthMap",this._fboShadowFloor.depthTexture,0).uniform("uShadowMatrix",this.mtxShadowFloor).draw(),this._renderRibbon(!0),this._drawFlowParticles.uniform("uViewport",[e.GL.width,e.GL.height]).uniform("uTime",s.Z.getElapsedTime()).draw(),r){this._fboRender.unbind(),this._textureBlurredRender=function(t){const{width:n,height:r}=e.GL;if(!b){const t=1;b=new e.SY(n*t,r*t,{minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR}),L=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,g).setClearColor(0,0,0,1)}for(let e=0;e<3;e++){const o=1/Math.pow(1.2,e),i=0===e?t:b.read.texture;L.bindFrameBuffer(b.write).bindTexture("uMap",i,0).uniform("uDirection",[1,0]).uniform("uResolution",[n*o,r*o]).draw(),b.swap(),L.bindFrameBuffer(b.write).bindTexture("uMap",b.read.texture,0).uniform("uDirection",[0,1]).uniform("uResolution",[n*o,r*o]).draw(),b.swap()}return b.read.texture}(this._fboRender.texture);const{near:t,far:n}=this.camera;let r=(this.orbitalControl.radius.value+3.8-t)/(n-t);this._drawCompose.bindFrameBuffer(this._fboCompose).bindTexture("uMap",this._fboRender.texture,0).bindTexture("uBlurMap",this._textureBlurredRender,1).bindTexture("uDepthMap",this._fboRender.depthTexture,2).bindTexture("uNoiseMap",this._textureNoise,3).bindTexture("uLookupMap",this._textureLookup,4).uniform("uFocus",r).uniform("uRatio",e.GL.aspectRatio).uniform("uNear",this.camera.near).uniform("uFar",this.camera.far).draw(),this._drawFxaa.bindTexture("uMap",this._fboCompose.texture,0).uniform("rtWidth",e.GL.width).uniform("rtHeight",e.GL.height).draw()}e.GL.disable(e.GL.DEPTH_TEST)}resize(){const{innerWidth:t,innerHeight:n}=window;e.GL.setSize(1.5*t,1.5*n),this.camera?.setAspectRatio?.(e.GL.aspectRatio),this._fboRender=new e.uL(e.GL.width,e.GL.height),this._fboCompose=new e.uL(e.GL.width,e.GL.height)}}const P=N,I=[{id:"color0",url:"assets/color0.jpg",type:"jpg"},{id:"color1",url:"assets/color1.jpg",type:"jpg"},{id:"color2",url:"assets/color2.jpg",type:"jpg"},{id:"color3",url:"assets/color3.jpg",type:"jpg"},{id:"color4",url:"assets/color4.jpg",type:"jpg"},{id:"color5",url:"assets/color5.jpg",type:"jpg"},{id:"lookup",url:"assets/lookup.png",type:"png"}];var y=o(370),w=o.n(y);let O,F;String.prototype.replaceAll=function(t,e){return this.replace(new RegExp(t,"g"),e)},window.addEventListener("keydown",(t=>{if(83===t.keyCode&&(t.metaKey||t.ctrlKey)){t.preventDefault();const e=(()=>{const t=new Date;return`${t.getFullYear()}.${t.getMonth()+1}.${t.getDate()}-${t.getHours()}.${t.getMinutes()}.${t.getSeconds()}`})();((t,e)=>{var n=document.createElement("a"),r=(t=>{for(var e=t.split(","),n=e[0].match(/:(.*?);/)[1],r=atob(e[1]),o=r.length,i=new Uint8Array(o);o--;)i[o]=r.charCodeAt(o);return new Blob([i],{type:n})})(t.toDataURL({format:"png",multiplier:4})),o=URL.createObjectURL(r);n.download=`${e}.png`,n.href=o,n.click()})(document.querySelector("#main-canvas"),e)}}));var U;new Promise(((t,e)=>{const n=document.body.querySelector(".Loading-Bar");console.log("Load Assets",I),I.length>0?(document.body.classList.add("isLoading"),new(w())({assets:I}).on("error",(t=>{console.log("Error :",t)})).on("progress",(t=>{n&&(n.style.width=100*t+"%")})).on("complete",(e=>{n&&(n.style.width="100%"),i(e),setTimeout((()=>{document.body.classList.remove("isLoading"),t(U)}),500)})).start()):t(U)})).then((function(){o.e(891).then(o.bind(o,891)).then((({default:n})=>{n.init(),e.GL.isMobile&&(t.Z.numParticles=64,t.Z.numSets=4,t.Z.usePostEffect=!0,n.refresh()),F=document.createElement("canvas"),F.id="main-canvas",document.body.appendChild(F),e.GL.init(F,{alpha:!1,preserveDrawingBuffer:!0}),document.addEventListener("keydown",(function(t){"f"===t.key&&(document.fullscreenElement?document.exitFullscreen():F.requestFullscreen())})),O=new P,Promise.all([o.e(296),o.e(437)]).then(o.bind(o,824)).then((({default:t})=>{t(O)}))}))}),n.H)})()})(); \ No newline at end of file +(()=>{var t,e,n={427:t=>{"use strict";t.exports=function(){try{return!!new Blob}catch(t){return!1}}()},42:(t,e,n)=>{"use strict";var r=n(187).EventEmitter;function o(){r.call(this),this.setMaxListeners(20)}o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.off=function(t,e){return e?this.removeListener(t,e):t?this.removeAllListeners(t):this.removeAllListeners()},t.exports=o},622:(t,e,n)=>{"use strict";var r=n(42),o=n(388),i=0;t.exports=function t(e){var n,a={},s=[],u=[],c=0,h=0,l={},f=function(r){return Array.isArray(r)?(r.forEach(f),n):((i=r.assets&&Array.isArray(r.assets)?t(d(r,e)):o(d(r,e))).once("destroy",m),u.push(i),l[i.id]=i,n);var i},_=function(t){return arguments.length?a[t]?a[t]:l[t]:s},d=function(t,e){return"string"==typeof t&&(t={url:t}),void 0===t.isTouchLocked&&(t.isTouchLocked=e.isTouchLocked),void 0===t.blob&&(t.blob=e.blob),void 0===t.basePath&&(t.basePath=e.basePath),t.id=t.id||t.url||String(++i),t.type=t.type||(n=t.url)&&n.split("?")[0].split(".").pop().toLowerCase(),t.crossOrigin=t.crossOrigin||e.crossOrigin,t.webAudioContext=t.webAudioContext||e.webAudioContext,t.log=e.log,t;var n},E=function(t){var e=c+t;n.emit("progress",e/h)},p=function(t,e,r){Array.isArray(t)&&(t={id:e,file:t,type:r}),c++,n.emit("progress",c/h),a[t.id]=t.file,s.push(t),n.emit("childcomplete",t),x()},v=function(t){h--,n.listeners("error").length?n.emit("error",t):console.error(t),x()},m=function(t){l[t]=null,delete l[t],a[t]=null,delete a[t],s.some((function(e,n){if(e.id===t)return s.splice(n,1),!0}))},x=function(){c>=h&&n.emit("complete",s,a,e.id,"group")};return n=Object.create(r.prototype,{_events:{value:{}},id:{get:function(){return e.id}},add:{value:f},start:{value:function(){return h=u.length,u.forEach((function(t){t.on("progress",E).once("complete",p).once("error",v).start()})),u=[],n}},get:{value:_},find:{value:function(t){if(_(t))return _(t);var e=null;return Object.keys(l).some((function(n){return!!(e=l[n].find&&l[n].find(t))})),e}},getLoader:{value:function(t){return l[t]}},loaded:{get:function(){return c>=h}},file:{get:function(){return s}},destroy:{value:function(){for(;u.length;)u.pop().destroy();return n.off("error"),n.off("progress"),n.off("complete"),s=[],a={},e.webAudioContext=null,h=0,c=0,Object.keys(l).forEach((function(t){l[t].destroy()})),l={},n.emit("destroy",n.id),n}}}),e=d(e||{},{basePath:"",blob:!1,touchLocked:!1,crossOrigin:null,webAudioContext:null,log:!1}),Array.isArray(e.assets)&&f(e.assets),n}},370:(t,e,n)=>{"use strict";var r=n(622);r.stats=n(795),t.exports=r},388:(t,e,n)=>{"use strict";var r=n(42),o=n(427),i=n(795);t.exports=function(t){var e,n,a,s,u,c,h=t.id,l=t.basePath||"",f=t.url,_=t.type,d=t.crossOrigin,E=t.isTouchLocked,p=t.blob&&o,v=t.webAudioContext,m=t.log,x=function(t){t&&(c={id:h,file:t,type:_},e.emit("progress",1),e.emit("complete",c,h,_),I())},T=function(t,e){n=e||R,(a=new XMLHttpRequest).open("GET",l+f,!0),a.responseType=t,a.addEventListener("progress",M),a.addEventListener("load",n),a.addEventListener("error",P),a.send()},M=function(t){t.lengthComputable&&e.emit("progress",t.loaded/t.total)},R=function(){A()&&x(a.response)},A=function(){return a&&a.status<400?(i.update(a,s,f,m),!0):(P(a&&a.statusText),!1)},g=function(){a=new Image,d&&(a.crossOrigin="anonymous"),a.addEventListener("error",P,!1),a.addEventListener("load",b,!1),a.src=l+f},b=function(t){window.clearTimeout(u),t||!a.error&&a.readyState?x(a):P()},L=function(){T("blob",(function(){A()&&((a=new Image).addEventListener("error",P,!1),a.addEventListener("load",S,!1),a.src=window.URL.createObjectURL(a.response))}))},S=function(){window.URL.revokeObjectURL(a.src),x(a)},C=function(){T("arraybuffer",(function(){A()&&v.decodeAudioData(a.response,(function(t){a=null,x(t)}),(function(t){P(t)}))}))},N=function(t){a=document.createElement(t),E||(window.clearTimeout(u),u=window.setTimeout(b,2e3),a.addEventListener("canplaythrough",b,!1)),a.addEventListener("error",P,!1),a.preload="auto",a.src=l+f,a.load(),E&&x(a)},P=function(t){window.clearTimeout(u);var n=t;a&&a.tagName&&a.error?n="MediaError: "+["","ABORTED","NETWORK","DECODE","SRC_NOT_SUPPORTED"][a.error.code]+" "+a.src:a&&a.statusText?n=a.statusText:t&&t.message?n=t.message:t&&t.type&&(n=t.type),e.emit("error",'Error loading "'+l+f+'" '+n),y()},I=function(){e.off("error"),e.off("progress"),e.off("complete"),a&&(a.removeEventListener("progress",M),a.removeEventListener("load",n),a.removeEventListener("error",P),a.removeEventListener("load",b),a.removeEventListener("canplaythrough",b),a.removeEventListener("load",S))},y=function(){I(),a&&a.abort&&a.readyState<4&&a.abort(),a=null,v=null,c=null,window.clearTimeout(u),e.emit("destroy",h)};return e=Object.create(r.prototype,{_events:{value:{}},id:{value:t.id},start:{value:function(){switch(s=Date.now(),_){case"json":T("json",(function(){if(A()){var t=a.response;"string"==typeof t&&(t=JSON.parse(t)),x(t)}}));break;case"jpg":case"png":case"gif":case"webp":case"svg":p?L():g();break;case"mp3":case"ogg":case"opus":case"wav":case"m4a":v?C():N("audio");break;case"ogv":case"mp4":case"webm":case"hls":p?T("blob"):N("video");break;case"bin":case"binary":T("arraybuffer");break;case"txt":case"text":T("text");break;default:throw"AssetsLoader ERROR: Unknown type for file with URL: "+l+f+" ("+_+")"}}},loaded:{get:function(){return!!c}},file:{get:function(){return c}},destroy:{value:y}})}},795:t=>{"use strict";t.exports={mbs:0,secs:0,update:function(t,e,n,r){var o,i=t.getAllResponseHeaders();if(i){var a=i.match(/content-length: (\d+)/i);a&&a.length&&(o=a[1])}if(o){var s=(o=parseInt(o,10))/1024/1024,u=(Date.now()-e)/1e3;this.secs+=u,this.mbs+=s,r&&this.log(n,s,u)}else r&&console.warn.call(console,"Can't get Content-Length:",n)},log:function(t,e,n){if(t){var r="File loaded: "+t.substr(t.lastIndexOf("/")+1)+" size:"+e.toFixed(2)+"mb time:"+n.toFixed(2)+"s speed:"+(e/n).toFixed(2)+"mbps";console.log.call(console,r)}var o="Total loaded: "+this.mbs.toFixed(2)+"mb time:"+this.secs.toFixed(2)+"s speed:"+this.getMbps().toFixed(2)+"mbps";console.log.call(console,o)},getMbps:function(){return this.mbs/this.secs}}},187:t=>{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}E(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&E(t,"error",e,{once:!0})}(t,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var o,i,a,c;if(s(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),a=i[e]),void 0===a)a=i[e]=n,++t._eventsCount;else if("function"==typeof a?a=i[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=u(t))>0&&a.length>o&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,c=h,console&&console.warn&&console.warn(c)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=h.bind(r);return o.listener=n,r.wrapFn=o,o}function f(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,h=d(u,c);for(n=0;n=0;i--)if(n[i]===e||n[i].listener===e){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},i.prototype.listeners=function(t){return f(this,t,!0)},i.prototype.rawListeners=function(t){return f(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},i.prototype.listenerCount=_,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},685:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ARRAY_TYPE:()=>o,EPSILON:()=>r,RANDOM:()=>i,equals:()=>c,setMatrixArrayType:()=>a,toRadian:()=>u});var r=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array,i=Math.random;function a(t){o=t}var s=Math.PI/180;function u(t){return t*s}function c(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},720:(t,e,n)=>{"use strict";n.r(e),n.d(e,{glMatrix:()=>u,mat2:()=>r,mat2d:()=>o,mat3:()=>at,mat4:()=>st,quat:()=>a,quat2:()=>s,vec2:()=>Cn,vec3:()=>ut,vec4:()=>i});var r={};n.r(r),n.d(r,{LDU:()=>L,add:()=>S,adjoint:()=>v,clone:()=>h,copy:()=>l,create:()=>c,determinant:()=>m,equals:()=>P,exactEquals:()=>N,frob:()=>b,fromRotation:()=>R,fromScaling:()=>A,fromValues:()=>_,identity:()=>f,invert:()=>p,mul:()=>w,multiply:()=>x,multiplyScalar:()=>I,multiplyScalarAndAdd:()=>y,rotate:()=>T,scale:()=>M,set:()=>d,str:()=>g,sub:()=>O,subtract:()=>C,transpose:()=>E});var o={};n.r(o),n.d(o,{add:()=>$,clone:()=>U,copy:()=>D,create:()=>F,determinant:()=>z,equals:()=>rt,exactEquals:()=>nt,frob:()=>Q,fromRotation:()=>k,fromScaling:()=>q,fromTranslation:()=>Z,fromValues:()=>G,identity:()=>B,invert:()=>X,mul:()=>ot,multiply:()=>H,multiplyScalar:()=>tt,multiplyScalarAndAdd:()=>et,rotate:()=>Y,scale:()=>j,set:()=>V,str:()=>K,sub:()=>it,subtract:()=>J,translate:()=>W});var i={};n.r(i),n.d(i,{add:()=>dt,ceil:()=>mt,clone:()=>ht,copy:()=>ft,create:()=>ct,cross:()=>wt,dist:()=>Wt,distance:()=>bt,div:()=>jt,divide:()=>vt,dot:()=>yt,equals:()=>Xt,exactEquals:()=>Vt,floor:()=>xt,forEach:()=>Kt,fromValues:()=>lt,inverse:()=>Pt,len:()=>qt,length:()=>St,lerp:()=>Ot,max:()=>Mt,min:()=>Tt,mul:()=>Yt,multiply:()=>pt,negate:()=>Nt,normalize:()=>It,random:()=>Ft,round:()=>Rt,scale:()=>At,scaleAndAdd:()=>gt,set:()=>_t,sqrDist:()=>kt,sqrLen:()=>Zt,squaredDistance:()=>Lt,squaredLength:()=>Ct,str:()=>Gt,sub:()=>Ht,subtract:()=>Et,transformMat4:()=>Ut,transformQuat:()=>Dt,zero:()=>Bt});var a={};n.r(a),n.d(a,{add:()=>Se,calculateW:()=>ae,clone:()=>Ae,conjugate:()=>_e,copy:()=>be,create:()=>Qt,dot:()=>Pe,equals:()=>Be,exactEquals:()=>De,exp:()=>se,fromEuler:()=>Ee,fromMat3:()=>de,fromValues:()=>ge,getAngle:()=>ee,getAxisAngle:()=>te,identity:()=>$t,invert:()=>fe,len:()=>we,length:()=>ye,lerp:()=>Ie,ln:()=>ue,mul:()=>Ce,multiply:()=>ne,normalize:()=>Ue,pow:()=>ce,random:()=>le,rotateX:()=>re,rotateY:()=>oe,rotateZ:()=>ie,rotationTo:()=>Ge,scale:()=>Ne,set:()=>Le,setAxes:()=>Xe,setAxisAngle:()=>Jt,slerp:()=>he,sqlerp:()=>Ve,sqrLen:()=>Fe,squaredLength:()=>Oe,str:()=>pe});var s={};n.r(s),n.d(s,{add:()=>fn,clone:()=>He,conjugate:()=>xn,copy:()=>Ke,create:()=>ze,dot:()=>pn,equals:()=>Sn,exactEquals:()=>Ln,fromMat4:()=>Ze,fromRotation:()=>qe,fromRotationTranslation:()=>We,fromRotationTranslationValues:()=>je,fromTranslation:()=>ke,fromValues:()=>Ye,getDual:()=>tn,getReal:()=>Je,getTranslation:()=>rn,identity:()=>Qe,invert:()=>mn,len:()=>Mn,length:()=>Tn,lerp:()=>vn,mul:()=>dn,multiply:()=>_n,normalize:()=>gn,rotateAroundAxis:()=>ln,rotateByQuatAppend:()=>cn,rotateByQuatPrepend:()=>hn,rotateX:()=>an,rotateY:()=>sn,rotateZ:()=>un,scale:()=>En,set:()=>$e,setDual:()=>nn,setReal:()=>en,sqrLen:()=>An,squaredLength:()=>Rn,str:()=>bn,translate:()=>on});var u=n(685);function c(){var t=new u.ARRAY_TYPE(4);return u.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function h(t){var e=new u.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function f(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function _(t,e,n,r){var o=new u.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o}function d(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t}function E(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function p(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*i-o*r;return a?(a=1/a,t[0]=i*a,t[1]=-r*a,t[2]=-o*a,t[3]=n*a,t):null}function v(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t}function m(t){return t[0]*t[3]-t[2]*t[1]}function x(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*s+i*u,t[1]=o*s+a*u,t[2]=r*c+i*h,t[3]=o*c+a*h,t}function T(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*s,t[1]=o*u+a*s,t[2]=r*-s+i*u,t[3]=o*-s+a*u,t}function M(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1];return t[0]=r*s,t[1]=o*s,t[2]=i*u,t[3]=a*u,t}function R(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t}function A(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function g(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function b(t){return Math.hypot(t[0],t[1],t[2],t[3])}function L(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]}function S(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function C(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function N(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function P(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],c=e[2],h=e[3];return Math.abs(n-a)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-c)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-h)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))}function I(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function y(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}var w=x,O=C;function F(){var t=new u.ARRAY_TYPE(6);return u.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function U(t){var e=new u.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function D(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function B(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function G(t,e,n,r,o,i){var a=new u.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=n,a[3]=r,a[4]=o,a[5]=i,a}function V(t,e,n,r,o,i,a){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t}function X(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=n*i-r*o;return u?(u=1/u,t[0]=i*u,t[1]=-r*u,t[2]=-o*u,t[3]=n*u,t[4]=(o*s-i*a)*u,t[5]=(r*a-n*s)*u,t):null}function z(t){return t[0]*t[3]-t[1]*t[2]}function H(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1],l=n[2],f=n[3],_=n[4],d=n[5];return t[0]=r*c+i*h,t[1]=o*c+a*h,t[2]=r*l+i*f,t[3]=o*l+a*f,t[4]=r*_+i*d+s,t[5]=o*_+a*d+u,t}function Y(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+i*c,t[1]=o*h+a*c,t[2]=r*-c+i*h,t[3]=o*-c+a*h,t[4]=s,t[5]=u,t}function j(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=o*c,t[2]=i*h,t[3]=a*h,t[4]=s,t[5]=u,t}function W(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=r*c+i*h+s,t[5]=o*c+a*h+u,t}function k(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t}function q(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function Z(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function K(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function Q(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function $(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t}function J(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}function tt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t}function et(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t}function nt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function rt(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],c=e[0],h=e[1],l=e[2],f=e[3],_=e[4],d=e[5];return Math.abs(n-c)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(r-h)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(o-l)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))&&Math.abs(i-f)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(a-_)<=u.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-d)<=u.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))}var ot=H,it=J,at=n(600),st=n(975),ut=n(160);function ct(){var t=new u.ARRAY_TYPE(4);return u.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ht(t){var e=new u.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function lt(t,e,n,r){var o=new u.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o}function ft(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function _t(t,e,n,r,o){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t}function dt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function Et(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function pt(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function vt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function mt(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function xt(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function Tt(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function Mt(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function Rt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function At(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function gt(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}function bt(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return Math.hypot(n,r,o,i)}function Lt(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2],i=e[3]-t[3];return n*n+r*r+o*o+i*i}function St(t){var e=t[0],n=t[1],r=t[2],o=t[3];return Math.hypot(e,n,r,o)}function Ct(t){var e=t[0],n=t[1],r=t[2],o=t[3];return e*e+n*n+r*r+o*o}function Nt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function Pt(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function It(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*n+r*r+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=o*a,t[3]=i*a,t}function yt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function wt(t,e,n,r){var o=n[0]*r[1]-n[1]*r[0],i=n[0]*r[2]-n[2]*r[0],a=n[0]*r[3]-n[3]*r[0],s=n[1]*r[2]-n[2]*r[1],u=n[1]*r[3]-n[3]*r[1],c=n[2]*r[3]-n[3]*r[2],h=e[0],l=e[1],f=e[2],_=e[3];return t[0]=l*c-f*u+_*s,t[1]=-h*c+f*a-_*i,t[2]=h*u-l*a+_*o,t[3]=-h*s+l*i-f*o,t}function Ot(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=e[3];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t[3]=s+r*(n[3]-s),t}function Ft(t,e){var n,r,o,i,a,s;e=e||1;do{a=(n=2*u.RANDOM()-1)*n+(r=2*u.RANDOM()-1)*r}while(a>=1);do{s=(o=2*u.RANDOM()-1)*o+(i=2*u.RANDOM()-1)*i}while(s>=1);var c=Math.sqrt((1-a)/s);return t[0]=e*n,t[1]=e*r,t[2]=e*o*c,t[3]=e*i*c,t}function Ut(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3];return t[0]=n[0]*r+n[4]*o+n[8]*i+n[12]*a,t[1]=n[1]*r+n[5]*o+n[9]*i+n[13]*a,t[2]=n[2]*r+n[6]*o+n[10]*i+n[14]*a,t[3]=n[3]*r+n[7]*o+n[11]*i+n[15]*a,t}function Dt(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],s=n[1],u=n[2],c=n[3],h=c*r+s*i-u*o,l=c*o+u*r-a*i,f=c*i+a*o-s*r,_=-a*r-s*o-u*i;return t[0]=h*c+_*-a+l*-u-f*-s,t[1]=l*c+_*-s+f*-a-h*-u,t[2]=f*c+_*-u+h*-s-l*-a,t[3]=e[3],t}function Bt(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Gt(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Vt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Xt(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=e[0],s=e[1],c=e[2],h=e[3];return Math.abs(n-a)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-s)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(o-c)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(i-h)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))}var zt,Ht=Et,Yt=pt,jt=vt,Wt=bt,kt=Lt,qt=St,Zt=Ct,Kt=(zt=ct(),function(t,e,n,r,o,i){var a,s;for(e||(e=4),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;au.EPSILON?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function ee(t,e){var n=Pe(t,e);return Math.acos(2*n*n-1)}function ne(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+a*s+o*c-i*u,t[1]=o*h+a*u+i*s-r*c,t[2]=i*h+a*c+r*u-o*s,t[3]=a*h-r*s-o*u-i*c,t}function re(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*s,t[1]=o*u+i*s,t[2]=i*u-o*s,t[3]=a*u-r*s,t}function oe(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u-i*s,t[1]=o*u+a*s,t[2]=i*u+r*s,t[3]=a*u-o*s,t}function ie(t,e,n){n*=.5;var r=e[0],o=e[1],i=e[2],a=e[3],s=Math.sin(n),u=Math.cos(n);return t[0]=r*u+o*s,t[1]=o*u-r*s,t[2]=i*u+a*s,t[3]=a*u-i*s,t}function ae(t,e){var n=e[0],r=e[1],o=e[2];return t[0]=n,t[1]=r,t[2]=o,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-o*o)),t}function se(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=Math.sqrt(n*n+r*r+o*o),s=Math.exp(i),u=a>0?s*Math.sin(a)/a:0;return t[0]=n*u,t[1]=r*u,t[2]=o*u,t[3]=s*Math.cos(a),t}function ue(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=Math.sqrt(n*n+r*r+o*o),s=a>0?Math.atan2(a,i)/a:0;return t[0]=n*s,t[1]=r*s,t[2]=o*s,t[3]=.5*Math.log(n*n+r*r+o*o+i*i),t}function ce(t,e,n){return ue(t,e),Ne(t,t,n),se(t,t),t}function he(t,e,n,r){var o,i,a,s,c,h=e[0],l=e[1],f=e[2],_=e[3],d=n[0],E=n[1],p=n[2],v=n[3];return(i=h*d+l*E+f*p+_*v)<0&&(i=-i,d=-d,E=-E,p=-p,v=-v),1-i>u.EPSILON?(o=Math.acos(i),a=Math.sin(o),s=Math.sin((1-r)*o)/a,c=Math.sin(r*o)/a):(s=1-r,c=r),t[0]=s*h+c*d,t[1]=s*l+c*E,t[2]=s*f+c*p,t[3]=s*_+c*v,t}function le(t){var e=u.RANDOM(),n=u.RANDOM(),r=u.RANDOM(),o=Math.sqrt(1-e),i=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*n),t[1]=o*Math.cos(2*Math.PI*n),t[2]=i*Math.sin(2*Math.PI*r),t[3]=i*Math.cos(2*Math.PI*r),t}function fe(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n*n+r*r+o*o+i*i,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-o*s,t[3]=i*s,t}function _e(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function de(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var i=(o+1)%3,a=(o+2)%3;n=Math.sqrt(e[3*o+o]-e[3*i+i]-e[3*a+a]+1),t[o]=.5*n,n=.5/n,t[3]=(e[3*i+a]-e[3*a+i])*n,t[i]=(e[3*i+o]+e[3*o+i])*n,t[a]=(e[3*a+o]+e[3*o+a])*n}return t}function Ee(t,e,n,r){var o=.5*Math.PI/180;e*=o,n*=o,r*=o;var i=Math.sin(e),a=Math.cos(e),s=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=i*u*h-a*s*c,t[1]=a*s*h+i*u*c,t[2]=a*u*c-i*s*h,t[3]=a*u*h+i*s*c,t}function pe(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var ve,me,xe,Te,Me,Re,Ae=ht,ge=lt,be=ft,Le=_t,Se=dt,Ce=ne,Ne=At,Pe=yt,Ie=Ot,ye=St,we=ye,Oe=Ct,Fe=Oe,Ue=It,De=Vt,Be=Xt,Ge=(ve=ut.create(),me=ut.fromValues(1,0,0),xe=ut.fromValues(0,1,0),function(t,e,n){var r=ut.dot(e,n);return r<-.999999?(ut.cross(ve,me,e),ut.len(ve)<1e-6&&ut.cross(ve,xe,e),ut.normalize(ve,ve),Jt(t,ve,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(ut.cross(ve,e,n),t[0]=ve[0],t[1]=ve[1],t[2]=ve[2],t[3]=1+r,Ue(t,t))}),Ve=(Te=Qt(),Me=Qt(),function(t,e,n,r,o,i){return he(Te,e,o,i),he(Me,n,r,i),he(t,Te,Me,2*i*(1-i)),t}),Xe=(Re=at.create(),function(t,e,n,r){return Re[0]=n[0],Re[3]=n[1],Re[6]=n[2],Re[1]=r[0],Re[4]=r[1],Re[7]=r[2],Re[2]=-e[0],Re[5]=-e[1],Re[8]=-e[2],Ue(t,de(t,Re))});function ze(){var t=new u.ARRAY_TYPE(8);return u.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function He(t){var e=new u.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function Ye(t,e,n,r,o,i,a,s){var c=new u.ARRAY_TYPE(8);return c[0]=t,c[1]=e,c[2]=n,c[3]=r,c[4]=o,c[5]=i,c[6]=a,c[7]=s,c}function je(t,e,n,r,o,i,a){var s=new u.ARRAY_TYPE(8);s[0]=t,s[1]=e,s[2]=n,s[3]=r;var c=.5*o,h=.5*i,l=.5*a;return s[4]=c*r+h*n-l*e,s[5]=h*r+l*t-c*n,s[6]=l*r+c*e-h*t,s[7]=-c*t-h*e-l*n,s}function We(t,e,n){var r=.5*n[0],o=.5*n[1],i=.5*n[2],a=e[0],s=e[1],u=e[2],c=e[3];return t[0]=a,t[1]=s,t[2]=u,t[3]=c,t[4]=r*c+o*u-i*s,t[5]=o*c+i*a-r*u,t[6]=i*c+r*s-o*a,t[7]=-r*a-o*s-i*u,t}function ke(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function qe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Ze(t,e){var n=Qt();st.getRotation(n,e);var r=new u.ARRAY_TYPE(3);return st.getTranslation(r,e),We(t,n,r),t}function Ke(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Qe(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function $e(t,e,n,r,o,i,a,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t}var Je=be;function tn(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var en=be;function nn(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function rn(t,e){var n=e[4],r=e[5],o=e[6],i=e[7],a=-e[0],s=-e[1],u=-e[2],c=e[3];return t[0]=2*(n*c+i*a+r*u-o*s),t[1]=2*(r*c+i*s+o*a-n*u),t[2]=2*(o*c+i*u+n*s-r*a),t}function on(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=.5*n[0],u=.5*n[1],c=.5*n[2],h=e[4],l=e[5],f=e[6],_=e[7];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=a*s+o*c-i*u+h,t[5]=a*u+i*s-r*c+l,t[6]=a*c+r*u-o*s+f,t[7]=-r*s-o*u-i*c+_,t}function an(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return re(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function sn(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return oe(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function un(t,e,n){var r=-e[0],o=-e[1],i=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=s*a+h*r+u*i-c*o,f=u*a+h*o+c*r-s*i,_=c*a+h*i+s*o-u*r,d=h*a-s*r-u*o-c*i;return ie(t,e,n),r=t[0],o=t[1],i=t[2],a=t[3],t[4]=l*a+d*r+f*i-_*o,t[5]=f*a+d*o+_*r-l*i,t[6]=_*a+d*i+l*o-f*r,t[7]=d*a-l*r-f*o-_*i,t}function cn(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],h=e[3];return t[0]=s*a+h*r+u*i-c*o,t[1]=u*a+h*o+c*r-s*i,t[2]=c*a+h*i+s*o-u*r,t[3]=h*a-s*r-u*o-c*i,s=e[4],u=e[5],c=e[6],h=e[7],t[4]=s*a+h*r+u*i-c*o,t[5]=u*a+h*o+c*r-s*i,t[6]=c*a+h*i+s*o-u*r,t[7]=h*a-s*r-u*o-c*i,t}function hn(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+a*s+o*c-i*u,t[1]=o*h+a*u+i*s-r*c,t[2]=i*h+a*c+r*u-o*s,t[3]=a*h-r*s-o*u-i*c,s=n[4],u=n[5],c=n[6],h=n[7],t[4]=r*h+a*s+o*c-i*u,t[5]=o*h+a*u+i*s-r*c,t[6]=i*h+a*c+r*u-o*s,t[7]=a*h-r*s-o*u-i*c,t}function ln(t,e,n,r){if(Math.abs(r)0){n=Math.sqrt(n);var r=e[0]/n,o=e[1]/n,i=e[2]/n,a=e[3]/n,s=e[4],u=e[5],c=e[6],h=e[7],l=r*s+o*u+i*c+a*h;t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=(s-r*l)/n,t[5]=(u-o*l)/n,t[6]=(c-i*l)/n,t[7]=(h-a*l)/n}return t}function bn(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function Ln(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function Sn(t,e){var n=t[0],r=t[1],o=t[2],i=t[3],a=t[4],s=t[5],c=t[6],h=t[7],l=e[0],f=e[1],_=e[2],d=e[3],E=e[4],p=e[5],v=e[6],m=e[7];return Math.abs(n-l)<=u.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(r-f)<=u.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(o-_)<=u.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(i-d)<=u.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-E)<=u.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-p)<=u.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(c-v)<=u.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(h-m)<=u.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))}var Cn=n(437)},600:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>C,adjoint:()=>_,clone:()=>a,copy:()=>s,create:()=>o,determinant:()=>d,equals:()=>w,exactEquals:()=>y,frob:()=>S,fromMat2d:()=>R,fromMat4:()=>i,fromQuat:()=>A,fromRotation:()=>T,fromScaling:()=>M,fromTranslation:()=>x,fromValues:()=>u,identity:()=>h,invert:()=>f,mul:()=>O,multiply:()=>E,multiplyScalar:()=>P,multiplyScalarAndAdd:()=>I,normalFromMat4:()=>g,projection:()=>b,rotate:()=>v,scale:()=>m,set:()=>c,str:()=>L,sub:()=>F,subtract:()=>N,translate:()=>p,transpose:()=>l});var r=n(685);function o(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function a(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function u(t,e,n,o,i,a,s,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=o,h[4]=i,h[5]=a,h[6]=s,h[7]=u,h[8]=c,h}function c(t,e,n,r,o,i,a,s,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t}function h(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function l(t,e){if(t===e){var n=e[1],r=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function f(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=h*a-s*c,f=-h*i+s*u,_=c*i-a*u,d=n*l+r*f+o*_;return d?(d=1/d,t[0]=l*d,t[1]=(-h*r+o*c)*d,t[2]=(s*r-o*a)*d,t[3]=f*d,t[4]=(h*n-o*u)*d,t[5]=(-s*n+o*i)*d,t[6]=_*d,t[7]=(-c*n+r*u)*d,t[8]=(a*n-r*i)*d,t):null}function _(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8];return t[0]=a*h-s*c,t[1]=o*c-r*h,t[2]=r*s-o*a,t[3]=s*u-i*h,t[4]=n*h-o*u,t[5]=o*i-n*s,t[6]=i*c-a*u,t[7]=r*u-n*c,t[8]=n*a-r*i,t}function d(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return e*(c*i-a*u)+n*(-c*o+a*s)+r*(u*o-i*s)}function E(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=n[0],_=n[1],d=n[2],E=n[3],p=n[4],v=n[5],m=n[6],x=n[7],T=n[8];return t[0]=f*r+_*a+d*c,t[1]=f*o+_*s+d*h,t[2]=f*i+_*u+d*l,t[3]=E*r+p*a+v*c,t[4]=E*o+p*s+v*h,t[5]=E*i+p*u+v*l,t[6]=m*r+x*a+T*c,t[7]=m*o+x*s+T*h,t[8]=m*i+x*u+T*l,t}function p(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=n[0],_=n[1];return t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=f*r+_*a+c,t[7]=f*o+_*s+h,t[8]=f*i+_*u+l,t}function v(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=Math.sin(n),_=Math.cos(n);return t[0]=_*r+f*a,t[1]=_*o+f*s,t[2]=_*i+f*u,t[3]=_*a-f*r,t[4]=_*s-f*o,t[5]=_*u-f*i,t[6]=c,t[7]=h,t[8]=l,t}function m(t,e,n){var r=n[0],o=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function x(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function T(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function M(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function R(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function A(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,l=r*s,f=o*a,_=o*s,d=o*u,E=i*a,p=i*s,v=i*u;return t[0]=1-l-d,t[3]=h-v,t[6]=f+p,t[1]=h+v,t[4]=1-c-d,t[7]=_-E,t[2]=f-p,t[5]=_+E,t[8]=1-c-l,t}function g(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],p=e[14],v=e[15],m=n*s-r*a,x=n*u-o*a,T=n*c-i*a,M=r*u-o*s,R=r*c-i*s,A=o*c-i*u,g=h*E-l*d,b=h*p-f*d,L=h*v-_*d,S=l*p-f*E,C=l*v-_*E,N=f*v-_*p,P=m*N-x*C+T*S+M*L-R*b+A*g;return P?(P=1/P,t[0]=(s*N-u*C+c*S)*P,t[1]=(u*L-a*N-c*b)*P,t[2]=(a*C-s*L+c*g)*P,t[3]=(o*C-r*N-i*S)*P,t[4]=(n*N-o*L+i*b)*P,t[5]=(r*L-n*C-i*g)*P,t[6]=(E*A-p*R+v*M)*P,t[7]=(p*T-d*A-v*x)*P,t[8]=(d*R-E*T+v*m)*P,t):null}function b(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function L(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function S(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function C(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function N(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function P(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function I(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t}function y(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function w(t,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],c=t[6],h=t[7],l=t[8],f=e[0],_=e[1],d=e[2],E=e[3],p=e[4],v=e[5],m=e[6],x=e[7],T=e[8];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-E)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-p)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-v)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-m)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(h-x)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(l-T)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(T))}var O=E,F=N},975:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>k,adjoint:()=>f,clone:()=>i,copy:()=>a,create:()=>o,determinant:()=>_,equals:()=>$,exactEquals:()=>Q,frob:()=>W,fromQuat:()=>O,fromQuat2:()=>C,fromRotation:()=>A,fromRotationTranslation:()=>S,fromRotationTranslationScale:()=>y,fromRotationTranslationScaleOrigin:()=>w,fromScaling:()=>R,fromTranslation:()=>M,fromValues:()=>s,fromXRotation:()=>g,fromYRotation:()=>b,fromZRotation:()=>L,frustum:()=>F,getRotation:()=>I,getScaling:()=>P,getTranslation:()=>N,identity:()=>c,invert:()=>l,lookAt:()=>H,mul:()=>J,multiply:()=>d,multiplyScalar:()=>Z,multiplyScalarAndAdd:()=>K,ortho:()=>X,orthoNO:()=>V,orthoZO:()=>z,perspective:()=>D,perspectiveFromFieldOfView:()=>G,perspectiveNO:()=>U,perspectiveZO:()=>B,rotate:()=>v,rotateX:()=>m,rotateY:()=>x,rotateZ:()=>T,scale:()=>p,set:()=>u,str:()=>j,sub:()=>tt,subtract:()=>q,targetTo:()=>Y,translate:()=>E,transpose:()=>h});var r=n(685);function o(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function i(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function s(t,e,n,o,i,a,s,u,c,h,l,f,_,d,E,p){var v=new r.ARRAY_TYPE(16);return v[0]=t,v[1]=e,v[2]=n,v[3]=o,v[4]=i,v[5]=a,v[6]=s,v[7]=u,v[8]=c,v[9]=h,v[10]=l,v[11]=f,v[12]=_,v[13]=d,v[14]=E,v[15]=p,v}function u(t,e,n,r,o,i,a,s,u,c,h,l,f,_,d,E,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=i,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t[9]=h,t[10]=l,t[11]=f,t[12]=_,t[13]=d,t[14]=E,t[15]=p,t}function c(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function h(t,e){if(t===e){var n=e[1],r=e[2],o=e[3],i=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=i,t[11]=e[14],t[12]=o,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function l(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],p=e[14],v=e[15],m=n*s-r*a,x=n*u-o*a,T=n*c-i*a,M=r*u-o*s,R=r*c-i*s,A=o*c-i*u,g=h*E-l*d,b=h*p-f*d,L=h*v-_*d,S=l*p-f*E,C=l*v-_*E,N=f*v-_*p,P=m*N-x*C+T*S+M*L-R*b+A*g;return P?(P=1/P,t[0]=(s*N-u*C+c*S)*P,t[1]=(o*C-r*N-i*S)*P,t[2]=(E*A-p*R+v*M)*P,t[3]=(f*R-l*A-_*M)*P,t[4]=(u*L-a*N-c*b)*P,t[5]=(n*N-o*L+i*b)*P,t[6]=(p*T-d*A-v*x)*P,t[7]=(h*A-f*T+_*x)*P,t[8]=(a*C-s*L+c*g)*P,t[9]=(r*L-n*C-i*g)*P,t[10]=(d*R-E*T+v*m)*P,t[11]=(l*T-h*R-_*m)*P,t[12]=(s*b-a*S-u*g)*P,t[13]=(n*S-r*b+o*g)*P,t[14]=(E*x-d*M-p*m)*P,t[15]=(h*M-l*x+f*m)*P,t):null}function f(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=e[4],s=e[5],u=e[6],c=e[7],h=e[8],l=e[9],f=e[10],_=e[11],d=e[12],E=e[13],p=e[14],v=e[15];return t[0]=s*(f*v-_*p)-l*(u*v-c*p)+E*(u*_-c*f),t[1]=-(r*(f*v-_*p)-l*(o*v-i*p)+E*(o*_-i*f)),t[2]=r*(u*v-c*p)-s*(o*v-i*p)+E*(o*c-i*u),t[3]=-(r*(u*_-c*f)-s*(o*_-i*f)+l*(o*c-i*u)),t[4]=-(a*(f*v-_*p)-h*(u*v-c*p)+d*(u*_-c*f)),t[5]=n*(f*v-_*p)-h*(o*v-i*p)+d*(o*_-i*f),t[6]=-(n*(u*v-c*p)-a*(o*v-i*p)+d*(o*c-i*u)),t[7]=n*(u*_-c*f)-a*(o*_-i*f)+h*(o*c-i*u),t[8]=a*(l*v-_*E)-h*(s*v-c*E)+d*(s*_-c*l),t[9]=-(n*(l*v-_*E)-h*(r*v-i*E)+d*(r*_-i*l)),t[10]=n*(s*v-c*E)-a*(r*v-i*E)+d*(r*c-i*s),t[11]=-(n*(s*_-c*l)-a*(r*_-i*l)+h*(r*c-i*s)),t[12]=-(a*(l*p-f*E)-h*(s*p-u*E)+d*(s*f-u*l)),t[13]=n*(l*p-f*E)-h*(r*p-o*E)+d*(r*f-o*l),t[14]=-(n*(s*p-u*E)-a*(r*p-o*E)+d*(r*u-o*s)),t[15]=n*(s*f-u*l)-a*(r*f-o*l)+h*(r*u-o*s),t}function _(t){var e=t[0],n=t[1],r=t[2],o=t[3],i=t[4],a=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],_=t[12],d=t[13],E=t[14],p=t[15];return(e*a-n*i)*(l*p-f*E)-(e*s-r*i)*(h*p-f*d)+(e*u-o*i)*(h*E-l*d)+(n*s-r*a)*(c*p-f*_)-(n*u-o*a)*(c*E-l*_)+(r*u-o*s)*(c*d-h*_)}function d(t,e,n){var r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],_=e[10],d=e[11],E=e[12],p=e[13],v=e[14],m=e[15],x=n[0],T=n[1],M=n[2],R=n[3];return t[0]=x*r+T*s+M*l+R*E,t[1]=x*o+T*u+M*f+R*p,t[2]=x*i+T*c+M*_+R*v,t[3]=x*a+T*h+M*d+R*m,x=n[4],T=n[5],M=n[6],R=n[7],t[4]=x*r+T*s+M*l+R*E,t[5]=x*o+T*u+M*f+R*p,t[6]=x*i+T*c+M*_+R*v,t[7]=x*a+T*h+M*d+R*m,x=n[8],T=n[9],M=n[10],R=n[11],t[8]=x*r+T*s+M*l+R*E,t[9]=x*o+T*u+M*f+R*p,t[10]=x*i+T*c+M*_+R*v,t[11]=x*a+T*h+M*d+R*m,x=n[12],T=n[13],M=n[14],R=n[15],t[12]=x*r+T*s+M*l+R*E,t[13]=x*o+T*u+M*f+R*p,t[14]=x*i+T*c+M*_+R*v,t[15]=x*a+T*h+M*d+R*m,t}function E(t,e,n){var r,o,i,a,s,u,c,h,l,f,_,d,E=n[0],p=n[1],v=n[2];return e===t?(t[12]=e[0]*E+e[4]*p+e[8]*v+e[12],t[13]=e[1]*E+e[5]*p+e[9]*v+e[13],t[14]=e[2]*E+e[6]*p+e[10]*v+e[14],t[15]=e[3]*E+e[7]*p+e[11]*v+e[15]):(r=e[0],o=e[1],i=e[2],a=e[3],s=e[4],u=e[5],c=e[6],h=e[7],l=e[8],f=e[9],_=e[10],d=e[11],t[0]=r,t[1]=o,t[2]=i,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=h,t[8]=l,t[9]=f,t[10]=_,t[11]=d,t[12]=r*E+s*p+l*v+e[12],t[13]=o*E+u*p+f*v+e[13],t[14]=i*E+c*p+_*v+e[14],t[15]=a*E+h*p+d*v+e[15]),t}function p(t,e,n){var r=n[0],o=n[1],i=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function v(t,e,n,o){var i,a,s,u,c,h,l,f,_,d,E,p,v,m,x,T,M,R,A,g,b,L,S,C,N=o[0],P=o[1],I=o[2],y=Math.hypot(N,P,I);return y0?(n[0]=2*(u*s+l*o+c*a-h*i)/f,n[1]=2*(c*s+l*i+h*o-u*a)/f,n[2]=2*(h*s+l*a+u*i-c*o)/f):(n[0]=2*(u*s+l*o+c*a-h*i),n[1]=2*(c*s+l*i+h*o-u*a),n[2]=2*(h*s+l*a+u*i-c*o)),S(t,e,n),t}function N(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function P(t,e){var n=e[0],r=e[1],o=e[2],i=e[4],a=e[5],s=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.hypot(n,r,o),t[1]=Math.hypot(i,a,s),t[2]=Math.hypot(u,c,h),t}function I(t,e){var n=new r.ARRAY_TYPE(3);P(n,e);var o=1/n[0],i=1/n[1],a=1/n[2],s=e[0]*o,u=e[1]*i,c=e[2]*a,h=e[4]*o,l=e[5]*i,f=e[6]*a,_=e[8]*o,d=e[9]*i,E=e[10]*a,p=s+l+E,v=0;return p>0?(v=2*Math.sqrt(p+1),t[3]=.25*v,t[0]=(f-d)/v,t[1]=(_-c)/v,t[2]=(u-h)/v):s>l&&s>E?(v=2*Math.sqrt(1+s-l-E),t[3]=(f-d)/v,t[0]=.25*v,t[1]=(u+h)/v,t[2]=(_+c)/v):l>E?(v=2*Math.sqrt(1+l-s-E),t[3]=(_-c)/v,t[0]=(u+h)/v,t[1]=.25*v,t[2]=(f+d)/v):(v=2*Math.sqrt(1+E-s-l),t[3]=(u-h)/v,t[0]=(_+c)/v,t[1]=(f+d)/v,t[2]=.25*v),t}function y(t,e,n,r){var o=e[0],i=e[1],a=e[2],s=e[3],u=o+o,c=i+i,h=a+a,l=o*u,f=o*c,_=o*h,d=i*c,E=i*h,p=a*h,v=s*u,m=s*c,x=s*h,T=r[0],M=r[1],R=r[2];return t[0]=(1-(d+p))*T,t[1]=(f+x)*T,t[2]=(_-m)*T,t[3]=0,t[4]=(f-x)*M,t[5]=(1-(l+p))*M,t[6]=(E+v)*M,t[7]=0,t[8]=(_+m)*R,t[9]=(E-v)*R,t[10]=(1-(l+d))*R,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function w(t,e,n,r,o){var i=e[0],a=e[1],s=e[2],u=e[3],c=i+i,h=a+a,l=s+s,f=i*c,_=i*h,d=i*l,E=a*h,p=a*l,v=s*l,m=u*c,x=u*h,T=u*l,M=r[0],R=r[1],A=r[2],g=o[0],b=o[1],L=o[2],S=(1-(E+v))*M,C=(_+T)*M,N=(d-x)*M,P=(_-T)*R,I=(1-(f+v))*R,y=(p+m)*R,w=(d+x)*A,O=(p-m)*A,F=(1-(f+E))*A;return t[0]=S,t[1]=C,t[2]=N,t[3]=0,t[4]=P,t[5]=I,t[6]=y,t[7]=0,t[8]=w,t[9]=O,t[10]=F,t[11]=0,t[12]=n[0]+g-(S*g+P*b+w*L),t[13]=n[1]+b-(C*g+I*b+O*L),t[14]=n[2]+L-(N*g+y*b+F*L),t[15]=1,t}function O(t,e){var n=e[0],r=e[1],o=e[2],i=e[3],a=n+n,s=r+r,u=o+o,c=n*a,h=r*a,l=r*s,f=o*a,_=o*s,d=o*u,E=i*a,p=i*s,v=i*u;return t[0]=1-l-d,t[1]=h+v,t[2]=f-p,t[3]=0,t[4]=h-v,t[5]=1-c-d,t[6]=_+E,t[7]=0,t[8]=f+p,t[9]=_-E,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function F(t,e,n,r,o,i,a){var s=1/(n-e),u=1/(o-r),c=1/(i-a);return t[0]=2*i*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*u,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(o+r)*u,t[10]=(a+i)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*i*2*c,t[15]=0,t}function U(t,e,n,r,o){var i,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=(o+r)*i,t[14]=2*o*r*i):(t[10]=-1,t[14]=-2*r),t}var D=U;function B(t,e,n,r,o){var i,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=o&&o!==1/0?(i=1/(r-o),t[10]=o*i,t[14]=o*r*i):(t[10]=-1,t[14]=-r),t}function G(t,e,n,r){var o=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(o+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(o-i)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function V(t,e,n,r,o,i,a){var s=1/(e-n),u=1/(r-o),c=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(o+r)*u,t[14]=(a+i)*c,t[15]=1,t}var X=V;function z(t,e,n,r,o,i,a){var s=1/(e-n),u=1/(r-o),c=1/(i-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(o+r)*u,t[14]=i*c,t[15]=1,t}function H(t,e,n,o){var i,a,s,u,h,l,f,_,d,E,p=e[0],v=e[1],m=e[2],x=o[0],T=o[1],M=o[2],R=n[0],A=n[1],g=n[2];return Math.abs(p-R)0&&(h*=_=1/Math.sqrt(_),l*=_,f*=_);var d=u*f-c*l,E=c*h-s*f,p=s*l-u*h;return(_=d*d+E*E+p*p)>0&&(d*=_=1/Math.sqrt(_),E*=_,p*=_),t[0]=d,t[1]=E,t[2]=p,t[3]=0,t[4]=l*p-f*E,t[5]=f*d-h*p,t[6]=h*E-l*d,t[7]=0,t[8]=h,t[9]=l,t[10]=f,t[11]=0,t[12]=o,t[13]=i,t[14]=a,t[15]=1,t}function j(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function W(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function k(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function q(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function Z(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function K(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function Q(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function $(t,e){var n=t[0],o=t[1],i=t[2],a=t[3],s=t[4],u=t[5],c=t[6],h=t[7],l=t[8],f=t[9],_=t[10],d=t[11],E=t[12],p=t[13],v=t[14],m=t[15],x=e[0],T=e[1],M=e[2],R=e[3],A=e[4],g=e[5],b=e[6],L=e[7],S=e[8],C=e[9],N=e[10],P=e[11],I=e[12],y=e[13],w=e[14],O=e[15];return Math.abs(n-x)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-T)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(i-M)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(a-R)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(R))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-b)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(h-L)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(l-S)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(f-C)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(_-N)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(N))&&Math.abs(d-P)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(E-I)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(I))&&Math.abs(p-y)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(y))&&Math.abs(v-w)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(w))&&Math.abs(m-O)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(O))}var J=d,tt=q},437:(t,e,n)=>{"use strict";n.r(e),n.d(e,{add:()=>c,angle:()=>U,ceil:()=>_,clone:()=>i,copy:()=>s,create:()=>o,cross:()=>C,dist:()=>W,distance:()=>T,div:()=>j,divide:()=>f,dot:()=>S,equals:()=>V,exactEquals:()=>G,floor:()=>d,forEach:()=>Z,fromValues:()=>a,inverse:()=>b,len:()=>z,length:()=>R,lerp:()=>N,max:()=>p,min:()=>E,mul:()=>Y,multiply:()=>l,negate:()=>g,normalize:()=>L,random:()=>P,rotate:()=>F,round:()=>v,scale:()=>m,scaleAndAdd:()=>x,set:()=>u,sqrDist:()=>k,sqrLen:()=>q,squaredDistance:()=>M,squaredLength:()=>A,str:()=>B,sub:()=>H,subtract:()=>h,transformMat2:()=>I,transformMat2d:()=>y,transformMat3:()=>w,transformMat4:()=>O,zero:()=>D});var r=n(685);function o(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function i(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function a(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n}function s(t,e){return t[0]=e[0],t[1]=e[1],t}function u(t,e,n){return t[0]=e,t[1]=n,t}function c(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function h(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function l(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function f(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function _(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function d(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function E(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function p(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function v(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function m(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function x(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}function T(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}function M(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function R(t){var e=t[0],n=t[1];return Math.hypot(e,n)}function A(t){var e=t[0],n=t[1];return e*e+n*n}function g(t,e){return t[0]=-e[0],t[1]=-e[1],t}function b(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function L(t,e){var n=e[0],r=e[1],o=n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t}function S(t,e){return t[0]*e[0]+t[1]*e[1]}function C(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}function N(t,e,n,r){var o=e[0],i=e[1];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t}function P(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function I(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o,t[1]=n[1]*r+n[3]*o,t}function y(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[2]*o+n[4],t[1]=n[1]*r+n[3]*o+n[5],t}function w(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[3]*o+n[6],t[1]=n[1]*r+n[4]*o+n[7],t}function O(t,e,n){var r=e[0],o=e[1];return t[0]=n[0]*r+n[4]*o+n[12],t[1]=n[1]*r+n[5]*o+n[13],t}function F(t,e,n,r){var o=e[0]-n[0],i=e[1]-n[1],a=Math.sin(r),s=Math.cos(r);return t[0]=o*s-i*a+n[0],t[1]=o*a+i*s+n[1],t}function U(t,e){var n=t[0],r=t[1],o=e[0],i=e[1],a=Math.sqrt(n*n+r*r)*Math.sqrt(o*o+i*i),s=a&&(n*o+r*i)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function D(t){return t[0]=0,t[1]=0,t}function B(t){return"vec2("+t[0]+", "+t[1]+")"}function G(t,e){return t[0]===e[0]&&t[1]===e[1]}function V(t,e){var n=t[0],o=t[1],i=e[0],a=e[1];return Math.abs(n-i)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(o-a)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(a))}var X,z=R,H=h,Y=l,j=f,W=T,k=M,q=A,Z=(X=o(),function(t,e,n,r,o,i){var a,s;for(e||(e=2),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;a{"use strict";n.r(e),n.d(e,{add:()=>h,angle:()=>G,bezier:()=>I,ceil:()=>d,clone:()=>i,copy:()=>u,create:()=>o,cross:()=>C,dist:()=>q,distance:()=>M,div:()=>k,divide:()=>_,dot:()=>S,equals:()=>H,exactEquals:()=>z,floor:()=>E,forEach:()=>$,fromValues:()=>s,hermite:()=>P,inverse:()=>b,len:()=>K,length:()=>a,lerp:()=>N,max:()=>v,min:()=>p,mul:()=>W,multiply:()=>f,negate:()=>g,normalize:()=>L,random:()=>y,rotateX:()=>U,rotateY:()=>D,rotateZ:()=>B,round:()=>m,scale:()=>x,scaleAndAdd:()=>T,set:()=>c,sqrDist:()=>Z,sqrLen:()=>Q,squaredDistance:()=>R,squaredLength:()=>A,str:()=>X,sub:()=>j,subtract:()=>l,transformMat3:()=>O,transformMat4:()=>w,transformQuat:()=>F,zero:()=>V});var r=n(685);function o(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function i(t){var e=new r.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function a(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function s(t,e,n){var o=new r.ARRAY_TYPE(3);return o[0]=t,o[1]=e,o[2]=n,o}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function c(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function h(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function l(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function f(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function _(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function d(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function E(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function p(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function v(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function m(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function x(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function T(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function M(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return Math.hypot(n,r,o)}function R(t,e){var n=e[0]-t[0],r=e[1]-t[1],o=e[2]-t[2];return n*n+r*r+o*o}function A(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function g(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function b(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function L(t,e){var n=e[0],r=e[1],o=e[2],i=n*n+r*r+o*o;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function S(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function C(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[0],s=n[1],u=n[2];return t[0]=o*u-i*s,t[1]=i*a-r*u,t[2]=r*s-o*a,t}function N(t,e,n,r){var o=e[0],i=e[1],a=e[2];return t[0]=o+r*(n[0]-o),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t}function P(t,e,n,r,o,i){var a=i*i,s=a*(2*i-3)+1,u=a*(i-2)+i,c=a*(i-1),h=a*(3-2*i);return t[0]=e[0]*s+n[0]*u+r[0]*c+o[0]*h,t[1]=e[1]*s+n[1]*u+r[1]*c+o[1]*h,t[2]=e[2]*s+n[2]*u+r[2]*c+o[2]*h,t}function I(t,e,n,r,o,i){var a=1-i,s=a*a,u=i*i,c=s*a,h=3*i*s,l=3*u*a,f=u*i;return t[0]=e[0]*c+n[0]*h+r[0]*l+o[0]*f,t[1]=e[1]*c+n[1]*h+r[1]*l+o[1]*f,t[2]=e[2]*c+n[2]*h+r[2]*l+o[2]*f,t}function y(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI,o=2*r.RANDOM()-1,i=Math.sqrt(1-o*o)*e;return t[0]=Math.cos(n)*i,t[1]=Math.sin(n)*i,t[2]=o*e,t}function w(t,e,n){var r=e[0],o=e[1],i=e[2],a=n[3]*r+n[7]*o+n[11]*i+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*o+n[8]*i+n[12])/a,t[1]=(n[1]*r+n[5]*o+n[9]*i+n[13])/a,t[2]=(n[2]*r+n[6]*o+n[10]*i+n[14])/a,t}function O(t,e,n){var r=e[0],o=e[1],i=e[2];return t[0]=r*n[0]+o*n[3]+i*n[6],t[1]=r*n[1]+o*n[4]+i*n[7],t[2]=r*n[2]+o*n[5]+i*n[8],t}function F(t,e,n){var r=n[0],o=n[1],i=n[2],a=n[3],s=e[0],u=e[1],c=e[2],h=o*c-i*u,l=i*s-r*c,f=r*u-o*s,_=o*f-i*l,d=i*h-r*f,E=r*l-o*h,p=2*a;return h*=p,l*=p,f*=p,_*=2,d*=2,E*=2,t[0]=s+h+_,t[1]=u+l+d,t[2]=c+f+E,t}function U(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0],i[1]=o[1]*Math.cos(r)-o[2]*Math.sin(r),i[2]=o[1]*Math.sin(r)+o[2]*Math.cos(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function D(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[2]*Math.sin(r)+o[0]*Math.cos(r),i[1]=o[1],i[2]=o[2]*Math.cos(r)-o[0]*Math.sin(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function B(t,e,n,r){var o=[],i=[];return o[0]=e[0]-n[0],o[1]=e[1]-n[1],o[2]=e[2]-n[2],i[0]=o[0]*Math.cos(r)-o[1]*Math.sin(r),i[1]=o[0]*Math.sin(r)+o[1]*Math.cos(r),i[2]=o[2],t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t}function G(t,e){var n=t[0],r=t[1],o=t[2],i=e[0],a=e[1],s=e[2],u=Math.sqrt(n*n+r*r+o*o)*Math.sqrt(i*i+a*a+s*s),c=u&&S(t,e)/u;return Math.acos(Math.min(Math.max(c,-1),1))}function V(t){return t[0]=0,t[1]=0,t[2]=0,t}function X(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function z(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function H(t,e){var n=t[0],o=t[1],i=t[2],a=e[0],s=e[1],u=e[2];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-s)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(s))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))}var Y,j=l,W=f,k=_,q=M,Z=R,K=a,Q=A,$=(Y=o(),function(t,e,n,r,o,i){var a,s;for(e||(e=3),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;a{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var a,s,u=o(t),c=1;c{"use strict";n.d(e,{Z:()=>x});let r=window,o=60,i=performance.now(),a=0,s=0,u=i;const c=[],h=[],l=[],f=[];let _=[],d=[],E=-1,p=0;function v(){!function(){let t,e=0,n=1e3/o,r=0;for(e=0;e0;)t=_.pop(),t.func(t.args);let E=performance.now();for(s=(E-i)/1e3,a=E-u,e=0;et.delay&&(t.func(t.args),h.splice(e,1));for(E=performance.now();l.length>0;){if(t=l.shift(),r=performance.now(),!(r-E0;)t=f.shift(),r=performance.now(),r-E-1&&window.cancelAnimationFrame(E),r=t,v()},setFrameRate:function(t){o=t},getElapsedTime:function(){return s},getDeltaTime:function(){return a}};const x=m},247:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});const r={usePostEffect:!0,colorIndex:1,numSets:8,numParticles:128,autoSave:!1,showThumbnail:!1,margin:100,thumbnailSize:256,background:[22,22,22]}},855:(t,e,n)=>{"use strict";n.d(e,{Ag:()=>U,hG:()=>D,nu:()=>B,QA:()=>X,Cg:()=>z,Wu:()=>q,SY:()=>W,uL:()=>w,GL:()=>T,fy:()=>y,v6:()=>G,l:()=>$,Kj:()=>b,xs:()=>tt,jz:()=>V,F7:()=>et});var r=n(187),o=n.n(r),i=n(418),a=n.n(i),s=n(685);function u(t,e){const n=t.getExtension(e);if(!n)return!1;const r=e.split("_")[0],o=new RegExp(`${r}$`);for(const e in n)if("function"==typeof n[e]){const r=e.replace(o,"");e.substring&&(t[r]=n[e].bind(n))}return!0}const c=["EXT_shader_texture_lod","EXT_sRGB","EXT_frag_depth","OES_texture_float","OES_texture_half_float","OES_texture_float_linear","OES_texture_half_float_linear","OES_standard_derivatives","OES_element_index_uint","EXT_texture_filter_anisotropic","EXT_color_buffer_half_float","OES_vertex_array_object","WEBGL_depth_texture","ANGLE_instanced_arrays","WEBGL_color_buffer_float","WEBGL_draw_buffers","EXT_color_buffer_float"],h=(()=>{let t=!1;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(t=!0),t})(),l=(t,e)=>{if("number"==typeof t)return s.equals(t,e);if(t.length!==e.length)return!1;let n=!0;return t.forEach(((t,r)=>{n=s.equals(t,e[r])&&n})),n},f=t=>{let e,n;return t.touches?(e=t.touches[0].pageX,n=t.touches[0].pageY):(e=t.clientX,n=t.clientY),{x:e,y:n}},_={ACTIVE_ATTRIBUTES:35721,ACTIVE_ATTRIBUTE_MAX_LENGTH:35722,ACTIVE_TEXTURE:34016,ACTIVE_UNIFORMS:35718,ACTIVE_UNIFORM_MAX_LENGTH:35719,ALIASED_LINE_WIDTH_RANGE:33902,ALIASED_POINT_SIZE_RANGE:33901,ALPHA:6406,ALPHA_BITS:3413,ALWAYS:519,ARRAY_BUFFER:34962,ARRAY_BUFFER_BINDING:34964,ATTACHED_SHADERS:35717,BACK:1029,BLEND:3042,BLEND_COLOR:32773,BLEND_DST_ALPHA:32970,BLEND_DST_RGB:32968,BLEND_EQUATION:32777,BLEND_EQUATION_ALPHA:34877,BLEND_EQUATION_RGB:32777,BLEND_SRC_ALPHA:32971,BLEND_SRC_RGB:32969,BLUE_BITS:3412,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,BROWSER_DEFAULT_WEBGL:37444,BUFFER_SIZE:34660,BUFFER_USAGE:34661,BYTE:5120,CCW:2305,CLAMP_TO_EDGE:33071,COLOR_ATTACHMENT0:36064,COLOR_BUFFER_BIT:16384,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,COMPILE_STATUS:35713,COMPRESSED_TEXTURE_FORMATS:34467,CONSTANT_ALPHA:32771,CONSTANT_COLOR:32769,CONTEXT_LOST_WEBGL:37442,CULL_FACE:2884,CULL_FACE_MODE:2885,CURRENT_PROGRAM:35725,CURRENT_VERTEX_ATTRIB:34342,CW:2304,DECR:7683,DECR_WRAP:34056,DELETE_STATUS:35712,DEPTH_ATTACHMENT:36096,DEPTH_BITS:3414,DEPTH_BUFFER_BIT:256,DEPTH_CLEAR_VALUE:2931,DEPTH_COMPONENT:6402,RED:6403,DEPTH_COMPONENT16:33189,DEPTH_FUNC:2932,DEPTH_RANGE:2928,DEPTH_STENCIL:34041,DEPTH_STENCIL_ATTACHMENT:33306,DEPTH_TEST:2929,DEPTH_WRITEMASK:2930,DITHER:3024,DONT_CARE:4352,DST_ALPHA:772,DST_COLOR:774,DYNAMIC_DRAW:35048,ELEMENT_ARRAY_BUFFER:34963,ELEMENT_ARRAY_BUFFER_BINDING:34965,EQUAL:514,FASTEST:4353,FLOAT:5126,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,FRAGMENT_SHADER:35632,FRAMEBUFFER:36160,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_BINDING:36006,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_UNSUPPORTED:36061,FRONT:1028,FRONT_AND_BACK:1032,FRONT_FACE:2886,FUNC_ADD:32774,FUNC_REVERSE_SUBTRACT:32779,FUNC_SUBTRACT:32778,GENERATE_MIPMAP_HINT:33170,GEQUAL:518,GREATER:516,GREEN_BITS:3411,HALF_FLOAT:36193,HIGH_FLOAT:36338,HIGH_INT:36341,INCR:7682,INCR_WRAP:34055,INFO_LOG_LENGTH:35716,INT:5124,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,INVALID_ENUM:1280,INVALID_FRAMEBUFFER_OPERATION:1286,INVALID_OPERATION:1282,INVALID_VALUE:1281,INVERT:5386,KEEP:7680,LEQUAL:515,LESS:513,LINEAR:9729,LINEAR_MIPMAP_LINEAR:9987,LINEAR_MIPMAP_NEAREST:9985,LINES:1,LINE_LOOP:2,LINE_STRIP:3,LINE_WIDTH:2849,LINK_STATUS:35714,LOW_FLOAT:36336,LOW_INT:36339,LUMINANCE:6409,LUMINANCE_ALPHA:6410,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_CUBE_MAP_TEXTURE_SIZE:34076,MAX_FRAGMENT_UNIFORM_VECTORS:36349,MAX_RENDERBUFFER_SIZE:34024,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_TEXTURE_SIZE:3379,MAX_VARYING_VECTORS:36348,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VIEWPORT_DIMS:3386,MEDIUM_FLOAT:36337,MEDIUM_INT:36340,MIRRORED_REPEAT:33648,NEAREST:9728,NEAREST_MIPMAP_LINEAR:9986,NEAREST_MIPMAP_NEAREST:9984,NEVER:512,NICEST:4354,NONE:0,NOTEQUAL:517,NO_ERROR:0,NUM_COMPRESSED_TEXTURE_FORMATS:34466,ONE:1,ONE_MINUS_CONSTANT_ALPHA:32772,ONE_MINUS_CONSTANT_COLOR:32770,ONE_MINUS_DST_ALPHA:773,ONE_MINUS_DST_COLOR:775,ONE_MINUS_SRC_ALPHA:771,ONE_MINUS_SRC_COLOR:769,OUT_OF_MEMORY:1285,PACK_ALIGNMENT:3333,POINTS:0,POLYGON_OFFSET_FACTOR:32824,POLYGON_OFFSET_FILL:32823,POLYGON_OFFSET_UNITS:10752,RED_BITS:3410,RENDERBUFFER:36161,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_BINDING:36007,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_STENCIL_SIZE:36181,RENDERBUFFER_WIDTH:36162,RENDERER:7937,REPEAT:10497,REPLACE:7681,RGB:6407,RGB5_A1:32855,RGB565:36194,RGBA:6408,RGBA4:32854,SAMPLER_2D:35678,SAMPLER_CUBE:35680,SAMPLES:32937,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_BUFFERS:32936,SAMPLE_COVERAGE:32928,SAMPLE_COVERAGE_INVERT:32939,SAMPLE_COVERAGE_VALUE:32938,SCISSOR_BOX:3088,SCISSOR_TEST:3089,SHADER_COMPILER:36346,SHADER_SOURCE_LENGTH:35720,SHADER_TYPE:35663,SHADING_LANGUAGE_VERSION:35724,SHORT:5122,SRC_ALPHA:770,SRC_ALPHA_SATURATE:776,SRC_COLOR:768,STATIC_DRAW:35044,STENCIL_ATTACHMENT:36128,STENCIL_BACK_FAIL:34817,STENCIL_BACK_FUNC:34816,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,STENCIL_BITS:3415,STENCIL_BUFFER_BIT:1024,STENCIL_CLEAR_VALUE:2961,STENCIL_FAIL:2964,STENCIL_FUNC:2962,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_TEST:2960,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STREAM_DRAW:35040,SUBPIXEL_BITS:3408,TEXTURE:5890,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,TEXTURE_2D:3553,TEXTURE_BINDING_2D:32873,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP:34067,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,UNPACK_ALIGNMENT:3317,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,UNSIGNED_BYTE:5121,UNSIGNED_INT:5125,UNSIGNED_SHORT:5123,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,VALIDATE_STATUS:35715,VENDOR:7936,VERSION:7938,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_SHADER:35633,VIEWPORT:2978,ZERO:0,R8:33321},d={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6403:"RED",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33321:"R8",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36193:"HALF_FLOAT",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},E={alpha:!1,depth:!0,premultipliedAlpha:!1};var p=n(975),v=n(600);let m=0;function x(){let t,e,n=[0,0,0,0],r=0,o=0,i=0,s=(()=>{const t=document.createElement("canvas");return!(!t.getContext("experimental-webgl2")&&!t.getContext("webgl2"))})(),f=h;const x=p.create(),M=p.create(),R=p.create(),A=v.create(),g=p.create(),b=v.create();this.id="WebGLContext"+m++,this.canvas,this.gl,this.CONTEXT_LOST="contextLost",this.CONTEXT_RESTORED="contextRestored",this.shaderCount=0,this.bufferCount=0,this.textureCount=0,this.frameBufferCount=0,this.maxAnisotropy=0,this.multiRenderTargetSupport=!1,this.maxMultiRenderTargets=0,this.init=function(t,e={}){const n=a()({},E,e);if(void 0!==t){if(t instanceof HTMLCanvasElement){this.canvas=t;let r=s?"webgl2":"webgl";e.webgl1&&(r="webgl",s=!1),this.gl=t.getContext(r,n)}else window.WebGL2RenderingContext&&t instanceof WebGL2RenderingContext?(s=!0,this.gl=t,this.canvas=t.canvas):t instanceof WebGLRenderingContext?(s=!1,this.gl=t,this.canvas=t.canvas):console.error("The source has to be one of the following : Canvas, WebGLRenderingContext or WebGL2RenderingContext");this.canvas.addEventListener("webglcontextlost",S),this.canvas.addEventListener("webglcontextrestored",C),this.extensions=(t=>{const{gl:e}=t,n=window.WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,r={};c.forEach((t=>{r[t]=e.getExtension(t)})),n||(r.OES_vertex_array_object||console.error("OES_vertex_array_object extension is not supported"),u(e,"OES_vertex_array_object"),u(e,"ANGLE_instanced_arrays"),u(e,"WEBGL_draw_buffers"));const o=r.EXT_texture_filter_anisotropic;if(o&&(t.maxAnisotropy=e.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),t.multiRenderTargetSupport=!!t.gl.drawBuffers,t.multiRenderTargetSupport){const n=t.gl.MAX_DRAW_BUFFERS||r.WEBGL_draw_buffers.MAX_DRAW_BUFFERS_WEBGL;t.maxMultiRenderTargets=e.getParameter(n)}return r})(this),(t=>{for(const e in _)t[e]?console.log("already exist : ",e):t[e]=_[e];if(t.webgl2){const e=/^[^a-z]*$/;for(const n in t.gl)e.test(n)&&-1===n.indexOf("FLOAT")&&(t[n]=t.gl[n],_[n]=t.gl[n],d[t[n]]=n)}})(this),this.setSize(this.canvas.width,this.canvas.height),this.enable(this.BLEND),this.enableAlphaBlending(),this.enable(this.DEPTH_TEST),this.enable(this.CULL_FACE),this.cullFace(T.BACK)}else{const t=document.createElement("canvas");this.init(t,n)}},this.clear=function(t=0,e=0,n=0,r=0){const{gl:o}=this;o.clearColor(t,e,n,r),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT)},this.setSize=function(t,e){o=Math.floor(t),i=Math.floor(e),this.canvas.width=o,this.canvas.height=i,r=o/i,this.viewport(0,0,o,i)},this.viewport=function(t,e,r,o){l(n,[t,e,r,o])||(n=[t,e,r,o],this.gl.viewport(t,e,r,o))},this.getViewport=function(){return n},this.getAspectRatio=function(){return r},this.enable=function(t){this.gl.enable(t)},this.disable=function(t){this.gl.disable(t)},this.cullFace=function(t){this.gl.cullFace(t)},this.enableAlphaBlending=function(){const{gl:t}=this;t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)},this.enableAdditiveBlending=function(){const{gl:t}=this;t.blendFunc(t.ONE,t.ONE)},this.setMatrices=function(t){e=t,this.setModelMatrix(M)},this.setModelMatrix=function(t){p.copy(R,t),void 0!==e&&(p.multiply(x,e.viewMatrix,R),v.fromMat4(A,x),v.invert(A,A),v.transpose(A,A),v.fromMat4(b,x),v.invert(b,b),p.invert(g,e.viewMatrix))},this.useShader=function(e){t=e,this.shaderProgram=e.shaderProgram,this.gl.useProgram(this.shaderProgram)},this.draw=function(e){if(e.length)return void e.forEach((t=>this.draw(t)));L(),t.updateUniforms(),e.bind(this);const{drawType:n}=e,{gl:r}=this;e.isInstanced?r.drawElementsInstanced(e.drawType,e.numItems,r.UNSIGNED_INT,0,e.numInstance):n===r.POINTS?r.drawArrays(n,0,e.vertexSize):r.drawElements(n,e.numItems,r.UNSIGNED_INT,0),e.unbind()},this.getCamera=function(){return e},this.destroy=function(t=!0){this.gl.getExtension("WEBGL_lose_context").loseContext(),t&&void 0!==this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)},this.__defineGetter__("width",(function(){return o})),this.__defineGetter__("height",(function(){return i})),this.__defineGetter__("webgl2",(function(){return s})),this.__defineGetter__("isMobile",(function(){return f})),this.__defineGetter__("aspectRatio",(function(){return r}));const L=()=>{void 0!==e&&(t.uniform("uProjectionMatrix","mat4",e.projectionMatrix),t.uniform("uViewMatrix","mat4",e.viewMatrix),t.uniform("uNormalMatrix","mat3",A),t.uniform("uModelViewMatrixInverse","mat3",b)),t.uniform("uModelMatrix","mat4",R)},S=()=>{this.emit(this.CONTEXT_LOST)},C=()=>{this.emit(this.CONTEXT_RESTORED)}}x.prototype=Object.assign(Object.create(o().prototype),{constructor:x});const T=new x,M={float:"uniform1f",vec2:"uniform2fv",vec3:"uniform3fv",vec4:"uniform4fv",int:"uniform1i",ivec2:"uniform2i",ivec3:"uniform3i",ivec4:"uniform4i",mat2:"uniformMatrix2fv",mat3:"uniformMatrix3fv",mat4:"uniformMatrix4fv"},R=t=>"number"==typeof t?t:t.slice?t.slice(0):new Float32Array(t),A=t=>"object"==typeof t?function(t){return 9===t.length?"mat3":16===t.length?"mat4":`vec${t.length}`}(t):"float";function g(t,e){let n;this.vertexShader=t||"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\n\nvoid main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n}",this.fragmentShader=e||"precision highp float;\n#define GLSLIFY 1\n// varying vec2 vTextureCoord;\n\nvoid main(void) {\n gl_FragColor = vec4(1.0);\n}",this.shaderProgram;let r={};this.bind=function(t){if(void 0===t||void 0===n||t===n){if(n=t||T,!this.shaderProgram){const t=o(this.vertexShader,!0),e=o(this.fragmentShader,!1);i(t,e)}n.useShader(this)}else console.error("this shader has been bind to a different WebGL Rendering Context",n.id)},this.uniform=function(t,e,n){let o,i;void 0===n?(i=A(e),o=e):(i=e,o=n);const a=M[i];if(r[t]){const e=r[t];l(e.value,o)||(e.value=R(o),e.changed=!0)}else r[t]={type:i,uniformType:a,value:R(o),changed:!0};return this},this.updateUniforms=function(){if(!n)return void console.warn("No WebGL Context has been set yet, please call shader.bind() first");const{gl:t}=n;for(let e in r){const n=r[e];if(n.changed){const r=e;n.uniformLoc||(n.uniformLoc=t.getUniformLocation(this.shaderProgram,r));const{uniformLoc:o,uniformType:i,value:a}=n;null!==o&&(-1===i.indexOf("Matrix")?t[i](o,a):t[i](o,!1,a)),n.changed=!1}}},this.destroy=function(){const{gl:t}=n;t.deleteProgram(this.shaderProgram),n.shaderCount--};const o=(t,e)=>{const{gl:r}=n,o=e?n.VERTEX_SHADER:n.FRAGMENT_SHADER,i=r.createShader(o);return r.shaderSource(i,t),r.compileShader(i),r.getShaderParameter(i,r.COMPILE_STATUS)?i:(console.warn("Error in Shader : ",r.getShaderInfoLog(i)),console.log((t=>{const e=t.split("\n");for(let t=0;t{const{gl:r}=n;this.shaderProgram=r.createProgram(),r.attachShader(this.shaderProgram,t),r.attachShader(this.shaderProgram,e),r.deleteShader(t),r.deleteShader(e),r.linkProgram(this.shaderProgram),n.shaderCount++}}function b(t=_.TRIANGLES){this.drawType=t,this.numItems=0;let e,n,r,o,i,a=[],s=[],u=[],c=!0,h=!1,l=0;this.bufferData=function(t,e,n,r=_.STATIC_DRAW,o=!1){let i,a=[];if("number"==typeof t[0]){if(i=t,void 0===n)return console.error("Missing element size for flatten data :",e),this;for(let t=0;t{for(let n=0;ne.name===t))},this.getAttributes=function(){return a},this.getSource=function(t){const e=this.getAttribute(t);return e?e.source:[]},this.generateFaces=function(){let t,e,n,o,i,a;u=[];const{vertices:s}=this;for(let c=0;c{t.deleteBuffer(e.buffer),e.source=[],e.dataArray=[],i.bufferCount--})),o&&(t.deleteBuffer(o),i.bufferCount--),t.deleteVertexArray(e),a=[],r=[],s=[]},this.__defineGetter__("vertices",(function(){return this.getSource("aVertexPosition")})),this.__defineGetter__("coords",(function(){return this.getSource("aTextureCoord")})),this.__defineGetter__("normal",(function(){return this.getSource("aNormal")})),this.__defineGetter__("indices",(function(){return r})),this.__defineGetter__("faces",(function(){return u})),this.__defineGetter__("isInstanced",(function(){return h})),this.__defineGetter__("numInstance",(function(){return l}));const f=(t,e,n,r,o=_.STATIC_DRAW,i=!1)=>{const u=o;h=i||h;const c=new Float32Array(t),l=this.getAttribute(n);return l?(l.itemSize=r,l.dataArray=c,l.source=e):a.push({name:n,source:e,itemSize:r,usage:u,dataArray:c,isInstanced:i}),s.push(n),this},d=()=>{const{shaderProgram:t,gl:n}=i;0!=s.length&&(e||(e=n.createVertexArray()),n.bindVertexArray(e),a.forEach((e=>{if(-1!==s.indexOf(e.name)){const r=function(t,e){let n;const{gl:r}=e;return void 0!==t.buffer?n=t.buffer:(n=r.createBuffer(),t.buffer=n,e.bufferCount++),n}(e,i);n.bindBuffer(n.ARRAY_BUFFER,r),n.bufferData(n.ARRAY_BUFFER,e.dataArray,e.usage);const o=((t,e,n)=>(void 0===e.cacheAttribLoc&&(e.cacheAttribLoc={}),void 0===e.cacheAttribLoc[n]&&(e.cacheAttribLoc[n]=t.getAttribLocation(e,n)),e.cacheAttribLoc[n]))(n,t,e.name);o>=0&&(n.enableVertexAttribArray(o),n.vertexAttribPointer(o,e.itemSize,n.FLOAT,!1,0,0)),e.attrPosition=o,e.isInstanced&&n.vertexAttribDivisor(o,1)}})),E(),n.bindVertexArray(null),c=!1,s=[])},E=()=>{const{gl:t}=i;c&&(o||(o=t.createBuffer(),i.bufferCount++),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,n))}}const L=t=>0!==t&&!(t&t-1);class S{constructor(t){this._value=t}set(t,e=1){this._value=this._value,this._value=0===e?this._value&0<>=t,1===e}reset(t){this._value=t}get value(){return this._value}}const C="This browser doesn't support multi render targets : WEBGL_draw_buffers",N="This framebuffer has been bind to a different WebGL Rendering Context",P="This texture has been bind to a different WebGL Rendering Context",I=(t,e="")=>{console.error(t,e)};class y{constructor(t,e={},n=0,r=0){if(this._fromWebGLTexture=!1,t instanceof WebGLTexture)this._texture=t,this._fromWebGLTexture=!0;else{if(this._source=t,this._isHtmlElement=(t=>t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)(this._source),!this._isHtmlElement&&t&&!((t,e)=>{let n=!0;return"Array"===t.constructor.name&&(console.error("Please convert texture source to Unit8Array or Float32Array"),n=!1),void 0===e.type&&"Uint8Array"!==t.constructor.name&&console.error("Using none Unit8Array, pleaes specify type in the texture parameters"),n})(t,e))return;this._getDimension(t,n,r),this._params=function(t,e,n){if(!t.minFilter){let r=_.LINEAR;e&&e&&L(e)&&L(n)&&(r=_.NEAREST_MIPMAP_LINEAR),t.minFilter=r}return t.mipmap=void 0===t.mipmap||t.mipmap,t.magFilter=t.magFilter||_.LINEAR,t.wrapS=t.wrapS||_.CLAMP_TO_EDGE,t.wrapT=t.wrapT||_.CLAMP_TO_EDGE,t.internalFormat=t.internalFormat||_.RGBA,t.format=t.format||_.RGBA,t.premultiplyAlpha=void 0!==t.premultiplyAlpha&&t.premultiplyAlpha,t.level=t.level||0,t.type=t.type||_.UNSIGNED_BYTE,t}(e,this._width,this._height),this._checkMipmap()}this._parametersState=new S(0)}bind(t,e){if(void 0!==e&&void 0!==this.GL&&e!==this.GL)return void I(P,this.GL.id);this.GL=e||T;const{gl:n}=this.GL;this._fromWebGLTexture||this.createTexture(this.GL),n.activeTexture(n.TEXTURE0+t),n.bindTexture(n.TEXTURE_2D,this._texture),this._checkParameters()}createTexture(t){void 0===t||void 0===this.GL||t===this.GL?(this.GL=t||T,this._texture||(((t,e)=>{t.webgl2&&(e.type===_.HALF_FLOAT?(e.type=t.gl.HALF_FLOAT,e.internalFormat=_.RGBA16F):e.type===_.FLOAT&&(e.internalFormat=_.RGBA32F))})(this.GL,this._params),this._uploadTexture())):I(P,this.GL.id)}updateTexture(t,e){this.GL=e||T,this._source=t,this._uploadTexture()}generateMipmap(){if(!this._generateMipmap)return;const{gl:t}=this.GL;t.bindTexture(t.TEXTURE_2D,this._texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){const{gl:t}=this.GL;t.deleteTexture(this._texture),this.GL.textureCount--}showProperties(){console.log("Dimension :",this._width,this._height);for(const t in this._params)console.log(t,d[this._params[t]]||this._params[t])}_uploadTexture(){const{gl:t}=this.GL;this._texture||(this._texture=t.createTexture(),this.GL.textureCount++),t.bindTexture(t.TEXTURE_2D,this._texture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),this._isHtmlElement&&!this.GL.webgl2?t.texImage2D(t.TEXTURE_2D,0,this._params.internalFormat,this._params.format,this._params.type,this._source):t.texImage2D(t.TEXTURE_2D,0,this._params.internalFormat,this._width,this._height,0,this._params.format,this._params.type,this._source),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this._params.magFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this._params.minFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._params.wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._params.wrapT),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha),this._generateMipmap&&t.generateMipmap(t.TEXTURE_2D)}_checkParameters(){const{gl:t}=this.GL;this._parametersState.value>0&&(this._parametersState.get(0)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this._params.minFilter):this._parametersState.get(1)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this._params.magFilter):this._parametersState.get(2)?t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._params.wrapS):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._params.wrapT)),this._parametersState.reset(0)}_getDimension(t,e,n){t?(this._width=t.width||t.videoWidth,this._height=t.height||t.videoWidth,this._width=this._width||e,this._height=this._height||n,this._width&&this._height||(this._width=this._height=Math.sqrt(t.length/4))):(this._width=e,this._height=n)}_checkMipmap(){this._generateMipmap=this._params.mipmap,L(this._width)&&L(this._height)||(this._generateMipmap=!1),-1===d[this._params.minFilter].indexOf("MIPMAP")&&(this._generateMipmap=!1)}get texture(){return this._texture}set minFilter(t){this._params.minFilter=t,this._parametersState.set(0,1)}get minFilter(){return this._params.minFilter}set magFilter(t){this._params.magFilter=t,this._parametersState.set(1,1)}get magFilter(){return this._params.magFilter}set wrapS(t){this._params.wrapS=t,this._parametersState.set(2,1)}get wrapS(){return this._params.wrapS}set wrapT(t){this._params.wrapT=t,this._parametersState.set(3,1)}get wrapT(){return this._params.wrapT}get width(){return this._width}get height(){return this._height}get glTexture(){return this._texture}}function w(t,e,n={},r=1){let o,i;const a=t,s=e,u=n,c=r,h=[];let l;this.bind=function(t,e=!0){if(void 0!==t&&void 0!==o&&t!==o)return void I(N,o.id);o=t||T;const{gl:n}=o;c>1&&!o.multiRenderTargetSupport&&I(C,o.id),i||f(),e&&o.viewport(0,0,a,s),n.bindFramebuffer(n.FRAMEBUFFER,i)},this.unbind=function(t=!0){t&&o.viewport(0,0,o.width,o.height);const{gl:e}=o;e.bindFramebuffer(e.FRAMEBUFFER,null),h.forEach((t=>{t.generateMipmap()}))},this.getTexture=function(t=0){return h[t]},this.destroy=function(){const{gl:t}=o;h.forEach((t=>t.destroy())),l.destroy(),t.deleteFramebuffer(i),o.frameBufferCount--};const f=()=>{d();const{gl:t}=o;i=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,i),o.frameBufferCount++;const e=o.webgl2?t.DRAW_FRAMEBUFFER:t.FRAMEBUFFER,n=[];for(let r=0;r{for(let t=0;t{const i=Object.assign({},u);n||(n=t),i.internalFormat=t||_.RGBA,i.format=n||_.RGBA,i.type=e||i.type,Object.assign(i,r);const c=new y(null,i,a,s);return c.createTexture(o),c};this.__defineGetter__("texture",(function(){return h[0]})),this.__defineGetter__("depthTexture",(function(){return l})),this.__defineGetter__("width",(function(){return a})),this.__defineGetter__("height",(function(){return s}))}var O=n(160);class F{constructor(){this._mtx=p.create(),this._mtxView=p.create(),this._mtxProj=p.create(),this._near=0,this._far=0,this._lookDir=O.create()}lookAt(t,e,n=[0,1,0]){p.lookAt(this._mtxView,t,e,n)}setFromViewProjection(t,e){p.copy(this._mtxView,t),p.copy(this._mtxProj,e)}setViewMatrix(t){p.copy(this._mtxView,t)}setProjectionMatrix(t){p.copy(this._mtxProj,t)}_updateMatrices(){}get viewMatrix(){return p.mul(this._mtx,this._mtxProj,this._mtxView),this._mtx}get viewMatrix(){return this._mtxView}get view(){return this._mtxView}get projectionMatrix(){return this._mtxProj}get projection(){return this._mtxProj}get position(){const t=p.create();return p.invert(t,this._mtxView),[t[12],t[13],t[14]]}get direction(){const t=v.create();return v.fromMat4(t,this._mtxView),v.transpose(t,t),O.transformMat3(this._lookDir,[0,0,-1],t),O.normalize(this._lookDir,this._lookDir),this._lookDir}set near(t){this._near=t,this._updateMatrices()}get near(){return this._near}set far(t){this._far=t,this._updateMatrices()}get far(){return this._far}}class U extends F{constructor(t,e,n,r,o=.1,i=100){super(),this._left=0,this._right=0,this._top=0,this._bottom=0,this.ortho(t,e,n,r,o,i)}ortho(t,e,n,r,o=.1,i=100){this.left=t,this.right=e,this.top=n,this.bottom=r,p.ortho(this._mtxProj,t,e,r,n,o,i),this._left=t,this._right=e,this._top=n,this._bottom=r,this._near=o,this._far=i}_updateMatrices(){this.ortho(this._left,this._right,this._top,this._bottom,this._near,this._far)}}class D{constructor(t){return this._GL=t||T,this._uniforms={},this._uniformTextures=[],this._fbo,this._clearColor={r:0,g:0,b:0,a:0},this}setClearColor(t=0,e=0,n=0,r=0){return this._clearColor.r=t,this._clearColor.g=e,this._clearColor.b=n,this._clearColor.a=r,this}useProgram(t,e){return this._shader=t instanceof g?t:new g(t,e),this}setMesh(t){return this._mesh=t,this}createMesh(t){return this._mesh=new b(t),this}bufferVertex(t){return this._mesh||(this._mesh=new b),this._mesh.bufferVertex(t),this}bufferTexCoord(t){return this._mesh||(this._mesh=new b),this._mesh.bufferTexCoord(t),this}bufferNormal(t){return this._mesh||(this._mesh=new b),this._mesh.bufferNormal(t),this}bufferIndex(t){return this._mesh||(this._mesh=new b),this._mesh.bufferIndex(t),this}bufferInstance(t,e){return this._mesh?(this._mesh.bufferInstance(t,e),this):(console.warn("Need to create mesh first"),this)}bufferData(t,e){return this._mesh||(this._mesh=new b),this._mesh.bufferData(t,e),this}uniform(t,e,n){const r=t;let o,i;return void 0===n?(i=A(e),o=e):(i=e,o=n),this._uniforms[r]={type:i,value:o},this}uniformTexture(t,e,n){return this.bindTexture(t,e,n)}bindTexture(t,e,n){return void 0!==n?this._uniformTextures[n]={name:t,texture:e}:(console.log("no index",t),this._uniformTextures.push({name:t,texture:e})),this}bindFrameBuffer(t){return this._fbo=t,this}draw(){if(this._shader){if(this._mesh){if(this._fbo){const{r:t,g:e,b:n,a:r}=this._clearColor;this._fbo.bind(this._GL),this._GL.clear(t,e,n,r)}this._shader.bind(this._GL);for(const t in this._uniforms){const e=this._uniforms[t];this._shader.uniform(t,e.type,e.value)}return this._uniformTextures.forEach(((t,e)=>{void 0!==t&&(this._shader.uniform(t.name,"int",e),t.texture.bind(e,this._GL))})),this._GL.draw(this._mesh),this._fbo&&this._fbo.unbind(),this}console.warn("No Mesh assigned for draw call")}else console.warn("No GLShader assigned for draw call")}get shader(){return this._shader}get framebuffer(){return this._fbo}}class B extends D{constructor(t){super(t);const e=this._GL,n=1e3,r=[[-n,0,0],[n,0,0],[0,-n,0],[0,n,0],[0,0,-n],[0,0,n]];this.createMesh(e.LINES).bufferVertex(r).bufferData([[1,0,0],[1,0,0],[0,1,0],[0,1,0],[0,0,1],[0,0,1]],"aColor").bufferIndex([0,1,2,3,4,5]).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec3 aColor;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nout vec3 vColor;\n\nvoid main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);\n vColor = aColor;\n}","#version 300 es\nprecision highp float;\n#define GLSLIFY 1\nin vec3 vColor;\nuniform float uOpacity;\nout vec4 oColor;\n\nvoid main(void) {\n oColor = vec4(vColor, uOpacity);\n}"),this.opacity=.75}draw(){this.uniform("uOpacity",this.opacity),super.draw()}}const G={plane:(t,e,n,r="xy")=>{const o=[],i=[],a=[],s=[],u=t/n,c=e/n,h=1/n,l=.5*-t,f=.5*-e;let _=0;for(let t=0;t{const o=t/2,i=(e=e||t)/2,a=(n=n||t)/2,s=[],u=[],c=[],h=[];let l=0;return s.push([-o,i,-a]),s.push([o,i,-a]),s.push([o,-i,-a]),s.push([-o,-i,-a]),h.push([0,0,-1]),h.push([0,0,-1]),h.push([0,0,-1]),h.push([0,0,-1]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,-a]),s.push([o,i,a]),s.push([o,-i,a]),s.push([o,-i,-a]),h.push([1,0,0]),h.push([1,0,0]),h.push([1,0,0]),h.push([1,0,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,a]),s.push([-o,i,a]),s.push([-o,-i,a]),s.push([o,-i,a]),h.push([0,0,1]),h.push([0,0,1]),h.push([0,0,1]),h.push([0,0,1]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([-o,i,a]),s.push([-o,i,-a]),s.push([-o,-i,-a]),s.push([-o,-i,a]),h.push([-1,0,0]),h.push([-1,0,0]),h.push([-1,0,0]),h.push([-1,0,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,i,-a]),s.push([-o,i,-a]),s.push([-o,i,a]),s.push([o,i,a]),h.push([0,1,0]),h.push([0,1,0]),h.push([0,1,0]),h.push([0,1,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),l++,s.push([o,-i,a]),s.push([-o,-i,a]),s.push([-o,-i,-a]),s.push([o,-i,-a]),h.push([0,-1,0]),h.push([0,-1,0]),h.push([0,-1,0]),h.push([0,-1,0]),u.push([0,0]),u.push([1,0]),u.push([1,1]),u.push([0,1]),c.push(4*l+0),c.push(4*l+1),c.push(4*l+2),c.push(4*l+0),c.push(4*l+2),c.push(4*l+3),r&&c.reverse(),(new b).bufferVertex(s).bufferTexCoord(u).bufferIndex(c).bufferNormal(h)},sphere:(t,e,n=!1)=>{const r=[],o=[],i=[],a=[],s=1/e;let u=0;function c(n,r,o=!1){const i=n/e*Math.PI-.5*Math.PI,a=r/e*Math.PI*2,s=o?1:t,u=[];u[1]=Math.sin(i)*s;const c=Math.cos(i)*s;u[0]=Math.cos(a)*c,u[2]=Math.sin(a)*c;const h=1e4;return u[0]=Math.floor(u[0]*h)/h,u[1]=Math.floor(u[1]*h)/h,u[2]=Math.floor(u[2]*h)/h,u}for(let t=0;t(new b).bufferData([[-1,-1],[-1,4],[4,-1]],"aPosition",2).bufferIndex([2,1,0])},V={simpleColorFrag:"#version 300 es\nprecision highp float;\n#define GLSLIFY 1\n\nuniform vec3 uColor;\nuniform float uOpacity;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor = vec4(uColor, uOpacity);\n}",copyFrag:"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\n\nout vec4 oColor;\n\nvoid main(void) {\n oColor = texture(uMap, vTextureCoord);\n}",bigTriangleVert:"#version 300 es\n\nprecision mediump float;\n#define GLSLIFY 1\nin vec2 aPosition;\nout vec2 vTextureCoord;\n\nvoid main(void) {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n vTextureCoord = aPosition * .5 + .5;\n}",generalVert:"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec3 uTranslate;\nuniform vec3 uScale;\nuniform vec3 uRotation;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nvoid main(void) {\n vec3 pos = aVertexPosition * uScale;\n pos.yz = rotate(pos.yz, uRotation.x);\n pos.xz = rotate(pos.xz, uRotation.y);\n pos.xy = rotate(pos.xy, uRotation.z);\n pos += uTranslate;\n\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(pos, 1.0);\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n}"};class X extends D{constructor(t){super(t),this.setMesh(G.sphere(1,12)).useProgram(V.generalVert,V.simpleColorFrag).uniform("uRotation",[0,0,0])}draw(t,e=[1,1,1],n=[1,1,1],r=1){this.uniform("uTranslate",t).uniform("uScale",e).uniform("uColor",n).uniform("uOpacity",r),super.draw(0)}}class z extends D{constructor(t){super(t),this.setMesh(G.bigTriangle()).useProgram(V.bigTriangleVert,V.copyFrag)}draw(t){this.bindTexture("texture",t,0),super.draw(0)}}const{mat4:H,vec4:Y}=n(720);class j{constructor(t,e,n,r={},o=1){this._fbos=[];for(let i=0;ithis._update()))}_update(){this._checkLimit(),this._value+=(this._targetValue-this._value)*this.easing,Math.abs(this._targetValue-this._value)<1e-4&&(this._value=this._targetValue)}setTo(t){this._targetValue=this._value=t}add(t){this._targetValue+=t}limit(t,e){t>e?this.limit(e,t):(this._min=t,this._max=e,this._checkLimit())}_checkLimit(){void 0!==this._min&&this._targetValuethis._max&&(this._targetValue=this._max)}destroy(){k.Z.removeEF(this._efIndex)}set value(t){this._targetValue=t}get value(){return this._value}get targetValue(){return this._targetValue}}const Z=function(t,e){const n=e||{};return t.touches?(n.x=t.touches[0].pageX,n.y=t.touches[0].pageY):(n.x=t.clientX,n.y=t.clientY),n};class K{#t=!1;#e=!1;#n=!1;#r=!1;#o;#i={};#a={};#s=p.create();#u=p.create();#c=p.create();#h=p.create();#l=O.create();#f=O.create();#_=O.fromValues(0,1,0);radius=new q(0);rx=new q(0);ry=new q(0);#d=0;#E=0;constructor(t,e=5,n=window){this.#o=t,this.radius.setTo(e),this.#f=[0,0,this.radius],this.rx.limit(-Math.PI/2+.01,Math.PI/2-.01),n.addEventListener("mousewheel",this._onWheel),n.addEventListener("DOMMouseScroll",this._onWheel),n.addEventListener("mousedown",this._onDown),n.addEventListener("mousemove",this._onMove),window.addEventListener("mouseup",this._onUp),n.addEventListener("touchstart",this._onDown),n.addEventListener("touchmove",this._onMove),window.addEventListener("touchend",this._onUp),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.update(),k.Z.addEF(this._loop)}lock(t=!0){this.#t=t,this.#e=t,this.#r=!1}lockZoom(t=!0){this.#e=t}lockRotation(t=!0){this.#t=t}update(){O.set(this.#f,0,0,this.radius.value),O.rotateX(this.#f,this.#f,[0,0,0],this.rx.value),O.rotateY(this.#f,this.#f,[0,0,0],this.ry.value),p.lookAt(this.#s,this.#f,this.#l,this.#_),p.invert(this.#u,this.#s),p.mul(this.#s,this.#s,this.#h),p.mul(this.#s,this.#s,this.#c),this.#o?.setViewMatrix(this.#s)}_onDown=t=>{this.#t||(this.#r=!0,Z(t,this.#i),Z(t,this.#a),this.#d=this.rx.targetValue,this.#E=this.ry.targetValue,p.identity(this.#c))};_onMove=t=>{if(this.#t)return;if(!this.#r)return;if(Z(t,this.#i),t.shiftKey){const t=[this.#i.x-this.#a.x,-(this.#i.y-this.#a.y),0];return O.transformMat4(t,t,this.#u),O.scale(t,t,.01),p.identity(this.#c,this.#c),void p.translate(this.#c,this.#c,t)}const e=this.#i.x-this.#a.x;this.ry.value=.01*-e+this.#E;const n=this.#i.y-this.#a.y;this.rx.value=.01*-n+this.#d};_onUp=()=>{this.#r=!1,this.#n&&(p.mul(this.#h,this.#h,this.#c),p.identity(this.#c))};_onWheel=t=>{if(this.#e)return;const e=t.wheelDelta,n=t.detail;let r=0;r=n?e?e/n/40*n>0?1:-1:-n/3:e/120,this.radius.add(2*-r),this.radius.targetValue<0&&(this.radius.value=1e-4)};_onKeyDown=t=>{t.code.indexOf("Shift")>-1&&(this.#n=!0)};_onKeyUp=t=>{"Shift"===t.key&&(p.mul(this.#h,this.#h,this.#c),p.identity(this.#c)),this.#n=!1};_loop=()=>{this.update()}}function Q(t,e){this.origin=t,this.direction=e;const n=O.create(),r=O.create(),o=O.create(),i=O.create(),a=O.create(),s=O.create(),u=O.create(),c=O.create();this.at=function(t){return O.copy(i,this.direction),O.scale(i,i,t),O.add(i,i,this.origin),i},this.lookAt=function(t){O.sub(this.direction,t,this.origin),O.normalize(this.origin,this.origin)},this.closestPointToPoint=function(t){const e=O.create();O.sub(t,this.origin);const n=O.dot(e,this.direction);return n<0?O.clone(this.origin):(O.copy(e,this.direction),O.scale(e,e,n),O.add(e,e,this.origin),e)},this.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},this.distanceSqToPoint=function(t){const e=O.create();O.sub(e,t,this.origin);const n=O.dot(e,this.direction);return n<0?O.squaredDistance(this.origin,t):(O.copy(e,this.direction),O.scale(e,e,n),O.add(e,e,this.origin),O.squaredDistance(e,t))},this.intersectsSphere=function(t,e){return this.distanceToPoint(t)<=e},this.intersectSphere=function(t,e){const n=O.create();O.sub(n,t,this.origin);const r=O.dot(n,this.direction),o=O.dot(n,n)-r*r,i=e*e;if(o>i)return null;const a=Math.sqrt(i-o),s=r-a,u=r+a;return s<0&&u<0?null:s<0?this.at(u):this.at(s)},this.intersectTriangle=function(t,e,i,h=!0){O.copy(n,t),O.copy(r,e),O.copy(o,i),O.sub(a,r,n),O.sub(s,o,n),O.cross(u,a,s);let l,f=O.dot(this.direction,u);if(f>0){if(h)return null;l=1}else{if(!(f<0))return null;l=-1,f=-f}O.sub(c,this.origin,n),O.cross(s,c,s);const _=l*O.dot(this.direction,s);if(_<0)return null;O.cross(a,a,c);const d=l*O.dot(this.direction,a);if(d<0)return null;if(_+d>f)return null;const E=-l*O.dot(c,u);return E<0?null:this.at(E/f)}}class $ extends(o()){constructor(t,e,n,r=!1,o=window){super(),this._mesh=t,this._mesh.generateFaces(),this._camera=e,this.faceVertices=t.faces.map((t=>t.vertices)),this.clickTolerance=8,this._ray=new Q([0,0,0],[0,0,-1]),this._hit=O.fromValues(-999,-999,-999),this._lastPos,this._firstPos,this.modelMatrix=p.create(),this.resolution=n||[window.innerWidth,window.innerHeight],this._listenerTarget=o,this._skippingMove=r,this._onMoveBind=t=>this._onMove(t),this._onDownBind=t=>this._onDown(t),this._onUpBind=()=>this._onUp(),this.connect()}connect(){this._listenerTarget.addEventListener("mousedown",this._onDownBind),this._listenerTarget.addEventListener("mousemove",this._onMoveBind),this._listenerTarget.addEventListener("mouseup",this._onUpBind)}disconnect(){this._listenerTarget.removeEventListener("mousedown",this._onDownBind),this._listenerTarget.removeEventListener("mousemove",this._onMoveBind),this._listenerTarget.removeEventListener("mouseup",this._onUpBind)}_checkHit(t="onHit"){const e=this._camera;if(!e)return;const n=this._lastPos.x/this.resolution[0]*2-1,r=-this._lastPos.y/this.resolution[1]*2+1;let o;e.generateRay([n,r,0],this._ray);const i=O.create(),a=O.create(),s=O.create();let u=0;const c=(t,e)=>{O.transformMat4(e,t,this.modelMatrix)};for(let t=0;tthis.resize())),this._efIndex=k.Z.addEF((()=>this._loop()))}stop(){this._isRunning=!1}resume(){this._isRunning=!0}_initTextures(){}_initViews(){}update(){}render(){}_loop(){this._isRunning&&(this.update(),this._GL.viewport(0,0,this._GL.width,this._GL.height),this._GL.setMatrices(this.camera),this.render())}resize(){this._GL.setSize(window.innerWidth,window.innerHeight),this.camera.setAspectRatio(this._GL.aspectRatio)}}const et=t=>{const e=t.split("\n"),n=[],r=[],o=[],i=[],a=[],s=[],u=[];let c,h=0;const l=/v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,f=/vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,_=/vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,d=/f( +-?\d+)( +-?\d+)( +-?\d+)( +-?\d+)?/,E=/f( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))?/,p=/f( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))?/,v=/f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/;function m(t){const e=parseInt(t);return 3*(e>=0?e-1:e+i.length/3)}function x(t){const e=parseInt(t);return 3*(e>=0?e-1:e+a.length/3)}function T(t){const e=parseInt(t);return 2*(e>=0?e-1:e+s.length/2)}function M(t,e,r){n.push([i[t],i[t+1],i[t+2]]),n.push([i[e],i[e+1],i[e+2]]),n.push([i[r],i[r+1],i[r+2]]),u.push(3*h+0),u.push(3*h+1),u.push(3*h+2),h++}function R(t,e,n){r.push([s[t],s[t+1]]),r.push([s[e],s[e+1]]),r.push([s[n],s[n+1]])}function A(t,e,n){o.push([a[t],a[t+1],a[t+2]]),o.push([a[e],a[e+1],a[e+2]]),o.push([a[n],a[n+1],a[n+2]])}function g(t,e,n,r,o,i,a,s,u,c,h,l){let f,_=m(t),d=m(e),E=m(n);void 0===r?M(_,d,E):(f=m(r),M(_,d,f),M(d,E,f)),void 0!==o&&(_=T(o),d=T(i),E=T(a),void 0===r?R(_,d,E):(f=T(s),R(_,d,f),R(d,E,f))),void 0!==u&&(_=x(u),d=x(c),E=x(h),void 0===r?A(_,d,E):(f=x(l),A(_,d,f),A(d,E,f)))}for(let t=0;t{const e=t.normals.length>0,n=t.coords.length>0;let r;if(t.positions.length>65535){const o=[];let i=0;const a={};for(a.positions=t.positions.concat(),a.coords=t.coords.concat(),a.indices=t.indices.concat(),a.normals=t.normals.concat();t.indices.length>0;){const s=Math.min(65535,t.positions.length),u=t.indices.splice(0,s),c=[],h=[],l=[];let f,_=0;for(let t=0;t_&&(_=u[t]),f=u[t],c.push(a.positions[f]),n&&h.push(a.coords[f]),e&&l.push(a.normals[f]),u[t]-=i;i=_+1,r=new b,r.bufferVertex(c),n&&r.bufferTexCoord(h),r.bufferIndex(u),e&&r.bufferNormal(l),o.push(r)}return o}return r=new b,r.bufferVertex(t.positions),n&&r.bufferTexCoord(t.coords),r.bufferIndex(t.indices),e&&r.bufferNormal(t.normals),r};n(643)},643:()=>{Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function t(){var e=isNaN(arguments[0])?1:Number(arguments[0]);return e?Array.prototype.reduce.call(this,(function(n,r){return Array.isArray(r)?n.push.apply(n,t.call(r,e-1)):n.push(r),n}),[]):Array.prototype.slice.call(this)},writable:!0})},297:()=>{let t="123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";var e="oo"+Array(49).fill(0).map((e=>t[Math.random()*t.length|0])).join("");let n=e.slice(2),r=new RegExp(".{"+(e.length/4|0)+"}","g"),o=n.match(r).map((e=>{return(n=e).split("").reduce(((e,r,o)=>e+t.indexOf(r)*Math.pow(t.length,n.length-o-1)),0);var n}));window.fxhash=e,window.fxrand=((t,e,n,r)=>()=>{var o=((t|=0)+(e|=0)|0)+(r|=0)|0;return r=r+1|0,t=e^e>>>9,e=(n|=0)+(n<<3)|0,n=(n=n<<21|n>>>11)+o|0,(o>>>0)/4294967296})(...o)},619:(t,e,n)=>{"use strict";n.d(e,{Ag:()=>s,jE:()=>_,Gv:()=>a,H:()=>u,ei:()=>l,MX:()=>c,Iy:()=>h,Ak:()=>r,CW:()=>f});const r=(t,e="data",n=!0)=>{var r=n?JSON.stringify(t,null,4):JSON.stringify(t),i=o(r),a=new Blob([i],{type:"application/octet-stream"}),s=URL.createObjectURL(a),u=document.createElement("a");u.setAttribute("href",s),u.setAttribute("download",`${e}.json`);var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,0,null),u.dispatchEvent(c)},o=t=>{for(var e=[],n=0;n[t,.99*t,.96*t],s=Math.PI/180,u=t=>{console.error(t)},c=(t,e)=>void 0===t?fxrand():void 0===e?fxrand()*t:t+(e-t)*fxrand(),h=(t,e)=>Math.floor(c(t,e)),l=t=>t[h(t.length)],f=(t,e,n)=>{var r=Math.max(0,Math.min(1,(n-t)/(e-t)));return r*r*(3-2*r)},_=i.fromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1)}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.m=n,o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.f={},o.e=t=>Promise.all(Object.keys(o.f).reduce(((e,n)=>(o.f[n](t,e),e)),[])),o.u=t=>t+".bundle.js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="fxhash-boilerplate-webpack:",o.l=(n,r,i,a)=>{if(t[n])t[n].push(r);else{var s,u;if(void 0!==i)for(var c=document.getElementsByTagName("script"),h=0;h{s.onerror=s.onload=null,clearTimeout(_);var o=t[n];if(delete t[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach((t=>t(r))),e)return e(r)},_=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),u&&document.head.appendChild(s)}},o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");n.length&&(t=n[n.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t})(),(()=>{var t={179:0};o.f.j=(e,n)=>{var r=o.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var i=new Promise(((n,o)=>r=t[e]=[n,o]));n.push(r[2]=i);var a=o.p+o.u(e),s=new Error;o.l(a,(n=>{if(o.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var i=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,r[1](s)}}),"chunk-"+e,e)}};var e=(e,n)=>{var r,i,[a,s,u]=n,c=0;if(a.some((e=>0!==t[e]))){for(r in s)o.o(s,r)&&(o.m[r]=s[r]);u&&u(o)}for(e&&e(n);c{"use strict";var t=o(247),e=(o(297),o(855)),n=o(619);let r;const i=t=>{r=t.map((({id:t,file:n,type:r})=>{const o=n;let i;switch(r){case"jpg":case"png":i=new e.fy(n);break;case"text":i=(0,e.F7)(n)}return{id:t,source:o,type:r,file:i}})),console.table(r)},a=t=>{const e=r.find((e=>e.id===t));return e?e.file:null};var s=o(51),u=o(160),c=o(975),h=o(437);class l extends e.hG{constructor(){super();const{numParticles:r}=t.Z,o=[],i=[],a=[],s=[],c=[],h=()=>{const t=2*Math.sqrt((0,n.MX)());return u.random([0,0,0],t)};for(let t=0;t 0.5)\n // discard;\n\n vec2 uv = gl_PointCoord.xy - 0.5;\n uv = abs(rotate(uv, PI / 4.0 * step(vRandom.z, 0.5)));\n float t = 0.1;\n float tx = smoothstep(t + 0.01, t, uv.x);\n float ty = smoothstep(t + 0.01, t, uv.y);\n\n float alpha = max(tx, ty);\n\n if(alpha < 0.9) discard;\n\n oColor = vec4(vColor, 1.0) * 0.15;\n}")}}class _ extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\n#define NUM_LINES 40\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform sampler2D uPosMap;\nuniform sampler2D uVelMap;\nuniform sampler2D uExtraMap;\nuniform sampler2D uDataMap;\nuniform sampler2D uPosOrgMap;\nuniform sampler2D uFluidMap;\nuniform sampler2D uDensityMap;\n\nuniform float uTime;\nuniform float uNoiseScale;\nuniform float uSpeed;\nuniform vec3 uTouch;\nuniform vec3 uCenter;\nuniform float uOffset;\nuniform float uLifeDecrease;\n\nlayout (location = 0) out vec4 oFragColor0;\nlayout (location = 1) out vec4 oFragColor1;\nlayout (location = 2) out vec4 oFragColor2;\nlayout (location = 3) out vec4 oFragColor3;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nmat4 rotationMatrix(vec3 axis, float angle) {\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n \n return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,\n 0.0, 0.0, 0.0, 1.0);\n}\n\nvec3 rotate(vec3 v, vec3 axis, float angle) {\n\tmat4 m = rotationMatrix(axis, angle);\n\treturn (m * vec4(v, 1.0)).xyz;\n}\n\n// snoise.glsl\nvec4 permute_1(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt_1(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise_1(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D_1 = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_1 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_1;\n vec3 i1 = min( g_1.xyz, l.zxy );\n vec3 i2 = max( g_1.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute_1( permute_1( permute_1( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D_1.wyz - D_1.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1_1 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0_1 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1_1.xy,h.z);\n vec3 p3 = vec3(a1_1.zw,h.w);\n \n vec4 norm = taylorInvSqrt_1(vec4(dot(p0_1,p0_1), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0_1 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0_1,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise_1(float x, float y, float z){\n return snoise_1(vec3(x, y, z));\n}\n\n// curlNoise.glsl\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\n// snoise.glsl\nvec4 permute_0(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt_0(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise_0(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D_0 = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_0 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_0;\n vec3 i1 = min( g_0.xyz, l.zxy );\n vec3 i2 = max( g_0.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute_0( permute_0( permute_0( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D_0.wyz - D_0.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1_0 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0_0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1_0.xy,h.z);\n vec3 p3 = vec3(a1_0.zw,h.w);\n \n vec4 norm = taylorInvSqrt_0(vec4(dot(p0_0,p0_0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0_0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0_0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise_0(float x, float y, float z){\n return snoise_0(vec3(x, y, z));\n}\n\nvec3 snoiseVec3( vec3 x ){\n\n\tfloat s = snoise_0(vec3( x ));\n\tfloat s1 = snoise_0(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 ));\n\tfloat s2 = snoise_0(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 ));\n\tvec3 c = vec3( s , s1 , s2 );\n\treturn c;\n\n}\n\nvec3 curlNoise( vec3 p ){\n\t\n\tconst float e = .1;\n\tvec3 dx = vec3( e , 0.0 , 0.0 );\n\tvec3 dy = vec3( 0.0 , e , 0.0 );\n\tvec3 dz = vec3( 0.0 , 0.0 , e );\n\n\tvec3 p_x0 = snoiseVec3( p - dx );\n\tvec3 p_x1 = snoiseVec3( p + dx );\n\tvec3 p_y0 = snoiseVec3( p - dy );\n\tvec3 p_y1 = snoiseVec3( p + dy );\n\tvec3 p_z0 = snoiseVec3( p - dz );\n\tvec3 p_z1 = snoiseVec3( p + dz );\n\n\tfloat x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;\n\tfloat y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;\n\tfloat z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;\n\n\tconst float divisor = 1.0 / ( 2.0 * e );\n\treturn normalize( vec3( x , y , z ) * divisor );\n\n}\n\n#define PI 3.1415926535897932384626433832795\n\nvoid main(void) {\n vec3 pos = texture(uPosMap, vTextureCoord).xyz;\n vec3 vel = texture(uVelMap, vTextureCoord).xyz;\n vec3 extra = texture(uExtraMap, vTextureCoord).xyz;\n vec3 data = texture(uDataMap, vTextureCoord).xyz;\n\n float posOffset = snoise_1(vec3(pos + uTime * 5.5)) * .5 + .5;\n posOffset = mix(2.2, 2.0, posOffset) * 0.1 * uNoiseScale;\n\n vec3 acc = vec3(0.0);\n vec3 noise = curlNoise(pos * posOffset - uTime * 0.3);\n acc += noise;\n\n vec3 dir;\n float f;\n\n f = 0.25;\n float maxRadius = mix(2.0, 2.2, extra.z) - f;\n maxRadius += step(2.0, uSpeed) * (0.5 + f);\n float d = distance(pos, uCenter);\n\n // pulling force\n dir = -normalize(pos - uCenter);\n f = smoothstep(maxRadius - 1.0, maxRadius, d);\n acc += dir * f * 2.0;\n \n\n // repel to touch\n d = distance(pos, uTouch);\n f = smoothstep(6.0, 3.0, d);\n dir = normalize(pos - uTouch);\n\n float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.2;\n t = sin(t * PI);\n t = smoothstep(-0.5, 1.0, t);\n // acc -= dir * f * 6.0/uSpeed * t * step(uSpeed, 2.0);\n float fSpeed = smoothstep(4.0, 1.0, uSpeed);\n fSpeed = mix(0.2, 1.0, fSpeed);\n acc -= dir * f * 4.0/uSpeed * t * fSpeed;\n \n float speed = mix(2.0, 3.0, extra.x);\n // float speed = mix(2.0, 4.0, extra.x);\n\n t = fract(extra.x + extra.y );\n if( t < 0.01) speed *= mix(4.0, 8.0, t);\n vel += acc * speed * 0.0002 * uSpeed;\n\n pos += vel;\n vel *= .96;\n\n oFragColor0 = vec4(pos, 1.0);\n oFragColor1 = vec4(vel, 1.0);\n oFragColor2 = vec4(extra, 1.0);\n oFragColor3 = vec4(data, 1.0);\n}").setClearColor(0,0,0,0)}}class d extends e.hG{constructor(){super();const{numParticles:r,numSets:o}=t.Z,i=parseInt(o),a=[],s=[],u=[],c=[];let h=0;const l=(t,e)=>{const{pos:n,normal:r}=((t,e)=>{const n=2*Math.PI/3*e,r=Math.cos(n),o=Math.sin(n);return{pos:[t,.015*o,.015*r],normal:[0,o,r]}})(t,e);a.push(n),u.push(r),s.push([t/i,e/3])},f=i*i;for(let t=0;t 0.5) discard;\n // shadow\n vec4 shadowCoord = vShadowCoord / vShadowCoord.w;\n\tfloat s = samplePCF3x3(shadowCoord);\n s = mix(s, 1.0, .6);\n\n float d = diffuse(vNormal, uLight, .3);\n vec3 color = vColor * d * s;\n color = smoothstep(vec3(0.0), vec3(1.0), color) * 1.2;\n\n oColor = vec4(color, 1.0);\n}").uniform("uTotal",f).uniform("uNumSets",i)}}class E extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform float uRatio;\nout vec4 oColor;\n\nvoid main(void) {\n if(vTextureCoord.x > .5) discard;\n float n = texture(uMap, vTextureCoord * 4.0).r; \n\n vec2 uv = vTextureCoord - .5;\n if(uRatio > 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n }\n\n float d = length(uv);\n d = smoothstep(0.2, 0.8, d);\n d = mix(d, 1.0, .1);\n d += n * 0.2;\n\n // n = mix(0.8, 1.0, n);\n n *= 0.2;\n\n float t = distance(uv, vec2(-0.5*uRatio, 0.5));\n t = smoothstep(1.0, 2.5, t);\n\n d += t * 1.5;\n \n\n oColor = vec4(vec3(n), d * .3);\n // oColor = vec4(vec3(t), 1.0);\n\n // oColor = vec4(vTextureCoord, 0.0, 1.0);\n}")}}class p extends e.hG{constructor(){super(),this.setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMapCurr;\nuniform sampler2D uMapPrev;\nuniform float uRatio;\nuniform float uColorOffset;\n\nout vec4 oColor;\n\nvoid main(void) {\n vec2 uv = vTextureCoord - .5;\n if(uRatio < 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n } \n\n float d = length(uv);\n d = smoothstep(0.6, 0.2, d);\n\n uv += 0.5;\n // vec4 color = texture(uMap, uv);\n vec4 colorCurr = texture( uMapCurr, uv );\n vec4 colorPrev = texture( uMapPrev, uv );\n vec4 color = mix(colorPrev, colorCurr, uColorOffset);\n\n color.rgb *= mix(0.7, 1.0, d);\n\n vec3 colorAdjusted = smoothstep(vec3(0.0), vec3(1.0), color.rgb);\n color.rgb = mix(color.rgb, colorAdjusted, 0.5);\n\n oColor = color;\n}")}}class v extends e.hG{constructor(){super();const t=e.v6.plane(30,30,1,"xz");this.setMesh(t).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat4 uShadowMatrix;\n\nout vec2 vTextureCoord;\nout vec3 vNormal;\nout vec4 vShadowCoord;\n\nvec2 rotate(vec2 v, float a) {\n\tfloat s = sin(a);\n\tfloat c = cos(a);\n\tmat2 m = mat2(c, s, -s, c);\n\treturn m * v;\n}\n\nmat4 rotationMatrix(vec3 axis, float angle) {\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n \n return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,\n 0.0, 0.0, 0.0, 1.0);\n}\n\nvec3 rotate(vec3 v, vec3 axis, float angle) {\n\tmat4 m = rotationMatrix(axis, angle);\n\treturn (m * vec4(v, 1.0)).xyz;\n}\n\nvoid main(void) {\n vec3 pos = aVertexPosition;\n pos.y -= 4.0;\n\n vec4 wsPos = uModelMatrix * vec4(pos, 1.0);\n gl_Position = uProjectionMatrix * uViewMatrix * wsPos;\n vTextureCoord = aTextureCoord;\n vNormal = aNormal;\n\n vShadowCoord = uShadowMatrix * wsPos;\n}","#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nin vec4 vShadowCoord;\n\nuniform sampler2D uMap;\nuniform sampler2D uDepthMap;\nout vec4 oColor;\n\nfloat samplePCF3x3( vec4 sc )\n{\n const int s = 2;\n float shadow = 0.0;\n\n float bias = 0.005;\n float threshold = sc.z - bias;\n\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2(-s, s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( 0, s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s,-s) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s, 0) ).r);\n shadow += step(threshold, textureProjOffset( uDepthMap, sc, ivec2( s, s) ).r);\n return shadow/9.0;\n}\n\nvoid main(void) {\n // shadow\n vec4 shadowCoord = vShadowCoord / vShadowCoord.w;\n\n\tfloat s = 1.0 -samplePCF3x3(shadowCoord);\n\n if(shadowCoord.x < 0.0 ||shadowCoord.x > 1.0 ||\n shadowCoord.y < 0.0 ||shadowCoord.y > 1.0) {\n s = 0.0;\n }\n\n if(shadowCoord.z > 1.0) {\n s = 0.0;\n }\n\n oColor = vec4(vec3(0.0), s * 0.15);\n}")}}class m extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\n#define LUT_FLIP_Y 1\n\nprecision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D uMap; // Normal texture\nuniform sampler2D uBlurMap; // Blurred texture\nuniform sampler2D uDepthMap; // Depth texture\nuniform sampler2D uNoiseMap; // noise texture\nuniform sampler2D uLookupMap; // lookup texture\n\nuniform float uFocus; // Focus distance\nuniform float uNear; // Camera near plane\nuniform float uFar; // Camera far plane\nuniform float uRatio;\n\nin vec2 vTextureCoord;\nout vec4 oColor;\n\nfloat normalizeDepth(float depth) {\n return (2.0 * uNear) / (uFar + uNear - depth * (uFar - uNear));\n}\n\nvec4 lookup(in vec4 textureColor, in sampler2D lookupTable, float strength) {\n #ifndef LUT_NO_CLAMP\n textureColor = clamp(textureColor, 0.0, 1.0);\n #endif\n\n mediump float blueColor = textureColor.b * 63.0;\n\n mediump vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n mediump vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n highp vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n #ifdef LUT_FLIP_Y\n texPos1.y = 1.0-texPos1.y;\n #endif\n\n highp vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\n\n #ifdef LUT_FLIP_Y\n texPos2.y = 1.0-texPos2.y;\n #endif\n\n lowp vec4 newColor1 = texture(lookupTable, texPos1);\n lowp vec4 newColor2 = texture(lookupTable, texPos2);\n\n lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return mix(textureColor, newColor, strength);\n}\n\nvec4 lookup(in vec4 textureColor, in sampler2D lookupTable) {\n return lookup(textureColor, lookupTable, 1.0);\n}\n\nvoid main() {\n float depth = texture(uDepthMap, vTextureCoord).r;\n float normalizedDepth = normalizeDepth(depth);\n\n // Calculate blur amount based on depth difference\n float blurAmount = abs(normalizedDepth - uFocus);\n // blurAmount = clamp(blurAmount, 0.0, 1.0);\n blurAmount = smoothstep(0.2, 0.4, blurAmount);\n blurAmount = pow(blurAmount, 1.5);\n // blurAmount = smoothstep(0.0, 0.7, blurAmount);\n\n float t = 0.05;\n blurAmount = smoothstep(uFocus - t, uFocus + t, normalizedDepth);\n\n vec2 uv = vTextureCoord - .5;\n if(uRatio < 1.0) {\n uv.x *= uRatio;\n } else {\n uv.y /= uRatio;\n }\n\n float distCenter = length(uv);\n float v = smoothstep(0.6, 0.2, distCenter);\n v = mix(.8, 1.2, v);\n\n float d = smoothstep(0.5, 0.2, distCenter);\n blurAmount = mix(0.0, blurAmount, d);\n\n vec4 sharpColor = texture(uMap, vTextureCoord);\n vec4 blurredColor = texture(uBlurMap, vTextureCoord);\n\n // Mix based on blur amount\n vec4 color = mix(sharpColor, blurredColor, blurAmount);\n color.rgb *= v;\n float n = texture(uNoiseMap, vTextureCoord).r;\n\n d = smoothstep(0.1, 0.7, distCenter);\n color.rgb += n * d * 0.15;\n\n // highlight / shadow\n d = 0.1;\n t = distance(uv, vec2(-d, d) * vec2(uRatio, 1.0));\n t = smoothstep(0.25, 0.8, t);\n color.rgb *= mix(1.0, 0.5, t);\n\n color.rgb = pow(color.rgb, vec3(0.75));\n // color.rgb = pow(color.rgb + 0.2, vec3(1.75));\n color = lookup(color, uLookupMap, 0.25);\n oColor = color;\n}\n")}}class x extends e.hG{constructor(){super().setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\n\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform float rtWidth;\nuniform float rtHeight;\n\nout vec4 oColor;\n\nfloat FXAA_SUBPIX_SHIFT = 1.0/4.0;\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#define FXAA_SPAN_MAX 8.0\n\nvec4 applyFXAA(vec2 fragCoord, sampler2D tex) {\n vec4 color;\n vec2 inverseVP = vec2(1.0 / rtWidth, 1.0 / rtHeight);\n vec3 rgbNW = texture(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;\n vec3 rgbNE = texture(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;\n vec3 rgbSW = texture(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;\n vec3 rgbSE = texture(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;\n vec3 rgbM = texture(tex, fragCoord * inverseVP).xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n //return texture(tex, fragCoord);\n //return vec4(fragCoord, 0.0, 1.0);\n //return vec4(rgbM, 1.0);\n\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, 1.0);\n else\n color = vec4(rgbB, 1.0);\n return color;\n}\n\nvoid main(void) {\n vec4 posPos = vec4(.0);\n\n\tvec2 rcpFrame = vec2(1.0/rtWidth, 1.0/rtHeight);\n\n \tposPos.xy = vTextureCoord.xy;\n \tposPos.zw = vTextureCoord.xy - (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));\n\n \toColor = applyFXAA(vTextureCoord * vec2(rtWidth, rtHeight), uMap);\n}")}}class T extends e.hG{constructor(){super();const t=[],r=[],o=[];let i=500;for(;i--;)t.push([(0,n.MX)(-10,10),(0,n.MX)(-10,10),.5*(0,n.MX)(-10,10)]),r.push([(0,n.MX)(),(0,n.MX)(),(0,n.MX)()]),o.push(i);const a=new e.Kj(e.GL.POINTS).bufferVertex(t).bufferNormal(r).bufferIndex(o);this.setMesh(a).useProgram("#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec3 aVertexPosition;\nin vec2 aTextureCoord;\nin vec3 aNormal;\n\nuniform mat4 uModelMatrix;\nuniform mat4 uViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform vec2 uViewport;\nuniform float uTime;\nuniform float uBound;\n\nout vec2 vTextureCoord;\nout vec3 vExtra;\nout vec3 vColor;\n\nfloat particleSize(vec4 screenPos, mat4 mtxProj, vec2 viewport, float radius) {\n\treturn viewport.y * mtxProj[1][1] * radius / screenPos.w;\n}\n\n// snoise.glsl\nvec4 permute(vec4 x) { return mod(((x*34.0)+1.0)*x, 289.0); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nfloat snoise(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n \n vec3 g_0 = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g_0;\n vec3 i1 = min( g_0.xyz, l.zxy );\n vec3 i2 = max( g_0.xyz, l.zxy );\n \n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n \n i = mod(i, 289.0 );\n vec4 p = permute( permute( permute( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n float n_ = 1.0/7.0;\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z *ns.z);\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ );\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n}\n\nfloat snoise(float x, float y, float z){\n return snoise(vec3(x, y, z));\n}\n\n#define radius 0.015\n\nvoid main(void) {\n vec3 pos = aVertexPosition;\n\n vec3 vel = mix(aNormal, vec3(1.0), .5);\n vel.z *= 0.1;\n float speed = mix(0.5, 3.0, aNormal.x) * 0.2;\n\n pos += vel * uTime * speed;\n pos = mod(pos + uBound, uBound * 2.0) - uBound;\n\n float scaleBound = 1.0;\n float scale = abs(pos.x) / uBound;\n scaleBound *= smoothstep(1.0, .9, scale);\n scale = abs(pos.y) / uBound;\n scaleBound *= smoothstep(1.0, .9, scale);\n\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(pos, 1.0);\n\n vExtra = aNormal;\n\n scale = mix(0.5, 2.0, aNormal.x) * scaleBound;\n\n gl_PointSize = particleSize(gl_Position, uProjectionMatrix, uViewport, radius * scale);\n\n // color \n float g = mix(0.15, 1.0, aNormal.z);\n vColor = vec3(g);\n}","#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nin vec3 vExtra;\nin vec3 vColor;\n\nout vec4 oColor;\n\nvoid main(void) {\n float d = distance(gl_PointCoord, vec2(0.5));\n d = smoothstep(0.5, 0.49, d);\n oColor = vec4(vColor, .2) * d;\n}").uniform("uBound",10)}}let M,R,A;const g="#version 300 es\n\nprecision highp float;\n#define GLSLIFY 1\nin vec2 vTextureCoord;\nuniform sampler2D uMap;\nuniform vec2 uDirection;\nuniform vec2 uResolution;\n\nout vec4 oColor;\n\nvec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n\tvec4 color = vec4(0.0);\n\tvec2 off1 = vec2(1.3846153846) * direction;\n\tvec2 off2 = vec2(3.2307692308) * direction;\n\tcolor += texture(image, uv) * 0.2270270270;\n\tcolor += texture(image, uv + (off1 / resolution)) * 0.3162162162;\n\tcolor += texture(image, uv - (off1 / resolution)) * 0.3162162162;\n\tcolor += texture(image, uv + (off2 / resolution)) * 0.0702702703;\n\tcolor += texture(image, uv - (off2 / resolution)) * 0.0702702703;\n\treturn color;\n}\n\nvoid main(void) {\n oColor = blur9(uMap, vTextureCoord, uResolution, uDirection);\n}";let b,L,S={};function C(t,n="default"){const r=2048;if(!S[n]){const o=new e.SY(r,r,{minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR});S[n]=o;const i=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,g).setClearColor(0,0,0,1),a=7;for(let e=0;e8&&(c=250),setTimeout((()=>{this.lengthScale.easing=.02,this.lengthScale.value=-.2,this.lengthScale.value=.15}),1500),setTimeout((()=>{this.speed.value=.1}),300+c),setTimeout((()=>{this.lengthScale.easing=.03,this.lengthScale.easing=.04,this.lengthScale.value=1}),2200+c),setTimeout((()=>this.pulse()),3e3+c)}_initTextures(){this.resize();const{numParticles:r,numSets:o}=t.Z,i={minFilter:e.GL.NEAREST,magFilter:e.GL.NEAREST,type:e.GL.FLOAT},s={minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR};this._fbo=new e.SY(r,r,i,4),this._fboRender=new e.uL(e.GL.width,e.GL.height),this._fboCompose=new e.uL(e.GL.width,e.GL.height);let u=r*o;this._fboPos=new e.uL(u,u,i),this._fboPos.bind(),e.GL.clear(0,0,0,1),this._fboPos.unbind(),u=2048,this._fboShadow=new e.uL(u,u,s),this._fboShadowFloor=new e.uL(u,u,s),this._textureNoise=(R||(R=new e.uL(e.GL.width,e.GL.height,{wrapS:e.GL.MIRRORED_REPEAT,wrapT:e.GL.MIRRORED_REPEAT}),A=(0,n.MX)(1e3),M=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,"#version 300 es\nprecision highp float;\n#define GLSLIFY 1\n\nin vec2 vTextureCoord;\nout vec4 outColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\n\nuint Rand(uint x) {\n x ^= x >> 16;\n x *= 0x7feb352dU;\n x ^= x >> 15;\n x *= 0x846ca68bU;\n x ^= x >> 16;\n return x;\n}\n\nuint HilbertIndex(uvec2 p) {\n uint i = 0u;\n for(uint l = 0x4000u; l > 0u; l >>= 1u) {\n uvec2 r = min(p & l, 1u);\n \n i = (i << 2u) | ((r.x * 3u) ^ r.y); \n p = r.y == 0u ? (0x7FFFu * r.x) ^ p.yx : p;\n }\n return i;\n}\n\nuint ReverseBits(uint x) {\n x = ((x & 0xaaaaaaaau) >> 1) | ((x & 0x55555555u) << 1);\n x = ((x & 0xccccccccu) >> 2) | ((x & 0x33333333u) << 2);\n x = ((x & 0xf0f0f0f0u) >> 4) | ((x & 0x0f0f0f0fu) << 4);\n x = ((x & 0xff00ff00u) >> 8) | ((x & 0x00ff00ffu) << 8);\n return (x >> 16) | (x << 16);\n}\n\n// from: https://psychopath.io/post/2021_01_30_building_a_better_lk_hash\nuint OwenHash(uint x, uint seed) { // seed is any random number\n x ^= x * 0x3d20adeau;\n x += seed;\n x *= (seed >> 16) | 1u;\n x ^= x * 0x05526c56u;\n x ^= x * 0x53a22864u;\n return x;\n}\n\n// adapted from: https://www.shadertoy.com/view/MslGR8\nfloat ReshapeUniformToTriangle(float v) {\n v = v * 2.0 - 1.0;\n v = sign(v) * (1.0 - sqrt(max(0.0, 1.0 - abs(v)))); // [-1, 1], max prevents NaNs\n return v + 0.5; // [-0.5, 1.5]\n}\n\nvoid main() {\n float scale = 10.0;\n uint m = HilbertIndex(uvec2(uResolution * vTextureCoord * scale)); // map pixel coords to hilbert curve index\n m = OwenHash(ReverseBits(m), 0xe7843fbfu); // owen-scramble hilbert index\n m = OwenHash(ReverseBits(m), 0x8d8fb1e0u); // map hilbert index to sobol sequence and owen-scramble\n float mask = float(ReverseBits(m)) / 4294967296.0; // convert to float\n\n outColor = vec4(vec3(mask), 1.0);\n}\n").setClearColor(0,0,0,1).bindFrameBuffer(R).uniform("uTime",A).uniform("uResolution",[e.GL.width,e.GL.height])),M.draw(),A+=.01,R.texture),this._textureColor=a(`color${t.Z.colorIndex}`),this._textureColor.minFilter=this._textureColor.magFilter=e.GL.NEAREST,this._textureLookup=a("lookup"),this._textureLookup.minFilter=this._textureLookup.magFilter=e.GL.NEAREST,this._index=0}_initViews(){this._dAxis=new e.nu,this._dCopy=new e.Cg,this._dBall=new e.QA,this._drawCover=new E,this._drawBackground=new p,this._drawFloor=new v,this._drawFlowParticles=new T,this._drawFxaa=new x,this._drawCompose=(new m).setClearColor(0,0,0,0).bindFrameBuffer(this._fboCompose),(new l).bindFrameBuffer(this._fbo.read).draw(),this._drawSim=new _,this._drawParticles=new f,this._drawRibbon=new d}updateColor(){this._prevColorIndex=this._currColorIndex,this._currColorIndex=t.Z.colorIndex,this.switchColor()}switchColor(){this._texColorCurr=a(`color${this._currColorIndex}`),this._texColorPrev=a(`color${this._prevColorIndex}`),this._bgCurr=C(this._texColorCurr,`color${this._currColorIndex}`),this._bgPrev=C(this._texColorPrev,`color${this._prevColorIndex}`),this._colorOffset.setTo(0),this._colorOffset.value=1}_initHit(){const t=e.v6.plane(15,15/e.GL.aspectRatio,1);this._hitTestor=new e.l(t,this.camera),this._hitTestor.on("onHit",(t=>{u.copy(this._hit,t.hit)})),this._hitTestor.on("onUp",(()=>{this._hit=[999,999,999]}))}update(){this._length=.45*Math.sin(.85*s.Z.getElapsedTime())+.55,this._drawSim.bindFrameBuffer(this._fbo.write).bindTexture("uPosMap",this._fbo.read.getTexture(0),0).bindTexture("uVelMap",this._fbo.read.getTexture(1),1).bindTexture("uExtraMap",this._fbo.read.getTexture(2),2).bindTexture("uDataMap",this._fbo.read.getTexture(3),3).uniform("uTime",s.Z.getElapsedTime()+this._seedTime).uniform("uSpeed",this.speed.value).uniform("uTouch",this._hit).uniform("uNoiseScale",this.noiseScale).uniform("uCenter",this._center).draw(),this._fbo.swap();const{numParticles:n,numSets:r}=t.Z,o=parseInt(r),i=this._index%o,a=Math.floor(this._index/o);this._index++,this._index>=o*o&&(this._index=0),e.GL.disable(e.GL.DEPTH_TEST),this._fboPos.bind(),e.GL.viewport(i*n,a*n,n,n),this._dCopy.draw(this._fbo.read.getTexture(0)),this._fboPos.unbind(),e.GL.enable(e.GL.DEPTH_TEST),this._updateShadowMap(!1)}_updateShadowMap(){this._fboShadow.bind(),e.GL.clear(0,0,0,1),e.GL.setMatrices(this._cameraLight),this._renderRibbon(!1),this._fboShadow.unbind(),this._fboShadowFloor.bind(),e.GL.clear(0,0,0,1),e.GL.setMatrices(this._cameraFloorShadow),this._renderRibbon(!1),this._fboShadowFloor.unbind()}_renderRibbon(t=!1){const r=t?this._fboShadow.depthTexture:this._fbo.read.getTexture(0);this._drawRibbon.bindTexture("uPosMap",this._fboPos.texture,0).bindTexture("uDepthMap",r,1).bindTexture("uColorMapCurr",this._texColorCurr,2).bindTexture("uColorMapPrev",this._texColorPrev,3).uniform("uColorOffset",this._colorOffset.value).uniform("uIndex",this._index).uniform("uLight",this._lightPosition).uniform("uShadowMatrix",this.mtxShadow).uniform("uColor",(0,n.Gv)(1)).uniform("uTime",s.Z.getElapsedTime()).uniform("uLengthOffset",this.lengthScale.value).uniform("uTouch",this._hit).draw(),this._drawParticles.bindTexture("uPosMap",this._fbo.read.getTexture(0),0).bindTexture("uColorMapCurr",this._texColorCurr,2).bindTexture("uColorMapPrev",this._texColorPrev,3).uniform("uColorOffset",this._colorOffset.value).uniform("uViewport",[e.GL.width,e.GL.height]).draw()}render(){let r=t.Z.usePostEffect,o=.91;if(e.GL.clear(...(0,n.Gv)(o),1),e.GL.setMatrices(this.camera),e.GL.disable(e.GL.DEPTH_TEST),r&&(this._fboRender.bind(),e.GL.clear(0,0,0,0)),this._drawBackground.bindTexture("uMapCurr",this._bgCurr,0).bindTexture("uMapPrev",this._bgPrev,1).uniform("uRatio",e.GL.aspectRatio).uniform("uColorOffset",this._colorOffset.value).draw(),e.GL.enable(e.GL.DEPTH_TEST),o=.2,this._drawFloor.bindTexture("uDepthMap",this._fboShadowFloor.depthTexture,0).uniform("uShadowMatrix",this.mtxShadowFloor).draw(),this._renderRibbon(!0),this._drawFlowParticles.uniform("uViewport",[e.GL.width,e.GL.height]).uniform("uTime",s.Z.getElapsedTime()).draw(),r){this._fboRender.unbind(),this._textureBlurredRender=function(t){const{width:n,height:r}=e.GL;if(!b){const t=1;b=new e.SY(n*t,r*t,{minFilter:e.GL.LINEAR,magFilter:e.GL.LINEAR}),L=(new e.hG).setMesh(e.v6.bigTriangle()).useProgram(e.jz.bigTriangleVert,g).setClearColor(0,0,0,1)}for(let e=0;e<3;e++){const o=1/Math.pow(1.2,e),i=0===e?t:b.read.texture;L.bindFrameBuffer(b.write).bindTexture("uMap",i,0).uniform("uDirection",[1,0]).uniform("uResolution",[n*o,r*o]).draw(),b.swap(),L.bindFrameBuffer(b.write).bindTexture("uMap",b.read.texture,0).uniform("uDirection",[0,1]).uniform("uResolution",[n*o,r*o]).draw(),b.swap()}return b.read.texture}(this._fboRender.texture);const{near:t,far:n}=this.camera;let r=(this.orbitalControl.radius.value+3.8-t)/(n-t);this._drawCompose.bindFrameBuffer(this._fboCompose).bindTexture("uMap",this._fboRender.texture,0).bindTexture("uBlurMap",this._textureBlurredRender,1).bindTexture("uDepthMap",this._fboRender.depthTexture,2).bindTexture("uNoiseMap",this._textureNoise,3).bindTexture("uLookupMap",this._textureLookup,4).uniform("uFocus",r).uniform("uRatio",e.GL.aspectRatio).uniform("uNear",this.camera.near).uniform("uFar",this.camera.far).draw(),this._drawFxaa.bindTexture("uMap",this._fboCompose.texture,0).uniform("rtWidth",e.GL.width).uniform("rtHeight",e.GL.height).draw()}e.GL.disable(e.GL.DEPTH_TEST)}resize(){const{innerWidth:t,innerHeight:n}=window;e.GL.setSize(1.5*t,1.5*n),this.camera?.setAspectRatio?.(e.GL.aspectRatio),this._fboRender=new e.uL(e.GL.width,e.GL.height),this._fboCompose=new e.uL(e.GL.width,e.GL.height)}}const P=N,I=[{id:"color0",url:"assets/color0.jpg",type:"jpg"},{id:"color1",url:"assets/color1.jpg",type:"jpg"},{id:"color2",url:"assets/color2.jpg",type:"jpg"},{id:"color3",url:"assets/color3.jpg",type:"jpg"},{id:"color4",url:"assets/color4.jpg",type:"jpg"},{id:"color5",url:"assets/color5.jpg",type:"jpg"},{id:"lookup",url:"assets/lookup.png",type:"png"}];var y=o(370),w=o.n(y);let O,F;String.prototype.replaceAll=function(t,e){return this.replace(new RegExp(t,"g"),e)},window.addEventListener("keydown",(t=>{if(83===t.keyCode&&(t.metaKey||t.ctrlKey)){t.preventDefault();const e=(()=>{const t=new Date;return`${t.getFullYear()}.${t.getMonth()+1}.${t.getDate()}-${t.getHours()}.${t.getMinutes()}.${t.getSeconds()}`})();((t,e)=>{var n=document.createElement("a"),r=(t=>{for(var e=t.split(","),n=e[0].match(/:(.*?);/)[1],r=atob(e[1]),o=r.length,i=new Uint8Array(o);o--;)i[o]=r.charCodeAt(o);return new Blob([i],{type:n})})(t.toDataURL({format:"png",multiplier:4})),o=URL.createObjectURL(r);n.download=`${e}.png`,n.href=o,n.click()})(document.querySelector("#main-canvas"),e)}}));var U;new Promise(((t,e)=>{const n=document.body.querySelector(".Loading-Bar");console.log("Load Assets",I),I.length>0?(document.body.classList.add("isLoading"),new(w())({assets:I}).on("error",(t=>{console.log("Error :",t)})).on("progress",(t=>{n&&(n.style.width=100*t+"%")})).on("complete",(e=>{n&&(n.style.width="100%"),i(e),setTimeout((()=>{document.body.classList.remove("isLoading"),t(U)}),500)})).start()):t(U)})).then((function(){o.e(891).then(o.bind(o,891)).then((({default:n})=>{n.init(),e.GL.isMobile&&(t.Z.numParticles=64,t.Z.numSets=4,t.Z.usePostEffect=!0,n.refresh()),F=document.createElement("canvas"),F.id="main-canvas",document.body.appendChild(F),e.GL.init(F,{alpha:!1,preserveDrawingBuffer:!0}),document.addEventListener("keydown",(function(t){"f"===t.key&&(document.fullscreenElement?document.exitFullscreen():F.requestFullscreen())})),O=new P,Promise.all([o.e(296),o.e(437)]).then(o.bind(o,824)).then((({default:t})=>{t(O)}))}))}),n.H)})()})(); \ No newline at end of file diff --git a/experiments/ribbon01/src/SceneApp.js b/experiments/ribbon01/src/SceneApp.js index 61733138..78b6a232 100644 --- a/experiments/ribbon01/src/SceneApp.js +++ b/experiments/ribbon01/src/SceneApp.js @@ -156,7 +156,7 @@ class SceneApp extends Scene { this.lengthScale.value = 1.0; }, 2200 + delay); - setTimeout(() => this.pulse(), 2500 + delay); + setTimeout(() => this.pulse(), 3000 + delay); } _initTextures() { @@ -245,7 +245,7 @@ class SceneApp extends Scene { } _initHit() { - const r = 12.5; + const r = 15; const mesh = Geom.plane(r, r / GL.aspectRatio, 1); // this._hitTestor = new HitTestor(Geom.sphere(3, 24), this.camera); this._hitTestor = new HitTestor(mesh, this.camera); diff --git a/experiments/ribbon01/src/shaders/sim.frag b/experiments/ribbon01/src/shaders/sim.frag index d34eb762..8b00c248 100644 --- a/experiments/ribbon01/src/shaders/sim.frag +++ b/experiments/ribbon01/src/shaders/sim.frag @@ -65,13 +65,16 @@ void main(void) { // repel to touch d = distance(pos, uTouch); - f = smoothstep(5.0, 3.0, d); + f = smoothstep(6.0, 3.0, d); dir = normalize(pos - uTouch); - float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.1; + float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.2; t = sin(t * PI); t = smoothstep(-0.5, 1.0, t); - acc -= dir * f * 4.0/uSpeed * t; + // acc -= dir * f * 6.0/uSpeed * t * step(uSpeed, 2.0); + float fSpeed = smoothstep(4.0, 1.0, uSpeed); + fSpeed = mix(0.2, 1.0, fSpeed); + acc -= dir * f * 4.0/uSpeed * t * fSpeed; float speed = mix(2.0, 3.0, extra.x); // float speed = mix(2.0, 4.0, extra.x);