mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-04 13:00:36 +00:00
52 lines
No EOL
475 KiB
JavaScript
52 lines
No EOL
475 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,79474,(t,e,i)=>{"use strict";var s=t.r(71645).__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;i.c=function(t){return s.H.useMemoCache(t)}},932,(t,e,i)=>{"use strict";e.exports=t.r(79474)},90072,t=>{"use strict";let e,i,s,r,n,a,o,h,l,u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},c={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p="attached",d="detached",m="srgb",f="srgb-linear",g="linear",y="srgb",x={COMPUTE:"compute",RENDER:"render"},b={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},v={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};function w(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}let M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function S(t,e){return new M[t](e)}function A(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function C(){let t=_("canvas");return t.style.display="block",t}let T={},I=null;function z(t){I=t}function k(){return I}function B(...t){let e="THREE."+t.shift();I?I("log",e,...t):console.log(e,...t)}function R(...t){let e="THREE."+t.shift();I?I("warn",e,...t):console.warn(e,...t)}function O(...t){let e="THREE."+t.shift();I?I("error",e,...t):console.error(e,...t)}function E(...t){let e=t.join(" ");e in T||(T[e]=!0,R(...t))}function P(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}class L{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return void 0!==i&&void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){let i=this._listeners;if(void 0===i)return;let s=i[t];if(void 0!==s){let t=s.indexOf(e);-1!==t&&s.splice(t,1)}}dispatchEvent(t){let e=this._listeners;if(void 0===e)return;let i=e[t.type];if(void 0!==i){t.target=this;let e=i.slice(0);for(let i=0,s=e.length;i<s;i++)e[i].call(this,t);t.target=null}}}let N=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],F=1234567,$=Math.PI/180,V=180/Math.PI;function D(){let t=0xffffffff*Math.random()|0,e=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,s=0xffffffff*Math.random()|0;return(N[255&t]+N[t>>8&255]+N[t>>16&255]+N[t>>24&255]+"-"+N[255&e]+N[e>>8&255]+"-"+N[e>>16&15|64]+N[e>>24&255]+"-"+N[63&i|128]+N[i>>8&255]+"-"+N[i>>16&255]+N[i>>24&255]+N[255&s]+N[s>>8&255]+N[s>>16&255]+N[s>>24&255]).toLowerCase()}function j(t,e,i){return Math.max(e,Math.min(i,t))}function U(t,e){return(t%e+e)%e}function W(t,e,i){return(1-i)*t+i*e}function G(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/0xffffffff;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/0x7fffffff,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw Error("Invalid component type.")}}function q(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(0xffffffff*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(0x7fffffff*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw Error("Invalid component type.")}}let H={DEG2RAD:$,RAD2DEG:V,generateUUID:D,clamp:j,euclideanModulo:U,mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:W,damp:function(t,e,i,s){return W(t,e,1-Math.exp(-i*s))},pingpong:function(t,e=1){return e-Math.abs(U(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(F=t);let e=F+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000},degToRad:function(t){return t*$},radToDeg:function(t){return t*V},isPowerOfTwo:function(t){return(t&t-1)==0&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,s,r){let n=Math.cos,a=Math.sin,o=n(i/2),h=a(i/2),l=n((e+s)/2),u=a((e+s)/2),c=n((e-s)/2),p=a((e-s)/2),d=n((s-e)/2),m=a((s-e)/2);switch(r){case"XYX":t.set(o*u,h*c,h*p,o*l);break;case"YZY":t.set(h*p,o*u,h*c,o*l);break;case"ZXZ":t.set(h*c,h*p,o*u,o*l);break;case"XZX":t.set(o*u,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*u,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*u,o*l);break;default:R("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:q,denormalize:G};class J{constructor(t=0,e=0){J.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class X{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let o=i[s+0],h=i[s+1],l=i[s+2],u=i[s+3],c=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0){t[e+0]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u;return}if(a>=1){t[e+0]=c,t[e+1]=p,t[e+2]=d,t[e+3]=m;return}if(u!==m||o!==c||h!==p||l!==d){let t=o*c+h*p+l*d+u*m;t<0&&(c=-c,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){let i=Math.acos(t),s=Math.sin(i);o=o*(e=Math.sin(e*i)/s)+c*(a=Math.sin(a*i)/s),h=h*e+p*a,l=l*e+d*a,u=u*e+m*a}else{let t=1/Math.sqrt((o=o*e+c*a)*o+(h=h*e+p*a)*h+(l=l*e+d*a)*l+(u=u*e+m*a)*u);o*=t,h*=t,l*=t,u*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){let a=i[s],o=i[s+1],h=i[s+2],l=i[s+3],u=r[n],c=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*u+o*p-h*c,t[e+1]=o*d+l*c+h*u-a*p,t[e+2]=h*d+l*p+a*c-o*u,t[e+3]=l*d-a*u-o*c-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),l=a(s/2),u=a(r/2),c=o(i/2),p=o(s/2),d=o(r/2);switch(n){case"XYZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"YXZ":this._x=c*l*u+h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"ZXY":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u-c*p*d;break;case"ZYX":this._x=c*l*u-h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u+c*p*d;break;case"YZX":this._x=c*l*u+h*p*d,this._y=h*p*u+c*l*d,this._z=h*l*d-c*p*u,this._w=h*l*u-c*p*d;break;case"XZY":this._x=c*l*u-h*p*d,this._y=h*p*u-c*l*d,this._z=h*l*d+c*p*u,this._w=h*l*u+c*p*d;break;default:R("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){let t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-s)*t}else if(i>a&&i>u){let t=2*Math.sqrt(1+i-a-u);this._w=(l-o)/t,this._x=.25*t,this._y=(s+n)/t,this._z=(r+h)/t}else if(a>u){let t=2*Math.sqrt(1+a-i-u);this._w=(r-h)/t,this._x=(s+n)/t,this._y=.25*t,this._z=(o+l)/t}else{let t=2*Math.sqrt(1+u-i-a);this._w=(n-s)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=i,this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(j(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(0===i)return this;let s=Math.min(1,e/i);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=i*l+n*a+s*h-r*o,this._y=s*l+n*o+r*a-i*h,this._z=r*l+n*h+i*o-s*a,this._w=n*l-i*a-s*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let i=t._x,s=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){let t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(t=0,e=0,i=0){Z.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Q.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Q.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*s-a*i),l=2*(a*e-r*s),u=2*(r*i-n*e);return this.x=e+o*h+n*u-a*l,this.y=i+o*l+a*h-r*u,this.z=s+o*u+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=s*o-r*a,this.y=r*n-i*o,this.z=i*a-s*n,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Y.copy(this).projectOnVector(t),this.sub(Y)}reflect(t){return this.sub(Y.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());return 0===e?Math.PI/2:Math.acos(j(this.dot(t)/e,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let Y=new Z,Q=new X;class K{constructor(t,e,i,s,r,n,a,o,h){K.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h)}set(t,e,i,s,r,n,a,o,h){let l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=i,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],l=i[4],u=i[7],c=i[2],p=i[5],d=i[8],m=s[0],f=s[3],g=s[6],y=s[1],x=s[4],b=s[7],v=s[2],w=s[5],M=s[8];return r[0]=n*m+a*y+o*v,r[3]=n*f+a*x+o*w,r[6]=n*g+a*b+o*M,r[1]=h*m+l*y+u*v,r[4]=h*f+l*x+u*w,r[7]=h*g+l*b+u*M,r[2]=c*m+p*y+d*v,r[5]=c*f+p*x+d*w,r[8]=c*g+p*b+d*M,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-i*r*l+i*a*o+s*r*h-s*n*o}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=l*n-a*h,c=a*o-l*r,p=h*r-n*o,d=e*u+i*c+s*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return t[0]=u*m,t[1]=(s*h-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=c*m,t[4]=(l*e-s*o)*m,t[5]=(s*r-a*e)*m,t[6]=p*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return 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],this}setUvTransform(t,e,i,s,r,n,a){let o=Math.cos(r),h=Math.sin(r);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-s*h,s*o,-s*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(tt.makeScale(t,e)),this}rotate(t){return this.premultiply(tt.makeRotation(-t)),this}translate(t,e){return this.premultiply(tt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}let tt=new K,te=new K().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ti=new K().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ts=(o=[.64,.33,.3,.6,.15,.06],h=[.2126,.7152,.0722],l=[.3127,.329],(a={enabled:!0,workingColorSpace:f,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i&&(this.spaces[e].transfer===y&&(t.r=tr(t.r),t.g=tr(t.g),t.b=tr(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===y&&(t.r=tn(t.r),t.g=tn(t.g),t.b=tn(t.b))),t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?g:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,e){return E("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(t,e)},toWorkingColorSpace:function(t,e){return E("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(t,e)}}).define({[f]:{primaries:o,whitePoint:l,transfer:g,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,workingColorSpaceConfig:{unpackColorSpace:m},outputColorSpaceConfig:{drawingBufferColorSpace:m}},[m]:{primaries:o,whitePoint:l,transfer:y,toXYZ:te,fromXYZ:ti,luminanceCoefficients:h,outputColorSpaceConfig:{drawingBufferColorSpace:m}}}),a);function tr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function tn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ta{static getDataURL(t,i="image/png"){let s;if(/^data:/i.test(t.src)||"u"<typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)s=t;else{void 0===e&&(e=_("canvas")),e.width=t.width,e.height=t.height;let i=e.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),s=e}return s.toDataURL(i)}static sRGBToLinear(t){if("u">typeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap){let e=_("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let t=0;t<r.length;t++)r[t]=255*tr(r[t]/255);return i.putImageData(s,0,0),e}if(!t.data)return R("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t;{let e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*tr(e[t]/255)):e[t]=tr(e[t]);return{data:e,width:t.width,height:t.height}}}}let to=0;class th{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:to++}),this.uuid=D(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return"u">typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"u">typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(null!==s){let t;if(Array.isArray(s)){t=[];for(let e=0,i=s.length;e<i;e++)s[e].isDataTexture?t.push(tl(s[e].image)):t.push(tl(s[e]))}else t=tl(s);i.url=t}return e||(t.images[this.uuid]=i),i}}function tl(t){return"u">typeof HTMLImageElement&&t instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&t instanceof ImageBitmap?ta.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(R("Texture: Unable to serialize Texture."),{})}let tu=0,tc=new Z;class tp extends L{constructor(t=tp.DEFAULT_IMAGE,e=tp.DEFAULT_MAPPING,i=1001,s=1001,r=1006,n=1008,a=1023,o=1009,h=tp.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tu++}),this.uuid=D(),this.name="",this.source=new th(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new K,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!t&&!!t.depth&&t.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(tc).x}get height(){return this.source.getSize(tc).y}get depth(){return this.source.getSize(tc).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(void 0===i){R(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}tp.DEFAULT_IMAGE=null,tp.DEFAULT_MAPPING=300,tp.DEFAULT_ANISOTROPY=1;class td{constructor(t=0,e=0,i=0,s=1){td.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,r,n=t.elements,a=n[0],o=n[4],h=n[8],l=n[1],u=n[5],c=n[9],p=n[2],d=n[6],m=n[10];if(.01>Math.abs(o-l)&&.01>Math.abs(h-p)&&.01>Math.abs(c-d)){if(.1>Math.abs(o+l)&&.1>Math.abs(h+p)&&.1>Math.abs(c+d)&&.1>Math.abs(a+u+m-3))return this.set(1,0,0,0),this;e=Math.PI;let t=(a+1)/2,n=(u+1)/2,f=(m+1)/2,g=(o+l)/4,y=(h+p)/4,x=(c+d)/4;return t>n&&t>f?t<.01?(i=0,s=.707106781,r=.707106781):(s=g/(i=Math.sqrt(t)),r=y/i):n>f?n<.01?(i=.707106781,s=0,r=.707106781):(i=g/(s=Math.sqrt(n)),r=x/s):f<.01?(i=.707106781,s=.707106781,r=0):(i=y/(r=Math.sqrt(f)),s=x/r),this.set(i,s,r,e),this}let f=Math.sqrt((d-c)*(d-c)+(h-p)*(h-p)+(l-o)*(l-o));return .001>Math.abs(f)&&(f=1),this.x=(d-c)/f,this.y=(h-p)/f,this.z=(l-o)/f,this.w=Math.acos((a+u+m-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=j(this.x,t.x,e.x),this.y=j(this.y,t.y,e.y),this.z=j(this.z,t.z,e.z),this.w=j(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=j(this.x,t,e),this.y=j(this.y,t,e),this.z=j(this.z,t,e),this.w=j(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(j(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class tm extends L{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new td(0,0,t,e),this.scissorTest=!1,this.viewport=new td(0,0,t,e);const s=new tp({width:t,height:e,depth:i.depth});this.textures=[];const r=i.count;for(let t=0;t<r;t++)this.textures[t]=s.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(t={}){let e={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let t=0;t<this.textures.length;t++)this.textures[t].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i,!0!==this.textures[s].isData3DTexture&&(this.textures[s].isArrayTexture=this.textures[s].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let i=Object.assign({},t.textures[e].image);this.textures[e].source=new th(i)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tf extends tm{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class tg extends tp{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ty extends tf{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new tg(null,t,e,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class tx extends tp{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class tb extends tf{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new tx(null,t,e,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class tv{constructor(t=new Z(Infinity,Infinity,Infinity),e=new Z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(tM.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(tM.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=tM.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(void 0!==i){let s=i.getAttribute("position");if(!0===e&&void 0!==s&&!0!==t.isInstancedMesh)for(let e=0,i=s.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,tM):tM.fromBufferAttribute(s,e),tM.applyMatrix4(t.matrixWorld),this.expandByPoint(tM);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),tS.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),tS.copy(i.boundingBox)),tS.applyMatrix4(t.matrixWorld),this.union(tS)}let s=t.children;for(let t=0,i=s.length;t<i;t++)this.expandByObject(s[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tM),tM.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(tk),tB.subVectors(this.max,tk),tA.subVectors(t.a,tk),t_.subVectors(t.b,tk),tC.subVectors(t.c,tk),tT.subVectors(t_,tA),tI.subVectors(tC,t_),tz.subVectors(tA,tC);let e=[0,-tT.z,tT.y,0,-tI.z,tI.y,0,-tz.z,tz.y,tT.z,0,-tT.x,tI.z,0,-tI.x,tz.z,0,-tz.x,-tT.y,tT.x,0,-tI.y,tI.x,0,-tz.y,tz.x,0];return!!tE(e,tA,t_,tC,tB)&&!!tE(e=[1,0,0,0,1,0,0,0,1],tA,t_,tC,tB)&&(tR.crossVectors(tT,tI),tE(e=[tR.x,tR.y,tR.z],tA,t_,tC,tB))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tM).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tM).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(tw[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),tw[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),tw[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),tw[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),tw[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),tw[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),tw[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),tw[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(tw)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}let tw=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tM=new Z,tS=new tv,tA=new Z,t_=new Z,tC=new Z,tT=new Z,tI=new Z,tz=new Z,tk=new Z,tB=new Z,tR=new Z,tO=new Z;function tE(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){tO.fromArray(t,n);let a=r.x*Math.abs(tO.x)+r.y*Math.abs(tO.y)+r.z*Math.abs(tO.z),o=e.dot(tO),h=i.dot(tO),l=s.dot(tO);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}let tP=new tv,tL=new Z,tN=new Z;class tF{constructor(t=new Z,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;void 0!==e?i.copy(e):tP.setFromPoints(t).getCenter(i);let s=0;for(let e=0,r=t.length;e<r;e++)s=Math.max(s,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;tL.subVectors(t,this.center);let e=tL.lengthSq();if(e>this.radius*this.radius){let t=Math.sqrt(e),i=(t-this.radius)*.5;this.center.addScaledVector(tL,i/t),this.radius+=i}return this}union(t){return t.isEmpty()||(this.isEmpty()?this.copy(t):!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(tN.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(tL.copy(t.center).add(tN)),this.expandByPoint(tL.copy(t.center).sub(tN)))),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let t$=new Z,tV=new Z,tD=new Z,tj=new Z,tU=new Z,tW=new Z,tG=new Z;class tq{constructor(t=new Z,e=new Z(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,t$)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=t$.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(t$.copy(this.origin).addScaledVector(this.direction,e),t$.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){let r,n,a,o;tV.copy(t).add(e).multiplyScalar(.5),tD.copy(e).sub(t).normalize(),tj.copy(this.origin).sub(tV);let h=.5*t.distanceTo(e),l=-this.direction.dot(tD),u=tj.dot(this.direction),c=-tj.dot(tD),p=tj.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(r=l*c-u,n=l*u-c,o=h*d,r>=0)if(n>=-o)if(n<=o){let t=1/d;r*=t,n*=t,a=r*(r+l*n+2*u)+n*(l*r+n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=h)+u)))*r+n*(n+2*c)+p;else a=-(r=Math.max(0,-(l*(n=-h)+u)))*r+n*(n+2*c)+p;else n<=-o?(n=(r=Math.max(0,-(-l*h+u)))>0?-h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p):n<=o?(r=0,a=(n=Math.min(Math.max(-h,-c),h))*(n+2*c)+p):(n=(r=Math.max(0,-(l*h+u)))>0?h:Math.min(Math.max(-h,-c),h),a=-r*r+n*(n+2*c)+p);else n=l>0?-h:h,a=-(r=Math.max(0,-(l*n+u)))*r+n*(n+2*c)+p;return i&&i.copy(this.origin).addScaledVector(this.direction,r),s&&s.copy(tV).addScaledVector(tD,n),a}intersectSphere(t,e){t$.subVectors(t.center,this.origin);let i=t$.dot(this.direction),s=t$.dot(t$)-i*i,r=t.radius*t.radius;if(s>r)return null;let n=Math.sqrt(r-s),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return!!(0===e||t.normal.dot(this.direction)*e<0)}intersectBox(t,e){let i,s,r,n,a,o,h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(h>=0?(i=(t.min.x-c.x)*h,s=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,s=(t.min.x-c.x)*h),l>=0?(r=(t.min.y-c.y)*l,n=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,n=(t.min.y-c.y)*l),i>n||r>s||((r>i||isNaN(i))&&(i=r),(n<s||isNaN(s))&&(s=n),u>=0?(a=(t.min.z-c.z)*u,o=(t.max.z-c.z)*u):(a=(t.max.z-c.z)*u,o=(t.min.z-c.z)*u),i>o||a>s||((a>i||i!=i)&&(i=a),(o<s||s!=s)&&(s=o),s<0)))?null:this.at(i>=0?i:s,e)}intersectsBox(t){return null!==this.intersectBox(t,t$)}intersectTriangle(t,e,i,s,r){let n;tU.subVectors(e,t),tW.subVectors(i,t),tG.crossVectors(tU,tW);let a=this.direction.dot(tG);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}tj.subVectors(this.origin,t);let o=n*this.direction.dot(tW.crossVectors(tj,tW));if(o<0)return null;let h=n*this.direction.dot(tU.cross(tj));if(h<0||o+h>a)return null;let l=-n*tj.dot(tG);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class tH{constructor(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){tH.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f)}set(t,e,i,s,r,n,a,o,h,l,u,c,p,d,m,f){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=s,g[1]=r,g[5]=n,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=u,g[14]=c,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new tH().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1)):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();let e=this.elements,i=t.elements,s=1/tJ.setFromMatrixColumn(t,0).length(),r=1/tJ.setFromMatrixColumn(t,1).length(),n=1/tJ.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(s),h=Math.sin(s),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=-o*u,e[8]=h,e[1]=i+s*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=s+i*h,e[10]=n*o}else if("YXZ"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t+r*a,e[4]=s*a-i,e[8]=n*h,e[1]=n*u,e[5]=n*l,e[9]=-a,e[2]=i*a-s,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){let t=o*l,i=o*u,s=h*l,r=h*u;e[0]=t-r*a,e[4]=-n*u,e[8]=s+i*a,e[1]=i+s*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){let t=n*l,i=n*u,s=a*l,r=a*u;e[0]=o*l,e[4]=s*h-i,e[8]=t*h+r,e[1]=o*u,e[5]=r*h+t,e[9]=i*h-s,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=r-t*u,e[8]=s*u+i,e[1]=u,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=i*u+s,e[10]=t-r*u}else if("XZY"===t.order){let t=n*o,i=n*h,s=a*o,r=a*h;e[0]=o*l,e[4]=-u,e[8]=h*l,e[1]=t*u+r,e[5]=n*l,e[9]=i*u-s,e[2]=s*u-i,e[6]=a*l,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(tZ,t,tY)}lookAt(t,e,i){let s=this.elements;return t0.subVectors(t,e),0===t0.lengthSq()&&(t0.z=1),t0.normalize(),tQ.crossVectors(i,t0),0===tQ.lengthSq()&&(1===Math.abs(i.z)?t0.x+=1e-4:t0.z+=1e-4,t0.normalize(),tQ.crossVectors(i,t0)),tQ.normalize(),tK.crossVectors(t0,tQ),s[0]=tQ.x,s[4]=tK.x,s[8]=t0.x,s[1]=tQ.y,s[5]=tK.y,s[9]=t0.y,s[2]=tQ.z,s[6]=tK.z,s[10]=t0.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[4],o=i[8],h=i[12],l=i[1],u=i[5],c=i[9],p=i[13],d=i[2],m=i[6],f=i[10],g=i[14],y=i[3],x=i[7],b=i[11],v=i[15],w=s[0],M=s[4],S=s[8],A=s[12],_=s[1],C=s[5],T=s[9],I=s[13],z=s[2],k=s[6],B=s[10],R=s[14],O=s[3],E=s[7],P=s[11],L=s[15];return r[0]=n*w+a*_+o*z+h*O,r[4]=n*M+a*C+o*k+h*E,r[8]=n*S+a*T+o*B+h*P,r[12]=n*A+a*I+o*R+h*L,r[1]=l*w+u*_+c*z+p*O,r[5]=l*M+u*C+c*k+p*E,r[9]=l*S+u*T+c*B+p*P,r[13]=l*A+u*I+c*R+p*L,r[2]=d*w+m*_+f*z+g*O,r[6]=d*M+m*C+f*k+g*E,r[10]=d*S+m*T+f*B+g*P,r[14]=d*A+m*I+f*R+g*L,r[3]=y*w+x*_+b*z+v*O,r[7]=y*M+x*C+b*k+v*E,r[11]=y*S+x*T+b*B+v*P,r[15]=y*A+x*I+b*R+v*L,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],u=t[6],c=t[10],p=t[14],d=t[3],m=t[7],f=t[11],g=t[15],y=o*p-h*c,x=a*p-h*u,b=a*c-o*u,v=n*p-h*l,w=n*c-o*l,M=n*u-a*l;return e*(m*y-f*x+g*b)-i*(d*y-f*v+g*w)+s*(d*x-m*v+g*M)-r*(d*b-m*w+f*M)}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],y=u*f*h-m*c*h+m*o*p-a*f*p-u*o*g+a*c*g,x=d*c*h-l*f*h-d*o*p+n*f*p+l*o*g-n*c*g,b=l*m*h-d*u*h+d*a*p-n*m*p-l*a*g+n*u*g,v=d*u*o-l*m*o-d*a*c+n*m*c+l*a*f-n*u*f,w=e*y+i*x+s*b+r*v;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let M=1/w;return t[0]=y*M,t[1]=(m*c*r-u*f*r-m*s*p+i*f*p+u*s*g-i*c*g)*M,t[2]=(a*f*r-m*o*r+m*s*h-i*f*h-a*s*g+i*o*g)*M,t[3]=(u*o*r-a*c*r-u*s*h+i*c*h+a*s*p-i*o*p)*M,t[4]=x*M,t[5]=(l*f*r-d*c*r+d*s*p-e*f*p-l*s*g+e*c*g)*M,t[6]=(d*o*r-n*f*r-d*s*h+e*f*h+n*s*g-e*o*g)*M,t[7]=(n*c*r-l*o*r+l*s*h-e*c*h-n*s*p+e*o*p)*M,t[8]=b*M,t[9]=(d*u*r-l*m*r-d*i*p+e*m*p+l*i*g-e*u*g)*M,t[10]=(n*m*r-d*a*r+d*i*h-e*m*h-n*i*g+e*a*g)*M,t[11]=(l*a*r-n*u*r-l*i*h+e*u*h+n*i*p-e*a*p)*M,t[12]=v*M,t[13]=(l*m*s-d*u*s+d*i*c-e*m*c-l*i*f+e*u*f)*M,t[14]=(d*a*s-n*m*s-d*i*o+e*m*o+n*i*f-e*a*f)*M,t[15]=(n*u*s-l*a*s+l*i*o-e*u*o-n*i*c+e*a*c)*M,this}scale(t){let e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements;return Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1]+t[2]*t[2],t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t[8]*t[8]+t[9]*t[9]+t[10]*t[10]))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+i,h*a-s*o,h*o+s*a,0,h*a+s*o,l*a+i,l*o-s*n,0,h*o-s*a,l*o+s*n,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,u=a+a,c=r*h,p=r*l,d=r*u,m=n*l,f=n*u,g=a*u,y=o*h,x=o*l,b=o*u,v=i.x,w=i.y,M=i.z;return s[0]=(1-(m+g))*v,s[1]=(p+b)*v,s[2]=(d-x)*v,s[3]=0,s[4]=(p-b)*w,s[5]=(1-(c+g))*w,s[6]=(f+y)*w,s[7]=0,s[8]=(d+x)*M,s[9]=(f-y)*M,s[10]=(1-(c+m))*M,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],0===this.determinant())return i.set(1,1,1),e.identity(),this;let r=tJ.set(s[0],s[1],s[2]).length(),n=tJ.set(s[4],s[5],s[6]).length(),a=tJ.set(s[8],s[9],s[10]).length();0>this.determinant()&&(r=-r),tX.copy(this);let o=1/r,h=1/n,l=1/a;return tX.elements[0]*=o,tX.elements[1]*=o,tX.elements[2]*=o,tX.elements[4]*=h,tX.elements[5]*=h,tX.elements[6]*=h,tX.elements[8]*=l,tX.elements[9]*=l,tX.elements[10]*=l,e.setFromRotationMatrix(tX),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=r/(n-r),l=n*r/(n-r);else if(2e3===a)h=-(n+r)/(n-r),l=-2*n*r/(n-r);else if(2001===a)h=-n/(n-r),l=-n*r/(n-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return u[0]=2*r/(e-t),u[4]=0,u[8]=(e+t)/(e-t),u[12]=0,u[1]=0,u[5]=2*r/(i-s),u[9]=(i+s)/(i-s),u[13]=0,u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=2e3,o=!1){let h,l,u=this.elements;if(o)h=1/(n-r),l=n/(n-r);else if(2e3===a)h=-2/(n-r),l=-(n+r)/(n-r);else if(2001===a)h=-1/(n-r),l=-r/(n-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return u[0]=2/(e-t),u[4]=0,u[8]=0,u[12]=-(e+t)/(e-t),u[1]=0,u[5]=2/(i-s),u[9]=0,u[13]=-(i+s)/(i-s),u[2]=0,u[6]=0,u[10]=h,u[14]=l,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let tJ=new Z,tX=new tH,tZ=new Z(0,0,0),tY=new Z(1,1,1),tQ=new Z,tK=new Z,t0=new Z,t1=new tH,t2=new X;class t3{constructor(t=0,e=0,i=0,s=t3.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let s=t.elements,r=s[0],n=s[4],a=s[8],o=s[1],h=s[5],l=s[9],u=s[2],c=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(j(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-j(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-j(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(j(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-j(n,-1,1)),.9999999>Math.abs(n)?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:R("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return t1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(t1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return t2.setFromEuler(this),this.setFromQuaternion(t2,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}t3.DEFAULT_ORDER="XYZ";class t5{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!=0}isEnabled(t){return(this.mask&1<<t)!=0}}let t4=0,t6=new Z,t8=new X,t9=new tH,t7=new Z,et=new Z,ee=new Z,ei=new X,es=new Z(1,0,0),er=new Z(0,1,0),en=new Z(0,0,1),ea={type:"added"},eo={type:"removed"},eh={type:"childadded",child:null},el={type:"childremoved",child:null};class eu extends L{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:t4++}),this.uuid=D(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=eu.DEFAULT_UP.clone();const t=new Z,e=new t3,i=new X,s=new Z(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new tH},normalMatrix:{value:new K}}),this.matrix=new tH,this.matrixWorld=new tH,this.matrixAutoUpdate=eu.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=eu.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new t5,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return t8.setFromAxisAngle(t,e),this.quaternion.multiply(t8),this}rotateOnWorldAxis(t,e){return t8.setFromAxisAngle(t,e),this.quaternion.premultiply(t8),this}rotateX(t){return this.rotateOnAxis(es,t)}rotateY(t){return this.rotateOnAxis(er,t)}rotateZ(t){return this.rotateOnAxis(en,t)}translateOnAxis(t,e){return t6.copy(t).applyQuaternion(this.quaternion),this.position.add(t6.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(es,t)}translateY(t){return this.translateOnAxis(er,t)}translateZ(t){return this.translateOnAxis(en,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(t9.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?t7.copy(t):t7.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),et.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?t9.lookAt(et,t7,this.up):t9.lookAt(t7,et,this.up),this.quaternion.setFromRotationMatrix(t9),s&&(t9.extractRotation(s.matrixWorld),t8.setFromRotationMatrix(t9),this.quaternion.premultiply(t8.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?O("Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ea),eh.child=t,this.dispatchEvent(eh),eh.child=null):O("Object3D.add: object not an instance of THREE.Object3D.",t),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}let e=this.children.indexOf(t);return -1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(eo),el.child=t,this.dispatchEvent(el),el.child=null),this}removeFromParent(){let t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),t9.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),t9.multiply(t.parent.matrixWorld)),t.applyMatrix4(t9),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ea),eh.child=t,this.dispatchEvent(eh),eh.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){let s=this.children[i].getObjectByProperty(t,e);if(void 0!==s)return s}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let s=this.children;for(let r=0,n=s.length;r<n;r++)s[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(et,t,ee),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(et,ei,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){let t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){let e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let s={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(t=>({...t})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(s.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){let i=e.shapes;if(Array.isArray(i))for(let e=0,s=i.length;e<s;e++){let s=i[e];r(t.shapes,s)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let e=[];for(let i=0,s=this.material.length;i<s;i++)e.push(r(t.materials,this.material[i]));s.material=e}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let e=0;e<this.children.length;e++)s.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let e=0;e<this.animations.length;e++){let i=this.animations[e];s.animations.push(r(t.animations,i))}}if(e){let e=n(t.geometries),s=n(t.materials),r=n(t.textures),a=n(t.images),o=n(t.shapes),h=n(t.skeletons),l=n(t.animations),u=n(t.nodes);e.length>0&&(i.geometries=e),s.length>0&&(i.materials=s),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),l.length>0&&(i.animations=l),u.length>0&&(i.nodes=u)}return i.object=s,i;function n(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){let i=t.children[e];this.add(i.clone())}return this}}eu.DEFAULT_UP=new Z(0,1,0),eu.DEFAULT_MATRIX_AUTO_UPDATE=!0,eu.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let ec=new Z,ep=new Z,ed=new Z,em=new Z,ef=new Z,eg=new Z,ey=new Z,ex=new Z,eb=new Z,ev=new Z,ew=new td,eM=new td,eS=new td;class eA{constructor(t=new Z,e=new Z,i=new Z){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),ec.subVectors(t,e),s.cross(ec);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){ec.subVectors(s,e),ep.subVectors(i,e),ed.subVectors(t,e);let n=ec.dot(ec),a=ec.dot(ep),o=ec.dot(ed),h=ep.dot(ep),l=ep.dot(ed),u=n*h-a*a;if(0===u)return r.set(0,0,0),null;let c=1/u,p=(h*o-a*l)*c,d=(n*l-a*o)*c;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,em)&&em.x>=0&&em.y>=0&&em.x+em.y<=1}static getInterpolation(t,e,i,s,r,n,a,o){return null===this.getBarycoord(t,e,i,s,em)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,em.x),o.addScaledVector(n,em.y),o.addScaledVector(a,em.z),o)}static getInterpolatedAttribute(t,e,i,s,r,n){return ew.setScalar(0),eM.setScalar(0),eS.setScalar(0),ew.fromBufferAttribute(t,e),eM.fromBufferAttribute(t,i),eS.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(ew,r.x),n.addScaledVector(eM,r.y),n.addScaledVector(eS,r.z),n}static isFrontFacing(t,e,i,s){return ec.subVectors(i,e),ep.subVectors(t,e),0>ec.cross(ep).dot(s)}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ec.subVectors(this.c,this.b),ep.subVectors(this.a,this.b),.5*ec.cross(ep).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return eA.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return eA.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return eA.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return eA.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return eA.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,s,r=this.a,n=this.b,a=this.c;ef.subVectors(n,r),eg.subVectors(a,r),ex.subVectors(t,r);let o=ef.dot(ex),h=eg.dot(ex);if(o<=0&&h<=0)return e.copy(r);eb.subVectors(t,n);let l=ef.dot(eb),u=eg.dot(eb);if(l>=0&&u<=l)return e.copy(n);let c=o*u-l*h;if(c<=0&&o>=0&&l<=0)return i=o/(o-l),e.copy(r).addScaledVector(ef,i);ev.subVectors(t,a);let p=ef.dot(ev),d=eg.dot(ev);if(d>=0&&p<=d)return e.copy(a);let m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return s=h/(h-d),e.copy(r).addScaledVector(eg,s);let f=l*d-p*u;if(f<=0&&u-l>=0&&p-d>=0)return ey.subVectors(a,n),s=(u-l)/(u-l+(p-d)),e.copy(n).addScaledVector(ey,s);let g=1/(f+m+c);return i=m*g,s=c*g,e.copy(r).addScaledVector(ef,i).addScaledVector(eg,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let e_={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},eC={h:0,s:0,l:0},eT={h:0,s:0,l:0};function eI(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*6*(2/3-i):t}class ez{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){return void 0===e&&void 0===i?t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t):this.setRGB(t,e,i),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=m){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ts.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=ts.workingColorSpace){return this.r=t,this.g=e,this.b=i,ts.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=ts.workingColorSpace){if(t=U(t,1),e=j(e,0,1),i=j(i,0,1),0===e)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+e):i+e-i*e,r=2*i-s;this.r=eI(r,s,t+1/3),this.g=eI(r,s,t),this.b=eI(r,s,t-1/3)}return ts.colorSpaceToWorking(this,s),this}setStyle(t,e=m){let i;function s(e){void 0!==e&&1>parseFloat(e)&&R("Color: Alpha component of "+t+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:R("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);R("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=m){let i=e_[t.toLowerCase()];return void 0!==i?this.setHex(i,e):R("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=tr(t.r),this.g=tr(t.g),this.b=tr(t.b),this}copyLinearToSRGB(t){return this.r=tn(t.r),this.g=tn(t.g),this.b=tn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=m){return ts.workingToColorSpace(ek.copy(this),t),65536*Math.round(j(255*ek.r,0,255))+256*Math.round(j(255*ek.g,0,255))+Math.round(j(255*ek.b,0,255))}getHexString(t=m){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ts.workingColorSpace){let i,s;ts.workingToColorSpace(ek.copy(this),e);let r=ek.r,n=ek.g,a=ek.b,o=Math.max(r,n,a),h=Math.min(r,n,a),l=(h+o)/2;if(h===o)i=0,s=0;else{let t=o-h;switch(s=l<=.5?t/(o+h):t/(2-o-h),o){case r:i=(n-a)/t+6*(n<a);break;case n:i=(a-r)/t+2;break;case a:i=(r-n)/t+4}i/=6}return t.h=i,t.s=s,t.l=l,t}getRGB(t,e=ts.workingColorSpace){return ts.workingToColorSpace(ek.copy(this),e),t.r=ek.r,t.g=ek.g,t.b=ek.b,t}getStyle(t=m){ts.workingToColorSpace(ek.copy(this),t);let e=ek.r,i=ek.g,s=ek.b;return t!==m?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)})`}offsetHSL(t,e,i){return this.getHSL(eC),this.setHSL(eC.h+t,eC.s+e,eC.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(eC),t.getHSL(eT);let i=W(eC.h,eT.h,e),s=W(eC.s,eT.s,e),r=W(eC.l,eT.l,e);return this.setHSL(i,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*s,this.g=r[1]*e+r[4]*i+r[7]*s,this.b=r[2]*e+r[5]*i+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let ek=new ez;ez.NAMES=e_;let eB=0;class eR extends L{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eB++}),this.uuid=D(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ez(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i){R(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){R(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function s(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let e=s(t.textures),r=s(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(null!==e){let t=e.length;i=Array(t);for(let s=0;s!==t;++s)i[s]=e[s].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class eO extends eR{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}let eE=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),s=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){let e=t-127;e<-27?(s[t]=0,s[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(s[t]=1024>>-e-14,s[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(s[t]=e+15<<10,s[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(s[t]=31744,s[256|t]=64512,r[t]=24,r[256|t]=24):(s[t]=31744,s[256|t]=64512,r[t]=13,r[256|t]=13)}let n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;(8388608&e)==0;)e<<=1,i-=8388608;e&=-8388609,i+=0x38800000,n[t]=e|i}for(let t=1024;t<2048;++t)n[t]=0x38000000+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=0x47800000,a[32]=0x80000000;for(let t=33;t<63;++t)a[t]=0x80000000+(t-32<<23);a[63]=0xc7800000;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:s,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}();function eP(t){Math.abs(t)>65504&&R("DataUtils.toHalfFloat(): Value out of range."),t=j(t,-65504,65504),eE.floatView[0]=t;let e=eE.uint32View[0],i=e>>23&511;return eE.baseTable[i]+((8388607&e)>>eE.shiftTable[i])}function eL(t){let e=t>>10;return eE.uint32View[0]=eE.mantissaTable[eE.offsetTable[e]+(1023&t)]+eE.exponentTable[e],eE.floatView[0]}class eN{static toHalfFloat(t){return eP(t)}static fromHalfFloat(t){return eL(t)}}let eF=new Z,e$=new J,eV=0;class eD{constructor(t,e,i=!1){if(Array.isArray(t))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:eV++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)e$.fromBufferAttribute(this,e),e$.applyMatrix3(t),this.setXY(e,e$.x,e$.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)eF.fromBufferAttribute(this,e),eF.applyMatrix3(t),this.setXYZ(e,eF.x,eF.y,eF.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)eF.fromBufferAttribute(this,e),eF.applyMatrix4(t),this.setXYZ(e,eF.x,eF.y,eF.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)eF.fromBufferAttribute(this,e),eF.applyNormalMatrix(t),this.setXYZ(e,eF.x,eF.y,eF.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)eF.fromBufferAttribute(this,e),eF.transformDirection(t),this.setXYZ(e,eF.x,eF.y,eF.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=G(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=q(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=G(e,this.array)),e}setX(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=G(e,this.array)),e}setY(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=G(e,this.array)),e}setZ(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=G(e,this.array)),e}setW(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array),r=q(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class ej extends eD{constructor(t,e,i){super(new Int8Array(t),e,i)}}class eU extends eD{constructor(t,e,i){super(new Uint8Array(t),e,i)}}class eW extends eD{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}}class eG extends eD{constructor(t,e,i){super(new Int16Array(t),e,i)}}class eq extends eD{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class eH extends eD{constructor(t,e,i){super(new Int32Array(t),e,i)}}class eJ extends eD{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class eX extends eD{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=eL(this.array[t*this.itemSize]);return this.normalized&&(e=G(e,this.array)),e}setX(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize]=eP(e),this}getY(t){let e=eL(this.array[t*this.itemSize+1]);return this.normalized&&(e=G(e,this.array)),e}setY(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+1]=eP(e),this}getZ(t){let e=eL(this.array[t*this.itemSize+2]);return this.normalized&&(e=G(e,this.array)),e}setZ(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+2]=eP(e),this}getW(t){let e=eL(this.array[t*this.itemSize+3]);return this.normalized&&(e=G(e,this.array)),e}setW(t,e){return this.normalized&&(e=q(e,this.array)),this.array[t*this.itemSize+3]=eP(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array)),this.array[t+0]=eP(e),this.array[t+1]=eP(i),this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array)),this.array[t+0]=eP(e),this.array[t+1]=eP(i),this.array[t+2]=eP(s),this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array),r=q(r,this.array)),this.array[t+0]=eP(e),this.array[t+1]=eP(i),this.array[t+2]=eP(s),this.array[t+3]=eP(r),this}}class eZ extends eD{constructor(t,e,i){super(new Float32Array(t),e,i)}}let eY=0,eQ=new tH,eK=new eu,e0=new Z,e1=new tv,e2=new tv,e3=new Z;class e5 extends L{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:eY++}),this.uuid=D(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(w(t)?eJ:eq)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let e=new K().getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}let s=this.attributes.tangent;return void 0!==s&&(s.transformDirection(t),s.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return eQ.makeRotationFromQuaternion(t),this.applyMatrix4(eQ),this}rotateX(t){return eQ.makeRotationX(t),this.applyMatrix4(eQ),this}rotateY(t){return eQ.makeRotationY(t),this.applyMatrix4(eQ),this}rotateZ(t){return eQ.makeRotationZ(t),this.applyMatrix4(eQ),this}translate(t,e,i){return eQ.makeTranslation(t,e,i),this.applyMatrix4(eQ),this}scale(t,e,i){return eQ.makeScale(t,e,i),this.applyMatrix4(eQ),this}lookAt(t){return eK.lookAt(t),eK.updateMatrix(),this.applyMatrix4(eK.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(e0).negate(),this.translate(e0.x,e0.y,e0.z),this}setFromPoints(t){let e=this.getAttribute("position");if(void 0===e){let e=[];for(let i=0,s=t.length;i<s;i++){let s=t[i];e.push(s.x,s.y,s.z||0)}this.setAttribute("position",new eZ(e,3))}else{let i=Math.min(t.length,e.count);for(let s=0;s<i;s++){let i=t[s];e.setXYZ(s,i.x,i.y,i.z||0)}t.length>e.count&&R("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){O("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(Infinity,Infinity,Infinity));return}if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){let i=e[t];e1.setFromBufferAttribute(i),this.morphTargetsRelative?(e3.addVectors(this.boundingBox.min,e1.min),this.boundingBox.expandByPoint(e3),e3.addVectors(this.boundingBox.max,e1.max),this.boundingBox.expandByPoint(e3)):(this.boundingBox.expandByPoint(e1.min),this.boundingBox.expandByPoint(e1.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&O('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new tF);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){O("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Z,1/0);return}if(t){let i=this.boundingSphere.center;if(e1.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){let i=e[t];e2.setFromBufferAttribute(i),this.morphTargetsRelative?(e3.addVectors(e1.min,e2.min),e1.expandByPoint(e3),e3.addVectors(e1.max,e2.max),e1.expandByPoint(e3)):(e1.expandByPoint(e2.min),e1.expandByPoint(e2.max))}e1.getCenter(i);let s=0;for(let e=0,r=t.count;e<r;e++)e3.fromBufferAttribute(t,e),s=Math.max(s,i.distanceToSquared(e3));if(e)for(let r=0,n=e.length;r<n;r++){let n=e[r],a=this.morphTargetsRelative;for(let e=0,r=n.count;e<r;e++)e3.fromBufferAttribute(n,e),a&&(e0.fromBufferAttribute(t,e),e3.add(e0)),s=Math.max(s,i.distanceToSquared(e3))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&O('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void O("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=e.position,s=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new eD(new Float32Array(4*i.count),4));let n=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Z,o[t]=new Z;let h=new Z,l=new Z,u=new Z,c=new J,p=new J,d=new J,m=new Z,f=new Z,g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,s=g.length;e<s;++e){let s=g[e],n=s.start,y=s.count;for(let e=n,s=n+y;e<s;e+=3)!function(t,e,s){h.fromBufferAttribute(i,t),l.fromBufferAttribute(i,e),u.fromBufferAttribute(i,s),c.fromBufferAttribute(r,t),p.fromBufferAttribute(r,e),d.fromBufferAttribute(r,s),l.sub(h),u.sub(h),p.sub(c),d.sub(c);let n=1/(p.x*d.y-d.x*p.y);isFinite(n)&&(m.copy(l).multiplyScalar(d.y).addScaledVector(u,-p.y).multiplyScalar(n),f.copy(u).multiplyScalar(p.x).addScaledVector(l,-d.x).multiplyScalar(n),a[t].add(m),a[e].add(m),a[s].add(m),o[t].add(f),o[e].add(f),o[s].add(f))}(t.getX(e+0),t.getX(e+1),t.getX(e+2))}let y=new Z,x=new Z,b=new Z,v=new Z;function w(t){b.fromBufferAttribute(s,t),v.copy(b);let e=a[t];y.copy(e),y.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(v,e);let i=x.dot(o[t]);n.setXYZW(t,y.x,y.y,y.z,i<0?-1:1)}for(let e=0,i=g.length;e<i;++e){let i=g[e],s=i.start,r=i.count;for(let e=s,i=s+r;e<i;e+=3)w(t.getX(e+0)),w(t.getX(e+1)),w(t.getX(e+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new eD(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);let s=new Z,r=new Z,n=new Z,a=new Z,o=new Z,h=new Z,l=new Z,u=new Z;if(t)for(let c=0,p=t.count;c<p;c+=3){let p=t.getX(c+0),d=t.getX(c+1),m=t.getX(c+2);s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),n.fromBufferAttribute(e,m),l.subVectors(n,r),u.subVectors(s,r),l.cross(u),a.fromBufferAttribute(i,p),o.fromBufferAttribute(i,d),h.fromBufferAttribute(i,m),a.add(l),o.add(l),h.add(l),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(d,o.x,o.y,o.z),i.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)s.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),l.subVectors(n,r),u.subVectors(s,r),l.cross(u),i.setXYZ(t+0,l.x,l.y,l.z),i.setXYZ(t+1,l.x,l.y,l.z),i.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)e3.fromBufferAttribute(t,e),e3.normalize(),t.setXYZ(e,e3.x,e3.y,e3.z)}toNonIndexed(){function t(t,e){let i=t.array,s=t.itemSize,r=t.normalized,n=new i.constructor(e.length*s),a=0,o=0;for(let r=0,h=e.length;r<h;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*s;for(let t=0;t<s;t++)n[o++]=i[a++]}return new eD(n,s,r)}if(null===this.index)return R("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new e5,i=this.index.array,s=this.attributes;for(let r in s){let n=t(s[r],i);e.setAttribute(r,n)}let r=this.morphAttributes;for(let s in r){let n=[],a=r[s];for(let e=0,s=a.length;e<s;e++){let s=t(a[e],i);n.push(s)}e.morphAttributes[s]=n}e.morphTargetsRelative=this.morphTargetsRelative;let n=this.groups;for(let t=0,i=n.length;t<i;t++){let i=n[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let e in i){let s=i[e];t.data.attributes[e]=s.toJSON(t.data)}let s={},r=!1;for(let e in this.morphAttributes){let i=this.morphAttributes[e],n=[];for(let e=0,s=i.length;e<s;e++){let s=i[e];n.push(s.toJSON(t.data))}n.length>0&&(s[e]=n,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone());let s=t.attributes;for(let t in s){let i=s[t];this.setAttribute(t,i.clone(e))}let r=t.morphAttributes;for(let t in r){let i=[],s=r[t];for(let t=0,r=s.length;t<r;t++)i.push(s[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;let n=t.groups;for(let t=0,e=n.length;t<e;t++){let e=n[t];this.addGroup(e.start,e.count,e.materialIndex)}let a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());let o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let e4=new tH,e6=new tq,e8=new tF,e9=new Z,e7=new Z,it=new Z,ie=new Z,ii=new Z,is=new Z,ir=new Z,ia=new Z;class io extends eu{constructor(t=new e5,e=new eO){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){let e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){let i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(s,t);let a=this.morphTargetInfluences;if(r&&a){is.set(0,0,0);for(let i=0,s=r.length;i<s;i++){let s=a[i],o=r[i];0!==s&&(ii.fromBufferAttribute(o,t),n?is.addScaledVector(ii,s):is.addScaledVector(ii.sub(e),s))}e.add(is)}return e}raycast(t,e){let i=this.geometry,s=this.material,r=this.matrixWorld;void 0===s||(null===i.boundingSphere&&i.computeBoundingSphere(),e8.copy(i.boundingSphere),e8.applyMatrix4(r),e6.copy(t.ray).recast(t.near),!1===e8.containsPoint(e6.origin)&&(null===e6.intersectSphere(e8,e9)||e6.origin.distanceToSquared(e9)>(t.far-t.near)**2)||(e4.copy(r).invert(),e6.copy(t.ray).applyMatrix4(e4),(null===i.boundingBox||!1!==e6.intersectsBox(i.boundingBox))&&this._computeIntersections(t,e,e6)))}_computeIntersections(t,e,i){let s,r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,c=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=c.length;r<o;r++){let o=c[r],d=n[o.materialIndex],m=Math.max(o.start,p.start),f=Math.min(a.count,Math.min(o.start+o.count,p.start+p.count));for(let r=m;r<f;r+=3)(s=ih(this,d,t,i,h,l,u,a.getX(r),a.getX(r+1),a.getX(r+2)))&&(s.faceIndex=Math.floor(r/3),s.face.materialIndex=o.materialIndex,e.push(s))}else{let r=Math.max(0,p.start),o=Math.min(a.count,p.start+p.count);for(let c=r;c<o;c+=3)(s=ih(this,n,t,i,h,l,u,a.getX(c),a.getX(c+1),a.getX(c+2)))&&(s.faceIndex=Math.floor(c/3),e.push(s))}else if(void 0!==o)if(Array.isArray(n))for(let r=0,a=c.length;r<a;r++){let a=c[r],d=n[a.materialIndex],m=Math.max(a.start,p.start),f=Math.min(o.count,Math.min(a.start+a.count,p.start+p.count));for(let r=m;r<f;r+=3)(s=ih(this,d,t,i,h,l,u,r,r+1,r+2))&&(s.faceIndex=Math.floor(r/3),s.face.materialIndex=a.materialIndex,e.push(s))}else{let r=Math.max(0,p.start),a=Math.min(o.count,p.start+p.count);for(let o=r;o<a;o+=3)(s=ih(this,n,t,i,h,l,u,o,o+1,o+2))&&(s.faceIndex=Math.floor(o/3),e.push(s))}}}function ih(t,e,i,s,r,n,a,o,h,l){t.getVertexPosition(o,e7),t.getVertexPosition(h,it),t.getVertexPosition(l,ie);let u=function(t,e,i,s,r,n,a,o){if(null===(1===e.side?s.intersectTriangle(a,n,r,!0,o):s.intersectTriangle(r,n,a,0===e.side,o)))return null;ia.copy(o),ia.applyMatrix4(t.matrixWorld);let h=i.ray.origin.distanceTo(ia);return h<i.near||h>i.far?null:{distance:h,point:ia.clone(),object:t}}(t,e,i,s,e7,it,ie,ir);if(u){let t=new Z;eA.getBarycoord(ir,e7,it,ie,t),r&&(u.uv=eA.getInterpolatedAttribute(r,o,h,l,t,new J)),n&&(u.uv1=eA.getInterpolatedAttribute(n,o,h,l,t,new J)),a&&(u.normal=eA.getInterpolatedAttribute(a,o,h,l,t,new Z),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));let e={a:o,b:h,c:l,normal:new Z,materialIndex:0};eA.getNormal(e7,it,ie,e.normal),u.face=e,u.barycoord=t}return u}class il extends e5{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};const a=this;s=Math.floor(s),r=Math.floor(r);const o=[],h=[],l=[],u=[];let c=0,p=0;function d(t,e,i,s,r,n,d,m,f,g,y){let x=n/f,b=d/g,v=n/2,w=d/2,M=m/2,S=f+1,A=g+1,_=0,C=0,T=new Z;for(let n=0;n<A;n++){let a=n*b-w;for(let o=0;o<S;o++){let c=o*x-v;T[t]=c*s,T[e]=a*r,T[i]=M,h.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[i]=m>0?1:-1,l.push(T.x,T.y,T.z),u.push(o/f),u.push(1-n/g),_+=1}}for(let t=0;t<g;t++)for(let e=0;e<f;e++){let i=c+e+S*t,s=c+e+S*(t+1),r=c+(e+1)+S*(t+1),n=c+(e+1)+S*t;o.push(i,s,n),o.push(s,r,n),C+=6}a.addGroup(p,C,y),p+=C,c+=_}d("z","y","x",-1,-1,i,e,t,n=Math.floor(n),r,0),d("z","y","x",1,-1,i,e,-t,n,r,1),d("x","z","y",1,1,t,i,e,s,n,2),d("x","z","y",1,-1,t,i,-e,s,n,3),d("x","y","z",1,-1,t,e,i,s,r,4),d("x","y","z",-1,-1,t,e,-i,s,r,5),this.setIndex(o),this.setAttribute("position",new eZ(h,3)),this.setAttribute("normal",new eZ(l,3)),this.setAttribute("uv",new eZ(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new il(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function iu(t){let e={};for(let i in t)for(let s in e[i]={},t[i]){let r=t[i][s];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(R("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][s]=null):e[i][s]=r.clone():Array.isArray(r)?e[i][s]=r.slice():e[i][s]=r}return e}function ic(t){let e={};for(let i=0;i<t.length;i++){let s=iu(t[i]);for(let t in s)e[t]=s[t]}return e}function ip(t){let e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:ts.workingColorSpace}let id={clone:iu,merge:ic};class im extends eR{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=iu(t.uniforms),this.uniformsGroups=function(t){let e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);for(let i in e.glslVersion=this.glslVersion,e.uniforms={},this.uniforms){let s=this.uniforms[i].value;s&&s.isTexture?e.uniforms[i]={type:"t",value:s.toJSON(t).uuid}:s&&s.isColor?e.uniforms[i]={type:"c",value:s.getHex()}:s&&s.isVector2?e.uniforms[i]={type:"v2",value:s.toArray()}:s&&s.isVector3?e.uniforms[i]={type:"v3",value:s.toArray()}:s&&s.isVector4?e.uniforms[i]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?e.uniforms[i]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?e.uniforms[i]={type:"m4",value:s.toArray()}:e.uniforms[i]={value:s}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let i={};for(let t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class ig extends eu{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tH,this.projectionMatrix=new tH,this.projectionMatrixInverse=new tH,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let iy=new Z,ix=new J,ib=new J;class iv extends ig{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*V*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*$*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*V*Math.atan(Math.tan(.5*$*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){iy.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(iy.x,iy.y).multiplyScalar(-t/iy.z),iy.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(iy.x,iy.y).multiplyScalar(-t/iy.z)}getViewSize(t,e){return this.getViewBounds(t,ix,ib),e.subVectors(ib,ix)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*$*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s,n=this.view;if(null!==this.view&&this.view.enabled){let t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*s/t,e-=n.offsetY*i/a,s*=n.width/t,i*=n.height/a}let a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class iw extends eu{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new iv(-90,1,t,e);s.layers=this.layers,this.add(s);const r=new iv(-90,1,t,e);r.layers=this.layers,this.add(r);const n=new iv(-90,1,t,e);n.layers=this.layers,this.add(n);const a=new iv(-90,1,t,e);a.layers=this.layers,this.add(a);const o=new iv(-90,1,t,e);o.layers=this.layers,this.add(o);const h=new iv(-90,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,o]=e;for(let t of e)this.remove(t);if(2e3===t)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===t)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,n,a,o,h,l]=this.children,u=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,o),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,c,p),t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class iM extends tp{constructor(t=[],e=301,i,s,r,n,a,o,h,l){super(t,e,i,s,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class iS extends tf{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1};this.texture=new iM([i,i,i,i,i,i]),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},s=new il(5,5,5),r=new im({name:"CubemapFromEquirect",uniforms:iu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let n=new io(s,r),a=e.minFilter;return 1008===e.minFilter&&(e.minFilter=1006),new iw(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){let r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(r)}}class iA extends eu{constructor(){super(),this.isGroup=!0,this.type="Group"}}let i_={type:"move"};class iC{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new iA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new iA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new iA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){for(let s of(n=!0,t.hand.values())){let t=e.getJointPose(s,i),r=this._getHandJoint(h,s);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}let s=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=s.position.distanceTo(r.position);h.inputState.pinching&&a>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(i_)))}return null!==a&&(a.visible=null!==s),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new iA;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class iT{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ez(t),this.density=e}clone(){return new iT(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iI{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new ez(t),this.near=e,this.far=i}clone(){return new iI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class iz extends eu{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new t3,this.environmentIntensity=1,this.environmentRotation=new t3,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ik{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,r=this.stride;s<r;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=D()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=D()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let iB=new Z;class iR{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)iB.fromBufferAttribute(this,e),iB.applyMatrix4(t),this.setXYZ(e,iB.x,iB.y,iB.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)iB.fromBufferAttribute(this,e),iB.applyNormalMatrix(t),this.setXYZ(e,iB.x,iB.y,iB.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)iB.fromBufferAttribute(this,e),iB.transformDirection(t),this.setXYZ(e,iB.x,iB.y,iB.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=G(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=q(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=q(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=q(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=q(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=q(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=G(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=G(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=G(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=G(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=q(e,this.array),i=q(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=q(e,this.array),i=q(i,this.array),s=q(s,this.array),r=q(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=r,this}clone(t){if(void 0!==t)return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new iR(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{B("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let e=0;e<this.count;e++){let i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new eD(new this.array.constructor(t),this.itemSize,this.normalized)}}toJSON(t){if(void 0!==t)return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{B("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let e=0;e<this.count;e++){let i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}}}class iO extends eR{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ez(0xffffff),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let iE=new Z,iP=new Z,iL=new Z,iN=new J,iF=new J,i$=new tH,iV=new Z,iD=new Z,ij=new Z,iU=new J,iW=new J,iG=new J;class iq extends eu{constructor(t=new iO){if(super(),this.isSprite=!0,this.type="Sprite",void 0===i){i=new e5;const t=new ik(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);i.setIndex([0,1,2,0,2,3]),i.setAttribute("position",new iR(t,3,0,!1)),i.setAttribute("uv",new iR(t,2,3,!1))}this.geometry=i,this.material=t,this.center=new J(.5,.5),this.count=1}raycast(t,e){let i,s;null===t.camera&&O('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),iP.setFromMatrixScale(this.matrixWorld),i$.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),iL.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&iP.multiplyScalar(-iL.z);let r=this.material.rotation;0!==r&&(s=Math.cos(r),i=Math.sin(r));let n=this.center;iH(iV.set(-.5,-.5,0),iL,n,iP,i,s),iH(iD.set(.5,-.5,0),iL,n,iP,i,s),iH(ij.set(.5,.5,0),iL,n,iP,i,s),iU.set(0,0),iW.set(1,0),iG.set(1,1);let a=t.ray.intersectTriangle(iV,iD,ij,!1,iE);if(null===a&&(iH(iD.set(-.5,.5,0),iL,n,iP,i,s),iW.set(0,1),null===(a=t.ray.intersectTriangle(iV,ij,iD,!1,iE))))return;let o=t.ray.origin.distanceTo(iE);o<t.near||o>t.far||e.push({distance:o,point:iE.clone(),uv:eA.getInterpolation(iE,iV,iD,ij,iU,iW,iG,new J),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function iH(t,e,i,s,r,n){iN.subVectors(t,i).addScalar(.5).multiply(s),void 0!==r?(iF.x=n*iN.x-r*iN.y,iF.y=r*iN.x+n*iN.y):iF.copy(iN),t.copy(e),t.x+=iF.x,t.y+=iF.y,t.applyMatrix4(i$)}let iJ=new Z,iX=new Z;class iZ extends eu{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let t=0,i=e.length;t<i;t++){let i=e[t];this.addLevel(i.object.clone(),i.distance,i.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,i=0){let s;e=Math.abs(e);let r=this.levels;for(s=0;s<r.length&&!(e<r[s].distance);s++);return r.splice(s,0,{distance:e,hysteresis:i,object:t}),this.add(t),this}removeLevel(t){let e=this.levels;for(let i=0;i<e.length;i++)if(e[i].distance===t){let t=e.splice(i,1);return this.remove(t[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){let e=this.levels;if(e.length>0){let i,s;for(i=1,s=e.length;i<s;i++){let s=e[i].distance;if(e[i].object.visible&&(s-=s*e[i].hysteresis),t<s)break}return e[i-1].object}return null}raycast(t,e){if(this.levels.length>0){iJ.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(iJ);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){let i,s;iJ.setFromMatrixPosition(t.matrixWorld),iX.setFromMatrixPosition(this.matrixWorld);let r=iJ.distanceTo(iX)/t.zoom;for(i=1,e[0].object.visible=!0,s=e.length;i<s;i++){let t=e[i].distance;if(e[i].object.visible&&(t-=t*e[i].hysteresis),r>=t)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)e[i].object.visible=!1}}toJSON(t){let e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];let i=this.levels;for(let t=0,s=i.length;t<s;t++){let s=i[t];e.object.levels.push({object:s.object.uuid,distance:s.distance,hysteresis:s.hysteresis})}return e}}let iY=new Z,iQ=new td,iK=new td,i0=new Z,i1=new tH,i2=new Z,i3=new tF,i5=new tH,i4=new tq;class i6 extends io{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=p,this.bindMatrix=new tH,this.bindMatrixInverse=new tH,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;null===this.boundingBox&&(this.boundingBox=new tv),this.boundingBox.makeEmpty();let e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,i2),this.boundingBox.expandByPoint(i2)}computeBoundingSphere(){let t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new tF),this.boundingSphere.makeEmpty();let e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,i2),this.boundingSphere.expandByPoint(i2)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){let i=this.material,s=this.matrixWorld;void 0===i||(null===this.boundingSphere&&this.computeBoundingSphere(),i3.copy(this.boundingSphere),i3.applyMatrix4(s),!1===t.ray.intersectsSphere(i3)||(i5.copy(s).invert(),i4.copy(t.ray).applyMatrix4(i5),(null===this.boundingBox||!1!==i4.intersectsBox(this.boundingBox))&&this._computeIntersections(t,e,i4)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let t=new td,e=this.geometry.attributes.skinWeight;for(let i=0,s=e.count;i<s;i++){t.fromBufferAttribute(e,i);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===p?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===d?this.bindMatrixInverse.copy(this.bindMatrix).invert():R("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){let i=this.skeleton,s=this.geometry;iQ.fromBufferAttribute(s.attributes.skinIndex,t),iK.fromBufferAttribute(s.attributes.skinWeight,t),iY.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){let s=iK.getComponent(t);if(0!==s){let r=iQ.getComponent(t);i1.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(i0.copy(iY).applyMatrix4(i1),s)}}return e.applyMatrix4(this.bindMatrixInverse)}}class i8 extends eu{constructor(){super(),this.isBone=!0,this.type="Bone"}}class i9 extends tp{constructor(t=null,e=1,i=1,s,r,n,a,o,h=1003,l=1003,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let i7=new tH,st=new tH;class se{constructor(t=[],e=[]){this.uuid=D(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){R("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new tH)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let e=new tH;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){let t=this.bones,e=this.boneInverses,i=this.boneMatrices,s=this.boneTexture;for(let s=0,r=t.length;s<r;s++){let r=t[s]?t[s].matrixWorld:st;i7.multiplyMatrices(r,e[s]),i7.toArray(i,16*s)}null!==s&&(s.needsUpdate=!0)}clone(){return new se(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length),e=new Float32Array((t=Math.max(t=4*Math.ceil(t/4),4))*t*4);e.set(this.boneMatrices);let i=new i9(e,t,t,1023,1015);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){let i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,s=t.bones.length;i<s;i++){let s=t.bones[i],r=e[s];void 0===r&&(R("Skeleton: No bone found with UUID:",s),r=new i8),this.bones.push(r),this.boneInverses.push(new tH().fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,i=this.boneInverses;for(let s=0,r=e.length;s<r;s++){let r=e[s];t.bones.push(r.uuid);let n=i[s];t.boneInverses.push(n.toArray())}return t}}class si extends eD{constructor(t,e,i,s=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}let ss=new tH,sr=new tH,sn=[],sa=new tv,so=new tH,sh=new io,sl=new tF;class su extends io{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new si(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,so)}computeBoundingBox(){let t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new tv),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ss),sa.copy(t.boundingBox).applyMatrix4(ss),this.boundingBox.union(sa)}computeBoundingSphere(){let t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new tF),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ss),sl.copy(t.boundingSphere).applyMatrix4(ss),this.boundingSphere.union(sl)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){let i=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=t*(i.length+1)+1;for(let t=0;t<i.length;t++)i[t]=s[r+t]}raycast(t,e){let i=this.matrixWorld,s=this.count;if((sh.geometry=this.geometry,sh.material=this.material,void 0!==sh.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),sl.copy(this.boundingSphere),sl.applyMatrix4(i),!1!==t.ray.intersectsSphere(sl)))for(let r=0;r<s;r++){this.getMatrixAt(r,ss),sr.multiplyMatrices(i,ss),sh.matrixWorld=sr,sh.raycast(t,sn);for(let t=0,i=sn.length;t<i;t++){let i=sn[t];i.instanceId=r,i.object=this,e.push(i)}sn.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new si(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){let i=e.morphTargetInfluences,s=i.length+1;null===this.morphTexture&&(this.morphTexture=new i9(new Float32Array(s*this.count),s,this.count,1028,1015));let r=this.morphTexture.source.data.data,n=0;for(let t=0;t<i.length;t++)n+=i[t];let a=this.geometry.morphTargetsRelative?1:1-n,o=s*t;r[o]=a,r.set(i,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let sc=new Z,sp=new Z,sd=new K;class sm{constructor(t=new Z(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let s=sc.subVectors(i,e).cross(sp.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let i=t.delta(sc),s=this.normal.dot(i);if(0===s)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||sd.getNormalMatrix(t),s=this.coplanarPoint(sc).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}let sf=new tF,sg=new J(.5,.5),sy=new Z;class sx{constructor(t=new sm,e=new sm,i=new sm,s=new sm,r=new sm,n=new sm){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){let s=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],u=r[5],c=r[6],p=r[7],d=r[8],m=r[9],f=r[10],g=r[11],y=r[12],x=r[13],b=r[14],v=r[15];if(s[0].setComponents(h-n,p-l,g-d,v-y).normalize(),s[1].setComponents(h+n,p+l,g+d,v+y).normalize(),s[2].setComponents(h+a,p+u,g+m,v+x).normalize(),s[3].setComponents(h-a,p-u,g-m,v-x).normalize(),i)s[4].setComponents(o,c,f,b).normalize(),s[5].setComponents(h-o,p-c,g-f,v-b).normalize();else if(s[4].setComponents(h-o,p-c,g-f,v-b).normalize(),2e3===e)s[5].setComponents(h+o,p+c,g+f,v+b).normalize();else if(2001===e)s[5].setComponents(o,c,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),sf.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),sf.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(sf)}intersectsSprite(t){return sf.center.set(0,0,0),sf.radius=.7071067811865476+sg.distanceTo(t.center),sf.applyMatrix4(t.matrixWorld),this.intersectsSphere(sf)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let s=e[i];if(sy.x=s.normal.x>0?t.max.x:t.min.x,sy.y=s.normal.y>0?t.max.y:t.min.y,sy.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(sy))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}let sb=new tH,sv=new sx;class sw{constructor(){this.coordinateSystem=2e3}intersectsObject(t,e){if(!e.isArrayCamera||0===e.cameras.length)return!1;for(let i=0;i<e.cameras.length;i++){let s=e.cameras[i];if(sb.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),sv.setFromProjectionMatrix(sb,s.coordinateSystem,s.reversedDepth),sv.intersectsObject(t))return!0}return!1}intersectsSprite(t,e){if(!e||!e.cameras||0===e.cameras.length)return!1;for(let i=0;i<e.cameras.length;i++){let s=e.cameras[i];if(sb.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),sv.setFromProjectionMatrix(sb,s.coordinateSystem,s.reversedDepth),sv.intersectsSprite(t))return!0}return!1}intersectsSphere(t,e){if(!e||!e.cameras||0===e.cameras.length)return!1;for(let i=0;i<e.cameras.length;i++){let s=e.cameras[i];if(sb.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),sv.setFromProjectionMatrix(sb,s.coordinateSystem,s.reversedDepth),sv.intersectsSphere(t))return!0}return!1}intersectsBox(t,e){if(!e||!e.cameras||0===e.cameras.length)return!1;for(let i=0;i<e.cameras.length;i++){let s=e.cameras[i];if(sb.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),sv.setFromProjectionMatrix(sb,s.coordinateSystem,s.reversedDepth),sv.intersectsBox(t))return!0}return!1}containsPoint(t,e){if(!e||!e.cameras||0===e.cameras.length)return!1;for(let i=0;i<e.cameras.length;i++){let s=e.cameras[i];if(sb.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),sv.setFromProjectionMatrix(sb,s.coordinateSystem,s.reversedDepth),sv.containsPoint(t))return!0}return!1}clone(){return new sw}}function sM(t,e){return t-e}function sS(t,e){return t.z-e.z}function sA(t,e){return e.z-t.z}let s_=new tH,sC=new ez(1,1,1),sT=new sx,sI=new sw,sz=new tv,sk=new tF,sB=new Z,sR=new Z,sO=new Z,sE=new class{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,i,s){let r=this.pool,n=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let a=r[this.index];n.push(a),this.index++,a.start=t,a.count=e,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}},sP=new io,sL=[];function sN(t,e){if(t.constructor!==e.constructor){let i=Math.min(t.length,e.length);for(let s=0;s<i;s++)e[s]=t[s]}else{let i=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,i))}}class sF extends io{constructor(t,e,i=2*e,s){super(new e5,s),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount),e=new i9(new Float32Array((t=Math.max(t=4*Math.ceil(t/4),4))*t*4),t,t,1023,1015);this._matricesTexture=e}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount),e=new i9(new Uint32Array((t=Math.ceil(t))*t),t,t,1029,1014);this._indirectTexture=e}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount),e=new i9(new Float32Array((t=Math.ceil(t))*t*4).fill(1),t,t,1023,1015);e.colorSpace=ts.workingColorSpace,this._colorsTexture=e}_initializeGeometry(t){let e=this.geometry,i=this._maxVertexCount,s=this._maxIndexCount;if(!1===this._geometryInitialized){for(let s in t.attributes){let{array:r,itemSize:n,normalized:a}=t.getAttribute(s),o=new eD(new r.constructor(i*n),n,a);e.setAttribute(s,o)}if(null!==t.getIndex()){let t=i>65535?new Uint32Array(s):new Uint16Array(s);e.setIndex(new eD(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let i in e.attributes){if(!t.hasAttribute(i))throw Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);let s=t.getAttribute(i),r=e.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tv);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i<s;i++){if(!1===e[i].active)continue;let s=e[i].geometryIndex;this.getMatrixAt(i,s_),this.getBoundingBoxAt(s,sz).applyMatrix4(s_),t.union(sz)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new tF);let t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let i=0,s=e.length;i<s;i++){if(!1===e[i].active)continue;let s=e[i].geometryIndex;this.getMatrixAt(i,s_),this.getBoundingSphereAt(s,sk).applyMatrix4(s_),t.union(sk)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let e={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(sM),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=e):(i=this._instanceInfo.length,this._instanceInfo.push(e));let s=this._matricesTexture;s_.identity().toArray(s.image.data,16*i),s.needsUpdate=!0;let r=this._colorsTexture;return r&&(sC.toArray(r.image.data,4*i),r.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,i=-1){let s;this._initializeGeometry(t),this._validateGeometry(t);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},n=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===e?t.getAttribute("position").count:e;let a=t.getIndex();if(null!==a&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===i?a.count:i),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(sM),n[s=this._availableGeometryIds.shift()]=r):(s=this._geometryCount,this._geometryCount++,n.push(r)),this.setGeometryAt(s,t),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,s}setGeometryAt(t,e){if(t>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);let i=this.geometry,s=null!==i.getIndex(),r=i.getIndex(),n=e.getIndex(),a=this._geometryInfo[t];if(s&&n.count>a.reservedIndexCount||e.attributes.position.count>a.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=a.vertexStart,h=a.reservedVertexCount;for(let t in a.vertexCount=e.getAttribute("position").count,i.attributes){let s=e.getAttribute(t),r=i.getAttribute(t);!function(t,e,i=0){let s=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){let r=t.count;for(let n=0;n<r;n++)for(let r=0;r<s;r++)e.setComponent(n+i,r,t.getComponent(n,r))}else e.array.set(t.array,i*s);e.needsUpdate=!0}(s,r,o);let n=s.itemSize;for(let t=s.count;t<h;t++){let e=o+t;for(let t=0;t<n;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(o*n,h*n)}if(s){let t=a.indexStart,i=a.reservedIndexCount;a.indexCount=e.getIndex().count;for(let e=0;e<n.count;e++)r.setX(t+e,o+n.getX(e));for(let e=n.count;e<i;e++)r.setX(t+e,o);r.needsUpdate=!0,r.addUpdateRange(t,a.reservedIndexCount)}return a.start=s?a.indexStart:a.vertexStart,a.count=s?a.indexCount:a.vertexCount,a.boundingBox=null,null!==e.boundingBox&&(a.boundingBox=e.boundingBox.clone()),a.boundingSphere=null,null!==e.boundingSphere&&(a.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){let e=this._geometryInfo;if(t>=e.length||!1===e[t].active)return this;let i=this._instanceInfo;for(let e=0,s=i.length;e<s;e++)i[e].active&&i[e].geometryIndex===t&&this.deleteInstance(e);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0,i=this._geometryInfo,s=i.map((t,e)=>e).sort((t,e)=>i[t].vertexStart-i[e].vertexStart),r=this.geometry;for(let n=0,a=i.length;n<a;n++){let a=i[s[n]];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==e){let{indexStart:i,vertexStart:s,reservedIndexCount:n}=a,o=r.index,h=o.array,l=t-s;for(let t=i;t<i+n;t++)h[t]=h[t]+l;o.array.copyWithin(e,i,i+n),o.addUpdateRange(e,n),o.needsUpdate=!0,a.indexStart=e}e+=a.reservedIndexCount}if(a.vertexStart!==t){let{vertexStart:e,reservedVertexCount:i}=a,s=r.attributes;for(let r in s){let n=s[r],{array:a,itemSize:o}=n;a.copyWithin(t*o,e*o,(e+i)*o),n.addUpdateRange(t*o,i*o),n.needsUpdate=!0}a.vertexStart=t}t+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this._visibilityChanged=!0,this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingBox){let t=new tv,e=i.index,r=i.attributes.position;for(let i=s.start,n=s.start+s.count;i<n;i++){let s=i;e&&(s=e.getX(s)),t.expandByPoint(sB.fromBufferAttribute(r,s))}s.boundingBox=t}return e.copy(s.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;let i=this.geometry,s=this._geometryInfo[t];if(null===s.boundingSphere){let e=new tF;this.getBoundingBoxAt(t,sz),sz.getCenter(e.center);let r=i.index,n=i.attributes.position,a=0;for(let t=s.start,i=s.start+s.count;t<i;t++){let i=t;r&&(i=r.getX(i)),sB.fromBufferAttribute(n,i),a=Math.max(a,e.center.distanceToSquared(sB))}e.radius=Math.sqrt(a),s.boundingSphere=e}return e.copy(s.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);let i=this._matricesTexture,s=this._matricesTexture.image.data;return e.toArray(s,16*t),i.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,16*t)}setColorAt(t,e){return this.validateInstanceId(t),null===this._colorsTexture&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,4*t),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,4*t)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e||(this._instanceInfo[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);let i=this._geometryInfo[t];return e.vertexStart=i.vertexStart,e.vertexCount=i.vertexCount,e.reservedVertexCount=i.reservedVertexCount,e.indexStart=i.indexStart,e.indexCount=i.indexCount,e.reservedIndexCount=i.reservedIndexCount,e.start=i.start,e.count=i.count,e}setInstanceCount(t){let e=this._availableInstanceIds,i=this._instanceInfo;for(e.sort(sM);e[e.length-1]===i.length-1;)i.pop(),e.pop();if(t<i.length)throw Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);let s=new Int32Array(t),r=new Int32Array(t);sN(this._multiDrawCounts,s),sN(this._multiDrawStarts,r),this._multiDrawCounts=s,this._multiDrawStarts=r,this._maxInstanceCount=t;let n=this._indirectTexture,a=this._matricesTexture,o=this._colorsTexture;n.dispose(),this._initIndirectTexture(),sN(n.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),sN(a.image.data,this._matricesTexture.image.data),o&&(o.dispose(),this._initColorsTexture(),sN(o.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){let i=[...this._geometryInfo].filter(t=>t.active);if(Math.max(...i.map(t=>t.vertexStart+t.reservedVertexCount))>t)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(t=>t.indexStart+t.reservedIndexCount))>e)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new e5,this._initializeGeometry(s));let r=this.geometry;for(let t in s.index&&sN(s.index.array,r.index.array),s.attributes)sN(s.attributes[t].array,r.attributes[t].array)}raycast(t,e){let i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,n=this.geometry;sP.material=this.material,sP.geometry.index=n.index,sP.geometry.attributes=n.attributes,null===sP.geometry.boundingBox&&(sP.geometry.boundingBox=new tv),null===sP.geometry.boundingSphere&&(sP.geometry.boundingSphere=new tF);for(let n=0,a=i.length;n<a;n++){if(!i[n].visible||!i[n].active)continue;let a=i[n].geometryIndex,o=s[a];sP.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(n,sP.matrixWorld).premultiply(r),this.getBoundingBoxAt(a,sP.geometry.boundingBox),this.getBoundingSphereAt(a,sP.geometry.boundingSphere),sP.raycast(t,sL);for(let t=0,i=sL.length;t<i;t++){let i=sL[t];i.object=this,i.batchId=n,e.push(i)}sL.length=0}sP.material=null,sP.geometry.index=null,sP.geometry.attributes={},sP.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(t=>({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(t=>({...t})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let n=s.getIndex(),a=null===n?1:n.array.BYTES_PER_ELEMENT,o=this._instanceInfo,h=this._multiDrawStarts,l=this._multiDrawCounts,u=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,d=p.image.data,m=i.isArrayCamera?sI:sT;c&&!i.isArrayCamera&&(s_.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),sT.setFromProjectionMatrix(s_,i.coordinateSystem,i.reversedDepth));let f=0;if(this.sortObjects){s_.copy(this.matrixWorld).invert(),sB.setFromMatrixPosition(i.matrixWorld).applyMatrix4(s_),sR.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(s_);for(let t=0,e=o.length;t<e;t++)if(o[t].visible&&o[t].active){let e=o[t].geometryIndex;this.getMatrixAt(t,s_),this.getBoundingSphereAt(e,sk).applyMatrix4(s_);let s=!1;if(c&&(s=!m.intersectsSphere(sk,i)),!s){let i=u[e],s=sO.subVectors(sk.center,sB).dot(sR);sE.push(i.start,i.count,s,t)}}let t=sE.list,e=this.customSort;null===e?t.sort(r.transparent?sA:sS):e.call(this,t,i);for(let e=0,i=t.length;e<i;e++){let i=t[e];h[f]=i.start*a,l[f]=i.count,d[f]=i.index,f++}sE.reset()}else for(let t=0,e=o.length;t<e;t++)if(o[t].visible&&o[t].active){let e=o[t].geometryIndex,s=!1;if(c&&(this.getMatrixAt(t,s_),this.getBoundingSphereAt(e,sk).applyMatrix4(s_),s=!m.intersectsSphere(sk,i)),!s){let i=u[e];h[f]=i.start*a,l[f]=i.count,d[f]=t,f++}}p.needsUpdate=!0,this._multiDrawCount=f,this._visibilityChanged=!1}onBeforeShadow(t,e,i,s,r,n){this.onBeforeRender(t,null,s,r,n)}}class s$ extends eR{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ez(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}let sV=new Z,sD=new Z,sj=new tH,sU=new tq,sW=new tF,sG=new Z,sq=new Z;class sH extends eu{constructor(t=new e5,e=new s$){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[0];for(let t=1,s=e.count;t<s;t++)sV.fromBufferAttribute(e,t-1),sD.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=sV.distanceTo(sD);t.setAttribute("lineDistance",new eZ(i,1))}else R("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let i=this.geometry,s=this.matrixWorld,r=t.params.Line.threshold,n=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),sW.copy(i.boundingSphere),sW.applyMatrix4(s),sW.radius+=r,!1===t.ray.intersectsSphere(sW))return;sj.copy(s).invert(),sU.copy(t.ray).applyMatrix4(sj);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=this.isLineSegments?2:1,l=i.index,u=i.attributes.position;if(null!==l){let i=Math.max(0,n.start),s=Math.min(l.count,n.start+n.count);for(let r=i,n=s-1;r<n;r+=h){let i=sJ(this,t,sU,o,l.getX(r),l.getX(r+1),r);i&&e.push(i)}if(this.isLineLoop){let r=sJ(this,t,sU,o,l.getX(s-1),l.getX(i),s-1);r&&e.push(r)}}else{let i=Math.max(0,n.start),s=Math.min(u.count,n.start+n.count);for(let r=i,n=s-1;r<n;r+=h){let i=sJ(this,t,sU,o,r,r+1,r);i&&e.push(i)}if(this.isLineLoop){let r=sJ(this,t,sU,o,s-1,i,s-1);r&&e.push(r)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){let e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function sJ(t,e,i,s,r,n,a){let o=t.geometry.attributes.position;if(sV.fromBufferAttribute(o,r),sD.fromBufferAttribute(o,n),i.distanceSqToSegment(sV,sD,sG,sq)>s)return;sG.applyMatrix4(t.matrixWorld);let h=e.ray.origin.distanceTo(sG);if(!(h<e.near)&&!(h>e.far))return{distance:h,point:sq.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}let sX=new Z,sZ=new Z;class sY extends sH{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,s=e.count;t<s;t+=2)sX.fromBufferAttribute(e,t),sZ.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+sX.distanceTo(sZ);t.setAttribute("lineDistance",new eZ(i,1))}else R("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class sQ extends sH{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class sK extends eR{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ez(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let s0=new tH,s1=new tq,s2=new tF,s3=new Z;class s5 extends eu{constructor(t=new e5,e=new sK){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){let i=this.geometry,s=this.matrixWorld,r=t.params.Points.threshold,n=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),s2.copy(i.boundingSphere),s2.applyMatrix4(s),s2.radius+=r,!1===t.ray.intersectsSphere(s2))return;s0.copy(s).invert(),s1.copy(t.ray).applyMatrix4(s0);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=i.index,l=i.attributes.position;if(null!==h){let i=Math.max(0,n.start),r=Math.min(h.count,n.start+n.count);for(let n=i;n<r;n++){let i=h.getX(n);s3.fromBufferAttribute(l,i),s4(s3,i,o,s,t,e,this)}}else{let i=Math.max(0,n.start),r=Math.min(l.count,n.start+n.count);for(let n=i;n<r;n++)s3.fromBufferAttribute(l,n),s4(s3,n,o,s,t,e,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){let e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function s4(t,e,i,s,r,n,a){let o=s1.distanceSqToPoint(t);if(o<i){let i=new Z;s1.closestPointToPoint(t,i),i.applyMatrix4(s);let h=r.ray.origin.distanceTo(i);if(h<r.near||h>r.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class s6 extends tp{constructor(t,e,i,s,r=1006,n=1006,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const l=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class s8 extends s6{constructor(t,e,i,s,r,n,a,o){super({},t,e,i,s,r,n,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class s9 extends tp{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class s7 extends tp{constructor(t,e,i,s,r,n,a,o,h,l,u,c){super(null,n,a,o,h,l,s,r,u,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class rt extends s7{constructor(t,e,i,s,r,n){super(t,e,i,r,n),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class re extends s7{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class ri extends tp{constructor(t,e,i,s,r,n,a,o,h){super(t,e,i,s,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rs extends tp{constructor(t,e,i=1014,s,r,n,a=1003,o=1003,h,l=1026,u=1){if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:u},s,r,n,a,o,l,i,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new th(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class rr extends rs{constructor(t,e=1014,i=301,s,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1};super(t,t,e,i,s,r,n,a,o,h),this.image=[l,l,l,l,l,l],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class rn extends tp{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class ra extends e5{constructor(t=1,e=1,i=4,s=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:s,heightSegments:r},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),s=Math.max(3,Math.floor(s));const n=[],a=[],o=[],h=[],l=e/2,u=Math.PI/2*t,c=e,p=2*u+c,d=2*i+(r=Math.max(1,Math.floor(r))),m=s+1,f=new Z,g=new Z;for(let y=0;y<=d;y++){let x=0,b=0,v=0,w=0;if(y<=i){const e=y/i,s=e*Math.PI/2;b=-l-t*Math.cos(s),v=t*Math.sin(s),w=-t*Math.cos(s),x=e*u}else if(y<=i+r){const s=(y-i)/r;b=-l+s*e,v=t,w=0,x=u+s*c}else{const e=(y-i-r)/i,s=e*Math.PI/2;b=l+t*Math.sin(s),v=t*Math.cos(s),w=t*Math.sin(s),x=u+c+e*u}const M=Math.max(0,Math.min(1,x/p));let S=0;0===y?S=.5/s:y===d&&(S=-.5/s);for(let t=0;t<=s;t++){const e=t/s,i=e*Math.PI*2,r=Math.sin(i),n=Math.cos(i);g.x=-v*n,g.y=b,g.z=v*r,a.push(g.x,g.y,g.z),f.set(-v*n,w,v*r),f.normalize(),o.push(f.x,f.y,f.z),h.push(e+S,M)}if(y>0){const t=(y-1)*m;for(let e=0;e<s;e++){const i=t+e,s=t+e+1,r=y*m+e,a=y*m+e+1;n.push(i,s,r),n.push(s,a,r)}}}this.setIndex(n),this.setAttribute("position",new eZ(a,3)),this.setAttribute("normal",new eZ(o,3)),this.setAttribute("uv",new eZ(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ra(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class ro extends e5{constructor(t=1,e=32,i=0,s=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:s},e=Math.max(3,e);const r=[],n=[],a=[],o=[],h=new Z,l=new J;n.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,u=3;r<=e;r++,u+=3){const c=i+r/e*s;h.x=t*Math.cos(c),h.y=t*Math.sin(c),n.push(h.x,h.y,h.z),a.push(0,0,1),l.x=(n[u]/t+1)/2,l.y=(n[u+1]/t+1)/2,o.push(l.x,l.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new eZ(n,3)),this.setAttribute("normal",new eZ(a,3)),this.setAttribute("uv",new eZ(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ro(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class rh extends e5{constructor(t=1,e=1,i=1,s=32,r=1,n=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:s,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o};const h=this;s=Math.floor(s),r=Math.floor(r);const l=[],u=[],c=[],p=[];let d=0;const m=[],f=i/2;let g=0;function y(i){let r=d,n=new J,m=new Z,y=0,x=!0===i?t:e,b=!0===i?1:-1;for(let t=1;t<=s;t++)u.push(0,f*b,0),c.push(0,b,0),p.push(.5,.5),d++;let v=d;for(let t=0;t<=s;t++){let e=t/s*o+a,i=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=f*b,m.z=x*i,u.push(m.x,m.y,m.z),c.push(0,b,0),n.x=.5*i+.5,n.y=.5*r*b+.5,p.push(n.x,n.y),d++}for(let t=0;t<s;t++){let e=r+t,s=v+t;!0===i?l.push(s,s+1,e):l.push(s+1,s,e),y+=3}h.addGroup(g,y,!0===i?1:2),g+=y}(function(){let n=new Z,y=new Z,x=0,b=(e-t)/i;for(let h=0;h<=r;h++){let l=[],g=h/r,x=g*(e-t)+t;for(let t=0;t<=s;t++){let e=t/s,r=e*o+a,h=Math.sin(r),m=Math.cos(r);y.x=x*h,y.y=-g*i+f,y.z=x*m,u.push(y.x,y.y,y.z),n.set(h,b,m).normalize(),c.push(n.x,n.y,n.z),p.push(e,1-g),l.push(d++)}m.push(l)}for(let i=0;i<s;i++)for(let s=0;s<r;s++){let n=m[s][i],a=m[s+1][i],o=m[s+1][i+1],h=m[s][i+1];(t>0||0!==s)&&(l.push(n,a,h),x+=3),(e>0||s!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(g,x,0),g+=x})(),!1===n&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rh(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rl extends rh{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ru extends e5{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};const r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function o(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function h(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new Z,s=new Z,r=new Z;for(let n=0;n<e.length;n+=3)o(e[n+0],i),o(e[n+1],s),o(e[n+2],r),function(t,e,i,s){let r=s+1,n=[];for(let s=0;s<=r;s++){n[s]=[];let a=t.clone().lerp(i,s/r),o=e.clone().lerp(i,s/r),h=r-s;for(let t=0;t<=h;t++)0===t&&s===r?n[s][t]=a:n[s][t]=a.clone().lerp(o,t/h)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){let i=Math.floor(e/2);e%2==0?(a(n[t][i+1]),a(n[t+1][i]),a(n[t][i])):(a(n[t][i+1]),a(n[t+1][i+1]),a(n[t+1][i]))}}(i,s,r,t)})(s),function(t){let e=new Z;for(let i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){let t=new Z;for(let i=0;i<r.length;i+=3){var e;t.x=r[i+0],t.y=r[i+1],t.z=r[i+2];let s=l(t)/2/Math.PI+.5,a=Math.atan2(-(e=t).y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;n.push(s,1-a)}(function(){let t=new Z,e=new Z,i=new Z,s=new Z,a=new J,o=new J,u=new J;for(let c=0,p=0;c<r.length;c+=9,p+=6){t.set(r[c+0],r[c+1],r[c+2]),e.set(r[c+3],r[c+4],r[c+5]),i.set(r[c+6],r[c+7],r[c+8]),a.set(n[p+0],n[p+1]),o.set(n[p+2],n[p+3]),u.set(n[p+4],n[p+5]),s.copy(t).add(e).add(i).divideScalar(3);let d=l(s);h(a,p+0,t,d),h(o,p+2,e,d),h(u,p+4,i,d)}})(),function(){for(let t=0;t<n.length;t+=6){let e=n[t+0],i=n[t+2],s=n[t+4],r=Math.max(e,i,s),a=Math.min(e,i,s);r>.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new eZ(r,3)),this.setAttribute("normal",new eZ(r.slice(),3)),this.setAttribute("uv",new eZ(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ru(t.vertices,t.indices,t.radius,t.detail)}}class rc extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rc(t.radius,t.detail)}}let rp=new Z,rd=new Z,rm=new Z,rf=new eA;class rg extends e5{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=Math.cos($*e),s=t.getIndex(),r=t.getAttribute("position"),n=s?s.count:r.count,a=[0,0,0],o=["a","b","c"],h=[,,,],l={},u=[];for(let t=0;t<n;t+=3){s?(a[0]=s.getX(t),a[1]=s.getX(t+1),a[2]=s.getX(t+2)):(a[0]=t,a[1]=t+1,a[2]=t+2);const{a:e,b:n,c}=rf;if(e.fromBufferAttribute(r,a[0]),n.fromBufferAttribute(r,a[1]),c.fromBufferAttribute(r,a[2]),rf.getNormal(rm),h[0]=`${Math.round(1e4*e.x)},${Math.round(1e4*e.y)},${Math.round(1e4*e.z)}`,h[1]=`${Math.round(1e4*n.x)},${Math.round(1e4*n.y)},${Math.round(1e4*n.z)}`,h[2]=`${Math.round(1e4*c.x)},${Math.round(1e4*c.y)},${Math.round(1e4*c.z)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,s=h[t],r=h[e],n=rf[o[t]],c=rf[o[e]],p=`${s}_${r}`,d=`${r}_${s}`;d in l&&l[d]?(rm.dot(l[d].normal)<=i&&(u.push(n.x,n.y,n.z),u.push(c.x,c.y,c.z)),l[d]=null):p in l||(l[p]={index0:a[t],index1:a[e],normal:rm.clone()})}}for(const t in l)if(l[t]){const{index0:e,index1:i}=l[t];rp.fromBufferAttribute(r,e),rd.fromBufferAttribute(r,i),u.push(rp.x,rp.y,rp.z),u.push(rd.x,rd.y,rd.z)}this.setAttribute("position",new eZ(u,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class ry{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){R("Curve: .getPoint() not implemented.")}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],i,s=this.getPoint(0),r=0;e.push(0);for(let n=1;n<=t;n++)e.push(r+=(i=this.getPoint(n/t)).distanceTo(s)),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let i,s=this.getLengths(),r=0,n=s.length;i=e||t*s[n-1];let a=0,o=n-1,h;for(;a<=o;)if((h=s[r=Math.floor(a+(o-a)/2)]-i)<0)a=r+1;else if(h>0)o=r-1;else{o=r;break}if(s[r=o]===i)return r/(n-1);let l=s[r],u=s[r+1];return(r+(i-l)/(u-l))/(n-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new J:new Z);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new Z,s=[],r=[],n=[],a=new Z,o=new tH;for(let e=0;e<=t;e++){let i=e/t;s[e]=this.getTangentAt(i,new Z)}r[0]=new Z,n[0]=new Z;let h=Number.MAX_VALUE,l=Math.abs(s[0].x),u=Math.abs(s[0].y),c=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),c<=h&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(s[e-1],s[e]),a.length()>Number.EPSILON){a.normalize();let t=Math.acos(j(s[e-1].dot(s[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(s[e],r[e])}if(!0===e){let e=Math.acos(j(r[0].dot(r[t]),-1,1));e/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(s[i],e*i)),n[i].crossVectors(s[i],r[i])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rx extends ry{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new J){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(s=r?0:i),!0!==this.aClockwise||r||(s===i?s=-i:s-=i);let n=this.aStartAngle+t*s,a=this.aX+this.xRadius*Math.cos(n),o=this.aY+this.yRadius*Math.sin(n);if(0!==this.aRotation){let t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=a-this.aX,s=o-this.aY;a=i*t-s*e+this.aX,o=i*e+s*t+this.aY}return e.set(a,o)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class rb extends rx{constructor(t,e,i,s,r,n){super(t,e,i,i,s,r,n),this.isArcCurve=!0,this.type="ArcCurve"}}function rv(){let t=0,e=0,i=0,s=0;function r(r,n,a,o){t=r,e=a,i=-3*r+3*n-2*a-o,s=2*r-2*n+a+o}return{initCatmullRom:function(t,e,i,s,n){r(e,i,n*(i-t),n*(s-e))},initNonuniformCatmullRom:function(t,e,i,s,n,a,o){let h=(e-t)/n-(i-t)/(n+a)+(i-e)/a,l=(i-e)/a-(s-e)/(a+o)+(s-i)/o;r(e,i,h*=a,l*=a)},calc:function(r){let n=r*r;return t+e*r+i*n+n*r*s}}}let rw=new Z,rM=new rv,rS=new rv,rA=new rv;class r_ extends ry{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new Z){let i,s,r=this.points,n=r.length,a=(n-!this.closed)*t,o=Math.floor(a),h=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/n)+1)*n:0===h&&o===n-1&&(o=n-2,h=1),this.closed||o>0?i=r[(o-1)%n]:(rw.subVectors(r[0],r[1]).add(r[0]),i=rw);let l=r[o%n],u=r[(o+1)%n];if(this.closed||o+2<n?s=r[(o+2)%n]:(rw.subVectors(r[n-1],r[n-2]).add(r[n-1]),s=rw),"centripetal"===this.curveType||"chordal"===this.curveType){let t="chordal"===this.curveType?.5:.25,e=Math.pow(i.distanceToSquared(l),t),r=Math.pow(l.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(s),t);r<1e-4&&(r=1),e<1e-4&&(e=r),n<1e-4&&(n=r),rM.initNonuniformCatmullRom(i.x,l.x,u.x,s.x,e,r,n),rS.initNonuniformCatmullRom(i.y,l.y,u.y,s.y,e,r,n),rA.initNonuniformCatmullRom(i.z,l.z,u.z,s.z,e,r,n)}else"catmullrom"===this.curveType&&(rM.initCatmullRom(i.x,l.x,u.x,s.x,this.tension),rS.initCatmullRom(i.y,l.y,u.y,s.y,this.tension),rA.initCatmullRom(i.z,l.z,u.z,s.z,this.tension));return e.set(rM.calc(h),rS.calc(h),rA.calc(h)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(new Z().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function rC(t,e,i,s,r){let n=(s-e)*.5,a=(r-i)*.5,o=t*t;return t*o*(2*i-2*s+n+a)+(-3*i+3*s-2*n-a)*o+n*t+i}function rT(t,e,i,s){let r;return(r=1-t)*r*e+2*(1-t)*t*i+t*t*s}function rI(t,e,i,s,r){let n,a;return(n=1-t)*n*n*e+3*(a=1-t)*a*t*i+3*(1-t)*t*t*s+t*t*t*r}class rz extends ry{constructor(t=new J,e=new J,i=new J,s=new J){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new J){let i=this.v0,s=this.v1,r=this.v2,n=this.v3;return e.set(rI(t,i.x,s.x,r.x,n.x),rI(t,i.y,s.y,r.y,n.y)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class rk extends ry{constructor(t=new Z,e=new Z,i=new Z,s=new Z){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new Z){let i=this.v0,s=this.v1,r=this.v2,n=this.v3;return e.set(rI(t,i.x,s.x,r.x,n.x),rI(t,i.y,s.y,r.y,n.y),rI(t,i.z,s.z,r.z,n.z)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class rB extends ry{constructor(t=new J,e=new J){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new J){return 1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new J){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rR extends ry{constructor(t=new Z,e=new Z){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Z){return 1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Z){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rO extends ry{constructor(t=new J,e=new J,i=new J){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new J){let i=this.v0,s=this.v1,r=this.v2;return e.set(rT(t,i.x,s.x,r.x),rT(t,i.y,s.y,r.y)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rE extends ry{constructor(t=new Z,e=new Z,i=new Z){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Z){let i=this.v0,s=this.v1,r=this.v2;return e.set(rT(t,i.x,s.x,r.x),rT(t,i.y,s.y,r.y),rT(t,i.z,s.z,r.z)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rP extends ry{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new J){let i=this.points,s=(i.length-1)*t,r=Math.floor(s),n=s-r,a=i[0===r?r:r-1],o=i[r],h=i[r>i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rC(n,a.x,o.x,h.x,l.x),rC(n,a.y,o.y,h.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(new J().fromArray(i))}return this}}var rL=Object.freeze({__proto__:null,ArcCurve:rb,CatmullRomCurve3:r_,CubicBezierCurve:rz,CubicBezierCurve3:rk,EllipseCurve:rx,LineCurve:rB,LineCurve3:rR,QuadraticBezierCurve:rO,QuadraticBezierCurve3:rE,SplineCurve:rP});class rN extends ry{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new rL[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=i){let t=s[r]-i,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i<s;i++)t.push(e+=this.curves[i].getLength());return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e,i=[];for(let s=0,r=this.curves;s<r.length;s++){let n=r[s],a=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,o=n.getPoints(a);for(let t=0;t<o.length;t++){let s=o[t];e&&e.equals(s)||(i.push(s),e=s)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let i=t.curves[e];this.curves.push(new rL[i.type]().fromJSON(i))}return this}}class rF extends rN{constructor(t){super(),this.type="Path",this.currentPoint=new J,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new rB(this.currentPoint.clone(),new J(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let r=new rO(this.currentPoint.clone(),new J(t,e),new J(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,r,n){let a=new rz(this.currentPoint.clone(),new J(t,e),new J(i,s),new J(r,n));return this.curves.push(a),this.currentPoint.set(r,n),this}splineThru(t){let e=new rP([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,r,n){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,s,r,n),this}absarc(t,e,i,s,r,n){return this.absellipse(t,e,i,i,s,r,n),this}ellipse(t,e,i,s,r,n,a,o){let h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,i,s,r,n,a,o),this}absellipse(t,e,i,s,r,n,a,o){let h=new rx(t,e,i,s,r,n,a,o);if(this.curves.length>0){let t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);let l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class r$ extends rF{constructor(t){super(t),this.uuid=D(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let i=t.holes[e];this.holes.push(new rF().fromJSON(i))}return this}}function rV(t,e,i,s,r){let n;if(r===function(t,e,i,s){let r=0;for(let n=e,a=i-s;n<i;n+=s)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,i,s)>0)for(let r=e;r<i;r+=s)n=rK(r/s|0,t[r],t[r+1],n);else for(let r=i-s;r>=e;r-=s)n=rK(r/s|0,t[r],t[r+1],n);return n&&rH(n,n.next)&&(r0(n),n=n.next),n}function rD(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rH(i,i.next)||0===rq(i.prev,i,i.next))){if(r0(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e)return e}function rj(t,e){let i=t.x-e.x;return 0===i&&0==(i=t.y-e.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function rU(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)<<1}function rW(t,e,i,s,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(s-o)>=(i-a)*(e-o)&&(i-a)*(n-o)>=(r-a)*(s-o)}function rG(t,e,i,s,r,n,a,o){return(t!==a||e!==o)&&rW(t,e,i,s,r,n,a,o)}function rq(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rH(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rZ(rq(t,e,i)),n=rZ(rq(t,e,s)),a=rZ(rq(i,s,t)),o=rZ(rq(i,s,e));return!!(r!==n&&a!==o||0===r&&rX(t,i,e)||0===n&&rX(t,s,e)||0===a&&rX(i,t,s)||0===o&&rX(i,e,s))}function rX(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rZ(t){return t>0?1:t<0?-1:0}function rY(t,e){return 0>rq(t.prev,t,t.next)?rq(t,e,t.next)>=0&&rq(t,t.prev,e)>=0:0>rq(t,e,t.prev)||0>rq(t,t.next,e)}function rQ(t,e){let i=r1(t.i,t.x,t.y),s=r1(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rK(t,e,i,s){let r=r1(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function r0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function r1(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class r2{static triangulate(t,e,i=2){return function(t,e,i=2){let s,r,n,a=e&&e.length,o=a?e[0]*i:t.length,h=rV(t,0,o,i,!0),l=[];if(!h||h.next===h.prev)return l;if(a&&(h=function(t,e,i,s){let r=[];for(let i=0,n=e.length;i<n;i++){let a=e[i]*s,o=i<n-1?e[i+1]*s:t.length,h=rV(t,a,o,s,!1);h===h.next&&(h.steiner=!0),r.push(function(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t)return i}(h))}r.sort(rj);for(let t=0;t<r.length;t++)i=function(t,e){let i=function(t,e){let i,s=e,r=t.x,n=t.y,a=-1/0;if(rH(t,s))return s;do{if(rH(t,s.next))return s.next;if(n<=s.y&&n>=s.next.y&&s.next.y!==s.y){let t=s.x+(n-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=r&&t>a&&(a=t,i=s.x<s.next.x?s:s.next,t===r))return i}s=s.next}while(s!==e)if(!i)return null;let o=i,h=i.x,l=i.y,u=1/0;s=i;do{if(r>=s.x&&s.x>=h&&r!==s.x&&rW(n<l?r:a,n,h,l,n<l?a:r,n,s.x,s.y)){var c,p;let e=Math.abs(n-s.y)/(r-s.x);rY(s,t)&&(e<u||e===u&&(s.x>i.x||s.x===i.x&&(c=i,p=s,0>rq(c.prev,c,p.prev)&&0>rq(p.next,c,c.next))))&&(i=s,u=e)}s=s.next}while(s!==o)return i}(t,e);if(!i)return e;let s=rQ(i,t);return rD(s,s.next),rD(i,i.next)}(r[t],i);return i}(t,e,h,i)),t.length>80*i){s=t[0],r=t[1];let e=s,a=r;for(let n=i;n<o;n+=i){let i=t[n],o=t[n+1];i<s&&(s=i),o<r&&(r=o),i>e&&(e=i),o>a&&(a=o)}n=0!==(n=Math.max(e-s,a-r))?32767/n:0}return function t(e,i,s,r,n,a,o){if(!e)return;!o&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rU(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t)r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let s,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t<i&&(o++,a=a.nextZ);t++);let h=i;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(s=r,r=r.nextZ,o--):(s=a,a=a.nextZ,h--),n?n.nextZ=s:t=s,s.prevZ=n,n=s;r=a}n.nextZ=null,i*=2}while(e>1)}(r)}(e,r,n,a);let h=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?function(t,e,i,s){let r=t.prev,n=t.next;if(rq(r,t,n)>=0)return!1;let a=r.x,o=t.x,h=n.x,l=r.y,u=t.y,c=n.y,p=Math.min(a,o,h),d=Math.min(l,u,c),m=Math.max(a,o,h),f=Math.max(l,u,c),g=rU(p,d,e,i,s),y=rU(m,f,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=f&&x!==r&&x!==n&&rG(a,l,o,u,h,c,x.x,x.y)&&rq(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=f&&b!==r&&b!==n&&rG(a,l,o,u,h,c,b.x,b.y)&&rq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rq(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,o=t.y,h=i.y,l=Math.min(s,r,n),u=Math.min(a,o,h),c=Math.max(s,r,n),p=Math.max(a,o,h),d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rG(s,a,r,o,n,h,d.x,d.y)&&rq(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i,e.i,u.i),r0(e),e=u.next,h=u.next;continue}if((e=u)===h){o?1===o?t(e=function(t,e){let i=t;do{let s=i.prev,r=i.next.next;!rH(s,r)&&rJ(s,i,i.next,r)&&rY(s,r)&&rY(r,s)&&(e.push(s.i,i.i,r.i),r0(i),r0(i.next),i=t=r),i=i.next}while(i!==t)return rD(i)}(rD(e),i),i,s,r,n,a,2):2===o&&function(e,i,s,r,n,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var h,l;if(o.i!==e.i&&(h=o,l=e,h.next.i!==l.i&&h.prev.i!==l.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t)return!1}(h,l)&&(rY(h,l)&&rY(l,h)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t)return s}(h,l)&&(rq(h.prev,h,l.prev)||rq(h,l.prev,l))||rH(h,l)&&rq(h.prev,h,h.next)>0&&rq(l.prev,l,l.next)>0))){let h=rQ(o,e);o=rD(o,o.next),h=rD(h,h.next),t(o,i,s,r,n,a,0),t(h,i,s,r,n,a,0);return}e=e.next}o=o.next}while(o!==e)}(e,i,s,r,n,a):t(rD(e),i,s,r,n,a,1);break}}}(h,l,i,s,r,n,0),l}(t,e,i)}}class r3{static area(t){let e=t.length,i=0;for(let s=e-1,r=0;r<e;s=r++)i+=t[s].x*t[r].y-t[r].x*t[s].y;return .5*i}static isClockWise(t){return 0>r3.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];r5(t),r4(i,t);let n=t.length;e.forEach(r5);for(let t=0;t<e.length;t++)s.push(n),n+=e[t].length,r4(i,e[t]);let a=r2.triangulate(i,s);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function r5(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function r4(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class r6 extends e5{constructor(t=new r$([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,s=[],r=[];for(let n=0,a=t.length;n<a;n++)!function(t){let n,a,o,h,l,u=[],c=void 0!==e.curveSegments?e.curveSegments:12,p=void 0!==e.steps?e.steps:1,d=void 0!==e.depth?e.depth:1,m=void 0===e.bevelEnabled||e.bevelEnabled,f=void 0!==e.bevelThickness?e.bevelThickness:.2,g=void 0!==e.bevelSize?e.bevelSize:f-.1,y=void 0!==e.bevelOffset?e.bevelOffset:0,x=void 0!==e.bevelSegments?e.bevelSegments:3,b=e.extrudePath,v=void 0!==e.UVGenerator?e.UVGenerator:r8,w,M=!1;if(b){w=b.getSpacedPoints(p),M=!0,m=!1;let t=!!b.isCatmullRomCurve3&&b.closed;n=b.computeFrenetFrames(p,t),a=new Z,o=new Z,h=new Z}m||(x=0,f=0,g=0,y=0);let S=t.extractPoints(c),A=S.shape,_=S.holes;if(!r3.isClockWise(A)){A=A.reverse();for(let t=0,e=_.length;t<e;t++){let e=_[t];r3.isClockWise(e)&&(_[t]=e.reverse())}}function C(t){let e=1e-10*1e-10,i=t[0];for(let s=1;s<=t.length;s++){let r=s%t.length,n=t[r],a=n.x-i.x,o=n.y-i.y,h=a*a+o*o,l=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(i.x),Math.abs(i.y));if(h<=e*l*l){t.splice(r,1),s--;continue}i=n}}C(A),_.forEach(C);let T=_.length,I=A;for(let t=0;t<T;t++){let e=_[t];A=A.concat(e)}function z(t,e,i){return e||O("ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}let k=A.length;function B(t,e,i){let s,r,n,a=t.x-e.x,o=t.y-e.y,h=i.x-t.x,l=i.y-t.y,u=a*a+o*o;if(Math.abs(a*l-o*h)>Number.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(h*h+l*l),d=e.x-o/c,m=e.y+a/c,f=((i.x-l/p-d)*l-(i.y+h/p-m)*h)/(a*l-o*h),g=(s=d+a*f-t.x)*s+(r=m+o*f-t.y)*r;if(g<=2)return new J(s,r);n=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(s=-o,r=a,n=Math.sqrt(u)):(s=a,r=o,n=Math.sqrt(u/2))}return new J(s/n,r/n)}let R=[];for(let t=0,e=I.length,i=e-1,s=t+1;t<e;t++,i++,s++)i===e&&(i=0),s===e&&(s=0),R[t]=B(I[t],I[i],I[s]);let E=[],P,L=R.concat();for(let t=0;t<T;t++){let e=_[t];P=[];for(let t=0,i=e.length,s=i-1,r=t+1;t<i;t++,s++,r++)s===i&&(s=0),r===i&&(r=0),P[t]=B(e[t],e[s],e[r]);E.push(P),L=L.concat(P)}if(0===x)l=r3.triangulateShape(I,_);else{let t=[],e=[];for(let i=0;i<x;i++){let s=i/x,r=f*Math.cos(s*Math.PI/2),n=g*Math.sin(s*Math.PI/2)+y;for(let e=0,i=I.length;e<i;e++){let i=z(I[e],R[e],n);V(i.x,i.y,-r),0===s&&t.push(i)}for(let t=0;t<T;t++){let i=_[t];P=E[t];let a=[];for(let t=0,e=i.length;t<e;t++){let e=z(i[t],P[t],n);V(e.x,e.y,-r),0===s&&a.push(e)}0===s&&e.push(a)}}l=r3.triangulateShape(t,e)}let N=l.length,F=g+y;for(let t=0;t<k;t++){let e=m?z(A[t],L[t],F):A[t];M?(o.copy(n.normals[0]).multiplyScalar(e.x),a.copy(n.binormals[0]).multiplyScalar(e.y),h.copy(w[0]).add(o).add(a),V(h.x,h.y,h.z)):V(e.x,e.y,0)}for(let t=1;t<=p;t++)for(let e=0;e<k;e++){let i=m?z(A[e],L[e],F):A[e];M?(o.copy(n.normals[t]).multiplyScalar(i.x),a.copy(n.binormals[t]).multiplyScalar(i.y),h.copy(w[t]).add(o).add(a),V(h.x,h.y,h.z)):V(i.x,i.y,d/p*t)}for(let t=x-1;t>=0;t--){let e=t/x,i=f*Math.cos(e*Math.PI/2),s=g*Math.sin(e*Math.PI/2)+y;for(let t=0,e=I.length;t<e;t++){let e=z(I[t],R[t],s);V(e.x,e.y,d+i)}for(let t=0,e=_.length;t<e;t++){let e=_[t];P=E[t];for(let t=0,r=e.length;t<r;t++){let r=z(e[t],P[t],s);M?V(r.x,r.y+w[p-1].y,w[p-1].x+i):V(r.x,r.y,d+i)}}}function $(t,e){let r=t.length;for(;--r>=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let t=0,r=p+2*x;t<r;t++){let r=k*t,o=k*(t+1);!function(t,e,r,n){j(t),j(e),j(n),j(e),j(r),j(n);let a=s.length/3,o=v.generateSideWallUV(i,s,a-6,a-3,a-2,a-1);U(o[0]),U(o[1]),U(o[3]),U(o[1]),U(o[2]),U(o[3])}(e+n+r,e+a+r,e+a+o,e+n+o)}}}function V(t,e,i){u.push(t),u.push(e),u.push(i)}function D(t,e,r){j(t),j(e),j(r);let n=s.length/3,a=v.generateTopUV(i,s,n-3,n-2,n-1);U(a[0]),U(a[1]),U(a[2])}function j(t){s.push(u[3*t+0]),s.push(u[3*t+1]),s.push(u[3*t+2])}function U(t){r.push(t.x),r.push(t.y)}(function(){let t=s.length/3;if(m){let t=0*k;for(let e=0;e<N;e++){let i=l[e];D(i[2]+t,i[1]+t,i[0]+t)}t=k*(p+2*x);for(let e=0;e<N;e++){let i=l[e];D(i[0]+t,i[1]+t,i[2]+t)}}else{for(let t=0;t<N;t++){let e=l[t];D(e[2],e[1],e[0])}for(let t=0;t<N;t++){let e=l[t];D(e[0]+k*p,e[1]+k*p,e[2]+k*p)}}i.addGroup(t,s.length/3-t,0)})(),function(){let t=s.length/3,e=0;$(I,0),e+=I.length;for(let t=0,i=_.length;t<i;t++){let i=_[t];$(i,e),e+=i.length}i.addGroup(t,s.length/3-t,1)}()}(t[n]);this.setAttribute("position",new eZ(s,3)),this.setAttribute("uv",new eZ(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,s=t.length;e<s;e++){let s=t[e];i.shapes.push(s.uuid)}else i.shapes.push(t.uuid);return i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){let i=[];for(let s=0,r=t.shapes.length;s<r;s++){let r=e[t.shapes[s]];i.push(r)}let s=t.options.extrudePath;return void 0!==s&&(t.options.extrudePath=new rL[s.type]().fromJSON(s)),new r6(i,t.options)}}let r8={generateTopUV:function(t,e,i,s,r){let n=e[3*i],a=e[3*i+1],o=e[3*s],h=e[3*s+1],l=e[3*r],u=e[3*r+1];return[new J(n,a),new J(o,h),new J(l,u)]},generateSideWallUV:function(t,e,i,s,r,n){let a=e[3*i],o=e[3*i+1],h=e[3*i+2],l=e[3*s],u=e[3*s+1],c=e[3*s+2],p=e[3*r],d=e[3*r+1],m=e[3*r+2],f=e[3*n],g=e[3*n+1],y=e[3*n+2];return Math.abs(o-u)<Math.abs(a-l)?[new J(a,1-h),new J(l,1-c),new J(p,1-m),new J(f,1-y)]:[new J(o,1-h),new J(u,1-c),new J(d,1-m),new J(g,1-y)]}};class r9 extends ru{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r9(t.radius,t.detail)}}class r7 extends e5{constructor(t=[new J(0,-.5),new J(.5,0),new J(0,.5)],e=12,i=0,s=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:s},e=Math.floor(e),s=j(s,0,2*Math.PI);const r=[],n=[],a=[],o=[],h=[],l=1/e,u=new Z,c=new J,p=new Z,d=new Z,m=new Z;let f=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,p.x=+(g=t[e+1].y-t[e].y),p.y=-f,p.z=0*g,m.copy(p),p.normalize(),o.push(p.x,p.y,p.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[e+1].x-t[e].x,p.x=+(g=t[e+1].y-t[e].y),p.y=-f,p.z=0*g,d.copy(p),p.x+=m.x,p.y+=m.y,p.z+=m.z,p.normalize(),o.push(p.x,p.y,p.z),m.copy(d)}for(let r=0;r<=e;r++){const p=i+r*l*s,d=Math.sin(p),m=Math.cos(p);for(let i=0;i<=t.length-1;i++){u.x=t[i].x*d,u.y=t[i].y,u.z=t[i].x*m,n.push(u.x,u.y,u.z),c.x=r/e,c.y=i/(t.length-1),a.push(c.x,c.y);const s=o[3*i+0]*d,l=o[3*i+1],p=o[3*i+0]*m;h.push(s,l,p)}}for(let i=0;i<e;i++)for(let e=0;e<t.length-1;e++){const s=e+i*t.length,n=s+t.length,a=s+t.length+1,o=s+1;r.push(s,n,o),r.push(a,o,n)}this.setIndex(r),this.setAttribute("position",new eZ(n,3)),this.setAttribute("uv",new eZ(a,2)),this.setAttribute("normal",new eZ(h,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r7(t.points,t.segments,t.phiStart,t.phiLength)}}class nt extends ru{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new nt(t.radius,t.detail)}}class ne extends e5{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};const r=t/2,n=e/2,a=Math.floor(i),o=Math.floor(s),h=a+1,l=o+1,u=t/a,c=e/o,p=[],d=[],m=[],f=[];for(let t=0;t<l;t++){const e=t*c-n;for(let i=0;i<h;i++){const s=i*u-r;d.push(s,-e,0),m.push(0,0,1),f.push(i/a),f.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const i=e+h*t,s=e+h*(t+1),r=e+1+h*(t+1),n=e+1+h*t;p.push(i,s,n),p.push(s,r,n)}this.setIndex(p),this.setAttribute("position",new eZ(d,3)),this.setAttribute("normal",new eZ(m,3)),this.setAttribute("uv",new eZ(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ne(t.width,t.height,t.widthSegments,t.heightSegments)}}class ni extends e5{constructor(t=.5,e=1,i=32,s=1,r=0,n=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:s,thetaStart:r,thetaLength:n},i=Math.max(3,i);const a=[],o=[],h=[],l=[];let u=t;const c=(e-t)/(s=Math.max(1,s)),p=new Z,d=new J;for(let t=0;t<=s;t++){for(let t=0;t<=i;t++){const s=r+t/i*n;p.x=u*Math.cos(s),p.y=u*Math.sin(s),o.push(p.x,p.y,p.z),h.push(0,0,1),d.x=(p.x/e+1)/2,d.y=(p.y/e+1)/2,l.push(d.x,d.y)}u+=c}for(let t=0;t<s;t++){const e=t*(i+1);for(let t=0;t<i;t++){const s=t+e,r=s+i+1,n=s+i+2,o=s+1;a.push(s,r,o),a.push(r,n,o)}}this.setIndex(a),this.setAttribute("position",new eZ(o,3)),this.setAttribute("normal",new eZ(h,3)),this.setAttribute("uv",new eZ(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ni(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class ns extends e5{constructor(t=new r$([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],s=[],r=[],n=[];let a=0,o=0;if(!1===Array.isArray(t))h(t);else for(let e=0;e<t.length;e++)h(t[e]),this.addGroup(a,o,e),a+=o,o=0;function h(t){let a=s.length/3,h=t.extractPoints(e),l=h.shape,u=h.holes;!1===r3.isClockWise(l)&&(l=l.reverse());for(let t=0,e=u.length;t<e;t++){let e=u[t];!0===r3.isClockWise(e)&&(u[t]=e.reverse())}let c=r3.triangulateShape(l,u);for(let t=0,e=u.length;t<e;t++){let e=u[t];l=l.concat(e)}for(let t=0,e=l.length;t<e;t++){let e=l[t];s.push(e.x,e.y,0),r.push(0,0,1),n.push(e.x,e.y)}for(let t=0,e=c.length;t<e;t++){let e=c[t],s=e[0]+a,r=e[1]+a,n=e[2]+a;i.push(s,r,n),o+=3}}this.setIndex(i),this.setAttribute("position",new eZ(s,3)),this.setAttribute("normal",new eZ(r,3)),this.setAttribute("uv",new eZ(n,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,s=t.length;i<s;i++){let s=t[i];e.shapes.push(s.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){let i=[];for(let s=0,r=t.shapes.length;s<r;s++){let r=e[t.shapes[s]];i.push(r)}return new ns(i,t.curveSegments)}}class nr extends e5{constructor(t=1,e=32,i=16,s=0,r=2*Math.PI,n=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:s,phiLength:r,thetaStart:n,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(n+a,Math.PI);let h=0;const l=[],u=new Z,c=new Z,p=[],d=[],m=[],f=[];for(let p=0;p<=i;p++){const g=[],y=p/i;let x=0;0===p&&0===n?x=.5/e:p===i&&o===Math.PI&&(x=-.5/e);for(let i=0;i<=e;i++){const o=i/e;u.x=-t*Math.cos(s+o*r)*Math.sin(n+y*a),u.y=t*Math.cos(n+y*a),u.z=t*Math.sin(s+o*r)*Math.sin(n+y*a),d.push(u.x,u.y,u.z),c.copy(u).normalize(),m.push(c.x,c.y,c.z),f.push(o+x,1-y),g.push(h++)}l.push(g)}for(let t=0;t<i;t++)for(let s=0;s<e;s++){const e=l[t][s+1],r=l[t][s],a=l[t+1][s],h=l[t+1][s+1];(0!==t||n>0)&&p.push(e,r,h),(t!==i-1||o<Math.PI)&&p.push(r,a,h)}this.setIndex(p),this.setAttribute("position",new eZ(d,3)),this.setAttribute("normal",new eZ(m,3)),this.setAttribute("uv",new eZ(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nr(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class nn extends ru{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new nn(t.radius,t.detail)}}class na extends e5{constructor(t=1,e=.4,i=12,s=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:s,arc:r},i=Math.floor(i),s=Math.floor(s);const n=[],a=[],o=[],h=[],l=new Z,u=new Z,c=new Z;for(let n=0;n<=i;n++)for(let p=0;p<=s;p++){const d=p/s*r,m=n/i*Math.PI*2;u.x=(t+e*Math.cos(m))*Math.cos(d),u.y=(t+e*Math.cos(m))*Math.sin(d),u.z=e*Math.sin(m),a.push(u.x,u.y,u.z),l.x=t*Math.cos(d),l.y=t*Math.sin(d),c.subVectors(u,l).normalize(),o.push(c.x,c.y,c.z),h.push(p/s),h.push(n/i)}for(let t=1;t<=i;t++)for(let e=1;e<=s;e++){const i=(s+1)*t+e-1,r=(s+1)*(t-1)+e-1,a=(s+1)*(t-1)+e,o=(s+1)*t+e;n.push(i,r,o),n.push(r,a,o)}this.setIndex(n),this.setAttribute("position",new eZ(a,3)),this.setAttribute("normal",new eZ(o,3)),this.setAttribute("uv",new eZ(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new na(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class no extends e5{constructor(t=1,e=.4,i=64,s=8,r=2,n=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:s,p:r,q:n},i=Math.floor(i),s=Math.floor(s);const a=[],o=[],h=[],l=[],u=new Z,c=new Z,p=new Z,d=new Z,m=new Z,f=new Z,g=new Z;for(let a=0;a<=i;++a){const x=a/i*r*Math.PI*2;y(x,r,n,t,p),y(x+.01,r,n,t,d),f.subVectors(d,p),g.addVectors(d,p),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let t=0;t<=s;++t){const r=t/s*Math.PI*2,n=-e*Math.cos(r),d=e*Math.sin(r);u.x=p.x+(n*g.x+d*m.x),u.y=p.y+(n*g.y+d*m.y),u.z=p.z+(n*g.z+d*m.z),o.push(u.x,u.y,u.z),c.subVectors(u,p).normalize(),h.push(c.x,c.y,c.z),l.push(a/i),l.push(t/s)}}for(let t=1;t<=i;t++)for(let e=1;e<=s;e++){const i=(s+1)*(t-1)+(e-1),r=(s+1)*t+(e-1),n=(s+1)*t+e,o=(s+1)*(t-1)+e;a.push(i,r,o),a.push(r,n,o)}function y(t,e,i,s,r){let n=Math.cos(t),a=Math.sin(t),o=i/e*t,h=Math.cos(o);r.x=s*(2+h)*.5*n,r.y=s*(2+h)*a*.5,r.z=s*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new eZ(o,3)),this.setAttribute("normal",new eZ(h,3)),this.setAttribute("uv",new eZ(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new no(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class nh extends e5{constructor(t=new rE(new Z(-1,-1,0),new Z(-1,1,0),new Z(1,1,0)),e=64,i=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:s,closed:r};const n=t.computeFrenetFrames(e,r);this.tangents=n.tangents,this.normals=n.normals,this.binormals=n.binormals;const a=new Z,o=new Z,h=new J;let l=new Z;const u=[],c=[],p=[],d=[];function m(r){l=t.getPointAt(r/e,l);let h=n.normals[r],p=n.binormals[r];for(let t=0;t<=s;t++){let e=t/s*Math.PI*2,r=Math.sin(e),n=-Math.cos(e);o.x=n*h.x+r*p.x,o.y=n*h.y+r*p.y,o.z=n*h.z+r*p.z,o.normalize(),c.push(o.x,o.y,o.z),a.x=l.x+i*o.x,a.y=l.y+i*o.y,a.z=l.z+i*o.z,u.push(a.x,a.y,a.z)}}(function(){for(let t=0;t<e;t++)m(t);m(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=s;i++)h.x=t/e,h.y=i/s,p.push(h.x,h.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=s;e++){let i=(s+1)*(t-1)+(e-1),r=(s+1)*t+(e-1),n=(s+1)*t+e,a=(s+1)*(t-1)+e;d.push(i,r,a),d.push(r,n,a)}}()})(),this.setIndex(d),this.setAttribute("position",new eZ(u,3)),this.setAttribute("normal",new eZ(c,3)),this.setAttribute("uv",new eZ(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new nh(new rL[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class nl extends e5{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],i=new Set,s=new Z,r=new Z;if(null!==t.index){const n=t.attributes.position,a=t.index;let o=t.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,h=o.length;t<h;++t){const h=o[t],l=h.start,u=h.count;for(let t=l,o=l+u;t<o;t+=3)for(let o=0;o<3;o++){const h=a.getX(t+o),l=a.getX(t+(o+1)%3);s.fromBufferAttribute(n,h),r.fromBufferAttribute(n,l),!0===nu(s,r,i)&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}}else{const n=t.attributes.position;for(let t=0,a=n.count/3;t<a;t++)for(let a=0;a<3;a++){const o=3*t+a,h=3*t+(a+1)%3;s.fromBufferAttribute(n,o),r.fromBufferAttribute(n,h),!0===nu(s,r,i)&&(e.push(s.x,s.y,s.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new eZ(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function nu(t,e,i){let s=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==i.has(s)&&!0!==i.has(r)&&(i.add(s),i.add(r),!0)}var nc=Object.freeze({__proto__:null,BoxGeometry:il,CapsuleGeometry:ra,CircleGeometry:ro,ConeGeometry:rl,CylinderGeometry:rh,DodecahedronGeometry:rc,EdgesGeometry:rg,ExtrudeGeometry:r6,IcosahedronGeometry:r9,LatheGeometry:r7,OctahedronGeometry:nt,PlaneGeometry:ne,PolyhedronGeometry:ru,RingGeometry:ni,ShapeGeometry:ns,SphereGeometry:nr,TetrahedronGeometry:nn,TorusGeometry:na,TorusKnotGeometry:no,TubeGeometry:nh,WireframeGeometry:nl});class np extends eR{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ez(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class nd extends im{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class nm extends eR{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ez(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nf extends nm{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return j(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ez(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ez(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ez(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class ng extends eR{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ez(0xffffff),this.specular=new ez(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ny extends eR{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ez(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class nx extends eR{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class nb extends eR{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ez(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ez(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new t3,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nv extends eR{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nw extends eR{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class nM extends eR{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ez(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}}class nS extends s${constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function nA(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function n_(t){let e=t.length,i=Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function nC(t,e,i){let s=t.length,r=new t.constructor(s);for(let n=0,a=0;a!==s;++n){let s=i[n]*e;for(let i=0;i!==e;++i)r[a++]=t[s+i]}return r}function nT(t,e,i,s){let r=1,n=t[0];for(;void 0!==n&&void 0===n[s];)n=t[r++];if(void 0===n)return;let a=n[s];if(void 0!==a)if(Array.isArray(a))do void 0!==(a=n[s])&&(e.push(n.time),i.push(...a)),n=t[r++];while(void 0!==n)else if(void 0!==a.toArray)do void 0!==(a=n[s])&&(e.push(n.time),a.toArray(i,i.length)),n=t[r++];while(void 0!==n)else do void 0!==(a=n[s])&&(e.push(n.time),i.push(a)),n=t[r++];while(void 0!==n)}class nI{static convertArray(t,e){return nA(t,e)}static isTypedArray(t){return A(t)}static getKeyframeOrder(t){return n_(t)}static sortedArray(t,e,i){return nC(t,e,i)}static flattenJSON(t,e,i,s){nT(t,e,i,s)}static subclip(t,e,i,s,r=30){return function(t,e,i,s,r=30){let n=t.clone();n.name=e;let a=[];for(let t=0;t<n.tracks.length;++t){let e=n.tracks[t],o=e.getValueSize(),h=[],l=[];for(let t=0;t<e.times.length;++t){let n=e.times[t]*r;if(!(n<i)&&!(n>=s)){h.push(e.times[t]);for(let i=0;i<o;++i)l.push(e.values[t*o+i])}}0!==h.length&&(e.times=nA(h,e.times.constructor),e.values=nA(l,e.values.constructor),a.push(e))}n.tracks=a;let o=1/0;for(let t=0;t<n.tracks.length;++t)o>n.tracks[t].times[0]&&(o=n.tracks[t].times[0]);for(let t=0;t<n.tracks.length;++t)n.tracks[t].shift(-1*o);return n.resetDuration(),n}(t,e,i,s,r)}static makeClipAdditive(t,e=0,i=t,s=30){return function(t,e=0,i=t,s=30){s<=0&&(s=30);let r=i.tracks.length,n=e/s;for(let e=0;e<r;++e){let s,r=i.tracks[e],a=r.ValueTypeName;if("bool"===a||"string"===a)continue;let o=t.tracks.find(function(t){return t.name===r.name&&t.ValueTypeName===a});if(void 0===o)continue;let h=0,l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=l/3);let u=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);let p=r.times.length-1;if(n<=r.times[0]){let t=h,e=l-h;s=r.values.slice(t,e)}else if(n>=r.times[p]){let t=p*l+h,e=t+l-h;s=r.values.slice(t,e)}else{let t=r.createInterpolant(),e=h,i=l-h;t.evaluate(n),s=t.resultBuffer.slice(e,i)}"quaternion"===a&&new X().fromArray(s).normalize().conjugate().toArray(s);let d=o.times.length;for(let t=0;t<d;++t){let e=t*c+u;if("quaternion"===a)X.multiplyQuaternionsFlat(o.values,e,s,0,o.values,e);else{let t=c-2*u;for(let i=0;i<t;++i)o.values[e+i]-=s[i]}}}return t.blendMode=2501,t}(t,e,i,s)}}class nz{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==s?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,s=e[i],r=e[i-1];t:{e:{let n;i:{s:if(!(t<s)){for(let n=i+2;;){if(void 0===s){if(t<r)break s;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===n)break;if(r=s,t<(s=e[++i]))break e}n=e.length;break i}if(!(t>=r)){let a=e[1];t<a&&(i=2,r=a);for(let n=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===n)break;if(s=r,t>=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i<n;){let s=i+n>>>1;t<e[s]?n=s:i=s+1}if(s=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===s)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=t*s;for(let t=0;t!==s;++t)e[t]=i[r+t];return e}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class nk extends nz{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){let s=this.parameterPositions,r=t-2,n=t+1,a=s[r],o=s[n];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-i;break;case 2402:r=s.length-2,a=e+s[r]-s[r+1];break;default:r=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:n=t,o=2*i-e;break;case 2402:n=1,o=i+s[1]-s[0];break;default:n=t-1,o=e}let h=(i-e)*.5,l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=r*l,this._offsetNext=n*l}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,p=this._weightNext,d=(i-e)/(s-e),m=d*d,f=m*d,g=-c*f+2*c*m-c*d,y=(1+c)*f+(-1.5-2*c)*m+(-.5+c)*d+1,x=(-1-p)*f+(1.5+p)*m+.5*d,b=p*f-p*m;for(let t=0;t!==a;++t)r[t]=g*n[l+t]+y*n[h+t]+x*n[o+t]+b*n[u+t];return r}}class nB extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(i-e)/(s-e),u=1-l;for(let t=0;t!==a;++t)r[t]=n[h+t]*u+n[o+t]*l;return r}}class nR extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}}class nO{constructor(t,e,i,s){if(void 0===t)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=nA(e,this.TimeBufferType),this.values=nA(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e,i=t.constructor;if(i.toJSON!==this.toJSON)e=i.toJSON(t);else{e={name:t.name,times:nA(t.times,Array),values:nA(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e}InterpolantFactoryMethodDiscrete(t){return new nR(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nB(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new nk(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){let e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(e);return R("KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(1!==t){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){let i=this.times,s=i.length,r=0,n=s-1;for(;r!==s&&i[r]<t;)++r;for(;-1!==n&&i[n]>e;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let t=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(O("KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(O("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){let s=i[e];if("number"==typeof s&&isNaN(s)){O("KeyframeTrack: Time is not a valid number.",this,e,s),t=!1;break}if(null!==n&&n>s){O("KeyframeTrack: Out of order keys.",this,e,s,n),t=!1;break}n=s}if(void 0!==s&&A(s))for(let e=0,i=s.length;e!==i;++e){let i=s[e];if(isNaN(i)){O("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a<r;++a){let r=!1,o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(s)r=!0;else{let t=a*i,s=t-i,n=t+i;for(let a=0;a!==i;++a){let i=e[t+a];if(i!==e[s+a]||i!==e[n+a]){r=!0;break}}}if(r){if(a!==n){t[n]=t[a];let s=a*i,r=n*i;for(let t=0;t!==i;++t)e[r+t]=e[s+t]}++n}}if(r>0){t[n]=t[r];for(let t=r*i,s=n*i,a=0;a!==i;++a)e[s+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=new this.constructor(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}nO.prototype.ValueTypeName="",nO.prototype.TimeBufferType=Float32Array,nO.prototype.ValueBufferType=Float32Array,nO.prototype.DefaultInterpolation=2301;class nE extends nO{constructor(t,e,i){super(t,e,i)}}nE.prototype.ValueTypeName="bool",nE.prototype.ValueBufferType=Array,nE.prototype.DefaultInterpolation=2300,nE.prototype.InterpolantFactoryMethodLinear=void 0,nE.prototype.InterpolantFactoryMethodSmooth=void 0;class nP extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nP.prototype.ValueTypeName="color";class nL extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nL.prototype.ValueTypeName="number";class nN extends nz{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(s-e),h=t*a;for(let t=h+a;h!==t;h+=4)X.slerpFlat(r,0,n,h-a,n,h,o);return r}}class nF extends nO{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new nN(this.times,this.values,this.getValueSize(),t)}}nF.prototype.ValueTypeName="quaternion",nF.prototype.InterpolantFactoryMethodSmooth=void 0;class n$ extends nO{constructor(t,e,i){super(t,e,i)}}n$.prototype.ValueTypeName="string",n$.prototype.ValueBufferType=Array,n$.prototype.DefaultInterpolation=2300,n$.prototype.InterpolantFactoryMethodLinear=void 0,n$.prototype.InterpolantFactoryMethodSmooth=void 0;class nV extends nO{constructor(t,e,i,s){super(t,e,i,s)}}nV.prototype.ValueTypeName="vector";class nD{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=D(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,s=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push((function(t){if(void 0===t.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nL;case"vector":case"vector2":case"vector3":case"vector4":return nV;case"color":return nP;case"quaternion":return nF;case"bool":case"boolean":return nE;case"string":return n$}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];nT(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)})(i[t]).scale(s));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){let e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,s=i.length;t!==s;++t)e.push(nO.toJSON(i[t]));return s}static CreateFromMorphTargetSequence(t,e,i,s){let r=e.length,n=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);let h=n_(a);a=nC(a,1,h),o=nC(o,1,h),s||0!==a[0]||(a.push(r),o.push(o[0])),n.push(new nL(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/i))}return new this(t,-1,n)}static findByName(t,e){let i=t;Array.isArray(t)||(i=t.geometry&&t.geometry.animations||t.animations);for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){let s={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){let i=t[e],n=i.name.match(r);if(n&&n.length>1){let t=n[1],e=s[t];e||(s[t]=e=[]),e.push(i)}}let n=[];for(let t in s)n.push(this.CreateFromMorphTargetSequence(t,s[t],e,i));return n}static parseAnimation(t,e){if(R("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return O("AnimationClip: No animation in JSONLoader data."),null;let i=function(t,e,i,s,r){if(0!==i.length){let n=[],a=[];nT(i,n,a,s),0!==n.length&&r.push(new t(e,n,a))}},s=[],r=t.name||"default",n=t.fps||30,a=t.blendMode,o=t.length||-1,h=t.hierarchy||[];for(let t=0;t<h.length;t++){let r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){let t,e={};for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let i=0;i<r[t].morphTargets.length;i++)e[r[t].morphTargets[i]]=-1;for(let i in e){let e=[],n=[];for(let s=0;s!==r[t].morphTargets.length;++s){let s=r[t];e.push(s.time),n.push(+(s.morphTarget===i))}s.push(new nL(".morphTargetInfluence["+i+"]",e,n))}o=e.length*n}else{let n=".bones["+e[t].name+"]";i(nV,n+".position",r,"pos",s),i(nF,n+".quaternion",r,"rot",s),i(nV,n+".scale",r,"scl",s)}}return 0===s.length?null:new this(r,o,s,a)}resetDuration(){let t=this.tracks,e=0;for(let i=0,s=t.length;i!==s;++i){let t=this.tracks[i];e=Math.max(e,t.times[t.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());let e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}let nj={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class nU{constructor(t,e,i){let s;const r=this;let n=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this._abortController=null,this.itemStart=function(t){o++,!1===n&&void 0!==r.onStart&&r.onStart(t,a,o),n=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){let e=h.indexOf(t);return -1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){let i=h[e],s=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return s}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}let nW=new nU;class nG{constructor(t){this.manager=void 0!==t?t:nW,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let i=this;return new Promise(function(s,r){i.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}nG.DEFAULT_MATERIAL_NAME="__DEFAULT";let nq={};class nH extends Error{constructor(t,e){super(t),this.response=e}}class nJ extends nG{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,i,s){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=nj.get(`file:${t}`);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==nq[t])return void nq[t].push({onLoad:e,onProgress:i,onError:s});nq[t]=[],nq[t].push({onLoad:e,onProgress:i,onError:s});let n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&R("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;let i=nq[t],s=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n,o=0;return new Response(new ReadableStream({start(t){!function e(){s.read().then(({done:s,value:r})=>{if(s)t.close();else{let s=new ProgressEvent("progress",{lengthComputable:a,loaded:o+=r.byteLength,total:n});for(let t=0,e=i.length;t<e;t++){let e=i[t];e.onProgress&&e.onProgress(s)}t.enqueue(r),e()}},e=>{t.error(e)})}()}}))}throw new nH(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>new DOMParser().parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=new TextDecoder(e&&e[1]?e[1].toLowerCase():void 0);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nj.add(`file:${t}`,e);let i=nq[t];delete nq[t];for(let t=0,s=i.length;t<s;t++){let s=i[t];s.onLoad&&s.onLoad(e)}}).catch(e=>{let i=nq[t];if(void 0===i)throw this.manager.itemError(t),e;delete nq[t];for(let t=0,s=i.length;t<s;t++){let s=i[t];s.onError&&s.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class nX extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=[];for(let i=0;i<t.length;i++){let s=nD.parse(t[i]);e.push(s)}return e}}class nZ extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=[],a=new s7,o=new nJ(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let h=0;if(Array.isArray(t))for(let l=0,u=t.length;l<u;++l)!function(l){o.load(t[l],function(t){let i=r.parse(t,!0);n[l]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},6===(h+=1)&&(1===i.mipmapCount&&(a.minFilter=1006),a.image=n,a.format=i.format,a.needsUpdate=!0,e&&e(a))},i,s)}(l);else o.load(t,function(t){let i=r.parse(t,!0);if(i.isCubemap){let t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){n[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)n[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),n[e].format=i.format,n[e].width=i.width,n[e].height=i.height}a.image=n}else a.image.width=i.width,a.image.height=i.height,a.mipmaps=i.mipmaps;1===i.mipmapCount&&(a.minFilter=1006),a.format=i.format,a.needsUpdate=!0,e&&e(a)},i,s);return a}}let nY=new WeakMap;class nQ extends nG{constructor(t){super(t)}load(t,e,i,s){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,n=nj.get(`image:${t}`);if(void 0!==n){if(!0===n.complete)r.manager.itemStart(t),setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0);else{let t=nY.get(n);void 0===t&&(t=[],nY.set(n,t)),t.push({onLoad:e,onError:s})}return n}let a=_("img");function o(){l(),e&&e(this);let i=nY.get(this)||[];for(let t=0;t<i.length;t++){let e=i[t];e.onLoad&&e.onLoad(this)}nY.delete(this),r.manager.itemEnd(t)}function h(e){l(),s&&s(e),nj.remove(`image:${t}`);let i=nY.get(this)||[];for(let t=0;t<i.length;t++){let s=i[t];s.onError&&s.onError(e)}nY.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",h,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),nj.add(`image:${t}`,a),r.manager.itemStart(t),a.src=t,a}}class nK extends nG{constructor(t){super(t)}load(t,e,i,s){let r=new iM;r.colorSpace=m;let n=new nQ(this.manager);n.setCrossOrigin(this.crossOrigin),n.setPath(this.path);let a=0;for(let i=0;i<t.length;++i)!function(i){n.load(t[i],function(t){r.images[i]=t,6==++a&&(r.needsUpdate=!0,e&&e(r))},void 0,s)}(i);return r}}class n0 extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new i9,a=new nJ(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(t){let i;try{i=r.parse(t)}catch(t){if(void 0===s)return void t(t);s(t)}void 0!==i.image?n.image=i.image:void 0!==i.data&&(n.image.width=i.width,n.image.height=i.height,n.image.data=i.data),n.wrapS=void 0!==i.wrapS?i.wrapS:1001,n.wrapT=void 0!==i.wrapT?i.wrapT:1001,n.magFilter=void 0!==i.magFilter?i.magFilter:1006,n.minFilter=void 0!==i.minFilter?i.minFilter:1006,n.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(n.colorSpace=i.colorSpace),void 0!==i.flipY&&(n.flipY=i.flipY),void 0!==i.format&&(n.format=i.format),void 0!==i.type&&(n.type=i.type),void 0!==i.mipmaps&&(n.mipmaps=i.mipmaps,n.minFilter=1008),1===i.mipmapCount&&(n.minFilter=1006),void 0!==i.generateMipmaps&&(n.generateMipmaps=i.generateMipmaps),n.needsUpdate=!0,e&&e(n,i)},i,s),n}}class n1 extends nG{constructor(t){super(t)}load(t,e,i,s){let r=new tp,n=new nQ(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,s),r}}class n2 extends eu{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new ez(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}}class n3 extends n2{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(eu.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ez(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}toJSON(t){let e=super.toJSON(t);return e.object.groundColor=this.groundColor.getHex(),e}}let n5=new tH,n4=new Z,n6=new Z;class n8{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new tH,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new sx,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new td(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,i=this.matrix;n4.setFromMatrixPosition(t.matrixWorld),e.position.copy(n4),n6.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(n6),e.updateMatrixWorld(),n5.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(n5,e.coordinateSystem,e.reversedDepth),e.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(n5)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class n9 extends n8{constructor(){super(new iv(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){let e=this.camera,i=2*V*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;(i!==e.fov||s!==e.aspect||r!==e.far)&&(e.fov=i,e.aspect=s,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class n7 extends n2{constructor(t,e,i=0,s=Math.PI/3,r=0,n=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(eu.DEFAULT_UP),this.updateMatrix(),this.target=new eu,this.distance=i,this.angle=s,this.penumbra=r,this.decay=n,this.map=null,this.shadow=new n9}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}}class at extends n8{constructor(){super(new iv(90,1,.5,500)),this.isPointLightShadow=!0}}class ae extends n2{constructor(t,e,i=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new at}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}}class ai extends ig{constructor(t=-1,e=1,i=1,s=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=r,this.far=n,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,r,n){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=i-t,n=i+t,a=s+e,o=s-e;if(null!==this.view&&this.view.enabled){let t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,n=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,n,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class as extends n8{constructor(){super(new ai(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ar extends n2{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(eu.DEFAULT_UP),this.updateMatrix(),this.target=new eu,this.shadow=new as}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}}class an extends n2{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class aa extends n2{constructor(t,e,i=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){let e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class ao{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Z)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){let i=t.x,s=t.y,r=t.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.282095),e.addScaledVector(n[1],.488603*s),e.addScaledVector(n[2],.488603*r),e.addScaledVector(n[3],.488603*i),e.addScaledVector(n[4],i*s*1.092548),e.addScaledVector(n[5],s*r*1.092548),e.addScaledVector(n[6],.315392*(3*r*r-1)),e.addScaledVector(n[7],i*r*1.092548),e.addScaledVector(n[8],.546274*(i*i-s*s)),e}getIrradianceAt(t,e){let i=t.x,s=t.y,r=t.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.886227),e.addScaledVector(n[1],1.023328*s),e.addScaledVector(n[2],1.023328*r),e.addScaledVector(n[3],1.023328*i),e.addScaledVector(n[4],.858086*i*s),e.addScaledVector(n[5],.858086*s*r),e.addScaledVector(n[6],.743125*r*r-.247708),e.addScaledVector(n[7],.858086*i*r),e.addScaledVector(n[8],.429043*(i*i-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){let i=this.coefficients;for(let s=0;s<9;s++)i[s].fromArray(t,e+3*s);return this}toArray(t=[],e=0){let i=this.coefficients;for(let s=0;s<9;s++)i[s].toArray(t,e+3*s);return t}static getBasisAt(t,e){let i=t.x,s=t.y,r=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*s,e[5]=1.092548*s*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-s*s)}}class ah extends n2{constructor(t=new ao,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}toJSON(t){let e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class al extends nG{constructor(t){super(t),this.textures={}}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e=this.textures;function i(t){return void 0===e[t]&&R("MaterialLoader: Undefined texture",t),e[t]}let s=this.createMaterialFromType(t.type);if(void 0!==t.uuid&&(s.uuid=t.uuid),void 0!==t.name&&(s.name=t.name),void 0!==t.color&&void 0!==s.color&&s.color.setHex(t.color),void 0!==t.roughness&&(s.roughness=t.roughness),void 0!==t.metalness&&(s.metalness=t.metalness),void 0!==t.sheen&&(s.sheen=t.sheen),void 0!==t.sheenColor&&(s.sheenColor=new ez().setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(s.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==s.emissive&&s.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==s.specular&&s.specular.setHex(t.specular),void 0!==t.specularIntensity&&(s.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==s.specularColor&&s.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(s.shininess=t.shininess),void 0!==t.clearcoat&&(s.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(s.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(s.dispersion=t.dispersion),void 0!==t.iridescence&&(s.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(s.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(s.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(s.transmission=t.transmission),void 0!==t.thickness&&(s.thickness=t.thickness),void 0!==t.attenuationDistance&&(s.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==s.attenuationColor&&s.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(s.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(s.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(s.fog=t.fog),void 0!==t.flatShading&&(s.flatShading=t.flatShading),void 0!==t.blending&&(s.blending=t.blending),void 0!==t.combine&&(s.combine=t.combine),void 0!==t.side&&(s.side=t.side),void 0!==t.shadowSide&&(s.shadowSide=t.shadowSide),void 0!==t.opacity&&(s.opacity=t.opacity),void 0!==t.transparent&&(s.transparent=t.transparent),void 0!==t.alphaTest&&(s.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(s.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(s.depthFunc=t.depthFunc),void 0!==t.depthTest&&(s.depthTest=t.depthTest),void 0!==t.depthWrite&&(s.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(s.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(s.blendSrc=t.blendSrc),void 0!==t.blendDst&&(s.blendDst=t.blendDst),void 0!==t.blendEquation&&(s.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(s.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(s.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(s.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==s.blendColor&&s.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(s.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(s.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(s.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(s.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(s.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(s.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(s.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(s.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(s.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(s.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(s.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(s.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(s.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(s.rotation=t.rotation),void 0!==t.linewidth&&(s.linewidth=t.linewidth),void 0!==t.dashSize&&(s.dashSize=t.dashSize),void 0!==t.gapSize&&(s.gapSize=t.gapSize),void 0!==t.scale&&(s.scale=t.scale),void 0!==t.polygonOffset&&(s.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(s.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(s.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(s.dithering=t.dithering),void 0!==t.alphaToCoverage&&(s.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(s.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(s.forceSinglePass=t.forceSinglePass),void 0!==t.allowOverride&&(s.allowOverride=t.allowOverride),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.toneMapped&&(s.toneMapped=t.toneMapped),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?s.vertexColors=t.vertexColors>0:s.vertexColors=t.vertexColors),void 0!==t.uniforms)for(let e in t.uniforms){let r=t.uniforms[e];switch(s.uniforms[e]={},r.type){case"t":s.uniforms[e].value=i(r.value);break;case"c":s.uniforms[e].value=new ez().setHex(r.value);break;case"v2":s.uniforms[e].value=new J().fromArray(r.value);break;case"v3":s.uniforms[e].value=new Z().fromArray(r.value);break;case"v4":s.uniforms[e].value=new td().fromArray(r.value);break;case"m3":s.uniforms[e].value=new K().fromArray(r.value);break;case"m4":s.uniforms[e].value=new tH().fromArray(r.value);break;default:s.uniforms[e].value=r.value}}if(void 0!==t.defines&&(s.defines=t.defines),void 0!==t.vertexShader&&(s.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(s.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(s.glslVersion=t.glslVersion),void 0!==t.extensions)for(let e in t.extensions)s.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(s.lights=t.lights),void 0!==t.clipping&&(s.clipping=t.clipping),void 0!==t.size&&(s.size=t.size),void 0!==t.sizeAttenuation&&(s.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(s.map=i(t.map)),void 0!==t.matcap&&(s.matcap=i(t.matcap)),void 0!==t.alphaMap&&(s.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(s.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(s.bumpScale=t.bumpScale),void 0!==t.normalMap&&(s.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(s.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),s.normalScale=new J().fromArray(e)}return void 0!==t.displacementMap&&(s.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(s.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(s.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(s.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(s.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(s.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(s.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(s.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(s.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(s.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(s.envMap=i(t.envMap)),void 0!==t.envMapRotation&&s.envMapRotation.fromArray(t.envMapRotation),void 0!==t.envMapIntensity&&(s.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(s.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(s.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(s.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(s.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(s.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(s.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(s.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(s.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(s.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(s.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(s.clearcoatNormalScale=new J().fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(s.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(s.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(s.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(s.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(s.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(s.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(s.sheenRoughnessMap=i(t.sheenRoughnessMap)),s}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return al.createMaterialFromType(t)}static createMaterialFromType(t){return new({ShadowMaterial:np,SpriteMaterial:iO,RawShaderMaterial:nd,ShaderMaterial:im,PointsMaterial:sK,MeshPhysicalMaterial:nf,MeshStandardMaterial:nm,MeshPhongMaterial:ng,MeshToonMaterial:ny,MeshNormalMaterial:nx,MeshLambertMaterial:nb,MeshDepthMaterial:nv,MeshDistanceMaterial:nw,MeshBasicMaterial:eO,MeshMatcapMaterial:nM,LineDashedMaterial:nS,LineBasicMaterial:s$,Material:eR})[t]}}class au{static extractUrlBase(t){let e=t.lastIndexOf("/");return -1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t))?t:e+t}}class ac extends e5{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class ap extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(r.manager);n.setPath(r.path),n.setRequestHeader(r.requestHeader),n.setWithCredentials(r.withCredentials),n.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(e){s?s(e):O(e),r.manager.itemError(t)}},i,s)}parse(t){let e={},i={};function s(t,s){if(void 0!==e[s])return e[s];let r=t.interleavedBuffers[s],n=function(t,e){if(void 0!==i[e])return i[e];let s=new Uint32Array(t.arrayBuffers[e]).buffer;return i[e]=s,s}(t,r.buffer),a=new ik(S(r.type,n),r.stride);return a.uuid=r.uuid,e[s]=a,a}let r=t.isInstancedBufferGeometry?new ac:new e5,n=t.data.index;if(void 0!==n){let t=S(n.type,n.array);r.setIndex(new eD(t,1))}let a=t.data.attributes;for(let e in a){let i,n=a[e];if(n.isInterleavedBufferAttribute)i=new iR(s(t.data,n.data),n.itemSize,n.offset,n.normalized);else{let t=S(n.type,n.array);i=new(n.isInstancedBufferAttribute?si:eD)(t,n.itemSize,n.normalized)}void 0!==n.name&&(i.name=n.name),void 0!==n.usage&&i.setUsage(n.usage),r.setAttribute(e,i)}let o=t.data.morphAttributes;if(o)for(let e in o){let i=o[e],n=[];for(let e=0,r=i.length;e<r;e++){let r,a=i[e];r=a.isInterleavedBufferAttribute?new iR(s(t.data,a.data),a.itemSize,a.offset,a.normalized):new eD(S(a.type,a.array),a.itemSize,a.normalized),void 0!==a.name&&(r.name=a.name),n.push(r)}r.morphAttributes[e]=n}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);let h=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==h)for(let t=0,e=h.length;t!==e;++t){let e=h[t];r.addGroup(e.start,e.count,e.materialIndex)}let l=t.data.boundingSphere;return void 0!==l&&(r.boundingSphere=new tF().fromJSON(l)),t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class ad extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=""===this.path?au.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;let a=new nJ(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(i){let n=null;try{n=JSON.parse(i)}catch(e){void 0!==s&&s(e),e("ObjectLoader: Can't parse "+t+".",e.message);return}let a=n.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase()){void 0!==s&&s(Error("THREE.ObjectLoader: Can't load "+t)),O("ObjectLoader: Can't load "+t);return}r.parse(n,e)},i,s)}async loadAsync(t,e){let i=""===this.path?au.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;let s=new nJ(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);let r=JSON.parse(await s.loadAsync(t,e)),n=r.metadata;if(void 0===n||void 0===n.type||"geometry"===n.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(r)}parse(t,e){let i=this.parseAnimations(t.animations),s=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,s),n=this.parseImages(t.images,function(){void 0!==e&&e(h)}),a=this.parseTextures(t.textures,n),o=this.parseMaterials(t.materials,a),h=this.parseObject(t.object,r,o,a,i),l=this.parseSkeletons(t.skeletons,h);if(this.bindSkeletons(h,l),this.bindLightTargets(h),void 0!==e){let t=!1;for(let e in n)if(n[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(h)}return h}async parseAsync(t){let e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,i),r=await this.parseImagesAsync(t.images),n=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,n),o=this.parseObject(t.object,s,a,n,e),h=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,h),this.bindLightTargets(o),o}parseShapes(t){let e={};if(void 0!==t)for(let i=0,s=t.length;i<s;i++){let s=new r$().fromJSON(t[i]);e[s.uuid]=s}return e}parseSkeletons(t,e){let i={},s={};if(e.traverse(function(t){t.isBone&&(s[t.uuid]=t)}),void 0!==t)for(let e=0,r=t.length;e<r;e++){let r=new se().fromJSON(t[e],s);i[r.uuid]=r}return i}parseGeometries(t,e){let i={};if(void 0!==t){let s=new ap;for(let r=0,n=t.length;r<n;r++){let n,a=t[r];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":n=s.parse(a);break;default:a.type in nc?n=nc[a.type].fromJSON(a,e):R(`ObjectLoader: Unsupported geometry type "${a.type}"`)}n.uuid=a.uuid,void 0!==a.name&&(n.name=a.name),void 0!==a.userData&&(n.userData=a.userData),i[a.uuid]=n}}return i}parseMaterials(t,e){let i={},s={};if(void 0!==t){let r=new al;r.setTextures(e);for(let e=0,n=t.length;e<n;e++){let n=t[e];void 0===i[n.uuid]&&(i[n.uuid]=r.parse(n)),s[n.uuid]=i[n.uuid]}}return s}parseAnimations(t){let e={};if(void 0!==t)for(let i=0;i<t.length;i++){let s=t[i],r=nD.parse(s);e[r.uuid]=r}return e}parseImages(t,e){let i,s=this,r={};function n(t){if("string"==typeof t){var e;return e=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:s.resourcePath+t,s.manager.itemStart(e),i.load(e,function(){s.manager.itemEnd(e)},void 0,function(){s.manager.itemError(e),s.manager.itemEnd(e)})}return t.data?{data:S(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){(i=new nQ(new nU(e))).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){let i=t[e],s=i.url;if(Array.isArray(s)){let t=[];for(let e=0,i=s.length;e<i;e++){let i=n(s[e]);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new i9(i.data,i.width,i.height)))}r[i.uuid]=new th(t)}else{let t=n(i.url);r[i.uuid]=new th(t)}}}return r}async parseImagesAsync(t){let e,i=this,s={};async function r(t){if("string"==typeof t){let s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:i.resourcePath+t;return await e.loadAsync(s)}return t.data?{data:S(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){(e=new nQ(this.manager)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){let i=t[e],n=i.url;if(Array.isArray(n)){let t=[];for(let e=0,i=n.length;e<i;e++){let i=n[e],s=await r(i);null!==s&&(s instanceof HTMLImageElement?t.push(s):t.push(new i9(s.data,s.width,s.height)))}s[i.uuid]=new th(t)}else{let t=await r(i.url);s[i.uuid]=new th(t)}}}return s}parseTextures(t,e){function i(t,e){return"number"==typeof t?t:(R("ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}let s={};if(void 0!==t)for(let r=0,n=t.length;r<n;r++){let n,a=t[r];void 0===a.image&&R('ObjectLoader: No "image" specified for',a.uuid),void 0===e[a.image]&&R("ObjectLoader: Undefined image",a.image);let o=e[a.image],h=o.data;Array.isArray(h)?(n=new iM,6===h.length&&(n.needsUpdate=!0)):(n=h&&h.data?new i9:new tp,h&&(n.needsUpdate=!0)),n.source=o,n.uuid=a.uuid,void 0!==a.name&&(n.name=a.name),void 0!==a.mapping&&(n.mapping=i(a.mapping,am)),void 0!==a.channel&&(n.channel=a.channel),void 0!==a.offset&&n.offset.fromArray(a.offset),void 0!==a.repeat&&n.repeat.fromArray(a.repeat),void 0!==a.center&&n.center.fromArray(a.center),void 0!==a.rotation&&(n.rotation=a.rotation),void 0!==a.wrap&&(n.wrapS=i(a.wrap[0],af),n.wrapT=i(a.wrap[1],af)),void 0!==a.format&&(n.format=a.format),void 0!==a.internalFormat&&(n.internalFormat=a.internalFormat),void 0!==a.type&&(n.type=a.type),void 0!==a.colorSpace&&(n.colorSpace=a.colorSpace),void 0!==a.minFilter&&(n.minFilter=i(a.minFilter,ag)),void 0!==a.magFilter&&(n.magFilter=i(a.magFilter,ag)),void 0!==a.anisotropy&&(n.anisotropy=a.anisotropy),void 0!==a.flipY&&(n.flipY=a.flipY),void 0!==a.generateMipmaps&&(n.generateMipmaps=a.generateMipmaps),void 0!==a.premultiplyAlpha&&(n.premultiplyAlpha=a.premultiplyAlpha),void 0!==a.unpackAlignment&&(n.unpackAlignment=a.unpackAlignment),void 0!==a.compareFunction&&(n.compareFunction=a.compareFunction),void 0!==a.userData&&(n.userData=a.userData),s[a.uuid]=n}return s}parseObject(t,e,i,s,r){let n,a,o;function h(t){return void 0===e[t]&&R("ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){let e=[];for(let s=0,r=t.length;s<r;s++){let r=t[s];void 0===i[r]&&R("ObjectLoader: Undefined material",r),e.push(i[r])}return e}return void 0===i[t]&&R("ObjectLoader: Undefined material",t),i[t]}}function u(t){return void 0===s[t]&&R("ObjectLoader: Undefined texture",t),s[t]}switch(t.type){case"Scene":n=new iz,void 0!==t.background&&(Number.isInteger(t.background)?n.background=new ez(t.background):n.background=u(t.background)),void 0!==t.environment&&(n.environment=u(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?n.fog=new iI(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(n.fog=new iT(t.fog.color,t.fog.density)),""!==t.fog.name&&(n.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(n.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(n.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&n.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(n.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&n.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":n=new iv(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(n.focus=t.focus),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.filmGauge&&(n.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(n.filmOffset=t.filmOffset),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"OrthographicCamera":n=new ai(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(n.zoom=t.zoom),void 0!==t.view&&(n.view=Object.assign({},t.view));break;case"AmbientLight":n=new an(t.color,t.intensity);break;case"DirectionalLight":(n=new ar(t.color,t.intensity)).target=t.target||"";break;case"PointLight":n=new ae(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":n=new aa(t.color,t.intensity,t.width,t.height);break;case"SpotLight":(n=new n7(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay)).target=t.target||"";break;case"HemisphereLight":n=new n3(t.color,t.groundColor,t.intensity);break;case"LightProbe":n=new ah(new ao().fromArray(t.sh),t.intensity);break;case"SkinnedMesh":n=new i6(a=h(t.geometry),o=l(t.material)),void 0!==t.bindMode&&(n.bindMode=t.bindMode),void 0!==t.bindMatrix&&n.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(n.skeleton=t.skeleton);break;case"Mesh":n=new io(a=h(t.geometry),o=l(t.material));break;case"InstancedMesh":a=h(t.geometry),o=l(t.material);let c=t.count,p=t.instanceMatrix,d=t.instanceColor;(n=new su(a,o,c)).instanceMatrix=new si(new Float32Array(p.array),16),void 0!==d&&(n.instanceColor=new si(new Float32Array(d.array),d.itemSize));break;case"BatchedMesh":a=h(t.geometry),o=l(t.material),(n=new sF(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,o)).geometry=a,n.perObjectFrustumCulled=t.perObjectFrustumCulled,n.sortObjects=t.sortObjects,n._drawRanges=t.drawRanges,n._reservedRanges=t.reservedRanges,n._geometryInfo=t.geometryInfo.map(t=>{let e=null,i=null;return void 0!==t.boundingBox&&(e=new tv().fromJSON(t.boundingBox)),void 0!==t.boundingSphere&&(i=new tF().fromJSON(t.boundingSphere)),{...t,boundingBox:e,boundingSphere:i}}),n._instanceInfo=t.instanceInfo,n._availableInstanceIds=t._availableInstanceIds,n._availableGeometryIds=t._availableGeometryIds,n._nextIndexStart=t.nextIndexStart,n._nextVertexStart=t.nextVertexStart,n._geometryCount=t.geometryCount,n._maxInstanceCount=t.maxInstanceCount,n._maxVertexCount=t.maxVertexCount,n._maxIndexCount=t.maxIndexCount,n._geometryInitialized=t.geometryInitialized,n._matricesTexture=u(t.matricesTexture.uuid),n._indirectTexture=u(t.indirectTexture.uuid),void 0!==t.colorsTexture&&(n._colorsTexture=u(t.colorsTexture.uuid)),void 0!==t.boundingSphere&&(n.boundingSphere=new tF().fromJSON(t.boundingSphere)),void 0!==t.boundingBox&&(n.boundingBox=new tv().fromJSON(t.boundingBox));break;case"LOD":n=new iZ;break;case"Line":n=new sH(h(t.geometry),l(t.material));break;case"LineLoop":n=new sQ(h(t.geometry),l(t.material));break;case"LineSegments":n=new sY(h(t.geometry),l(t.material));break;case"PointCloud":case"Points":n=new s5(h(t.geometry),l(t.material));break;case"Sprite":n=new iq(l(t.material));break;case"Group":n=new iA;break;case"Bone":n=new i8;break;default:n=new eu}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.up&&n.up.fromArray(t.up),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(n.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(n.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children){let a=t.children;for(let t=0;t<a.length;t++)n.add(this.parseObject(a[t],e,i,s,r))}if(void 0!==t.animations){let e=t.animations;for(let t=0;t<e.length;t++){let i=e[t];n.animations.push(r[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(n.autoUpdate=t.autoUpdate);let e=t.levels;for(let t=0;t<e.length;t++){let i=e[t],s=n.getObjectByProperty("uuid",i.object);void 0!==s&&n.addLevel(s,i.distance,i.hysteresis)}}return n}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse(function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){let i=e[t.skeleton];void 0===i?R("ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){let i=e.target,s=t.getObjectByProperty("uuid",i);void 0!==s?e.target=s:e.target=new eu}})}}let am={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},af={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},ag={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},ay=new WeakMap;class ax extends nG{constructor(t){super(t),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&R("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&R("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,i,s){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,n=nj.get(`image-bitmap:${t}`);if(void 0!==n)return(r.manager.itemStart(t),n.then)?void n.then(i=>{if(!0!==ay.has(n))return e&&e(i),r.manager.itemEnd(t),i;s&&s(ay.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);let a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return nj.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){s&&s(e),ay.set(o,e),nj.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nj.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ab{static getContext(){return void 0===s&&(s=new(window.AudioContext||window.webkitAudioContext)),s}static setContext(t){s=t}}class av extends nG{constructor(t){super(t)}load(t,e,i,s){let r=this,n=new nJ(this.manager);function a(e){s?s(e):O(e),r.manager.itemError(t)}n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(t,function(t){try{let i=t.slice(0);ab.getContext().decodeAudioData(i,function(t){e(t)}).catch(a)}catch(t){a(t)}},i,s)}}let aw=new tH,aM=new tH,aS=new tH;class aA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new iv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new iv,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){let i,s;e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,aS.copy(t.projectionMatrix);let r=e.eyeSep/2,n=r*e.near/e.focus,a=e.near*Math.tan($*e.fov*.5)/e.zoom;aM.elements[12]=-r,aw.elements[12]=r,i=-a*e.aspect+n,s=a*e.aspect+n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraL.projectionMatrix.copy(aS),i=-a*e.aspect-n,s=a*e.aspect-n,aS.elements[0]=2*e.near/(s-i),aS.elements[8]=(s+i)/(s-i),this.cameraR.projectionMatrix.copy(aS)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(aM),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(aw)}}class a_ extends iv{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class aC{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}let aT=new Z,aI=new X,az=new Z,ak=new Z,aB=new Z;class aR extends eu{constructor(){super(),this.type="AudioListener",this.context=ab.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new aC}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);let e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(aT,aI,az),ak.set(0,0,-1).applyQuaternion(aI),aB.set(0,1,0).applyQuaternion(aI),e.positionX){let t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(aT.x,t),e.positionY.linearRampToValueAtTime(aT.y,t),e.positionZ.linearRampToValueAtTime(aT.z,t),e.forwardX.linearRampToValueAtTime(ak.x,t),e.forwardY.linearRampToValueAtTime(ak.y,t),e.forwardZ.linearRampToValueAtTime(ak.z,t),e.upX.linearRampToValueAtTime(aB.x,t),e.upY.linearRampToValueAtTime(aB.y,t),e.upZ.linearRampToValueAtTime(aB.z,t)}else e.setPosition(aT.x,aT.y,aT.z),e.setOrientation(ak.x,ak.y,ak.z,aB.x,aB.y,aB.z)}}class aO extends eu{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void R("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void R("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(t=0){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(R("Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){return!1===this.hasPlaybackControl?void R("Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return(super.copy(t,e),"buffer"!==t.sourceType)?R("Audio: Audio source type cannot be copied."):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice()),this}clone(t){return new this.constructor(this.listener).copy(this,t)}}let aE=new Z,aP=new X,aL=new Z,aN=new Z;class aF extends aO{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(aE,aP,aL),aN.set(0,0,1).applyQuaternion(aP);let e=this.panner;if(e.positionX){let t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(aE.x,t),e.positionY.linearRampToValueAtTime(aE.y,t),e.positionZ.linearRampToValueAtTime(aE.z,t),e.orientationX.linearRampToValueAtTime(aN.x,t),e.orientationY.linearRampToValueAtTime(aN.y,t),e.orientationZ.linearRampToValueAtTime(aN.z,t)}else e.setPosition(aE.x,aE.y,aE.z),e.setOrientation(aN.x,aN.y,aN.z)}}class a${constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0,e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}class aV{constructor(t,e,i){let s,r,n;switch(this.binding=t,this.valueSize=i,e){case"quaternion":s=this._slerp,r=this._slerpAdditive,n=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,n=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:s=this._lerp,r=this._lerpAdditive,n=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=n,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let i=this.buffer,s=this.valueSize,r=t*s+s,n=this.cumulativeWeight;if(0===n){for(let t=0;t!==s;++t)i[r+t]=i[t];n=e}else{n+=e;let t=e/n;this._mixBufferRegion(i,r,0,t,s)}this.cumulativeWeight=n}accumulateAdditive(t){let e=this.buffer,i=this.valueSize,s=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,s,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,i=this.buffer,s=t*e+e,r=this.cumulativeWeight,n=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let t=e*this._origIndex;this._mixBufferRegion(i,s,t,1-r,e)}n>0&&this._mixBufferRegionAdditive(i,s,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,s);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,s=i*this._origIndex;t.getValue(e,s);for(let t=i;t!==s;++t)e[t]=e[s+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,s,r){if(s>=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,s){X.slerpFlat(t,e,t,e,t,i,s)}_slerpAdditive(t,e,i,s,r){let n=this._workIndex*r;X.multiplyQuaternionsFlat(t,n,t,e,t,i),X.slerpFlat(t,e,t,e,t,n,s)}_lerp(t,e,i,s,r){let n=1-s;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*n+t[i+a]*s}}_lerpAdditive(t,e,i,s,r){for(let n=0;n!==r;++n){let r=e+n;t[r]=t[r]+t[i+n]*s}}}let aD="\\[\\]\\.:\\/",aj=RegExp("["+aD+"]","g"),aU="[^"+aD+"]",aW="[^"+aD.replace("\\.","")+"]",aG=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",aU)+/(WCOD+)?/.source.replace("WCOD",aW)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aU)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aU)+"$"),aq=["material","materials","bones","map"];class aH{constructor(t,e,i){this.path=e,this.parsedPath=i||aH.parseTrackName(e),this.node=aH.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new aH.Composite(t,e,i):new aH(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(aj,"")}static parseTrackName(t){let e=aG.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let t=i.nodeName.substring(s+1);-1!==aq.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let s=0;s<t.length;s++){let r=t[s];if(r.name===e||r.uuid===e)return r;let n=i(r.children);if(n)return n}return null},s=i(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)t[e++]=i[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,i=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=aH.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void R("PropertyBinding: No target node found for track: "+this.path+".");if(i){let s=e.objectIndex;switch(i){case"materials":if(!t.material)return void O("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void O("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void O("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===s){s=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void O("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void O("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void O("PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==s){if(void 0===t[s])return void O("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[s]}}let n=t[s];if(void 0===n)return void O("PropertyBinding: Trying to update property for track: "+e.nodeName+"."+s+" but it wasn't found.",t);let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===s){if(!t.geometry)return void O("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void O("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=r}else void 0!==n.fromArray&&void 0!==n.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(o=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=s;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}aH.Composite=class{constructor(t,e,i){const s=i||aH.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];void 0!==s&&s.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},aH.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},aH.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},aH.prototype.GetterByBindingType=[aH.prototype._getValue_direct,aH.prototype._getValue_array,aH.prototype._getValue_arrayElement,aH.prototype._getValue_toArray],aH.prototype.SetterByBindingTypeAndVersioning=[[aH.prototype._setValue_direct,aH.prototype._setValue_direct_setNeedsUpdate,aH.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[aH.prototype._setValue_array,aH.prototype._setValue_array_setNeedsUpdate,aH.prototype._setValue_array_setMatrixWorldNeedsUpdate],[aH.prototype._setValue_arrayElement,aH.prototype._setValue_arrayElement_setNeedsUpdate,aH.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[aH.prototype._setValue_fromArray,aH.prototype._setValue_fromArray_setNeedsUpdate,aH.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class aJ{constructor(){this.isAnimationObjectGroup=!0,this.uuid=D(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){let t=this._objects,e=this._indicesByUUID,i=this._paths,s=this._parsedPaths,r=this._bindings,n=r.length,a,o=t.length,h=this.nCachedObjects_;for(let l=0,u=arguments.length;l!==u;++l){let u=arguments[l],c=u.uuid,p=e[c];if(void 0===p){p=o++,e[c]=p,t.push(u);for(let t=0;t!==n;++t)r[t].push(new aH(u,i[t],s[t]))}else if(p<h){a=t[p];let o=--h,l=t[o];e[l.uuid]=p,t[p]=l,e[c]=o,t[o]=u;for(let t=0;t!==n;++t){let e=r[t],n=e[o],a=e[p];e[p]=n,void 0===a&&(a=new aH(u,i[t],s[t])),e[o]=a}}else t[p]!==a&&O("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_;for(let n=0,a=arguments.length;n!==a;++n){let a=arguments[n],o=a.uuid,h=e[o];if(void 0!==h&&h>=r){let n=r++,l=t[n];e[l.uuid]=h,t[h]=l,e[o]=n,t[n]=a;for(let t=0;t!==s;++t){let e=i[t],s=e[n],r=e[h];e[h]=s,e[n]=r}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,i=this._bindings,s=i.length,r=this.nCachedObjects_,n=t.length;for(let a=0,o=arguments.length;a!==o;++a){let o=arguments[a],h=o.uuid,l=e[h];if(void 0!==l)if(delete e[h],l<r){let a=--r,o=t[a],h=--n,u=t[h];e[o.uuid]=l,t[l]=o,e[u.uuid]=a,t[a]=u,t.pop();for(let t=0;t!==s;++t){let e=i[t],s=e[a],r=e[h];e[l]=s,e[a]=r,e.pop()}}else{let r=--n,a=t[r];r>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0;t!==s;++t){let e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){let i=this._bindingsIndicesByPath,s=i[t],r=this._bindings;if(void 0!==s)return r[s];let n=this._paths,a=this._parsedPaths,o=this._objects,h=o.length,l=this.nCachedObjects_,u=Array(h);s=r.length,i[t]=s,n.push(t),a.push(e),r.push(u);for(let i=l,s=o.length;i!==s;++i){let s=o[i];u[i]=new aH(s,t,e)}return u}unsubscribe_(t){let e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){let s=this._paths,r=this._parsedPaths,n=this._bindings,a=n.length-1,o=n[a];e[t[a]]=i,n[i]=o,n.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class aX{constructor(t,e,i=null,s=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=s;const r=e.tracks,n=r.length,a=Array(n),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==n;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){let i=this._clip.duration,s=t._clip.duration;t.warp(1,s/i,e),this.warp(i/s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let s=this._mixer,r=s.time,n=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=r,o[1]=r+i,h[0]=t/n,h[1]=e/n,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,s){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let s=(t-r)*i;s<0||0===i?e=0:(this._startTime=null,e=i*s)}e*=this._updateTimeScale(t);let n=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(n),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(n),e[i].accumulate(s,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let s=i.evaluate(t)[0];e*=s,t>i.parameterPositions[1]&&(this.stopFading(),0===s&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,s=this.time+t,r=this._loopCount,n=2202===i;if(0===t)return -1===r?s:n&&(1&r)==1?e-s:s;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(s>=e)s=e;else if(s<0)s=0;else{this.time=s;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,n)):this._setEndings(0===this.repetitions,!0,n)),s>=e||s<0){let i=Math.floor(s/e);s-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=t>0?e:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,n)}else this._setEndings(!1,!1,n);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(n&&(1&r)==1)return e-s}return s}_setEndings(t,e,i){let s=this._interpolantSettings;i?(s.endingStart=2401,s.endingEnd=2401):(t?s.endingStart=this.zeroSlopeAtStart?2401:2400:s.endingStart=2402,e?s.endingEnd=this.zeroSlopeAtEnd?2401:2400:s.endingEnd=2402)}_scheduleFading(t,e,i){let s=this._mixer,r=s.time,n=this._weightInterpolant;null===n&&(n=s._lendControlInterpolant(),this._weightInterpolant=n);let a=n.parameterPositions,o=n.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}let aZ=new Float32Array(1);class aY extends L{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,s=t._clip.tracks,r=s.length,n=t._propertyBindings,a=t._interpolants,o=i.uuid,h=this._bindingsByRootAndName,l=h[o];void 0===l&&(l={},h[o]=l);for(let t=0;t!==r;++t){let r=s[t],h=r.name,u=l[h];if(void 0!==u)++u.referenceCount,n[t]=u;else{if(void 0!==(u=n[t])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,h));continue}let s=e&&e._propertyBindings[t].binding.parsedPath;u=new aV(aH.create(i,h,s),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,h),n[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){let s=this._actions,r=this._actionsByClip,n=r[e];if(void 0===n)n={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=n;else{let e=n.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=s.length,s.push(t),n.actionByRoot[i]=t}_removeInactiveAction(t){let e=this._actions,i=e[e.length-1],s=t._cacheIndex;i._cacheIndex=s,e[s]=i,e.pop(),t._cacheIndex=null;let r=t._clip.uuid,n=this._actionsByClip,a=n[r],o=a.knownActions,h=o[o.length-1],l=t._byClipCacheIndex;h._byClipCacheIndex=l,o[l]=h,o.pop(),t._byClipCacheIndex=null;let u=a.actionByRoot,c=(t._localRoot||this._root).uuid;delete u[c],0===o.length&&delete n[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){let e=this._actions,i=t._cacheIndex,s=this._nActiveActions++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){let e=this._actions,i=t._cacheIndex,s=--this._nActiveActions,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){let s=this._bindingsByRootAndName,r=this._bindings,n=s[e];void 0===n&&(n={},s[e]=n),n[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){let e=this._bindings,i=t.binding,s=i.rootNode.uuid,r=i.path,n=this._bindingsByRootAndName,a=n[s],o=e[e.length-1],h=t._cacheIndex;o._cacheIndex=h,e[h]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete n[s]}_lendBinding(t){let e=this._bindings,i=t._cacheIndex,s=this._nActiveBindings++,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){let e=this._bindings,i=t._cacheIndex,s=--this._nActiveBindings,r=e[s];t._cacheIndex=s,e[s]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&((i=new nB(new Float32Array(2),new Float32Array(2),1,aZ)).__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){let e=this._controlInterpolants,i=t.__cacheIndex,s=--this._nActiveControlInterpolants,r=e[s];t.__cacheIndex=s,e[s]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){let s=e||this._root,r=s.uuid,n="string"==typeof t?nD.findByName(s,t):t,a=null!==n?n.uuid:t,o=this._actionsByClip[a],h=null;if(void 0===i&&(i=null!==n?n.blendMode:2500),void 0!==o){let t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;h=o.knownActions[0],null===n&&(n=h._clip)}if(null===n)return null;let l=new aX(this,n,e,i);return this._bindAction(l,h),this._addInactiveAction(l,a,r),l}existingAction(t,e){let i=e||this._root,s=i.uuid,r="string"==typeof t?nD.findByName(i,t):t,n=r?r.uuid:t,a=this._actionsByClip[n];return void 0!==a&&a.actionByRoot[s]||null}stopAllAction(){let t=this._actions,e=this._nActiveActions;for(let i=e-1;i>=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,s=this.time+=t,r=Math.sign(t),n=this._accuIndex^=1;for(let a=0;a!==i;++a)e[a]._update(s,t,r,n);let a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(n);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,i=t.uuid,s=this._actionsByClip,r=s[i];if(void 0!==r){let t=r.knownActions;for(let i=0,s=t.length;i!==s;++i){let s=t[i];this._deactivateAction(s);let r=s._cacheIndex,n=e[e.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,n._cacheIndex=r,e[r]=n,e.pop(),this._removeInactiveBindingsForAction(s)}delete s[i]}}uncacheRoot(t){let e=t.uuid,i=this._actionsByClip;for(let t in i){let s=i[t].actionByRoot[e];void 0!==s&&(this._deactivateAction(s),this._removeInactiveAction(s))}let s=this._bindingsByRootAndName[e];if(void 0!==s)for(let t in s){let e=s[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){let i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class aQ extends tm{constructor(t=1,e=1,i=1,s={}){super(t,e,s),this.isRenderTarget3D=!0,this.depth=i,this.texture=new tx(null,t,e,i),this._setTextureOptions(s),this.texture.isRenderTargetTexture=!0}}class aK{constructor(t){this.value=t}clone(){return new aK(void 0===this.value.clone?this.value:this.value.clone())}}let a0=0;class a1 extends L{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:a0++}),this.name="",this.usage=35044,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){let e=this.uniforms.indexOf(t);return -1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;let e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++){let i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<i.length;t++)this.uniforms.push(i[t].clone())}return this}clone(){return new this.constructor().copy(this)}}class a2 extends ik{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class a3{constructor(t,e,i,s,r,n=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=s,this.count=r,this.normalized=n,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}let a5=new tH;class a4{constructor(t,e,i=0,s=1/0){this.ray=new tq(t,e),this.near=i,this.far=s,this.camera=null,this.layers=new t5,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):O("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return a5.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(a5),this}intersectObject(t,e=!0,i=[]){return a8(t,this,i,e),i.sort(a6),i}intersectObjects(t,e=!0,i=[]){for(let s=0,r=t.length;s<r;s++)a8(t[s],this,i,e);return i.sort(a6),i}}function a6(t,e){return t.distance-e.distance}function a8(t,e,i,s){let r=!0;if(t.layers.test(e.layers)&&!1===t.raycast(e,i)&&(r=!1),!0===r&&!0===s){let s=t.children;for(let t=0,r=s.length;t<r;t++)a8(s[t],e,i,!0)}}class a9{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,void 0!==t.hidden&&(this._pageVisibilityHandler=a7.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==t?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function a7(){!1===this._document.hidden&&this.reset()}class ot{constructor(t=1,e=0,i=0){this.radius=t,this.phi=e,this.theta=i}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=j(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(j(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class oe{constructor(t=1,e=0,i=0){this.radius=t,this.theta=e,this.y=i}set(t,e,i){return this.radius=t,this.theta=e,this.y=i,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}clone(){return new this.constructor().copy(this)}}class oi{constructor(t,e,i,s){oi.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,e,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let i=0;i<4;i++)this.elements[i]=t[i+e];return this}set(t,e,i,s){let r=this.elements;return r[0]=t,r[2]=e,r[1]=i,r[3]=s,this}}let os=new J;class or{constructor(t=new J(Infinity,Infinity),e=new J(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=os.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,os).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}let on=new Z,oa=new Z,oo=new Z,oh=new Z,ol=new Z,ou=new Z,oc=new Z;class op{constructor(t=new Z,e=new Z){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){on.subVectors(t,this.start),oa.subVectors(this.end,this.start);let i=oa.dot(oa),s=oa.dot(on)/i;return e&&(s=j(s,0,1)),s}closestPointToPoint(t,e,i){let s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=ou,i=oc){let s,r,n=1e-8*1e-8,a=this.start,o=t.start,h=this.end,l=t.end;oo.subVectors(h,a),oh.subVectors(l,o),ol.subVectors(a,o);let u=oo.dot(oo),c=oh.dot(oh),p=oh.dot(ol);if(u<=n&&c<=n)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=n)s=0,r=j(r=p/c,0,1);else{let t=oo.dot(ol);if(c<=n)r=0,s=j(-t/u,0,1);else{let e=oo.dot(oh),i=u*c-e*e;s=0!==i?j((e*p-t*c)/i,0,1):0,(r=(e*s+p)/c)<0?(r=0,s=j(-t/u,0,1)):r>1&&(r=1,s=j((e-t)/u,0,1))}}return e.copy(a).add(oo.multiplyScalar(s)),i.copy(o).add(oh.multiplyScalar(r)),e.sub(i),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let od=new Z;class om extends eu{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new e5,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1;t<32;t++,e++){const i=t/32*Math.PI*2,r=e/32*Math.PI*2;s.push(Math.cos(i),Math.sin(i),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new eZ(s,3));const r=new s$({fog:!1,toneMapped:!1});this.cone=new sY(i,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),od.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(od),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let of=new Z,og=new tH,oy=new tH;class ox extends sY{constructor(t){const e=function t(e){let i=[];!0===e.isBone&&i.push(e);for(let s=0;s<e.children.length;s++)i.push(...t(e.children[s]));return i}(t),i=new e5,s=[],r=[];for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}i.setAttribute("position",new eZ(s,3)),i.setAttribute("color",new eZ(r,3)),super(i,new s$({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;const n=new ez(255),a=new ez(65280);this.setColors(n,a)}updateMatrixWorld(t){let e=this.bones,i=this.geometry,s=i.getAttribute("position");oy.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){let r=e[t];r.parent&&r.parent.isBone&&(og.multiplyMatrices(oy,r.matrixWorld),of.setFromMatrixPosition(og),s.setXYZ(i,of.x,of.y,of.z),og.multiplyMatrices(oy,r.parent.matrixWorld),of.setFromMatrixPosition(og),s.setXYZ(i+1,of.x,of.y,of.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){let i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,t.r,t.g,t.b),i.setXYZ(s+1,e.r,e.g,e.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ob extends io{constructor(t,e,i){super(new nr(e,4,2),new eO({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}let ov=new Z,ow=new ez,oM=new ez;class oS extends eu{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const s=new nt(e);s.rotateY(.5*Math.PI),this.material=new eO({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=new Float32Array(3*s.getAttribute("position").count);s.setAttribute("color",new eD(r,3)),this.add(new io(s,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let e=t.geometry.getAttribute("color");ow.copy(this.light.color),oM.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){let s=t<i/2?ow:oM;e.setXYZ(t,s.r,s.g,s.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(ov.setFromMatrixPosition(this.light.matrixWorld).negate())}}class oA extends sY{constructor(t=10,e=10,i=4473924,s=8947848){i=new ez(i),s=new ez(s);const r=e/2,n=t/e,a=t/2,o=[],h=[];for(let t=0,l=0,u=-a;t<=e;t++,u+=n){o.push(-a,0,u,a,0,u),o.push(u,0,-a,u,0,a);const e=t===r?i:s;e.toArray(h,l),l+=3,e.toArray(h,l),l+=3,e.toArray(h,l),l+=3,e.toArray(h,l),l+=3}const l=new e5;l.setAttribute("position",new eZ(o,3)),l.setAttribute("color",new eZ(h,3)),super(l,new s$({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class o_ extends sY{constructor(t=10,e=16,i=8,s=64,r=4473924,n=8947848){r=new ez(r),n=new ez(n);const a=[],o=[];if(e>1)for(let i=0;i<e;i++){const s=i/e*(2*Math.PI),h=Math.sin(s)*t,l=Math.cos(s)*t;a.push(0,0,0),a.push(h,0,l);const u=1&i?r:n;o.push(u.r,u.g,u.b),o.push(u.r,u.g,u.b)}for(let e=0;e<i;e++){const h=1&e?r:n,l=t-t/i*e;for(let t=0;t<s;t++){let e=t/s*(2*Math.PI),i=Math.sin(e)*l,r=Math.cos(e)*l;a.push(i,0,r),o.push(h.r,h.g,h.b),i=Math.sin(e=(t+1)/s*(2*Math.PI))*l,r=Math.cos(e)*l,a.push(i,0,r),o.push(h.r,h.g,h.b)}}const h=new e5;h.setAttribute("position",new eZ(a,3)),h.setAttribute("color",new eZ(o,3)),super(h,new s$({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}let oC=new Z,oT=new Z,oI=new Z;class oz extends eu{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let s=new e5;s.setAttribute("position",new eZ([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new s$({fog:!1,toneMapped:!1});this.lightPlane=new sH(s,r),this.add(this.lightPlane),(s=new e5).setAttribute("position",new eZ([0,0,0,0,0,1],3)),this.targetLine=new sH(s,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),oC.setFromMatrixPosition(this.light.matrixWorld),oT.setFromMatrixPosition(this.light.target.matrixWorld),oI.subVectors(oT,oC),this.lightPlane.lookAt(oT),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(oT),this.targetLine.scale.z=oI.length()}}let ok=new Z,oB=new ig;class oR extends sY{constructor(t){const e=new e5,i=new s$({color:0xffffff,vertexColors:!0,toneMapped:!1}),s=[],r=[],n={};function a(t,e){o(t),o(e)}function o(t){s.push(0,0,0),r.push(0,0,0),void 0===n[t]&&(n[t]=[]),n[t].push(s.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new eZ(s,3)),e.setAttribute("color",new eZ(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update();const h=new ez(0xffaa00),l=new ez(0xff0000),u=new ez(43775),c=new ez(0xffffff),p=new ez(3355443);this.setColors(h,l,u,c,p)}setColors(t,e,i,s,r){let n=this.geometry.getAttribute("color");return n.setXYZ(0,t.r,t.g,t.b),n.setXYZ(1,t.r,t.g,t.b),n.setXYZ(2,t.r,t.g,t.b),n.setXYZ(3,t.r,t.g,t.b),n.setXYZ(4,t.r,t.g,t.b),n.setXYZ(5,t.r,t.g,t.b),n.setXYZ(6,t.r,t.g,t.b),n.setXYZ(7,t.r,t.g,t.b),n.setXYZ(8,t.r,t.g,t.b),n.setXYZ(9,t.r,t.g,t.b),n.setXYZ(10,t.r,t.g,t.b),n.setXYZ(11,t.r,t.g,t.b),n.setXYZ(12,t.r,t.g,t.b),n.setXYZ(13,t.r,t.g,t.b),n.setXYZ(14,t.r,t.g,t.b),n.setXYZ(15,t.r,t.g,t.b),n.setXYZ(16,t.r,t.g,t.b),n.setXYZ(17,t.r,t.g,t.b),n.setXYZ(18,t.r,t.g,t.b),n.setXYZ(19,t.r,t.g,t.b),n.setXYZ(20,t.r,t.g,t.b),n.setXYZ(21,t.r,t.g,t.b),n.setXYZ(22,t.r,t.g,t.b),n.setXYZ(23,t.r,t.g,t.b),n.setXYZ(24,e.r,e.g,e.b),n.setXYZ(25,e.r,e.g,e.b),n.setXYZ(26,e.r,e.g,e.b),n.setXYZ(27,e.r,e.g,e.b),n.setXYZ(28,e.r,e.g,e.b),n.setXYZ(29,e.r,e.g,e.b),n.setXYZ(30,e.r,e.g,e.b),n.setXYZ(31,e.r,e.g,e.b),n.setXYZ(32,i.r,i.g,i.b),n.setXYZ(33,i.r,i.g,i.b),n.setXYZ(34,i.r,i.g,i.b),n.setXYZ(35,i.r,i.g,i.b),n.setXYZ(36,i.r,i.g,i.b),n.setXYZ(37,i.r,i.g,i.b),n.setXYZ(38,s.r,s.g,s.b),n.setXYZ(39,s.r,s.g,s.b),n.setXYZ(40,r.r,r.g,r.b),n.setXYZ(41,r.r,r.g,r.b),n.setXYZ(42,r.r,r.g,r.b),n.setXYZ(43,r.r,r.g,r.b),n.setXYZ(44,r.r,r.g,r.b),n.setXYZ(45,r.r,r.g,r.b),n.setXYZ(46,r.r,r.g,r.b),n.setXYZ(47,r.r,r.g,r.b),n.setXYZ(48,r.r,r.g,r.b),n.setXYZ(49,r.r,r.g,r.b),n.needsUpdate=!0,this}update(){let t,e,i=this.geometry,s=this.pointMap;if(oB.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)t=1,e=0;else if(2e3===this.camera.coordinateSystem)t=-1,e=1;else if(2001===this.camera.coordinateSystem)t=0,e=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);oO("c",s,i,oB,0,0,t),oO("t",s,i,oB,0,0,e),oO("n1",s,i,oB,-1,-1,t),oO("n2",s,i,oB,1,-1,t),oO("n3",s,i,oB,-1,1,t),oO("n4",s,i,oB,1,1,t),oO("f1",s,i,oB,-1,-1,e),oO("f2",s,i,oB,1,-1,e),oO("f3",s,i,oB,-1,1,e),oO("f4",s,i,oB,1,1,e),oO("u1",s,i,oB,.7,1.1,t),oO("u2",s,i,oB,-.7,1.1,t),oO("u3",s,i,oB,0,2,t),oO("cf1",s,i,oB,-1,0,e),oO("cf2",s,i,oB,1,0,e),oO("cf3",s,i,oB,0,-1,e),oO("cf4",s,i,oB,0,1,e),oO("cn1",s,i,oB,-1,0,t),oO("cn2",s,i,oB,1,0,t),oO("cn3",s,i,oB,0,-1,t),oO("cn4",s,i,oB,0,1,t),i.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function oO(t,e,i,s,r,n,a){ok.set(r,n,a).unproject(s);let o=e[t];if(void 0!==o){let t=i.getAttribute("position");for(let e=0,i=o.length;e<i;e++)t.setXYZ(o[e],ok.x,ok.y,ok.z)}}let oE=new tv;class oP extends sY{constructor(t,e=0xffff00){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new Float32Array(24),r=new e5;r.setIndex(new eD(i,1)),r.setAttribute("position",new eD(s,3)),super(r,new s$({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&oE.setFromObject(this.object),oE.isEmpty())return;let t=oE.min,e=oE.max,i=this.geometry.attributes.position,s=i.array;s[0]=e.x,s[1]=e.y,s[2]=e.z,s[3]=t.x,s[4]=e.y,s[5]=e.z,s[6]=t.x,s[7]=t.y,s[8]=e.z,s[9]=e.x,s[10]=t.y,s[11]=e.z,s[12]=e.x,s[13]=e.y,s[14]=t.z,s[15]=t.x,s[16]=e.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=e.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oL extends sY{constructor(t,e=0xffff00){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),s=new e5;s.setIndex(new eD(i,1)),s.setAttribute("position",new eZ([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(s,new s$({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){let e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class oN extends sH{constructor(t,e=1,i=0xffff00){const s=new e5;s.setAttribute("position",new eZ([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),s.computeBoundingSphere(),super(s,new s$({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new e5;r.setAttribute("position",new eZ([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new io(r,new eO({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}let oF=new Z;class o$ extends eu{constructor(t=new Z(0,0,1),e=new Z(0,0,0),i=1,s=0xffff00,a=.2*i,o=.2*a){super(),this.type="ArrowHelper",void 0===r&&((r=new e5).setAttribute("position",new eZ([0,0,0,0,1,0],3)),(n=new rl(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new sH(r,new s$({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new io(n,new eO({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,a,o)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oF.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oF,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class oV extends sY{constructor(t=1){const e=new e5;e.setAttribute("position",new eZ([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],3)),e.setAttribute("color",new eZ([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(e,new s$({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let s=new ez,r=this.geometry.attributes.color.array;return s.set(t),s.toArray(r,0),s.toArray(r,3),s.set(e),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oD{constructor(){this.type="ShapePath",this.color=new ez,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new rF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.currentPath.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,r,n){return this.currentPath.bezierCurveTo(t,e,i,s,r,n),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){let e,i,s,r,n,a=r3.isClockWise,o=this.subPaths;if(0===o.length)return[];let h=[];if(1===o.length)return i=o[0],(s=new r$).curves=i.curves,h.push(s),h;let l=!a(o[0].getPoints());l=t?!l:l;let u=[],c=[],p=[],d=0;c[0]=void 0,p[d]=[];for(let s=0,n=o.length;s<n;s++)e=a(r=(i=o[s]).getPoints()),(e=t?!e:e)?(!l&&c[d]&&d++,c[d]={s:new r$,p:r},c[d].s.curves=i.curves,l&&d++,p[d]=[]):p[d].push({h:i,p:r[0]});if(!c[0])return function(t){let e=[];for(let i=0,s=t.length;i<s;i++){let s=t[i],r=new r$;r.curves=s.curves,e.push(r)}return e}(o);if(c.length>1){let t=!1,e=0;for(let t=0,e=c.length;t<e;t++)u[t]=[];for(let i=0,s=c.length;i<s;i++){let s=p[i];for(let r=0;r<s.length;r++){let n=s[r],a=!0;for(let s=0;s<c.length;s++)(function(t,e){let i=e.length,s=!1;for(let r=i-1,n=0;n<i;r=n++){let i=e[r],a=e[n],o=a.x-i.x,h=a.y-i.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(i=e[n],o=-o,a=e[r],h=-h),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{let e=h*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;s=!s}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return s})(n.p,c[s].p)&&(i!==s&&e++,a?(a=!1,u[s].push(n)):t=!0);a&&u[i].push(n)}}e>0&&!1===t&&(p=u)}for(let t=0,e=c.length;t<e;t++){s=c[t].s,h.push(s),n=p[t];for(let t=0,e=n.length;t<e;t++)s.holes.push(n[t].h)}return h}}class oj extends L{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){void 0===t?R("Controls: connect() now requires an element."):(null!==this.domElement&&this.disconnect(),this.domElement=t)}disconnect(){}dispose(){}update(){}}function oU(t,e,i,s){let r=function(t){switch(t){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${t}.`)}(s);switch(i){case 1021:return t*e;case 1028:case 1029:return t*e/r.components*r.byteLength;case 1030:case 1031:return t*e*2/r.components*r.byteLength;case 1022:return t*e*3/r.components*r.byteLength;case 1023:case 1033:return t*e*4/r.components*r.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case 35841:case 35843:return Math.max(t,16)*Math.max(e,8)/4;case 35840:case 35842:return Math.max(t,8)*Math.max(e,8)/2;case 37809:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case 37810:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case 37811:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case 37812:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case 37813:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case 37814:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case 37815:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case 37816:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case 37817:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case 37818:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case 37819:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case 37820:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case 37821:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(t/4)*Math.ceil(e/4)*16;case 36283:case 36284:return Math.ceil(t/4)*Math.ceil(e/4)*8}throw Error(`Unable to determine texture byte length for ${i} format.`)}class oW{static contain(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}static cover(t,e){let i;return(i=t.image&&t.image.width?t.image.width/t.image.height:1)>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}static fill(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}static getByteLength(t,e,i,s){return oU(t,e,i,s)}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"u">typeof window&&(window.__THREE__?R("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182"),t.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>an,"AnimationAction",()=>aX,"AnimationClip",()=>nD,"AnimationLoader",()=>nX,"AnimationMixer",()=>aY,"AnimationObjectGroup",()=>aJ,"AnimationUtils",()=>nI,"ArcCurve",()=>rb,"ArrayCamera",()=>a_,"ArrowHelper",()=>o$,"AttachedBindMode",()=>p,"Audio",()=>aO,"AudioAnalyser",()=>a$,"AudioContext",()=>ab,"AudioListener",()=>aR,"AudioLoader",()=>av,"AxesHelper",()=>oV,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>sF,"Bone",()=>i8,"BooleanKeyframeTrack",()=>nE,"Box2",()=>or,"Box3",()=>tv,"Box3Helper",()=>oL,"BoxGeometry",()=>il,"BoxHelper",()=>oP,"BufferAttribute",()=>eD,"BufferGeometry",()=>e5,"BufferGeometryLoader",()=>ap,"ByteType",()=>1010,"Cache",()=>nj,"Camera",()=>ig,"CameraHelper",()=>oR,"CanvasTexture",()=>ri,"CapsuleGeometry",()=>ra,"CatmullRomCurve3",()=>r_,"CineonToneMapping",()=>3,"CircleGeometry",()=>ro,"ClampToEdgeWrapping",()=>1001,"Clock",()=>aC,"Color",()=>ez,"ColorKeyframeTrack",()=>nP,"ColorManagement",()=>ts,"CompressedArrayTexture",()=>rt,"CompressedCubeTexture",()=>re,"CompressedTexture",()=>s7,"CompressedTextureLoader",()=>nZ,"ConeGeometry",()=>rl,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>oj,"CubeCamera",()=>iw,"CubeDepthTexture",()=>rr,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>iM,"CubeTextureLoader",()=>nK,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>rz,"CubicBezierCurve3",()=>rk,"CubicInterpolant",()=>nk,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>ry,"CurvePath",()=>rN,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>rh,"Cylindrical",()=>oe,"Data3DTexture",()=>tx,"DataArrayTexture",()=>tg,"DataTexture",()=>i9,"DataTextureLoader",()=>n0,"DataUtils",()=>eN,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>nW,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>rs,"DetachedBindMode",()=>d,"DirectionalLight",()=>ar,"DirectionalLightHelper",()=>oz,"DiscreteInterpolant",()=>nR,"DodecahedronGeometry",()=>rc,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>rg,"EllipseCurve",()=>rx,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>t3,"EventDispatcher",()=>L,"ExternalTexture",()=>rn,"ExtrudeGeometry",()=>r6,"FileLoader",()=>nJ,"Float16BufferAttribute",()=>eX,"Float32BufferAttribute",()=>eZ,"FloatType",()=>1015,"Fog",()=>iI,"FogExp2",()=>iT,"FramebufferTexture",()=>s9,"FrontSide",()=>0,"Frustum",()=>sx,"FrustumArray",()=>sw,"GLBufferAttribute",()=>a3,"GLSL1",()=>"100","GLSL3",()=>"300 es","GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>oA,"Group",()=>iA,"HalfFloatType",()=>1016,"HemisphereLight",()=>n3,"HemisphereLightHelper",()=>oS,"IcosahedronGeometry",()=>r9,"ImageBitmapLoader",()=>ax,"ImageLoader",()=>nQ,"ImageUtils",()=>ta,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>si,"InstancedBufferGeometry",()=>ac,"InstancedInterleavedBuffer",()=>a2,"InstancedMesh",()=>su,"Int16BufferAttribute",()=>eG,"Int32BufferAttribute",()=>eH,"Int8BufferAttribute",()=>ej,"IntType",()=>1013,"InterleavedBuffer",()=>ik,"InterleavedBufferAttribute",()=>iR,"Interpolant",()=>nz,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>v,"InterpolationSamplingType",()=>b,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>nO,"LOD",()=>iZ,"LatheGeometry",()=>r7,"Layers",()=>t5,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>n2,"LightProbe",()=>ah,"Line",()=>sH,"Line3",()=>op,"LineBasicMaterial",()=>s$,"LineCurve",()=>rB,"LineCurve3",()=>rR,"LineDashedMaterial",()=>nS,"LineLoop",()=>sQ,"LineSegments",()=>sY,"LinearFilter",()=>1006,"LinearInterpolant",()=>nB,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>f,"LinearToneMapping",()=>1,"LinearTransfer",()=>g,"Loader",()=>nG,"LoaderUtils",()=>au,"LoadingManager",()=>nU,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>u,"Material",()=>eR,"MaterialLoader",()=>al,"MathUtils",()=>H,"Matrix2",()=>oi,"Matrix3",()=>K,"Matrix4",()=>tH,"MaxEquation",()=>104,"Mesh",()=>io,"MeshBasicMaterial",()=>eO,"MeshDepthMaterial",()=>nv,"MeshDistanceMaterial",()=>nw,"MeshLambertMaterial",()=>nb,"MeshMatcapMaterial",()=>nM,"MeshNormalMaterial",()=>nx,"MeshPhongMaterial",()=>ng,"MeshPhysicalMaterial",()=>nf,"MeshStandardMaterial",()=>nm,"MeshToonMaterial",()=>ny,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>nL,"Object3D",()=>eu,"ObjectLoader",()=>ad,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>nt,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>ai,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>rF,"PerspectiveCamera",()=>iv,"Plane",()=>sm,"PlaneGeometry",()=>ne,"PlaneHelper",()=>oN,"PointLight",()=>ae,"PointLightHelper",()=>ob,"Points",()=>s5,"PointsMaterial",()=>sK,"PolarGridHelper",()=>o_,"PolyhedronGeometry",()=>ru,"PositionalAudio",()=>aF,"PropertyBinding",()=>aH,"PropertyMixer",()=>aV,"QuadraticBezierCurve",()=>rO,"QuadraticBezierCurve3",()=>rE,"Quaternion",()=>X,"QuaternionKeyframeTrack",()=>nF,"QuaternionLinearInterpolant",()=>nN,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>V,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"182","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>nd,"Ray",()=>tq,"Raycaster",()=>a4,"RectAreaLight",()=>aa,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>tm,"RenderTarget3D",()=>aQ,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>ni,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>m,"SRGBTransfer",()=>y,"Scene",()=>iz,"ShaderMaterial",()=>im,"ShadowMaterial",()=>np,"Shape",()=>r$,"ShapeGeometry",()=>ns,"ShapePath",()=>oD,"ShapeUtils",()=>r3,"ShortType",()=>1011,"Skeleton",()=>se,"SkeletonHelper",()=>ox,"SkinnedMesh",()=>i6,"Source",()=>th,"Sphere",()=>tF,"SphereGeometry",()=>nr,"Spherical",()=>ot,"SphericalHarmonics3",()=>ao,"SplineCurve",()=>rP,"SpotLight",()=>n7,"SpotLightHelper",()=>om,"Sprite",()=>iq,"SpriteMaterial",()=>iO,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>aA,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>n$,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>c,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>nn,"Texture",()=>tp,"TextureLoader",()=>n1,"TextureUtils",()=>oW,"Timer",()=>a9,"TimestampQuery",()=>x,"TorusGeometry",()=>na,"TorusKnotGeometry",()=>no,"Triangle",()=>eA,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>nh,"UVMapping",()=>300,"Uint16BufferAttribute",()=>eq,"Uint32BufferAttribute",()=>eJ,"Uint8BufferAttribute",()=>eU,"Uint8ClampedBufferAttribute",()=>eW,"Uniform",()=>aK,"UniformsGroup",()=>a1,"UniformsUtils",()=>id,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>J,"Vector3",()=>Z,"Vector4",()=>td,"VectorKeyframeTrack",()=>nV,"VideoFrameTexture",()=>s8,"VideoTexture",()=>s6,"WebGL3DRenderTarget",()=>tb,"WebGLArrayRenderTarget",()=>ty,"WebGLCoordinateSystem",()=>2e3,"WebGLCubeRenderTarget",()=>iS,"WebGLRenderTarget",()=>tf,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>iC,"WireframeGeometry",()=>nl,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"arrayNeedsUint32",()=>w,"cloneUniforms",()=>iu,"createCanvasElement",()=>C,"createElementNS",()=>_,"error",()=>O,"getByteLength",()=>oU,"getConsoleFunction",()=>k,"getUnlitUniformColorSpace",()=>ip,"log",()=>B,"mergeUniforms",()=>ic,"probeAsync",()=>P,"setConsoleFunction",()=>z,"warn",()=>R,"warnOnce",()=>E])},98223,71726,91996,t=>{"use strict";function e(t){return t.split(/(?:\r\n|\r|\n)/g).map(t=>t.trim()).filter(Boolean).filter(t=>!t.startsWith(";")).map(t=>{let e=t.match(/^(.+)\s(\d+)$/);if(!e)return{name:t,frameCount:1};{let t=parseInt(e[2],10);return{name:e[1],frameCount:t}}})}t.s(["parseImageFileList",()=>e],98223);var i=t.i(87447);function s(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/")}t.s(["normalizePath",()=>s],71726);let r=i.default;function n(t){return s(t).toLowerCase()}function a(){return r.resources}function o(t){let[e,...i]=r.resources[t],[s,n]=i[i.length-1];return[s,n??e]}function h(t){let e=n(t);if(r.resources[e])return e;let i=e.replace(/\d+(\.(png))$/i,"$1");if(r.resources[i])return i;throw Error(`Resource not found in manifest: ${t}`)}function l(){return Object.keys(r.resources)}let u=["",".jpg",".png",".gif",".bmp"];function c(t){let e=n(t);for(let t of u){let i=`${e}${t}`;if(r.resources[i])return i}return e}function p(t){let e=r.missions[t];if(!e)throw Error(`Mission not found: ${t}`);return e}function d(){return Object.keys(r.missions)}let m=new Map(Object.keys(r.missions).map(t=>[t.toLowerCase(),t]));function f(t){let e=t.replace(/-/g,"_").toLowerCase();return m.get(e)??null}t.s(["findMissionByDemoName",()=>f,"getActualResourceKey",()=>h,"getMissionInfo",()=>p,"getMissionList",()=>d,"getResourceKey",()=>n,"getResourceList",()=>l,"getResourceMap",()=>a,"getSourceAndPath",()=>o,"getStandardTextureResourceKey",()=>c],91996)},92552,(t,e,i)=>{"use strict";let s,r;function n(t,e){return e.reduce((t,[e,i])=>({type:"BinaryExpression",operator:e,left:t,right:i}),t)}function a(t,e){return{type:"UnaryExpression",operator:t,argument:e}}class o extends SyntaxError{constructor(t,e,i,s){super(t),this.expected=e,this.found=i,this.location=s,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let i=null,s=t.find(t=>t.source===this.location.source);s&&(i=s.text.split(/\r\n|\n|\r/g));let r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(i){let t=this.location.end,s="".padEnd(n.line.toString().length," "),o=i[r.line-1],h=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --> "+a+"\n"+s+" |\n"+n.line+" | "+o+"\n"+s+" | "+"".padEnd(r.column-1," ")+"".padEnd(h,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function i(t){return t.codePointAt(0).toString(16).toUpperCase()}let s=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t){return s?t.replace(s,t=>"\\u{"+i(t)+"}"):t}function n(t){return r(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}function a(t){return r(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+i(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+i(t)))}let o={literal:t=>'"'+n(t.text)+'"',class(t){let e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function h(t){return o[t.type](t)}return"Expected "+function(t){let e=t.map(h);if(e.sort(),e.length>0){let t=1;for(let i=1;i<e.length;i++)e[i-1]!==e[i]&&(e[t]=e[i],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+(e?'"'+n(e)+'"':"end of input")+" found."}}e.exports={StartRules:["Program"],SyntaxError:o,parse:function(t,e){let i,h={},l=(e=void 0!==e?e:{}).grammarSource,u={Program:eB},c=eB,p="package",d="function",m="datablock",f="else",g="while",y="switch$",x="switch",b="case",v="default",w="return",M="break",S="continue",A="parent",_="true",C="false",T=/^[<>]/,I=/^[+\-]/,z=/^[%*\/]/,k=/^[!\-~]/,B=/^[a-zA-Z_]/,R=/^[a-zA-Z0-9_]/,O=/^[ \t]/,E=/^[^"\\\n\r]/,P=/^[^'\\\n\r]/,L=/^[0-9a-fA-F]/,N=/^[0-9]/,F=/^[xX]/,$=/^[^\n\r]/,V=/^[\n\r]/,D=/^[ \t\n\r]/,j=eC(";",!1),U=eC("package",!1),W=eC("{",!1),G=eC("}",!1),q=eC("function",!1),H=eC("(",!1),J=eC(")",!1),X=eC("::",!1),Z=eC(",",!1),Y=eC("datablock",!1),Q=eC(":",!1),K=eC("new",!1),tt=eC("[",!1),te=eC("]",!1),ti=eC("=",!1),ts=eC(".",!1),tr=eC("if",!1),tn=eC("else",!1),ta=eC("for",!1),to=eC("while",!1),th=eC("do",!1),tl=eC("switch$",!1),tu=eC("switch",!1),tc=eC("case",!1),tp=eC("default",!1),td=eC("or",!1),tm=eC("return",!1),tf=eC("break",!1),tg=eC("continue",!1),ty=eC("+=",!1),tx=eC("-=",!1),tb=eC("*=",!1),tv=eC("/=",!1),tw=eC("%=",!1),tM=eC("<<=",!1),tS=eC(">>=",!1),tA=eC("&=",!1),t_=eC("|=",!1),tC=eC("^=",!1),tT=eC("?",!1),tI=eC("||",!1),tz=eC("&&",!1),tk=eC("|",!1),tB=eC("^",!1),tR=eC("&",!1),tO=eC("==",!1),tE=eC("!=",!1),tP=eC("<=",!1),tL=eC(">=",!1),tN=eT(["<",">"],!1,!1,!1),tF=eC("$=",!1),t$=eC("!$=",!1),tV=eC("@",!1),tD=eC("NL",!1),tj=eC("TAB",!1),tU=eC("SPC",!1),tW=eC("<<",!1),tG=eC(">>",!1),tq=eT(["+","-"],!1,!1,!1),tH=eT(["%","*","/"],!1,!1,!1),tJ=eT(["!","-","~"],!1,!1,!1),tX=eC("++",!1),tZ=eC("--",!1),tY=eC("*",!1),tQ=eC("%",!1),tK=eT([["a","z"],["A","Z"],"_"],!1,!1,!1),t0=eT([["a","z"],["A","Z"],["0","9"],"_"],!1,!1,!1),t1=eC("$",!1),t2=eC("parent",!1),t3=eT([" "," "],!1,!1,!1),t5=eC('"',!1),t4=eC("'",!1),t6=eC("\\",!1),t8=eT(['"',"\\","\n","\r"],!0,!1,!1),t9=eT(["'","\\","\n","\r"],!0,!1,!1),t7=eC("n",!1),et=eC("r",!1),ee=eC("t",!1),ei=eC("x",!1),es=eT([["0","9"],["a","f"],["A","F"]],!1,!1,!1),er=eC("cr",!1),en=eC("cp",!1),ea=eC("co",!1),eo=eC("c",!1),eh=eT([["0","9"]],!1,!1,!1),el={type:"any"},eu=eC("0",!1),ec=eT(["x","X"],!1,!1,!1),ep=eC("-",!1),ed=eC("true",!1),em=eC("false",!1),ef=eC("//",!1),eg=eT(["\n","\r"],!0,!1,!1),ey=eT(["\n","\r"],!1,!1,!1),ex=eC("/*",!1),eb=eC("*/",!1),ev=eT([" "," ","\n","\r"],!1,!1,!1),ew=0|e.peg$currPos,eM=[{line:1,column:1}],eS=ew,eA=e.peg$maxFailExpected||[],e_=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function eC(t,e){return{type:"literal",text:t,ignoreCase:e}}function eT(t,e,i,s){return{type:"class",parts:t,inverted:e,ignoreCase:i,unicode:s}}function eI(e){let i,s=eM[e];if(s)return s;if(e>=eM.length)i=eM.length-1;else for(i=e;!eM[--i];);for(s={line:(s=eM[i]).line,column:s.column};i<e;)10===t.charCodeAt(i)?(s.line++,s.column=1):s.column++,i++;return eM[e]=s,s}function ez(t,e,i){let s=eI(t),r=eI(e),n={source:l,start:{offset:t,line:s.line,column:s.column},end:{offset:e,line:r.line,column:r.column}};return i&&l&&"function"==typeof l.offset&&(n.start=l.offset(n.start),n.end=l.offset(n.end)),n}function ek(t){ew<eS||(ew>eS&&(eS=ew,eA=[]),eA.push(t))}function eB(){let t,e,i;for(ip(),t=[],e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);e!==h;)t.push(e),e=ew,(i=il())===h&&(i=eR()),i!==h?e=i=[i,ip()]:(ew=e,e=h);return{type:"Program",body:t.map(([t])=>t).filter(Boolean),execScriptPaths:Array.from(s),hasDynamicExec:r}}function eR(){let e,i,s,r,n,a,o,l,u,c,m,b,v,A,_,C,T;return(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,t.substr(ew,7)===p?(i=p,ew+=7):(i=h,0===e_&&ek(U)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),123===t.charCodeAt(ew)?(r="{",ew++):(r=h,0===e_&&ek(W)),r!==h){for(ip(),n=[],a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);a!==h;)n.push(a),a=ew,(o=il())===h&&(o=eR()),o!==h?a=o=[o,l=ip()]:(ew=a,a=h);(125===t.charCodeAt(ew)?(a="}",ew++):(a=h,0===e_&&ek(G)),a!==h)?(o=iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"PackageDeclaration",name:s,body:n.map(([t])=>t).filter(Boolean)}):(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,t.substr(ew,8)===d?(i=d,ew+=8):(i=h,0===e_&&ek(q)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r;if(e=ew,(i=is())!==h)if("::"===t.substr(ew,2)?(s="::",ew+=2):(s=h,0===e_&&ek(X)),s!==h)if((r=is())!==h)e={type:"MethodName",namespace:i,method:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=is()),e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=is())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=is())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)if(iu(),(o=eD())!==h)e={type:"FunctionDeclaration",name:s,params:n||[],body:o};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&((s=ew,(r=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),s=r):(ew=s,s=h),(e=s)===h&&((a=ew,(o=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),iu(),a=o):(ew=a,a=h),(e=a)===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,"if"===t.substr(ew,2)?(i="if",ew+=2):(i=h,0===e_&&ek(tr)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h){var d;o=ew,l=iu(),t.substr(ew,4)===f?(u=f,ew+=4):(u=h,0===e_&&ek(tn)),u!==h?(c=iu(),(p=eR())!==h?o=l=[l,u,c,p]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),e={type:"IfStatement",test:r,consequent:a,alternate:(d=o)?d[3]:null}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,"for"===t.substr(ew,3)?(i="for",ew+=3):(i=h,0===e_&&ek(ta)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())===h&&(r=null),iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h)if(iu(),(a=ej())===h&&(a=null),iu(),59===t.charCodeAt(ew)?(o=";",ew++):(o=h,0===e_&&ek(j)),o!==h)if(iu(),(l=ej())===h&&(l=null),iu(),41===t.charCodeAt(ew)?(u=")",ew++):(u=h,0===e_&&ek(J)),u!==h)if(iu(),(c=eR())!==h){var p,d;p=r,d=a,e={type:"ForStatement",init:p,test:d,update:l,body:c}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l;if(e=ew,"do"===t.substr(ew,2)?(i="do",ew+=2):(i=h,0===e_&&ek(th)),i!==h)if(iu(),(s=eR())!==h)if(iu(),t.substr(ew,5)===g?(r=g,ew+=5):(r=h,0===e_&&ek(to)),r!==h)if(iu(),40===t.charCodeAt(ew)?(n="(",ew++):(n=h,0===e_&&ek(H)),n!==h)if(iu(),(a=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(o=")",ew++):(o=h,0===e_&&ek(J)),o!==h)iu(),59===t.charCodeAt(ew)?(l=";",ew++):(l=h,0===e_&&ek(j)),l===h&&(l=null),e={type:"DoWhileStatement",test:a,body:s};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,t.substr(ew,5)===g?(i=g,ew+=5):(i=h,0===e_&&ek(to)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),(a=eR())!==h)e={type:"WhileStatement",test:r,body:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o,l,u,c;if(e=ew,t.substr(ew,7)===y?(i=y,ew+=7):(i=h,0===e_&&ek(tl)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!0,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,6)===x?(i=x,ew+=6):(i=h,0===e_&&ek(tu)),i!==h)if(iu(),40===t.charCodeAt(ew)?(s="(",ew++):(s=h,0===e_&&ek(H)),s!==h)if(iu(),(r=ej())!==h)if(iu(),41===t.charCodeAt(ew)?(n=")",ew++):(n=h,0===e_&&ek(J)),n!==h)if(iu(),123===t.charCodeAt(ew)?(a="{",ew++):(a=h,0===e_&&ek(W)),a!==h){for(ip(),o=[],l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);l!==h;)o.push(l),l=ew,(u=il())===h&&(u=eV()),u!==h?l=u=[u,c=ip()]:(ew=l,l=h);(125===t.charCodeAt(ew)?(l="}",ew++):(l=h,0===e_&&ek(G)),l!==h)?e={type:"SwitchStatement",stringMode:!1,discriminant:r,cases:o.map(([t])=>t).filter(t=>t&&"SwitchCase"===t.type)}:(ew=e,e=h)}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n;if(e=ew,t.substr(ew,6)===w?(i=w,ew+=6):(i=h,0===e_&&ek(tm)),i!==h)if(s=ew,(r=ic())!==h&&(n=ej())!==h?s=r=[r,n]:(ew=s,s=h),s===h&&(s=null),r=iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n!==h){var a;e={type:"ReturnStatement",value:(a=s)?a[1]:null}}else ew=e,e=h;else ew=e,e=h;return e}())===h&&(u=ew,t.substr(ew,5)===M?(c=M,ew+=5):(c=h,0===e_&&ek(tf)),c!==h?(iu(),59===t.charCodeAt(ew)?(m=";",ew++):(m=h,0===e_&&ek(j)),m!==h?u={type:"BreakStatement"}:(ew=u,u=h)):(ew=u,u=h),(e=u)===h&&(b=ew,t.substr(ew,8)===S?(v=S,ew+=8):(v=h,0===e_&&ek(tg)),v!==h?(iu(),59===t.charCodeAt(ew)?(A=";",ew++):(A=h,0===e_&&ek(j)),A!==h?b={type:"ContinueStatement"}:(ew=b,b=h)):(ew=b,b=h),(e=b)===h&&((_=ew,(C=ej())!==h&&(iu(),59===t.charCodeAt(ew)?(T=";",ew++):(T=h,0===e_&&ek(j)),T!==h))?_={type:"ExpressionStatement",expression:C}:(ew=_,_=h),(e=_)===h&&(e=eD())===h&&(e=il())===h)))))&&(e=ew,iu(),59===t.charCodeAt(ew)?(i=";",ew++):(i=h,0===e_&&ek(j)),i!==h?(iu(),e=null):(ew=e,e=h)),e}function eO(){let e,i,s,r,n,a,o,l,u,c,p,d,f,g;if(e=ew,t.substr(ew,9)===m?(i=m,ew+=9):(i=h,0===e_&&ek(Y)),i!==h)if(ic()!==h)if((s=is())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var y,x,b;if(iu(),o=ew,58===t.charCodeAt(ew)?(l=":",ew++):(l=h,0===e_&&ek(Q)),l!==h?(u=iu(),(c=is())!==h?o=l=[l,u,c]:(ew=o,o=h)):(ew=o,o=h),o===h&&(o=null),l=iu(),u=ew,123===t.charCodeAt(ew)?(c="{",ew++):(c=h,0===e_&&ek(W)),c!==h){for(p=iu(),d=[],f=eP();f!==h;)d.push(f),f=eP();f=iu(),125===t.charCodeAt(ew)?(g="}",ew++):(g=h,0===e_&&ek(G)),g!==h?u=c=[c,p,d,f,g,iu()]:(ew=u,u=h)}else ew=u,u=h;u===h&&(u=null),y=n,x=o,b=u,e={type:"DatablockDeclaration",className:s,instanceName:y,parent:x?x[2]:null,body:b?b[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eE(){let e,i,s,r,n,a,o,l,u,c,p,d;if(e=ew,"new"===t.substr(ew,3)?(i="new",ew+=3):(i=h,0===e_&&ek(K)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l,u,c;if((e=ew,40===t.charCodeAt(ew)?(i="(",ew++):(i=h,0===e_&&ek(H)),i!==h&&(s=iu(),(r=ej())!==h&&(n=iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h)))?e=r:(ew=e,e=h),e===h)if(e=ew,(i=is())!==h){var p;for(s=[],r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),91===t.charCodeAt(ew)?(a="[",ew++):(a=h,0===e_&&ek(tt)),a!==h?(o=iu(),(l=e$())!==h?(u=iu(),93===t.charCodeAt(ew)?(c="]",ew++):(c=h,0===e_&&ek(te)),c!==h?r=n=[n,a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);p=i,e=s.reduce((t,[,,,e])=>({type:"IndexExpression",object:t,index:e}),p)}else ew=e,e=h;return e}())!==h)if(iu(),40===t.charCodeAt(ew)?(r="(",ew++):(r=h,0===e_&&ek(H)),r!==h)if(iu(),(n=eL())===h&&(n=null),iu(),41===t.charCodeAt(ew)?(a=")",ew++):(a=h,0===e_&&ek(J)),a!==h){var m;if(iu(),o=ew,123===t.charCodeAt(ew)?(l="{",ew++):(l=h,0===e_&&ek(W)),l!==h){for(u=iu(),c=[],p=eP();p!==h;)c.push(p),p=eP();p=iu(),125===t.charCodeAt(ew)?(d="}",ew++):(d=h,0===e_&&ek(G)),d!==h?o=l=[l,u,c,p,d,iu()]:(ew=o,o=h)}else ew=o,o=h;o===h&&(o=null),e={type:"ObjectDeclaration",className:s,instanceName:n,body:(m=o)?m[2].filter(Boolean):[]}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}function eP(){let e,i,s;return(e=ew,(i=eE())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&((e=ew,(i=eO())!==h)?(iu(),59===t.charCodeAt(ew)?(s=";",ew++):(s=h,0===e_&&ek(j)),s===h&&(s=null),iu(),e=i):(ew=e,e=h),e===h&&(e=function(){let e,i,s,r,n;if(e=ew,iu(),(i=eN())!==h)if(iu(),61===t.charCodeAt(ew)?(s="=",ew++):(s=h,0===e_&&ek(ti)),s!==h)if(iu(),(r=ej())!==h)iu(),59===t.charCodeAt(ew)?(n=";",ew++):(n=h,0===e_&&ek(j)),n===h&&(n=null),iu(),e={type:"Assignment",target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e}())===h&&(e=il())===h&&(e=function(){let e,i;if(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i!==h)for(;i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));else e=h;return e!==h&&(e=null),e}())),e}function eL(){let t;return(t=eK())===h&&(t=is())===h&&(t=ih()),t}function eN(){let t,e,i,s;if(t=ew,(e=e9())!==h){for(i=[],s=eF();s!==h;)i.push(s),s=eF();t=i.reduce((t,e)=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},e)}else ew=t,t=h;return t}function eF(){let e,i,s,r;return(e=ew,46===t.charCodeAt(ew)?(i=".",ew++):(i=h,0===e_&&ek(ts)),i!==h&&(iu(),(s=is())!==h))?e={type:"property",value:s}:(ew=e,e=h),e===h&&((e=ew,91===t.charCodeAt(ew)?(i="[",ew++):(i=h,0===e_&&ek(tt)),i!==h&&(iu(),(s=e$())!==h&&(iu(),93===t.charCodeAt(ew)?(r="]",ew++):(r=h,0===e_&&ek(te)),r!==h)))?e={type:"index",value:s}:(ew=e,e=h)),e}function e$(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}function eV(){let e,i,s,r,n,a,o,l,u;if(e=ew,t.substr(ew,4)===b?(i=b,ew+=4):(i=h,0===e_&&ek(tc)),i!==h)if(ic()!==h)if((s=function(){let e,i,s,r,n,a,o,l;if(e=ew,(i=e5())!==h){for(s=[],r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),"or"===t.substr(ew,2)?(a="or",ew+=2):(a=h,0===e_&&ek(td)),a!==h&&(o=ic())!==h&&(l=e5())!==h?r=n=[n,a,o,l]:(ew=r,r=h);e=s.length>0?[i,...s.map(([,,,t])=>t)]:i}else ew=e,e=h;return e}())!==h)if(iu(),58===t.charCodeAt(ew)?(r=":",ew++):(r=h,0===e_&&ek(Q)),r!==h){for(n=ip(),a=[],o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);o!==h;)a.push(o),o=ew,(l=il())===h&&(l=eR()),l!==h?o=l=[l,u=ip()]:(ew=o,o=h);e={type:"SwitchCase",test:s,consequent:a.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;if(e===h)if(e=ew,t.substr(ew,7)===v?(i=v,ew+=7):(i=h,0===e_&&ek(tp)),i!==h)if(iu(),58===t.charCodeAt(ew)?(s=":",ew++):(s=h,0===e_&&ek(Q)),s!==h){for(ip(),r=[],n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);n!==h;)r.push(n),n=ew,(a=il())===h&&(a=eR()),a!==h?n=a=[a,o=ip()]:(ew=n,n=h);e={type:"SwitchCase",test:null,consequent:r.map(([t])=>t).filter(Boolean)}}else ew=e,e=h;else ew=e,e=h;return e}function eD(){let e,i,s,r,n,a;if(e=ew,123===t.charCodeAt(ew)?(i="{",ew++):(i=h,0===e_&&ek(W)),i!==h){for(ip(),s=[],r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);r!==h;)s.push(r),r=ew,(n=il())===h&&(n=eR()),n!==h?r=n=[n,a=ip()]:(ew=r,r=h);(125===t.charCodeAt(ew)?(r="}",ew++):(r=h,0===e_&&ek(G)),r!==h)?e={type:"BlockStatement",body:s.map(([t])=>t).filter(Boolean)}:(ew=e,e=h)}else ew=e,e=h;return e}function ej(){let e,i,s,r;if(e=ew,(i=eN())!==h)if(iu(),(s=eU())!==h)if(iu(),(r=ej())!==h)e={type:"AssignmentExpression",operator:s,target:i,value:r};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=function(){let e,i,s,r,n,a;if(e=ew,(i=eW())!==h)if(iu(),63===t.charCodeAt(ew)?(s="?",ew++):(s=h,0===e_&&ek(tT)),s!==h)if(iu(),(r=ej())!==h)if(iu(),58===t.charCodeAt(ew)?(n=":",ew++):(n=h,0===e_&&ek(Q)),n!==h)if(iu(),(a=ej())!==h)e={type:"ConditionalExpression",test:i,consequent:r,alternate:a};else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;else ew=e,e=h;return e===h&&(e=eW()),e}()),e}function eU(){let e;return 61===t.charCodeAt(ew)?(e="=",ew++):(e=h,0===e_&&ek(ti)),e===h&&("+="===t.substr(ew,2)?(e="+=",ew+=2):(e=h,0===e_&&ek(ty)),e===h&&("-="===t.substr(ew,2)?(e="-=",ew+=2):(e=h,0===e_&&ek(tx)),e===h&&("*="===t.substr(ew,2)?(e="*=",ew+=2):(e=h,0===e_&&ek(tb)),e===h&&("/="===t.substr(ew,2)?(e="/=",ew+=2):(e=h,0===e_&&ek(tv)),e===h&&("%="===t.substr(ew,2)?(e="%=",ew+=2):(e=h,0===e_&&ek(tw)),e===h&&("<<="===t.substr(ew,3)?(e="<<=",ew+=3):(e=h,0===e_&&ek(tM)),e===h&&(">>="===t.substr(ew,3)?(e=">>=",ew+=3):(e=h,0===e_&&ek(tS)),e===h&&("&="===t.substr(ew,2)?(e="&=",ew+=2):(e=h,0===e_&&ek(tA)),e===h&&("|="===t.substr(ew,2)?(e="|=",ew+=2):(e=h,0===e_&&ek(t_)),e===h&&("^="===t.substr(ew,2)?(e="^=",ew+=2):(e=h,0===e_&&ek(tC)))))))))))),e}function eW(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eG())!==h){for(s=[],r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"||"===t.substr(ew,2)?(o="||",ew+=2):(o=h,0===e_&&ek(tI)),o!==h?(l=iu(),(u=eG())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eG(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eq())!==h){for(s=[],r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),"&&"===t.substr(ew,2)?(o="&&",ew+=2):(o=h,0===e_&&ek(tz)),o!==h?(l=iu(),(u=eq())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eq(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eH())!==h){for(s=[],r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),124===t.charCodeAt(ew)?(o="|",ew++):(o=h,0===e_&&ek(tk)),o!==h?(l=ew,e_++,124===t.charCodeAt(ew)?(u="|",ew++):(u=h,0===e_&&ek(tk)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eH())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eH(){let e,i,s,r,a,o,l,u;if(e=ew,(i=eJ())!==h){for(s=[],r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),94===t.charCodeAt(ew)?(o="^",ew++):(o=h,0===e_&&ek(tB)),o!==h?(l=iu(),(u=eJ())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function eJ(){let e,i,s,r,a,o,l,u,c;if(e=ew,(i=eX())!==h){for(s=[],r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),38===t.charCodeAt(ew)?(o="&",ew++):(o=h,0===e_&&ek(tR)),o!==h?(l=ew,e_++,38===t.charCodeAt(ew)?(u="&",ew++):(u=h,0===e_&&ek(tR)),e_--,u===h?l=void 0:(ew=l,l=h),l!==h?(u=iu(),(c=eX())!==h?r=a=[a,o,l,u,c]:(ew=r,r=h)):(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,,e])=>[t,e]))}else ew=e,e=h;return e}function eX(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eY())!==h){for(i=[],s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eZ())!==h?(o=iu(),(l=eY())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eZ(){let e;return"=="===t.substr(ew,2)?(e="==",ew+=2):(e=h,0===e_&&ek(tO)),e===h&&("!="===t.substr(ew,2)?(e="!=",ew+=2):(e=h,0===e_&&ek(tE))),e}function eY(){let t,e,i,s,r,a,o,l;if(t=ew,(e=eK())!==h){for(i=[],s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=eQ())!==h?(o=iu(),(l=eK())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function eQ(){let e;return"<="===t.substr(ew,2)?(e="<=",ew+=2):(e=h,0===e_&&ek(tP)),e===h&&(">="===t.substr(ew,2)?(e=">=",ew+=2):(e=h,0===e_&&ek(tL)),e===h&&(e=t.charAt(ew),T.test(e)?ew++:(e=h,0===e_&&ek(tN)))),e}function eK(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e2())!==h){for(i=[],s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e1())!==h?(o=iu(),(l=e0())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e0(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e2()),t}function e1(){let e;return"$="===t.substr(ew,2)?(e="$=",ew+=2):(e=h,0===e_&&ek(tF)),e===h&&("!$="===t.substr(ew,3)?(e="!$=",ew+=3):(e=h,0===e_&&ek(t$)),e===h&&(64===t.charCodeAt(ew)?(e="@",ew++):(e=h,0===e_&&ek(tV)),e===h&&("NL"===t.substr(ew,2)?(e="NL",ew+=2):(e=h,0===e_&&ek(tD)),e===h&&("TAB"===t.substr(ew,3)?(e="TAB",ew+=3):(e=h,0===e_&&ek(tj)),e===h&&("SPC"===t.substr(ew,3)?(e="SPC",ew+=3):(e=h,0===e_&&ek(tU))))))),e}function e2(){let t,e,i,s,r,a,o,l;if(t=ew,(e=e5())!==h){for(i=[],s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);s!==h;)i.push(s),s=ew,r=iu(),(a=e3())!==h?(o=iu(),(l=e5())!==h?s=r=[r,a,o,l]:(ew=s,s=h)):(ew=s,s=h);t=n(e,i.map(([,t,,e])=>[t,e]))}else ew=t,t=h;return t}function e3(){let e;return"<<"===t.substr(ew,2)?(e="<<",ew+=2):(e=h,0===e_&&ek(tW)),e===h&&(">>"===t.substr(ew,2)?(e=">>",ew+=2):(e=h,0===e_&&ek(tG))),e}function e5(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e4())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),I.test(o)?ew++:(o=h,0===e_&&ek(tq)),o!==h?(l=iu(),(u=e4())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e4(){let e,i,s,r,a,o,l,u;if(e=ew,(i=e6())!==h){for(s=[],r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,a=iu(),o=t.charAt(ew),z.test(o)?ew++:(o=h,0===e_&&ek(tH)),o!==h?(l=iu(),(u=e6())!==h?r=a=[a,o,l,u]:(ew=r,r=h)):(ew=r,r=h);e=n(i,s.map(([,t,,e])=>[t,e]))}else ew=e,e=h;return e}function e6(){let e,i,s;return(e=ew,i=t.charAt(ew),k.test(i)?ew++:(i=h,0===e_&&ek(tJ)),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,"++"===t.substr(ew,2)?(i="++",ew+=2):(i=h,0===e_&&ek(tX)),i===h&&("--"===t.substr(ew,2)?(i="--",ew+=2):(i=h,0===e_&&ek(tZ))),i!==h&&(iu(),(s=e8())!==h))?e=a(i,s):(ew=e,e=h),e===h&&((e=ew,42===t.charCodeAt(ew)?(i="*",ew++):(i=h,0===e_&&ek(tY)),i!==h&&(iu(),(s=e8())!==h))?e={type:"TagDereferenceExpression",argument:s}:(ew=e,e=h),e===h&&(e=function(){let e,i,s;if(e=ew,(i=e9())!==h)if(iu(),"++"===t.substr(ew,2)?(s="++",ew+=2):(s=h,0===e_&&ek(tX)),s===h&&("--"===t.substr(ew,2)?(s="--",ew+=2):(s=h,0===e_&&ek(tZ))),s!==h)e={type:"PostfixExpression",operator:s,argument:i};else ew=e,e=h;else ew=e,e=h;return e===h&&(e=e9()),e}()))),e}function e8(){let t,e,i,s;if(t=ew,(e=eN())!==h)if(iu(),(i=eU())!==h)if(iu(),(s=ej())!==h)t={type:"AssignmentExpression",operator:i,target:e,value:s};else ew=t,t=h;else ew=t,t=h;else ew=t,t=h;return t===h&&(t=e6()),t}function e9(){let e,i,n,a,o,l,u,c,p,d;if(e=ew,(i=function(){let e,i,s,r,n,a,o,l,u,c,p,d,m,f,g,y;if(e=ew,(o=eE())===h&&(o=eO())===h&&(o=function(){let e,i,s,r;if(e=ew,34===t.charCodeAt(ew)?(i='"',ew++):(i=h,0===e_&&ek(t5)),i!==h){for(s=[],r=ir();r!==h;)s.push(r),r=ir();(34===t.charCodeAt(ew)?(r='"',ew++):(r=h,0===e_&&ek(t5)),r!==h)?e={type:"StringLiteral",value:s.join("")}:(ew=e,e=h)}else ew=e,e=h;if(e===h)if(e=ew,39===t.charCodeAt(ew)?(i="'",ew++):(i=h,0===e_&&ek(t4)),i!==h){for(s=[],r=ia();r!==h;)s.push(r),r=ia();(39===t.charCodeAt(ew)?(r="'",ew++):(r=h,0===e_&&ek(t4)),r!==h)?e={type:"StringLiteral",value:s.join(""),tagged:!0}:(ew=e,e=h)}else ew=e,e=h;return e}())===h&&(o=ih())===h&&((l=ew,t.substr(ew,4)===_?(u=_,ew+=4):(u=h,0===e_&&ek(ed)),u===h&&(t.substr(ew,5)===C?(u=C,ew+=5):(u=h,0===e_&&ek(em))),u!==h&&(c=ew,e_++,p=im(),e_--,p===h?c=void 0:(ew=c,c=h),c!==h))?l={type:"BooleanLiteral",value:"true"===u}:(ew=l,l=h),(o=l)===h&&((d=it())===h&&(d=ie())===h&&(d=ii()),(o=d)===h))&&((m=ew,40===t.charCodeAt(ew)?(f="(",ew++):(f=h,0===e_&&ek(H)),f!==h&&(iu(),(g=ej())!==h&&(iu(),41===t.charCodeAt(ew)?(y=")",ew++):(y=h,0===e_&&ek(J)),y!==h)))?m=g:(ew=m,m=h),o=m),(i=o)!==h){for(s=[],r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),(a=eF())!==h?r=n=[n,a]:(ew=r,r=h);e=s.reduce((t,[,e])=>"property"===e.type?{type:"MemberExpression",object:t,property:e.value}:{type:"IndexExpression",object:t,index:e.value},i)}else ew=e,e=h;return e}())!==h){for(n=[],a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));a!==h;)n.push(a),a=ew,o=iu(),40===t.charCodeAt(ew)?(l="(",ew++):(l=h,0===e_&&ek(H)),l!==h?(u=iu(),(c=e7())===h&&(c=null),p=iu(),41===t.charCodeAt(ew)?(d=")",ew++):(d=h,0===e_&&ek(J)),d!==h?a=o=[o,l,u,c,p,d]:(ew=a,a=h)):(ew=a,a=h),a===h&&(a=ew,o=iu(),(l=eF())!==h?a=o=[o,l]:(ew=a,a=h));e=n.reduce((t,e)=>{if("("===e[1]){var i;let[,,,n]=e;return i=n||[],"Identifier"===t.type&&"exec"===t.name.toLowerCase()&&(i.length>0&&"StringLiteral"===i[0].type?s.add(i[0].value):r=!0),{type:"CallExpression",callee:t,arguments:i}}let n=e[1];return"property"===n.type?{type:"MemberExpression",object:t,property:n.value}:{type:"IndexExpression",object:t,index:n.value}},i)}else ew=e,e=h;return e}function e7(){let e,i,s,r,n,a,o,l;if(e=ew,(i=ej())!==h){for(s=[],r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=iu(),44===t.charCodeAt(ew)?(a=",",ew++):(a=h,0===e_&&ek(Z)),a!==h?(o=iu(),(l=ej())!==h?r=n=[n,a,o,l]:(ew=r,r=h)):(ew=r,r=h);e=[i,...s.map(([,,,t])=>t)]}else ew=e,e=h;return e}function it(){let e,i,s,r,n,a,o;if(e=ew,37===t.charCodeAt(ew)?(i="%",ew++):(i=h,0===e_&&ek(tQ)),i!==h){if(s=ew,r=ew,n=t.charAt(ew),B.test(n)?ew++:(n=h,0===e_&&ek(tK)),n!==h){for(a=[],o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));o!==h;)a.push(o),o=t.charAt(ew),R.test(o)?ew++:(o=h,0===e_&&ek(t0));r=n=[n,a]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"local",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ie(){let e,i,s,r,n,a,o,l,u,c,p,d,m;if(e=ew,36===t.charCodeAt(ew)?(i="$",ew++):(i=h,0===e_&&ek(t1)),i!==h){if(s=ew,r=ew,"::"===t.substr(ew,2)?(n="::",ew+=2):(n=h,0===e_&&ek(X)),n===h&&(n=null),a=t.charAt(ew),B.test(a)?ew++:(a=h,0===e_&&ek(tK)),a!==h){for(o=[],l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));l!==h;)o.push(l),l=t.charAt(ew),R.test(l)?ew++:(l=h,0===e_&&ek(t0));if(l=[],u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;for(;u!==h;)if(l.push(u),u=ew,"::"===t.substr(ew,2)?(c="::",ew+=2):(c=h,0===e_&&ek(X)),c!==h)if(p=t.charAt(ew),B.test(p)?ew++:(p=h,0===e_&&ek(tK)),p!==h){for(d=[],m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));m!==h;)d.push(m),m=t.charAt(ew),R.test(m)?ew++:(m=h,0===e_&&ek(t0));u=c=[c,p,d]}else ew=u,u=h;else ew=u,u=h;r=n=[n,a,o,l]}else ew=r,r=h;(s=r!==h?t.substring(s,ew):r)!==h?e={type:"Variable",scope:"global",name:s}:(ew=e,e=h)}else ew=e,e=h;return e}function ii(){let e,i,s,r,n,a,o,l,u,c,p;if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){for(n=[],a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));a!==h;)n.push(a),a=t.charAt(ew),O.test(a)?ew++:(a=h,0===e_&&ek(t3));if("::"===t.substr(ew,2)?(a="::",ew+=2):(a=h,0===e_&&ek(X)),a!==h){for(o=[],l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));l!==h;)o.push(l),l=t.charAt(ew),O.test(l)?ew++:(l=h,0===e_&&ek(t3));if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));s=r=[r,n,a,o,l,u]}else ew=s,s=h}else ew=s,s=h}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i.replace(/\s+/g,"")}),(e=i)===h){if(e=ew,i=ew,s=ew,t.substr(ew,6)===A?(r=A,ew+=6):(r=h,0===e_&&ek(t2)),r!==h){if(n=[],a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;if(a!==h)for(;a!==h;)if(n.push(a),a=ew,"::"===t.substr(ew,2)?(o="::",ew+=2):(o=h,0===e_&&ek(X)),o!==h)if(l=t.charAt(ew),B.test(l)?ew++:(l=h,0===e_&&ek(tK)),l!==h){for(u=[],c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));c!==h;)u.push(c),c=t.charAt(ew),R.test(c)?ew++:(c=h,0===e_&&ek(t0));a=o=[o,l,u]}else ew=a,a=h;else ew=a,a=h;else n=h;n!==h?s=r=[r,n]:(ew=s,s=h)}else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),(e=i)===h){if(e=ew,i=ew,s=ew,r=t.charAt(ew),B.test(r)?ew++:(r=h,0===e_&&ek(tK)),r!==h){for(n=[],a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));a!==h;)n.push(a),a=t.charAt(ew),R.test(a)?ew++:(a=h,0===e_&&ek(t0));if(a=[],o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;for(;o!==h;)if(a.push(o),o=ew,"::"===t.substr(ew,2)?(l="::",ew+=2):(l=h,0===e_&&ek(X)),l!==h)if(u=t.charAt(ew),B.test(u)?ew++:(u=h,0===e_&&ek(tK)),u!==h){for(c=[],p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));p!==h;)c.push(p),p=t.charAt(ew),R.test(p)?ew++:(p=h,0===e_&&ek(t0));o=l=[l,u,c]}else ew=o,o=h;else ew=o,o=h;s=r=[r,n,a]}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(i={type:"Identifier",name:i}),e=i}}return e}function is(){let t;return(t=it())===h&&(t=ie())===h&&(t=ii()),t}function ir(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),E.test(e)?ew++:(e=h,0===e_&&ek(t8))),e}function ia(){let e,i,s;return(e=ew,92===t.charCodeAt(ew)?(i="\\",ew++):(i=h,0===e_&&ek(t6)),i!==h&&(s=io())!==h)?e=s:(ew=e,e=h),e===h&&(e=t.charAt(ew),P.test(e)?ew++:(e=h,0===e_&&ek(t9))),e}function io(){let e,i,s,r,n,a;return e=ew,110===t.charCodeAt(ew)?(i="n",ew++):(i=h,0===e_&&ek(t7)),i!==h&&(i="\n"),(e=i)===h&&(e=ew,114===t.charCodeAt(ew)?(i="r",ew++):(i=h,0===e_&&ek(et)),i!==h&&(i="\r"),(e=i)===h)&&(e=ew,116===t.charCodeAt(ew)?(i="t",ew++):(i=h,0===e_&&ek(ee)),i!==h&&(i=" "),(e=i)===h)&&((e=ew,120===t.charCodeAt(ew)?(i="x",ew++):(i=h,0===e_&&ek(ei)),i!==h&&(s=ew,r=ew,n=t.charAt(ew),L.test(n)?ew++:(n=h,0===e_&&ek(es)),n!==h?(a=t.charAt(ew),L.test(a)?ew++:(a=h,0===e_&&ek(es)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h),(s=r!==h?t.substring(s,ew):r)!==h))?e=String.fromCharCode(parseInt(s,16)):(ew=e,e=h),e===h&&(e=ew,"cr"===t.substr(ew,2)?(i="cr",ew+=2):(i=h,0===e_&&ek(er)),i!==h&&(i="\x0f"),(e=i)===h&&(e=ew,"cp"===t.substr(ew,2)?(i="cp",ew+=2):(i=h,0===e_&&ek(en)),i!==h&&(i="\x10"),(e=i)===h))&&(e=ew,"co"===t.substr(ew,2)?(i="co",ew+=2):(i=h,0===e_&&ek(ea)),i!==h&&(i="\x11"),(e=i)===h)&&((e=ew,99===t.charCodeAt(ew)?(i="c",ew++):(i=h,0===e_&&ek(eo)),i!==h&&(s=t.charAt(ew),N.test(s)?ew++:(s=h,0===e_&&ek(eh)),s!==h))?e=String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(s,10)]):(ew=e,e=h),e===h&&(e=ew,t.length>ew?(i=t.charAt(ew),ew++):(i=h,0===e_&&ek(el)),e=i))),e}function ih(){let e,i,s,r,n,a,o,l,u;if(e=ew,i=ew,s=ew,48===t.charCodeAt(ew)?(r="0",ew++):(r=h,0===e_&&ek(eu)),r!==h)if(n=t.charAt(ew),F.test(n)?ew++:(n=h,0===e_&&ek(ec)),n!==h){if(a=[],o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),L.test(o)?ew++:(o=h,0===e_&&ek(es));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;else ew=s,s=h;if((i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseInt(i,16)}:(ew=e,e=h),e===h){if(e=ew,i=ew,s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),n=[],a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh)),a!==h)for(;a!==h;)n.push(a),a=t.charAt(ew),N.test(a)?ew++:(a=h,0===e_&&ek(eh));else n=h;if(n!==h){if(a=ew,46===t.charCodeAt(ew)?(o=".",ew++):(o=h,0===e_&&ek(ts)),o!==h){if(l=[],u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh)),u!==h)for(;u!==h;)l.push(u),u=t.charAt(ew),N.test(u)?ew++:(u=h,0===e_&&ek(eh));else l=h;l!==h?a=o=[o,l]:(ew=a,a=h)}else ew=a,a=h;a===h&&(a=null),s=r=[r,n,a]}else ew=s,s=h;if(s===h)if(s=ew,45===t.charCodeAt(ew)?(r="-",ew++):(r=h,0===e_&&ek(ep)),r===h&&(r=null),46===t.charCodeAt(ew)?(n=".",ew++):(n=h,0===e_&&ek(ts)),n!==h){if(a=[],o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh)),o!==h)for(;o!==h;)a.push(o),o=t.charAt(ew),N.test(o)?ew++:(o=h,0===e_&&ek(eh));else a=h;a!==h?s=r=[r,n,a]:(ew=s,s=h)}else ew=s,s=h;(i=s!==h?t.substring(i,ew):s)!==h&&(s=ew,e_++,r=im(),e_--,r===h?s=void 0:(ew=s,s=h),s!==h)?e={type:"NumberLiteral",value:parseFloat(i)}:(ew=e,e=h)}return e}function il(){let e;return(e=function(){let e,i,s,r,n;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=ew,r=[],n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));n!==h;)r.push(n),n=t.charAt(ew),$.test(n)?ew++:(n=h,0===e_&&ek(eg));s=t.substring(s,ew),r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e={type:"Comment",value:s}}else ew=e,e=h;return e}())===h&&(e=function(){let e,i,s,r,n,a,o;if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=ew,r=[],n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);n!==h;)r.push(n),n=ew,a=ew,e_++,"*/"===t.substr(ew,2)?(o="*/",ew+=2):(o=h,0===e_&&ek(eb)),e_--,o===h?a=void 0:(ew=a,a=h),a!==h?(t.length>ew?(o=t.charAt(ew),ew++):(o=h,0===e_&&ek(el)),o!==h?n=a=[a,o]:(ew=n,n=h)):(ew=n,n=h);(s=t.substring(s,ew),"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h)?e={type:"Comment",value:s}:(ew=e,e=h)}else ew=e,e=h;return e}()),e}function iu(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev)),i===h&&(i=id());return e}function ic(){let e,i,s,r;if(e=ew,i=[],s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev)),s!==h)for(;s!==h;)i.push(s),s=t.charAt(ew),D.test(s)?ew++:(s=h,0===e_&&ek(ev));else i=h;if(i!==h){for(s=[],r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());r!==h;)s.push(r),r=t.charAt(ew),D.test(r)?ew++:(r=h,0===e_&&ek(ev)),r===h&&(r=id());e=i=[i,s]}else ew=e,e=h;return e}function ip(){let e,i;for(e=[],i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));i!==h;)e.push(i),i=t.charAt(ew),D.test(i)?ew++:(i=h,0===e_&&ek(ev));return e}function id(){let e,i,s,r,n,a;if(e=ew,"//"===t.substr(ew,2)?(i="//",ew+=2):(i=h,0===e_&&ek(ef)),i!==h){for(s=[],r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r!==h;)s.push(r),r=t.charAt(ew),$.test(r)?ew++:(r=h,0===e_&&ek(eg));r=t.charAt(ew),V.test(r)?ew++:(r=h,0===e_&&ek(ey)),r===h&&(r=null),e=i=[i,s,r]}else ew=e,e=h;if(e===h)if(e=ew,"/*"===t.substr(ew,2)?(i="/*",ew+=2):(i=h,0===e_&&ek(ex)),i!==h){for(s=[],r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);r!==h;)s.push(r),r=ew,n=ew,e_++,"*/"===t.substr(ew,2)?(a="*/",ew+=2):(a=h,0===e_&&ek(eb)),e_--,a===h?n=void 0:(ew=n,n=h),n!==h?(t.length>ew?(a=t.charAt(ew),ew++):(a=h,0===e_&&ek(el)),a!==h?r=n=[n,a]:(ew=r,r=h)):(ew=r,r=h);"*/"===t.substr(ew,2)?(r="*/",ew+=2):(r=h,0===e_&&ek(eb)),r!==h?e=i=[i,s,r]:(ew=e,e=h)}else ew=e,e=h;return e}function im(){let e;return e=t.charAt(ew),R.test(e)?ew++:(e=h,0===e_&&ek(t0)),e}s=new Set,r=!1;let ig=(i=c())!==h&&ew===t.length;function iy(){var e,s,r;throw i!==h&&ew<t.length&&ek({type:"end"}),e=eA,s=eS<t.length?function(e=ew){let i=t.codePointAt(e);return void 0===i?"":String.fromCodePoint(i)}(eS):null,r=eS<t.length?ez(eS,eS+1):ez(eS,eS),new o(o.buildMessage(e,s),e,s,r)}return e.peg$library?{peg$result:i,peg$currPos:ew,peg$FAILED:h,peg$maxFailExpected:eA,peg$maxFailPos:eS,peg$success:ig,peg$throw:ig?void 0:iy}:ig?i:void iy()}}},53487,(t,e,i)=>{"use strict";let s="[^\\\\/]",r="[^/]",n="(?:\\/|$)",a="(?:^|\\/)",o=`\\.{1,2}${n}`,h=`(?!${a}${o})`,l=`(?!\\.{0,1}${n})`,u=`(?!${o})`,c=`${r}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:r,END_ANCHOR:n,DOTS_SLASH:o,NO_DOT:"(?!\\.)",NO_DOTS:h,NO_DOT_SLASH:l,NO_DOTS_SLASH:u,QMARK_NO_DOT:"[^.\\/]",STAR:c,START_ANCHOR:a,SEP:"/"},d={...p,SLASH_LITERAL:"[\\\\/]",QMARK:s,STAR:`${s}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?d:p}},19241,(t,e,i)=>{"use strict";var s=t.i(47167);let{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_GLOBAL:o}=t.r(53487);i.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),i.hasRegexChars=t=>a.test(t),i.isRegexChar=t=>1===t.length&&i.hasRegexChars(t),i.escapeRegex=t=>t.replace(o,"\\$1"),i.toPosixSlashes=t=>t.replace(r,"/"),i.isWindows=()=>{if("u">typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return void 0!==s.default&&!!s.default.platform&&"win32"===s.default.platform},i.removeBackslashes=t=>t.replace(n,t=>"\\"===t?"":t),i.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return -1===r?t:"\\"===t[r-1]?i.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`},i.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i},i.wrapOutput=(t,e={},i={})=>{let s=i.contains?"":"^",r=i.contains?"":"$",n=`${s}(?:${t})${r}`;return!0===e.negated&&(n=`(?:^(?!${n}).*$)`),n},i.basename=(t,{windows:e}={})=>{let i=t.split(e?/[\\/]/:"/"),s=i[i.length-1];return""===s?i[i.length-2]:s}},26094,(t,e,i)=>{"use strict";let s=t.r(19241),{CHAR_ASTERISK:r,CHAR_AT:n,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:h,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:m,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:x}=t.r(53487),b=t=>t===u||t===a,v=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};e.exports=(t,e)=>{let i,w,M=e||{},S=t.length-1,A=!0===M.parts||!0===M.scanToEnd,_=[],C=[],T=[],I=t,z=-1,k=0,B=0,R=!1,O=!1,E=!1,P=!1,L=!1,N=!1,F=!1,$=!1,V=!1,D=!1,j=0,U={value:"",depth:0,isGlob:!1},W=()=>z>=S,G=()=>I.charCodeAt(z+1),q=()=>(i=w,I.charCodeAt(++z));for(;z<S;){let t;if((w=q())===a){F=U.backslashes=!0,(w=q())===c&&(N=!0);continue}if(!0===N||w===c){for(j++;!0!==W()&&(w=q());){if(w===a){F=U.backslashes=!0,q();continue}if(w===c){j++;continue}if(!0!==N&&w===h&&(w=q())===h||!0!==N&&w===o){if(R=U.isBrace=!0,E=U.isGlob=!0,D=!0,!0===A)continue;break}if(w===g&&0==--j){N=!1,R=U.isBrace=!0,D=!0;break}}if(!0===A)continue;break}if(w===u){if(_.push(z),C.push(U),U={value:"",depth:0,isGlob:!1},!0===D)continue;if(i===h&&z===k+1){k+=2;continue}B=z+1;continue}if(!0!==M.noext&&!0==(w===m||w===n||w===r||w===f||w===l)&&G()===p){if(E=U.isGlob=!0,P=U.isExtglob=!0,D=!0,w===l&&z===k&&(V=!0),!0===A){for(;!0!==W()&&(w=q());){if(w===a){F=U.backslashes=!0,w=q();continue}if(w===y){E=U.isGlob=!0,D=!0;break}}continue}break}if(w===r){if(i===r&&(L=U.isGlobstar=!0),E=U.isGlob=!0,D=!0,!0===A)continue;break}if(w===f){if(E=U.isGlob=!0,D=!0,!0===A)continue;break}if(w===d){for(;!0!==W()&&(t=q());){if(t===a){F=U.backslashes=!0,q();continue}if(t===x){O=U.isBracket=!0,E=U.isGlob=!0,D=!0;break}}if(!0===A)continue;break}if(!0!==M.nonegate&&w===l&&z===k){$=U.negated=!0,k++;continue}if(!0!==M.noparen&&w===p){if(E=U.isGlob=!0,!0===A){for(;!0!==W()&&(w=q());){if(w===p){F=U.backslashes=!0,w=q();continue}if(w===y){D=!0;break}}continue}break}if(!0===E){if(D=!0,!0===A)continue;break}}!0===M.noext&&(P=!1,E=!1);let H=I,J="",X="";k>0&&(J=I.slice(0,k),I=I.slice(k),B-=k),H&&!0===E&&B>0?(H=I.slice(0,B),X=I.slice(B)):!0===E?(H="",X=I):H=I,H&&""!==H&&"/"!==H&&H!==I&&b(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),!0===M.unescape&&(X&&(X=s.removeBackslashes(X)),H&&!0===F&&(H=s.removeBackslashes(H)));let Z={prefix:J,input:t,start:k,base:H,glob:X,isBrace:R,isBracket:O,isGlob:E,isExtglob:P,isGlobstar:L,negated:$,negatedExtglob:V};if(!0===M.tokens&&(Z.maxDepth=0,b(w)||C.push(U),Z.tokens=C),!0===M.parts||!0===M.tokens){let e;for(let i=0;i<_.length;i++){let s=e?e+1:k,r=_[i],n=t.slice(s,r);M.tokens&&(0===i&&0!==k?(C[i].isPrefix=!0,C[i].value=J):C[i].value=n,v(C[i]),Z.maxDepth+=C[i].depth),(0!==i||""!==n)&&T.push(n),e=r}if(e&&e+1<t.length){let i=t.slice(e+1);T.push(i),M.tokens&&(C[C.length-1].value=i,v(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=_,Z.parts=T}return Z}},17932,(t,e,i)=>{"use strict";let s=t.r(53487),r=t.r(19241),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:h,REPLACEMENTS:l}=s,u=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;try{new RegExp(i)}catch(e){return t.map(t=>r.escapeRegex(t)).join("..")}return i},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,p=(t,e)=>{let i;if("string"!=typeof t)throw TypeError("Expected a string");t=l[t]||t;let d={...e},m="number"==typeof d.maxLength?Math.min(n,d.maxLength):n,f=t.length;if(f>m)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${m}`);let g={type:"bos",value:"",output:d.prepend||""},y=[g],x=d.capture?"":"?:",b=s.globChars(d.windows),v=s.extglobChars(b),{DOT_LITERAL:w,PLUS_LITERAL:M,SLASH_LITERAL:S,ONE_CHAR:A,DOTS_SLASH:_,NO_DOT:C,NO_DOT_SLASH:T,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:k,STAR:B,START_ANCHOR:R}=b,O=t=>`(${x}(?:(?!${R}${t.dot?_:w}).)*?)`,E=d.dot?"":C,P=d.dot?z:k,L=!0===d.bash?O(d):B;d.capture&&(L=`(${L})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let N={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};f=(t=r.removePrefix(t,N)).length;let F=[],$=[],V=[],D=g,j=()=>N.index===f-1,U=N.peek=(e=1)=>t[N.index+e],W=N.advance=()=>t[++N.index]||"",G=()=>t.slice(N.index+1),q=(t="",e=0)=>{N.consumed+=t,N.index+=e},H=t=>{N.output+=null!=t.output?t.output:t.value,q(t.value)},J=()=>{let t=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)W(),N.start++,t++;return t%2!=0&&(N.negated=!0,N.start++,!0)},X=t=>{N[t]++,V.push(t)},Z=t=>{N[t]--,V.pop()},Y=t=>{if("globstar"===D.type){let e=N.braces>0&&("comma"===t.type||"brace"===t.type),i=!0===t.extglob||F.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||i||(N.output=N.output.slice(0,-D.output.length),D.type="star",D.value="*",D.output=L,N.output+=D.output)}if(F.length&&"paren"!==t.type&&(F[F.length-1].inner+=t.value),(t.value||t.output)&&H(t),D&&"text"===D.type&&"text"===t.type){D.output=(D.output||D.value)+t.value,D.value+=t.value;return}t.prev=D,y.push(t),D=t},Q=(t,e)=>{let i={...v[e],conditions:1,inner:""};i.prev=D,i.parens=N.parens,i.output=N.output;let s=(d.capture?"(":"")+i.open;X("parens"),Y({type:t,value:e,output:N.output?"":A}),Y({type:"paren",extglob:!0,value:W(),output:s}),F.push(i)},K=t=>{let s,r=t.close+(d.capture?")":"");if("negate"===t.type){let i=L;if(t.inner&&t.inner.length>1&&t.inner.includes("/")&&(i=O(d)),(i!==L||j()||/^\)+$/.test(G()))&&(r=t.close=`)$))${i}`),t.inner.includes("*")&&(s=G())&&/^\.[^\\/.]+$/.test(s)){let n=p(s,{...e,fastpaths:!1}).output;r=t.close=`)${n})${i})`}"bos"===t.prev.type&&(N.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:i,output:r}),Z("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let i=!1,s=t.replace(h,(t,e,s,r,n,a)=>"\\"===r?(i=!0,t):"?"===r?e?e+r+(n?z.repeat(n.length):""):0===a?P+(n?z.repeat(n.length):""):z.repeat(s.length):"."===r?w.repeat(s.length):"*"===r?e?e+r+(n?L:""):L:e?t:`\\${t}`);return(!0===i&&(s=!0===d.unescape?s.replace(/\\/g,""):s.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),s===t&&!0===d.contains)?N.output=t:N.output=r.wrapOutput(s,N,e),N}for(;!j();){if("\0"===(i=W()))continue;if("\\"===i){let t=U();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){Y({type:"text",value:i+="\\"});continue}let e=/^\\+/.exec(G()),s=0;if(e&&e[0].length>2&&(s=e[0].length,N.index+=s,s%2!=0&&(i+="\\")),!0===d.unescape?i=W():i+=W(),0===N.brackets){Y({type:"text",value:i});continue}}if(N.brackets>0&&("]"!==i||"["===D.value||"[^"===D.value)){if(!1!==d.posix&&":"===i){let t=D.value.slice(1);if(t.includes("[")&&(D.posix=!0,t.includes(":"))){let t=D.value.lastIndexOf("["),e=D.value.slice(0,t),i=a[D.value.slice(t+2)];if(i){D.value=e+i,N.backtrack=!0,W(),g.output||1!==y.indexOf(D)||(g.output=A);continue}}}("["===i&&":"!==U()||"-"===i&&"]"===U())&&(i=`\\${i}`),"]"===i&&("["===D.value||"[^"===D.value)&&(i=`\\${i}`),!0===d.posix&&"!"===i&&"["===D.value&&(i="^"),D.value+=i,H({value:i});continue}if(1===N.quotes&&'"'!==i){i=r.escapeRegex(i),D.value+=i,H({value:i});continue}if('"'===i){N.quotes=+(1!==N.quotes),!0===d.keepQuotes&&Y({type:"text",value:i});continue}if("("===i){X("parens"),Y({type:"paren",value:i});continue}if(")"===i){if(0===N.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=F[F.length-1];if(t&&N.parens===t.parens+1){K(F.pop());continue}Y({type:"paren",value:i,output:N.parens?")":"\\)"}),Z("parens");continue}if("["===i){if(!0!==d.nobracket&&G().includes("]"))X("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));i=`\\${i}`}Y({type:"bracket",value:i});continue}if("]"===i){if(!0===d.nobracket||D&&"bracket"===D.type&&1===D.value.length){Y({type:"text",value:i,output:`\\${i}`});continue}if(0===N.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));Y({type:"text",value:i,output:`\\${i}`});continue}Z("brackets");let t=D.value.slice(1);if(!0===D.posix||"^"!==t[0]||t.includes("/")||(i=`/${i}`),D.value+=i,H({value:i}),!1===d.literalBrackets||r.hasRegexChars(t))continue;let e=r.escapeRegex(D.value);if(N.output=N.output.slice(0,-D.value.length),!0===d.literalBrackets){N.output+=e,D.value=e;continue}D.value=`(${x}${e}|${D.value})`,N.output+=D.value;continue}if("{"===i&&!0!==d.nobrace){X("braces");let t={type:"brace",value:i,output:"(",outputIndex:N.output.length,tokensIndex:N.tokens.length};$.push(t),Y(t);continue}if("}"===i){let t=$[$.length-1];if(!0===d.nobrace||!t){Y({type:"text",value:i,output:i});continue}let e=")";if(!0===t.dots){let t=y.slice(),i=[];for(let e=t.length-1;e>=0&&(y.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&i.unshift(t[e].value);e=u(i,d),N.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let s=N.output.slice(0,t.outputIndex),r=N.tokens.slice(t.tokensIndex);for(let n of(t.value=t.output="\\{",i=e="\\}",N.output=s,r))N.output+=n.output||n.value}Y({type:"brace",value:i,output:e}),Z("braces"),$.pop();continue}if("|"===i){F.length>0&&F[F.length-1].conditions++,Y({type:"text",value:i});continue}if(","===i){let t=i,e=$[$.length-1];e&&"braces"===V[V.length-1]&&(e.comma=!0,t="|"),Y({type:"comma",value:i,output:t});continue}if("/"===i){if("dot"===D.type&&N.index===N.start+1){N.start=N.index+1,N.consumed="",N.output="",y.pop(),D=g;continue}Y({type:"slash",value:i,output:S});continue}if("."===i){if(N.braces>0&&"dot"===D.type){"."===D.value&&(D.output=w);let t=$[$.length-1];D.type="dots",D.output+=i,D.value+=i,t.dots=!0;continue}if(N.braces+N.parens===0&&"bos"!==D.type&&"slash"!==D.type){Y({type:"text",value:i,output:w});continue}Y({type:"dot",value:i,output:w});continue}if("?"===i){if(!(D&&"("===D.value)&&!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",i);continue}if(D&&"paren"===D.type){let t=U(),e=i;("("!==D.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(G()))||(e=`\\${i}`),Y({type:"text",value:i,output:e});continue}if(!0!==d.dot&&("slash"===D.type||"bos"===D.type)){Y({type:"qmark",value:i,output:k});continue}Y({type:"qmark",value:i,output:z});continue}if("!"===i){if(!0!==d.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",i);continue}if(!0!==d.nonegate&&0===N.index){J();continue}}if("+"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",i);continue}if(D&&"("===D.value||!1===d.regex){Y({type:"plus",value:i,output:M});continue}if(D&&("bracket"===D.type||"paren"===D.type||"brace"===D.type)||N.parens>0){Y({type:"plus",value:i});continue}Y({type:"plus",value:M});continue}if("@"===i){if(!0!==d.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:i,output:""});continue}Y({type:"text",value:i});continue}if("*"!==i){("$"===i||"^"===i)&&(i=`\\${i}`);let t=o.exec(G());t&&(i+=t[0],N.index+=t[0].length),Y({type:"text",value:i});continue}if(D&&("globstar"===D.type||!0===D.star)){D.type="star",D.star=!0,D.value+=i,D.output=L,N.backtrack=!0,N.globstar=!0,q(i);continue}let e=G();if(!0!==d.noextglob&&/^\([^?]/.test(e)){Q("star",i);continue}if("star"===D.type){if(!0===d.noglobstar){q(i);continue}let s=D.prev,r=s.prev,n="slash"===s.type||"bos"===s.type,a=r&&("star"===r.type||"globstar"===r.type);if(!0===d.bash&&(!n||e[0]&&"/"!==e[0])){Y({type:"star",value:i,output:""});continue}let o=N.braces>0&&("comma"===s.type||"brace"===s.type),h=F.length&&("pipe"===s.type||"paren"===s.type);if(!n&&"paren"!==s.type&&!o&&!h){Y({type:"star",value:i,output:""});continue}for(;"/**"===e.slice(0,3);){let i=t[N.index+4];if(i&&"/"!==i)break;e=e.slice(3),q("/**",3)}if("bos"===s.type&&j()){D.type="globstar",D.value+=i,D.output=O(d),N.output=D.output,N.globstar=!0,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!a&&j()){N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=O(d)+(d.strictSlashes?")":"|$)"),D.value+=i,N.globstar=!0,N.output+=s.output+D.output,q(i);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";N.output=N.output.slice(0,-(s.output+D.output).length),s.output=`(?:${s.output}`,D.type="globstar",D.output=`${O(d)}${S}|${S}${t})`,D.value+=i,N.output+=s.output+D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===e[0]){D.type="globstar",D.value+=i,D.output=`(?:^|${S}|${O(d)}${S})`,N.output=D.output,N.globstar=!0,q(i+W()),Y({type:"slash",value:"/",output:""});continue}N.output=N.output.slice(0,-D.output.length),D.type="globstar",D.output=O(d),D.value+=i,N.output+=D.output,N.globstar=!0,q(i);continue}let s={type:"star",value:i,output:L};if(!0===d.bash){s.output=".*?",("bos"===D.type||"slash"===D.type)&&(s.output=E+s.output),Y(s);continue}if(D&&("bracket"===D.type||"paren"===D.type)&&!0===d.regex){s.output=i,Y(s);continue}(N.index===N.start||"slash"===D.type||"dot"===D.type)&&("dot"===D.type?(N.output+=T,D.output+=T):!0===d.dot?(N.output+=I,D.output+=I):(N.output+=E,D.output+=E),"*"!==U()&&(N.output+=A,D.output+=A)),Y(s)}for(;N.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));N.output=r.escapeLast(N.output,"["),Z("brackets")}for(;N.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));N.output=r.escapeLast(N.output,"("),Z("parens")}for(;N.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));N.output=r.escapeLast(N.output,"{"),Z("braces")}if(!0!==d.strictSlashes&&("star"===D.type||"bracket"===D.type)&&Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===N.backtrack)for(let t of(N.output="",N.tokens))N.output+=null!=t.output?t.output:t.value,t.suffix&&(N.output+=t.suffix);return N};p.fastpaths=(t,e)=>{let i={...e},a="number"==typeof i.maxLength?Math.min(n,i.maxLength):n,o=t.length;if(o>a)throw SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${a}`);t=l[t]||t;let{DOT_LITERAL:h,SLASH_LITERAL:u,ONE_CHAR:c,DOTS_SLASH:p,NO_DOT:d,NO_DOTS:m,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(i.windows),x=i.dot?m:d,b=i.dot?f:d,v=i.capture?"":"?:",w=!0===i.bash?".*?":g;i.capture&&(w=`(${w})`);let M=t=>!0===t.noglobstar?w:`(${v}(?:(?!${y}${t.dot?p:h}).)*?)`,S=t=>{switch(t){case"*":return`${x}${c}${w}`;case".*":return`${h}${c}${w}`;case"*.*":return`${x}${w}${h}${c}${w}`;case"*/*":return`${x}${w}${u}${c}${b}${w}`;case"**":return x+M(i);case"**/*":return`(?:${x}${M(i)}${u})?${b}${c}${w}`;case"**/*.*":return`(?:${x}${M(i)}${u})?${b}${w}${h}${c}${w}`;case"**/.*":return`(?:${x}${M(i)}${u})?${h}${c}${w}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let i=S(e[1]);if(!i)return;return i+h+e[2]}}},A=S(r.removePrefix(t,{negated:!1,prefix:""}));return A&&!0!==i.strictSlashes&&(A+=`${u}?`),A},e.exports=p},53174,(t,e,i)=>{"use strict";let s=t.r(26094),r=t.r(17932),n=t.r(19241),a=t.r(53487),o=(t,e,i=!1)=>{if(Array.isArray(t)){let s=t.map(t=>o(t,e,i));return t=>{for(let e of s){let i=e(t);if(i)return i}return!1}}let s=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!s)throw TypeError("Expected pattern to be a non-empty string");let r=e||{},n=r.windows,a=s?o.compileRe(t,e):o.makeRe(t,e,!1,!0),h=a.state;delete a.state;let l=()=>!1;if(r.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};l=o(r.ignore,t,i)}let u=(i,s=!1)=>{let{isMatch:u,match:c,output:p}=o.test(i,a,e,{glob:t,posix:n}),d={glob:t,state:h,regex:a,posix:n,input:i,output:p,match:c,isMatch:u};return("function"==typeof r.onResult&&r.onResult(d),!1===u)?(d.isMatch=!1,!!s&&d):l(i)?("function"==typeof r.onIgnore&&r.onIgnore(d),d.isMatch=!1,!!s&&d):("function"==typeof r.onMatch&&r.onMatch(d),!s||d)};return i&&(u.state=h),u};o.test=(t,e,i,{glob:s,posix:r}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let a=i||{},h=a.format||(r?n.toPosixSlashes:null),l=t===s,u=l&&h?h(t):t;return!1===l&&(l=(u=h?h(t):t)===s),(!1===l||!0===a.capture)&&(l=!0===a.matchBase||!0===a.basename?o.matchBase(t,e,i,r):e.exec(u)),{isMatch:!!l,match:l,output:u}},o.matchBase=(t,e,i)=>(e instanceof RegExp?e:o.makeRe(e,i)).test(n.basename(t)),o.isMatch=(t,e,i)=>o(e,i)(t),o.parse=(t,e)=>Array.isArray(t)?t.map(t=>o.parse(t,e)):r(t,{...e,fastpaths:!1}),o.scan=(t,e)=>s(t,e),o.compileRe=(t,e,i=!1,s=!1)=>{if(!0===i)return t.output;let r=e||{},n=r.contains?"":"^",a=r.contains?"":"$",h=`${n}(?:${t.output})${a}`;t&&!0===t.negated&&(h=`^(?!${h}).*$`);let l=o.toRegex(h,e);return!0===s&&(l.state=t),l},o.makeRe=(t,e={},i=!1,s=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(n.output=r.fastpaths(t,e)),n.output||(n=r(t,e)),o.compileRe(n,e,i,s)},o.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},o.constants=a,e.exports=o},54970,(t,e,i)=>{"use strict";let s=t.r(53174),r=t.r(19241);function n(t,e,i=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:r.isWindows()}),s(t,e,i)}Object.assign(n,s),e.exports=n},62395,33870,38433,86608,t=>{"use strict";var e=t.i(90072);t.s(["parse",()=>E,"runServer",()=>N],86608);var i=t.i(92552);function s(t){let e=t.indexOf("::");return -1===e?null:{namespace:t.slice(0,e),method:t.slice(e+2)}}let r={"+":"$.add","-":"$.sub","*":"$.mul","/":"$.div","<":"$.lt","<=":"$.le",">":"$.gt",">=":"$.ge","==":"$.eq","!=":"$.ne","%":"$.mod","&":"$.bitand","|":"$.bitor","^":"$.bitxor","<<":"$.shl",">>":"$.shr"};class n{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(t={}){this.indent=t.indent??" ",this.runtime=t.runtime??"$",this.functions=t.functions??"$f",this.globals=t.globals??"$g",this.locals=t.locals??"$l"}getAccessInfo(t){if("Variable"===t.type){let e=JSON.stringify(t.name),i="global"===t.scope?this.globals:this.locals;return{getter:`${i}.get(${e})`,setter:t=>`${i}.set(${e}, ${t})`,postIncHelper:`${i}.postInc(${e})`,postDecHelper:`${i}.postDec(${e})`}}if("MemberExpression"===t.type){let e=this.expression(t.object),i="Identifier"===t.property.type?JSON.stringify(t.property.name):this.expression(t.property);return{getter:`${this.runtime}.prop(${e}, ${i})`,setter:t=>`${this.runtime}.setProp(${e}, ${i}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${e}, ${i})`,postDecHelper:`${this.runtime}.propPostDec(${e}, ${i})`}}if("IndexExpression"===t.type){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals,r=e.join(", ");return{getter:`${s}.get(${i}, ${r})`,setter:t=>`${s}.set(${i}, ${r}, ${t})`,postIncHelper:`${s}.postInc(${i}, ${r})`,postDecHelper:`${s}.postDec(${i}, ${r})`}}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return{getter:`${this.runtime}.prop(${s}, ${n})`,setter:t=>`${this.runtime}.setProp(${s}, ${n}, ${t})`,postIncHelper:`${this.runtime}.propPostInc(${s}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${s}, ${n})`}}let i=this.expression(t.object),s=1===e.length?e[0]:`${this.runtime}.key(${e.join(", ")})`;return{getter:`${this.runtime}.getIndex(${i}, ${s})`,setter:t=>`${this.runtime}.setIndex(${i}, ${s}, ${t})`,postIncHelper:`${this.runtime}.indexPostInc(${i}, ${s})`,postDecHelper:`${this.runtime}.indexPostDec(${i}, ${s})`}}return null}generate(t){let e=[];for(let i of t.body){let t=this.statement(i);t&&e.push(t)}return e.join("\n\n")}statement(t){switch(t.type){case"Comment":return"";case"ExpressionStatement":return this.line(`${this.expression(t.expression)};`);case"FunctionDeclaration":return this.functionDeclaration(t);case"PackageDeclaration":return this.packageDeclaration(t);case"DatablockDeclaration":return this.datablockDeclaration(t);case"ObjectDeclaration":return this.line(`${this.objectDeclaration(t)};`);case"IfStatement":return this.ifStatement(t);case"ForStatement":return this.forStatement(t);case"WhileStatement":return this.whileStatement(t);case"DoWhileStatement":return this.doWhileStatement(t);case"SwitchStatement":return this.switchStatement(t);case"ReturnStatement":return this.returnStatement(t);case"BreakStatement":return this.line("break;");case"ContinueStatement":return this.line("continue;");case"BlockStatement":return this.blockStatement(t);default:throw Error(`Unknown statement type: ${t.type}`)}}functionDeclaration(t){let e=s(t.name.name);if(e){let i=e.namespace,s=e.method;this.currentClass=i.toLowerCase(),this.currentFunction=s.toLowerCase();let r=this.functionBody(t.body,t.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(i)}, ${JSON.stringify(s)}, function() {`)}
|
||
${r}
|
||
${this.line("});")}`}{let e=t.name.name;this.currentFunction=e.toLowerCase();let i=this.functionBody(t.body,t.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(e)}, function() {`)}
|
||
${i}
|
||
${this.line("});")}`}}functionBody(t,e){this.indentLevel++;let i=[];i.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let t=0;t<e.length;t++)i.push(this.line(`${this.locals}.set(${JSON.stringify(e[t].name)}, arguments[${t}]);`));for(let e of t.body)i.push(this.statement(e));return this.indentLevel--,i.join("\n")}packageDeclaration(t){let e=JSON.stringify(t.name.name);this.indentLevel++;let i=t.body.map(t=>this.statement(t)).join("\n\n");return this.indentLevel--,`${this.line(`${this.runtime}.package(${e}, function() {`)}
|
||
${i}
|
||
${this.line("});")}`}datablockDeclaration(t){let e=JSON.stringify(t.className.name),i=t.instanceName?JSON.stringify(t.instanceName.name):"null",s=t.parent?JSON.stringify(t.parent.name):"null",r=this.objectBody(t.body);return this.line(`${this.runtime}.datablock(${e}, ${i}, ${s}, ${r});`)}objectDeclaration(t){let e="Identifier"===t.className.type?JSON.stringify(t.className.name):this.expression(t.className),i=null===t.instanceName?"null":"Identifier"===t.instanceName.type?JSON.stringify(t.instanceName.name):this.expression(t.instanceName),s=[],r=[];for(let e of t.body)"Assignment"===e.type?s.push(e):r.push(e);let n=this.objectBody(s);if(r.length>0){let t=r.map(t=>this.objectDeclaration(t)).join(",\n");return`${this.runtime}.create(${e}, ${i}, ${n}, [
|
||
${t}
|
||
])`}return`${this.runtime}.create(${e}, ${i}, ${n})`}objectBody(t){if(0===t.length)return"{}";let e=[];for(let i of t)if("Assignment"===i.type){let t=this.expression(i.value);if("Identifier"===i.target.type){let s=i.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)?e.push(`${s}: ${t}`):e.push(`[${JSON.stringify(s)}]: ${t}`)}else if("IndexExpression"===i.target.type){let s=this.objectPropertyKey(i.target);e.push(`[${s}]: ${t}`)}else{let s=this.expression(i.target);e.push(`[${s}]: ${t}`)}}if(e.length<=1)return`{ ${e.join(", ")} }`;let i=this.indent.repeat(this.indentLevel+1),s=this.indent.repeat(this.indentLevel);return`{
|
||
${i}${e.join(",\n"+i)}
|
||
${s}}`}objectPropertyKey(t){let e="Identifier"===t.object.type?JSON.stringify(t.object.name):this.expression(t.object),i=Array.isArray(t.index)?t.index.map(t=>this.expression(t)).join(", "):this.expression(t.index);return`${this.runtime}.key(${e}, ${i})`}ifStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.consequent);if(t.alternate)if("IfStatement"===t.alternate.type){let s=this.ifStatement(t.alternate).replace(/^\s*/,"");return this.line(`if (${e}) ${i} else ${s}`)}else{let s=this.statementAsBlock(t.alternate);return this.line(`if (${e}) ${i} else ${s}`)}return this.line(`if (${e}) ${i}`)}forStatement(t){let e=t.init?this.expression(t.init):"",i=t.test?this.expression(t.test):"",s=t.update?this.expression(t.update):"",r=this.statementAsBlock(t.body);return this.line(`for (${e}; ${i}; ${s}) ${r}`)}whileStatement(t){let e=this.expression(t.test),i=this.statementAsBlock(t.body);return this.line(`while (${e}) ${i}`)}doWhileStatement(t){let e=this.statementAsBlock(t.body),i=this.expression(t.test);return this.line(`do ${e} while (${i});`)}switchStatement(t){if(t.stringMode)return this.switchStringStatement(t);let e=this.expression(t.discriminant);this.indentLevel++;let i=[];for(let e of t.cases)i.push(this.switchCase(e));return this.indentLevel--,`${this.line(`switch (${e}) {`)}
|
||
${i.join("\n")}
|
||
${this.line("}")}`}switchCase(t){let e=[];if(null===t.test)e.push(this.line("default:"));else if(Array.isArray(t.test))for(let i of t.test)e.push(this.line(`case ${this.expression(i)}:`));else e.push(this.line(`case ${this.expression(t.test)}:`));for(let i of(this.indentLevel++,t.consequent))e.push(this.statement(i));return e.push(this.line("break;")),this.indentLevel--,e.join("\n")}switchStringStatement(t){let e=this.expression(t.discriminant),i=[];for(let e of t.cases)if(null===e.test)i.push(`default: () => { ${this.blockContent(e.consequent)} }`);else if(Array.isArray(e.test))for(let t of e.test)i.push(`${this.expression(t)}: () => { ${this.blockContent(e.consequent)} }`);else i.push(`${this.expression(e.test)}: () => { ${this.blockContent(e.consequent)} }`);return this.line(`${this.runtime}.switchStr(${e}, { ${i.join(", ")} });`)}returnStatement(t){return t.value?this.line(`return ${this.expression(t.value)};`):this.line("return;")}blockStatement(t){this.indentLevel++;let e=t.body.map(t=>this.statement(t)).join("\n");return this.indentLevel--,`{
|
||
${e}
|
||
${this.line("}")}`}statementAsBlock(t){if("BlockStatement"===t.type)return this.blockStatement(t);this.indentLevel++;let e=this.statement(t);return this.indentLevel--,`{
|
||
${e}
|
||
${this.line("}")}`}blockContent(t){return t.map(t=>this.statement(t).trim()).join(" ")}expression(t){switch(t.type){case"Identifier":return this.identifier(t);case"Variable":return this.variable(t);case"NumberLiteral":case"BooleanLiteral":return String(t.value);case"StringLiteral":return JSON.stringify(t.value);case"BinaryExpression":return this.binaryExpression(t);case"UnaryExpression":return this.unaryExpression(t);case"PostfixExpression":return this.postfixExpression(t);case"AssignmentExpression":return this.assignmentExpression(t);case"ConditionalExpression":return`(${this.expression(t.test)} ? ${this.expression(t.consequent)} : ${this.expression(t.alternate)})`;case"CallExpression":return this.callExpression(t);case"MemberExpression":return this.memberExpression(t);case"IndexExpression":return this.indexExpression(t);case"TagDereferenceExpression":return`${this.runtime}.deref(${this.expression(t.argument)})`;case"ObjectDeclaration":return this.objectDeclaration(t);case"DatablockDeclaration":return`${this.runtime}.datablock(${JSON.stringify(t.className.name)}, ${t.instanceName?JSON.stringify(t.instanceName.name):"null"}, ${t.parent?JSON.stringify(t.parent.name):"null"}, ${this.objectBody(t.body)})`;default:throw Error(`Unknown expression type: ${t.type}`)}}identifier(t){let e=s(t.name);return e&&"parent"===e.namespace.toLowerCase()?t.name:e?`${this.runtime}.nsRef(${JSON.stringify(e.namespace)}, ${JSON.stringify(e.method)})`:JSON.stringify(t.name)}variable(t){return"global"===t.scope?`${this.globals}.get(${JSON.stringify(t.name)})`:`${this.locals}.get(${JSON.stringify(t.name)})`}binaryExpression(t){let e=this.expression(t.left),i=this.expression(t.right),s=t.operator,n=this.concatExpression(e,s,i);if(n)return n;if("$="===s)return`${this.runtime}.streq(${e}, ${i})`;if("!$="===s)return`!${this.runtime}.streq(${e}, ${i})`;if("&&"===s||"||"===s)return`(${e} ${s} ${i})`;let a=r[s];return a?`${a}(${e}, ${i})`:`(${e} ${s} ${i})`}unaryExpression(t){if("++"===t.operator||"--"===t.operator){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?1:-1;return e.setter(`${this.runtime}.add(${e.getter}, ${i})`)}}let e=this.expression(t.argument);return"~"===t.operator?`${this.runtime}.bitnot(${e})`:"-"===t.operator?`${this.runtime}.neg(${e})`:`${t.operator}${e}`}postfixExpression(t){let e=this.getAccessInfo(t.argument);if(e){let i="++"===t.operator?e.postIncHelper:e.postDecHelper;if(i)return i}return`${this.expression(t.argument)}${t.operator}`}assignmentExpression(t){let e=this.expression(t.value),i=t.operator,s=this.getAccessInfo(t.target);if(!s)throw Error(`Unhandled assignment target type: ${t.target.type}`);if("="===i)return s.setter(e);{let t=i.slice(0,-1),r=this.compoundAssignmentValue(s.getter,t,e);return s.setter(r)}}callExpression(t){let e=t.arguments.map(t=>this.expression(t)).join(", ");if("Identifier"===t.callee.type){let i=t.callee.name,r=s(i);if(r&&"parent"===r.namespace.toLowerCase())if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${e?", "+e:""})`;else if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${e?", "+e:""})`;else throw Error("Parent:: call outside of function context");return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${e?", "+e:""})`:`${this.functions}.call(${JSON.stringify(i)}${e?", "+e:""})`}if("MemberExpression"===t.callee.type){let i=this.expression(t.callee.object),s="Identifier"===t.callee.property.type?JSON.stringify(t.callee.property.name):this.expression(t.callee.property);return`${this.runtime}.call(${i}, ${s}${e?", "+e:""})`}let i=this.expression(t.callee);return`${i}(${e})`}memberExpression(t){let e=this.expression(t.object);return t.computed||"Identifier"!==t.property.type?`${this.runtime}.prop(${e}, ${this.expression(t.property)})`:`${this.runtime}.prop(${e}, ${JSON.stringify(t.property.name)})`}indexExpression(t){let e=Array.isArray(t.index)?t.index.map(t=>this.expression(t)):[this.expression(t.index)];if("Variable"===t.object.type){let i=JSON.stringify(t.object.name),s="global"===t.object.scope?this.globals:this.locals;return`${s}.get(${i}, ${e.join(", ")})`}if("MemberExpression"===t.object.type){let i=t.object,s=this.expression(i.object),r="Identifier"===i.property.type?JSON.stringify(i.property.name):this.expression(i.property),n=`${this.runtime}.key(${r}, ${e.join(", ")})`;return`${this.runtime}.prop(${s}, ${n})`}let i=this.expression(t.object);return 1===e.length?`${this.runtime}.getIndex(${i}, ${e[0]})`:`${this.runtime}.getIndex(${i}, ${this.runtime}.key(${e.join(", ")}))`}line(t){return this.indent.repeat(this.indentLevel)+t}concatExpression(t,e,i){switch(e){case"@":return`${this.runtime}.concat(${t}, ${i})`;case"SPC":return`${this.runtime}.concat(${t}, " ", ${i})`;case"TAB":return`${this.runtime}.concat(${t}, "\\t", ${i})`;case"NL":return`${this.runtime}.concat(${t}, "\\n", ${i})`;default:return null}}compoundAssignmentValue(t,e,i){let s=this.concatExpression(t,e,i);if(s)return s;let n=r[e];return n?`${n}(${t}, ${i})`:`(${t} ${e} ${i})`}}t.s(["createRuntime",()=>R,"createScriptCache",()=>I],33870);var a=t.i(54970);class o{map=new Map;keyLookup=new Map;constructor(t){if(t)for(const[e,i]of t)this.set(e,i)}get size(){return this.map.size}get(t){let e=this.keyLookup.get(t.toLowerCase());return void 0!==e?this.map.get(e):void 0}set(t,e){let i=t.toLowerCase(),s=this.keyLookup.get(i);return void 0!==s?this.map.set(s,e):(this.keyLookup.set(i,t),this.map.set(t,e)),this}has(t){return this.keyLookup.has(t.toLowerCase())}delete(t){let e=t.toLowerCase(),i=this.keyLookup.get(e);return void 0!==i&&(this.keyLookup.delete(e),this.map.delete(i))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(t){for(let[e,i]of this.map)t(i,e,this)}get[Symbol.toStringTag](){return"CaseInsensitiveMap"}getOriginalKey(t){return this.keyLookup.get(t.toLowerCase())}}class h{set=new Set;constructor(t){if(t)for(const e of t)this.add(e)}get size(){return this.set.size}add(t){return this.set.add(t.toLowerCase()),this}has(t){return this.set.has(t.toLowerCase())}delete(t){return this.set.delete(t.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return"CaseInsensitiveSet"}}function l(t){return t.replace(/\\/g,"/").toLowerCase()}function u(t){return String(t??"")}function c(t){return Number(t)||0}function p(t){let e=u(t||"0 0 0").split(" ").map(Number);return[e[0]||0,e[1]||0,e[2]||0]}function d(t,e,i){let s=0;for(;e+s<t.length&&!i.includes(t[e+s]);)s++;return s}function m(t,e,i){let s=0;for(;e>0;){if(s>=t.length)return"";let r=d(t,s,i);if(s+r>=t.length)return"";s+=r+1,e--}let r=d(t,s,i);return 0===r?"":t.substring(s,s+r)}function f(t,e,i,s){let r=0,n=e;for(;n>0;){if(r>=t.length)return"";let e=d(t,r,s);if(r+e>=t.length)return"";r+=e+1,n--}let a=r,o=i-e+1;for(;o>0;){let e=d(t,r,s);if((r+=e)>=t.length)break;r++,o--}let h=r;return h>a&&s.includes(t[h-1])&&h--,t.substring(a,h)}function g(t,e){if(""===t)return 0;let i=0;for(let s=0;s<t.length;s++)e.includes(t[s])&&i++;return i+1}function y(t,e,i,s,r){let n=[],a=0,o=0;for(;a<t.length||o<=e;){if(a<t.length){let r=d(t,a,s);o===e?n.push(i):n.push(t.substring(a,a+r)),(a+=r)<t.length&&a++}else o===e?n.push(i):n.push("");if(++o>e&&a>=t.length)break}return n.join(r)}function x(t,e,i,s){let r=[],n=0,a=0;for(;n<t.length;){let s=d(t,n,i);a!==e&&r.push(t.substring(n,n+s)),(n+=s)<t.length&&n++,a++}return r.join(s)}function b(t){let{runtime:e,fileSystem:i}=t,s=[],r=0,n="";return{echo(...t){console.log(...t.map(u))},warn(...t){console.warn(...t.map(u))},error(...t){console.error(...t.map(u))},call:(t,...i)=>e().$f.call(u(t),...i),eval(t){throw Error("eval() not implemented: requires runtime parsing and execution")},collapseescape:t=>u(t).replace(/\\([ntr\\])/g,(t,e)=>"n"===e?"\n":"t"===e?" ":"r"===e?"\r":"\\"),expandescape:t=>u(t).replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),export(t,e,i){console.warn(`export(${t}): not implemented`)},quit(){console.warn("quit(): not implemented in browser")},trace(t){},isobject:t=>e().$.isObject(t),nametoid:t=>e().$.nameToId(t),strlen:t=>u(t).length,strchr(t,e){let i=u(t),s=u(e)[0]??"",r=i.indexOf(s);return r>=0?i.substring(r):""},strpos:(t,e,i)=>u(t).indexOf(u(e),c(i)),strcmp(t,e){let i=u(t),s=u(e);return i<s?-1:+(i>s)},stricmp(t,e){let i=u(t).toLowerCase(),s=u(e).toLowerCase();return i<s?-1:+(i>s)},strstr:(t,e)=>u(t).indexOf(u(e)),getsubstr(t,e,i){let s=u(t),r=c(e);return void 0===i?s.substring(r):s.substring(r,r+c(i))},getword:(t,e)=>m(u(t),c(e)," \n"),getwordcount:t=>g(u(t)," \n"),getfield:(t,e)=>m(u(t),c(e)," \n"),getfieldcount:t=>g(u(t)," \n"),setword:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),setfield:(t,e,i)=>y(u(t),c(e),u(i)," \n"," "),firstword:t=>m(u(t),0," \n"),restwords:t=>f(u(t),1,1e6," \n"),trim:t=>u(t).trim(),ltrim:t=>u(t).replace(/^\s+/,""),rtrim:t=>u(t).replace(/\s+$/,""),strupr:t=>u(t).toUpperCase(),strlwr:t=>u(t).toLowerCase(),strreplace:(t,e,i)=>u(t).split(u(e)).join(u(i)),filterstring:(t,e)=>u(t),stripchars(t,e){let i=u(t),s=new Set(u(e).split(""));return i.split("").filter(t=>!s.has(t)).join("")},getfields(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},getwords(t,e,i){let s=void 0!==i?Number(i):1e6;return f(u(t),c(e),s," \n")},removeword:(t,e)=>x(u(t),c(e)," \n"," "),removefield:(t,e)=>x(u(t),c(e)," \n"," "),getrecord:(t,e)=>m(u(t),c(e),"\n"),getrecordcount:t=>g(u(t),"\n"),setrecord:(t,e,i)=>y(u(t),c(e),u(i),"\n","\n"),removerecord:(t,e)=>x(u(t),c(e),"\n","\n"),nexttoken(t,e,i){throw Error("nextToken() is not implemented: it requires variable mutation")},strtoplayername:t=>u(t).replace(/[^\w\s-]/g,"").trim(),mabs:t=>Math.abs(c(t)),mfloor:t=>Math.floor(c(t)),mceil:t=>Math.ceil(c(t)),msqrt:t=>Math.sqrt(c(t)),mpow:(t,e)=>Math.pow(c(t),c(e)),msin:t=>Math.sin(c(t)),mcos:t=>Math.cos(c(t)),mtan:t=>Math.tan(c(t)),masin:t=>Math.asin(c(t)),macos:t=>Math.acos(c(t)),matan:(t,e)=>Math.atan2(c(t),c(e)),mlog:t=>Math.log(c(t)),getrandom(t,e){if(void 0===t)return Math.random();if(void 0===e)return Math.floor(Math.random()*(c(t)+1));let i=c(t);return Math.floor(Math.random()*(c(e)-i+1))+i},mdegtorad:t=>c(t)*(Math.PI/180),mradtodeg:t=>c(t)*(180/Math.PI),mfloatlength:(t,e)=>c(t).toFixed(c(e)),getboxcenter(t){let e=u(t).split(" ").map(Number),i=e[0]||0,s=e[1]||0,r=e[2]||0,n=e[3]||0,a=e[4]||0,o=e[5]||0;return`${(i+n)/2} ${(s+a)/2} ${(r+o)/2}`},vectoradd(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i+n} ${s+a} ${r+o}`},vectorsub(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${i-n} ${s-a} ${r-o}`},vectorscale(t,e){let[i,s,r]=p(t),n=c(e);return`${i*n} ${s*n} ${r*n}`},vectordot(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return i*n+s*a+r*o},vectorcross(t,e){let[i,s,r]=p(t),[n,a,o]=p(e);return`${s*o-r*a} ${r*n-i*o} ${i*a-s*n}`},vectorlen(t){let[e,i,s]=p(t);return Math.sqrt(e*e+i*i+s*s)},vectornormalize(t){let[e,i,s]=p(t),r=Math.sqrt(e*e+i*i+s*s);return 0===r?"0 0 0":`${e/r} ${i/r} ${s/r}`},vectordist(t,e){let[i,s,r]=p(t),[n,a,o]=p(e),h=i-n,l=s-a,u=r-o;return Math.sqrt(h*h+l*l+u*u)},matrixcreate(t,e){throw Error("MatrixCreate() not implemented: requires axis-angle rotation math")},matrixcreatefromeuler(t){throw Error("MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion")},matrixmultiply(t,e){throw Error("MatrixMultiply() not implemented: requires full 4x4 matrix multiplication")},matrixmulpoint(t,e){throw Error("MatrixMulPoint() not implemented: requires full transform application")},matrixmulvector(t,e){throw Error("MatrixMulVector() not implemented: requires rotation matrix application")},getsimtime:()=>Date.now()-e().state.startTime,getrealtime:()=>Date.now(),schedule(t,i,s,...r){let n=Number(t)||0,a=e(),o=setTimeout(()=>{a.state.pendingTimeouts.delete(o);try{a.$f.call(String(s),...r)}catch(t){throw console.error(`schedule: error calling ${s}:`,t),t}},n);return a.state.pendingTimeouts.add(o),o},cancel(t){clearTimeout(t),e().state.pendingTimeouts.delete(t)},iseventpending:t=>e().state.pendingTimeouts.has(t),exec(t){let i=String(t??"");if(console.debug(`exec(${JSON.stringify(i)}): preparing to execute…`),!i.includes("."))return console.error(`exec: invalid script file name ${JSON.stringify(i)}.`),!1;let s=l(i),r=e(),{executedScripts:n,scripts:a}=r.state;if(n.has(s))return console.debug(`exec(${JSON.stringify(i)}): skipping (already executed)`),!0;let o=a.get(s);return null==o?(console.warn(`exec(${JSON.stringify(i)}): script not found`),!1):(n.add(s),console.debug(`exec(${JSON.stringify(i)}): executing!`),r.executeAST(o),!0)},compile(t){throw Error("compile() not implemented: requires DSO bytecode compiler")},isdemo:()=>!1,isfile:t=>i?i.isFile(u(t)):(console.warn("isFile(): no fileSystem handler configured"),!1),fileext(t){let e=u(t),i=e.lastIndexOf(".");return i>=0?e.substring(i):""},filebase(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),s=e.lastIndexOf("."),r=i>=0?i+1:0,n=s>r?s:e.length;return e.substring(r,n)},filepath(t){let e=u(t),i=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return i>=0?e.substring(0,i):""},expandfilename(t){throw Error("expandFilename() not implemented: requires filesystem path expansion")},findfirstfile:t=>i?(n=u(t),s=i.findFiles(n),r=0,s[r++]??""):(console.warn("findFirstFile(): no fileSystem handler configured"),""),findnextfile(t){let e=u(t);if(e!==n){if(!i)return"";n=e,s=i.findFiles(e)}return s[r++]??""},getfilecrc:t=>u(t),iswriteablefilename:t=>!1,activatepackage(t){e().$.activatePackage(u(t))},deactivatepackage(t){e().$.deactivatePackage(u(t))},ispackage:t=>e().$.isPackage(u(t)),isactivepackage:t=>e().$.isActivePackage(u(t)),getpackagelist:()=>e().$.getPackageList(),addmessagecallback(t,e){},alxcreatesource:(...t)=>0,alxgetwavelen:t=>0,alxlistenerf(t,e){},alxplay:(...t)=>0,alxsetchannelvolume(t,e){},alxsourcef(t,e,i){},alxstop(t){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(t){},isjoystickdetected:()=>!1,lockmouse(t){},addmaterialmapping(t,e){},flushtexturecache(){},getdesktopresolution:()=>"1920 1080 32",getdisplaydevicelist:()=>"OpenGL",getresolutionlist:t=>"640 480 800 600 1024 768 1280 720 1920 1080",getvideodriverinfo:()=>"WebGL",isdevicefullscreenonly:t=>!1,isfullscreen:()=>!1,screenshot(t){},setdisplaydevice:t=>!0,setfov(t){},setinteriorrendermode(t){},setopenglanisotropy(t){},setopenglmipreduction(t){},setopenglskymipreduction(t){},setopengltexturecompressionhint(t){},setscreenmode(t,e,i,s){},setverticalsync(t){},setzoomspeed(t){},togglefullscreen(){},videosetgammacorrection(t){},snaptoggle(){},addtaggedstring:t=>0,buildtaggedstring:(t,...e)=>"",detag:t=>u(t),gettag:t=>0,gettaggedstring:t=>"",removetaggedstring(t){},commandtoclient(t,e){},commandtoserver(t){},cancelserverquery(){},querymasterserver(){},querysingleserver(){},setnetport:t=>!0,allowconnections(t){},startheartbeat(){},stopheartbeat(){},gotowebpage(t){},deletedatablocks(){},preloaddatablock:t=>!0,containerboxempty:(...t)=>!0,containerraycast:(...t)=>"",containersearchcurrdist:()=>0,containersearchnext:()=>0,initcontainerradiussearch(){},calcexplosioncoverage:(...t)=>1,getcontrolobjectaltitude:()=>0,getcontrolobjectspeed:()=>0,getterrainheight:t=>0,lightscene(){},pathonmissionloaddone(){}}}function v(t){return t.toLowerCase()}function w(t){let e=t.trim();return v(e.startsWith("$")?e.slice(1):e)}function M(t,e){let i=t.get(e);return i||(i=new Set,t.set(e,i)),i}function S(t,e){for(let i of e)t.add(v(i))}function A(t,e,i){if(t.anyClassValues.has("*")||t.anyClassValues.has(i))return!0;for(let s of e){let e=t.valuesByClass.get(v(s));if(e&&(e.has("*")||e.has(i)))return!0}return!1}let _=[{classNames:["SceneObject","GameBase","ShapeBase","Item","Player"],fields:["position","rotation","scale","transform","hidden","renderingdistance","datablock","shapename","shapefile","initialbarrel","skin","team","health","energy","energylevel","damagelevel","damageflash","damagepercent","damagestate","mountobject","mountedimage","targetposition","targetrotation","targetscale","missiontypeslist","renderenabled","vis","velocity","name"]},{classNames:["*"],fields:["position","rotation","scale","hidden","shapefile","datablock"]}],C=[{classNames:["SceneObject","GameBase","ShapeBase","SimObject"],methods:["settransform","setposition","setrotation","setscale","sethidden","setdatablock","setshapename","mountimage","unmountimage","mountobject","unmountobject","setdamagelevel","setenergylevel","schedule","delete","deleteallobjects","add","remove","playthread","stopthread","setthreaddir","pausethread"]},{classNames:["*"],methods:["settransform","setscale","delete","add","remove"]}],T=["missionrunning","loadingmission"];function I(){return{scripts:new Map,generatedCode:new WeakMap}}function z(t){return t.toLowerCase()}function k(t){return Number(t)>>>0}function B(t){if(null==t)return null;if("string"==typeof t)return t||null;if("number"==typeof t)return String(t);throw Error(`Invalid instance name type: ${typeof t}`)}function R(t={}){let e,i,s,r=t.reactiveFieldRules??_,u=t.reactiveMethodRules??C,c=t.reactiveGlobalNames??T,p=(e=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.fields);continue}S(M(i,r),s.fields)}return{anyClassValues:e,valuesByClass:i}}(r),(t,i)=>A(e,t,v(i))),d=(i=function(t){let e=new Set,i=new Map;for(let s of t)for(let t of s.classNames){let r=v(t);if("*"===r){S(e,s.methods);continue}S(M(i,r),s.methods)}return{anyClassValues:e,valuesByClass:i}}(u),(t,e)=>A(i,t,v(e))),m=(s=function(t){let e=new Set;for(let i of t)e.add(w(i));return e}(c),t=>{let e=w(t);return s.has("*")||s.has(e)}),f=new o,g=new o,y=new o,x=[],O=new h,P=3,L=1027,N=new Map,F=new o,$=new o,V=new o,D=new o,j=new o,U=new Set,W=[],G=!1,q=0;if(t.globals)for(let[e,i]of Object.entries(t.globals)){if(!e.startsWith("$"))throw Error(`Global variable "${e}" must start with $, e.g. "$${e}"`);V.set(e.slice(1),i)}let H=new Set,J=new Set,X=t.ignoreScripts&&t.ignoreScripts.length>0?(0,a.default)(t.ignoreScripts,{nocase:!0}):null,Z=t.cache??I(),Y=Z.scripts,Q=Z.generatedCode,K=new Map;function tt(t){let e=K.get(t);return e&&e.length>0?e[e.length-1]:void 0}function te(t,e,i){let s;(s=K.get(t))||(s=[],K.set(t,s)),s.push(e);try{return i()}finally{let e;(e=K.get(t))&&e.pop()}}function ti(t,e){return`${t.toLowerCase()}::${e.toLowerCase()}`}function ts(t,e){return f.get(t)?.get(e)??null}function tr(t){if(!t)return[];let e=[],i=new Set,s=t.class||t._className||t._class,r=s?z(String(s)):"";for(;r&&!i.has(r);)e.push(r),i.add(r),r=j.get(r)??"";return t._superClass&&!i.has(t._superClass)&&e.push(t._superClass),e}function tn(){if(G=!1,0===W.length)return;let t=W.splice(0,W.length);for(let e of(q+=1,U))e({type:"batch.flushed",tick:q,events:t})}function ta(t){for(let e of(W.push(t),U))e(t);G||(G=!0,queueMicrotask(tn))}function to(t){ta({type:"object.created",objectId:t._id,object:t})}function th(t,e,i,s){let r=z(e);Object.is(i,s)||p(tr(t),r)&&ta({type:"field.changed",objectId:t._id,field:r,value:i,previousValue:s,object:t})}let tl=new Set,tu=null,tc=null,tp=(t.builtins??b)({runtime:()=>tc,fileSystem:t.fileSystem??null});function td(t){let e=y.get(t);if(!e)return void O.add(t);if(!e.active){for(let[t,i]of(e.active=!0,x.push(e.name),e.methods)){f.has(t)||f.set(t,new o);let e=f.get(t);for(let[t,s]of i)e.has(t)||e.set(t,[]),e.get(t).push(s)}for(let[t,i]of e.functions)g.has(t)||g.set(t,[]),g.get(t).push(i)}}function tm(t){return null==t||""===t?null:"object"==typeof t&&null!=t._id?t:"string"==typeof t?F.get(t)??null:"number"==typeof t?N.get(t)??null:null}function tf(t,e,i){let s=tm(t);if(null==s)return 0;let r=tb(s[e]);return s[e]=r+i,th(s,e,s[e],r),r}function tg(t,e){let i=ts(t,e);return i&&i.length>0?i[i.length-1]:null}function ty(t,e,i,s){let r=ts(t,e);return r&&0!==r.length?{found:!0,result:te(ti(t,e),r.length-1,()=>r[r.length-1](i,...s))}:{found:!1}}function tx(t,e,i,s){let r;d((r=tr(i)).length?r:[t],e)&&ta({type:"method.called",className:z(t),methodName:z(e),objectId:i._id,args:[...s]});let n=D.get(t);if(n){let t=n.get(e);if(t)for(let e of t)e(i,...s)}}function tb(t){if(null==t||""===t)return 0;let e=Number(t);return isNaN(e)?0:e}function tv(t){if(!t||""===t)return null;t.startsWith("/")&&(t=t.slice(1));let e=t.split("/"),i=null;for(let t=0;t<e.length;t++){let s=e[t];if(s){if(0===t)i=/^\d+$/.test(s)?N.get(parseInt(s,10))??null:F.get(s)??null;else{if(!i||!i._children)return null;let t=s.toLowerCase();i=i._children.find(e=>e._name?.toLowerCase()===t)??null}if(!i)return null}}return i}function tw(t){return null==t||""===t?null:tv(String(t))}function tM(t,e){function i(t,e){return t+e.join("_")}return{get:(e,...s)=>t.get(i(e,s))??"",set(s,...r){if(0===r.length)throw Error("set() requires at least a value argument");if(1===r.length){let i=t.get(s);return t.set(s,r[0]),e?.onSet?.(s,r[0],i),r[0]}let n=r[r.length-1],a=i(s,r.slice(0,-1)),o=t.get(a);return t.set(a,n),e?.onSet?.(a,n,o),n},postInc(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a+1;return t.set(n,o),e?.onSet?.(n,o,a),a},postDec(s,...r){let n=i(s,r),a=tb(t.get(n)),o=a-1;return t.set(n,o),e?.onSet?.(n,o,a),a}}}function tS(){return tM(new o)}let tA={registerMethod:function(t,e,i){if(tu)tu.methods.has(t)||tu.methods.set(t,new o),tu.methods.get(t).set(e,i);else{f.has(t)||f.set(t,new o);let s=f.get(t);s.has(e)||s.set(e,[]),s.get(e).push(i)}},registerFunction:function(t,e){tu?tu.functions.set(t,e):(g.has(t)||g.set(t,[]),g.get(t).push(e))},package:function(t,e){let i=y.get(t);i||(i={name:t,active:!1,methods:new o,functions:new o},y.set(t,i));let s=tu;tu=i,e(),tu=s,O.has(t)&&(O.delete(t),td(t))},activatePackage:td,deactivatePackage:function(t){let e=y.get(t);if(!e||!e.active)return;e.active=!1;let i=x.findIndex(e=>e.toLowerCase()===t.toLowerCase());for(let[t,s]of(-1!==i&&x.splice(i,1),e.methods)){let e=f.get(t);if(e)for(let[t,i]of s){let s=e.get(t);if(s){let t=s.indexOf(i);-1!==t&&s.splice(t,1)}}}for(let[t,i]of e.functions){let e=g.get(t);if(e){let t=e.indexOf(i);-1!==t&&e.splice(t,1)}}},create:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(L);)L+=1;let t=L;return L+=1,t}(),a={_class:r,_className:t,_id:n};for(let[t,e]of Object.entries(i))a[z(t)]=e;a.superclass&&(a._superClass=z(String(a.superclass)),a.class&&j.set(z(String(a.class)),a._superClass)),N.set(n,a);let o=B(e);if(o&&(a._name=o,F.set(o,a)),s){for(let t of s)t._parent=a;a._children=s}let h=tg(t,"onAdd");return h&&h(a),to(a),a},datablock:function(t,e,i,s){let r=z(t),n=function(){for(;N.has(P);)P+=1;let t=P;return P+=1,t}(),a={_class:r,_className:t,_id:n,_isDatablock:!0},o=B(i);if(o){let t=$.get(o);if(t){for(let[e,i]of Object.entries(t))e.startsWith("_")||(a[e]=i);a._parent=t}}for(let[t,e]of Object.entries(s))a[z(t)]=e;N.set(n,a);let h=B(e);return h&&(a._name=h,F.set(h,a),$.set(h,a)),to(a),a},deleteObject:function t(e){var i;let s;if(null==e||("number"==typeof e?s=N.get(e):"string"==typeof e?s=F.get(e):"object"==typeof e&&e._id&&(s=e),!s))return!1;let r=tg(s._className,"onRemove");if(r&&r(s),N.delete(s._id),s._name&&F.delete(s._name),s._isDatablock&&s._name&&$.delete(s._name),s._parent&&s._parent._children){let t=s._parent._children.indexOf(s);-1!==t&&s._parent._children.splice(t,1)}if(s._children)for(let e of[...s._children])t(e);return ta({type:"object.deleted",objectId:(i=s)._id,object:i}),!0},prop:function(t,e){let i=tm(t);return null==i?"":i[z(e)]??""},setProp:function(t,e,i){let s=tm(t);if(null==s)return i;let r=z(e),n=s[r];return s[r]=i,th(s,r,i,n),i},getIndex:function(t,e){let i=tm(t);return null==i?"":i[String(e)]??""},setIndex:function(t,e,i){let s=tm(t);if(null==s)return i;let r=String(e),n=s[r];return s[r]=i,th(s,r,i,n),i},propPostInc:function(t,e){return tf(t,z(e),1)},propPostDec:function(t,e){return tf(t,z(e),-1)},indexPostInc:function(t,e){return tf(t,String(e),1)},indexPostDec:function(t,e){return tf(t,String(e),-1)},key:function(t,...e){return t+e.join("_")},call:function(t,e,...i){if(null==t||("string"==typeof t||"number"==typeof t)&&null==(t=tw(t)))return"";let s=t.class||t._className||t._class;if(s){let r=ty(s,e,t,i);if(r.found)return tx(s,e,t,i),r.result}let r=t._superClass||j.get(s);for(;r;){let s=ty(r,e,t,i);if(s.found)return tx(r,e,t,i),s.result;r=j.get(r)}return""},nsCall:function(t,e,...i){let s=ts(t,e);if(!s||0===s.length)return"";let r=ti(t,e),n=s[s.length-1],a=te(r,s.length-1,()=>n(...i)),o=i[0];return o&&"object"==typeof o&&tx(t,e,o,i.slice(1)),a},nsRef:function(t,e){let i=ts(t,e);if(!i||0===i.length)return null;let s=ti(t,e),r=i[i.length-1];return(...t)=>te(s,i.length-1,()=>r(...t))},parent:function(t,e,i,...s){let r=ts(t,e),n=ti(t,e),a=tt(n);if(r&&void 0!==a&&a>=1){let o=a-1,h=te(n,o,()=>r[o](i,...s));return i&&"object"==typeof i&&tx(t,e,i,s),h}let o=j.get(t);for(;o;){let t=ts(o,e);if(t&&t.length>0){let r=te(ti(o,e),t.length-1,()=>t[t.length-1](i,...s));return i&&"object"==typeof i&&tx(o,e,i,s),r}o=j.get(o)}return""},parentFunc:function(t,...e){let i=g.get(t);if(!i)return"";let s=t.toLowerCase(),r=tt(s);if(void 0===r||r<1)return"";let n=r-1;return te(s,n,()=>i[n](...e))},add:function(t,e){return tb(t)+tb(e)},sub:function(t,e){return tb(t)-tb(e)},mul:function(t,e){return tb(t)*tb(e)},div:function(t,e){return tb(t)/tb(e)},neg:function(t){return-tb(t)},lt:function(t,e){return tb(t)<tb(e)},le:function(t,e){return tb(t)<=tb(e)},gt:function(t,e){return tb(t)>tb(e)},ge:function(t,e){return tb(t)>=tb(e)},eq:function(t,e){return tb(t)===tb(e)},ne:function(t,e){return tb(t)!==tb(e)},mod:function(t,e){let i=0|Number(e);return 0===i?0:(0|Number(t))%i},bitand:function(t,e){return k(t)&k(e)},bitor:function(t,e){return k(t)|k(e)},bitxor:function(t,e){return k(t)^k(e)},shl:function(t,e){return k(k(t)<<(31&k(e)))},shr:function(t,e){return k(t)>>>(31&k(e))},bitnot:function(t){return~k(t)>>>0},concat:function(...t){return t.map(t=>String(t??"")).join("")},streq:function(t,e){return String(t??"").toLowerCase()===String(e??"").toLowerCase()},switchStr:function(t,e){let i=String(t??"").toLowerCase();for(let[t,s]of Object.entries(e))if("default"!==t&&z(t)===i)return void s();e.default&&e.default()},deref:tw,nameToId:function(t){let e=tv(t);return e?e._id:-1},isObject:function(t){return null!=t&&("object"==typeof t&&!!t._id||("number"==typeof t?N.has(t):"string"==typeof t&&F.has(t)))},isFunction:function(t){return g.has(t)||t.toLowerCase()in tp},isPackage:function(t){return y.has(t)},isActivePackage:function(t){let e=y.get(t);return e?.active??!1},getPackageList:function(){return x.join(" ")},locals:tS,onMethodCalled(t,e,i){let s=D.get(t);s||(s=new o,D.set(t,s));let r=s.get(e);return r||(r=[],s.set(e,r)),r.push(i),()=>{let t=r.indexOf(i);-1!==t&&r.splice(t,1)}}},t_={call(t,...e){let i=g.get(t);if(i&&i.length>0)return te(t.toLowerCase(),i.length-1,()=>i[i.length-1](...e));let s=tp[t.toLowerCase()];return s?s(...e):(console.warn(`Unknown function: ${t}(${e.map(t=>JSON.stringify(t)).join(", ")})`),"")}},tC=tM(V,{onSet:function(t,e,i){let s=z(t.startsWith("$")?t.slice(1):t);Object.is(e,i)||m(s)&&ta({type:"global.changed",name:s,value:e,previousValue:i})}}),tT={methods:f,functions:g,packages:y,activePackages:x,objectsById:N,objectsByName:F,datablocks:$,globals:V,executedScripts:H,failedScripts:J,scripts:Y,generatedCode:Q,pendingTimeouts:tl,startTime:Date.now()};function tI(t){let e=function(t){let e=Q.get(t);null==e&&(e=new n(void 0).generate(t),Q.set(t,e));return e}(t),i=tS();Function("$","$f","$g","$l",e)(tA,t_,tC,i)}function tz(t,e){return{execute(){if(e){let t=l(e);tT.executedScripts.add(t)}tI(t)}}}async function tk(e,i,s){let r=t.loadScript;if(!r){e.length>0&&console.warn("Script has exec() calls but no loadScript provided:",e);return}async function n(e){t.signal?.throwIfAborted();let n=l(e);if(tT.scripts.has(n)||tT.failedScripts.has(n))return;if(X&&X(n)){console.warn(`Ignoring script: ${e}`),tT.failedScripts.add(n);return}if(s.has(n))return;let a=i.get(n);if(a)return void await a;t.progress?.addItem(e);let o=(async()=>{let a,o=await r(e);if(null==o){console.warn(`Script not found: ${e}`),tT.failedScripts.add(n),t.progress?.completeItem();return}try{a=E(o,{filename:e})}catch(i){console.warn(`Failed to parse script: ${e}`,i),tT.failedScripts.add(n),t.progress?.completeItem();return}let h=new Set(s);h.add(n),await tk(a.execScriptPaths,i,h),tT.scripts.set(n,a),t.progress?.completeItem()})();i.set(n,o),await o}await Promise.all(e.map(n))}async function tB(e){let i=t.loadScript;if(!i)throw Error("loadFromPath requires loadScript option to be set");let s=l(e);if(tT.scripts.has(s))return tz(tT.scripts.get(s),e);t.progress?.addItem(e);let r=await i(e);if(null==r)throw t.progress?.completeItem(),Error(`Script not found: ${e}`);let n=await tR(r,{path:e});return t.progress?.completeItem(),n}async function tR(t,e){if(e?.path){let t=l(e.path);if(tT.scripts.has(t))return tz(tT.scripts.get(t),e.path)}return tO(E(t,{filename:e?.path}),e)}async function tO(e,i){let s=new Map,r=new Set;if(i?.path){let t=l(i.path);tT.scripts.set(t,e),r.add(t)}let n=[...e.execScriptPaths,...t.preloadScripts??[]];return await tk(n,s,r),tz(e,i?.path)}return tc={$:tA,$f:t_,$g:tC,state:tT,destroy:function(){for(let t of(W.length>0&&tn(),tT.pendingTimeouts))clearTimeout(t);tT.pendingTimeouts.clear(),U.clear()},executeAST:tI,loadFromPath:tB,loadFromSource:tR,loadFromAST:tO,call:(t,...e)=>t_.call(t,...e),getObjectByName:t=>F.get(t),subscribeRuntimeEvents:t=>(U.add(t),()=>{U.delete(t)})}}function O(){let t=new Set,e=0,i=0,s=null;function r(){for(let e of t)e()}return{get total(){return e},get loaded(){return i},get current(){return s},get progress(){return 0===e?0:i/e},on(e,i){t.add(i)},off(e,i){t.delete(i)},addItem(t){e++,s=t,r()},completeItem(){i++,s=null,r()},setCurrent(t){s=t,r()}}}function E(t,e){try{return i.default.parse(t)}catch(t){if(e?.filename&&t.location)throw Error(`${e.filename}:${t.location.start.line}:${t.location.start.column}: ${t.message}`,{cause:t});throw t}}function P(t){if("boolean"==typeof t)return t;if("number"==typeof t)return 0!==t;if("string"==typeof t){let e=t.trim().toLowerCase();return""!==e&&"0"!==e&&"false"!==e}return!!t}function L(){let t=Error("Operation aborted");return t.name="AbortError",t}function N(t){let e,{missionName:i,missionType:s,runtimeOptions:r,onMissionLoadDone:n}=t,{signal:a,fileSystem:o,globals:h={},preloadScripts:l=[],reactiveGlobalNames:u}=r??{},c=o?.findFiles("scripts/*Game.cs")??[],p=u?Array.from(new Set([...u,"missionRunning"])):void 0,d=R({...r,reactiveGlobalNames:p,globals:{...h,"$Host::Map":i,"$Host::MissionType":s},preloadScripts:[...l,...c]});(e=d.$.registerMethod.bind(d.$))("ShapeBase","playThread",(t,e,i)=>{t._threads||(t._threads={}),t._threads[Number(e)]={sequence:String(i),playing:!0,direction:!0}}),e("ShapeBase","stopThread",(t,e)=>{t._threads&&delete t._threads[Number(e)]}),e("ShapeBase","setThreadDir",(t,e,i)=>{t._threads||(t._threads={});let s=Number(e);t._threads[s]?t._threads[s].direction=!!Number(i):t._threads[s]={sequence:"",playing:!1,direction:!!Number(i)}}),e("ShapeBase","pauseThread",(t,e)=>{t._threads?.[Number(e)]&&(t._threads[Number(e)].playing=!1)}),e("ShapeBase","playAudio",()=>{}),e("ShapeBase","stopAudio",()=>{}),e("SimObject","getDatablock",t=>{let e=t.datablock;return e?d.getObjectByName(String(e))??"":""}),e("SimObject","getGroup",t=>t._parent??""),e("SimObject","getName",t=>t._name??""),e("SimObject","getType",()=>16384),e("SimGroup","getCount",t=>t._children?t._children.length:0),e("SimGroup","getObject",(t,e)=>{let i=t._children;return i?i[Number(e)]??"":""}),e("GameBase","isEnabled",()=>!0),e("GameBase","isDisabled",()=>!1),e("GameBase","setPoweredState",()=>{}),e("GameBase","setRechargeRate",()=>{}),e("GameBase","getRechargeRate",()=>0),e("GameBase","setEnergyLevel",()=>{}),e("GameBase","getEnergyLevel",()=>0),e("ShapeBase","getDamageLevel",()=>0),e("ShapeBase","setDamageLevel",()=>{}),e("ShapeBase","getRepairRate",()=>0),e("ShapeBase","setRepairRate",()=>{}),e("ShapeBase","getDamagePercent",()=>0),e("GameBase","getControllingClient",()=>0),e("SimObject","schedule",(t,e,i,...s)=>{let r=setTimeout(()=>{d.state.pendingTimeouts.delete(r);try{d.$.call(t,String(i),...s)}catch(e){console.error(`schedule: error calling ${i} on ${t._id}:`,e)}},Number(e)||0);return d.state.pendingTimeouts.add(r),r});let m=async function(){try{let t=await d.loadFromPath("scripts/server.cs");a?.throwIfAborted(),await d.loadFromPath(`missions/${i}.mis`),a?.throwIfAborted(),t.execute();let e=function(t,e){let{signal:i,onMissionLoadDone:s}=e;return new Promise((e,r)=>{let n=!1,a=!1,o=()=>P(t.$g.get("missionRunning")),h=()=>{n||(n=!0,d(),e())},l=t=>{n||(n=!0,d(),r(t))},u=e=>{if(!s||a)return;let i=e??t.getObjectByName("Game");i&&(a=!0,s(i))},c=()=>l(L()),p=t.subscribeRuntimeEvents(t=>{if("global.changed"===t.type&&"missionrunning"===t.name){P(t.value)&&(u(),h());return}"batch.flushed"===t.type&&o()&&(u(),h())});function d(){p(),i?.removeEventListener("abort",c)}if(i){if(i.aborted)return void l(L());i.addEventListener("abort",c,{once:!0})}o()&&(u(),h())})}(d,{signal:a,onMissionLoadDone:n}),s=await d.loadFromSource("CreateServer($Host::Map, $Host::MissionType);");a?.throwIfAborted(),s.execute(),await e}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;throw t}}();return{runtime:d,ready:m}}t.s(["createProgressTracker",()=>O],38433);let F=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,$=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,V=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,D={arena:"Arena",bounty:"Bounty",cnh:"CnH",ctf:"CTF",dm:"DM",dnd:"DnD",hunters:"Hunters",lakrabbit:"LakRabbit",lakzm:"LakZM",lctf:"LCTF",none:"None",rabbit:"Rabbit",sctf:"SCtF",siege:"Siege",singleplayer:"SinglePlayer",tdm:"TDM",teamhunters:"TeamHunters",teamlak:"TeamLak",tr2:"TR2"};function j(t){let e=E(t),{pragma:i,sections:s}=function(t){let e={},i=[],s={name:null,comments:[]};for(let r of t.body)if("Comment"===r.type){let t=function(t){let e;return(e=t.match($))?{type:"sectionBegin",name:e[1]}:(e=t.match(V))?{type:"sectionEnd",name:e[1]}:(e=t.match(F))?{type:"definition",identifier:e[1],value:e[2]}:null}(r.value);if(t)switch(t.type){case"definition":null===s.name?e[t.identifier.toLowerCase()]=t.value:s.comments.push(r.value);break;case"sectionBegin":(null!==s.name||s.comments.length>0)&&i.push(s),s={name:t.name.toUpperCase(),comments:[]};break;case"sectionEnd":null!==s.name&&i.push(s),s={name:null,comments:[]}}else s.comments.push(r.value)}return(null!==s.name||s.comments.length>0)&&i.push(s),{pragma:e,sections:i}}(e);function r(t){return s.find(e=>e.name===t)?.comments.map(t=>t.trimStart()).join("\n")??null}return{displayName:i.displayname??null,missionTypes:i.missiontypes?.split(/\s+/).filter(Boolean).map(t=>D[t.toLowerCase()]??t)??[],missionBriefing:r("MISSION BRIEFING"),briefingWav:i.briefingwav??null,bitmap:i.bitmap??null,planetName:i.planetname??null,missionBlurb:r("MISSION BLURB"),missionQuote:r("MISSION QUOTE"),missionString:r("MISSION STRING"),execScriptPaths:e.execScriptPaths,hasDynamicExec:e.hasDynamicExec,ast:e}}function U(t,e){if(t)return t[e.toLowerCase()]}function W(t,e){let i=t[e.toLowerCase()];return null==i?i:parseFloat(i)}function G(t,e){let i=t[e.toLowerCase()];return null==i?i:parseInt(i,10)}function q(t){let[e,i,s]=(t.position??"0 0 0").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function H(t){let[e,i,s]=(t.scale??"1 1 1").split(" ").map(t=>parseFloat(t));return[i||0,s||0,e||0]}function J(t){let[i,s,r,n]=(t.rotation??"1 0 0 0").split(" ").map(t=>parseFloat(t)),a=new e.Vector3(s,r,i).normalize(),o=-(Math.PI/180*n);return new e.Quaternion().setFromAxisAngle(a,o)}t.s(["getFloat",()=>W,"getInt",()=>G,"getPosition",()=>q,"getProperty",()=>U,"getRotation",()=>J,"getScale",()=>H,"parseMissionScript",()=>j],62395)},12979,t=>{"use strict";var e=t.i(98223),i=t.i(91996),s=t.i(62395),r=t.i(71726);let n="/t2-mapper",a=`${n}/base/`,o=`${n}/magenta.png`;function h(t,e){let s;try{s=(0,i.getActualResourceKey)(t)}catch(i){if(e)return console.warn(`Resource "${t}" not found - rendering fallback.`),e;throw i}let[r,n]=(0,i.getSourceAndPath)(s);return r?`${a}@vl2/${r}/${n}`:`${a}${n}`}function l(t){return h(`interiors/${t}`).replace(/\.dif$/i,".glb")}function u(t){return h(`shapes/${t}`).replace(/\.dts$/i,".glb")}function c(t){return t=t.replace(/^terrain\./,""),h((0,i.getStandardTextureResourceKey)(`textures/terrain/${t}`),o)}function p(t,e){let s=(0,r.normalizePath)(e).split("/"),n=s.length>1?s.slice(0,-1).join("/")+"/":"",a=`${n}${t}`;return h((0,i.getStandardTextureResourceKey)(a),o)}function d(t){return h((0,i.getStandardTextureResourceKey)(`textures/${t}`),o)}function m(t){return h(`audio/${t}`)}async function f(t){let e=h(`textures/${t}`),i=await fetch(e);return(await i.text()).split(/(?:\r\n|\r|\n)/).map(t=>{if(!(t=t.trim()).startsWith(";"))return t}).filter(Boolean)}async function g(t){let e,r=(0,i.getMissionInfo)(t),n=await fetch(h(r.resourcePath)),a=await n.arrayBuffer();try{e=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{e=new TextDecoder("windows-1252").decode(a)}return e=e.replaceAll("<22>","'"),(0,s.parseMissionScript)(e)}async function y(t){let e=await fetch(h(`terrains/${t}`));return function(t){let e=new DataView(t),i=0,s=e.getUint8(i++),r=new Uint16Array(65536),n=[],a=t=>{let s="";for(let r=0;r<t;r++){let t=e.getUint8(i+r);if(0===t)break;s+=String.fromCharCode(t)}return i+=t,s};for(let t=0;t<65536;t++){let s=e.getUint16(i,!0);i+=2,r[t]=s}i+=65536;for(let t=0;t<8;t++){let s=e.getUint8(i++),r=a(s);t<6&&s>0&&n.push(r)}let o=[];for(let t of n){let t=new Uint8Array(65536);for(let s=0;s<65536;s++){let r=e.getUint8(i++);t[s]=r}o.push(t)}return{version:s,textureNames:n,heightMap:r,alphaMaps:o}}(await e.arrayBuffer())}async function x(t){let i=h(t),s=await fetch(i),r=await s.text();return(0,e.parseImageFileList)(r)}t.s(["FALLBACK_TEXTURE_URL",0,o,"RESOURCE_ROOT_URL",0,a,"audioToUrl",()=>m,"getUrlForPath",()=>h,"iflTextureToUrl",()=>p,"interiorToUrl",()=>l,"loadDetailMapList",()=>f,"loadImageFrameList",()=>x,"loadMission",()=>g,"loadTerrain",()=>y,"shapeToUrl",()=>u,"terrainTextureToUrl",()=>c,"textureToUrl",()=>d],12979)}]); |