@wodira/browser 1.2.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/boxes/cdn.js +1 -1
- package/dist/ui/boxes/index.js +7 -0
- package/dist/ui/components.d.ts +10 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/i18n.d.ts +1 -1
- package/dist/ui/i18n.d.ts.map +1 -1
- package/dist/ui/{index-3eb6xc34.js → index-4eecjr6y.js} +70 -1
- package/dist/ui/index.js +137 -44
- package/dist/ui/shirt-sponsors/cdn.js +90 -22
- package/dist/ui/shirt-sponsors/index.js +2 -2
- package/dist/ui/styles.d.ts +1 -0
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/waiver-document-kemkgn03.js +4120 -0
- package/dist/ui/waiver-document.d.ts +2 -0
- package/dist/ui/waiver-document.d.ts.map +1 -0
- package/package.json +3 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};function Lp(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Np(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ds(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function nd(){let e=ds("canvas");return e.style.display="block",e}function Ys(...e){let t="THREE."+e.shift();if(fs)fs("log",t,...e);else console.log(t,...e)}function id(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Te(...e){e=id(e);let t="THREE."+e.shift();if(fs)fs("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Le(...e){e=id(e);let t="THREE."+e.shift();if(fs)fs("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function Di(...e){let t=e.join(" ");if(t in Sh)return;Sh[t]=!0,Te(...e)}function sd(e,t,n){return new Promise(function(i,s){function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:s();break;case e.TIMEOUT_EXPIRED:setTimeout(r,n);break;default:i()}}setTimeout(r,n)})}class Yn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let s=i.indexOf(t);if(s!==-1)i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e);e.target=null}}}function In(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Lt[e&255]+Lt[e>>8&255]+Lt[e>>16&255]+Lt[e>>24&255]+"-"+Lt[t&255]+Lt[t>>8&255]+"-"+Lt[t>>16&15|64]+Lt[t>>24&255]+"-"+Lt[n&63|128]+Lt[n>>8&255]+"-"+Lt[n>>16&255]+Lt[n>>24&255]+Lt[i&255]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]).toLowerCase()}function Ve(e,t,n){return Math.max(t,Math.min(n,e))}function Hl(e,t){return(e%t+t)%t}function Dp(e,t,n,i,s){return i+(e-t)*(s-i)/(n-t)}function Up(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function qs(e,t,n){return(1-n)*e+n*t}function Fp(e,t,n,i){return qs(e,t,1-Math.exp(-n*i))}function Op(e,t=1){return t-Math.abs(Hl(e,t*2)-t)}function Bp(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function kp(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function zp(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Hp(e,t){return e+Math.random()*(t-e)}function Gp(e){return e*(0.5-Math.random())}function Wp(e){if(e!==void 0)bh=e;let t=bh+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Vp(e){return e*$s}function Xp(e){return e*Ui}function $p(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function qp(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Gl(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Yp(e,t,n,i,s){let{cos:r,sin:a}=Math,o=r(n/2),l=a(n/2),c=r((t+i)/2),h=a((t+i)/2),u=r((t-i)/2),d=a((t-i)/2),f=r((i-t)/2),_=a((i-t)/2);switch(s){case"XYX":e.set(o*h,l*u,l*d,o*c);break;case"YZY":e.set(l*d,o*h,l*u,o*c);break;case"ZXZ":e.set(l*u,l*d,o*h,o*c);break;case"XZX":e.set(o*h,l*_,l*f,o*c);break;case"YXY":e.set(l*f,o*h,l*_,o*c);break;case"ZYZ":e.set(l*_,l*f,o*h,o*c);break;default:Te("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function da(e){switch(e.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function Wl(e,t){if(t.constructor===Float32Array)return e;let n=da(t);if(n===void 0)throw Error("THREE.MathUtils: Invalid component type.");return Math.max(e/n,-1)}function Vl(e,t){if(t.constructor===Float32Array)return e;let n=da(t);if(n===void 0)throw Error("THREE.MathUtils: Invalid component type.");return Math.round(e*n)}function Zp(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(s,r,a){if(this.enabled===!1||r===a||!r||!a)return s;if(this.spaces[r].transfer==="srgb")s.r=Xn(s.r),s.g=Xn(s.g),s.b=Xn(s.b);if(this.spaces[r].primaries!==this.spaces[a].primaries)s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ);if(this.spaces[a].transfer==="srgb")s.r=us(s.r),s.g=us(s.g),s.b=us(s.b);return s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){if(s==="")return"linear";return this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[a].fromXYZ).multiply(this.spaces[r].toXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:wh,fromXYZ:Th,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:wh,fromXYZ:Th,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}function Xn(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function us(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}class Xl{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(Ji===void 0)Ji=ds("canvas");Ji.width=e.width,Ji.height=e.height;let i=Ji.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=ds("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=Xn(s[r]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(Xn(t[n]/255)*255);else t[n]=Xn(t[n]);return{data:t,width:e.width,height:e.height}}else return Te("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class tr{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Kp++}),this.uuid=In(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width||0,t.height||0,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,a=i.length;r<a;r++)if(i[r].isDataTexture)s.push(mo(i[r].image));else s.push(mo(i[r]))}else s=mo(i);n.url=s}if(!t)e.images[this.uuid]=n;return n}}function mo(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return Xl.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Te("Texture: Unable to serialize Texture."),{}}class nr{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}class ir{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new En,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new En,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new En,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,s=null,r=null,a=this._targetRay,o=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){r=!0;for(let _ of e.hand.values()){let y=t.getJointPose(_,n),p=this._getHandJoint(l,_);if(y!==null)p.matrix.fromArray(y.transform.matrix),p.matrix.decompose(p.position,p.quaternion,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=y.radius;p.visible=y!==null}let c=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],u=c.position.distanceTo(h.position),d=0.02,f=0.005;if(l.inputState.pinching&&u>d+f)l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!l.inputState.pinching&&u<=d-f)l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(o!==null&&e.gripSpace){if(s=t.getPose(e.gripSpace,n),s!==null){if(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity);else o.hasLinearVelocity=!1;if(s.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity);else o.hasAngularVelocity=!1;if(o.eventsEnabled)o.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(a!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null)i=s;if(i!==null){if(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity);else a.hasLinearVelocity=!1;if(i.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity);else a.hasAngularVelocity=!1;this.dispatchEvent(sm)}}}if(a!==null)a.visible=i!==null;if(o!==null)o.visible=s!==null;if(l!==null)l.visible=r!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new En;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}function xo(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Wt{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),xn.subVectors(e,t),i.cross(xn);let s=i.lengthSq();if(s>0)return i.multiplyScalar(1/Math.sqrt(s));return i.set(0,0,0)}static getBarycoord(e,t,n,i,s){xn.subVectors(i,t),zn.subVectors(n,t),vo.subVectors(e,t);let r=xn.dot(xn),a=xn.dot(zn),o=xn.dot(vo),l=zn.dot(zn),c=zn.dot(vo),h=r*l-a*a;if(h===0)return s.set(0,0,0),null;let u=1/h,d=(l*o-a*c)*u,f=(r*c-a*o)*u;return s.set(1-d-f,f,d)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,Hn)===null)return!1;return Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getInterpolation(e,t,n,i,s,r,a,o){if(this.getBarycoord(e,t,n,i,Hn)===null){if(o.x=0,o.y=0,"z"in o)o.z=0;if("w"in o)o.w=0;return null}return o.setScalar(0),o.addScaledVector(s,Hn.x),o.addScaledVector(r,Hn.y),o.addScaledVector(a,Hn.z),o}static getInterpolatedAttribute(e,t,n,i,s,r){return Mo.setScalar(0),wo.setScalar(0),To.setScalar(0),Mo.fromBufferAttribute(e,t),wo.fromBufferAttribute(e,n),To.fromBufferAttribute(e,i),r.setScalar(0),r.addScaledVector(Mo,s.x),r.addScaledVector(wo,s.y),r.addScaledVector(To,s.z),r}static isFrontFacing(e,t,n,i){return xn.subVectors(n,t),zn.subVectors(e,t),xn.cross(zn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return xn.subVectors(this.c,this.b),zn.subVectors(this.a,this.b),xn.cross(zn).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return Wt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Wt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Wt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,s=this.c,r,a;ts.subVectors(i,n),ns.subVectors(s,n),yo.subVectors(e,n);let o=ts.dot(yo),l=ns.dot(yo);if(o<=0&&l<=0)return t.copy(n);So.subVectors(e,i);let c=ts.dot(So),h=ns.dot(So);if(c>=0&&h<=c)return t.copy(i);let u=o*h-c*l;if(u<=0&&o>=0&&c<=0&&o-c>0)return r=o/(o-c),t.copy(n).addScaledVector(ts,r);bo.subVectors(e,s);let d=ts.dot(bo),f=ns.dot(bo);if(f>=0&&d<=f)return t.copy(s);let _=d*l-o*f;if(_<=0&&l>=0&&f<=0)return a=l/(l-f),t.copy(n).addScaledVector(ns,a);let y=c*f-d*h;if(y<=0&&h-c>=0&&d-f>=0)return Nh.subVectors(s,i),a=(h-c)/(h-c+(d-f)),t.copy(i).addScaledVector(Nh,a);let p=1/(y+_+u);return r=_*p,a=u*p,t.copy(n).addScaledVector(ts,r).addScaledVector(ns,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class qt{constructor(e=new D(1/0,1/0,1/0),t=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(vn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(vn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=vn.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let r=0,a=s.count;r<a;r++){if(e.isMesh===!0)e.getVertexPosition(r,vn);else vn.fromBufferAttribute(s,r);vn.applyMatrix4(e.matrixWorld),this.expandByPoint(vn)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();Ir.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();Ir.copy(n.boundingBox)}Ir.applyMatrix4(e.matrixWorld),this.union(Ir)}}let i=e.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vn),vn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bs),Pr.subVectors(this.max,Bs),is.subVectors(e.a,Bs),ss.subVectors(e.b,Bs),rs.subVectors(e.c,Bs),si.subVectors(ss,is),ri.subVectors(rs,ss),Ii.subVectors(is,rs);let t=[0,-si.z,si.y,0,-ri.z,ri.y,0,-Ii.z,Ii.y,si.z,0,-si.x,ri.z,0,-ri.x,Ii.z,0,-Ii.x,-si.y,si.x,0,-ri.y,ri.x,0,-Ii.y,Ii.x,0];if(!Eo(t,is,ss,rs,Pr))return!1;if(t=[1,0,0,0,1,0,0,0,1],!Eo(t,is,ss,rs,Pr))return!1;return Lr.crossVectors(si,ri),t=[Lr.x,Lr.y,Lr.z],Eo(t,is,ss,rs,Pr)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vn).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(vn).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return Gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Gn),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}function Eo(e,t,n,i,s){for(let r=0,a=e.length-3;r<=a;r+=3){Pi.fromArray(e,r);let o=s.x*Math.abs(Pi.x)+s.y*Math.abs(Pi.y)+s.z*Math.abs(Pi.z),l=t.dot(Pi),c=n.dot(Pi),h=i.dot(Pi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}class sn{constructor(e=new D,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else am.setFromPoints(e).getCenter(n);let i=0;for(let s=0,r=e.length;s<r;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ks.subVectors(e,this.center);let t=ks.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(ks,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else Ao.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ks.copy(e.center).add(Ao)),this.expandByPoint(ks.copy(e.center).sub(Ao));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}class sr{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=In()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};let t=Dh(this.array);if(e.arrayBuffers[t]===void 0)e.arrayBuffers[t]=this.array.slice(0).buffer;let n=new this.array.constructor(e.arrayBuffers[t]),i=new this.constructor(n,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};let t=Dh(this.array);if(e.arrayBuffers[t]===void 0)e.arrayBuffers[t]=Array.from(new Uint32Array(this.array.slice(0).buffer));let n={uuid:this.uuid,buffer:t,type:this.array.constructor.name,stride:this.stride};return n.usage=this.usage,n}}function Dh(e){if(e.buffer._uuid===void 0)e.buffer._uuid=In();if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer._uuid;return e.buffer._uuid+":"+e.byteOffset+":"+e.byteLength}class Ss{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i,this._normalizationScale=e!==void 0?da(e.array):void 0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix4(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyNormalMatrix(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.transformDirection(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=this._denormalize(n);return n}setComponent(e,t,n){if(this.normalized)n=this._normalize(n);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=this._denormalize(t);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=this._denormalize(t);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=this._denormalize(t);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=this._denormalize(t);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i),s=this._normalize(s);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){Ys("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new pt(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new Ss(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){Ys("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}_denormalize(e){let t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Wl(e,this.data.array)}_normalize(e){let t=this._normalizationScale;return t!==void 0?Math.round(e*t):Vl(e,this.data.array)}}class Tn{constructor(e=new D(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Co.subVectors(n,t).cross(lm.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(Co),s=this.normal.dot(i);if(s===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let r=-(e.start.dot(this.normal)+this.constant)/s;if(n===!0&&(r<0||r>1))return null;return t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||cm.getNormalMatrix(e),i=this.coplanarPoint(Co).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}class Gi{constructor(e=new D,t=new D(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Wn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Wn.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return Wn.copy(this.origin).addScaledVector(this.direction,t),Wn.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){Io.copy(e).add(t).multiplyScalar(0.5),Dr.copy(t).sub(e).normalize(),Ur.copy(this.origin).sub(Io);let s=e.distanceTo(t)*0.5,r=-this.direction.dot(Dr),a=Ur.dot(this.direction),o=-Ur.dot(Dr),l=Ur.lengthSq(),c=Math.abs(1-r*r),h,u,d,f;if(c>0)if(h=r*o-a,u=r*a-o,f=s*c,h>=0)if(u>=-f)if(u<=f){let _=1/c;h*=_,u*=_,d=h*(h+r*u+2*a)+u*(r*h+u+2*o)+l}else u=s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;else u=-s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;else if(u<=-f)h=Math.max(0,-(-r*s+a)),u=h>0?-s:Math.min(Math.max(-s,-o),s),d=-h*h+u*(u+2*o)+l;else if(u<=f)h=0,u=Math.min(Math.max(-s,-o),s),d=u*(u+2*o)+l;else h=Math.max(0,-(r*s+a)),u=h>0?s:Math.min(Math.max(-s,-o),s),d=-h*h+u*(u+2*o)+l;else u=r>0?-s:s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;if(n)n.copy(this.origin).addScaledVector(this.direction,h);if(i)i.copy(Io).addScaledVector(Dr,u);return d}intersectSphere(e,t){if(e.radius<0)return null;Wn.subVectors(e.center,this.origin);let n=Wn.dot(this.direction),i=Wn.dot(Wn)-n*n,s=e.radius*e.radius;if(i>s)return null;let r=Math.sqrt(s-i),a=n-r,o=n+r;if(o<0)return null;if(a<0)return this.at(o,t);return this.at(a,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,s,r,a,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;if(l>=0)n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l;else n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l;if(c>=0)s=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c;else s=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c;if(n>r||s>i)return null;if(s>n||isNaN(n))n=s;if(r<i||isNaN(i))i=r;if(h>=0)a=(e.min.z-u.z)*h,o=(e.max.z-u.z)*h;else a=(e.max.z-u.z)*h,o=(e.min.z-u.z)*h;if(n>o||a>i)return null;if(a>n||n!==n)n=a;if(o<i||i!==i)i=o;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Wn)!==null}intersectTriangle(e,t,n,i,s){let r=this.origin,a=this.direction,{x:o,y:l,z:c}=a,h=e.x-r.x,u=e.y-r.y,d=e.z-r.z,f=t.x-r.x,_=t.y-r.y,y=t.z-r.z,p=n.x-r.x,m=n.y-r.y,M=n.z-r.z,T=Math.abs(o),b=Math.abs(l),E=Math.abs(c),A,g,S,P,z,N,H,Q,C,Y,K,B;if(T>=b&&T>=E)if(S=o,N=h,C=f,B=p,o>=0)A=l,g=c,P=u,z=d,H=_,Q=y,Y=m,K=M;else A=c,g=l,P=d,z=u,H=y,Q=_,Y=M,K=m;else if(b>=E)if(S=l,N=u,C=_,B=m,l>=0)A=c,g=o,P=d,z=h,H=y,Q=f,Y=M,K=p;else A=o,g=c,P=h,z=d,H=f,Q=y,Y=p,K=M;else if(S=c,N=d,C=y,B=M,c>=0)A=o,g=l,P=h,z=u,H=f,Q=_,Y=p,K=m;else A=l,g=o,P=u,z=h,H=_,Q=f,Y=m,K=p;if(S===0)return null;let ae=A/S,V=g/S,j=1/S,ie=P-ae*N,be=z-V*N,Z=H-ae*C,ne=Q-V*C,ye=Y-ae*B,Ce=K-V*B,Ie=ye*ne-Ce*Z,Se=ie*Ce-be*ye,je=Z*be-ne*ie;if(i){if(Ie<0||Se<0||je<0)return null}else if((Ie<0||Se<0||je<0)&&(Ie>0||Se>0||je>0))return null;let We=Ie+Se+je;if(We===0)return null;let Oe=j*(Ie*N+Se*C+je*B);if(We>0?Oe<0:Oe>0)return null;return this.at(Oe/We,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}function um(e,t,n,i,s,r,a,o){let l;if(t.side===1)l=i.intersectTriangle(a,r,s,!0,o);else l=i.intersectTriangle(s,r,a,t.side===0,o);if(l===null)return null;Hr.copy(o),Hr.applyMatrix4(e.matrixWorld);let c=n.ray.origin.distanceTo(Hr);if(c<n.near||c>n.far)return null;return{distance:c,point:Hr.clone(),object:e}}function Gr(e,t,n,i,s,r,a,o,l,c){e.getVertexPosition(o,Or),e.getVertexPosition(l,Br),e.getVertexPosition(c,kr);let h=um(e,t,n,i,Or,Br,kr,Oh);if(h){let u=new D;if(Wt.getBarycoord(Oh,Or,Br,kr,u),s)h.uv=Wt.getInterpolatedAttribute(s,o,l,c,u,new ke);if(r)h.uv1=Wt.getInterpolatedAttribute(r,o,l,c,u,new ke);if(a){if(h.normal=Wt.getInterpolatedAttribute(a,o,l,c,u,new D),h.normal.dot(i.direction)>0)h.normal.multiplyScalar(-1)}let d={a:o,b:l,c,normal:new D,materialIndex:0};Wt.getNormal(Or,Br,kr,d.normal),h.face=d,h.barycoord=u}return h}class ar{constructor(e=[],t=[]){this.uuid=In(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.previousBoneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Te("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Fe;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,r=e.length;s<r;s++){let a=e[s]?e[s].matrixWorld:fm;Gh.multiplyMatrices(a,t[s]),Gh.toArray(n,s*16)}if(i!==null)i.needsUpdate=!0}clone(){return new ar(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new Wi(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null;if(this.previousBoneTexture!==null)this.previousBoneTexture.dispose(),this.previousBoneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let s=e.bones[n],r=t[s];if(r===void 0)Te("Skeleton: No bone found with UUID:",s),r=new rr;this.bones.push(r),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){let r=t[i];e.bones.push(r.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}}class Fi{constructor(e=new Tn,t=new Tn,n=new Tn,i=new Tn,s=new Tn,r=new Tn){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(r),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,s=e.elements,r=s[0],a=s[1],o=s[2],l=s[3],c=s[4],h=s[5],u=s[6],d=s[7],f=s[8],_=s[9],y=s[10],p=s[11],m=s[12],M=s[13],T=s[14],b=s[15];if(i[0].setComponents(l-r,d-c,p-f,b-m).normalize(),i[1].setComponents(l+r,d+c,p+f,b+m).normalize(),i[2].setComponents(l+a,d+h,p+_,b+M).normalize(),i[3].setComponents(l-a,d-h,p-_,b-M).normalize(),n)i[4].setComponents(o,u,y,T).normalize(),i[5].setComponents(l-o,d-u,p-y,b-T).normalize();else if(i[4].setComponents(l-o,d-u,p-y,b-T).normalize(),t===2000)i[5].setComponents(l+o,d+u,p+y,b+T).normalize();else if(t===2001)i[5].setComponents(o,u,y,T).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();Ni.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();Ni.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ni)}intersectsSprite(e){Ni.center.set(0,0,0);let t=mm.distanceTo(e.center);return Ni.radius=0.7071067811865476+t,Ni.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ni)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Xr.x=i.normal.x>0?e.max.x:e.min.x,Xr.y=i.normal.y>0?e.max.y:e.min.y,Xr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Xr)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class va{constructor(){this.coordinateSystem=2000,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let i=0;i<t.length;i++){let s=t[i];if(Xh.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[i]===void 0)n[i]=new Fi;n[i].setFromProjectionMatrix(Xh,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}getFrustum(e){return this._frustums[e]}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let i=0;i<e._count;i++){if(t[i]===void 0)t[i]=new Fi;t[i].copy(n[i])}return this._count=e._count,this}clone(){return new va().copy(this)}}function qr(e,t,n,i,s,r,a){let o=e.geometry.attributes.position;if(jr.fromBufferAttribute(o,s),Qr.fromBufferAttribute(o,r),n.distanceSqToSegment(jr,Qr,Do,qh)>i)return;Do.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Do);if(c<t.near||c>t.far)return;return{distance:c,point:qh.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}function Jh(e,t,n,i,s,r,a){let o=Oo.distanceSqToPoint(e);if(o<n){let l=new D;Oo.closestPointToPoint(e,l),l.applyMatrix4(i);let c=s.ray.origin.distanceTo(l);if(c<s.near||c>s.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}function Vi(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let s=e[n][i];if(jh(s))if(s.isRenderTargetTexture)Te("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=s.clone();else if(Array.isArray(s))if(jh(s[0])){let r=[];for(let a=0,o=s.length;a<o;a++)r[a]=s[a].clone();t[n][i]=r}else t[n][i]=s.slice();else t[n][i]=s}}return t}function Ut(e){let t={};for(let n=0;n<e.length;n++){let i=Vi(e[n]);for(let s in i)t[s]=i[s]}return t}function jh(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function gm(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Yl(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return He.workingColorSpace}function oi(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function Xs(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function vm(e){function t(s,r){return e[s]-e[r]}let n=e.length,i=Array(n);for(let s=0;s!==n;++s)i[s]=s;return i.sort(t),i}function Qh(e,t,n){let i=e.length,s=new e.constructor(i);for(let r=0,a=0;a!==i;++r){let o=n[r]*t;for(let l=0;l!==t;++l)s[a++]=e[o+l]}return s}function ym(e,t,n,i){let s=1,r=e[0];while(r!==void 0&&r[i]===void 0)r=e[s++];if(r===void 0)return;let a=r[i];if(a===void 0)return;if(Array.isArray(a))do{if(a=r[i],a!==void 0)t.push(r.time),n.push(...a);r=e[s++]}while(r!==void 0);else if(a.toArray!==void 0)do{if(a=r[i],a!==void 0)t.push(r.time),a.toArray(n,n.length);r=e[s++]}while(r!==void 0);else do{if(a=r[i],a!==void 0)t.push(r.time),n.push(a);r=e[s++]}while(r!==void 0)}class Jn{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let r;t:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break e}r=t.length;break t}if(!(e>=s)){let a=t[1];if(e<a)n=2,s=a;for(let o=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===o)break;if(i=s,s=t[--n-1],e>=s)break e}r=n,n=0;break t}break n}while(n<r){let a=n+r>>>1;if(e<t[a])r=a;else n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let r=0;r!==i;++r)t[r]=n[s+r];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}function ld(e,t,n,i,s){let r=1-e;return r*r*r*t+3*r*r*e*n+3*r*e*e*i+e*e*e*s}function Sm(e,t,n,i,s){let r=1-e;return 3*r*r*(n-t)+6*r*e*(i-n)+3*e*e*(s-i)}function bm(e,t,n,i,s){let r=(e-t)/(s-t);for(let a=0;a<8;a++){let o=ld(r,t,n,i,s)-e;if(Math.abs(o)<0.0000000001)break;let l=Sm(r,t,n,i,s);if(Math.abs(l)<0.0000000001)break;r=Math.max(0,Math.min(1,r-o/l))}return r}class an{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oi(t,this.TimeBufferType),this.values=oi(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oi(e.times,Array),values:oi(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i;if(Xs(e.settings))n.settings={inTangents:oi(e.settings.inTangents,Array),outTangents:oi(e.settings.outTangents,Array)}}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ec(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ql(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new jl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new tc(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Te("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e;if(Xs(this.settings))eu(this.settings.inTangents,e),eu(this.settings.outTangents,e)}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e;if(Xs(this.settings))tu(this.settings.inTangents,e),tu(this.settings.outTangents,e)}return this}trim(e,t){let n=this.times,i=n.length,s=0,r=i-1;while(s!==i&&n[s]<e)++s;while(r!==-1&&n[r]>t)--r;if(++r,s!==0||r!==i){if(s>=r)r=Math.max(r,1),s=r-1;let a=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*a,r*a)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Le("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,s=n.length;if(s===0)Le("KeyframeTrack: Track is empty.",this),e=!1;let r=null;for(let a=0;a!==s;a++){let o=n[a];if(typeof o==="number"&&isNaN(o)){Le("KeyframeTrack: Time is not a valid number.",this,a,o),e=!1;break}if(r!==null&&r>o){Le("KeyframeTrack: Out of order keys.",this,a,o,r),e=!1;break}r=o}if(i!==void 0){if(Np(i))for(let a=0,o=i.length;a!==o;++a){let l=i[a];if(isNaN(l)){Le("KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,s=e.length-1,r=1;for(let a=1;a<s;++a){let o=!1,l=e[a],c=e[a+1];if(l!==c&&(a!==1||l!==e[0]))if(!i){let h=a*n,u=h-n,d=h+n;for(let f=0;f!==n;++f){let _=t[h+f];if(_!==t[u+f]||_!==t[d+f]){o=!0;break}}}else o=!0;if(o){if(a!==r){e[r]=e[a];let h=a*n,u=r*n;for(let d=0;d!==n;++d)t[u+d]=t[h+d]}++r}}if(s>0){e[r]=e[s];for(let a=s*n,o=r*n,l=0;l!==n;++l)t[o+l]=t[a+l];++r}if(r!==e.length)this.times=e.slice(0,r),this.values=t.slice(0,r*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);if(i.createInterpolant=this.createInterpolant,Xs(this.settings))i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()};return i}}function eu(e,t){for(let n=0,i=e.length;n!==i;n+=2)e[n]+=t}function tu(e,t){for(let n=0,i=e.length;n!==i;n+=2)e[n]*=t}class Aa{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=In(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let r=0,a=n.length;r!==a;++r)t.push(wm(n[r]).scale(i));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,r=n.length;s!==r;++s)t.push(an.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let s=t.length,r=[];for(let a=0;a<s;a++){let o=[],l=[];o.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);let c=vm(o);if(o=Qh(o,1,c),l=Qh(l,1,c),!i&&o[0]===0)o.push(s),l.push(l[0]);r.push(new gi(".morphTargetInfluences["+t[a].name+"]",o,l).scale(1/n))}return new this(e,-1,r)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,o=e.length;a<o;a++){let l=e[a],c=l.name.match(s);if(c&&c.length>1){let h=c[1],u=i[h];if(!u)i[h]=u=[];u.push(l)}}let r=[];for(let a in i)r.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return r}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Mm(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return gi;case"vector":case"vector2":case"vector3":case"vector4":return Xi;case"color":return Ea;case"quaternion":return _i;case"bool":case"boolean":return mi;case"string":return xi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function wm(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=Mm(e.type);if(e.times===void 0){let i=[],s=[];ym(e.keys,i,s,"value"),e.times=i,e.values=s}let n;if(t.parse!==void 0)n=t.parse(e);else n=new t(e.name,e.times,e.values,e.interpolation);if(Xs(e.settings))n.settings={inTangents:oi(e.settings.inTangents,Float32Array),outTangents:oi(e.settings.outTangents,Float32Array)};return n}function nu(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class ic{constructor(e,t,n){let i=this,s=!1,r=0,a=0,o=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(c){if(a++,s===!1){if(i.onStart!==void 0)i.onStart(c,r,a)}s=!0},this.itemEnd=function(c){if(r++,i.onProgress!==void 0)i.onProgress(c,r,a);if(r===a){if(s=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(c){if(i.onError!==void 0)i.onError(c)},this.resolveURL=function(c){if(c=c.normalize("NFC"),o)return o(c);return c},this.setURLModifier=function(c){return o=c,this},this.addHandler=function(c,h){return l.push(c,h),this},this.removeHandler=function(c){let h=l.indexOf(c);if(h!==-1)l.splice(h,2);return this},this.getHandler=function(c){for(let h=0,u=l.length;h<u;h+=2){let d=l[h],f=l[h+1];if(d.global)d.lastIndex=0;if(d.test(c))return f}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}class jn{constructor(e){if(this.manager=e!==void 0?e:cd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},this.priority="auto",this.cache="default",typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}setPriority(e){return this.priority=e,this}setCache(e){return this.cache=e,this}abort(){return this}}class ur{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fi,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new tt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera;iu.setFromMatrixPosition(e.matrixWorld),t.position.copy(iu),su.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(su),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,n,i){Uo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.setFromProjectionMatrix(Uo,e.coordinateSystem,e.reversedDepth);let s=this._frameExtents,r=i?i.z/s.x:1,a=i?i.w/s.y:1,o=i?i.x/s.x:0,l=i?i.y/s.y:0;if(e.coordinateSystem===2001||e.reversedDepth)t.set(0.5*r,0,0,0.5*r+o,0,0.5*a,0,0.5*a+l,0,0,1,0,0,0,0,1);else t.set(0.5*r,0,0,0.5*r+o,0,0.5*a,0,0.5*a+l,0,0,0.5,0.5,0,0,0,1);t.multiply(Uo)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.mapType=e.mapType,this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.mapType=this.mapType,e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class yi{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}class pd{constructor(e,t,n){let i=n||Je.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Je{constructor(e,t,n){this.path=t,this.parsedPath=n||Je.parseTrackName(t),this.node=Je.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new Je(e,t,n);else return new Je.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Tm,"")}static parseTrackName(e){let t=Pm.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);if(Lm.indexOf(s)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=s}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let r=0;r<s.length;r++){let a=s[r];if(a.name===t||a.uuid===t)return a;let o=n(a.children);if(o)return o}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:s}=t;if(!e)e=Je.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Te("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Le("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Le("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===l){l=c;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Le("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Le("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Le("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let r=e[i];if(r===void 0){let l=t.nodeName;Le("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)a=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)a=this.Versioning.MatrixWorldNeedsUpdate;let o=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[s]!==void 0)s=e.morphTargetDictionary[s]}o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else if(r.fromArray!==void 0&&r.toArray!==void 0)o=this.BindingType.HasFromToArray,this.resolvedProperty=r;else if(Array.isArray(r))o=this.BindingType.EntireArray,this.resolvedProperty=r;else this.propertyName=i;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}}class Da{constructor(e,t,n=0,i=1/0){this.ray=new Gi(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new nr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){if(t.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,0.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t;else if(t.isOrthographicCamera)this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t;else Le("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ou.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ou),this}intersectObject(e,t=!0,n=[]){return Bo(e,this,n,t),n.sort(lu),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Bo(e[i],this,n,t);return n.sort(lu),n}}function lu(e,t){return e.distance-t.distance}function Bo(e,t,n,i){let s=!0;if(e.layers.test(t.layers)){if(e.raycast(t,n)===!1)s=!1}if(s===!0&&i===!0){let r=e.children;for(let a=0,o=r.length;a<o;a++)Bo(r[a],t,n,!0)}}function lc(e,t,n,i){let s=Nm(i);switch(n){case 1021:return e*t;case 1028:return e*t/s.components*s.byteLength;case 1029:return e*t/s.components*s.byteLength;case 1030:return e*t*2/s.components*s.byteLength;case 1031:return e*t*2/s.components*s.byteLength;case 1022:return e*t*3/s.components*s.byteLength;case 1023:return e*t*4/s.components*s.byteLength;case 1033:return e*t*4/s.components*s.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function Nm(e){switch(e){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(`THREE.TextureUtils: Unknown texture type ${e}.`)}var cu="187",hu=0,ko=1,uu=2,Zs=1,du=2,ps=3,ci=0,Xt=1,$t=2,Oi=0,Ks=1,zo=2,Ho=3,Go=4,fu=5,ms=100,pu=101,mu=102,gu=103,_u=104,xu=200,vu=201,yu=202,Su=203,bu=204,Mu=205,wu=206,Tu=207,Eu=208,Au=209,Ru=210,Cu=211,Iu=212,Pu=213,Lu=214,Nu=0,Du=1,Uu=2,Wo=3,Fu=4,Ou=5,Bu=6,ku=7,zu=0,Hu=1,Gu=2,Rn=0,Vo=1,Xo=2,$o=3,Js=4,qo=5,Yo=6,Zo=7,js=301,gs=302,ea=303,ta=304,hi=1000,_s=1001,na=1002,yn=1003,ia=1004,Bi=1005,mt=1006,xs=1007,tn=1008,Sn=1009,Wu=1010,Vu=1011,Qs=1012,Ko=1013,ui=1014,qn=1015,Cn=1016,Jo=1017,jo=1018,ki=1020,Xu=35902,$u=35899,qu=1021,Yu=1022,bn=1023,vs=1026,di=1027,Zu=1028,Qo=1029,zi=1030,el=1031,tl=1033,sa=33776,ra=33777,aa=33778,oa=33779,nl=35840,il=35841,sl=35842,rl=35843,al=36196,ol=37492,ll=37496,cl=37488,hl=37489,la=37490,ul=37491,dl=37808,fl=37809,pl=37810,ml=37811,gl=37812,_l=37813,xl=37814,vl=37815,yl=37816,Sl=37817,bl=37818,Ml=37819,wl=37820,Tl=37821,El=36492,Al=36494,Rl=36495,Cl=36283,Il=36284,ca=36285,Pl=36286,Ll=2300,ha=2301,Nl=0,er=1,ys=2,Dl=0,Ku=1,Hi="",ln="srgb",nn="srgb-linear",Ul="linear",st="srgb",Ju=512,ju=513,Qu=514,Fl=515,ed=516,td=517,Ol=518,Bl=519,ua=35048,kl="300 es",zl=2000,Sh,fs=null,rd,Lt,bh=1234567,$s,Ui,fi,ke,cn,D,fo,Mh,Ne,po,wh,Th,He,Ji,Kp=0,Jp=0,go,ft,tt,$l,hn,fa,ql,Fe,ji,_n,jp,Qp,ni,Ar,Qt,Eh,Ah,$n,em=0,Rh,Qi,kn,Rr,Os,tm,nm,Ch,Ih,Ph,Lh,im,es,_o,ot,En,sm,ad,ii,Cr,Ee,Nt,pa,xn,zn,vo,Hn,ts,ns,Nh,yo,So,bo,Mo,wo,To,Gn,vn,Ir,is,ss,rs,si,ri,Ii,Bs,Pr,Lr,Pi,vt,Nr,rm=0,pt,ma,ga,Vt,am,ks,Ao,om=0,on,Ro,as,en,zs,Et,Yt,Bt,Co,lm,cm,hm=0,rn,Wn,Io,Dr,Ur,Zn,Uh,Li,Fr,Fh,Or,Br,kr,Po,zr,Oh,Hr,yt,Hs,Bh,kh,dm,zh,Wr,Lo,Hh,No,_a,rr,Wi,Gh,fm,li,os,Wh,Vr,Vh,pm,Gs,Ws,xa,Ni,mm,Xr,Xh,or,jr,Qr,$h,Vs,$r,Do,qh,bs,Yh,Zh,ya,Sa,lr,Kh,Oo,Yr,Zr,ba,Ma,Ms,pi,wa,Ta,ws,cr,od,_m=`void main() {
|
|
1
|
+
var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};function Lp(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Np(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ds(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function nd(){let e=ds("canvas");return e.style.display="block",e}function Zs(...e){let t="THREE."+e.shift();if(fs)fs("log",t,...e);else console.log(t,...e)}function id(e){let t=e[0];if(typeof t==="string"&&t.startsWith("TSL:")){let n=e[1];if(n&&n.isStackTrace)e[0]+=" "+n.getLocation();else e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function Te(...e){e=id(e);let t="THREE."+e.shift();if(fs)fs("warn",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.warn(n.getError(t));else console.warn(t,...e)}}function Le(...e){e=id(e);let t="THREE."+e.shift();if(fs)fs("error",t,...e);else{let n=e[0];if(n&&n.isStackTrace)console.error(n.getError(t));else console.error(t,...e)}}function Di(...e){let t=e.join(" ");if(t in Sh)return;Sh[t]=!0,Te(...e)}function sd(e,t,n){return new Promise(function(i,s){function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:s();break;case e.TIMEOUT_EXPIRED:setTimeout(r,n);break;default:i()}}setTimeout(r,n)})}class Yn{addEventListener(e,t){if(this._listeners===void 0)this._listeners={};let n=this._listeners;if(n[e]===void 0)n[e]=[];if(n[e].indexOf(t)===-1)n[e].push(t)}hasEventListener(e,t){let n=this._listeners;if(n===void 0)return!1;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let s=i.indexOf(t);if(s!==-1)i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e);e.target=null}}}function In(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Lt[e&255]+Lt[e>>8&255]+Lt[e>>16&255]+Lt[e>>24&255]+"-"+Lt[t&255]+Lt[t>>8&255]+"-"+Lt[t>>16&15|64]+Lt[t>>24&255]+"-"+Lt[n&63|128]+Lt[n>>8&255]+"-"+Lt[n>>16&255]+Lt[n>>24&255]+Lt[i&255]+Lt[i>>8&255]+Lt[i>>16&255]+Lt[i>>24&255]).toLowerCase()}function Ve(e,t,n){return Math.max(t,Math.min(n,e))}function Hl(e,t){return(e%t+t)%t}function Dp(e,t,n,i,s){return i+(e-t)*(s-i)/(n-t)}function Up(e,t,n){if(e!==t)return(n-e)/(t-e);else return 0}function Ys(e,t,n){return(1-n)*e+n*t}function Fp(e,t,n,i){return Ys(e,t,1-Math.exp(-n*i))}function Op(e,t=1){return t-Math.abs(Hl(e,t*2)-t)}function Bp(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*(3-2*e)}function kp(e,t,n){if(e<=t)return 0;if(e>=n)return 1;return e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10)}function zp(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Hp(e,t){return e+Math.random()*(t-e)}function Gp(e){return e*(0.5-Math.random())}function Wp(e){if(e!==void 0)bh=e;let t=bh+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Vp(e){return e*qs}function Xp(e){return e*Ui}function $p(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function qp(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Gl(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Yp(e,t,n,i,s){let{cos:r,sin:a}=Math,o=r(n/2),l=a(n/2),c=r((t+i)/2),h=a((t+i)/2),u=r((t-i)/2),d=a((t-i)/2),f=r((i-t)/2),_=a((i-t)/2);switch(s){case"XYX":e.set(o*h,l*u,l*d,o*c);break;case"YZY":e.set(l*d,o*h,l*u,o*c);break;case"ZXZ":e.set(l*u,l*d,o*h,o*c);break;case"XZX":e.set(o*h,l*_,l*f,o*c);break;case"YXY":e.set(l*f,o*h,l*_,o*c);break;case"ZYZ":e.set(l*_,l*f,o*h,o*c);break;default:Te("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function da(e){switch(e.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function Wl(e,t){if(t.constructor===Float32Array)return e;let n=da(t);if(n===void 0)throw Error("THREE.MathUtils: Invalid component type.");return Math.max(e/n,-1)}function Vl(e,t){if(t.constructor===Float32Array)return e;let n=da(t);if(n===void 0)throw Error("THREE.MathUtils: Invalid component type.");return Math.round(e*n)}function Zp(){let e={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(s,r,a){if(this.enabled===!1||r===a||!r||!a)return s;if(this.spaces[r].transfer==="srgb")s.r=Xn(s.r),s.g=Xn(s.g),s.b=Xn(s.b);if(this.spaces[r].primaries!==this.spaces[a].primaries)s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ);if(this.spaces[a].transfer==="srgb")s.r=us(s.r),s.g=us(s.g),s.b=us(s.b);return s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){if(s==="")return"linear";return this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[a].fromXYZ).multiply(this.spaces[r].toXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},t=[0.64,0.33,0.3,0.6,0.15,0.06],n=[0.2126,0.7152,0.0722],i=[0.3127,0.329];return e.define({["srgb-linear"]:{primaries:t,whitePoint:i,transfer:"linear",toXYZ:wh,fromXYZ:Th,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:t,whitePoint:i,transfer:"srgb",toXYZ:wh,fromXYZ:Th,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),e}function Xn(e){return e<0.04045?e*0.0773993808:Math.pow(e*0.9478672986+0.0521327014,2.4)}function us(e){return e<0.0031308?e*12.92:1.055*Math.pow(e,0.41666)-0.055}class Xl{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if(typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{if(Ji===void 0)Ji=ds("canvas");Ji.width=e.width,Ji.height=e.height;let i=Ji.getContext("2d");if(e instanceof ImageData)i.putImageData(e,0,0);else i.drawImage(e,0,0,e.width,e.height);n=Ji}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=ds("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=Xn(s[r]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)t[n]=Math.floor(Xn(t[n]/255)*255);else t[n]=Xn(t[n]);return{data:t,width:e.width,height:e.height}}else return Te("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class nr{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Kp++}),this.uuid=In(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)e.set(t.videoWidth,t.videoHeight,0);else if(typeof VideoFrame<"u"&&t instanceof VideoFrame)e.set(t.displayWidth,t.displayHeight,0);else if(t!==null)e.set(t.width||0,t.height||0,t.depth||0);else e.set(0,0,0);return e}set needsUpdate(e){if(e===!0)this.version++}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,a=i.length;r<a;r++)if(i[r].isDataTexture)s.push(mo(i[r].image));else s.push(mo(i[r]))}else s=mo(i);n.url=s}if(!t)e.images[this.uuid]=n;return n}}function mo(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)return Xl.getDataURL(e);else if(e.data)return{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name};else return Te("Texture: Unable to serialize Texture."),{}}class ir{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}class sr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new En,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new En,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new En,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(e){if(this._targetRay!==null)this._targetRay.dispatchEvent(e);if(this._grip!==null)this._grip.dispatchEvent(e);if(this._hand!==null)this._hand.dispatchEvent(e);return this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){if(this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(e,t,n){let i=null,s=null,r=null,a=this._targetRay,o=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){r=!0;for(let _ of e.hand.values()){let y=t.getJointPose(_,n),p=this._getHandJoint(l,_);if(y!==null)p.matrix.fromArray(y.transform.matrix),p.matrix.decompose(p.position,p.quaternion,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=y.radius;p.visible=y!==null}let c=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],u=c.position.distanceTo(h.position),d=0.02,f=0.005;if(l.inputState.pinching&&u>d+f)l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this});else if(!l.inputState.pinching&&u<=d-f)l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this})}else if(o!==null&&e.gripSpace){if(s=t.getPose(e.gripSpace,n),s!==null){if(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity)o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity);else o.hasLinearVelocity=!1;if(s.angularVelocity)o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity);else o.hasAngularVelocity=!1;if(o.eventsEnabled)o.dispatchEvent({type:"gripUpdated",data:e,target:this})}}if(a!==null){if(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null)i=s;if(i!==null){if(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity)a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity);else a.hasLinearVelocity=!1;if(i.angularVelocity)a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity);else a.hasAngularVelocity=!1;this.dispatchEvent(sm)}}}if(a!==null)a.visible=i!==null;if(o!==null)o.visible=s!==null;if(l!==null)l.visible=r!==null;return this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new En;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}function xo(e,t,n){if(n<0)n+=1;if(n>1)n-=1;if(n<0.16666666666666666)return e+(t-e)*6*n;if(n<0.5)return t;if(n<0.6666666666666666)return e+(t-e)*6*(0.6666666666666666-n);return e}class Wt{constructor(e=new D,t=new D,n=new D){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),xn.subVectors(e,t),i.cross(xn);let s=i.lengthSq();if(s>0)return i.multiplyScalar(1/Math.sqrt(s));return i.set(0,0,0)}static getBarycoord(e,t,n,i,s){xn.subVectors(i,t),zn.subVectors(n,t),vo.subVectors(e,t);let r=xn.dot(xn),a=xn.dot(zn),o=xn.dot(vo),l=zn.dot(zn),c=zn.dot(vo),h=r*l-a*a;if(h===0)return s.set(0,0,0),null;let u=1/h,d=(l*o-a*c)*u,f=(r*c-a*o)*u;return s.set(1-d-f,f,d)}static containsPoint(e,t,n,i){if(this.getBarycoord(e,t,n,i,Hn)===null)return!1;return Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getInterpolation(e,t,n,i,s,r,a,o){if(this.getBarycoord(e,t,n,i,Hn)===null){if(o.x=0,o.y=0,"z"in o)o.z=0;if("w"in o)o.w=0;return null}return o.setScalar(0),o.addScaledVector(s,Hn.x),o.addScaledVector(r,Hn.y),o.addScaledVector(a,Hn.z),o}static getInterpolatedAttribute(e,t,n,i,s,r){return Mo.setScalar(0),wo.setScalar(0),To.setScalar(0),Mo.fromBufferAttribute(e,t),wo.fromBufferAttribute(e,n),To.fromBufferAttribute(e,i),r.setScalar(0),r.addScaledVector(Mo,s.x),r.addScaledVector(wo,s.y),r.addScaledVector(To,s.z),r}static isFrontFacing(e,t,n,i){return xn.subVectors(n,t),zn.subVectors(e,t),xn.cross(zn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return xn.subVectors(this.c,this.b),zn.subVectors(this.a,this.b),xn.cross(zn).length()*0.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(e){return Wt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Wt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Wt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,s=this.c,r,a;ts.subVectors(i,n),ns.subVectors(s,n),yo.subVectors(e,n);let o=ts.dot(yo),l=ns.dot(yo);if(o<=0&&l<=0)return t.copy(n);So.subVectors(e,i);let c=ts.dot(So),h=ns.dot(So);if(c>=0&&h<=c)return t.copy(i);let u=o*h-c*l;if(u<=0&&o>=0&&c<=0&&o-c>0)return r=o/(o-c),t.copy(n).addScaledVector(ts,r);bo.subVectors(e,s);let d=ts.dot(bo),f=ns.dot(bo);if(f>=0&&d<=f)return t.copy(s);let _=d*l-o*f;if(_<=0&&l>=0&&f<=0)return a=l/(l-f),t.copy(n).addScaledVector(ns,a);let y=c*f-d*h;if(y<=0&&h-c>=0&&d-f>=0)return Nh.subVectors(s,i),a=(h-c)/(h-c+(d-f)),t.copy(i).addScaledVector(Nh,a);let p=1/(y+_+u);return r=_*p,a=u*p,t.copy(n).addScaledVector(ts,r).addScaledVector(ns,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class qt{constructor(e=new D(1/0,1/0,1/0),t=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(vn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(vn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=vn.copy(t).multiplyScalar(0.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let r=0,a=s.count;r<a;r++){if(e.isMesh===!0)e.getVertexPosition(r,vn);else vn.fromBufferAttribute(s,r);vn.applyMatrix4(e.matrixWorld),this.expandByPoint(vn)}else{if(e.boundingBox!==void 0){if(e.boundingBox===null)e.computeBoundingBox();Ir.copy(e.boundingBox)}else{if(n.boundingBox===null)n.computeBoundingBox();Ir.copy(n.boundingBox)}Ir.applyMatrix4(e.matrixWorld),this.union(Ir)}}let i=e.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vn),vn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;if(e.normal.x>0)t=e.normal.x*this.min.x,n=e.normal.x*this.max.x;else t=e.normal.x*this.max.x,n=e.normal.x*this.min.x;if(e.normal.y>0)t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y;else t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y;if(e.normal.z>0)t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z;else t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z;return t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ks),Pr.subVectors(this.max,ks),is.subVectors(e.a,ks),ss.subVectors(e.b,ks),rs.subVectors(e.c,ks),si.subVectors(ss,is),ri.subVectors(rs,ss),Ii.subVectors(is,rs);let t=[0,-si.z,si.y,0,-ri.z,ri.y,0,-Ii.z,Ii.y,si.z,0,-si.x,ri.z,0,-ri.x,Ii.z,0,-Ii.x,-si.y,si.x,0,-ri.y,ri.x,0,-Ii.y,Ii.x,0];if(!Eo(t,is,ss,rs,Pr))return!1;if(t=[1,0,0,0,1,0,0,0,1],!Eo(t,is,ss,rs,Pr))return!1;return Lr.crossVectors(si,ri),t=[Lr.x,Lr.y,Lr.z],Eo(t,is,ss,rs,Pr)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vn).distanceTo(e)}getBoundingSphere(e){if(this.isEmpty())e.makeEmpty();else this.getCenter(e.center),e.radius=this.getSize(vn).length()*0.5;return e}intersect(e){if(this.min.max(e.min),this.max.min(e.max),this.isEmpty())this.makeEmpty();return this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){if(this.isEmpty())return this;return Gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Gn),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}function Eo(e,t,n,i,s){for(let r=0,a=e.length-3;r<=a;r+=3){Pi.fromArray(e,r);let o=s.x*Math.abs(Pi.x)+s.y*Math.abs(Pi.y)+s.z*Math.abs(Pi.z),l=t.dot(Pi),c=n.dot(Pi),h=i.dot(Pi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}class sn{constructor(e=new D,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;if(t!==void 0)n.copy(t);else am.setFromPoints(e).getCenter(n);let i=0;for(let s=0,r=e.length;s<r;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);if(t.copy(e),n>this.radius*this.radius)t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center);return t}getBoundingBox(e){if(this.isEmpty())return e.makeEmpty(),e;return e.set(this.center,this.center),e.expandByScalar(this.radius),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zs.subVectors(e,this.center);let t=zs.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*0.5;this.center.addScaledVector(zs,i/n),this.radius+=i}return this}union(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copy(e),this;if(this.center.equals(e.center)===!0)this.radius=Math.max(this.radius,e.radius);else Ao.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zs.copy(e.center).add(Ao)),this.expandByPoint(zs.copy(e.center).sub(Ao));return this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}class rr{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=In()}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};let t=Dh(this.array);if(e.arrayBuffers[t]===void 0)e.arrayBuffers[t]=this.array.slice(0).buffer;let n=new this.array.constructor(e.arrayBuffers[t]),i=new this.constructor(n,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){if(e.arrayBuffers===void 0)e.arrayBuffers={};let t=Dh(this.array);if(e.arrayBuffers[t]===void 0)e.arrayBuffers[t]=Array.from(new Uint32Array(this.array.slice(0).buffer));let n={uuid:this.uuid,buffer:t,type:this.array.constructor.name,stride:this.stride};return n.usage=this.usage,n}}function Dh(e){if(e.buffer._uuid===void 0)e.buffer._uuid=In();if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer._uuid;return e.buffer._uuid+":"+e.byteOffset+":"+e.byteLength}class Ss{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i,this._normalizationScale=e!==void 0?da(e.array):void 0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix4(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyNormalMatrix(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.transformDirection(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];if(this.normalized)n=this._denormalize(n);return n}setComponent(e,t,n){if(this.normalized)n=this._normalize(n);return this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){if(this.normalized)t=this._normalize(t);return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];if(this.normalized)t=this._denormalize(t);return t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];if(this.normalized)t=this._denormalize(t);return t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];if(this.normalized)t=this._denormalize(t);return t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];if(this.normalized)t=this._denormalize(t);return t}setXY(e,t,n){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n);return this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){if(e=e*this.data.stride+this.offset,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i),s=this._normalize(s);return this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){Zs("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new pt(new this.array.constructor(t),this.itemSize,this.normalized)}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.clone(e);return new Ss(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(e){if(e===void 0){Zs("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else{if(e.interleavedBuffers===void 0)e.interleavedBuffers={};if(e.interleavedBuffers[this.data.uuid]===void 0)e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}_denormalize(e){let t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Wl(e,this.data.array)}_normalize(e){let t=this._normalizationScale;return t!==void 0?Math.round(e*t):Vl(e,this.data.array)}}class Tn{constructor(e=new D(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Co.subVectors(n,t).cross(lm.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(Co),s=this.normal.dot(i);if(s===0){if(this.distanceToPoint(e.start)===0)return t.copy(e.start);return null}let r=-(e.start.dot(this.normal)+this.constant)/s;if(n===!0&&(r<0||r>1))return null;return t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||cm.getNormalMatrix(e),i=this.coplanarPoint(Co).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}class Gi{constructor(e=new D,t=new D(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Wn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);if(n<0)return t.copy(this.origin);return t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Wn.subVectors(e,this.origin).dot(this.direction);if(t<0)return this.origin.distanceToSquared(e);return Wn.copy(this.origin).addScaledVector(this.direction,t),Wn.distanceToSquared(e)}distanceSqToSegment(e,t,n,i){Io.copy(e).add(t).multiplyScalar(0.5),Dr.copy(t).sub(e).normalize(),Ur.copy(this.origin).sub(Io);let s=e.distanceTo(t)*0.5,r=-this.direction.dot(Dr),a=Ur.dot(this.direction),o=-Ur.dot(Dr),l=Ur.lengthSq(),c=Math.abs(1-r*r),h,u,d,f;if(c>0)if(h=r*o-a,u=r*a-o,f=s*c,h>=0)if(u>=-f)if(u<=f){let _=1/c;h*=_,u*=_,d=h*(h+r*u+2*a)+u*(r*h+u+2*o)+l}else u=s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;else u=-s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;else if(u<=-f)h=Math.max(0,-(-r*s+a)),u=h>0?-s:Math.min(Math.max(-s,-o),s),d=-h*h+u*(u+2*o)+l;else if(u<=f)h=0,u=Math.min(Math.max(-s,-o),s),d=u*(u+2*o)+l;else h=Math.max(0,-(r*s+a)),u=h>0?s:Math.min(Math.max(-s,-o),s),d=-h*h+u*(u+2*o)+l;else u=r>0?-s:s,h=Math.max(0,-(r*u+a)),d=-h*h+u*(u+2*o)+l;if(n)n.copy(this.origin).addScaledVector(this.direction,h);if(i)i.copy(Io).addScaledVector(Dr,u);return d}intersectSphere(e,t){if(e.radius<0)return null;Wn.subVectors(e.center,this.origin);let n=Wn.dot(this.direction),i=Wn.dot(Wn)-n*n,s=e.radius*e.radius;if(i>s)return null;let r=Math.sqrt(s-i),a=n-r,o=n+r;if(o<0)return null;if(a<0)return this.at(o,t);return this.at(a,t)}intersectsSphere(e){if(e.radius<0)return!1;return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0){if(e.distanceToPoint(this.origin)===0)return 0;return null}let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);if(n===null)return null;return this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(t===0)return!0;if(e.normal.dot(this.direction)*t<0)return!0;return!1}intersectBox(e,t){let n,i,s,r,a,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;if(l>=0)n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l;else n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l;if(c>=0)s=(e.min.y-u.y)*c,r=(e.max.y-u.y)*c;else s=(e.max.y-u.y)*c,r=(e.min.y-u.y)*c;if(n>r||s>i)return null;if(s>n||isNaN(n))n=s;if(r<i||isNaN(i))i=r;if(h>=0)a=(e.min.z-u.z)*h,o=(e.max.z-u.z)*h;else a=(e.max.z-u.z)*h,o=(e.min.z-u.z)*h;if(n>o||a>i)return null;if(a>n||n!==n)n=a;if(o<i||i!==i)i=o;if(i<0)return null;return this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Wn)!==null}intersectTriangle(e,t,n,i,s){let r=this.origin,a=this.direction,{x:o,y:l,z:c}=a,h=e.x-r.x,u=e.y-r.y,d=e.z-r.z,f=t.x-r.x,_=t.y-r.y,y=t.z-r.z,p=n.x-r.x,m=n.y-r.y,M=n.z-r.z,T=Math.abs(o),b=Math.abs(l),E=Math.abs(c),A,g,S,P,z,N,H,Q,C,Y,K,B;if(T>=b&&T>=E)if(S=o,N=h,C=f,B=p,o>=0)A=l,g=c,P=u,z=d,H=_,Q=y,Y=m,K=M;else A=c,g=l,P=d,z=u,H=y,Q=_,Y=M,K=m;else if(b>=E)if(S=l,N=u,C=_,B=m,l>=0)A=c,g=o,P=d,z=h,H=y,Q=f,Y=M,K=p;else A=o,g=c,P=h,z=d,H=f,Q=y,Y=p,K=M;else if(S=c,N=d,C=y,B=M,c>=0)A=o,g=l,P=h,z=u,H=f,Q=_,Y=p,K=m;else A=l,g=o,P=u,z=h,H=_,Q=f,Y=m,K=p;if(S===0)return null;let ae=A/S,V=g/S,j=1/S,ie=P-ae*N,be=z-V*N,Z=H-ae*C,ne=Q-V*C,ye=Y-ae*B,Ce=K-V*B,Ie=ye*ne-Ce*Z,Se=ie*Ce-be*ye,je=Z*be-ne*ie;if(i){if(Ie<0||Se<0||je<0)return null}else if((Ie<0||Se<0||je<0)&&(Ie>0||Se>0||je>0))return null;let We=Ie+Se+je;if(We===0)return null;let Oe=j*(Ie*N+Se*C+je*B);if(We>0?Oe<0:Oe>0)return null;return this.at(Oe/We,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}function um(e,t,n,i,s,r,a,o){let l;if(t.side===1)l=i.intersectTriangle(a,r,s,!0,o);else l=i.intersectTriangle(s,r,a,t.side===0,o);if(l===null)return null;Hr.copy(o),Hr.applyMatrix4(e.matrixWorld);let c=n.ray.origin.distanceTo(Hr);if(c<n.near||c>n.far)return null;return{distance:c,point:Hr.clone(),object:e}}function Gr(e,t,n,i,s,r,a,o,l,c){e.getVertexPosition(o,Or),e.getVertexPosition(l,Br),e.getVertexPosition(c,kr);let h=um(e,t,n,i,Or,Br,kr,Oh);if(h){let u=new D;if(Wt.getBarycoord(Oh,Or,Br,kr,u),s)h.uv=Wt.getInterpolatedAttribute(s,o,l,c,u,new ke);if(r)h.uv1=Wt.getInterpolatedAttribute(r,o,l,c,u,new ke);if(a){if(h.normal=Wt.getInterpolatedAttribute(a,o,l,c,u,new D),h.normal.dot(i.direction)>0)h.normal.multiplyScalar(-1)}let d={a:o,b:l,c,normal:new D,materialIndex:0};Wt.getNormal(Or,Br,kr,d.normal),h.face=d,h.barycoord=u}return h}class or{constructor(e=[],t=[]){this.uuid=In(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.previousBoneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Te("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Fe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Fe;if(this.bones[e])n.copy(this.bones[e].matrixWorld).invert();this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n)n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];if(n){if(n.parent&&n.parent.isBone)n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld);else n.matrix.copy(n.matrixWorld);n.matrix.decompose(n.position,n.quaternion,n.scale)}}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,r=e.length;s<r;s++){let a=e[s]?e[s].matrixWorld:fm;Gh.multiplyMatrices(a,t[s]),Gh.toArray(n,s*16)}if(i!==null)i.needsUpdate=!0}clone(){return new or(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new Wi(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null;if(this.previousBoneTexture!==null)this.previousBoneTexture.dispose(),this.previousBoneTexture=null}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let s=e.bones[n],r=t[s];if(r===void 0)Te("Skeleton: No bone found with UUID:",s),r=new ar;this.bones.push(r),this.boneInverses.push(new Fe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){let r=t[i];e.bones.push(r.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}}class Fi{constructor(e=new Tn,t=new Tn,n=new Tn,i=new Tn,s=new Tn,r=new Tn){this.planes=[e,t,n,i,s,r]}set(e,t,n,i,s,r){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(r),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2000,n=!1){let i=this.planes,s=e.elements,r=s[0],a=s[1],o=s[2],l=s[3],c=s[4],h=s[5],u=s[6],d=s[7],f=s[8],_=s[9],y=s[10],p=s[11],m=s[12],M=s[13],T=s[14],b=s[15];if(i[0].setComponents(l-r,d-c,p-f,b-m).normalize(),i[1].setComponents(l+r,d+c,p+f,b+m).normalize(),i[2].setComponents(l+a,d+h,p+_,b+M).normalize(),i[3].setComponents(l-a,d-h,p-_,b-M).normalize(),n)i[4].setComponents(o,u,y,T).normalize(),i[5].setComponents(l-o,d-u,p-y,b-T).normalize();else if(i[4].setComponents(l-o,d-u,p-y,b-T).normalize(),t===2000)i[5].setComponents(l+o,d+u,p+y,b+T).normalize();else if(t===2001)i[5].setComponents(o,u,y,T).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0){if(e.boundingSphere===null)e.computeBoundingSphere();Ni.copy(e.boundingSphere).applyMatrix4(e.matrixWorld)}else{let t=e.geometry;if(t.boundingSphere===null)t.computeBoundingSphere();Ni.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ni)}intersectsSprite(e){Ni.center.set(0,0,0);let t=mm.distanceTo(e.center);return Ni.radius=0.7071067811865476+t,Ni.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ni)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Xr.x=i.normal.x>0?e.max.x:e.min.x,Xr.y=i.normal.y>0?e.max.y:e.min.y,Xr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Xr)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class va{constructor(){this.coordinateSystem=2000,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let i=0;i<t.length;i++){let s=t[i];if(Xh.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[i]===void 0)n[i]=new Fi;n[i].setFromProjectionMatrix(Xh,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}getFrustum(e){return this._frustums[e]}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let i=0;i<e._count;i++){if(t[i]===void 0)t[i]=new Fi;t[i].copy(n[i])}return this._count=e._count,this}clone(){return new va().copy(this)}}function qr(e,t,n,i,s,r,a){let o=e.geometry.attributes.position;if(jr.fromBufferAttribute(o,s),Qr.fromBufferAttribute(o,r),n.distanceSqToSegment(jr,Qr,Do,qh)>i)return;Do.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Do);if(c<t.near||c>t.far)return;return{distance:c,point:qh.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}function Jh(e,t,n,i,s,r,a){let o=Oo.distanceSqToPoint(e);if(o<n){let l=new D;Oo.closestPointToPoint(e,l),l.applyMatrix4(i);let c=s.ray.origin.distanceTo(l);if(c<s.near||c>s.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}function Vi(e){let t={};for(let n in e){t[n]={};for(let i in e[n]){let s=e[n][i];if(jh(s))if(s.isRenderTargetTexture)Te("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null;else t[n][i]=s.clone();else if(Array.isArray(s))if(jh(s[0])){let r=[];for(let a=0,o=s.length;a<o;a++)r[a]=s[a].clone();t[n][i]=r}else t[n][i]=s.slice();else t[n][i]=s}}return t}function Ut(e){let t={};for(let n=0;n<e.length;n++){let i=Vi(e[n]);for(let s in i)t[s]=i[s]}return t}function jh(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function gm(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Yl(e){let t=e.getRenderTarget();if(t===null)return e.outputColorSpace;if(t.isXRRenderTarget===!0)return t.texture.colorSpace;return He.workingColorSpace}function oi(e,t){if(!e||e.constructor===t)return e;if(typeof t.BYTES_PER_ELEMENT==="number")return new t(e);return Array.prototype.slice.call(e)}function $s(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function vm(e){function t(s,r){return e[s]-e[r]}let n=e.length,i=Array(n);for(let s=0;s!==n;++s)i[s]=s;return i.sort(t),i}function Qh(e,t,n){let i=e.length,s=new e.constructor(i);for(let r=0,a=0;a!==i;++r){let o=n[r]*t;for(let l=0;l!==t;++l)s[a++]=e[o+l]}return s}function ym(e,t,n,i){let s=1,r=e[0];while(r!==void 0&&r[i]===void 0)r=e[s++];if(r===void 0)return;let a=r[i];if(a===void 0)return;if(Array.isArray(a))do{if(a=r[i],a!==void 0)t.push(r.time),n.push(...a);r=e[s++]}while(r!==void 0);else if(a.toArray!==void 0)do{if(a=r[i],a!==void 0)t.push(r.time),a.toArray(n,n.length);r=e[s++]}while(r!==void 0);else do{if(a=r[i],a!==void 0)t.push(r.time),n.push(a);r=e[s++]}while(r!==void 0)}class Jn{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let r;t:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break e}r=t.length;break t}if(!(e>=s)){let a=t[1];if(e<a)n=2,s=a;for(let o=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===o)break;if(i=s,s=t[--n-1],e>=s)break e}r=n,n=0;break t}break n}while(n<r){let a=n+r>>>1;if(e<t[a])r=a;else n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let r=0;r!==i;++r)t[r]=n[s+r];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}function ld(e,t,n,i,s){let r=1-e;return r*r*r*t+3*r*r*e*n+3*r*e*e*i+e*e*e*s}function Sm(e,t,n,i,s){let r=1-e;return 3*r*r*(n-t)+6*r*e*(i-n)+3*e*e*(s-i)}function bm(e,t,n,i,s){let r=(e-t)/(s-t);for(let a=0;a<8;a++){let o=ld(r,t,n,i,s)-e;if(Math.abs(o)<0.0000000001)break;let l=Sm(r,t,n,i,s);if(Math.abs(l)<0.0000000001)break;r=Math.max(0,Math.min(1,r-o/l))}return r}class an{constructor(e,t,n,i){if(e===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oi(t,this.TimeBufferType),this.values=oi(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:oi(e.times,Array),values:oi(e.values,Array)};let i=e.getInterpolation();if(i!==e.DefaultInterpolation)n.interpolation=i;if($s(e.settings))n.settings={inTangents:oi(e.settings.inTangents,Array),outTangents:oi(e.settings.outTangents,Array)}}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ec(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ql(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new jl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new tc(this.times,this.values,this.getValueSize(),e);if(this.settings)t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents;return t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return Te("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e;if($s(this.settings))eu(this.settings.inTangents,e),eu(this.settings.outTangents,e)}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e;if($s(this.settings))tu(this.settings.inTangents,e),tu(this.settings.outTangents,e)}return this}trim(e,t){let n=this.times,i=n.length,s=0,r=i-1;while(s!==i&&n[s]<e)++s;while(r!==-1&&n[r]>t)--r;if(++r,s!==0||r!==i){if(s>=r)r=Math.max(r,1),s=r-1;let a=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*a,r*a)}return this}validate(){let e=!0,t=this.getValueSize();if(t-Math.floor(t)!==0)Le("KeyframeTrack: Invalid value size in track.",this),e=!1;let n=this.times,i=this.values,s=n.length;if(s===0)Le("KeyframeTrack: Track is empty.",this),e=!1;let r=null;for(let a=0;a!==s;a++){let o=n[a];if(typeof o==="number"&&isNaN(o)){Le("KeyframeTrack: Time is not a valid number.",this,a,o),e=!1;break}if(r!==null&&r>o){Le("KeyframeTrack: Out of order keys.",this,a,o,r),e=!1;break}r=o}if(i!==void 0){if(Np(i))for(let a=0,o=i.length;a!==o;++a){let l=i[a];if(isNaN(l)){Le("KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===2302,s=e.length-1,r=1;for(let a=1;a<s;++a){let o=!1,l=e[a],c=e[a+1];if(l!==c&&(a!==1||l!==e[0]))if(!i){let h=a*n,u=h-n,d=h+n;for(let f=0;f!==n;++f){let _=t[h+f];if(_!==t[u+f]||_!==t[d+f]){o=!0;break}}}else o=!0;if(o){if(a!==r){e[r]=e[a];let h=a*n,u=r*n;for(let d=0;d!==n;++d)t[u+d]=t[h+d]}++r}}if(s>0){e[r]=e[s];for(let a=s*n,o=r*n,l=0;l!==n;++l)t[o+l]=t[a+l];++r}if(r!==e.length)this.times=e.slice(0,r),this.values=t.slice(0,r*n);else this.times=e,this.values=t;return this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);if(i.createInterpolant=this.createInterpolant,$s(this.settings))i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()};return i}}function eu(e,t){for(let n=0,i=e.length;n!==i;n+=2)e[n]+=t}function tu(e,t){for(let n=0,i=e.length;n!==i;n+=2)e[n]*=t}class Aa{constructor(e="",t=-1,n=[],i=2500){if(this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=In(),this.userData={},this.duration<0)this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let r=0,a=n.length;r!==a;++r)t.push(wm(n[r]).scale(i));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,r=n.length;s!==r;++s)t.push(an.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let s=t.length,r=[];for(let a=0;a<s;a++){let o=[],l=[];o.push((a+s-1)%s,a,(a+1)%s),l.push(0,1,0);let c=vm(o);if(o=Qh(o,1,c),l=Qh(l,1,c),!i&&o[0]===0)o.push(s),l.push(l[0]);r.push(new gi(".morphTargetInfluences["+t[a].name+"]",o,l).scale(1/n))}return new this(e,-1,r)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,o=e.length;a<o;a++){let l=e[a],c=l.name.match(s);if(c&&c.length>1){let h=c[1],u=i[h];if(!u)i[h]=u=[];u.push(l)}}let r=[];for(let a in i)r.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return r}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Mm(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return gi;case"vector":case"vector2":case"vector3":case"vector4":return Xi;case"color":return Ea;case"quaternion":return _i;case"bool":case"boolean":return mi;case"string":return xi}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function wm(e){if(e.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=Mm(e.type);if(e.times===void 0){let i=[],s=[];ym(e.keys,i,s,"value"),e.times=i,e.values=s}let n;if(t.parse!==void 0)n=t.parse(e);else n=new t(e.name,e.times,e.values,e.interpolation);if($s(e.settings))n.settings={inTangents:oi(e.settings.inTangents,Float32Array),outTangents:oi(e.settings.outTangents,Float32Array)};return n}function nu(e){try{let t=e.slice(e.indexOf(":")+1);return new URL(t).protocol==="blob:"}catch(t){return!1}}class ic{constructor(e,t,n){let i=this,s=!1,r=0,a=0,o=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(c){if(a++,s===!1){if(i.onStart!==void 0)i.onStart(c,r,a)}s=!0},this.itemEnd=function(c){if(r++,i.onProgress!==void 0)i.onProgress(c,r,a);if(r===a){if(s=!1,i.onLoad!==void 0)i.onLoad()}},this.itemError=function(c){if(i.onError!==void 0)i.onError(c)},this.resolveURL=function(c){if(c=c.normalize("NFC"),o)return o(c);return c},this.setURLModifier=function(c){return o=c,this},this.addHandler=function(c,h){return l.push(c,h),this},this.removeHandler=function(c){let h=l.indexOf(c);if(h!==-1)l.splice(h,2);return this},this.getHandler=function(c){for(let h=0,u=l.length;h<u;h+=2){let d=l[h],f=l[h+1];if(d.global)d.lastIndex=0;if(d.test(c))return f}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}class jn{constructor(e){if(this.manager=e!==void 0?e:cd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},this.priority="auto",this.cache="default",typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}setPriority(e){return this.priority=e,this}setCache(e){return this.cache=e,this}abort(){return this}}class dr{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new Fe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Fi,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new tt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera;iu.setFromMatrixPosition(e.matrixWorld),t.position.copy(iu),su.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(su),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,n,i){Uo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.setFromProjectionMatrix(Uo,e.coordinateSystem,e.reversedDepth);let s=this._frameExtents,r=i?i.z/s.x:1,a=i?i.w/s.y:1,o=i?i.x/s.x:0,l=i?i.y/s.y:0;if(e.coordinateSystem===2001||e.reversedDepth)t.set(0.5*r,0,0,0.5*r+o,0,0.5*a,0,0.5*a+l,0,0,1,0,0,0,0,1);else t.set(0.5*r,0,0,0.5*r+o,0,0.5*a,0,0.5*a+l,0,0,0.5,0.5,0,0,0,1);t.multiply(Uo)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.mapType=e.mapType,this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.mapType=this.mapType,e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class yi{static extractUrlBase(e){let t=e.lastIndexOf("/");if(t===-1)return"./";return e.slice(0,t+1)}static resolveURL(e,t){if(typeof e!=="string"||e==="")return"";if(/^https?:\/\//i.test(t)&&/^\//.test(e))t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(e))return e;if(/^data:.*,.*$/i.test(e))return e;if(/^blob:.*$/i.test(e))return e;return t+e}}class pd{constructor(e,t,n){let i=n||Je.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];if(i!==void 0)i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Je{constructor(e,t,n){this.path=t,this.parsedPath=n||Je.parseTrackName(t),this.node=Je.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){if(!(e&&e.isAnimationObjectGroup))return new Je(e,t,n);else return new Je.Composite(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Tm,"")}static parseTrackName(e){let t=Pm.exec(e);if(t===null)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);if(Lm.indexOf(s)!==-1)n.nodeName=n.nodeName.substring(0,i),n.objectName=s}if(n.propertyName===null||n.propertyName.length===0)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let r=0;r<s.length;r++){let a=s[r];if(a.name===t||a.uuid===t)return a;let o=n(a.children);if(o)return o}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,{objectName:n,propertyName:i,propertyIndex:s}=t;if(!e)e=Je.findNode(this.rootNode,t.nodeName),this.node=e;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Te("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Le("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Le("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===l){l=c;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Le("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Le("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Le("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let r=e[i];if(r===void 0){let l=t.nodeName;Le("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;if(this.targetObject=e,e.isMaterial===!0)a=this.Versioning.NeedsUpdate;else if(e.isObject3D===!0)a=this.Versioning.MatrixWorldNeedsUpdate;let o=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(e.morphTargetDictionary[s]!==void 0)s=e.morphTargetDictionary[s]}o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else if(r.fromArray!==void 0&&r.toArray!==void 0)o=this.BindingType.HasFromToArray,this.resolvedProperty=r;else if(Array.isArray(r))o=this.BindingType.EntireArray,this.resolvedProperty=r;else this.propertyName=i;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}}class Da{constructor(e,t,n=0,i=1/0){this.ray=new Gi(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new ir,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){if(t.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,0.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t;else if(t.isOrthographicCamera)this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t;else Le("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ou.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ou),this}intersectObject(e,t=!0,n=[]){return Bo(e,this,n,t),n.sort(lu),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Bo(e[i],this,n,t);return n.sort(lu),n}}function lu(e,t){return e.distance-t.distance}function Bo(e,t,n,i){let s=!0;if(e.layers.test(t.layers)){if(e.raycast(t,n)===!1)s=!1}if(s===!0&&i===!0){let r=e.children;for(let a=0,o=r.length;a<o;a++)Bo(r[a],t,n,!0)}}function lc(e,t,n,i){let s=Nm(i);switch(n){case 1021:return e*t;case 1028:return e*t/s.components*s.byteLength;case 1029:return e*t/s.components*s.byteLength;case 1030:return e*t*2/s.components*s.byteLength;case 1031:return e*t*2/s.components*s.byteLength;case 1022:return e*t*3/s.components*s.byteLength;case 1023:return e*t*4/s.components*s.byteLength;case 1033:return e*t*4/s.components*s.byteLength;case 33776:case 33777:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function Nm(e){switch(e){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(`THREE.TextureUtils: Unknown texture type ${e}.`)}var cu="187",hu=0,ko=1,uu=2,Ks=1,du=2,ps=3,ci=0,Xt=1,$t=2,Oi=0,Js=1,zo=2,Ho=3,Go=4,fu=5,ms=100,pu=101,mu=102,gu=103,_u=104,xu=200,vu=201,yu=202,Su=203,bu=204,Mu=205,wu=206,Tu=207,Eu=208,Au=209,Ru=210,Cu=211,Iu=212,Pu=213,Lu=214,Nu=0,Du=1,Uu=2,Wo=3,Fu=4,Ou=5,Bu=6,ku=7,zu=0,Hu=1,Gu=2,Rn=0,Vo=1,Xo=2,$o=3,js=4,qo=5,Yo=6,Zo=7,Qs=301,gs=302,ea=303,ta=304,hi=1000,_s=1001,na=1002,yn=1003,ia=1004,Bi=1005,mt=1006,xs=1007,tn=1008,Sn=1009,Wu=1010,Vu=1011,er=1012,Ko=1013,ui=1014,qn=1015,Cn=1016,Jo=1017,jo=1018,ki=1020,Xu=35902,$u=35899,qu=1021,Yu=1022,bn=1023,vs=1026,di=1027,Zu=1028,Qo=1029,zi=1030,el=1031,tl=1033,sa=33776,ra=33777,aa=33778,oa=33779,nl=35840,il=35841,sl=35842,rl=35843,al=36196,ol=37492,ll=37496,cl=37488,hl=37489,la=37490,ul=37491,dl=37808,fl=37809,pl=37810,ml=37811,gl=37812,_l=37813,xl=37814,vl=37815,yl=37816,Sl=37817,bl=37818,Ml=37819,wl=37820,Tl=37821,El=36492,Al=36494,Rl=36495,Cl=36283,Il=36284,ca=36285,Pl=36286,Ll=2300,ha=2301,Nl=0,tr=1,ys=2,Dl=0,Ku=1,Hi="",ln="srgb",nn="srgb-linear",Ul="linear",st="srgb",Ju=512,ju=513,Qu=514,Fl=515,ed=516,td=517,Ol=518,Bl=519,ua=35048,kl="300 es",zl=2000,Sh,fs=null,rd,Lt,bh=1234567,qs,Ui,fi,ke,cn,D,fo,Mh,Ne,po,wh,Th,He,Ji,Kp=0,Jp=0,go,ft,tt,$l,hn,fa,ql,Fe,ji,_n,jp,Qp,ni,Ar,Qt,Eh,Ah,$n,em=0,Rh,Qi,kn,Rr,Bs,tm,nm,Ch,Ih,Ph,Lh,im,es,_o,ot,En,sm,ad,ii,Cr,Ee,Nt,pa,xn,zn,vo,Hn,ts,ns,Nh,yo,So,bo,Mo,wo,To,Gn,vn,Ir,is,ss,rs,si,ri,Ii,ks,Pr,Lr,Pi,vt,Nr,rm=0,pt,ma,ga,Vt,am,zs,Ao,om=0,on,Ro,as,en,Hs,Et,Yt,Bt,Co,lm,cm,hm=0,rn,Wn,Io,Dr,Ur,Zn,Uh,Li,Fr,Fh,Or,Br,kr,Po,zr,Oh,Hr,yt,Gs,Bh,kh,dm,zh,Wr,Lo,Hh,No,_a,ar,Wi,Gh,fm,li,os,Wh,Vr,Vh,pm,Ws,Vs,xa,Ni,mm,Xr,Xh,lr,jr,Qr,$h,Xs,$r,Do,qh,bs,Yh,Zh,ya,Sa,cr,Kh,Oo,Yr,Zr,ba,Ma,Ms,pi,wa,Ta,ws,hr,od,_m=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,xm=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
-
}`,Kn,Zl,Pn,Ft,Kl,Jl,jl,Ql,ec,tc,mi,Ea,gi,nc,_i,xi,Xi,An,cd,Vn,hd,hr,ls,sc,Ra,Ts,Ca,Uo,iu,su,Kr,Jr,wn,Ia,ai,ru,au,Dt,ud,Pa,dd,La,vi,fd,$i,Fo,Na,cs=-90,hs=1,dr,rc,ac="\\[\\]\\.:\\/",Tm,oc,Em,Am,Rm,Cm,Im,Pm,Lm,fy,ou,md;var cc=On(()=>{Sh={};rd={[0]:0,[2]:6,[4]:4,[3]:5,[1]:1,[6]:2,[7]:7,[5]:3};Lt=["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"],$s=Math.PI/180,Ui=180/Math.PI;fi={DEG2RAD:$s,RAD2DEG:Ui,generateUUID:In,clamp:Ve,euclideanModulo:Hl,mapLinear:Dp,inverseLerp:Up,lerp:qs,damp:Fp,pingpong:Op,smoothstep:Bp,smootherstep:kp,randInt:zp,randFloat:Hp,randFloatSpread:Gp,seededRandom:Wp,degToRad:Vp,radToDeg:Xp,isPowerOfTwo:$p,ceilPowerOfTwo:qp,floorPowerOfTwo:Gl,setQuaternionFromProperEuler:Yp,normalize:Vl,denormalize:Wl};ke=class ke{static{this.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};cn=class cn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,r,a){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=s[r+0],d=s[r+1],f=s[r+2],_=s[r+3];if(h!==_||o!==u||l!==d||c!==f){let y=o*u+l*d+c*f+h*_;if(y<0)u=-u,d=-d,f=-f,_=-_,y=-y;let p=1-a;if(y<0.9995){let m=Math.acos(y),M=Math.sin(m);p=Math.sin(p*m)/M,a=Math.sin(a*m)/M,o=o*p+u*a,l=l*p+d*a,c=c*p+f*a,h=h*p+_*a}else{o=o*p+u*a,l=l*p+d*a,c=c*p+f*a,h=h*p+_*a;let m=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=m,l*=m,c*=m,h*=m}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){let a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=s[r],u=s[r+1],d=s[r+2],f=s[r+3];return e[t]=a*f+c*h+o*d-l*u,e[t+1]=o*f+c*u+l*h-a*d,e[t+2]=l*f+c*d+a*u-o*h,e[t+3]=c*f-a*h-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:s,_order:r}=e,{cos:a,sin:o}=Math,l=a(n/2),c=a(i/2),h=a(s/2),u=o(n/2),d=o(i/2),f=o(s/2);switch(r){case"XYZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"YXZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"ZXY":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"ZYX":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"YZX":this._x=u*c*h+l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h-u*d*f;break;case"XZY":this._x=u*c*h-l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h+u*d*f;break;default:Te("Quaternion: .setFromEuler() encountered an unknown order: "+r)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],a=t[5],o=t[9],l=t[2],c=t[6],h=t[10],u=n+a+h;if(u>0){let d=0.5/Math.sqrt(u+1);this._w=0.25/d,this._x=(c-o)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>a&&n>h){let d=2*Math.sqrt(1+n-a-h);this._w=(c-o)/d,this._x=0.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(a>h){let d=2*Math.sqrt(1+a-n-h);this._w=(s-l)/d,this._x=(i+r)/d,this._y=0.25*d,this._z=(o+c)/d}else{let d=2*Math.sqrt(1+h-n-a);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(o+c)/d,this._z=0.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ve(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:s,_w:r}=e,{_x:a,_y:o,_z:l,_w:c}=t;return this._x=n*c+r*a+i*l-s*o,this._y=i*c+r*o+s*a-n*l,this._z=s*c+r*l+n*o-i*a,this._w=r*c-n*a-i*o-s*l,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:s,_w:r}=e,a=this.dot(e);if(a<0)n=-n,i=-i,s=-s,r=-r,a=-a;let o=1-t;if(a<0.9995){let l=Math.acos(a),c=Math.sin(l);o=Math.sin(o*l)/c,t=Math.sin(t*l)/c,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+r*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+r*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};D=class D{static{this.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Mh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Mh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:s,y:r,z:a,w:o}=e,l=2*(r*i-a*n),c=2*(a*t-s*i),h=2*(s*n-r*t);return this.x=t+o*l+r*h-a*c,this.y=n+o*c+a*l-s*h,this.z=i+o*h+s*c-r*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:s}=e,{x:r,y:a,z:o}=t;return this.x=i*o-s*a,this.y=s*r-n*o,this.z=n*a-i*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return fo.copy(this).projectOnVector(e),this.sub(fo)}reflect(e){return this.sub(fo.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};fo=new D,Mh=new cn;Ne=class Ne{static{this.prototype.isMatrix3=!0}constructor(e,t,n,i,s,r,a,o,l){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,s,r,a,o,l)}set(e,t,n,i,s,r,a,o,l){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=o,c[6]=n,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],f=n[8],_=i[0],y=i[3],p=i[6],m=i[1],M=i[4],T=i[7],b=i[2],E=i[5],A=i[8];return s[0]=r*_+a*m+o*b,s[3]=r*y+a*M+o*E,s[6]=r*p+a*T+o*A,s[1]=l*_+c*m+h*b,s[4]=l*y+c*M+h*E,s[7]=l*p+c*T+h*A,s[2]=u*_+d*m+f*b,s[5]=u*y+d*M+f*E,s[8]=u*p+d*T+f*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8];return t*r*c-t*a*l-n*s*c+n*a*o+i*s*l-i*r*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8],h=c*r-a*l,u=a*o-c*s,d=l*s-r*o,f=t*h+n*u+i*d;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/f;return e[0]=h*_,e[1]=(i*l-c*n)*_,e[2]=(a*n-i*r)*_,e[3]=u*_,e[4]=(c*t-i*o)*_,e[5]=(i*s-a*t)*_,e[6]=d*_,e[7]=(n*o-l*t)*_,e[8]=(r*t-n*s)*_,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,a){let o=Math.cos(s),l=Math.sin(s);return this.set(n*o,n*l,-n*(o*r+l*a)+r+e,-i*l,i*o,-i*(-l*r+o*a)+a+t,0,0,1),this}scale(e,t){return Di("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(po.makeScale(e,t)),this}rotate(e){return Di("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(po.makeRotation(-e)),this}translate(e,t){return Di("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(po.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};po=new Ne,wh=new Ne().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),Th=new Ne().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);He=Zp();go=new D;ft=class ft extends Yn{constructor(e=ft.DEFAULT_IMAGE,t=ft.DEFAULT_MAPPING,n=1001,i=1001,s=1006,r=1008,a=1023,o=1009,l=ft.DEFAULT_ANISOTROPY,c=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:Jp++}),this.uuid=In(),this.name="",this.source=new tr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ne,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(go).x}get height(){return this.source.getSize(go).y}get depth(){return this.source.getSize(go).z}get image(){return this.source.data}set image(e){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Te(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Te(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}};ft.DEFAULT_IMAGE=null;ft.DEFAULT_MAPPING=300;ft.DEFAULT_ANISOTROPY=1;tt=class tt{static{this.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*t+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*t+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*t+r[7]*n+r[11]*i+r[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,s,r=0.01,a=0.1,o=e.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],f=o[9],_=o[2],y=o[6],p=o[10];if(Math.abs(c-u)<0.01&&Math.abs(h-_)<0.01&&Math.abs(f-y)<0.01){if(Math.abs(c+u)<0.1&&Math.abs(h+_)<0.1&&Math.abs(f+y)<0.1&&Math.abs(l+d+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(l+1)/2,T=(d+1)/2,b=(p+1)/2,E=(c+u)/4,A=(h+_)/4,g=(f+y)/4;if(M>T&&M>b)if(M<0.01)n=0,i=0.707106781,s=0.707106781;else n=Math.sqrt(M),i=E/n,s=A/n;else if(T>b)if(T<0.01)n=0.707106781,i=0,s=0.707106781;else i=Math.sqrt(T),n=E/i,s=g/i;else if(b<0.01)n=0.707106781,i=0.707106781,s=0;else s=Math.sqrt(b),n=A/s,i=g/s;return this.set(n,i,s,t),this}let m=Math.sqrt((y-f)*(y-f)+(h-_)*(h-_)+(u-c)*(u-c));if(Math.abs(m)<0.001)m=1;return this.x=(y-f)/m,this.y=(h-_)/m,this.z=(u-c)/m,this.w=Math.acos((l+d+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}};$l=class $l extends Yn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new tt(0,0,e,t),this.scissorTest=!1,this.viewport=new tt(0,0,e,t),this.textures=[];let i=n.count;for(let s=0;s<i;s++)this.textures[s]=new ft({width:e,height:t,depth:n.depth}),this.textures[s].isRenderTargetTexture=!0,this.textures[s].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.mipmapsAutoUpdate!==void 0)t.mipmapsAutoUpdate=e.mipmapsAutoUpdate;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null&&this._depthTexture.renderTarget===this)this._depthTexture.renderTarget=null;if(e!==null&&e.renderTarget===null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new tr(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture;else this.depthTexture=null;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};hn=class hn extends $l{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}};fa=class fa extends ft{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};ql=class ql extends ft{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}};Fe=class Fe{static{this.prototype.isMatrix4=!0}constructor(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y)}set(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=r,p[9]=a,p[13]=o,p[2]=l,p[6]=c,p[10]=h,p[14]=u,p[3]=d,p[7]=f,p[11]=_,p[15]=y,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 Fe().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/ji.setFromMatrixColumn(e,0).length(),s=1/ji.setFromMatrixColumn(e,1).length(),r=1/ji.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:s}=e,r=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let u=r*c,d=r*h,f=a*c,_=a*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=d+f*l,t[5]=u-_*l,t[9]=-a*o,t[2]=_-u*l,t[6]=f+d*l,t[10]=r*o}else if(e.order==="YXZ"){let u=o*c,d=o*h,f=l*c,_=l*h;t[0]=u+_*a,t[4]=f*a-d,t[8]=r*l,t[1]=r*h,t[5]=r*c,t[9]=-a,t[2]=d*a-f,t[6]=_+u*a,t[10]=r*o}else if(e.order==="ZXY"){let u=o*c,d=o*h,f=l*c,_=l*h;t[0]=u-_*a,t[4]=-r*h,t[8]=f+d*a,t[1]=d+f*a,t[5]=r*c,t[9]=_-u*a,t[2]=-r*l,t[6]=a,t[10]=r*o}else if(e.order==="ZYX"){let u=r*c,d=r*h,f=a*c,_=a*h;t[0]=o*c,t[4]=f*l-d,t[8]=u*l+_,t[1]=o*h,t[5]=_*l+u,t[9]=d*l-f,t[2]=-l,t[6]=a*o,t[10]=r*o}else if(e.order==="YZX"){let u=r*o,d=r*l,f=a*o,_=a*l;t[0]=o*c,t[4]=_-u*h,t[8]=f*h+d,t[1]=h,t[5]=r*c,t[9]=-a*c,t[2]=-l*c,t[6]=d*h+f,t[10]=u-_*h}else if(e.order==="XZY"){let u=r*o,d=r*l,f=a*o,_=a*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=u*h+_,t[5]=r*c,t[9]=d*h-f,t[2]=f*h-d,t[6]=a*c,t[10]=_*h+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(jp,e,Qp)}lookAt(e,t,n){let i=this.elements;if(Qt.subVectors(e,t),Qt.lengthSq()===0)Qt.z=1;if(Qt.normalize(),ni.crossVectors(n,Qt),ni.lengthSq()===0){if(Math.abs(n.z)===1)Qt.x+=0.0001;else Qt.z+=0.0001;Qt.normalize(),ni.crossVectors(n,Qt)}return ni.normalize(),Ar.crossVectors(Qt,ni),i[0]=ni.x,i[4]=Ar.x,i[8]=Qt.x,i[1]=ni.y,i[5]=Ar.y,i[9]=Qt.y,i[2]=ni.z,i[6]=Ar.z,i[10]=Qt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],f=n[2],_=n[6],y=n[10],p=n[14],m=n[3],M=n[7],T=n[11],b=n[15],E=i[0],A=i[4],g=i[8],S=i[12],P=i[1],z=i[5],N=i[9],H=i[13],Q=i[2],C=i[6],Y=i[10],K=i[14],B=i[3],ae=i[7],V=i[11],j=i[15];return s[0]=r*E+a*P+o*Q+l*B,s[4]=r*A+a*z+o*C+l*ae,s[8]=r*g+a*N+o*Y+l*V,s[12]=r*S+a*H+o*K+l*j,s[1]=c*E+h*P+u*Q+d*B,s[5]=c*A+h*z+u*C+d*ae,s[9]=c*g+h*N+u*Y+d*V,s[13]=c*S+h*H+u*K+d*j,s[2]=f*E+_*P+y*Q+p*B,s[6]=f*A+_*z+y*C+p*ae,s[10]=f*g+_*N+y*Y+p*V,s[14]=f*S+_*H+y*K+p*j,s[3]=m*E+M*P+T*Q+b*B,s[7]=m*A+M*z+T*C+b*ae,s[11]=m*g+M*N+T*Y+b*V,s[15]=m*S+M*H+T*K+b*j,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],a=e[5],o=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14],f=e[3],_=e[7],y=e[11],p=e[15],m=o*d-l*u,M=a*d-l*h,T=a*u-o*h,b=r*d-l*c,E=r*u-o*c,A=r*h-a*c;return t*(_*m-y*M+p*T)-n*(f*m-y*b+p*E)+i*(f*M-_*b+p*A)-s*(f*T-_*E+y*A)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[1],r=e[5],a=e[9],o=e[2],l=e[6],c=e[10];return t*(r*c-a*l)-n*(s*c-a*o)+i*(s*l-r*o)}transpose(){let e=this.elements,t;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(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],f=e[12],_=e[13],y=e[14],p=e[15],m=t*a-n*r,M=t*o-i*r,T=t*l-s*r,b=n*o-i*a,E=n*l-s*a,A=i*l-s*o,g=c*_-h*f,S=c*y-u*f,P=c*p-d*f,z=h*y-u*_,N=h*p-d*_,H=u*p-d*y,Q=m*H-M*N+T*z+b*P-E*S+A*g;if(Q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/Q;return e[0]=(a*H-o*N+l*z)*C,e[1]=(i*N-n*H-s*z)*C,e[2]=(_*A-y*E+p*b)*C,e[3]=(u*E-h*A-d*b)*C,e[4]=(o*P-r*H-l*S)*C,e[5]=(t*H-i*P+s*S)*C,e[6]=(y*T-f*A-p*M)*C,e[7]=(c*A-u*T+d*M)*C,e[8]=(r*N-a*P+l*g)*C,e[9]=(n*P-t*N-s*g)*C,e[10]=(f*E-_*T+p*m)*C,e[11]=(h*T-c*E-d*m)*C,e[12]=(a*S-r*z-o*g)*C,e[13]=(t*z-n*S+i*g)*C,e[14]=(_*M-f*b-y*m)*C,e[15]=(c*b-h*M+u*m)*C,this}scale(e){let t=this.elements,{x:n,y:i,z:s}=e;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,{x:r,y:a,z:o}=e,l=s*r,c=s*a;return this.set(l*r+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*r,0,l*o-i*a,c*o+i*r,s*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:s,_y:r,_z:a,_w:o}=t,l=s+s,c=r+r,h=a+a,u=s*l,d=s*c,f=s*h,_=r*c,y=r*h,p=a*h,m=o*l,M=o*c,T=o*h,{x:b,y:E,z:A}=n;return i[0]=(1-(_+p))*b,i[1]=(d+T)*b,i[2]=(f-M)*b,i[3]=0,i[4]=(d-T)*E,i[5]=(1-(u+p))*E,i[6]=(y+m)*E,i[7]=0,i[8]=(f+M)*A,i[9]=(y-m)*A,i[10]=(1-(u+_))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let r=ji.set(i[0],i[1],i[2]).length(),a=ji.set(i[4],i[5],i[6]).length(),o=ji.set(i[8],i[9],i[10]).length();if(s<0)r=-r;_n.copy(this);let l=1/r,c=1/a,h=1/o;return _n.elements[0]*=l,_n.elements[1]*=l,_n.elements[2]*=l,_n.elements[4]*=c,_n.elements[5]*=c,_n.elements[6]*=c,_n.elements[8]*=h,_n.elements[9]*=h,_n.elements[10]*=h,t.setFromRotationMatrix(_n),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,r,a=2000,o=!1){let l=this.elements,c=2*s/(t-e),h=2*s/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i),f,_;if(o)f=s/(r-s),_=r*s/(r-s);else if(a===2000)f=-(r+s)/(r-s),_=-2*r*s/(r-s);else if(a===2001)f=-r/(r-s),_=-r*s/(r-s);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,r,a=2000,o=!1){let l=this.elements,c=2/(t-e),h=2/(n-i),u=-(t+e)/(t-e),d=-(n+i)/(n-i),f,_;if(o)f=1/(r-s),_=r/(r-s);else if(a===2000)f=-2/(r-s),_=-(r+s)/(r-s);else if(a===2001)f=-1/(r-s),_=-s/(r-s);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=h,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=f,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};ji=new D,_n=new Fe,jp=new D(0,0,0),Qp=new D(1,1,1),ni=new D,Ar=new D,Qt=new D,Eh=new Fe,Ah=new cn;$n=class $n{constructor(e=0,t=0,n=0,i=$n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],r=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":if(this._y=Math.asin(Ve(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s);else this._x=Math.atan2(u,l),this._z=0;break;case"YXZ":if(this._x=Math.asin(-Ve(c,-1,1)),Math.abs(c)<0.9999999)this._y=Math.atan2(a,d),this._z=Math.atan2(o,l);else this._y=Math.atan2(-h,s),this._z=0;break;case"ZXY":if(this._x=Math.asin(Ve(u,-1,1)),Math.abs(u)<0.9999999)this._y=Math.atan2(-h,d),this._z=Math.atan2(-r,l);else this._y=0,this._z=Math.atan2(o,s);break;case"ZYX":if(this._y=Math.asin(-Ve(h,-1,1)),Math.abs(h)<0.9999999)this._x=Math.atan2(u,d),this._z=Math.atan2(o,s);else this._x=0,this._z=Math.atan2(-r,l);break;case"YZX":if(this._z=Math.asin(Ve(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,s);else this._x=0,this._y=Math.atan2(a,d);break;case"XZY":if(this._z=Math.asin(-Ve(r,-1,1)),Math.abs(r)<0.9999999)this._x=Math.atan2(u,l),this._y=Math.atan2(a,s);else this._x=Math.atan2(-c,d),this._y=0;break;default:Te("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return Eh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Eh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ah.setFromEuler(this),this.setFromQuaternion(Ah,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};$n.DEFAULT_ORDER="XYZ";Rh=new D,Qi=new cn,kn=new Fe,Rr=new D,Os=new D,tm=new D,nm=new cn,Ch=new D(1,0,0),Ih=new D(0,1,0),Ph=new D(0,0,1),Lh={type:"added"},im={type:"removed"},es={type:"childadded",child:null},_o={type:"childremoved",child:null};ot=class ot extends Yn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:em++}),this.uuid=In(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DEFAULT_UP.clone();let e=new D,t=new $n,n=new cn,i=new D(1,1,1);function s(){n.setFromEuler(t,!1)}function r(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new Ne}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new nr,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.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null)this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.multiply(Qi),this}rotateOnWorldAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.premultiply(Qi),this}rotateX(e){return this.rotateOnAxis(Ch,e)}rotateY(e){return this.rotateOnAxis(Ih,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Rh.copy(e).applyQuaternion(this.quaternion),this.position.add(Rh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ch,e)}translateY(e){return this.translateOnAxis(Ih,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(kn.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)Rr.copy(e);else Rr.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),Os.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)kn.lookAt(Os,Rr,this.up);else kn.lookAt(Rr,Os,this.up);if(this.quaternion.setFromRotationMatrix(kn),i)kn.extractRotation(i.matrixWorld),Qi.setFromRotationMatrix(kn),this.quaternion.premultiply(Qi.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Le("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lh),es.child=e,this.dispatchEvent(es),es.child=null;else Le("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(im),_o.child=e,this.dispatchEvent(_o),_o.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),kn.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),kn.multiply(e.parent.matrixWorld);return e.applyMatrix4(kn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lh),es.child=e,this.dispatchEvent(es),es.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,e,tm),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Os,nm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,i.name=this.name,i.castShadow=this.castShadow,i.receiveShadow=this.receiveShadow,i.visible=this.visible,i.frustumCulled=this.frustumCulled,i.renderOrder=this.renderOrder,i.static=this.static,i.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((a)=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((a)=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function s(a,o){if(a[o.uuid]===void 0)a[o.uuid]=o.toJSON(e);return o.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let o=a.shapes;if(Array.isArray(o))for(let l=0,c=o.length;l<c;l++){let h=o[l];s(e.shapes,h)}else s(e.shapes,o)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let o=0,l=this.material.length;o<l;o++)a.push(s(e.materials,this.material[o]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let o=this.animations[a];i.animations.push(s(e.animations,o))}}if(t){let a=r(e.geometries),o=r(e.materials),l=r(e.textures),c=r(e.images),h=r(e.shapes),u=r(e.skeletons),d=r(e.animations),f=r(e.nodes);if(a.length>0)n.geometries=a;if(o.length>0)n.materials=o;if(l.length>0)n.textures=l;if(c.length>0)n.images=c;if(h.length>0)n.shapes=h;if(u.length>0)n.skeletons=u;if(d.length>0)n.animations=d;if(f.length>0)n.nodes=f}return n.object=i,n;function r(a){let o=[];for(let l in a){let c=a[l];delete c.metadata,o.push(c)}return o}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};ot.DEFAULT_UP=new D(0,1,0);ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;En=class En extends ot{constructor(){super();this.isGroup=!0,this.type="Group"}};sm={type:"move"};ad={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ii={h:0,s:0,l:0},Cr={h:0,s:0,l:0};Ee=class Ee{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,He.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=He.workingColorSpace){return this.r=e,this.g=t,this.b=n,He.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=He.workingColorSpace){if(e=Hl(e,1),t=Ve(t,0,1),n=Ve(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=0.5?n*(1+t):n+t-n*t,r=2*n-s;this.r=xo(r,s,e+0.3333333333333333),this.g=xo(r,s,e),this.b=xo(r,s,e-0.3333333333333333)}return He.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(s){if(s===void 0)return;if(parseFloat(s)<1)Te("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseFloat(s[1]))/100,Math.min(100,parseFloat(s[2]))/100,Math.min(100,parseFloat(s[3]))/100,t);break;case"hsl":case"hsla":if(s=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Te("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);else if(r===6)return this.setHex(parseInt(s,16),t);else Te("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=ad[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Te("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Xn(e.r),this.g=Xn(e.g),this.b=Xn(e.b),this}copyLinearToSRGB(e){return this.r=us(e.r),this.g=us(e.g),this.b=us(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return He.workingToColorSpace(Nt.copy(this),e),Math.round(Ve(Nt.r*255,0,255))*65536+Math.round(Ve(Nt.g*255,0,255))*256+Math.round(Ve(Nt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=He.workingColorSpace){He.workingToColorSpace(Nt.copy(this),t);let{r:n,g:i,b:s}=Nt,r=Math.max(n,i,s),a=Math.min(n,i,s),o,l,c=(a+r)/2;if(a===r)o=0,l=0;else{let h=r-a;switch(l=c<=0.5?h/(r+a):h/(2-r-a),r){case n:o=(i-s)/h+(i<s?6:0);break;case i:o=(s-n)/h+2;break;case s:o=(n-i)/h+4;break}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=He.workingColorSpace){return He.workingToColorSpace(Nt.copy(this),t),e.r=Nt.r,e.g=Nt.g,e.b=Nt.b,e}getStyle(e="srgb"){He.workingToColorSpace(Nt.copy(this),e);let{r:t,g:n,b:i}=Nt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ii),this.setHSL(ii.h+e,ii.s+t,ii.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ii),e.getHSL(Cr);let n=qs(ii.h,Cr.h,t),i=qs(ii.s,Cr.s,t),s=qs(ii.l,Cr.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};Nt=new Ee;Ee.NAMES=ad;pa=class pa extends ot{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new $n,this.environmentIntensity=1,this.environmentRotation=new $n,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),this.background=e.background!==null?e.background.clone():null,this.environment=e.environment!==null?e.environment.clone():null,this.fog=e.fog!==null?e.fog.clone():null,this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),this.overrideMaterial=e.overrideMaterial!==null?e.overrideMaterial.clone():null,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();return t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}};xn=new D,zn=new D,vo=new D,Hn=new D,ts=new D,ns=new D,Nh=new D,yo=new D,So=new D,bo=new D,Mo=new tt,wo=new tt,To=new tt;Gn=[new D,new D,new D,new D,new D,new D,new D,new D],vn=new D,Ir=new qt,is=new D,ss=new D,rs=new D,si=new D,ri=new D,Ii=new D,Bs=new D,Pr=new D,Lr=new D,Pi=new D;vt=new D,Nr=new ke;pt=class pt extends Yn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rm++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0,this._normalizationScale=e!==void 0?da(e):void 0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.applyMatrix3(e),this.setXY(t,Nr.x,Nr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyMatrix3(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyMatrix4(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyNormalMatrix(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.transformDirection(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=this._denormalize(n);return n}setComponent(e,t,n){if(this.normalized)n=this._normalize(n);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=this._denormalize(t);return t}setX(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=this._denormalize(t);return t}setY(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=this._denormalize(t);return t}setZ(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=this._denormalize(t);return t}setW(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i),s=this._normalize(s);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}_denormalize(e){let t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Wl(e,this.array)}_normalize(e){let t=this._normalizationScale;return t!==void 0?Math.round(e*t):Vl(e,this.array)}};ma=class ma extends pt{constructor(e,t,n){super(new Uint16Array(e),t,n)}};ga=class ga extends pt{constructor(e,t,n){super(new Uint32Array(e),t,n)}};Vt=class Vt extends pt{constructor(e,t,n){super(new Float32Array(e),t,n)}};am=new qt,ks=new D,Ao=new D;on=new Fe,Ro=new ot,as=new D,en=new qt,zs=new qt,Et=new D;Yt=class Yt extends Yn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:om++}),this.uuid=In(),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={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((Lp(e))?ga:ma)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let s=new Ne().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return on.makeRotationFromQuaternion(e),this.applyMatrix4(on),this}rotateX(e){return on.makeRotationX(e),this.applyMatrix4(on),this}rotateY(e){return on.makeRotationY(e),this.applyMatrix4(on),this}rotateZ(e){return on.makeRotationZ(e),this.applyMatrix4(on),this}translate(e,t,n){return on.makeTranslation(e,t,n),this.applyMatrix4(on),this}scale(e,t,n){return on.makeScale(e,t,n),this.applyMatrix4(on),this}lookAt(e){return Ro.lookAt(e),Ro.updateMatrix(),this.applyMatrix4(Ro.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(as).negate(),this.translate(as.x,as.y,as.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,s=e.length;i<s;i++){let r=e[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new Vt(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}if(e.length>t.count)Te("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new qt;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];if(en.setFromBufferAttribute(s),this.morphTargetsRelative)Et.addVectors(this.boundingBox.min,en.min),this.boundingBox.expandByPoint(Et),Et.addVectors(this.boundingBox.max,en.max),this.boundingBox.expandByPoint(Et);else this.boundingBox.expandByPoint(en.min),this.boundingBox.expandByPoint(en.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Le('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new sn;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){let n=this.boundingSphere.center;if(en.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];if(zs.setFromBufferAttribute(a),this.morphTargetsRelative)Et.addVectors(en.min,zs.min),en.expandByPoint(Et),Et.addVectors(en.max,zs.max),en.expandByPoint(Et);else en.expandByPoint(zs.min),en.expandByPoint(zs.max)}en.getCenter(n);let i=0;for(let s=0,r=e.count;s<r;s++)Et.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Et));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],o=this.morphTargetsRelative;for(let l=0,c=a.count;l<c;l++){if(Et.fromBufferAttribute(a,l),o)as.fromBufferAttribute(e,l),Et.add(as);i=Math.max(i,n.distanceToSquared(Et))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Le('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Le("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:s}=t,r=this.getAttribute("tangent");if(r===void 0||r.count!==n.count)r=new pt(new Float32Array(4*n.count),4),this.setAttribute("tangent",r);let a=[],o=[],l=new Uint8Array(n.count);for(let S=0;S<n.count;S++)a[S]=new D,o[S]=new D;let c=new D,h=new D,u=new D,d=new ke,f=new ke,_=new ke,y=new D,p=new D;function m(S,P,z){l[S]=l[P]=l[z]=1,c.fromBufferAttribute(n,S),h.fromBufferAttribute(n,P),u.fromBufferAttribute(n,z),d.fromBufferAttribute(s,S),f.fromBufferAttribute(s,P),_.fromBufferAttribute(s,z),h.sub(c),u.sub(c),f.sub(d),_.sub(d);let N=1/(f.x*_.y-_.x*f.y);if(!isFinite(N))return;y.copy(h).multiplyScalar(_.y).addScaledVector(u,-f.y).multiplyScalar(N),p.copy(u).multiplyScalar(f.x).addScaledVector(h,-_.x).multiplyScalar(N),a[S].add(y),a[P].add(y),a[z].add(y),o[S].add(p),o[P].add(p),o[z].add(p)}let M=this.groups;if(M.length===0)M=[{start:0,count:e.count}];for(let S=0,P=M.length;S<P;++S){let z=M[S],{start:N,count:H}=z;for(let Q=N,C=N+H;Q<C;Q+=3)m(e.getX(Q+0),e.getX(Q+1),e.getX(Q+2))}let T=new D,b=new D,E=new D,A=new D;function g(S){E.fromBufferAttribute(i,S),A.copy(E);let P=a[S];T.copy(P),T.sub(E.multiplyScalar(E.dot(P))).normalize(),b.crossVectors(A,P);let N=b.dot(o[S])<0?-1:1;r.setXYZW(S,T.x,T.y,T.z,N)}for(let S=0,P=n.count;S<P;++S)if(l[S])g(S);this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new pt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,d=n.count;u<d;u++)n.setXYZ(u,0,0,0);let i=new D,s=new D,r=new D,a=new D,o=new D,l=new D,c=new D,h=new D;if(e)for(let u=0,d=e.count;u<d;u+=3){let f=e.getX(u+0),_=e.getX(u+1),y=e.getX(u+2);i.fromBufferAttribute(t,f),s.fromBufferAttribute(t,_),r.fromBufferAttribute(t,y),c.subVectors(r,s),h.subVectors(i,s),c.cross(h),a.fromBufferAttribute(n,f),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,y),a.add(c),o.add(c),l.add(c),n.setXYZ(f,a.x,a.y,a.z),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(y,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)i.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),r.fromBufferAttribute(t,u+2),c.subVectors(r,s),h.subVectors(i,s),c.cross(h),n.setXYZ(u+0,c.x,c.y,c.z),n.setXYZ(u+1,c.x,c.y,c.z),n.setXYZ(u+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Et.fromBufferAttribute(e,t),Et.normalize(),e.setXYZ(t,Et.x,Et.y,Et.z)}toNonIndexed(){function e(a,o){let{array:l,itemSize:c,normalized:h}=a,u=new l.constructor(o.length*c),d=0,f=0;for(let _=0,y=o.length;_<y;_++){if(a.isInterleavedBufferAttribute)d=o[_]*a.data.stride+a.offset;else d=o[_]*c;for(let p=0;p<c;p++)u[f++]=l[d++]}return new pt(u,c,h)}if(this.index===null)return Te("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Yt,n=this.index.array,i=this.attributes;for(let a in i){let o=i[a],l=e(o,n);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let o=[],l=s[a];for(let c=0,h=l.length;c<h;c++){let u=l[c],d=e(u,n);o.push(d)}t.morphAttributes[a]=o}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,o=r.length;a<o;a++){let l=r[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)if(o[l]!==void 0)e[l]=o[l];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let o in n){let l=n[o];e.data.attributes[o]=l.toJSON(e.data)}let i={},s=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],c=[];for(let h=0,u=l.length;h<u;h++){let d=l[h];c.push(d.toJSON(e.data))}if(c.length>0)i[o]=c,s=!0}if(s)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;if(r.length>0)e.data.groups=JSON.parse(JSON.stringify(r));let a=this.boundingSphere;if(a!==null)e.data.boundingSphere=a.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let l in i){let c=i[l];this.setAttribute(l,c.clone(t))}let s=e.morphAttributes;for(let l in s){let c=[],h=s[l];for(let u=0,d=h.length;u<d;u++)c.push(h[u].clone(t));this.morphAttributes[l]=c}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let l=0,c=r.length;l<c;l++){let h=r[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;if(a!==null)this.boundingBox=a.clone();let o=e.boundingSphere;if(o!==null)this.boundingSphere=o.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};Bt=new D;Co=new D,lm=new D,cm=new Ne;rn=class rn extends Yn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:hm++}),this.uuid=In(),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 Ee(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(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Te(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Te(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.diffuseRoughness!==void 0)n.diffuseRoughness=this.diffuseRoughness;if(this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture)n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.retroreflectivity!==void 0)n.retroreflectivity=this.retroreflectivity;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessMinimum!==void 0)n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum;if(this.iridescenceThicknessMaximum!==void 0)n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0)n.clippingPlanes=this.clippingPlanes.map((s)=>s.toJSON());if(this.rotation!==void 0)n.rotation=this.rotation;if(this.depthPacking!==void 0)n.depthPacking=this.depthPacking;if(this.linewidth!==void 0)n.linewidth=this.linewidth;if(this.linecap!==void 0)n.linecap=this.linecap;if(this.linejoin!==void 0)n.linejoin=this.linejoin;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.wireframe!==void 0)n.wireframe=this.wireframe;if(this.wireframeLinewidth!==void 0)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!==void 0)n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!==void 0)n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading!==void 0)n.flatShading=this.flatShading;if(this.fog!==void 0)n.fog=this.fog;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(s){let r=[];for(let a in s){let o=s[a];delete o.metadata,r.push(o)}return r}if(t){let s=i(e.textures),r=i(e.images);if(s.length>0)n.textures=s;if(r.length>0)n.images=r}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Ee().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.diffuseRoughness!==void 0)this.diffuseRoughness=e.diffuseRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.retroreflectivity!==void 0)this.retroreflectivity=e.retroreflectivity;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessMinimum!==void 0)this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum;if(e.iridescenceThicknessMaximum!==void 0)this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1];if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.clippingPlanes!==void 0)this.clippingPlanes=e.clippingPlanes.map((n)=>new Tn().fromJSON(n));if(e.clipIntersection!==void 0)this.clipIntersection=e.clipIntersection;if(e.clipShadows!==void 0)this.clipShadows=e.clipShadows;if(e.depthPacking!==void 0)this.depthPacking=e.depthPacking;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.linecap!==void 0)this.linecap=e.linecap;if(e.linejoin!==void 0)this.linejoin=e.linejoin;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new ke().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new ke().fromArray(e.clearcoatNormalScale);if(e.diffuseRoughnessMap!==void 0)this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null;if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}};Wn=new D,Io=new D,Dr=new D,Ur=new D;Zn=class Zn extends rn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ee(16777215),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 $n,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Uh=new Fe,Li=new Gi,Fr=new sn,Fh=new D,Or=new D,Br=new D,kr=new D,Po=new D,zr=new D,Oh=new D,Hr=new D;yt=class yt extends ot{constructor(e=new Yt,t=new Zn){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,r=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let a=this.morphTargetInfluences;if(s&&a){zr.set(0,0,0);for(let o=0,l=s.length;o<l;o++){let c=a[o],h=s[o];if(c===0)continue;if(Po.fromBufferAttribute(h,e),r)zr.addScaledVector(Po,c);else zr.addScaledVector(Po.sub(t),c)}t.add(zr)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(Fr.copy(n.boundingSphere),Fr.applyMatrix4(s),Li.copy(e.ray).recast(e.near),Fr.containsPoint(Li.origin)===!1){if(Li.intersectSphere(Fr,Fh)===null)return;if(Li.origin.distanceToSquared(Fh)>(e.far-e.near)**2)return}if(Uh.copy(s).invert(),Li.copy(e.ray).applyMatrix4(Uh),n.boundingBox!==null){if(Li.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,Li)}_computeIntersections(e,t,n){let i,s=this.geometry,r=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,h=s.attributes.normal,{groups:u,drawRange:d}=s;if(a!==null)if(Array.isArray(r))for(let f=0,_=u.length;f<_;f++){let y=u[f],p=r[y.materialIndex],m=Math.max(y.start,d.start),M=Math.min(a.count,Math.min(y.start+y.count,d.start+d.count));for(let T=m,b=M;T<b;T+=3){let E=a.getX(T),A=a.getX(T+1),g=a.getX(T+2);if(i=Gr(this,p,e,n,l,c,h,E,A,g),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let f=Math.max(0,d.start),_=Math.min(a.count,d.start+d.count);for(let y=f,p=_;y<p;y+=3){let m=a.getX(y),M=a.getX(y+1),T=a.getX(y+2);if(i=Gr(this,r,e,n,l,c,h,m,M,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}else if(o!==void 0)if(Array.isArray(r))for(let f=0,_=u.length;f<_;f++){let y=u[f],p=r[y.materialIndex],m=Math.max(y.start,d.start),M=Math.min(o.count,Math.min(y.start+y.count,d.start+d.count));for(let T=m,b=M;T<b;T+=3){let E=T,A=T+1,g=T+2;if(i=Gr(this,p,e,n,l,c,h,E,A,g),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let f=Math.max(0,d.start),_=Math.min(o.count,d.start+d.count);for(let y=f,p=_;y<p;y+=3){let m=y,M=y+1,T=y+2;if(i=Gr(this,r,e,n,l,c,h,m,M,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}}};Hs=new tt,Bh=new tt,kh=new tt,dm=new tt,zh=new Fe,Wr=new D,Lo=new sn,Hh=new Fe,No=new Gi;_a=class _a extends yt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new qt;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Wr),this.boundingBox.expandByPoint(Wr)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new sn;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Wr),this.boundingSphere.expandByPoint(Wr)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Lo.copy(this.boundingSphere),Lo.applyMatrix4(i),e.ray.intersectsSphere(Lo)===!1)return;if(Hh.copy(i).invert(),No.copy(e.ray).applyMatrix4(Hh),this.boundingBox!==null){if(No.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,No)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new tt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let s=1/e.manhattanLength();if(s!==1/0)e.multiplyScalar(s);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Te("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(Bh.fromBufferAttribute(i.attributes.skinIndex,e),kh.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)Hs.copy(t),t.set(0,0,0,0);else Hs.set(t.x,t.y,t.z,1),t.set(0,0,0);Hs.applyMatrix4(this.bindMatrix);for(let s=0;s<4;s++){let r=kh.getComponent(s);if(r!==0){let a=Bh.getComponent(s);zh.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(dm.copy(Hs).applyMatrix4(zh),r)}}if(t.isVector4)t.w=Hs.w;return t.applyMatrix4(this.bindMatrixInverse)}};rr=class rr extends ot{constructor(){super();this.isBone=!0,this.type="Bone"}};Wi=class Wi extends ft{constructor(e=null,t=1,n=1,i,s,r,a,o,l=1003,c=1003,h,u){super(null,r,a,o,l,c,i,s,h,u);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Gh=new Fe,fm=new Fe;li=class li extends pt{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};os=new Fe,Wh=new Fe,Vr=[],Vh=new qt,pm=new Fe,Gs=new yt,Ws=new sn;xa=class xa extends yt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new li(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,pm)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new qt;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,os),Vh.copy(e.boundingBox).applyMatrix4(os),this.boundingBox.union(Vh)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new sn;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,os),Ws.copy(e.boundingSphere).applyMatrix4(os),this.boundingSphere.union(Ws)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),this.morphTexture=e.morphTexture!==null?e.morphTexture.clone():null,this.instanceColor=e.instanceColor!==null?e.instanceColor.clone():null,this.count=e.count,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,r=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[r+a]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Gs.geometry=this.geometry,Gs.material=this.material,Gs.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Ws.copy(this.boundingSphere),Ws.applyMatrix4(n),e.ray.intersectsSphere(Ws)===!1)return;for(let s=0;s<i;s++){this.getMatrixAt(s,os),Wh.multiplyMatrices(n,os),Gs.matrixWorld=Wh,Gs.raycast(e,Vr);for(let r=0,a=Vr.length;r<a;r++){let o=Vr[r];o.instanceId=s,o.object=this,t.push(o)}Vr.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new li(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new Wi(new Float32Array(i*this.count),i,this.count,1028,1015);let s=this.morphTexture.source.data.data,r=0;for(let l=0;l<n.length;l++)r+=n[l];let a=this.geometry.morphTargetsRelative?1:1-r,o=i*e;return s[o]=a,s.set(n,o+1),this}updateMorphTargets(){}dispose(){if(super.dispose(),this.instanceMatrix.dispose(),this.instanceColor!==null)this.instanceColor.dispose();if(this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}};Ni=new sn,mm=new ke(0.5,0.5),Xr=new D;Xh=new Fe;or=class or extends rn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ee(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};jr=new D,Qr=new D,$h=new Fe,Vs=new Gi,$r=new sn,Do=new D,qh=new D;bs=class bs extends ot{constructor(e=new Yt,t=new or){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)jr.fromBufferAttribute(t,i-1),Qr.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=jr.distanceTo(Qr);e.setAttribute("lineDistance",new Vt(n,1))}else Te("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,r=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if($r.copy(n.boundingSphere),$r.applyMatrix4(i),$r.radius+=s,e.ray.intersectsSphere($r)===!1)return;$h.copy(i).invert(),Vs.copy(e.ray).applyMatrix4($h);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=n.index,u=n.attributes.position;if(c!==null){let d=Math.max(0,r.start),f=Math.min(c.count,r.start+r.count);for(let _=d,y=f-1;_<y;_+=l){let p=c.getX(_),m=c.getX(_+1),M=qr(this,e,Vs,o,p,m,_);if(M)t.push(M)}if(this.isLineLoop){let _=c.getX(f-1),y=c.getX(d),p=qr(this,e,Vs,o,_,y,f-1);if(p)t.push(p)}}else{let d=Math.max(0,r.start),f=Math.min(u.count,r.start+r.count);for(let _=d,y=f-1;_<y;_+=l){let p=qr(this,e,Vs,o,_,_+1,_);if(p)t.push(p)}if(this.isLineLoop){let _=qr(this,e,Vs,o,f-1,d,f-1);if(_)t.push(_)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};Yh=new D,Zh=new D;ya=class ya extends bs{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Yh.fromBufferAttribute(t,i),Zh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Yh.distanceTo(Zh);e.setAttribute("lineDistance",new Vt(n,1))}else Te("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};Sa=class Sa extends bs{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}};lr=class lr extends rn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ee(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Kh=new Fe,Oo=new Gi,Yr=new sn,Zr=new D;ba=class ba extends ot{constructor(e=new Yt,t=new lr){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,r=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Yr.copy(n.boundingSphere),Yr.applyMatrix4(i),Yr.radius+=s,e.ray.intersectsSphere(Yr)===!1)return;Kh.copy(i).invert(),Oo.copy(e.ray).applyMatrix4(Kh);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=n.index,h=n.attributes.position;if(l!==null){let u=Math.max(0,r.start),d=Math.min(l.count,r.start+r.count);for(let f=u,_=d;f<_;f++){let y=l.getX(f);Zr.fromBufferAttribute(h,y),Jh(Zr,y,o,i,e,t,this)}}else{let u=Math.max(0,r.start),d=Math.min(h.count,r.start+r.count);for(let f=u,_=d;f<_;f++)Zr.fromBufferAttribute(h,f),Jh(Zr,f,o,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};Ma=class Ma extends ft{constructor(e=[],t=301,n,i,s,r,a,o,l,c){super(e,t,n,i,s,r,a,o,l,c);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};Ms=class Ms extends ft{constructor(e,t,n,i,s,r,a,o,l){super(e,t,n,i,s,r,a,o,l);this.isCanvasTexture=!0,this.needsUpdate=!0}};pi=class pi extends ft{constructor(e,t,n=1014,i,s,r,a=1003,o=1003,l,c=1026,h=1){if(c!==1026&&c!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:h};super(u,i,s,r,a,o,c,n,l);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new tr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}};wa=class wa extends pi{constructor(e,t=1014,n=301,i,s,r=1003,a=1003,o,l=1026){let c={width:e,height:e,depth:1},h=[c,c,c,c,c,c];super(e,e,t,n,i,s,r,a,o,l);this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}};Ta=class Ta extends ft{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}};ws=class ws extends Yt{constructor(e=1,t=1,n=1,i=1,s=1,r=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:r};let a=this;i=Math.floor(i),s=Math.floor(s),r=Math.floor(r);let o=[],l=[],c=[],h=[],u=0,d=0;f("z","y","x",-1,-1,n,t,e,r,s,0),f("z","y","x",1,-1,n,t,-e,r,s,1),f("x","z","y",1,1,e,n,t,i,r,2),f("x","z","y",1,-1,e,n,-t,i,r,3),f("x","y","z",1,-1,e,t,n,i,s,4),f("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(o),this.setAttribute("position",new Vt(l,3)),this.setAttribute("normal",new Vt(c,3)),this.setAttribute("uv",new Vt(h,2));function f(_,y,p,m,M,T,b,E,A,g,S){let P=T/A,z=b/g,N=T/2,H=b/2,Q=E/2,C=A+1,Y=g+1,K=0,B=0,ae=new D;for(let V=0;V<Y;V++){let j=V*z-H;for(let ie=0;ie<C;ie++){let be=ie*P-N;ae[_]=be*m,ae[y]=j*M,ae[p]=Q,l.push(ae.x,ae.y,ae.z),ae[_]=0,ae[y]=0,ae[p]=E>0?1:-1,c.push(ae.x,ae.y,ae.z),h.push(ie/A),h.push(1-V/g),K+=1}}for(let V=0;V<g;V++)for(let j=0;j<A;j++){let ie=u+j+C*V,be=u+j+C*(V+1),Z=u+(j+1)+C*(V+1),ne=u+(j+1)+C*V;o.push(ie,be,ne),o.push(be,Z,ne),B+=6}a.addGroup(d,B,S),d+=B,u+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ws(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};cr=class cr extends Yt{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let s=e/2,r=t/2,a=Math.floor(n),o=Math.floor(i),l=a+1,c=o+1,h=e/a,u=t/o,d=[],f=[],_=[],y=[];for(let p=0;p<c;p++){let m=p*u-r;for(let M=0;M<l;M++){let T=M*h-s;f.push(T,-m,0),_.push(0,0,1),y.push(M/a),y.push(1-p/o)}}for(let p=0;p<o;p++)for(let m=0;m<a;m++){let M=m+l*p,T=m+l*(p+1),b=m+1+l*(p+1),E=m+1+l*p;d.push(M,T,E),d.push(T,b,E)}this.setIndex(d),this.setAttribute("position",new Vt(f,3)),this.setAttribute("normal",new Vt(_,3)),this.setAttribute("uv",new Vt(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cr(e.width,e.height,e.widthSegments,e.heightSegments)}};od={clone:Vi,merge:Ut};Kn=class Kn extends rn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_m,this.fragmentShader=xm,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vi(e.uniforms),this.uniformsGroups=gm(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let r=this.uniforms[i].value;if(r&&r.isTexture)t.uniforms[i]={type:"t",value:r.toJSON(e).uuid};else if(r&&r.isColor)t.uniforms[i]={type:"c",value:r.getHex()};else if(r&&r.isVector2)t.uniforms[i]={type:"v2",value:r.toArray()};else if(r&&r.isVector3)t.uniforms[i]={type:"v3",value:r.toArray()};else if(r&&r.isVector4)t.uniforms[i]={type:"v4",value:r.toArray()};else if(r&&r.isMatrix3)t.uniforms[i]={type:"m3",value:r.toArray()};else if(r&&r.isMatrix4)t.uniforms[i]={type:"m4",value:r.toArray()};else t.uniforms[i]={value:r}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Ee().setHex(i.value);break;case"v2":this.uniforms[n].value=new ke().fromArray(i.value);break;case"v3":this.uniforms[n].value=new D().fromArray(i.value);break;case"v4":this.uniforms[n].value=new tt().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Ne().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Fe().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}};Zl=class Zl extends Kn{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};Pn=class Pn extends rn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ee(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ee(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new ke(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 $n,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Ft=class Ft extends Pn{constructor(e){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 ke(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ve(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new Ee(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 Ee(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ee(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(e){if(this._diffuseRoughness>0!==e>0)this.version++;this._diffuseRoughness=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){if(this._retroreflectivity>0!==e>0)this.version++;this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}get iridescenceThicknessRange(){return Di('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(e){Di('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),this.iridescenceThicknessMinimum=e[0],this.iridescenceThicknessMaximum=e[1]}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.diffuseRoughness=e.diffuseRoughness,this.diffuseRoughnessMap=e.diffuseRoughnessMap,this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Kl=class Kl extends rn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};Jl=class Jl extends rn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};jl=class jl extends Jn{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,r=e+1,a=i[s],o=i[r];if(a===void 0)switch(this.getSettings_().endingStart){case 2401:s=e,a=2*t-n;break;case 2402:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(o===void 0)switch(this.getSettings_().endingEnd){case 2401:r=e,o=2*n-t;break;case 2402:r=1,o=n+i[1]-i[0];break;default:r=e-1,o=t}let l=(n-t)*0.5,c=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(o-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,f=(n-t)/(i-t),_=f*f,y=_*f,p=-u*y+2*u*_-u*f,m=(1+u)*y+(-1.5-2*u)*_+(-0.5+u)*f+1,M=(-1-d)*y+(1.5+d)*_+0.5*f,T=d*y-d*_;for(let b=0;b!==a;++b)s[b]=p*r[c+b]+m*r[l+b]+M*r[o+b]+T*r[h+b];return s}};Ql=class Ql extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=(n-t)/(i-t),h=1-c;for(let u=0;u!==a;++u)s[u]=r[l+u]*h+r[o+u]*c;return s}};ec=class ec extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}};tc=class tc extends Jn{interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=this.inTangents,h=this.outTangents;if(!c||!h){let f=(n-t)/(i-t),_=1-f;for(let y=0;y!==a;++y)s[y]=r[l+y]*_+r[o+y]*f;return s}let u=a*2,d=e-1;for(let f=0;f!==a;++f){let _=r[l+f],y=r[o+f],p=d*u+f*2,m=h[p],M=h[p+1],T=e*u+f*2,b=c[T],E=c[T+1],A=bm(n,t,m,b,i);s[f]=ld(A,_,M,E,y)}return s}};an.prototype.ValueTypeName="";an.prototype.TimeBufferType=Float32Array;an.prototype.ValueBufferType=Float32Array;an.prototype.DefaultInterpolation=2301;mi=class mi extends an{constructor(e,t,n){super(e,t,n)}};mi.prototype.ValueTypeName="bool";mi.prototype.ValueBufferType=Array;mi.prototype.DefaultInterpolation=2300;mi.prototype.InterpolantFactoryMethodLinear=void 0;mi.prototype.InterpolantFactoryMethodSmooth=void 0;Ea=class Ea extends an{constructor(e,t,n,i){super(e,t,n,i)}};Ea.prototype.ValueTypeName="color";gi=class gi extends an{constructor(e,t,n,i){super(e,t,n,i)}};gi.prototype.ValueTypeName="number";nc=class nc extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t),l=e*a;for(let c=l+a;l!==c;l+=4)cn.slerpFlat(s,0,r,l-a,r,l,o);return s}};_i=class _i extends an{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new nc(this.times,this.values,this.getValueSize(),e)}};_i.prototype.ValueTypeName="quaternion";_i.prototype.InterpolantFactoryMethodSmooth=void 0;xi=class xi extends an{constructor(e,t,n){super(e,t,n)}};xi.prototype.ValueTypeName="string";xi.prototype.ValueBufferType=Array;xi.prototype.DefaultInterpolation=2300;xi.prototype.InterpolantFactoryMethodLinear=void 0;xi.prototype.InterpolantFactoryMethodSmooth=void 0;Xi=class Xi extends an{constructor(e,t,n,i){super(e,t,n,i)}};Xi.prototype.ValueTypeName="vector";An={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(nu(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(nu(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};cd=new ic;jn.DEFAULT_MATERIAL_NAME="__DEFAULT";Vn={};hd=class hd extends Error{constructor(e,t){super(e);this.response=t}};hr=class hr extends jn{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=An.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(s);this.manager.itemEnd(e)},0);return}if(Vn[e]!==void 0){Vn[e].push({onLoad:t,onProgress:n,onError:i});return}Vn[e]=[],Vn[e].push({onLoad:t,onProgress:n,onError:i});let r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(r).then((l)=>{if(l.status===200||l.status===0){if(l.status===0)Te("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let c=Vn[e],h=l.body.getReader(),u=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=u?parseInt(u):0,f=d!==0,_=0,y=new ReadableStream({start(p){m();function m(){h.read().then(({done:M,value:T})=>{if(M)p.close();else{_+=T.byteLength;let b=new ProgressEvent("progress",{lengthComputable:f,loaded:_,total:d});for(let E=0,A=c.length;E<A;E++){let g=c[E];if(g.onProgress)g.onProgress(b)}p.enqueue(T),m()}},(M)=>{p.error(M)})}}});return new Response(y)}else throw new hd(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then((l)=>{switch(o){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then((c)=>new DOMParser().parseFromString(c,a));case"json":return l.json();default:if(a==="")return l.text();else{let h=/charset="?([^;"\s]*)"?/i.exec(a),u=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(u);return l.arrayBuffer().then((f)=>d.decode(f))}}}).then((l)=>{An.add(`file:${e}`,l);let c=Vn[e];delete Vn[e];for(let h=0,u=c.length;h<u;h++){let d=c[h];if(d.onLoad)d.onLoad(l)}}).catch((l)=>{let c=Vn[e];if(c===void 0)throw this.manager.itemError(e),l;delete Vn[e];for(let h=0,u=c.length;h<u;h++){let d=c[h];if(d.onError)d.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};ls=new WeakMap;sc=class sc extends jn{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=this,r=An.get(`image:${e}`);if(r!==void 0){if(r.complete===!0)s.manager.itemStart(e),setTimeout(function(){if(t)t(r);s.manager.itemEnd(e)},0);else{let h=ls.get(r);if(h===void 0)h=[],ls.set(r,h);h.push({onLoad:t,onError:i})}return r}let a=ds("img");function o(){if(c(),t)t(this);let h=ls.get(this)||[];for(let u=0;u<h.length;u++){let d=h[u];if(d.onLoad)d.onLoad(this)}ls.delete(this),s.manager.itemEnd(e)}function l(h){if(c(),i)i(h);An.remove(`image:${e}`);let u=ls.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];if(f.onError)f.onError(h)}ls.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}if(a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)a.crossOrigin=this.crossOrigin}return An.add(`image:${e}`,a),s.manager.itemStart(e),a.fetchPriority=this.priority,a.src=e,a}};Ra=class Ra extends jn{constructor(e){super(e)}load(e,t,n,i){let s=new ft,r=new sc(this.manager);return r.setPriority(this.priority),r.setCache(this.cache),r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(e,function(a){if(s.image=a,s.needsUpdate=!0,t!==void 0)t(s)},n,i),s}};Ts=class Ts extends ot{static registerNode(e){this.prototype._lightNode=e}constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Ee(e),this.intensity=t}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};Ca=class Ca extends Ts{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ee(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}};Uo=new Fe,iu=new D,su=new D;Kr=new D,Jr=new cn,wn=new D;Ia=class Ia extends ot{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(Kr,Jr,wn),wn.x===1&&wn.y===1&&wn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Kr,Jr,wn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Kr,Jr,wn),wn.x===1&&wn.y===1&&wn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Kr,Jr,wn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};ai=new D,ru=new ke,au=new ke;Dt=class Dt extends Ia{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=Ui*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan($s*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return Ui*2*Math.atan(Math.tan($s*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ai.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(ai.x,ai.y).multiplyScalar(-e/ai.z),ai.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(ai.x,ai.y).multiplyScalar(-e/ai.z)}getViewSize(e,t){return this.getViewBounds(e,ru,au),t.subVectors(au,ru)}setViewOffset(e,t,n,i,s,r){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan($s*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-0.5*i,r=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:o,fullHeight:l}=r;s+=r.offsetX*i/o,t-=r.offsetY*n/l,i*=r.width/o,n*=r.height/l}let a=this.filmOffset;if(a!==0)s+=e*a/this.getFilmWidth();this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};ud=class ud extends ur{constructor(){super(new Dt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ui*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;if(n!==t.fov||i!==t.aspect||s!==t.far)t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this.aspect=e.aspect,this}toJSON(){let e=super.toJSON();return e.focus=this.focus,e.aspect=this.aspect,e}};Pa=class Pa extends Ts{constructor(e,t,n=0,i=Math.PI/3,s=0,r=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new ud}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}};dd=class dd extends ur{constructor(){super(new Dt(90,1,0.5,500));this.isPointLightShadow=!0}};La=class La extends Ts{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new dd}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}};vi=class vi extends Ia{constructor(e=-1,t=1,n=1,i=-1,s=0.1,r=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,s=n-e,r=n+e,a=i+t,o=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,r=s+l*this.view.width,a-=c*this.view.offsetY,o=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,r,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}};fd=class fd extends ur{constructor(){super(new vi(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}};$i=class $i extends Ts{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.shadow=new fd}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}};Fo=new WeakMap;Na=class Na extends jn{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Te("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Te("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=this,r=An.get(`image-bitmap:${e}`);if(r!==void 0){if(s.manager.itemStart(e),r.then){r.then((l)=>{if(Fo.has(r)===!0){if(i)i(Fo.get(r));s.manager.itemError(e),s.manager.itemEnd(e)}else{if(t)t(l);s.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(r);s.manager.itemEnd(e)},0);return}let a={};a.credentials=this.withCredentials||this.crossOrigin!=="anonymous"?"include":"same-origin",a.headers=this.requestHeader,a.priority=this.priority,a.cache=this.cache,a.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign({},s.options,{colorSpaceConversion:"none"}))}).then(function(l){if(An.add(`image-bitmap:${e}`,l),t)t(l);return s.manager.itemEnd(e),l}).catch(function(l){if(i)i(l);Fo.set(o,l),An.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});An.add(`image-bitmap:${e}`,o),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};dr=class dr extends ot{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Dt(cs,hs,e,t);i.layers=this.layers,this.add(i);let s=new Dt(cs,hs,e,t);s.layers=this.layers,this.add(s);let r=new Dt(cs,hs,e,t);r.layers=this.layers,this.add(r);let a=new Dt(cs,hs,e,t);a.layers=this.layers,this.add(a);let o=new Dt(cs,hs,e,t);o.layers=this.layers,this.add(o);let l=new Dt(cs,hs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,s,r,a,o]=t;for(let l of t)this.remove(l);if(e===2000)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),r.up.set(0,0,1),r.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(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),r.up.set(0,0,-1),r.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: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[s,r,a,o,l,c]=this.children,h=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;let _=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let y=!1;if(e.isWebGLRenderer===!0)y=e.state.buffers.depth.getReversed();else y=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,1,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,2,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,3,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,4,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,l),n.texture.mipmapsAutoUpdate=_,e.setRenderTarget(n,5,i),y&&e.autoClear===!1)e.clearDepth();e.render(t,c),e.setRenderTarget(h,u,d),e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}};rc=class rc extends Dt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e,this.perCameraFrustumCulled=!1}};Tm=new RegExp("["+ac+"]","g"),oc="[^"+ac+"]",Em="[^"+ac.replace("\\.","")+"]",Am=/((?:WC+[\/:])*)/.source.replace("WC",oc),Rm=/(WCOD+)?/.source.replace("WCOD",Em),Cm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oc),Im=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oc),Pm=new RegExp("^"+Am+Rm+Cm+Im+"$"),Lm=["material","materials","bones","map"];Je.Composite=pd;Je.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Je.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Je.prototype.GetterByBindingType=[Je.prototype._getValue_direct,Je.prototype._getValue_array,Je.prototype._getValue_arrayElement,Je.prototype._getValue_toArray];Je.prototype.SetterByBindingTypeAndVersioning=[[Je.prototype._setValue_direct,Je.prototype._setValue_direct_setNeedsUpdate,Je.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_array,Je.prototype._setValue_array_setNeedsUpdate,Je.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_arrayElement,Je.prototype._setValue_arrayElement_setNeedsUpdate,Je.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_fromArray,Je.prototype._setValue_fromArray_setNeedsUpdate,Je.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];fy=new Float32Array(1),ou=new Fe;md=class md{static{this.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}};if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"187"}}));if(typeof window<"u")if(window.__THREE__)Te("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="187"});function Od(){let e=null,t=!1,n=null,i=null;function s(r,a){i=e.requestAnimationFrame(s),n(r,a)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(s),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(r){n=r},setContext:function(r){e=r}}}function Dm(e){let t=new WeakMap;function n(o,l){let{array:c,usage:h}=o,u=c.byteLength,d=e.createBuffer();e.bindBuffer(l,d),e.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=e.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=e.HALF_FLOAT;else if(c instanceof Uint16Array)if(o.isFloat16BufferAttribute)f=e.HALF_FLOAT;else f=e.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=e.SHORT;else if(c instanceof Uint32Array)f=e.UNSIGNED_INT;else if(c instanceof Int32Array)f=e.INT;else if(c instanceof Int8Array)f=e.BYTE;else if(c instanceof Uint8Array)f=e.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function i(o,l,c){let{array:h,updateRanges:u}=l;if(e.bindBuffer(c,o),u.length===0)e.bufferSubData(c,0,h);else{u.sort((f,_)=>f.start-_.start);let d=0;for(let f=1;f<u.length;f++){let _=u[d],y=u[f];if(y.start<=_.start+_.count+1)_.count=Math.max(_.count,y.start+y.count-_.start);else++d,u[d]=y}u.length=d+1;for(let f=0,_=u.length;f<_;f++){let y=u[f];e.bufferSubData(c,y.start*h.BYTES_PER_ELEMENT,h,y.start,y.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(o){if(o.isInterleavedBufferAttribute)o=o.data;return t.get(o)}function r(o){if(o.isInterleavedBufferAttribute)o=o.data;let l=t.get(o);if(l)e.deleteBuffer(l.buffer),t.delete(o)}function a(o,l){if(o.isInterleavedBufferAttribute)o=o.data;if(o.isGLBufferAttribute){let h=t.get(o);if(!h||h.version<o.version)t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let c=t.get(o);if(c===void 0)t.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:s,remove:r,update:a}}function m0(e,t,n,i,s,r){let a=new Ee(0),o=s===!0?0:1,l,c,h=null,u=0,d=null;function f(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){let b=M.backgroundBlurriness>0;T=t.get(T,b)}return T}function _(M){let T=!1,b=f(M);if(b===null)p(a,o);else if(b&&b.isColor)p(b,1),T=!0;let E=e.xr.getEnvironmentBlendMode();if(E==="additive")n.buffers.color.setClear(0,0,0,1,r);else if(E==="alpha-blend")n.buffers.color.setClear(0,0,0,0,r);if(e.autoClear||T)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function y(M,T){let b=f(T);if(b&&b.isCubeTexture){if(c===void 0)c=new yt(new ws(1,1,1),new Kn({name:"BackgroundCubeMaterial",uniforms:Vi(Nn.backgroundCube.uniforms),vertexShader:Nn.backgroundCube.vertexShader,fragmentShader:Nn.backgroundCube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(E,A,g){this.matrixWorld.copyPosition(g.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c);if(c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(p0.makeRotationFromEuler(T.backgroundRotation)).transpose(),b.isRenderTargetTexture===!1)c.material.uniforms.backgroundRotation.value.premultiply(Bd);if(c.material.toneMapped=He.getTransfer(b.colorSpace)!==st,h!==b||u!==b.version||d!==e.toneMapping)c.material.needsUpdate=!0,h=b,u=b.version,d=e.toneMapping;c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null)}else if(b&&b.isTexture){if(l===void 0)l=new yt(new cr(2,2),new Kn({name:"BackgroundMaterial",uniforms:Vi(Nn.background.uniforms),vertexShader:Nn.background.vertexShader,fragmentShader:Nn.background.fragmentShader,side:ci,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l);if(l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.toneMapped=He.getTransfer(b.colorSpace)!==st,b.matrixAutoUpdate===!0)b.updateMatrix();if(l.material.uniforms.uvTransform.value.copy(b.matrix),h!==b||u!==b.version||d!==e.toneMapping)l.material.needsUpdate=!0,h=b,u=b.version,d=e.toneMapping;l.layers.enableAll(),M.unshift(l,l.geometry,l.material,0,0,null)}}function p(M,T){M.getRGB(Ua,Yl(e)),n.buffers.color.setClear(Ua.r,Ua.g,Ua.b,T,r)}function m(){if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0;if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0}return{getClearColor:function(){return a},setClearColor:function(M,T=1){a.set(M),o=T,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(M){o=M,p(a,o)},render:_,addToRenderList:y,dispose:m}}function g0(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},s=d(null),r=s,a=!1;function o(N,H,Q,C,Y){let K=!1,B=u(N,C,Q,H);if(r!==B)r=B,c(r.object);if(K=f(N,C,Q,Y),K)_(N,C,Q,Y);if(Y!==null)t.update(Y,e.ELEMENT_ARRAY_BUFFER);if(K||a){if(a=!1,b(N,H,Q,C),Y!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer)}}function l(){return e.createVertexArray()}function c(N){return e.bindVertexArray(N)}function h(N){return e.deleteVertexArray(N)}function u(N,H,Q,C){let Y=C.wireframe===!0,K=i[H.id];if(K===void 0)K={},i[H.id]=K;let B=N.isInstancedMesh===!0?N.id:0,ae=K[B];if(ae===void 0)ae={},K[B]=ae;let V=ae[Q.id];if(V===void 0)V={},ae[Q.id]=V;let j=V[Y];if(j===void 0)j=d(l()),V[Y]=j;return j}function d(N){let H=[],Q=[],C=[];for(let Y=0;Y<n;Y++)H[Y]=0,Q[Y]=0,C[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:Q,attributeDivisors:C,object:N,attributes:{},index:null}}function f(N,H,Q,C){let Y=r.attributes,K=H.attributes,B=0,ae=Q.getAttributes();for(let V in ae)if(ae[V].location>=0){let ie=Y[V],be=K[V];if(be===void 0){if(V==="instanceMatrix"&&N.instanceMatrix)be=N.instanceMatrix;if(V==="instanceColor"&&N.instanceColor)be=N.instanceColor}if(ie===void 0)return!0;if(ie.attribute!==be)return!0;if(be&&ie.data!==be.data)return!0;B++}if(r.attributesNum!==B)return!0;if(r.index!==C)return!0;return!1}function _(N,H,Q,C){let Y={},K=H.attributes,B=0,ae=Q.getAttributes();for(let V in ae)if(ae[V].location>=0){let ie=K[V];if(ie===void 0){if(V==="instanceMatrix"&&N.instanceMatrix)ie=N.instanceMatrix;if(V==="instanceColor"&&N.instanceColor)ie=N.instanceColor}let be={};if(be.attribute=ie,ie&&ie.data)be.data=ie.data;Y[V]=be,B++}r.attributes=Y,r.attributesNum=B,r.index=C}function y(){let N=r.newAttributes;for(let H=0,Q=N.length;H<Q;H++)N[H]=0}function p(N){m(N,0)}function m(N,H){let Q=r.newAttributes,C=r.enabledAttributes,Y=r.attributeDivisors;if(Q[N]=1,C[N]===0)e.enableVertexAttribArray(N),C[N]=1;if(Y[N]!==H)e.vertexAttribDivisor(N,H),Y[N]=H}function M(){let N=r.newAttributes,H=r.enabledAttributes;for(let Q=0,C=H.length;Q<C;Q++)if(H[Q]!==N[Q])e.disableVertexAttribArray(Q),H[Q]=0}function T(N,H,Q,C,Y,K,B){if(B===!0)e.vertexAttribIPointer(N,H,Q,Y,K);else e.vertexAttribPointer(N,H,Q,C,Y,K)}function b(N,H,Q,C){y();let Y=C.attributes,K=Q.getAttributes(),B=H.defaultAttributeValues;for(let ae in K){let V=K[ae];if(V.location>=0){let j=Y[ae];if(j===void 0){if(ae==="instanceMatrix"&&N.instanceMatrix)j=N.instanceMatrix;if(ae==="instanceColor"&&N.instanceColor)j=N.instanceColor}if(j!==void 0){let ie=j.normalized,be=j.itemSize,Z=t.get(j);if(Z===void 0)continue;let{buffer:ne,type:ye,bytesPerElement:Ce}=Z,Ie=ye===e.INT||ye===e.UNSIGNED_INT||j.gpuType===Ko;if(j.isInterleavedBufferAttribute){let Se=j.data,je=Se.isInterleavedBuffer===!0?Se.stride:Se.itemSize,We=j.offset;if(Se.isInstancedInterleavedBuffer||Se.isInstancedBufferAttribute){for(let Oe=0;Oe<V.locationSize;Oe++)m(V.location+Oe,Se.meshPerAttribute);if(N.isInstancedMesh!==!0&&C._maxInstanceCount===void 0)C._maxInstanceCount=Se.meshPerAttribute*Se.count}else for(let Oe=0;Oe<V.locationSize;Oe++)p(V.location+Oe);e.bindBuffer(e.ARRAY_BUFFER,ne);for(let Oe=0;Oe<V.locationSize;Oe++)T(V.location+Oe,be/V.locationSize,ye,ie,je*Ce,(We+be/V.locationSize*Oe)*Ce,Ie)}else{if(j.isInstancedBufferAttribute){for(let Se=0;Se<V.locationSize;Se++)m(V.location+Se,j.meshPerAttribute);if(N.isInstancedMesh!==!0&&C._maxInstanceCount===void 0)C._maxInstanceCount=j.meshPerAttribute*j.count}else for(let Se=0;Se<V.locationSize;Se++)p(V.location+Se);e.bindBuffer(e.ARRAY_BUFFER,ne);for(let Se=0;Se<V.locationSize;Se++)T(V.location+Se,be/V.locationSize,ye,ie,be*Ce,be/V.locationSize*Se*Ce,Ie)}}else if(B!==void 0){let ie=B[ae];if(ie!==void 0)switch(ie.length){case 2:e.vertexAttrib2fv(V.location,ie);break;case 3:e.vertexAttrib3fv(V.location,ie);break;case 4:e.vertexAttrib4fv(V.location,ie);break;default:e.vertexAttrib1fv(V.location,ie)}}}}M()}function E(){P();for(let N in i){let H=i[N];for(let Q in H){let C=H[Q];for(let Y in C){let K=C[Y];for(let B in K)h(K[B].object),delete K[B];delete C[Y]}}delete i[N]}}function A(N){if(i[N.id]===void 0)return;let H=i[N.id];for(let Q in H){let C=H[Q];for(let Y in C){let K=C[Y];for(let B in K)h(K[B].object),delete K[B];delete C[Y]}}delete i[N.id]}function g(N){for(let H in i){let Q=i[H];for(let C in Q){let Y=Q[C];if(Y[N.id]===void 0)continue;let K=Y[N.id];for(let B in K)h(K[B].object),delete K[B];delete Y[N.id]}}}function S(N){for(let H in i){let Q=i[H],C=N.isInstancedMesh===!0?N.id:0,Y=Q[C];if(Y===void 0)continue;for(let K in Y){let B=Y[K];for(let ae in B)h(B[ae].object),delete B[ae];delete Y[K]}if(delete Q[C],Object.keys(Q).length===0)delete i[H]}}function P(){if(z(),a=!0,r===s)return;r=s,c(r.object)}function z(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:P,resetDefaultState:z,dispose:E,releaseStatesOfGeometry:A,releaseStatesOfObject:S,releaseStatesOfProgram:g,initAttributes:y,enableAttribute:p,disableUnusedAttributes:M}}function _0(e,t,n){let i;function s(l){i=l}function r(l,c){e.drawArrays(i,l,c),n.update(c,i,1)}function a(l,c,h){if(h===0)return;e.drawArraysInstanced(i,l,c,h),n.update(c,i,h)}function o(l,c,h){if(h===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,h);let d=0;for(let f=0;f<h;f++)d+=c[f];n.update(d,i,1)}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function x0(e,t,n,i){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let g=t.get("EXT_texture_filter_anisotropic");s=e.getParameter(g.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(g){if(g!==bn&&i.convert(g)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function o(g){let S=g===Cn&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(g!==Sn&&g!==qn&&!S&&i.convert(g)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE))return!1;return!0}function l(g){if(g==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";g="mediump"}if(g==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let c=n.precision!==void 0?n.precision:"highp",h=l(c);if(h!==c)Te("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h;let u=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),d=n.logarithmicDepthBuffer===!0&&u===!1;if(n.reversedDepthBuffer===!0&&u===!1)Te("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");if(n.logarithmicDepthBuffer===!0&&u===!0)Te("WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.");let f=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),_=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),M=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),T=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),E=e.getParameter(e.MAX_SAMPLES),A=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:_,maxTextureSize:y,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:b,maxSamples:E,samples:A}}function v0(e){let t=this,n=null,i=0,s=!1,r=!1,a=new Tn,o=new Ne,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||i!==0||s;return s=d,i=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){n=h(u,d,0)},this.setState=function(u,d,f){let{clippingPlanes:_,clipIntersection:y,clipShadows:p}=u,m=e.get(u);if(!s||_===null||_.length===0||r&&!p)if(r)h(null);else c();else{let M=r?0:i,T=M*4,b=m.clippingState||null;l.value=b,b=h(_,d,T,f);for(let E=0;E!==T;++E)b[E]=n[E];m.clippingState=b,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=M}};function c(){if(l.value!==n)l.value=n,l.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function h(u,d,f,_){let y=u!==null?u.length:0,p=null;if(y!==0){if(p=l.value,_!==!0||p===null){let m=f+y*4,M=d.matrixWorldInverse;if(o.getNormalMatrix(M),p===null||p.length<m)p=new Float32Array(m);for(let T=0,b=f;T!==y;++T,b+=4)a.copy(u[T]).applyMatrix4(M,o),a.normal.toArray(p,b),p[b+3]=a.constant}l.value=p,l.needsUpdate=!0}return t.numPlanes=y,t.numIntersection=0,p}}class Oa{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new dr(1,10,null),this._boxMesh=new yt(new ws(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=0.1,i=100,s={}){let{size:r=256,position:a=M0}=s,o=this._renderer;this._setSize(r);let l=this._allocateTarget(),c=this._getSourceTarget(!0);if(t>0)c.texture.mipmapsAutoUpdate=!1;let{autoClear:h,autoClearColor:u,autoClearDepth:d,autoClearStencil:f}=o,_=e.background;if(o.autoClear=!0,o.autoClearColor=!0,o.autoClearDepth=!0,o.autoClearStencil=!0,_===null)e.background=o.getClearColor(w0);let y=new dr(n,i,c);if(y.position.copy(a),y.update(o,e),o.autoClear=h,o.autoClearColor=u,o.autoClearDepth=d,o.autoClearStencil=f,e.background=_,t>0)c.texture.mipmapsAutoUpdate=!0,this._blur(l,t);return this._applyPMREM(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=vd(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=xd(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._sourceTarget!==null)this._sourceTarget.dispose();if(this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._integrationMaterial!==null)this._integrationMaterial.dispose();this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max(gd,Gl(e))}_fromTexture(e,t){if(e.mapping===js||e.mapping===gs)this._setSize(e.image.length===0?gd:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=_d(e,!1,!1),n=Math.log2(e)-y0;for(let i=0;i<=n;i++)t.texture.mipmaps.push({width:e>>i,height:e>>i});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;if(n===null||n.width!==t||e&&n.depthBuffer===!1){if(n!==null)n.dispose();this._sourceTarget=_d(t,!0,e)}return this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let i=this._boxMesh,s=this._cubeCamera;i.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let r=e.width>>t;e.viewport.set(0,0,r,r),s.update(this._renderer,i),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;if(e.mapping===js||e.mapping===gs){if(this._cubemapMaterial===null)this._cubemapMaterial=vd();t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else{if(this._equirectMaterial===null)this._equirectMaterial=xd();t=this._equirectMaterial}t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){if(this._ggxMaterial===null)this._ggxMaterial=T0(),this._integrationMaterial=E0();let t=this._cubeSize,n=e.texture.mipmaps.length-1,i=this._ggxMaterial.uniforms;i.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/zd);for(let r=0;r<=n;r++){let a=Oa.lodToRoughness(r,n);if(r>n-b0)s.roughness.value=a,this._renderCube(e,r,this._integrationMaterial);else{let o=a>0?Math.log2(t)+0.5*Math.log2(6/(kd*Math.pow(a,4)))+0.5:0;i.roughness.value=a,i.lodBias.value=o,this._renderCube(e,r,this._ggxMaterial)}}}_blur(e,t){if(this._blurMaterial===null)this._blurMaterial=A0();let n=this._blurMaterial,i=n.uniforms,s=this._sourceTarget;i.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,i.envMap.value=s.texture,this._renderCube(e,0,n),i.envMap.value=e.texture,this._renderCube(s,0,n)}}function _d(e,t,n){return new Ba(e,{minFilter:tn,generateMipmaps:t,type:Cn,colorSpace:nn,depthBuffer:n})}function gr(e,t,n){return new Kn({name:e,uniforms:t,vertexShader:ze.cube_vert,fragmentShader:n,side:Xt,blending:Oi,depthTest:!1,depthWrite:!1})}function T0(){return gr("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},`
|
|
5
|
+
}`,Kn,Zl,Pn,Ft,Kl,Jl,jl,Ql,ec,tc,mi,Ea,gi,nc,_i,xi,Xi,An,cd,Vn,hd,ur,ls,sc,Ra,Ts,Ca,Uo,iu,su,Kr,Jr,wn,Ia,ai,ru,au,Dt,ud,Pa,dd,La,vi,fd,$i,Fo,Na,cs=-90,hs=1,fr,rc,ac="\\[\\]\\.:\\/",Tm,oc,Em,Am,Rm,Cm,Im,Pm,Lm,py,ou,md;var cc=On(()=>{Sh={};rd={[0]:0,[2]:6,[4]:4,[3]:5,[1]:1,[6]:2,[7]:7,[5]:3};Lt=["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"],qs=Math.PI/180,Ui=180/Math.PI;fi={DEG2RAD:qs,RAD2DEG:Ui,generateUUID:In,clamp:Ve,euclideanModulo:Hl,mapLinear:Dp,inverseLerp:Up,lerp:Ys,damp:Fp,pingpong:Op,smoothstep:Bp,smootherstep:kp,randInt:zp,randFloat:Hp,randFloatSpread:Gp,seededRandom:Wp,degToRad:Vp,radToDeg:Xp,isPowerOfTwo:$p,ceilPowerOfTwo:qp,floorPowerOfTwo:Gl,setQuaternionFromProperEuler:Yp,normalize:Vl,denormalize:Wl};ke=class ke{static{this.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};cn=class cn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,r,a){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=s[r+0],d=s[r+1],f=s[r+2],_=s[r+3];if(h!==_||o!==u||l!==d||c!==f){let y=o*u+l*d+c*f+h*_;if(y<0)u=-u,d=-d,f=-f,_=-_,y=-y;let p=1-a;if(y<0.9995){let m=Math.acos(y),M=Math.sin(m);p=Math.sin(p*m)/M,a=Math.sin(a*m)/M,o=o*p+u*a,l=l*p+d*a,c=c*p+f*a,h=h*p+_*a}else{o=o*p+u*a,l=l*p+d*a,c=c*p+f*a,h=h*p+_*a;let m=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=m,l*=m,c*=m,h*=m}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,r){let a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=s[r],u=s[r+1],d=s[r+2],f=s[r+3];return e[t]=a*f+c*h+o*d-l*u,e[t+1]=o*f+c*u+l*h-a*d,e[t+2]=l*f+c*d+a*u-o*h,e[t+3]=c*f-a*h-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let{_x:n,_y:i,_z:s,_order:r}=e,{cos:a,sin:o}=Math,l=a(n/2),c=a(i/2),h=a(s/2),u=o(n/2),d=o(i/2),f=o(s/2);switch(r){case"XYZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"YXZ":this._x=u*c*h+l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"ZXY":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h-u*d*f;break;case"ZYX":this._x=u*c*h-l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h+u*d*f;break;case"YZX":this._x=u*c*h+l*d*f,this._y=l*d*h+u*c*f,this._z=l*c*f-u*d*h,this._w=l*c*h-u*d*f;break;case"XZY":this._x=u*c*h-l*d*f,this._y=l*d*h-u*c*f,this._z=l*c*f+u*d*h,this._w=l*c*h+u*d*f;break;default:Te("Quaternion: .setFromEuler() encountered an unknown order: "+r)}if(t===!0)this._onChangeCallback();return this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],a=t[5],o=t[9],l=t[2],c=t[6],h=t[10],u=n+a+h;if(u>0){let d=0.5/Math.sqrt(u+1);this._w=0.25/d,this._x=(c-o)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>a&&n>h){let d=2*Math.sqrt(1+n-a-h);this._w=(c-o)/d,this._x=0.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(a>h){let d=2*Math.sqrt(1+a-n-h);this._w=(s-l)/d,this._x=(i+r)/d,this._y=0.25*d,this._z=(o+c)/d}else{let d=2*Math.sqrt(1+h-n-a);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(o+c)/d,this._z=0.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;if(n<0.00000001)if(n=0,Math.abs(e.x)>Math.abs(e.z))this._x=-e.y,this._y=e.x,this._z=0,this._w=n;else this._x=0,this._y=-e.z,this._z=e.y,this._w=n;else this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n;return this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ve(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();if(e===0)this._x=0,this._y=0,this._z=0,this._w=1;else e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e;return this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let{_x:n,_y:i,_z:s,_w:r}=e,{_x:a,_y:o,_z:l,_w:c}=t;return this._x=n*c+r*a+i*l-s*o,this._y=i*c+r*o+s*a-n*l,this._z=s*c+r*l+n*o-i*a,this._w=r*c-n*a-i*o-s*l,this._onChangeCallback(),this}slerp(e,t){let{_x:n,_y:i,_z:s,_w:r}=e,a=this.dot(e);if(a<0)n=-n,i=-i,s=-s,r=-r,a=-a;let o=1-t;if(a<0.9995){let l=Math.acos(a),c=Math.sin(l);o=Math.sin(o*l)/c,t=Math.sin(t*l)/c,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+r*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+r*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};D=class D{static{this.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){if(n===void 0)n=this.z;return this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Mh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Mh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,{x:s,y:r,z:a,w:o}=e,l=2*(r*i-a*n),c=2*(a*t-s*i),h=2*(s*n-r*t);return this.x=t+o*l+r*h-a*c,this.y=n+o*c+a*l-s*h,this.z=i+o*h+s*c-r*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let{x:n,y:i,z:s}=e,{x:r,y:a,z:o}=t;return this.x=i*o-s*a,this.y=s*r-n*o,this.z=n*a-i*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return fo.copy(this).projectOnVector(e),this.sub(fo)}reflect(e){return this.sub(fo.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ve(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};fo=new D,Mh=new cn;Ne=class Ne{static{this.prototype.isMatrix3=!0}constructor(e,t,n,i,s,r,a,o,l){if(this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0)this.set(e,t,n,i,s,r,a,o,l)}set(e,t,n,i,s,r,a,o,l){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=o,c[6]=n,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],f=n[8],_=i[0],y=i[3],p=i[6],m=i[1],M=i[4],T=i[7],b=i[2],E=i[5],A=i[8];return s[0]=r*_+a*m+o*b,s[3]=r*y+a*M+o*E,s[6]=r*p+a*T+o*A,s[1]=l*_+c*m+h*b,s[4]=l*y+c*M+h*E,s[7]=l*p+c*T+h*A,s[2]=u*_+d*m+f*b,s[5]=u*y+d*M+f*E,s[8]=u*p+d*T+f*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8];return t*r*c-t*a*l-n*s*c+n*a*o+i*s*l-i*r*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8],h=c*r-a*l,u=a*o-c*s,d=l*s-r*o,f=t*h+n*u+i*d;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/f;return e[0]=h*_,e[1]=(i*l-c*n)*_,e[2]=(a*n-i*r)*_,e[3]=u*_,e[4]=(c*t-i*o)*_,e[5]=(i*s-a*t)*_,e[6]=d*_,e[7]=(n*o-l*t)*_,e[8]=(r*t-n*s)*_,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,a){let o=Math.cos(s),l=Math.sin(s);return this.set(n*o,n*l,-n*(o*r+l*a)+r+e,-i*l,i*o,-i*(-l*r+o*a)+a+t,0,0,1),this}scale(e,t){return Di("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(po.makeScale(e,t)),this}rotate(e){return Di("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(po.makeRotation(-e)),this}translate(e,t){return Di("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(po.makeTranslation(e,t)),this}makeTranslation(e,t){if(e.isVector2)this.set(1,0,e.x,0,1,e.y,0,0,1);else this.set(1,0,e,0,1,t,0,0,1);return this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};po=new Ne,wh=new Ne().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),Th=new Ne().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);He=Zp();go=new D;ft=class ft extends Yn{constructor(e=ft.DEFAULT_IMAGE,t=ft.DEFAULT_MAPPING,n=1001,i=1001,s=1006,r=1008,a=1023,o=1009,l=ft.DEFAULT_ANISOTROPY,c=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:Jp++}),this.uuid=In(),this.name="",this.source=new nr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ne,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=e&&e.depth&&e.depth>1?!0:!1,this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(go).x}get height(){return this.source.getSize(go).y}get depth(){return this.source.getSize(go).z}get image(){return this.source.data}set image(e){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Te(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Te(`Texture.setValues(): property '${t}' does not exist.`);continue}if(i&&n&&(i.isVector2&&n.isVector2))i.copy(n);else if(i&&n&&(i.isVector3&&n.isVector3))i.copy(n);else if(i&&n&&(i.isMatrix3&&n.isMatrix3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)n.userData=this.userData;if(!t)e.textures[this.uuid]=n;return n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1000:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.x)%2)===1)e.x=Math.ceil(e.x)-e.x;else e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case 1000:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(e.y)%2)===1)e.y=Math.ceil(e.y)-e.y;else e.y=e.y-Math.floor(e.y);break}if(this.flipY)e.y=1-e.y;return e}set needsUpdate(e){if(e===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(e){if(e===!0)this.pmremVersion++}};ft.DEFAULT_IMAGE=null;ft.DEFAULT_MAPPING=300;ft.DEFAULT_ANISOTROPY=1;tt=class tt{static{this.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=this.w,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*t+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*t+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*t+r[7]*n+r[11]*i+r[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);if(t<0.0001)this.x=1,this.y=0,this.z=0;else this.x=e.x/t,this.y=e.y/t,this.z=e.z/t;return this}setAxisAngleFromRotationMatrix(e){let t,n,i,s,r=0.01,a=0.1,o=e.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],f=o[9],_=o[2],y=o[6],p=o[10];if(Math.abs(c-u)<0.01&&Math.abs(h-_)<0.01&&Math.abs(f-y)<0.01){if(Math.abs(c+u)<0.1&&Math.abs(h+_)<0.1&&Math.abs(f+y)<0.1&&Math.abs(l+d+p-3)<0.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(l+1)/2,T=(d+1)/2,b=(p+1)/2,E=(c+u)/4,A=(h+_)/4,g=(f+y)/4;if(M>T&&M>b)if(M<0.01)n=0,i=0.707106781,s=0.707106781;else n=Math.sqrt(M),i=E/n,s=A/n;else if(T>b)if(T<0.01)n=0.707106781,i=0,s=0.707106781;else i=Math.sqrt(T),n=E/i,s=g/i;else if(b<0.01)n=0.707106781,i=0.707106781,s=0;else s=Math.sqrt(b),n=A/s,i=g/s;return this.set(n,i,s,t),this}let m=Math.sqrt((y-f)*(y-f)+(h-_)*(h-_)+(u-c)*(u-c));if(Math.abs(m)<0.001)m=1;return this.x=(y-f)/m,this.y=(h-_)/m,this.z=(u-c)/m,this.w=Math.acos((l+d+p-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}};$l=class $l extends Yn{constructor(e=1,t=1,n={}){super();n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new tt(0,0,e,t),this.scissorTest=!1,this.viewport=new tt(0,0,e,t),this.textures=[];let i=n.count;for(let s=0;s<i;s++)this.textures[s]=new ft({width:e,height:t,depth:n.depth}),this.textures[s].isRenderTargetTexture=!0,this.textures[s].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(e.mapping!==void 0)t.mapping=e.mapping;if(e.wrapS!==void 0)t.wrapS=e.wrapS;if(e.wrapT!==void 0)t.wrapT=e.wrapT;if(e.wrapR!==void 0)t.wrapR=e.wrapR;if(e.magFilter!==void 0)t.magFilter=e.magFilter;if(e.minFilter!==void 0)t.minFilter=e.minFilter;if(e.format!==void 0)t.format=e.format;if(e.type!==void 0)t.type=e.type;if(e.anisotropy!==void 0)t.anisotropy=e.anisotropy;if(e.colorSpace!==void 0)t.colorSpace=e.colorSpace;if(e.flipY!==void 0)t.flipY=e.flipY;if(e.generateMipmaps!==void 0)t.generateMipmaps=e.generateMipmaps;if(e.mipmapsAutoUpdate!==void 0)t.mipmapsAutoUpdate=e.mipmapsAutoUpdate;if(e.internalFormat!==void 0)t.internalFormat=e.internalFormat;for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){if(this._depthTexture!==null&&this._depthTexture.renderTarget===this)this._depthTexture.renderTarget=null;if(e!==null&&e.renderTarget===null)e.renderTarget=this;this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)if(this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0)this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new nr(i)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture;else this.depthTexture=null;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};hn=class hn extends $l{constructor(e=1,t=1,n={}){super(e,t,n);this.isWebGLRenderTarget=!0}};fa=class fa extends ft{constructor(e=null,t=1,n=1,i=1){super(null);this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};ql=class ql extends ft{constructor(e=null,t=1,n=1,i=1){super(null);this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}};Fe=class Fe{static{this.prototype.isMatrix4=!0}constructor(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0)this.set(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y)}set(e,t,n,i,s,r,a,o,l,c,h,u,d,f,_,y){let p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=r,p[9]=a,p[13]=o,p[2]=l,p[6]=c,p[10]=h,p[14]=u,p[3]=d,p[7]=f,p[11]=_,p[15]=y,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 Fe().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){if(this.determinantAffine()===0)return e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this;return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/ji.setFromMatrixColumn(e,0).length(),s=1/ji.setFromMatrixColumn(e,1).length(),r=1/ji.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,{x:n,y:i,z:s}=e,r=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let u=r*c,d=r*h,f=a*c,_=a*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=d+f*l,t[5]=u-_*l,t[9]=-a*o,t[2]=_-u*l,t[6]=f+d*l,t[10]=r*o}else if(e.order==="YXZ"){let u=o*c,d=o*h,f=l*c,_=l*h;t[0]=u+_*a,t[4]=f*a-d,t[8]=r*l,t[1]=r*h,t[5]=r*c,t[9]=-a,t[2]=d*a-f,t[6]=_+u*a,t[10]=r*o}else if(e.order==="ZXY"){let u=o*c,d=o*h,f=l*c,_=l*h;t[0]=u-_*a,t[4]=-r*h,t[8]=f+d*a,t[1]=d+f*a,t[5]=r*c,t[9]=_-u*a,t[2]=-r*l,t[6]=a,t[10]=r*o}else if(e.order==="ZYX"){let u=r*c,d=r*h,f=a*c,_=a*h;t[0]=o*c,t[4]=f*l-d,t[8]=u*l+_,t[1]=o*h,t[5]=_*l+u,t[9]=d*l-f,t[2]=-l,t[6]=a*o,t[10]=r*o}else if(e.order==="YZX"){let u=r*o,d=r*l,f=a*o,_=a*l;t[0]=o*c,t[4]=_-u*h,t[8]=f*h+d,t[1]=h,t[5]=r*c,t[9]=-a*c,t[2]=-l*c,t[6]=d*h+f,t[10]=u-_*h}else if(e.order==="XZY"){let u=r*o,d=r*l,f=a*o,_=a*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=u*h+_,t[5]=r*c,t[9]=d*h-f,t[2]=f*h-d,t[6]=a*c,t[10]=_*h+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(jp,e,Qp)}lookAt(e,t,n){let i=this.elements;if(Qt.subVectors(e,t),Qt.lengthSq()===0)Qt.z=1;if(Qt.normalize(),ni.crossVectors(n,Qt),ni.lengthSq()===0){if(Math.abs(n.z)===1)Qt.x+=0.0001;else Qt.z+=0.0001;Qt.normalize(),ni.crossVectors(n,Qt)}return ni.normalize(),Ar.crossVectors(Qt,ni),i[0]=ni.x,i[4]=Ar.x,i[8]=Qt.x,i[1]=ni.y,i[5]=Ar.y,i[9]=Qt.y,i[2]=ni.z,i[6]=Ar.z,i[10]=Qt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],f=n[2],_=n[6],y=n[10],p=n[14],m=n[3],M=n[7],T=n[11],b=n[15],E=i[0],A=i[4],g=i[8],S=i[12],P=i[1],z=i[5],N=i[9],H=i[13],Q=i[2],C=i[6],Y=i[10],K=i[14],B=i[3],ae=i[7],V=i[11],j=i[15];return s[0]=r*E+a*P+o*Q+l*B,s[4]=r*A+a*z+o*C+l*ae,s[8]=r*g+a*N+o*Y+l*V,s[12]=r*S+a*H+o*K+l*j,s[1]=c*E+h*P+u*Q+d*B,s[5]=c*A+h*z+u*C+d*ae,s[9]=c*g+h*N+u*Y+d*V,s[13]=c*S+h*H+u*K+d*j,s[2]=f*E+_*P+y*Q+p*B,s[6]=f*A+_*z+y*C+p*ae,s[10]=f*g+_*N+y*Y+p*V,s[14]=f*S+_*H+y*K+p*j,s[3]=m*E+M*P+T*Q+b*B,s[7]=m*A+M*z+T*C+b*ae,s[11]=m*g+M*N+T*Y+b*V,s[15]=m*S+M*H+T*K+b*j,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],a=e[5],o=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14],f=e[3],_=e[7],y=e[11],p=e[15],m=o*d-l*u,M=a*d-l*h,T=a*u-o*h,b=r*d-l*c,E=r*u-o*c,A=r*h-a*c;return t*(_*m-y*M+p*T)-n*(f*m-y*b+p*E)+i*(f*M-_*b+p*A)-s*(f*T-_*E+y*A)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[1],r=e[5],a=e[9],o=e[2],l=e[6],c=e[10];return t*(r*c-a*l)-n*(s*c-a*o)+i*(s*l-r*o)}transpose(){let e=this.elements,t;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(e,t,n){let i=this.elements;if(e.isVector3)i[12]=e.x,i[13]=e.y,i[14]=e.z;else i[12]=e,i[13]=t,i[14]=n;return this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],f=e[12],_=e[13],y=e[14],p=e[15],m=t*a-n*r,M=t*o-i*r,T=t*l-s*r,b=n*o-i*a,E=n*l-s*a,A=i*l-s*o,g=c*_-h*f,S=c*y-u*f,P=c*p-d*f,z=h*y-u*_,N=h*p-d*_,H=u*p-d*y,Q=m*H-M*N+T*z+b*P-E*S+A*g;if(Q===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/Q;return e[0]=(a*H-o*N+l*z)*C,e[1]=(i*N-n*H-s*z)*C,e[2]=(_*A-y*E+p*b)*C,e[3]=(u*E-h*A-d*b)*C,e[4]=(o*P-r*H-l*S)*C,e[5]=(t*H-i*P+s*S)*C,e[6]=(y*T-f*A-p*M)*C,e[7]=(c*A-u*T+d*M)*C,e[8]=(r*N-a*P+l*g)*C,e[9]=(n*P-t*N-s*g)*C,e[10]=(f*E-_*T+p*m)*C,e[11]=(h*T-c*E-d*m)*C,e[12]=(a*S-r*z-o*g)*C,e[13]=(t*z-n*S+i*g)*C,e[14]=(_*M-f*b-y*m)*C,e[15]=(c*b-h*M+u*m)*C,this}scale(e){let t=this.elements,{x:n,y:i,z:s}=e;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){if(e.isVector3)this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1);else this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1);return this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,{x:r,y:a,z:o}=e,l=s*r,c=s*a;return this.set(l*r+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*r,0,l*o-i*a,c*o+i*r,s*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,{_x:s,_y:r,_z:a,_w:o}=t,l=s+s,c=r+r,h=a+a,u=s*l,d=s*c,f=s*h,_=r*c,y=r*h,p=a*h,m=o*l,M=o*c,T=o*h,{x:b,y:E,z:A}=n;return i[0]=(1-(_+p))*b,i[1]=(d+T)*b,i[2]=(f-M)*b,i[3]=0,i[4]=(d-T)*E,i[5]=(1-(u+p))*E,i[6]=(y+m)*E,i[7]=0,i[8]=(f+M)*A,i[9]=(y-m)*A,i[10]=(1-(u+_))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let r=ji.set(i[0],i[1],i[2]).length(),a=ji.set(i[4],i[5],i[6]).length(),o=ji.set(i[8],i[9],i[10]).length();if(s<0)r=-r;_n.copy(this);let l=1/r,c=1/a,h=1/o;return _n.elements[0]*=l,_n.elements[1]*=l,_n.elements[2]*=l,_n.elements[4]*=c,_n.elements[5]*=c,_n.elements[6]*=c,_n.elements[8]*=h,_n.elements[9]*=h,_n.elements[10]*=h,t.setFromRotationMatrix(_n),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,s,r,a=2000,o=!1){let l=this.elements,c=2*s/(t-e),h=2*s/(n-i),u=(t+e)/(t-e),d=(n+i)/(n-i),f,_;if(o)f=s/(r-s),_=r*s/(r-s);else if(a===2000)f=-(r+s)/(r-s),_=-2*r*s/(r-s);else if(a===2001)f=-r/(r-s),_=-r*s/(r-s);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,r,a=2000,o=!1){let l=this.elements,c=2/(t-e),h=2/(n-i),u=-(t+e)/(t-e),d=-(n+i)/(n-i),f,_;if(o)f=1/(r-s),_=r/(r-s);else if(a===2000)f=-2/(r-s),_=-(r+s)/(r-s);else if(a===2001)f=-1/(r-s),_=-s/(r-s);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=h,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=f,l[14]=_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};ji=new D,_n=new Fe,jp=new D(0,0,0),Qp=new D(1,1,1),ni=new D,Ar=new D,Qt=new D,Eh=new Fe,Ah=new cn;$n=class $n{constructor(e=0,t=0,n=0,i=$n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],r=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(t){case"XYZ":if(this._y=Math.asin(Ve(a,-1,1)),Math.abs(a)<0.9999999)this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s);else this._x=Math.atan2(u,l),this._z=0;break;case"YXZ":if(this._x=Math.asin(-Ve(c,-1,1)),Math.abs(c)<0.9999999)this._y=Math.atan2(a,d),this._z=Math.atan2(o,l);else this._y=Math.atan2(-h,s),this._z=0;break;case"ZXY":if(this._x=Math.asin(Ve(u,-1,1)),Math.abs(u)<0.9999999)this._y=Math.atan2(-h,d),this._z=Math.atan2(-r,l);else this._y=0,this._z=Math.atan2(o,s);break;case"ZYX":if(this._y=Math.asin(-Ve(h,-1,1)),Math.abs(h)<0.9999999)this._x=Math.atan2(u,d),this._z=Math.atan2(o,s);else this._x=0,this._z=Math.atan2(-r,l);break;case"YZX":if(this._z=Math.asin(Ve(o,-1,1)),Math.abs(o)<0.9999999)this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,s);else this._x=0,this._y=Math.atan2(a,d);break;case"XZY":if(this._z=Math.asin(-Ve(r,-1,1)),Math.abs(r)<0.9999999)this._x=Math.atan2(u,l),this._y=Math.atan2(a,s);else this._x=Math.atan2(-c,d),this._y=0;break;default:Te("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}if(this._order=t,n===!0)this._onChangeCallback();return this}setFromQuaternion(e,t,n){return Eh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Eh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ah.setFromEuler(this),this.setFromQuaternion(Ah,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){if(this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0)this._order=e[3];return this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};$n.DEFAULT_ORDER="XYZ";Rh=new D,Qi=new cn,kn=new Fe,Rr=new D,Bs=new D,tm=new D,nm=new cn,Ch=new D(1,0,0),Ih=new D(0,1,0),Ph=new D(0,0,1),Lh={type:"added"},im={type:"removed"},es={type:"childadded",child:null},_o={type:"childremoved",child:null};ot=class ot extends Yn{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:em++}),this.uuid=In(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DEFAULT_UP.clone();let e=new D,t=new $n,n=new cn,i=new D(1,1,1);function s(){n.setFromEuler(t,!1)}function r(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Fe},normalMatrix:{value:new Ne}}),this.matrix=new Fe,this.matrixWorld=new Fe,this.matrixAutoUpdate=ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ir,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.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null)this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.multiply(Qi),this}rotateOnWorldAxis(e,t){return Qi.setFromAxisAngle(e,t),this.quaternion.premultiply(Qi),this}rotateX(e){return this.rotateOnAxis(Ch,e)}rotateY(e){return this.rotateOnAxis(Ih,e)}rotateZ(e){return this.rotateOnAxis(Ph,e)}translateOnAxis(e,t){return Rh.copy(e).applyQuaternion(this.quaternion),this.position.add(Rh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ch,e)}translateY(e){return this.translateOnAxis(Ih,e)}translateZ(e){return this.translateOnAxis(Ph,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(kn.copy(this.matrixWorld).invert())}lookAt(e,t,n){if(e.isVector3)Rr.copy(e);else Rr.set(e,t,n);let i=this.parent;if(this.updateWorldMatrix(!0,!1),Bs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)kn.lookAt(Bs,Rr,this.up);else kn.lookAt(Rr,Bs,this.up);if(this.quaternion.setFromRotationMatrix(kn),i)kn.extractRotation(i.matrixWorld),Qi.setFromRotationMatrix(kn),this.quaternion.premultiply(Qi.invert())}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}if(e===this)return Le("Object3D.add: object can't be added as a child of itself.",e),this;if(e&&e.isObject3D)e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lh),es.child=e,this.dispatchEvent(es),es.child=null;else Le("Object3D.add: object not an instance of THREE.Object3D.",e);return this}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);if(t!==-1)e.parent=null,this.children.splice(t,1),e.dispatchEvent(im),_o.child=e,this.dispatchEvent(_o),_o.child=null;return this}removeFromParent(){let e=this.parent;if(e!==null)e.remove(this);return this}clear(){return this.remove(...this.children)}attach(e){if(this.updateWorldMatrix(!0,!1),kn.copy(this.matrixWorld).invert(),e.parent!==null)e.parent.updateWorldMatrix(!0,!1),kn.multiply(e.parent.matrixWorld);return e.applyMatrix4(kn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lh),es.child=e,this.dispatchEvent(es),es.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}return}getObjectsByProperty(e,t,n=[]){if(this[e]===t)n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,e,tm),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Bs,nm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;if(t!==null)e(t),t.traverseAncestors(e)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let{x:t,y:n,z:i}=e,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,e=!0}let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null)i.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||n){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,n=!0}if(t===!0){let s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==="string",n={};if(t)e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let i={};if(i.uuid=this.uuid,i.type=this.type,i.name=this.name,i.castShadow=this.castShadow,i.receiveShadow=this.receiveShadow,i.visible=this.visible,i.frustumCulled=this.frustumCulled,i.renderOrder=this.renderOrder,i.static=this.static,i.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0)i.userData=this.userData;if(i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null)i.pivot=this.pivot.toArray();if(this.morphTargetDictionary!==void 0)i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)i.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)i.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((a)=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map((a)=>({...a})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null)i.colorsTexture=this._colorsTexture.toJSON(e);if(this.boundingSphere!==null)i.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)i.boundingBox=this.boundingBox.toJSON()}function s(a,o){if(a[o.uuid]===void 0)a[o.uuid]=o.toJSON(e);return o.uuid}if(this.isScene){if(this.background){if(this.background.isColor)i.background=this.background.toJSON();else if(this.background.isTexture)i.background=this.background.toJSON(e).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)i.environment=this.environment.toJSON(e).uuid}else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let o=a.shapes;if(Array.isArray(o))for(let l=0,c=o.length;l<c;l++){let h=o[l];s(e.shapes,h)}else s(e.shapes,o)}}if(this.isSkinnedMesh){if(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let o=0,l=this.material.length;o<l;o++)a.push(s(e.materials,this.material[o]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let o=this.animations[a];i.animations.push(s(e.animations,o))}}if(t){let a=r(e.geometries),o=r(e.materials),l=r(e.textures),c=r(e.images),h=r(e.shapes),u=r(e.skeletons),d=r(e.animations),f=r(e.nodes);if(a.length>0)n.geometries=a;if(o.length>0)n.materials=o;if(l.length>0)n.textures=l;if(c.length>0)n.images=c;if(h.length>0)n.shapes=h;if(u.length>0)n.skeletons=u;if(d.length>0)n.animations=d;if(f.length>0)n.nodes=f}return n.object=i,n;function r(a){let o=[];for(let l in a){let c=a[l];delete c.metadata,o.push(c)}return o}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};ot.DEFAULT_UP=new D(0,1,0);ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;En=class En extends ot{constructor(){super();this.isGroup=!0,this.type="Group"}};sm={type:"move"};ad={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ii={h:0,s:0,l:0},Cr={h:0,s:0,l:0};Ee=class Ee{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;if(i&&i.isColor)this.copy(i);else if(typeof i==="number")this.setHex(i);else if(typeof i==="string")this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t="srgb"){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,He.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=He.workingColorSpace){return this.r=e,this.g=t,this.b=n,He.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=He.workingColorSpace){if(e=Hl(e,1),t=Ve(t,0,1),n=Ve(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=0.5?n*(1+t):n+t-n*t,r=2*n-s;this.r=xo(r,s,e+0.3333333333333333),this.g=xo(r,s,e),this.b=xo(r,s,e-0.3333333333333333)}return He.colorSpaceToWorking(this,i),this}setStyle(e,t="srgb"){function n(s){if(s===void 0)return;if(parseFloat(s)<1)Te("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseFloat(s[1]))/100,Math.min(100,parseFloat(s[2]))/100,Math.min(100,parseFloat(s[3]))/100,t);break;case"hsl":case"hsla":if(s=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Te("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);else if(r===6)return this.setHex(parseInt(s,16),t);else Te("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t="srgb"){let n=ad[e.toLowerCase()];if(n!==void 0)this.setHex(n,t);else Te("Color: Unknown color "+e);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Xn(e.r),this.g=Xn(e.g),this.b=Xn(e.b),this}copyLinearToSRGB(e){return this.r=us(e.r),this.g=us(e.g),this.b=us(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e="srgb"){return He.workingToColorSpace(Nt.copy(this),e),Math.round(Ve(Nt.r*255,0,255))*65536+Math.round(Ve(Nt.g*255,0,255))*256+Math.round(Ve(Nt.b*255,0,255))}getHexString(e="srgb"){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=He.workingColorSpace){He.workingToColorSpace(Nt.copy(this),t);let{r:n,g:i,b:s}=Nt,r=Math.max(n,i,s),a=Math.min(n,i,s),o,l,c=(a+r)/2;if(a===r)o=0,l=0;else{let h=r-a;switch(l=c<=0.5?h/(r+a):h/(2-r-a),r){case n:o=(i-s)/h+(i<s?6:0);break;case i:o=(s-n)/h+2;break;case s:o=(n-i)/h+4;break}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=He.workingColorSpace){return He.workingToColorSpace(Nt.copy(this),t),e.r=Nt.r,e.g=Nt.g,e.b=Nt.b,e}getStyle(e="srgb"){He.workingToColorSpace(Nt.copy(this),e);let{r:t,g:n,b:i}=Nt;if(e!=="srgb")return`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`;return`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(ii),this.setHSL(ii.h+e,ii.s+t,ii.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ii),e.getHSL(Cr);let n=Ys(ii.h,Cr.h,t),i=Ys(ii.s,Cr.s,t),s=Ys(ii.l,Cr.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};Nt=new Ee;Ee.NAMES=ad;pa=class pa extends ot{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new $n,this.environmentIntensity=1,this.environmentRotation=new $n,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),this.background=e.background!==null?e.background.clone():null,this.environment=e.environment!==null?e.environment.clone():null,this.fog=e.fog!==null?e.fog.clone():null,this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),this.overrideMaterial=e.overrideMaterial!==null?e.overrideMaterial.clone():null,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);if(this.fog!==null)t.object.fog=this.fog.toJSON();return t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}};xn=new D,zn=new D,vo=new D,Hn=new D,ts=new D,ns=new D,Nh=new D,yo=new D,So=new D,bo=new D,Mo=new tt,wo=new tt,To=new tt;Gn=[new D,new D,new D,new D,new D,new D,new D,new D],vn=new D,Ir=new qt,is=new D,ss=new D,rs=new D,si=new D,ri=new D,Ii=new D,ks=new D,Pr=new D,Lr=new D,Pi=new D;vt=new D,Nr=new ke;pt=class pt extends Yn{constructor(e,t,n=!1){super();if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rm++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0,this._normalizationScale=e!==void 0?da(e):void 0}onUploadCallback(){}set needsUpdate(e){if(e===!0)this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Nr.fromBufferAttribute(this,t),Nr.applyMatrix3(e),this.setXY(t,Nr.x,Nr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyMatrix3(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyMatrix4(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.applyNormalMatrix(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)vt.fromBufferAttribute(this,t),vt.transformDirection(e),this.setXYZ(t,vt.x,vt.y,vt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];if(this.normalized)n=this._denormalize(n);return n}setComponent(e,t,n){if(this.normalized)n=this._normalize(n);return this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];if(this.normalized)t=this._denormalize(t);return t}setX(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];if(this.normalized)t=this._denormalize(t);return t}setY(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];if(this.normalized)t=this._denormalize(t);return t}setZ(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];if(this.normalized)t=this._denormalize(t);return t}setW(e,t){if(this.normalized)t=this._normalize(t);return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n);return this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){if(e*=this.itemSize,this.normalized)t=this._normalize(t),n=this._normalize(n),i=this._normalize(i),s=this._normalize(s);return this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}_denormalize(e){let t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Wl(e,this.array)}_normalize(e){let t=this._normalizationScale;return t!==void 0?Math.round(e*t):Vl(e,this.array)}};ma=class ma extends pt{constructor(e,t,n){super(new Uint16Array(e),t,n)}};ga=class ga extends pt{constructor(e,t,n){super(new Uint32Array(e),t,n)}};Vt=class Vt extends pt{constructor(e,t,n){super(new Float32Array(e),t,n)}};am=new qt,zs=new D,Ao=new D;on=new Fe,Ro=new ot,as=new D,en=new qt,Hs=new qt,Et=new D;Yt=class Yt extends Yn{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:om++}),this.uuid=In(),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={},this._transformed=!1}getIndex(){return this.index}setIndex(e){if(Array.isArray(e))this.index=new((Lp(e))?ga:ma)(e,1);else this.index=e;return this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;if(t!==void 0)t.applyMatrix4(e),t.needsUpdate=!0;let n=this.attributes.normal;if(n!==void 0){let s=new Ne().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;if(i!==void 0)i.transformDirection(e),i.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this._transformed=!0,this}applyQuaternion(e){return on.makeRotationFromQuaternion(e),this.applyMatrix4(on),this}rotateX(e){return on.makeRotationX(e),this.applyMatrix4(on),this}rotateY(e){return on.makeRotationY(e),this.applyMatrix4(on),this}rotateZ(e){return on.makeRotationZ(e),this.applyMatrix4(on),this}translate(e,t,n){return on.makeTranslation(e,t,n),this.applyMatrix4(on),this}scale(e,t,n){return on.makeScale(e,t,n),this.applyMatrix4(on),this}lookAt(e){return Ro.lookAt(e),Ro.updateMatrix(),this.applyMatrix4(Ro.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(as).negate(),this.translate(as.x,as.y,as.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,s=e.length;i<s;i++){let r=e[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new Vt(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}if(e.length>t.count)Te("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");t.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new qt;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];if(en.setFromBufferAttribute(s),this.morphTargetsRelative)Et.addVectors(this.boundingBox.min,en.min),this.boundingBox.expandByPoint(Et),Et.addVectors(this.boundingBox.max,en.max),this.boundingBox.expandByPoint(Et);else this.boundingBox.expandByPoint(en.min),this.boundingBox.expandByPoint(en.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))Le('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new sn;let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new D,1/0);return}if(e){let n=this.boundingSphere.center;if(en.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];if(Hs.setFromBufferAttribute(a),this.morphTargetsRelative)Et.addVectors(en.min,Hs.min),en.expandByPoint(Et),Et.addVectors(en.max,Hs.max),en.expandByPoint(Et);else en.expandByPoint(Hs.min),en.expandByPoint(Hs.max)}en.getCenter(n);let i=0;for(let s=0,r=e.count;s<r;s++)Et.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Et));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],o=this.morphTargetsRelative;for(let l=0,c=a.count;l<c;l++){if(Et.fromBufferAttribute(a,l),o)as.fromBufferAttribute(e,l),Et.add(as);i=Math.max(i,n.distanceToSquared(Et))}}if(this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius))Le('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Le("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:n,normal:i,uv:s}=t,r=this.getAttribute("tangent");if(r===void 0||r.count!==n.count)r=new pt(new Float32Array(4*n.count),4),this.setAttribute("tangent",r);let a=[],o=[],l=new Uint8Array(n.count);for(let S=0;S<n.count;S++)a[S]=new D,o[S]=new D;let c=new D,h=new D,u=new D,d=new ke,f=new ke,_=new ke,y=new D,p=new D;function m(S,P,z){l[S]=l[P]=l[z]=1,c.fromBufferAttribute(n,S),h.fromBufferAttribute(n,P),u.fromBufferAttribute(n,z),d.fromBufferAttribute(s,S),f.fromBufferAttribute(s,P),_.fromBufferAttribute(s,z),h.sub(c),u.sub(c),f.sub(d),_.sub(d);let N=1/(f.x*_.y-_.x*f.y);if(!isFinite(N))return;y.copy(h).multiplyScalar(_.y).addScaledVector(u,-f.y).multiplyScalar(N),p.copy(u).multiplyScalar(f.x).addScaledVector(h,-_.x).multiplyScalar(N),a[S].add(y),a[P].add(y),a[z].add(y),o[S].add(p),o[P].add(p),o[z].add(p)}let M=this.groups;if(M.length===0)M=[{start:0,count:e.count}];for(let S=0,P=M.length;S<P;++S){let z=M[S],{start:N,count:H}=z;for(let Q=N,C=N+H;Q<C;Q+=3)m(e.getX(Q+0),e.getX(Q+1),e.getX(Q+2))}let T=new D,b=new D,E=new D,A=new D;function g(S){E.fromBufferAttribute(i,S),A.copy(E);let P=a[S];T.copy(P),T.sub(E.multiplyScalar(E.dot(P))).normalize(),b.crossVectors(A,P);let N=b.dot(o[S])<0?-1:1;r.setXYZW(S,T.x,T.y,T.z,N)}for(let S=0,P=n.count;S<P;++S)if(l[S])g(S);this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new pt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,d=n.count;u<d;u++)n.setXYZ(u,0,0,0);let i=new D,s=new D,r=new D,a=new D,o=new D,l=new D,c=new D,h=new D;if(e)for(let u=0,d=e.count;u<d;u+=3){let f=e.getX(u+0),_=e.getX(u+1),y=e.getX(u+2);i.fromBufferAttribute(t,f),s.fromBufferAttribute(t,_),r.fromBufferAttribute(t,y),c.subVectors(r,s),h.subVectors(i,s),c.cross(h),a.fromBufferAttribute(n,f),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,y),a.add(c),o.add(c),l.add(c),n.setXYZ(f,a.x,a.y,a.z),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(y,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)i.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),r.fromBufferAttribute(t,u+2),c.subVectors(r,s),h.subVectors(i,s),c.cross(h),n.setXYZ(u+0,c.x,c.y,c.z),n.setXYZ(u+1,c.x,c.y,c.z),n.setXYZ(u+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Et.fromBufferAttribute(e,t),Et.normalize(),e.setXYZ(t,Et.x,Et.y,Et.z)}toNonIndexed(){function e(a,o){let{array:l,itemSize:c,normalized:h}=a,u=new l.constructor(o.length*c),d=0,f=0;for(let _=0,y=o.length;_<y;_++){if(a.isInterleavedBufferAttribute)d=o[_]*a.data.stride+a.offset;else d=o[_]*c;for(let p=0;p<c;p++)u[f++]=l[d++]}return new pt(u,c,h)}if(this.index===null)return Te("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Yt,n=this.index.array,i=this.attributes;for(let a in i){let o=i[a],l=e(o,n);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let o=[],l=s[a];for(let c=0,h=l.length;c<h;c++){let u=l[c],d=e(u,n);o.push(d)}t.morphAttributes[a]=o}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,o=r.length;a<o;a++){let l=r[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0)e.userData=this.userData;if(this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)if(o[l]!==void 0)e[l]=o[l];return e}e.data={attributes:{}};let t=this.index;if(t!==null)e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)};let n=this.attributes;for(let o in n){let l=n[o];e.data.attributes[o]=l.toJSON(e.data)}let i={},s=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],c=[];for(let h=0,u=l.length;h<u;h++){let d=l[h];c.push(d.toJSON(e.data))}if(c.length>0)i[o]=c,s=!0}if(s)e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;if(r.length>0)e.data.groups=JSON.parse(JSON.stringify(r));let a=this.boundingSphere;if(a!==null)e.data.boundingSphere=a.toJSON();return e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;if(n!==null)this.setIndex(n.clone());let i=e.attributes;for(let l in i){let c=i[l];this.setAttribute(l,c.clone(t))}let s=e.morphAttributes;for(let l in s){let c=[],h=s[l];for(let u=0,d=h.length;u<d;u++)c.push(h[u].clone(t));this.morphAttributes[l]=c}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let l=0,c=r.length;l<c;l++){let h=r[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;if(a!==null)this.boundingBox=a.clone();let o=e.boundingSphere;if(o!==null)this.boundingSphere=o.clone();return this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};Bt=new D;Co=new D,lm=new D,cm=new Ne;rn=class rn extends Yn{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:hm++}),this.uuid=In(),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 Ee(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(e){if(this._alphaTest>0!==e>0)this.version++;this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e===void 0)return;for(let t in e){let n=e[t];if(n===void 0){Te(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Te(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}if(i&&i.isColor)i.set(n);else if(i&&i.isVector2&&(n&&n.isVector2)||i&&i.isEuler&&(n&&n.isEuler)||i&&i.isVector3&&(n&&n.isVector3))i.copy(n);else this[t]=n}}toJSON(e){let t=e===void 0||typeof e==="string";if(t)e={textures:{},images:{}};let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor)n.color=this.color.getHex();if(this.roughness!==void 0)n.roughness=this.roughness;if(this.metalness!==void 0)n.metalness=this.metalness;if(this.sheen!==void 0)n.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)n.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)n.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)n.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0)n.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)n.specular=this.specular.getHex();if(this.specularIntensity!==void 0)n.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)n.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)n.shininess=this.shininess;if(this.clearcoat!==void 0)n.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)n.clearcoatRoughness=this.clearcoatRoughness;if(this.diffuseRoughness!==void 0)n.diffuseRoughness=this.diffuseRoughness;if(this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture)n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid;if(this.clearcoatMap&&this.clearcoatMap.isTexture)n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid;if(this.dispersion!==void 0)n.dispersion=this.dispersion;if(this.retroreflectivity!==void 0)n.retroreflectivity=this.retroreflectivity;if(this.iridescence!==void 0)n.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)n.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessMinimum!==void 0)n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum;if(this.iridescenceThicknessMaximum!==void 0)n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum;if(this.iridescenceMap&&this.iridescenceMap.isTexture)n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid;if(this.anisotropy!==void 0)n.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)n.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid;if(this.map&&this.map.isTexture)n.map=this.map.toJSON(e).uuid;if(this.matcap&&this.matcap.isTexture)n.matcap=this.matcap.toJSON(e).uuid;if(this.alphaMap&&this.alphaMap.isTexture)n.alphaMap=this.alphaMap.toJSON(e).uuid;if(this.lightMap&&this.lightMap.isTexture)n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)n.roughnessMap=this.roughnessMap.toJSON(e).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)n.metalnessMap=this.metalnessMap.toJSON(e).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)n.emissiveMap=this.emissiveMap.toJSON(e).uuid;if(this.specularMap&&this.specularMap.isTexture)n.specularMap=this.specularMap.toJSON(e).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)n.specularColorMap=this.specularColorMap.toJSON(e).uuid;if(this.envMap&&this.envMap.isTexture){if(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0)n.combine=this.combine}if(this.envMapRotation!==void 0)n.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)n.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)n.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)n.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)n.gradientMap=this.gradientMap.toJSON(e).uuid;if(this.transmission!==void 0)n.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)n.transmissionMap=this.transmissionMap.toJSON(e).uuid;if(this.thickness!==void 0)n.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)n.thicknessMap=this.thicknessMap.toJSON(e).uuid;if(this.attenuationDistance!==void 0)n.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)n.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)n.size=this.size;if(this.sizeAttenuation!==void 0)n.sizeAttenuation=this.sizeAttenuation;if(Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0)n.clippingPlanes=this.clippingPlanes.map((s)=>s.toJSON());if(this.rotation!==void 0)n.rotation=this.rotation;if(this.depthPacking!==void 0)n.depthPacking=this.depthPacking;if(this.linewidth!==void 0)n.linewidth=this.linewidth;if(this.linecap!==void 0)n.linecap=this.linecap;if(this.linejoin!==void 0)n.linejoin=this.linejoin;if(this.dashSize!==void 0)n.dashSize=this.dashSize;if(this.gapSize!==void 0)n.gapSize=this.gapSize;if(this.scale!==void 0)n.scale=this.scale;if(this.wireframe!==void 0)n.wireframe=this.wireframe;if(this.wireframeLinewidth!==void 0)n.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!==void 0)n.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!==void 0)n.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading!==void 0)n.flatShading=this.flatShading;if(this.fog!==void 0)n.fog=this.fog;if(Object.keys(this.userData).length>0)n.userData=this.userData;function i(s){let r=[];for(let a in s){let o=s[a];delete o.metadata,r.push(o)}return r}if(t){let s=i(e.textures),r=i(e.images);if(s.length>0)n.textures=s;if(r.length>0)n.images=r}return n}fromJSON(e,t){if(e.uuid!==void 0)this.uuid=e.uuid;if(e.name!==void 0)this.name=e.name;if(e.color!==void 0&&this.color!==void 0)this.color.setHex(e.color);if(e.roughness!==void 0)this.roughness=e.roughness;if(e.metalness!==void 0)this.metalness=e.metalness;if(e.sheen!==void 0)this.sheen=e.sheen;if(e.sheenColor!==void 0)this.sheenColor=new Ee().setHex(e.sheenColor);if(e.sheenRoughness!==void 0)this.sheenRoughness=e.sheenRoughness;if(e.emissive!==void 0&&this.emissive!==void 0)this.emissive.setHex(e.emissive);if(e.specular!==void 0&&this.specular!==void 0)this.specular.setHex(e.specular);if(e.specularIntensity!==void 0)this.specularIntensity=e.specularIntensity;if(e.specularColor!==void 0&&this.specularColor!==void 0)this.specularColor.setHex(e.specularColor);if(e.shininess!==void 0)this.shininess=e.shininess;if(e.clearcoat!==void 0)this.clearcoat=e.clearcoat;if(e.clearcoatRoughness!==void 0)this.clearcoatRoughness=e.clearcoatRoughness;if(e.diffuseRoughness!==void 0)this.diffuseRoughness=e.diffuseRoughness;if(e.dispersion!==void 0)this.dispersion=e.dispersion;if(e.retroreflectivity!==void 0)this.retroreflectivity=e.retroreflectivity;if(e.iridescence!==void 0)this.iridescence=e.iridescence;if(e.iridescenceIOR!==void 0)this.iridescenceIOR=e.iridescenceIOR;if(e.iridescenceThicknessMinimum!==void 0)this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum;if(e.iridescenceThicknessMaximum!==void 0)this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum;if(e.iridescenceThicknessRange!==void 0)this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1];if(e.transmission!==void 0)this.transmission=e.transmission;if(e.thickness!==void 0)this.thickness=e.thickness;if(e.attenuationDistance!==void 0)this.attenuationDistance=e.attenuationDistance;if(e.attenuationColor!==void 0&&this.attenuationColor!==void 0)this.attenuationColor.setHex(e.attenuationColor);if(e.anisotropy!==void 0)this.anisotropy=e.anisotropy;if(e.anisotropyRotation!==void 0)this.anisotropyRotation=e.anisotropyRotation;if(e.fog!==void 0)this.fog=e.fog;if(e.flatShading!==void 0)this.flatShading=e.flatShading;if(e.blending!==void 0)this.blending=e.blending;if(e.combine!==void 0)this.combine=e.combine;if(e.side!==void 0)this.side=e.side;if(e.shadowSide!==void 0)this.shadowSide=e.shadowSide;if(e.opacity!==void 0)this.opacity=e.opacity;if(e.transparent!==void 0)this.transparent=e.transparent;if(e.alphaTest!==void 0)this.alphaTest=e.alphaTest;if(e.alphaHash!==void 0)this.alphaHash=e.alphaHash;if(e.depthFunc!==void 0)this.depthFunc=e.depthFunc;if(e.depthTest!==void 0)this.depthTest=e.depthTest;if(e.depthWrite!==void 0)this.depthWrite=e.depthWrite;if(e.colorWrite!==void 0)this.colorWrite=e.colorWrite;if(e.clippingPlanes!==void 0)this.clippingPlanes=e.clippingPlanes.map((n)=>new Tn().fromJSON(n));if(e.clipIntersection!==void 0)this.clipIntersection=e.clipIntersection;if(e.clipShadows!==void 0)this.clipShadows=e.clipShadows;if(e.depthPacking!==void 0)this.depthPacking=e.depthPacking;if(e.blendSrc!==void 0)this.blendSrc=e.blendSrc;if(e.blendDst!==void 0)this.blendDst=e.blendDst;if(e.blendEquation!==void 0)this.blendEquation=e.blendEquation;if(e.blendSrcAlpha!==void 0)this.blendSrcAlpha=e.blendSrcAlpha;if(e.blendDstAlpha!==void 0)this.blendDstAlpha=e.blendDstAlpha;if(e.blendEquationAlpha!==void 0)this.blendEquationAlpha=e.blendEquationAlpha;if(e.blendColor!==void 0&&this.blendColor!==void 0)this.blendColor.setHex(e.blendColor);if(e.blendAlpha!==void 0)this.blendAlpha=e.blendAlpha;if(e.stencilWriteMask!==void 0)this.stencilWriteMask=e.stencilWriteMask;if(e.stencilFunc!==void 0)this.stencilFunc=e.stencilFunc;if(e.stencilRef!==void 0)this.stencilRef=e.stencilRef;if(e.stencilFuncMask!==void 0)this.stencilFuncMask=e.stencilFuncMask;if(e.stencilFail!==void 0)this.stencilFail=e.stencilFail;if(e.stencilZFail!==void 0)this.stencilZFail=e.stencilZFail;if(e.stencilZPass!==void 0)this.stencilZPass=e.stencilZPass;if(e.stencilWrite!==void 0)this.stencilWrite=e.stencilWrite;if(e.wireframe!==void 0)this.wireframe=e.wireframe;if(e.wireframeLinewidth!==void 0)this.wireframeLinewidth=e.wireframeLinewidth;if(e.wireframeLinecap!==void 0)this.wireframeLinecap=e.wireframeLinecap;if(e.wireframeLinejoin!==void 0)this.wireframeLinejoin=e.wireframeLinejoin;if(e.rotation!==void 0)this.rotation=e.rotation;if(e.linewidth!==void 0)this.linewidth=e.linewidth;if(e.linecap!==void 0)this.linecap=e.linecap;if(e.linejoin!==void 0)this.linejoin=e.linejoin;if(e.dashSize!==void 0)this.dashSize=e.dashSize;if(e.gapSize!==void 0)this.gapSize=e.gapSize;if(e.scale!==void 0)this.scale=e.scale;if(e.polygonOffset!==void 0)this.polygonOffset=e.polygonOffset;if(e.polygonOffsetFactor!==void 0)this.polygonOffsetFactor=e.polygonOffsetFactor;if(e.polygonOffsetUnits!==void 0)this.polygonOffsetUnits=e.polygonOffsetUnits;if(e.dithering!==void 0)this.dithering=e.dithering;if(e.alphaToCoverage!==void 0)this.alphaToCoverage=e.alphaToCoverage;if(e.premultipliedAlpha!==void 0)this.premultipliedAlpha=e.premultipliedAlpha;if(e.forceSinglePass!==void 0)this.forceSinglePass=e.forceSinglePass;if(e.allowOverride!==void 0)this.allowOverride=e.allowOverride;if(e.visible!==void 0)this.visible=e.visible;if(e.toneMapped!==void 0)this.toneMapped=e.toneMapped;if(e.userData!==void 0)this.userData=e.userData;if(e.vertexColors!==void 0)if(typeof e.vertexColors==="number")this.vertexColors=e.vertexColors>0;else this.vertexColors=e.vertexColors;if(e.size!==void 0)this.size=e.size;if(e.sizeAttenuation!==void 0)this.sizeAttenuation=e.sizeAttenuation;if(e.map!==void 0)this.map=t[e.map]||null;if(e.matcap!==void 0)this.matcap=t[e.matcap]||null;if(e.alphaMap!==void 0)this.alphaMap=t[e.alphaMap]||null;if(e.bumpMap!==void 0)this.bumpMap=t[e.bumpMap]||null;if(e.bumpScale!==void 0)this.bumpScale=e.bumpScale;if(e.normalMap!==void 0)this.normalMap=t[e.normalMap]||null;if(e.normalMapType!==void 0)this.normalMapType=e.normalMapType;if(e.normalScale!==void 0){let n=e.normalScale;if(Array.isArray(n)===!1)n=[n,n];this.normalScale=new ke().fromArray(n)}if(e.displacementMap!==void 0)this.displacementMap=t[e.displacementMap]||null;if(e.displacementScale!==void 0)this.displacementScale=e.displacementScale;if(e.displacementBias!==void 0)this.displacementBias=e.displacementBias;if(e.roughnessMap!==void 0)this.roughnessMap=t[e.roughnessMap]||null;if(e.metalnessMap!==void 0)this.metalnessMap=t[e.metalnessMap]||null;if(e.emissiveMap!==void 0)this.emissiveMap=t[e.emissiveMap]||null;if(e.emissiveIntensity!==void 0)this.emissiveIntensity=e.emissiveIntensity;if(e.specularMap!==void 0)this.specularMap=t[e.specularMap]||null;if(e.specularIntensityMap!==void 0)this.specularIntensityMap=t[e.specularIntensityMap]||null;if(e.specularColorMap!==void 0)this.specularColorMap=t[e.specularColorMap]||null;if(e.envMap!==void 0)this.envMap=t[e.envMap]||null;if(e.envMapRotation!==void 0)this.envMapRotation.fromArray(e.envMapRotation);if(e.envMapIntensity!==void 0)this.envMapIntensity=e.envMapIntensity;if(e.reflectivity!==void 0)this.reflectivity=e.reflectivity;if(e.refractionRatio!==void 0)this.refractionRatio=e.refractionRatio;if(e.lightMap!==void 0)this.lightMap=t[e.lightMap]||null;if(e.lightMapIntensity!==void 0)this.lightMapIntensity=e.lightMapIntensity;if(e.aoMap!==void 0)this.aoMap=t[e.aoMap]||null;if(e.aoMapIntensity!==void 0)this.aoMapIntensity=e.aoMapIntensity;if(e.gradientMap!==void 0)this.gradientMap=t[e.gradientMap]||null;if(e.clearcoatMap!==void 0)this.clearcoatMap=t[e.clearcoatMap]||null;if(e.clearcoatRoughnessMap!==void 0)this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null;if(e.clearcoatNormalMap!==void 0)this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null;if(e.clearcoatNormalScale!==void 0)this.clearcoatNormalScale=new ke().fromArray(e.clearcoatNormalScale);if(e.diffuseRoughnessMap!==void 0)this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null;if(e.iridescenceMap!==void 0)this.iridescenceMap=t[e.iridescenceMap]||null;if(e.iridescenceThicknessMap!==void 0)this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null;if(e.transmissionMap!==void 0)this.transmissionMap=t[e.transmissionMap]||null;if(e.thicknessMap!==void 0)this.thicknessMap=t[e.thicknessMap]||null;if(e.anisotropyMap!==void 0)this.anisotropyMap=t[e.anisotropyMap]||null;if(e.sheenColorMap!==void 0)this.sheenColorMap=t[e.sheenColorMap]||null;if(e.sheenRoughnessMap!==void 0)this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null;return this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){if(e===!0)this.version++}};Wn=new D,Io=new D,Dr=new D,Ur=new D;Zn=class Zn extends rn{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ee(16777215),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 $n,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Uh=new Fe,Li=new Gi,Fr=new sn,Fh=new D,Or=new D,Br=new D,kr=new D,Po=new D,zr=new D,Oh=new D,Hr=new D;yt=class yt extends ot{constructor(e=new Yt,t=new Zn){super();this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,r=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let a=this.morphTargetInfluences;if(s&&a){zr.set(0,0,0);for(let o=0,l=s.length;o<l;o++){let c=a[o],h=s[o];if(c===0)continue;if(Po.fromBufferAttribute(h,e),r)zr.addScaledVector(Po,c);else zr.addScaledVector(Po.sub(t),c)}t.add(zr)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0)return;if(n.boundingSphere===null)n.computeBoundingSphere();if(Fr.copy(n.boundingSphere),Fr.applyMatrix4(s),Li.copy(e.ray).recast(e.near),Fr.containsPoint(Li.origin)===!1){if(Li.intersectSphere(Fr,Fh)===null)return;if(Li.origin.distanceToSquared(Fh)>(e.far-e.near)**2)return}if(Uh.copy(s).invert(),Li.copy(e.ray).applyMatrix4(Uh),n.boundingBox!==null){if(Li.intersectsBox(n.boundingBox)===!1)return}this._computeIntersections(e,t,Li)}_computeIntersections(e,t,n){let i,s=this.geometry,r=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,h=s.attributes.normal,{groups:u,drawRange:d}=s;if(a!==null)if(Array.isArray(r))for(let f=0,_=u.length;f<_;f++){let y=u[f],p=r[y.materialIndex],m=Math.max(y.start,d.start),M=Math.min(a.count,Math.min(y.start+y.count,d.start+d.count));for(let T=m,b=M;T<b;T+=3){let E=a.getX(T),A=a.getX(T+1),g=a.getX(T+2);if(i=Gr(this,p,e,n,l,c,h,E,A,g),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let f=Math.max(0,d.start),_=Math.min(a.count,d.start+d.count);for(let y=f,p=_;y<p;y+=3){let m=a.getX(y),M=a.getX(y+1),T=a.getX(y+2);if(i=Gr(this,r,e,n,l,c,h,m,M,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}else if(o!==void 0)if(Array.isArray(r))for(let f=0,_=u.length;f<_;f++){let y=u[f],p=r[y.materialIndex],m=Math.max(y.start,d.start),M=Math.min(o.count,Math.min(y.start+y.count,d.start+d.count));for(let T=m,b=M;T<b;T+=3){let E=T,A=T+1,g=T+2;if(i=Gr(this,p,e,n,l,c,h,E,A,g),i)i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i)}}else{let f=Math.max(0,d.start),_=Math.min(o.count,d.start+d.count);for(let y=f,p=_;y<p;y+=3){let m=y,M=y+1,T=y+2;if(i=Gr(this,r,e,n,l,c,h,m,M,T),i)i.faceIndex=Math.floor(y/3),t.push(i)}}}};Gs=new tt,Bh=new tt,kh=new tt,dm=new tt,zh=new Fe,Wr=new D,Lo=new sn,Hh=new Fe,No=new Gi;_a=class _a extends yt{constructor(e,t){super(e,t);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Fe,this.bindMatrixInverse=new Fe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;if(this.boundingBox===null)this.boundingBox=new qt;this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Wr),this.boundingBox.expandByPoint(Wr)}computeBoundingSphere(){let e=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new sn;this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Wr),this.boundingSphere.expandByPoint(Wr)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}raycast(e,t){let n=this.material,i=this.matrixWorld;if(n===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Lo.copy(this.boundingSphere),Lo.applyMatrix4(i),e.ray.intersectsSphere(Lo)===!1)return;if(Hh.copy(i).invert(),No.copy(e.ray).applyMatrix4(Hh),this.boundingBox!==null){if(No.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(e,t,No)}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){if(this.skeleton=e,t===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld;this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new tt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let s=1/e.manhattanLength();if(s!==1/0)e.multiplyScalar(s);else e.set(1,0,0,0);t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else Te("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;if(Bh.fromBufferAttribute(i.attributes.skinIndex,e),kh.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4)Gs.copy(t),t.set(0,0,0,0);else Gs.set(t.x,t.y,t.z,1),t.set(0,0,0);Gs.applyMatrix4(this.bindMatrix);for(let s=0;s<4;s++){let r=kh.getComponent(s);if(r!==0){let a=Bh.getComponent(s);zh.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(dm.copy(Gs).applyMatrix4(zh),r)}}if(t.isVector4)t.w=Gs.w;return t.applyMatrix4(this.bindMatrixInverse)}};ar=class ar extends ot{constructor(){super();this.isBone=!0,this.type="Bone"}};Wi=class Wi extends ft{constructor(e=null,t=1,n=1,i,s,r,a,o,l=1003,c=1003,h,u){super(null,r,a,o,l,c,i,s,h,u);this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Gh=new Fe,fm=new Fe;li=class li extends pt{constructor(e,t,n,i=1){super(e,t,n);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};os=new Fe,Wh=new Fe,Vr=[],Vh=new qt,pm=new Fe,Ws=new yt,Vs=new sn;xa=class xa extends yt{constructor(e,t,n){super(e,t);this.isInstancedMesh=!0,this.instanceMatrix=new li(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,pm)}computeBoundingBox(){let e=this.geometry,t=this.count;if(this.boundingBox===null)this.boundingBox=new qt;if(e.boundingBox===null)e.computeBoundingBox();this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,os),Vh.copy(e.boundingBox).applyMatrix4(os),this.boundingBox.union(Vh)}computeBoundingSphere(){let e=this.geometry,t=this.count;if(this.boundingSphere===null)this.boundingSphere=new sn;if(e.boundingSphere===null)e.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,os),Vs.copy(e.boundingSphere).applyMatrix4(os),this.boundingSphere.union(Vs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),this.morphTexture=e.morphTexture!==null?e.morphTexture.clone():null,this.instanceColor=e.instanceColor!==null?e.instanceColor.clone():null,this.count=e.count,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}getColorAt(e,t){if(this.instanceColor===null)return t.setRGB(1,1,1);else return t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,r=e*s+1;for(let a=0;a<n.length;a++)n[a]=i[r+a]}raycast(e,t){let n=this.matrixWorld,i=this.count;if(Ws.geometry=this.geometry,Ws.material=this.material,Ws.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(Vs.copy(this.boundingSphere),Vs.applyMatrix4(n),e.ray.intersectsSphere(Vs)===!1)return;for(let s=0;s<i;s++){this.getMatrixAt(s,os),Wh.multiplyMatrices(n,os),Ws.matrixWorld=Wh,Ws.raycast(e,Vr);for(let r=0,a=Vr.length;r<a;r++){let o=Vr[r];o.instanceId=s,o.object=this,t.push(o)}Vr.length=0}}setColorAt(e,t){if(this.instanceColor===null)this.instanceColor=new li(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;if(this.morphTexture===null)this.morphTexture=new Wi(new Float32Array(i*this.count),i,this.count,1028,1015);let s=this.morphTexture.source.data.data,r=0;for(let l=0;l<n.length;l++)r+=n[l];let a=this.geometry.morphTargetsRelative?1:1-r,o=i*e;return s[o]=a,s.set(n,o+1),this}updateMorphTargets(){}dispose(){if(super.dispose(),this.instanceMatrix.dispose(),this.instanceColor!==null)this.instanceColor.dispose();if(this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}};Ni=new sn,mm=new ke(0.5,0.5),Xr=new D;Xh=new Fe;lr=class lr extends rn{constructor(e){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ee(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};jr=new D,Qr=new D,$h=new Fe,Xs=new Gi,$r=new sn,Do=new D,qh=new D;bs=class bs extends ot{constructor(e=new Yt,t=new lr){super();this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)jr.fromBufferAttribute(t,i-1),Qr.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=jr.distanceTo(Qr);e.setAttribute("lineDistance",new Vt(n,1))}else Te("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,r=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if($r.copy(n.boundingSphere),$r.applyMatrix4(i),$r.radius+=s,e.ray.intersectsSphere($r)===!1)return;$h.copy(i).invert(),Xs.copy(e.ray).applyMatrix4($h);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=n.index,u=n.attributes.position;if(c!==null){let d=Math.max(0,r.start),f=Math.min(c.count,r.start+r.count);for(let _=d,y=f-1;_<y;_+=l){let p=c.getX(_),m=c.getX(_+1),M=qr(this,e,Xs,o,p,m,_);if(M)t.push(M)}if(this.isLineLoop){let _=c.getX(f-1),y=c.getX(d),p=qr(this,e,Xs,o,_,y,f-1);if(p)t.push(p)}}else{let d=Math.max(0,r.start),f=Math.min(u.count,r.start+r.count);for(let _=d,y=f-1;_<y;_+=l){let p=qr(this,e,Xs,o,_,_+1,_);if(p)t.push(p)}if(this.isLineLoop){let _=qr(this,e,Xs,o,f-1,d,f-1);if(_)t.push(_)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};Yh=new D,Zh=new D;ya=class ya extends bs{constructor(e,t){super(e,t);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Yh.fromBufferAttribute(t,i),Zh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Yh.distanceTo(Zh);e.setAttribute("lineDistance",new Vt(n,1))}else Te("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};Sa=class Sa extends bs{constructor(e,t){super(e,t);this.isLineLoop=!0,this.type="LineLoop"}};cr=class cr extends rn{constructor(e){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ee(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Kh=new Fe,Oo=new Gi,Yr=new sn,Zr=new D;ba=class ba extends ot{constructor(e=new Yt,t=new cr){super();this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){if(super.copy(e,t),e.morphTargetInfluences!==void 0)this.morphTargetInfluences=e.morphTargetInfluences.slice();else this.morphTargetInfluences=void 0;if(e.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary);else this.morphTargetDictionary=void 0;return this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,r=n.drawRange;if(n.boundingSphere===null)n.computeBoundingSphere();if(Yr.copy(n.boundingSphere),Yr.applyMatrix4(i),Yr.radius+=s,e.ray.intersectsSphere(Yr)===!1)return;Kh.copy(i).invert(),Oo.copy(e.ray).applyMatrix4(Kh);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=n.index,h=n.attributes.position;if(l!==null){let u=Math.max(0,r.start),d=Math.min(l.count,r.start+r.count);for(let f=u,_=d;f<_;f++){let y=l.getX(f);Zr.fromBufferAttribute(h,y),Jh(Zr,y,o,i,e,t,this)}}else{let u=Math.max(0,r.start),d=Math.min(h.count,r.start+r.count);for(let f=u,_=d;f<_;f++)Zr.fromBufferAttribute(h,f),Jh(Zr,f,o,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};Ma=class Ma extends ft{constructor(e=[],t=301,n,i,s,r,a,o,l,c){super(e,t,n,i,s,r,a,o,l,c);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};Ms=class Ms extends ft{constructor(e,t,n,i,s,r,a,o,l){super(e,t,n,i,s,r,a,o,l);this.isCanvasTexture=!0,this.needsUpdate=!0}};pi=class pi extends ft{constructor(e,t,n=1014,i,s,r,a=1003,o=1003,l,c=1026,h=1){if(c!==1026&&c!==1027)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:h};super(u,i,s,r,a,o,c,n,l);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new nr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}};wa=class wa extends pi{constructor(e,t=1014,n=301,i,s,r=1003,a=1003,o,l=1026){let c={width:e,height:e,depth:1},h=[c,c,c,c,c,c];super(e,e,t,n,i,s,r,a,o,l);this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}};Ta=class Ta extends ft{constructor(e=null){super();this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}};ws=class ws extends Yt{constructor(e=1,t=1,n=1,i=1,s=1,r=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:r};let a=this;i=Math.floor(i),s=Math.floor(s),r=Math.floor(r);let o=[],l=[],c=[],h=[],u=0,d=0;f("z","y","x",-1,-1,n,t,e,r,s,0),f("z","y","x",1,-1,n,t,-e,r,s,1),f("x","z","y",1,1,e,n,t,i,r,2),f("x","z","y",1,-1,e,n,-t,i,r,3),f("x","y","z",1,-1,e,t,n,i,s,4),f("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(o),this.setAttribute("position",new Vt(l,3)),this.setAttribute("normal",new Vt(c,3)),this.setAttribute("uv",new Vt(h,2));function f(_,y,p,m,M,T,b,E,A,g,S){let P=T/A,z=b/g,N=T/2,H=b/2,Q=E/2,C=A+1,Y=g+1,K=0,B=0,ae=new D;for(let V=0;V<Y;V++){let j=V*z-H;for(let ie=0;ie<C;ie++){let be=ie*P-N;ae[_]=be*m,ae[y]=j*M,ae[p]=Q,l.push(ae.x,ae.y,ae.z),ae[_]=0,ae[y]=0,ae[p]=E>0?1:-1,c.push(ae.x,ae.y,ae.z),h.push(ie/A),h.push(1-V/g),K+=1}}for(let V=0;V<g;V++)for(let j=0;j<A;j++){let ie=u+j+C*V,be=u+j+C*(V+1),Z=u+(j+1)+C*(V+1),ne=u+(j+1)+C*V;o.push(ie,be,ne),o.push(be,Z,ne),B+=6}a.addGroup(d,B,S),d+=B,u+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ws(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};hr=class hr extends Yt{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let s=e/2,r=t/2,a=Math.floor(n),o=Math.floor(i),l=a+1,c=o+1,h=e/a,u=t/o,d=[],f=[],_=[],y=[];for(let p=0;p<c;p++){let m=p*u-r;for(let M=0;M<l;M++){let T=M*h-s;f.push(T,-m,0),_.push(0,0,1),y.push(M/a),y.push(1-p/o)}}for(let p=0;p<o;p++)for(let m=0;m<a;m++){let M=m+l*p,T=m+l*(p+1),b=m+1+l*(p+1),E=m+1+l*p;d.push(M,T,E),d.push(T,b,E)}this.setIndex(d),this.setAttribute("position",new Vt(f,3)),this.setAttribute("normal",new Vt(_,3)),this.setAttribute("uv",new Vt(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hr(e.width,e.height,e.widthSegments,e.heightSegments)}};od={clone:Vi,merge:Ut};Kn=class Kn extends rn{constructor(e){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_m,this.fragmentShader=xm,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,e!==void 0)this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vi(e.uniforms),this.uniformsGroups=gm(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let r=this.uniforms[i].value;if(r&&r.isTexture)t.uniforms[i]={type:"t",value:r.toJSON(e).uuid};else if(r&&r.isColor)t.uniforms[i]={type:"c",value:r.getHex()};else if(r&&r.isVector2)t.uniforms[i]={type:"v2",value:r.toArray()};else if(r&&r.isVector3)t.uniforms[i]={type:"v3",value:r.toArray()};else if(r&&r.isVector4)t.uniforms[i]={type:"v4",value:r.toArray()};else if(r&&r.isMatrix3)t.uniforms[i]={type:"m3",value:r.toArray()};else if(r&&r.isMatrix4)t.uniforms[i]={type:"m4",value:r.toArray()};else t.uniforms[i]={value:r}}if(Object.keys(this.defines).length>0)t.defines=this.defines;t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let i in this.extensions)if(this.extensions[i]===!0)n[i]=!0;if(Object.keys(n).length>0)t.extensions=n;return t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new Ee().setHex(i.value);break;case"v2":this.uniforms[n].value=new ke().fromArray(i.value);break;case"v3":this.uniforms[n].value=new D().fromArray(i.value);break;case"v4":this.uniforms[n].value=new tt().fromArray(i.value);break;case"m3":this.uniforms[n].value=new Ne().fromArray(i.value);break;case"m4":this.uniforms[n].value=new Fe().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(e.defines!==void 0)this.defines=e.defines;if(e.vertexShader!==void 0)this.vertexShader=e.vertexShader;if(e.fragmentShader!==void 0)this.fragmentShader=e.fragmentShader;if(e.glslVersion!==void 0)this.glslVersion=e.glslVersion;if(e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];if(e.lights!==void 0)this.lights=e.lights;if(e.clipping!==void 0)this.clipping=e.clipping;return this}};Zl=class Zl extends Kn{constructor(e){super(e);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};Pn=class Pn extends rn{constructor(e){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ee(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ee(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new ke(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 $n,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Ft=class Ft extends Pn{constructor(e){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 ke(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ve(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+0.4*t)/(1-0.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new Ee(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 Ee(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ee(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){if(this._anisotropy>0!==e>0)this.version++;this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){if(this._clearcoat>0!==e>0)this.version++;this._clearcoat=e}get diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(e){if(this._diffuseRoughness>0!==e>0)this.version++;this._diffuseRoughness=e}get iridescence(){return this._iridescence}set iridescence(e){if(this._iridescence>0!==e>0)this.version++;this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){if(this._dispersion>0!==e>0)this.version++;this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){if(this._retroreflectivity>0!==e>0)this.version++;this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){if(this._sheen>0!==e>0)this.version++;this._sheen=e}get transmission(){return this._transmission}set transmission(e){if(this._transmission>0!==e>0)this.version++;this._transmission=e}get iridescenceThicknessRange(){return Di('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(e){Di('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),this.iridescenceThicknessMinimum=e[0],this.iridescenceThicknessMaximum=e[1]}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.diffuseRoughness=e.diffuseRoughness,this.diffuseRoughnessMap=e.diffuseRoughnessMap,this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Kl=class Kl extends rn{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};Jl=class Jl extends rn{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};jl=class jl extends Jn{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,r=e+1,a=i[s],o=i[r];if(a===void 0)switch(this.getSettings_().endingStart){case 2401:s=e,a=2*t-n;break;case 2402:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(o===void 0)switch(this.getSettings_().endingEnd){case 2401:r=e,o=2*n-t;break;case 2402:r=1,o=n+i[1]-i[0];break;default:r=e-1,o=t}let l=(n-t)*0.5,c=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(o-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,f=(n-t)/(i-t),_=f*f,y=_*f,p=-u*y+2*u*_-u*f,m=(1+u)*y+(-1.5-2*u)*_+(-0.5+u)*f+1,M=(-1-d)*y+(1.5+d)*_+0.5*f,T=d*y-d*_;for(let b=0;b!==a;++b)s[b]=p*r[c+b]+m*r[l+b]+M*r[o+b]+T*r[h+b];return s}};Ql=class Ql extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=(n-t)/(i-t),h=1-c;for(let u=0;u!==a;++u)s[u]=r[l+u]*h+r[o+u]*c;return s}};ec=class ec extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}};tc=class tc extends Jn{interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=e*a,l=o-a,c=this.inTangents,h=this.outTangents;if(!c||!h){let f=(n-t)/(i-t),_=1-f;for(let y=0;y!==a;++y)s[y]=r[l+y]*_+r[o+y]*f;return s}let u=a*2,d=e-1;for(let f=0;f!==a;++f){let _=r[l+f],y=r[o+f],p=d*u+f*2,m=h[p],M=h[p+1],T=e*u+f*2,b=c[T],E=c[T+1],A=bm(n,t,m,b,i);s[f]=ld(A,_,M,E,y)}return s}};an.prototype.ValueTypeName="";an.prototype.TimeBufferType=Float32Array;an.prototype.ValueBufferType=Float32Array;an.prototype.DefaultInterpolation=2301;mi=class mi extends an{constructor(e,t,n){super(e,t,n)}};mi.prototype.ValueTypeName="bool";mi.prototype.ValueBufferType=Array;mi.prototype.DefaultInterpolation=2300;mi.prototype.InterpolantFactoryMethodLinear=void 0;mi.prototype.InterpolantFactoryMethodSmooth=void 0;Ea=class Ea extends an{constructor(e,t,n,i){super(e,t,n,i)}};Ea.prototype.ValueTypeName="color";gi=class gi extends an{constructor(e,t,n,i){super(e,t,n,i)}};gi.prototype.ValueTypeName="number";nc=class nc extends Jn{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t),l=e*a;for(let c=l+a;l!==c;l+=4)cn.slerpFlat(s,0,r,l-a,r,l,o);return s}};_i=class _i extends an{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new nc(this.times,this.values,this.getValueSize(),e)}};_i.prototype.ValueTypeName="quaternion";_i.prototype.InterpolantFactoryMethodSmooth=void 0;xi=class xi extends an{constructor(e,t,n){super(e,t,n)}};xi.prototype.ValueTypeName="string";xi.prototype.ValueBufferType=Array;xi.prototype.DefaultInterpolation=2300;xi.prototype.InterpolantFactoryMethodLinear=void 0;xi.prototype.InterpolantFactoryMethodSmooth=void 0;Xi=class Xi extends an{constructor(e,t,n,i){super(e,t,n,i)}};Xi.prototype.ValueTypeName="vector";An={enabled:!1,files:{},add:function(e,t){if(this.enabled===!1)return;if(nu(e))return;this.files[e]=t},get:function(e){if(this.enabled===!1)return;if(nu(e))return;return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};cd=new ic;jn.DEFAULT_MATERIAL_NAME="__DEFAULT";Vn={};hd=class hd extends Error{constructor(e,t){super(e);this.response=t}};ur=class ur extends jn{constructor(e){super(e);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=An.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{if(t)t(s);this.manager.itemEnd(e)},0);return}if(Vn[e]!==void 0){Vn[e].push({onLoad:t,onProgress:n,onError:i});return}Vn[e]=[],Vn[e].push({onLoad:t,onProgress:n,onError:i});let r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(r).then((l)=>{if(l.status===200||l.status===0){if(l.status===0)Te("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let c=Vn[e],h=l.body.getReader(),u=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),d=u?parseInt(u):0,f=d!==0,_=0,y=new ReadableStream({start(p){m();function m(){h.read().then(({done:M,value:T})=>{if(M)p.close();else{_+=T.byteLength;let b=new ProgressEvent("progress",{lengthComputable:f,loaded:_,total:d});for(let E=0,A=c.length;E<A;E++){let g=c[E];if(g.onProgress)g.onProgress(b)}p.enqueue(T),m()}},(M)=>{p.error(M)})}}});return new Response(y)}else throw new hd(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then((l)=>{switch(o){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then((c)=>new DOMParser().parseFromString(c,a));case"json":return l.json();default:if(a==="")return l.text();else{let h=/charset="?([^;"\s]*)"?/i.exec(a),u=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(u);return l.arrayBuffer().then((f)=>d.decode(f))}}}).then((l)=>{An.add(`file:${e}`,l);let c=Vn[e];delete Vn[e];for(let h=0,u=c.length;h<u;h++){let d=c[h];if(d.onLoad)d.onLoad(l)}}).catch((l)=>{let c=Vn[e];if(c===void 0)throw this.manager.itemError(e),l;delete Vn[e];for(let h=0,u=c.length;h<u;h++){let d=c[h];if(d.onError)d.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};ls=new WeakMap;sc=class sc extends jn{constructor(e){super(e)}load(e,t,n,i){if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=this,r=An.get(`image:${e}`);if(r!==void 0){if(r.complete===!0)s.manager.itemStart(e),setTimeout(function(){if(t)t(r);s.manager.itemEnd(e)},0);else{let h=ls.get(r);if(h===void 0)h=[],ls.set(r,h);h.push({onLoad:t,onError:i})}return r}let a=ds("img");function o(){if(c(),t)t(this);let h=ls.get(this)||[];for(let u=0;u<h.length;u++){let d=h[u];if(d.onLoad)d.onLoad(this)}ls.delete(this),s.manager.itemEnd(e)}function l(h){if(c(),i)i(h);An.remove(`image:${e}`);let u=ls.get(this)||[];for(let d=0;d<u.length;d++){let f=u[d];if(f.onError)f.onError(h)}ls.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}if(a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),e.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)a.crossOrigin=this.crossOrigin}return An.add(`image:${e}`,a),s.manager.itemStart(e),a.fetchPriority=this.priority,a.src=e,a}};Ra=class Ra extends jn{constructor(e){super(e)}load(e,t,n,i){let s=new ft,r=new sc(this.manager);return r.setPriority(this.priority),r.setCache(this.cache),r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(e,function(a){if(s.image=a,s.needsUpdate=!0,t!==void 0)t(s)},n,i),s}};Ts=class Ts extends ot{static registerNode(e){this.prototype._lightNode=e}constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new Ee(e),this.intensity=t}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};Ca=class Ca extends Ts{constructor(e,t,n){super(e,n);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ee(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}};Uo=new Fe,iu=new D,su=new D;Kr=new D,Jr=new cn,wn=new D;Ia=class Ia extends ot{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.matrixWorld.decompose(Kr,Jr,wn),wn.x===1&&wn.y===1&&wn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Kr,Jr,wn.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){if(super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Kr,Jr,wn),wn.x===1&&wn.y===1&&wn.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(Kr,Jr,wn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}};ai=new D,ru=new ke,au=new ke;Dt=class Dt extends Ia{constructor(e=50,t=1,n=0.1,i=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=0.5*this.getFilmHeight()/e;this.fov=Ui*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(qs*0.5*this.fov);return 0.5*this.getFilmHeight()/e}getEffectiveFOV(){return Ui*2*Math.atan(Math.tan(qs*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ai.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),t.set(ai.x,ai.y).multiplyScalar(-e/ai.z),ai.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),n.set(ai.x,ai.y).multiplyScalar(-e/ai.z)}getViewSize(e,t){return this.getViewBounds(e,ru,au),t.subVectors(au,ru)}setViewOffset(e,t,n,i,s,r){if(this.aspect=e/t,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(qs*0.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-0.5*i,r=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:o,fullHeight:l}=r;s+=r.offsetX*i/o,t-=r.offsetY*n/l,i*=r.width/o,n*=r.height/l}let a=this.filmOffset;if(a!==0)s+=e*a/this.getFilmWidth();this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null)t.object.view=Object.assign({},this.view);return t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};ud=class ud extends dr{constructor(){super(new Dt(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ui*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;if(n!==t.fov||i!==t.aspect||s!==t.far)t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix();super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this.aspect=e.aspect,this}toJSON(){let e=super.toJSON();return e.focus=this.focus,e.aspect=this.aspect,e}};Pa=class Pa extends Ts{constructor(e,t,n=0,i=Math.PI/3,s=0,r=2){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.distance=n,this.angle=i,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new ud}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);if(t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture)t.object.map=this.map.toJSON(e).uuid;return t.object.shadow=this.shadow.toJSON(),t}};dd=class dd extends dr{constructor(){super(new Dt(90,1,0.5,500));this.isPointLightShadow=!0}};La=class La extends Ts{constructor(e,t,n=0,i=2){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new dd}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}};vi=class vi extends Ia{constructor(e=-1,t=1,n=1,i=-1,s=0.1,r=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,r){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,s=n-e,r=n+e,a=i+t,o=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,r=s+l*this.view.width,a-=c*this.view.offsetY,o=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,r,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);if(t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null)t.object.view=Object.assign({},this.view);return t}};fd=class fd extends dr{constructor(){super(new vi(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}};$i=class $i extends Ts{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.shadow=new fd}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}};Fo=new WeakMap;Na=class Na extends jn{constructor(e){super(e);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")Te("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")Te("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){if(e===void 0)e="";if(this.path!==void 0)e=this.path+e;e=this.manager.resolveURL(e);let s=this,r=An.get(`image-bitmap:${e}`);if(r!==void 0){if(s.manager.itemStart(e),r.then){r.then((l)=>{if(Fo.has(r)===!0){if(i)i(Fo.get(r));s.manager.itemError(e),s.manager.itemEnd(e)}else{if(t)t(l);s.manager.itemEnd(e)}});return}setTimeout(function(){if(t)t(r);s.manager.itemEnd(e)},0);return}let a={};a.credentials=this.withCredentials||this.crossOrigin!=="anonymous"?"include":"same-origin",a.headers=this.requestHeader,a.priority=this.priority,a.cache=this.cache,a.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign({},s.options,{colorSpaceConversion:"none"}))}).then(function(l){if(An.add(`image-bitmap:${e}`,l),t)t(l);return s.manager.itemEnd(e),l}).catch(function(l){if(i)i(l);Fo.set(o,l),An.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});An.add(`image-bitmap:${e}`,o),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};fr=class fr extends ot{constructor(e,t,n){super();this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Dt(cs,hs,e,t);i.layers=this.layers,this.add(i);let s=new Dt(cs,hs,e,t);s.layers=this.layers,this.add(s);let r=new Dt(cs,hs,e,t);r.layers=this.layers,this.add(r);let a=new Dt(cs,hs,e,t);a.layers=this.layers,this.add(a);let o=new Dt(cs,hs,e,t);o.layers=this.layers,this.add(o);let l=new Dt(cs,hs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,s,r,a,o]=t;for(let l of t)this.remove(l);if(e===2000)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),r.up.set(0,0,1),r.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(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),r.up.set(0,0,-1),r.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: "+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;if(this.coordinateSystem!==e.coordinateSystem)this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem();let[s,r,a,o,l,c]=this.children,h=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;let _=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let y=!1;if(e.isWebGLRenderer===!0)y=e.state.buffers.depth.getReversed();else y=e.reversedDepthBuffer;if(e.setRenderTarget(n,0,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,s),e.setRenderTarget(n,1,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,r),e.setRenderTarget(n,2,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,a),e.setRenderTarget(n,3,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,o),e.setRenderTarget(n,4,i),y&&e.autoClear===!1)e.clearDepth();if(e.render(t,l),n.texture.mipmapsAutoUpdate=_,e.setRenderTarget(n,5,i),y&&e.autoClear===!1)e.clearDepth();e.render(t,c),e.setRenderTarget(h,u,d),e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}};rc=class rc extends Dt{constructor(e=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e,this.perCameraFrustumCulled=!1}};Tm=new RegExp("["+ac+"]","g"),oc="[^"+ac+"]",Em="[^"+ac.replace("\\.","")+"]",Am=/((?:WC+[\/:])*)/.source.replace("WC",oc),Rm=/(WCOD+)?/.source.replace("WCOD",Em),Cm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oc),Im=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oc),Pm=new RegExp("^"+Am+Rm+Cm+Im+"$"),Lm=["material","materials","bones","map"];Je.Composite=pd;Je.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Je.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Je.prototype.GetterByBindingType=[Je.prototype._getValue_direct,Je.prototype._getValue_array,Je.prototype._getValue_arrayElement,Je.prototype._getValue_toArray];Je.prototype.SetterByBindingTypeAndVersioning=[[Je.prototype._setValue_direct,Je.prototype._setValue_direct_setNeedsUpdate,Je.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_array,Je.prototype._setValue_array_setNeedsUpdate,Je.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_arrayElement,Je.prototype._setValue_arrayElement_setNeedsUpdate,Je.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Je.prototype._setValue_fromArray,Je.prototype._setValue_fromArray_setNeedsUpdate,Je.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];py=new Float32Array(1),ou=new Fe;md=class md{static{this.prototype.isMatrix2=!0}constructor(e,t,n,i){if(this.elements=[1,0,0,1],e!==void 0)this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}};if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"187"}}));if(typeof window<"u")if(window.__THREE__)Te("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="187"});function Od(){let e=null,t=!1,n=null,i=null;function s(r,a){i=e.requestAnimationFrame(s),n(r,a)}return{start:function(){if(t===!0)return;if(n===null)return;if(e===null)return;i=e.requestAnimationFrame(s),t=!0},stop:function(){if(e!==null)e.cancelAnimationFrame(i);t=!1},setAnimationLoop:function(r){n=r},setContext:function(r){e=r}}}function Dm(e){let t=new WeakMap;function n(o,l){let{array:c,usage:h}=o,u=c.byteLength,d=e.createBuffer();e.bindBuffer(l,d),e.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=e.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=e.HALF_FLOAT;else if(c instanceof Uint16Array)if(o.isFloat16BufferAttribute)f=e.HALF_FLOAT;else f=e.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=e.SHORT;else if(c instanceof Uint32Array)f=e.UNSIGNED_INT;else if(c instanceof Int32Array)f=e.INT;else if(c instanceof Int8Array)f=e.BYTE;else if(c instanceof Uint8Array)f=e.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function i(o,l,c){let{array:h,updateRanges:u}=l;if(e.bindBuffer(c,o),u.length===0)e.bufferSubData(c,0,h);else{u.sort((f,_)=>f.start-_.start);let d=0;for(let f=1;f<u.length;f++){let _=u[d],y=u[f];if(y.start<=_.start+_.count+1)_.count=Math.max(_.count,y.start+y.count-_.start);else++d,u[d]=y}u.length=d+1;for(let f=0,_=u.length;f<_;f++){let y=u[f];e.bufferSubData(c,y.start*h.BYTES_PER_ELEMENT,h,y.start,y.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(o){if(o.isInterleavedBufferAttribute)o=o.data;return t.get(o)}function r(o){if(o.isInterleavedBufferAttribute)o=o.data;let l=t.get(o);if(l)e.deleteBuffer(l.buffer),t.delete(o)}function a(o,l){if(o.isInterleavedBufferAttribute)o=o.data;if(o.isGLBufferAttribute){let h=t.get(o);if(!h||h.version<o.version)t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let c=t.get(o);if(c===void 0)t.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:s,remove:r,update:a}}function m0(e,t,n,i,s,r){let a=new Ee(0),o=s===!0?0:1,l,c,h=null,u=0,d=null;function f(M){let T=M.isScene===!0?M.background:null;if(T&&T.isTexture){let b=M.backgroundBlurriness>0;T=t.get(T,b)}return T}function _(M){let T=!1,b=f(M);if(b===null)p(a,o);else if(b&&b.isColor)p(b,1),T=!0;let E=e.xr.getEnvironmentBlendMode();if(E==="additive")n.buffers.color.setClear(0,0,0,1,r);else if(E==="alpha-blend")n.buffers.color.setClear(0,0,0,0,r);if(e.autoClear||T)n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)}function y(M,T){let b=f(T);if(b&&b.isCubeTexture){if(c===void 0)c=new yt(new ws(1,1,1),new Kn({name:"BackgroundCubeMaterial",uniforms:Vi(Nn.backgroundCube.uniforms),vertexShader:Nn.backgroundCube.vertexShader,fragmentShader:Nn.backgroundCube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(E,A,g){this.matrixWorld.copyPosition(g.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c);if(c.material.uniforms.envMap.value=b,c.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(p0.makeRotationFromEuler(T.backgroundRotation)).transpose(),b.isRenderTargetTexture===!1)c.material.uniforms.backgroundRotation.value.premultiply(Bd);if(c.material.toneMapped=He.getTransfer(b.colorSpace)!==st,h!==b||u!==b.version||d!==e.toneMapping)c.material.needsUpdate=!0,h=b,u=b.version,d=e.toneMapping;c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null)}else if(b&&b.isTexture){if(l===void 0)l=new yt(new hr(2,2),new Kn({name:"BackgroundMaterial",uniforms:Vi(Nn.background.uniforms),vertexShader:Nn.background.vertexShader,fragmentShader:Nn.background.fragmentShader,side:ci,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l);if(l.material.uniforms.t2D.value=b,l.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,l.material.toneMapped=He.getTransfer(b.colorSpace)!==st,b.matrixAutoUpdate===!0)b.updateMatrix();if(l.material.uniforms.uvTransform.value.copy(b.matrix),h!==b||u!==b.version||d!==e.toneMapping)l.material.needsUpdate=!0,h=b,u=b.version,d=e.toneMapping;l.layers.enableAll(),M.unshift(l,l.geometry,l.material,0,0,null)}}function p(M,T){M.getRGB(Ua,Yl(e)),n.buffers.color.setClear(Ua.r,Ua.g,Ua.b,T,r)}function m(){if(c!==void 0)c.geometry.dispose(),c.material.dispose(),c=void 0;if(l!==void 0)l.geometry.dispose(),l.material.dispose(),l=void 0}return{getClearColor:function(){return a},setClearColor:function(M,T=1){a.set(M),o=T,p(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(M){o=M,p(a,o)},render:_,addToRenderList:y,dispose:m}}function g0(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},s=d(null),r=s,a=!1;function o(N,H,Q,C,Y){let K=!1,B=u(N,C,Q,H);if(r!==B)r=B,c(r.object);if(K=f(N,C,Q,Y),K)_(N,C,Q,Y);if(Y!==null)t.update(Y,e.ELEMENT_ARRAY_BUFFER);if(K||a){if(a=!1,b(N,H,Q,C),Y!==null)e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer)}}function l(){return e.createVertexArray()}function c(N){return e.bindVertexArray(N)}function h(N){return e.deleteVertexArray(N)}function u(N,H,Q,C){let Y=C.wireframe===!0,K=i[H.id];if(K===void 0)K={},i[H.id]=K;let B=N.isInstancedMesh===!0?N.id:0,ae=K[B];if(ae===void 0)ae={},K[B]=ae;let V=ae[Q.id];if(V===void 0)V={},ae[Q.id]=V;let j=V[Y];if(j===void 0)j=d(l()),V[Y]=j;return j}function d(N){let H=[],Q=[],C=[];for(let Y=0;Y<n;Y++)H[Y]=0,Q[Y]=0,C[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:Q,attributeDivisors:C,object:N,attributes:{},index:null}}function f(N,H,Q,C){let Y=r.attributes,K=H.attributes,B=0,ae=Q.getAttributes();for(let V in ae)if(ae[V].location>=0){let ie=Y[V],be=K[V];if(be===void 0){if(V==="instanceMatrix"&&N.instanceMatrix)be=N.instanceMatrix;if(V==="instanceColor"&&N.instanceColor)be=N.instanceColor}if(ie===void 0)return!0;if(ie.attribute!==be)return!0;if(be&&ie.data!==be.data)return!0;B++}if(r.attributesNum!==B)return!0;if(r.index!==C)return!0;return!1}function _(N,H,Q,C){let Y={},K=H.attributes,B=0,ae=Q.getAttributes();for(let V in ae)if(ae[V].location>=0){let ie=K[V];if(ie===void 0){if(V==="instanceMatrix"&&N.instanceMatrix)ie=N.instanceMatrix;if(V==="instanceColor"&&N.instanceColor)ie=N.instanceColor}let be={};if(be.attribute=ie,ie&&ie.data)be.data=ie.data;Y[V]=be,B++}r.attributes=Y,r.attributesNum=B,r.index=C}function y(){let N=r.newAttributes;for(let H=0,Q=N.length;H<Q;H++)N[H]=0}function p(N){m(N,0)}function m(N,H){let Q=r.newAttributes,C=r.enabledAttributes,Y=r.attributeDivisors;if(Q[N]=1,C[N]===0)e.enableVertexAttribArray(N),C[N]=1;if(Y[N]!==H)e.vertexAttribDivisor(N,H),Y[N]=H}function M(){let N=r.newAttributes,H=r.enabledAttributes;for(let Q=0,C=H.length;Q<C;Q++)if(H[Q]!==N[Q])e.disableVertexAttribArray(Q),H[Q]=0}function T(N,H,Q,C,Y,K,B){if(B===!0)e.vertexAttribIPointer(N,H,Q,Y,K);else e.vertexAttribPointer(N,H,Q,C,Y,K)}function b(N,H,Q,C){y();let Y=C.attributes,K=Q.getAttributes(),B=H.defaultAttributeValues;for(let ae in K){let V=K[ae];if(V.location>=0){let j=Y[ae];if(j===void 0){if(ae==="instanceMatrix"&&N.instanceMatrix)j=N.instanceMatrix;if(ae==="instanceColor"&&N.instanceColor)j=N.instanceColor}if(j!==void 0){let ie=j.normalized,be=j.itemSize,Z=t.get(j);if(Z===void 0)continue;let{buffer:ne,type:ye,bytesPerElement:Ce}=Z,Ie=ye===e.INT||ye===e.UNSIGNED_INT||j.gpuType===Ko;if(j.isInterleavedBufferAttribute){let Se=j.data,je=Se.isInterleavedBuffer===!0?Se.stride:Se.itemSize,We=j.offset;if(Se.isInstancedInterleavedBuffer||Se.isInstancedBufferAttribute){for(let Oe=0;Oe<V.locationSize;Oe++)m(V.location+Oe,Se.meshPerAttribute);if(N.isInstancedMesh!==!0&&C._maxInstanceCount===void 0)C._maxInstanceCount=Se.meshPerAttribute*Se.count}else for(let Oe=0;Oe<V.locationSize;Oe++)p(V.location+Oe);e.bindBuffer(e.ARRAY_BUFFER,ne);for(let Oe=0;Oe<V.locationSize;Oe++)T(V.location+Oe,be/V.locationSize,ye,ie,je*Ce,(We+be/V.locationSize*Oe)*Ce,Ie)}else{if(j.isInstancedBufferAttribute){for(let Se=0;Se<V.locationSize;Se++)m(V.location+Se,j.meshPerAttribute);if(N.isInstancedMesh!==!0&&C._maxInstanceCount===void 0)C._maxInstanceCount=j.meshPerAttribute*j.count}else for(let Se=0;Se<V.locationSize;Se++)p(V.location+Se);e.bindBuffer(e.ARRAY_BUFFER,ne);for(let Se=0;Se<V.locationSize;Se++)T(V.location+Se,be/V.locationSize,ye,ie,be*Ce,be/V.locationSize*Se*Ce,Ie)}}else if(B!==void 0){let ie=B[ae];if(ie!==void 0)switch(ie.length){case 2:e.vertexAttrib2fv(V.location,ie);break;case 3:e.vertexAttrib3fv(V.location,ie);break;case 4:e.vertexAttrib4fv(V.location,ie);break;default:e.vertexAttrib1fv(V.location,ie)}}}}M()}function E(){P();for(let N in i){let H=i[N];for(let Q in H){let C=H[Q];for(let Y in C){let K=C[Y];for(let B in K)h(K[B].object),delete K[B];delete C[Y]}}delete i[N]}}function A(N){if(i[N.id]===void 0)return;let H=i[N.id];for(let Q in H){let C=H[Q];for(let Y in C){let K=C[Y];for(let B in K)h(K[B].object),delete K[B];delete C[Y]}}delete i[N.id]}function g(N){for(let H in i){let Q=i[H];for(let C in Q){let Y=Q[C];if(Y[N.id]===void 0)continue;let K=Y[N.id];for(let B in K)h(K[B].object),delete K[B];delete Y[N.id]}}}function S(N){for(let H in i){let Q=i[H],C=N.isInstancedMesh===!0?N.id:0,Y=Q[C];if(Y===void 0)continue;for(let K in Y){let B=Y[K];for(let ae in B)h(B[ae].object),delete B[ae];delete Y[K]}if(delete Q[C],Object.keys(Q).length===0)delete i[H]}}function P(){if(z(),a=!0,r===s)return;r=s,c(r.object)}function z(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:P,resetDefaultState:z,dispose:E,releaseStatesOfGeometry:A,releaseStatesOfObject:S,releaseStatesOfProgram:g,initAttributes:y,enableAttribute:p,disableUnusedAttributes:M}}function _0(e,t,n){let i;function s(l){i=l}function r(l,c){e.drawArrays(i,l,c),n.update(c,i,1)}function a(l,c,h){if(h===0)return;e.drawArraysInstanced(i,l,c,h),n.update(c,i,h)}function o(l,c,h){if(h===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,h);let d=0;for(let f=0;f<h;f++)d+=c[f];n.update(d,i,1)}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function x0(e,t,n,i){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let g=t.get("EXT_texture_filter_anisotropic");s=e.getParameter(g.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(g){if(g!==bn&&i.convert(g)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function o(g){let S=g===Cn&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));if(g!==Sn&&g!==qn&&!S&&i.convert(g)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE))return!1;return!0}function l(g){if(g==="highp"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";g="mediump"}if(g==="mediump"){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let c=n.precision!==void 0?n.precision:"highp",h=l(c);if(h!==c)Te("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h;let u=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),d=n.logarithmicDepthBuffer===!0&&u===!1;if(n.reversedDepthBuffer===!0&&u===!1)Te("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");if(n.logarithmicDepthBuffer===!0&&u===!0)Te("WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.");let f=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),_=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),m=e.getParameter(e.MAX_VERTEX_ATTRIBS),M=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),T=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),E=e.getParameter(e.MAX_SAMPLES),A=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:_,maxTextureSize:y,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:b,maxSamples:E,samples:A}}function v0(e){let t=this,n=null,i=0,s=!1,r=!1,a=new Tn,o=new Ne,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let f=u.length!==0||d||i!==0||s;return s=d,i=u.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,d){n=h(u,d,0)},this.setState=function(u,d,f){let{clippingPlanes:_,clipIntersection:y,clipShadows:p}=u,m=e.get(u);if(!s||_===null||_.length===0||r&&!p)if(r)h(null);else c();else{let M=r?0:i,T=M*4,b=m.clippingState||null;l.value=b,b=h(_,d,T,f);for(let E=0;E!==T;++E)b[E]=n[E];m.clippingState=b,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=M}};function c(){if(l.value!==n)l.value=n,l.needsUpdate=i>0;t.numPlanes=i,t.numIntersection=0}function h(u,d,f,_){let y=u!==null?u.length:0,p=null;if(y!==0){if(p=l.value,_!==!0||p===null){let m=f+y*4,M=d.matrixWorldInverse;if(o.getNormalMatrix(M),p===null||p.length<m)p=new Float32Array(m);for(let T=0,b=f;T!==y;++T,b+=4)a.copy(u[T]).applyMatrix4(M,o),a.normal.toArray(p,b),p[b+3]=a.constant}l.value=p,l.needsUpdate=!0}return t.numPlanes=y,t.numIntersection=0,p}}class Oa{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new fr(1,10,null),this._boxMesh=new yt(new ws(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=0.1,i=100,s={}){let{size:r=256,position:a=M0}=s,o=this._renderer;this._setSize(r);let l=this._allocateTarget(),c=this._getSourceTarget(!0);if(t>0)c.texture.mipmapsAutoUpdate=!1;let{autoClear:h,autoClearColor:u,autoClearDepth:d,autoClearStencil:f}=o,_=e.background;if(o.autoClear=!0,o.autoClearColor=!0,o.autoClearDepth=!0,o.autoClearStencil=!0,_===null)e.background=o.getClearColor(w0);let y=new fr(n,i,c);if(y.position.copy(a),y.update(o,e),o.autoClear=h,o.autoClearColor=u,o.autoClearDepth=d,o.autoClearStencil=f,e.background=_,t>0)c.texture.mipmapsAutoUpdate=!0,this._blur(l,t);return this._applyPMREM(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=vd(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=xd(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._sourceTarget!==null)this._sourceTarget.dispose();if(this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._integrationMaterial!==null)this._integrationMaterial.dispose();this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max(gd,Gl(e))}_fromTexture(e,t){if(e.mapping===Qs||e.mapping===gs)this._setSize(e.image.length===0?gd:e.image[0].width||e.image[0].image.width);else this._setSize(e.image.width/4);let n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){let e=this._cubeSize,t=_d(e,!1,!1),n=Math.log2(e)-y0;for(let i=0;i<=n;i++)t.texture.mipmaps.push({width:e>>i,height:e>>i});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){let t=this._cubeSize,n=this._sourceTarget;if(n===null||n.width!==t||e&&n.depthBuffer===!1){if(n!==null)n.dispose();this._sourceTarget=_d(t,!0,e)}return this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){let i=this._boxMesh,s=this._cubeCamera;i.material=n,s.renderTarget=e,s.activeMipmapLevel=t;let r=e.width>>t;e.viewport.set(0,0,r,r),s.update(this._renderer,i),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;if(e.mapping===Qs||e.mapping===gs){if(this._cubemapMaterial===null)this._cubemapMaterial=vd();t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1}else{if(this._equirectMaterial===null)this._equirectMaterial=xd();t=this._equirectMaterial}t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){if(this._ggxMaterial===null)this._ggxMaterial=T0(),this._integrationMaterial=E0();let t=this._cubeSize,n=e.texture.mipmaps.length-1,i=this._ggxMaterial.uniforms;i.envMap.value=this._sourceTarget.texture;let s=this._integrationMaterial.uniforms;s.envMap.value=this._sourceTarget.texture,s.sourceLod.value=Math.log2(t/zd);for(let r=0;r<=n;r++){let a=Oa.lodToRoughness(r,n);if(r>n-b0)s.roughness.value=a,this._renderCube(e,r,this._integrationMaterial);else{let o=a>0?Math.log2(t)+0.5*Math.log2(6/(kd*Math.pow(a,4)))+0.5:0;i.roughness.value=a,i.lodBias.value=o,this._renderCube(e,r,this._ggxMaterial)}}}_blur(e,t){if(this._blurMaterial===null)this._blurMaterial=A0();let n=this._blurMaterial,i=n.uniforms,s=this._sourceTarget;i.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,i.envMap.value=s.texture,this._renderCube(e,0,n),i.envMap.value=e.texture,this._renderCube(s,0,n)}}function _d(e,t,n){return new Ba(e,{minFilter:tn,generateMipmaps:t,type:Cn,colorSpace:nn,depthBuffer:n})}function _r(e,t,n){return new Kn({name:e,uniforms:t,vertexShader:ze.cube_vert,fragmentShader:n,side:Xt,blending:Oi,depthTest:!1,depthWrite:!1})}function T0(){return _r("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},`
|
|
6
6
|
|
|
7
7
|
#define GGX_SAMPLES ${kd}u
|
|
8
8
|
|
|
@@ -86,7 +86,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
86
86
|
gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );
|
|
87
87
|
|
|
88
88
|
}
|
|
89
|
-
`)}function E0(){return
|
|
89
|
+
`)}function E0(){return _r("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:zd}},`
|
|
90
90
|
|
|
91
91
|
varying vec3 vWorldDirection;
|
|
92
92
|
|
|
@@ -139,7 +139,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
139
139
|
gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );
|
|
140
140
|
|
|
141
141
|
}
|
|
142
|
-
`)}function A0(){return
|
|
142
|
+
`)}function A0(){return _r("PMREMSphericalGaussianBlur",{envMap:{value:null},sigma:{value:0}},`
|
|
143
143
|
|
|
144
144
|
#define SAMPLES ${S0}
|
|
145
145
|
#define GOLDEN_ANGLE 2.39996322973
|
|
@@ -187,7 +187,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
187
187
|
gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
|
|
188
188
|
|
|
189
189
|
}
|
|
190
|
-
`)}function xd(){return
|
|
190
|
+
`)}function xd(){return _r("PMREMEquirectangularToCubemap",{envMap:{value:null}},`
|
|
191
191
|
|
|
192
192
|
varying vec3 vWorldDirection;
|
|
193
193
|
|
|
@@ -209,7 +209,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
209
209
|
gl_FragColor = vec4( color * 0.25, 1.0 );
|
|
210
210
|
|
|
211
211
|
}
|
|
212
|
-
`)}function vd(){return
|
|
212
|
+
`)}function vd(){return _r("PMREMCubemapToCubemap",{envMap:{value:null},flipEnvMap:{value:-1}},`
|
|
213
213
|
|
|
214
214
|
varying vec3 vWorldDirection;
|
|
215
215
|
|
|
@@ -221,7 +221,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
221
221
|
gl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 );
|
|
222
222
|
|
|
223
223
|
}
|
|
224
|
-
`)}function R0(e){let t=new WeakMap,n=new WeakMap,i=null;function s(d,f=!1){if(d===null||d===void 0)return null;if(f)return a(d);return r(d)}function r(d){if(d&&d.isTexture){let f=d.mapping;if(f===ea||f===ta)if(t.has(d)){let _=t.get(d).texture;return o(_,d.mapping)}else{let _=d.image;if(_&&_.height>0){let y=new Ba(_.height);return y.fromEquirectangularTexture(e,d),t.set(d,y),d.addEventListener("dispose",c),o(y.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture&&d.isPMREMTexture!==!0){let f=d.mapping,_=f===ea||f===ta,y=f===
|
|
224
|
+
`)}function R0(e){let t=new WeakMap,n=new WeakMap,i=null;function s(d,f=!1){if(d===null||d===void 0)return null;if(f)return a(d);return r(d)}function r(d){if(d&&d.isTexture){let f=d.mapping;if(f===ea||f===ta)if(t.has(d)){let _=t.get(d).texture;return o(_,d.mapping)}else{let _=d.image;if(_&&_.height>0){let y=new Ba(_.height);return y.fromEquirectangularTexture(e,d),t.set(d,y),d.addEventListener("dispose",c),o(y.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture&&d.isPMREMTexture!==!0){let f=d.mapping,_=f===ea||f===ta,y=f===Qs||f===gs;if(_||y){let p=n.get(d),m=p!==void 0?p.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==m){if(i===null)i=new Oa(e);return p=_?i.fromEquirectangular(d,p):i.fromCubemap(d,p),p.texture.pmremVersion=d.pmremVersion,n.set(d,p),p.texture}else if(p!==void 0)return p.texture;else{let M=d.image;if(_&&M&&M.height>0||y&&M&&l(M)){if(i===null)i=new Oa(e);return p=_?i.fromEquirectangular(d):i.fromCubemap(d),p.texture.pmremVersion=d.pmremVersion,n.set(d,p),d.addEventListener("dispose",h),p.texture}else return null}}}return d}function o(d,f){if(f===ea)d.mapping=Qs;else if(f===ta)d.mapping=gs;return d}function l(d){let f=0,_=6;for(let y=0;y<_;y++)if(d[y]!==void 0)f++;return f===_}function c(d){let f=d.target;f.removeEventListener("dispose",c);let _=t.get(f);if(_!==void 0)t.delete(f),_.dispose()}function h(d){let f=d.target;f.removeEventListener("dispose",h);let _=n.get(f);if(_!==void 0)n.delete(f),_.dispose()}function u(){if(t=new WeakMap,n=new WeakMap,i!==null)i.dispose(),i=null}return{get:s,dispose:u}}function C0(e){let t={};function n(i){if(t[i]!==void 0)return t[i];let s=e.getExtension(i);return t[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){let s=n(i);if(s===null)Di("WebGLRenderer: "+i+" extension not supported.");return s}}}function I0(e,t,n,i){let s={},r=new WeakMap,a=new FinalizationRegistry((_)=>delete s[_]);function o(_){l(_.target)}function l(_){if(_.index!==null)t.remove(_.index);for(let p in _.attributes)t.remove(_.attributes[p]);_.removeEventListener("dispose",o),delete s[_.id],a.unregister(_);let y=r.get(_);if(y)t.remove(y),r.delete(_);if(i.releaseStatesOfGeometry(_),_.isInstancedBufferGeometry===!0)delete _._maxInstanceCount;n.memory.geometries--}function c(_,y){if(s[y.id]!==void 0)return y;return y.addEventListener("dispose",o),s[y.id]=new WeakRef(y),a.register(y,y.id,y),n.memory.geometries++,y}function h(_){let y=_.attributes;for(let p in y)t.update(y[p],e.ARRAY_BUFFER)}function u(_){let y=_.index,p=_.attributes.position,m=0;if(p===void 0)return;let M=y!==null?y.array.length:p.array.length/3-1,b=new(p.count>=65535?ga:ma)(Math.ceil(M/3)*6,1),E=b.array;if(y!==null){let g=y.array;m=y.version;for(let S=0,P=0;S<M;S+=3){let z=g[S+0],N=g[S+1],H=g[S+2];E[P++]=z,E[P++]=N,E[P++]=N,E[P++]=H,E[P++]=H,E[P++]=z}}else{m=p.version;for(let g=0,S=0;g<M;g+=3){let P=g+0,z=g+1,N=g+2;E[S++]=P,E[S++]=z,E[S++]=z,E[S++]=N,E[S++]=N,E[S++]=P}}b.version=m;let A=r.get(_);if(A)t.remove(A);r.set(_,b)}function d(_){let y=r.get(_);if(y){let p=_.index;if(p!==null){if(y.version<p.version)u(_)}}else u(_);return r.get(_)}function f(){for(let _ in s){let y=s[_].deref();if(y!==void 0)l(y)}}return{get:c,update:h,getWireframeAttribute:d,dispose:f}}function P0(e,t,n){let i;function s(u){i=u}let r,a;function o(u){r=u.type,a=u.bytesPerElement}function l(u,d){e.drawElements(i,d,r,u*a),n.update(d,i,1)}function c(u,d,f){if(f===0)return;e.drawElementsInstanced(i,d,r,u*a,f),n.update(d,i,f)}function h(u,d,f){if(f===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,d,0,r,u,0,f);let y=0;for(let p=0;p<f;p++)y+=d[p];n.update(y,i,1)}this.setMode=s,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function L0(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,a,o){switch(n.calls++,a){case e.TRIANGLES:n.triangles+=o*(r/3);break;case e.LINES:n.lines+=o*(r/2);break;case e.LINE_STRIP:n.lines+=o*(r-1);break;case e.LINE_LOOP:n.lines+=o*r;break;case e.POINTS:n.points+=o*r;break;default:Le("WebGLInfo: Unknown draw mode:",a);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:s,update:i}}function N0(e,t,n){let i=new WeakMap,s=new tt;function r(a,o,l){let c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0,d=i.get(o);if(d===void 0||d.count!==u){let P=function(){g.dispose(),i.delete(o),o.removeEventListener("dispose",P)};if(d!==void 0)d.texture.dispose();let f=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],M=o.morphAttributes.color||[],T=0;if(f===!0)T=1;if(_===!0)T=2;if(y===!0)T=3;let b=o.attributes.position.count*T,E=1;if(b>t.maxTextureSize)E=Math.ceil(b/t.maxTextureSize),b=t.maxTextureSize;let A=new Float32Array(b*E*4*u),g=new fa(A,b,E,u);g.type=qn,g.needsUpdate=!0;let S=T*4;for(let z=0;z<u;z++){let N=p[z],H=m[z],Q=M[z],C=b*E*4*z;for(let Y=0;Y<N.count;Y++){let K=Y*S;if(f===!0)s.fromBufferAttribute(N,Y),A[C+K+0]=s.x,A[C+K+1]=s.y,A[C+K+2]=s.z,A[C+K+3]=0;if(_===!0)s.fromBufferAttribute(H,Y),A[C+K+4]=s.x,A[C+K+5]=s.y,A[C+K+6]=s.z,A[C+K+7]=0;if(y===!0)s.fromBufferAttribute(Q,Y),A[C+K+8]=s.x,A[C+K+9]=s.y,A[C+K+10]=s.z,A[C+K+11]=Q.itemSize===4?s.w:1}}d={count:u,texture:g,size:new ke(b,E)},i.set(o,d),o.addEventListener("dispose",P)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let f=0;for(let y=0;y<c.length;y++)f+=c[y];let _=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(e,"morphTargetBaseInfluence",_),l.getUniforms().setValue(e,"morphTargetInfluences",c)}l.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),l.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}return{update:r}}function D0(e,t,n,i,s){let r=new WeakMap;function a(c){let h=s.render.frame,u=c.geometry,d=t.get(c,u);if(r.get(d)!==h)t.update(d),r.set(d,h);if(c.isInstancedMesh){if(c.hasEventListener("dispose",l)===!1)c.addEventListener("dispose",l);if(r.get(c)!==h){if(n.update(c.instanceMatrix,e.ARRAY_BUFFER),c.instanceColor!==null)n.update(c.instanceColor,e.ARRAY_BUFFER);r.set(c,h)}}if(c.isSkinnedMesh){let f=c.skeleton;if(r.get(f)!==h)f.update(),r.set(f,h)}return d}function o(){r=new WeakMap}function l(c){let h=c.target;if(h.removeEventListener("dispose",l),i.releaseStatesOfObject(h),n.remove(h.instanceMatrix),h.instanceColor!==null)n.remove(h.instanceColor)}return{update:a,dispose:o}}function F0(e,t,n,i,s,r){let a=new hn(t,n,{type:e,depthBuffer:s,stencilBuffer:r,samples:i?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),o=null,l=null,c=null,h=new Yt;h.setAttribute("position",new Vt([-1,3,0,-1,-1,0,3,-1,0],3)),h.setAttribute("uv",new Vt([0,2,0,0,2,0],2));let u=new Zl({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
225
225
|
precision highp float;
|
|
226
226
|
|
|
227
227
|
uniform mat4 modelViewMatrix;
|
|
@@ -267,7 +267,7 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
267
267
|
#ifdef SRGB_TRANSFER
|
|
268
268
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
269
269
|
#endif
|
|
270
|
-
}`,depthTest:!1,depthWrite:!1}),d=new yt(h,u),f=new vi(-1,1,1,-1,0,1),_=null,y=null,p=!1,m,M=null,T=[],b=!1;this.setSize=function(E,A){if(a.setSize(E,A),o!==null)o.setSize(E,A);if(l!==null)l.setSize(E,A);for(let g=0;g<T.length;g++){let S=T[g];if(S.setSize)S.setSize(E,A)}},this.setEffects=function(E){T=E,b=T.length>0&&T[0].isRenderPass===!0;let{width:A,height:g}=a;if(T.length>0&&o===null)o=new hn(A,g,{type:Cn,depthBuffer:!1,stencilBuffer:!1}),l=new hn(A,g,{type:Cn,depthBuffer:!1,stencilBuffer:!1});let S=s===!0&&T.some((P)=>P.needsDepthTexture===!0);if(S!==(a.depthTexture!==null)){if(S===!0&&c===null){if(c=new pi(A,g),r===!0)c.format=di,c.type=ki}a.dispose(),a.depthTexture=S?c:null,a.resolveDepthBuffer=S,a.storeMultisampledDepthBuffer=S}for(let P=0;P<T.length;P++){let z=T[P];if(z.setSize)z.setSize(A,g);if(S&&z.needsDepthTexture===!0&&z.setDepthTexture)z.setDepthTexture(c)}},this.begin=function(E,A){if(p)return!1;if(E.toneMapping===Rn&&T.length===0)return!1;if(M=A,A!==null){let{width:g,height:S}=A;if(a.width!==g||a.height!==S)this.setSize(g,S)}if(b===!1)E.setRenderTarget(a);return m=E.toneMapping,E.toneMapping=Rn,!0},this.hasRenderPass=function(){return b},this.end=function(E,A){E.toneMapping=m,p=!0;let g=a,S=o;for(let P=0;P<T.length;P++){let z=T[P];if(z.enabled===!1)continue;if(z.render(E,S,g,A),z.needsSwap!==!1)g=S,S=S===o?l:o}if(_!==E.outputColorSpace||y!==E.toneMapping){if(_=E.outputColorSpace,y=E.toneMapping,u.defines={},He.getTransfer(_)===st)u.defines.SRGB_TRANSFER="";let P=U0[y];if(P)u.defines[P]="";u.needsUpdate=!0}u.uniforms.tDiffuse.value=g.texture,E.setRenderTarget(M),E.render(d,f),M=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){if(a.dispose(),o!==null)o.dispose();if(l!==null)l.dispose();h.dispose(),u.dispose()}}function Es(e,t,n){let i=e[0];if(i<=0||i>0)return e;let s=t*n,r=yd[s];if(r===void 0)r=new Float32Array(s),yd[s]=r;if(t!==0){i.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=n,e[a].toArray(r,o)}return r}function St(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function bt(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function ka(e,t){let n=Sd[t];if(n===void 0)n=new Int32Array(t),Sd[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function O0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function B0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2fv(this.addr,t),bt(n,t)}}function k0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(St(n,t))return;e.uniform3fv(this.addr,t),bt(n,t)}}function z0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4fv(this.addr,t),bt(n,t)}}function H0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;wd.set(i),e.uniformMatrix2fv(this.addr,!1,wd),bt(n,i)}}function G0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;Md.set(i),e.uniformMatrix3fv(this.addr,!1,Md),bt(n,i)}}function W0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;bd.set(i),e.uniformMatrix4fv(this.addr,!1,bd),bt(n,i)}}function V0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function X0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2iv(this.addr,t),bt(n,t)}}function $0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(St(n,t))return;e.uniform3iv(this.addr,t),bt(n,t)}}function q0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4iv(this.addr,t),bt(n,t)}}function Y0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function Z0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2uiv(this.addr,t),bt(n,t)}}function K0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(St(n,t))return;e.uniform3uiv(this.addr,t),bt(n,t)}}function J0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4uiv(this.addr,t),bt(n,t)}}function za(e){if(e.version===0)e.compareFunction=Bl,e.needsUpdate=!0;return e}function j0(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;let r;if(this.type===e.SAMPLER_2D_SHADOW)r=za(Gd);else r=Hd;n.setTexture2D(t||r,s)}function Q0(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;n.setTexture3D(t||Xd,s)}function ex(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;let r;if(this.type===e.SAMPLER_CUBE_SHADOW)r=za(Wd);else r=$d;n.setTextureCube(t||r,s)}function tx(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;n.setTexture2DArray(t||Vd,s)}function nx(e){switch(e){case 5126:return O0;case 35664:return B0;case 35665:return k0;case 35666:return z0;case 35674:return H0;case 35675:return G0;case 35676:return W0;case 5124:case 35670:return V0;case 35667:case 35671:return X0;case 35668:case 35672:return $0;case 35669:case 35673:return q0;case 5125:return Y0;case 36294:return Z0;case 36295:return K0;case 36296:return J0;case 35678:case 36198:case 36298:case 36306:case 35682:return j0;case 35679:case 36299:case 36307:return Q0;case 35680:case 36300:case 36308:case 36293:return ex;case 36289:case 36303:case 36311:case 36292:return tx}}function ix(e,t){e.uniform1fv(this.addr,t)}function sx(e,t){let n=Es(t,this.size,2);e.uniform2fv(this.addr,n)}function rx(e,t){let n=Es(t,this.size,3);e.uniform3fv(this.addr,n)}function ax(e,t){let n=Es(t,this.size,4);e.uniform4fv(this.addr,n)}function ox(e,t){let n=Es(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function lx(e,t){let n=Es(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function cx(e,t){let n=Es(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function hx(e,t){e.uniform1iv(this.addr,t)}function ux(e,t){e.uniform2iv(this.addr,t)}function dx(e,t){e.uniform3iv(this.addr,t)}function fx(e,t){e.uniform4iv(this.addr,t)}function px(e,t){e.uniform1uiv(this.addr,t)}function mx(e,t){e.uniform2uiv(this.addr,t)}function gx(e,t){e.uniform3uiv(this.addr,t)}function _x(e,t){e.uniform4uiv(this.addr,t)}function xx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);let a;if(this.type===e.SAMPLER_2D_SHADOW)a=za(Gd);else a=Hd;for(let o=0;o!==s;++o)n.setTexture2D(t[o]||a,r[o])}function vx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);for(let a=0;a!==s;++a)n.setTexture3D(t[a]||Xd,r[a])}function yx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);let a;if(this.type===e.SAMPLER_CUBE_SHADOW)a=za(Wd);else a=$d;for(let o=0;o!==s;++o)n.setTextureCube(t[o]||a,r[o])}function Sx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);for(let a=0;a!==s;++a)n.setTexture2DArray(t[a]||Vd,r[a])}function bx(e){switch(e){case 5126:return ix;case 35664:return sx;case 35665:return rx;case 35666:return ax;case 35674:return ox;case 35675:return lx;case 35676:return cx;case 5124:case 35670:return hx;case 35667:case 35671:return ux;case 35668:case 35672:return dx;case 35669:case 35673:return fx;case 5125:return px;case 36294:return mx;case 36295:return gx;case 36296:return _x;case 35678:case 36198:case 36298:case 36306:case 35682:return xx;case 35679:case 36299:case 36307:return vx;case 35680:case 36300:case 36308:case 36293:return yx;case 36289:case 36303:case 36311:case 36292:return Sx}}class qd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=nx(t.type)}}class Yd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=bx(t.type)}}class Zd{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let s=0,r=i.length;s!==r;++s){let a=i[s];a.setValue(e,t[a.id],n)}}}function Td(e,t){e.seq.push(t),e.map[t.id]=t}function Mx(e,t,n){let i=e.name,s=i.length;hc.lastIndex=0;while(!0){let r=hc.exec(i),a=hc.lastIndex,o=r[1],l=r[2]==="]",c=r[3];if(l)o=o|0;if(c===void 0||c==="["&&a+2===s){Td(n,c===void 0?new qd(o,e,t):new Yd(o,e,t));break}else{let u=n.map[o];if(u===void 0)u=new Zd(o),Td(n,u);n=u}}}class mr{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let a=e.getActiveUniform(t,r),o=e.getUniformLocation(t,a.name);Mx(a,o,this)}let i=[],s=[];for(let r of this.seq)if(r.type===e.SAMPLER_2D_SHADOW||r.type===e.SAMPLER_CUBE_SHADOW||r.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(r);else s.push(r);if(i.length>0)this.seq=i.concat(s)}setValue(e,t,n,i){let s=this.map[t];if(s!==void 0)s.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,r=t.length;s!==r;++s){let a=t[s],o=n[a.id];if(o.needsUpdate!==!1)a.setValue(e,o.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,s=e.length;i!==s;++i){let r=e[i];if(r.id in t)n.push(r)}return n}}function Ed(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}function Ex(e,t){let n=e.split(`
|
|
270
|
+
}`,depthTest:!1,depthWrite:!1}),d=new yt(h,u),f=new vi(-1,1,1,-1,0,1),_=null,y=null,p=!1,m,M=null,T=[],b=!1;this.setSize=function(E,A){if(a.setSize(E,A),o!==null)o.setSize(E,A);if(l!==null)l.setSize(E,A);for(let g=0;g<T.length;g++){let S=T[g];if(S.setSize)S.setSize(E,A)}},this.setEffects=function(E){T=E,b=T.length>0&&T[0].isRenderPass===!0;let{width:A,height:g}=a;if(T.length>0&&o===null)o=new hn(A,g,{type:Cn,depthBuffer:!1,stencilBuffer:!1}),l=new hn(A,g,{type:Cn,depthBuffer:!1,stencilBuffer:!1});let S=s===!0&&T.some((P)=>P.needsDepthTexture===!0);if(S!==(a.depthTexture!==null)){if(S===!0&&c===null){if(c=new pi(A,g),r===!0)c.format=di,c.type=ki}a.dispose(),a.depthTexture=S?c:null,a.resolveDepthBuffer=S,a.storeMultisampledDepthBuffer=S}for(let P=0;P<T.length;P++){let z=T[P];if(z.setSize)z.setSize(A,g);if(S&&z.needsDepthTexture===!0&&z.setDepthTexture)z.setDepthTexture(c)}},this.begin=function(E,A){if(p)return!1;if(E.toneMapping===Rn&&T.length===0)return!1;if(M=A,A!==null){let{width:g,height:S}=A;if(a.width!==g||a.height!==S)this.setSize(g,S)}if(b===!1)E.setRenderTarget(a);return m=E.toneMapping,E.toneMapping=Rn,!0},this.hasRenderPass=function(){return b},this.end=function(E,A){E.toneMapping=m,p=!0;let g=a,S=o;for(let P=0;P<T.length;P++){let z=T[P];if(z.enabled===!1)continue;if(z.render(E,S,g,A),z.needsSwap!==!1)g=S,S=S===o?l:o}if(_!==E.outputColorSpace||y!==E.toneMapping){if(_=E.outputColorSpace,y=E.toneMapping,u.defines={},He.getTransfer(_)===st)u.defines.SRGB_TRANSFER="";let P=U0[y];if(P)u.defines[P]="";u.needsUpdate=!0}u.uniforms.tDiffuse.value=g.texture,E.setRenderTarget(M),E.render(d,f),M=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){if(a.dispose(),o!==null)o.dispose();if(l!==null)l.dispose();h.dispose(),u.dispose()}}function Es(e,t,n){let i=e[0];if(i<=0||i>0)return e;let s=t*n,r=yd[s];if(r===void 0)r=new Float32Array(s),yd[s]=r;if(t!==0){i.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=n,e[a].toArray(r,o)}return r}function St(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function bt(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function ka(e,t){let n=Sd[t];if(n===void 0)n=new Int32Array(t),Sd[t]=n;for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function O0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1f(this.addr,t),n[0]=t}function B0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2fv(this.addr,t),bt(n,t)}}function k0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else if(t.r!==void 0){if(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b}else{if(St(n,t))return;e.uniform3fv(this.addr,t),bt(n,t)}}function z0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4fv(this.addr,t),bt(n,t)}}function H0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;wd.set(i),e.uniformMatrix2fv(this.addr,!1,wd),bt(n,i)}}function G0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;Md.set(i),e.uniformMatrix3fv(this.addr,!1,Md),bt(n,i)}}function W0(e,t){let n=this.cache,i=t.elements;if(i===void 0){if(St(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),bt(n,t)}else{if(St(n,i))return;bd.set(i),e.uniformMatrix4fv(this.addr,!1,bd),bt(n,i)}}function V0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1i(this.addr,t),n[0]=t}function X0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2iv(this.addr,t),bt(n,t)}}function $0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(St(n,t))return;e.uniform3iv(this.addr,t),bt(n,t)}}function q0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4iv(this.addr,t),bt(n,t)}}function Y0(e,t){let n=this.cache;if(n[0]===t)return;e.uniform1ui(this.addr,t),n[0]=t}function Z0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y)e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y}else{if(St(n,t))return;e.uniform2uiv(this.addr,t),bt(n,t)}}function K0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z}else{if(St(n,t))return;e.uniform3uiv(this.addr,t),bt(n,t)}}function J0(e,t){let n=this.cache;if(t.x!==void 0){if(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w}else{if(St(n,t))return;e.uniform4uiv(this.addr,t),bt(n,t)}}function za(e){if(e.version===0)e.compareFunction=Bl,e.needsUpdate=!0;return e}function j0(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;let r;if(this.type===e.SAMPLER_2D_SHADOW)r=za(Gd);else r=Hd;n.setTexture2D(t||r,s)}function Q0(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;n.setTexture3D(t||Xd,s)}function ex(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;let r;if(this.type===e.SAMPLER_CUBE_SHADOW)r=za(Wd);else r=$d;n.setTextureCube(t||r,s)}function tx(e,t,n){let i=this.cache,s=n.allocateTextureUnit();if(i[0]!==s)e.uniform1i(this.addr,s),i[0]=s;n.setTexture2DArray(t||Vd,s)}function nx(e){switch(e){case 5126:return O0;case 35664:return B0;case 35665:return k0;case 35666:return z0;case 35674:return H0;case 35675:return G0;case 35676:return W0;case 5124:case 35670:return V0;case 35667:case 35671:return X0;case 35668:case 35672:return $0;case 35669:case 35673:return q0;case 5125:return Y0;case 36294:return Z0;case 36295:return K0;case 36296:return J0;case 35678:case 36198:case 36298:case 36306:case 35682:return j0;case 35679:case 36299:case 36307:return Q0;case 35680:case 36300:case 36308:case 36293:return ex;case 36289:case 36303:case 36311:case 36292:return tx}}function ix(e,t){e.uniform1fv(this.addr,t)}function sx(e,t){let n=Es(t,this.size,2);e.uniform2fv(this.addr,n)}function rx(e,t){let n=Es(t,this.size,3);e.uniform3fv(this.addr,n)}function ax(e,t){let n=Es(t,this.size,4);e.uniform4fv(this.addr,n)}function ox(e,t){let n=Es(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function lx(e,t){let n=Es(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function cx(e,t){let n=Es(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function hx(e,t){e.uniform1iv(this.addr,t)}function ux(e,t){e.uniform2iv(this.addr,t)}function dx(e,t){e.uniform3iv(this.addr,t)}function fx(e,t){e.uniform4iv(this.addr,t)}function px(e,t){e.uniform1uiv(this.addr,t)}function mx(e,t){e.uniform2uiv(this.addr,t)}function gx(e,t){e.uniform3uiv(this.addr,t)}function _x(e,t){e.uniform4uiv(this.addr,t)}function xx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);let a;if(this.type===e.SAMPLER_2D_SHADOW)a=za(Gd);else a=Hd;for(let o=0;o!==s;++o)n.setTexture2D(t[o]||a,r[o])}function vx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);for(let a=0;a!==s;++a)n.setTexture3D(t[a]||Xd,r[a])}function yx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);let a;if(this.type===e.SAMPLER_CUBE_SHADOW)a=za(Wd);else a=$d;for(let o=0;o!==s;++o)n.setTextureCube(t[o]||a,r[o])}function Sx(e,t,n){let i=this.cache,s=t.length,r=ka(n,s);if(!St(i,r))e.uniform1iv(this.addr,r),bt(i,r);for(let a=0;a!==s;++a)n.setTexture2DArray(t[a]||Vd,r[a])}function bx(e){switch(e){case 5126:return ix;case 35664:return sx;case 35665:return rx;case 35666:return ax;case 35674:return ox;case 35675:return lx;case 35676:return cx;case 5124:case 35670:return hx;case 35667:case 35671:return ux;case 35668:case 35672:return dx;case 35669:case 35673:return fx;case 5125:return px;case 36294:return mx;case 36295:return gx;case 36296:return _x;case 35678:case 36198:case 36298:case 36306:case 35682:return xx;case 35679:case 36299:case 36307:return vx;case 35680:case 36300:case 36308:case 36293:return yx;case 36289:case 36303:case 36311:case 36292:return Sx}}class qd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=nx(t.type)}}class Yd{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=bx(t.type)}}class Zd{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let s=0,r=i.length;s!==r;++s){let a=i[s];a.setValue(e,t[a.id],n)}}}function Td(e,t){e.seq.push(t),e.map[t.id]=t}function Mx(e,t,n){let i=e.name,s=i.length;hc.lastIndex=0;while(!0){let r=hc.exec(i),a=hc.lastIndex,o=r[1],l=r[2]==="]",c=r[3];if(l)o=o|0;if(c===void 0||c==="["&&a+2===s){Td(n,c===void 0?new qd(o,e,t):new Yd(o,e,t));break}else{let u=n.map[o];if(u===void 0)u=new Zd(o),Td(n,u);n=u}}}class gr{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let a=e.getActiveUniform(t,r),o=e.getUniformLocation(t,a.name);Mx(a,o,this)}let i=[],s=[];for(let r of this.seq)if(r.type===e.SAMPLER_2D_SHADOW||r.type===e.SAMPLER_CUBE_SHADOW||r.type===e.SAMPLER_2D_ARRAY_SHADOW)i.push(r);else s.push(r);if(i.length>0)this.seq=i.concat(s)}setValue(e,t,n,i){let s=this.map[t];if(s!==void 0)s.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];if(i!==void 0)this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,r=t.length;s!==r;++s){let a=t[s],o=n[a.id];if(o.needsUpdate!==!1)a.setValue(e,o.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,s=e.length;i!==s;++i){let r=e[i];if(r.id in t)n.push(r)}return n}}function Ed(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}function Ex(e,t){let n=e.split(`
|
|
271
271
|
`),i=[],s=Math.max(t-6,0),r=Math.min(t+6,n.length);for(let a=s;a<r;a++){let o=a+1;i.push(`${o===t?">":" "} ${o}: ${n[a]}`)}return i.join(`
|
|
272
272
|
`)}function Ax(e){He._getMatrix(Ad,He.workingColorSpace,e);let t=`mat3( ${Ad.elements.map((n)=>n.toFixed(4))} )`;switch(He.getTransfer(e)){case Ul:return[t,"LinearTransferOETF"];case st:return[t,"sRGBTransferOETF"];default:return Te("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function Rd(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&r==="")return"";let a=/ERROR: 0:(\d+)/.exec(r);if(a){let o=parseInt(a[1]);return n.toUpperCase()+`
|
|
273
273
|
|
|
@@ -275,9 +275,9 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
275
275
|
|
|
276
276
|
`+Ex(e.getShaderSource(t),o)}else return r}function Rx(e,t){let n=Ax(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( ${n[0]} * value.rgb, value.a ) );`,"}"].join(`
|
|
277
277
|
`)}function Ix(e,t){let n=Cx[t];if(n===void 0)return Te("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Px(){He.getLuminanceCoefficients(Fa);let e=Fa.x.toFixed(4),t=Fa.y.toFixed(4),n=Fa.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`,"\treturn dot( weights, rgb );","}"].join(`
|
|
278
|
-
`)}function Lx(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(
|
|
278
|
+
`)}function Lx(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(mr).join(`
|
|
279
279
|
`)}function Nx(e){let t=[];for(let n in e){let i=e[n];if(i===!1)continue;t.push("#define "+n+" "+i)}return t.join(`
|
|
280
|
-
`)}function Dx(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let r=e.getActiveAttrib(t,s),a=r.name,o=1;if(r.type===e.FLOAT_MAT2)o=2;if(r.type===e.FLOAT_MAT3)o=3;if(r.type===e.FLOAT_MAT4)o=4;n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}function
|
|
280
|
+
`)}function Dx(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){let r=e.getActiveAttrib(t,s),a=r.name,o=1;if(r.type===e.FLOAT_MAT2)o=2;if(r.type===e.FLOAT_MAT3)o=3;if(r.type===e.FLOAT_MAT4)o=4;n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}function mr(e){return e!==""}function Cd(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_SUN_LIGHTS/g,t.numSunLights).replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,t.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows).replace(/NUM_LIGHT_PROBE_GRIDS/g,t.numLightProbeGrids)}function Id(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function dc(e){return e.replace(Ux,Fx)}function Fx(e,t){let n=ze[t];if(n===void 0)throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">");return dc(n)}function Pd(e){return e.replace(Ox,Bx)}function Bx(e,t,n,i){let s="";for(let r=parseInt(t);r<parseInt(n);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Ld(e){let t=`precision ${e.precision} float;
|
|
281
281
|
precision ${e.precision} int;
|
|
282
282
|
precision ${e.precision} sampler2D;
|
|
283
283
|
precision ${e.precision} samplerCube;
|
|
@@ -298,14 +298,14 @@ var On=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(i){n=[i]}if(n)throw n[0];return t};
|
|
|
298
298
|
#define HIGH_PRECISION`;else if(e.precision==="mediump")t+=`
|
|
299
299
|
#define MEDIUM_PRECISION`;else if(e.precision==="lowp")t+=`
|
|
300
300
|
#define LOW_PRECISION`;return t}function zx(e){return kx[e.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}function Gx(e){if(e.envMap===!1)return"ENVMAP_MODE_REFLECTION";return Hx[e.envMapMode]||"ENVMAP_MODE_REFLECTION"}function Vx(e){if(e.envMap===!1)return"ENVMAP_BLENDING_NONE";return Wx[e.combine]||"ENVMAP_BLENDING_NONE"}function Xx(e,t,n,i){let s=e.getContext(),{defines:r,vertexShader:a,fragmentShader:o}=n,l=zx(n),c=n.envMapPMREM===!0?"ENVMAP_TYPE_PMREM":"ENVMAP_TYPE_CUBE",h=Gx(n),u=Vx(n),d=Lx(n),f=Nx(r),_=s.createProgram(),y,p,m=n.glslVersion?"#version "+n.glslVersion+`
|
|
301
|
-
`:"";if(n.isRawShaderMaterial){if(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(
|
|
301
|
+
`:"";if(n.isRawShaderMaterial){if(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(mr).join(`
|
|
302
302
|
`),y.length>0)y+=`
|
|
303
|
-
`;if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(
|
|
303
|
+
`;if(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(mr).join(`
|
|
304
304
|
`),p.length>0)p+=`
|
|
305
305
|
`}else y=[Ld(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+n.diffuseRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",`
|
|
306
|
-
`].filter(
|
|
306
|
+
`].filter(mr).join(`
|
|
307
307
|
`),p=[Ld(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.envMapPMREM?"#define ENVMAP_MAX_LOD "+n.envMapMaxLod+".0":"",n.envMapPMREM?"#define ENVMAP_SIZE "+n.envMapSize+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",n.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.retroreflection?"#define USE_RETROREFLECTION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Rn?"#define TONE_MAPPING":"",n.toneMapping!==Rn?ze.tonemapping_pars_fragment:"",n.toneMapping!==Rn?Ix("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,Rx("linearToOutputTexel",n.outputColorSpace),Px(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
|
308
|
-
`].filter(
|
|
308
|
+
`].filter(mr).join(`
|
|
309
309
|
`);if(a=dc(a),a=Cd(a,n),a=Id(a,n),o=dc(o),o=Cd(o,n),o=Id(o,n),a=Pd(a),o=Pd(o),n.isRawShaderMaterial!==!0)m=`#version 300 es
|
|
310
310
|
`,y=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
311
311
|
`)+`
|
|
@@ -318,7 +318,7 @@ Material Type: `+z.type+`
|
|
|
318
318
|
|
|
319
319
|
Program Info Log: `+C+`
|
|
320
320
|
`+V+`
|
|
321
|
-
`+j)}else if(C!=="")Te("WebGLProgram: Program Info Log:",C);else if(Y===""||K==="")ae=!1;if(ae)z.diagnostics={runnable:B,programLog:C,vertexShader:{log:Y,prefix:y},fragmentShader:{log:K,prefix:p}}}s.deleteShader(b),s.deleteShader(E),g=new mr(s,_),S=Dx(s,_)}let g;this.getUniforms=function(){if(g===void 0)A(this);return g};let S;this.getAttributes=function(){if(S===void 0)A(this);return S};let P=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(P===!1)P=s.getProgramParameter(_,wx);return P},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Tx++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=E,this}class Kd{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new Jd(e),t.set(e,n);return n}}class Jd{constructor(e){this.id=$x++,this.code=e,this.usedTimes=0}}function qx(e){return e===zi||e===la||e===ca}function Yx(e,t,n,i,s,r){let a=new nr,o=new Kd,l=new Set,c=[],h=new Map,u=i.logarithmicDepthBuffer,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(g){if(l.add(g),g===0)return"uv";return`uv${g}`}function _(g,S,P,z,N,H){let Q=z.fog,C=N.geometry,Y=g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial?z.environment:null,K=g.isMeshStandardMaterial||g.isMeshLambertMaterial&&!g.envMap||g.isMeshPhongMaterial&&!g.envMap,B=t.get(g.envMap||Y,K),ae=d[g.type],V=i.precision;if(g.precision!==null){if(V=i.getMaxPrecision(g.precision),V!==g.precision)Te("WebGLProgram.getParameters:",g.precision,"not supported, using",V,"instead.")}let j=C.morphAttributes.position||C.morphAttributes.normal||C.morphAttributes.color,ie=j!==void 0?j.length:0,be=0;if(C.morphAttributes.position!==void 0)be=1;if(C.morphAttributes.normal!==void 0)be=2;if(C.morphAttributes.color!==void 0)be=3;let Z,ne,ye,Ce;if(ae){let me=Nn[ae];Z=me.vertexShader,ne=me.fragmentShader}else{Z=g.vertexShader,ne=g.fragmentShader;let me=o.getVertexShaderStage(g),et=o.getFragmentShaderStage(g);o.update(g,me,et),ye=me.id,Ce=et.id}let Ie=e.getRenderTarget(),Se=e.state.buffers.depth.getReversed(),je=N.isInstancedMesh===!0,We=N.isBatchedMesh===!0,Oe=!!g.map,lt=!!g.matcap,qe=!!B,dt=qe&&B.isPMREMTexture===!0,gt=!!g.aoMap,kt=!!g.lightMap,Zt=!!g.bumpMap&&g.wireframe===!1,_t=!!g.normalMap,Rt=!!g.displacementMap,zt=!!g.emissiveMap,Ht=!!g.metalnessMap,dn=!!g.roughnessMap,L=g.anisotropy>0,fn=g.clearcoat>0,Qe=g.diffuseRoughness>0,Mt=g.dispersion>0,de=g.retroreflectivity>0,rt=g.iridescence>0,Pe=g.sheen>0,De=g.transmission>0,Ct=L&&!!g.anisotropyMap,w=fn&&!!g.clearcoatMap,x=fn&&!!g.clearcoatNormalMap,U=fn&&!!g.clearcoatRoughnessMap,ee=Qe&&!!g.diffuseRoughnessMap,J=rt&&!!g.iridescenceMap,re=rt&&!!g.iridescenceThicknessMap,ce=Pe&&!!g.sheenColorMap,G=Pe&&!!g.sheenRoughnessMap,q=!!g.specularMap,oe=!!g.specularColorMap,R=!!g.specularIntensityMap,X=De&&!!g.transmissionMap,W=De&&!!g.thicknessMap,te=!!g.gradientMap,se=!!g.alphaMap,ue=g.alphaTest>0,Ae=!!g.alphaHash,we=!!g.extensions,pe=Rn;if(g.toneMapped){if(Ie===null||Ie.isXRRenderTarget===!0)pe=e.toneMapping}let Re=dt?B.isCompressedCubeTexture?B.image[0].mipmaps:B.mipmaps:null,Be={shaderID:ae,shaderType:g.type,shaderName:g.name,vertexShader:Z,fragmentShader:ne,defines:g.defines,customVertexShaderID:ye,customFragmentShaderID:Ce,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:V,batching:We,batchingColor:We&&N._colorsTexture!==null,instancing:je,instancingColor:je&&N.instanceColor!==null,instancingMorph:je&&N.morphTexture!==null,outputColorSpace:Ie===null?e.outputColorSpace:Ie.isXRRenderTarget===!0?Ie.texture.colorSpace:He.workingColorSpace,alphaToCoverage:!!g.alphaToCoverage,map:Oe,matcap:lt,envMap:qe,envMapMode:qe&&B.mapping,envMapPMREM:dt,envMapMaxLod:dt?Re.length-1:null,envMapSize:dt?Re[0].width:null,aoMap:gt,lightMap:kt,bumpMap:Zt,normalMap:_t,displacementMap:Rt,emissiveMap:zt,normalMapObjectSpace:_t&&g.normalMapType===Ku,normalMapTangentSpace:_t&&g.normalMapType===Dl,packedNormalMap:_t&&g.normalMapType===Dl&&qx(g.normalMap.format),metalnessMap:Ht,roughnessMap:dn,anisotropy:L,anisotropyMap:Ct,clearcoat:fn,clearcoatMap:w,clearcoatNormalMap:x,clearcoatRoughnessMap:U,diffuseRoughness:Qe,diffuseRoughnessMap:ee,dispersion:Mt,retroreflection:de,iridescence:rt,iridescenceMap:J,iridescenceThicknessMap:re,sheen:Pe,sheenColorMap:ce,sheenRoughnessMap:G,specularMap:q,specularColorMap:oe,specularIntensityMap:R,transmission:De,transmissionMap:X,thicknessMap:W,gradientMap:te,opaque:g.transparent===!1&&g.blending===Ks&&g.alphaToCoverage===!1,alphaMap:se,alphaTest:ue,alphaHash:Ae,combine:g.combine,mapUv:Oe&&f(g.map.channel),aoMapUv:gt&&f(g.aoMap.channel),lightMapUv:kt&&f(g.lightMap.channel),bumpMapUv:Zt&&f(g.bumpMap.channel),normalMapUv:_t&&f(g.normalMap.channel),displacementMapUv:Rt&&f(g.displacementMap.channel),emissiveMapUv:zt&&f(g.emissiveMap.channel),metalnessMapUv:Ht&&f(g.metalnessMap.channel),roughnessMapUv:dn&&f(g.roughnessMap.channel),anisotropyMapUv:Ct&&f(g.anisotropyMap.channel),clearcoatMapUv:w&&f(g.clearcoatMap.channel),clearcoatNormalMapUv:x&&f(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:U&&f(g.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:ee&&f(g.diffuseRoughnessMap.channel),iridescenceMapUv:J&&f(g.iridescenceMap.channel),iridescenceThicknessMapUv:re&&f(g.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&f(g.sheenColorMap.channel),sheenRoughnessMapUv:G&&f(g.sheenRoughnessMap.channel),specularMapUv:q&&f(g.specularMap.channel),specularColorMapUv:oe&&f(g.specularColorMap.channel),specularIntensityMapUv:R&&f(g.specularIntensityMap.channel),transmissionMapUv:X&&f(g.transmissionMap.channel),thicknessMapUv:W&&f(g.thicknessMap.channel),alphaMapUv:se&&f(g.alphaMap.channel),vertexTangents:!!C.attributes.tangent&&(_t||L),vertexNormals:!!C.attributes.normal,vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!C.attributes.color&&C.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!C.attributes.uv&&(Oe||se),fog:!!Q,useFog:g.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:g.wireframe===!1&&(g.flatShading===!0||C.attributes.normal===void 0&&_t===!1&&(g.isMeshLambertMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isMeshPhysicalMaterial)),sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Se,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:C.attributes.position!==void 0,morphTargets:C.morphAttributes.position!==void 0,morphNormals:C.morphAttributes.normal!==void 0,morphColors:C.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:be,numSunLights:S.sun.length,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numSunLightShadows:S.sunShadowMap.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:H.filter((me)=>me.texture!==null).length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:g.dithering,shadowMapEnabled:e.shadowMap.enabled&&P.length>0,shadowMapType:e.shadowMap.type,toneMapping:pe,decodeVideoTexture:Oe&&g.map.isVideoTexture===!0&&He.getTransfer(g.map.colorSpace)===st,decodeVideoTextureEmissive:zt&&g.emissiveMap.isVideoTexture===!0&&He.getTransfer(g.emissiveMap.colorSpace)===st,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===$t,flipSided:g.side===Xt,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:we&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&g.extensions.multiDraw===!0||We)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return Be.vertexUv1s=l.has(1),Be.vertexUv2s=l.has(2),Be.vertexUv3s=l.has(3),l.clear(),Be}function y(g){let S=[];if(g.shaderID)S.push(g.shaderID);else S.push(g.customVertexShaderID),S.push(g.customFragmentShaderID);if(g.defines!==void 0)for(let P in g.defines)S.push(P),S.push(g.defines[P]);if(g.isRawShaderMaterial===!1)p(S,g),m(S,g),S.push(e.outputColorSpace);return S.push(g.customProgramCacheKey),S.join()}function p(g,S){g.push(S.precision),g.push(S.outputColorSpace),g.push(S.envMapMode),g.push(S.envMapPMREM),g.push(S.envMapMaxLod),g.push(S.envMapSize),g.push(S.mapUv),g.push(S.alphaMapUv),g.push(S.lightMapUv),g.push(S.aoMapUv),g.push(S.bumpMapUv),g.push(S.normalMapUv),g.push(S.displacementMapUv),g.push(S.emissiveMapUv),g.push(S.metalnessMapUv),g.push(S.roughnessMapUv),g.push(S.anisotropyMapUv),g.push(S.clearcoatMapUv),g.push(S.clearcoatNormalMapUv),g.push(S.clearcoatRoughnessMapUv),g.push(S.diffuseRoughnessMapUv),g.push(S.iridescenceMapUv),g.push(S.iridescenceThicknessMapUv),g.push(S.sheenColorMapUv),g.push(S.sheenRoughnessMapUv),g.push(S.specularMapUv),g.push(S.specularColorMapUv),g.push(S.specularIntensityMapUv),g.push(S.transmissionMapUv),g.push(S.thicknessMapUv),g.push(S.combine),g.push(S.fogExp2),g.push(S.sizeAttenuation),g.push(S.morphTargetsCount),g.push(S.numSunLights),g.push(S.numDirLights),g.push(S.numPointLights),g.push(S.numSpotLights),g.push(S.numSpotLightMaps),g.push(S.numHemiLights),g.push(S.numRectAreaLights),g.push(S.numSunLightShadows),g.push(S.numDirLightShadows),g.push(S.numPointLightShadows),g.push(S.numSpotLightShadows),g.push(S.numSpotLightShadowsWithMaps),g.push(S.numLightProbes),g.push(S.numLightProbeGrids),g.push(S.shadowMapType),g.push(S.toneMapping),g.push(S.numClippingPlanes),g.push(S.numClipIntersection),g.push(S.depthPacking)}function m(g,S){if(a.disableAll(),S.instancing)a.enable(0);if(S.instancingColor)a.enable(1);if(S.instancingMorph)a.enable(2);if(S.matcap)a.enable(3);if(S.envMap)a.enable(4);if(S.normalMapObjectSpace)a.enable(5);if(S.normalMapTangentSpace)a.enable(6);if(S.clearcoat)a.enable(7);if(S.iridescence)a.enable(8);if(S.alphaTest)a.enable(9);if(S.vertexColors)a.enable(10);if(S.vertexAlphas)a.enable(11);if(S.vertexUv1s)a.enable(12);if(S.vertexUv2s)a.enable(13);if(S.vertexUv3s)a.enable(14);if(S.vertexTangents)a.enable(15);if(S.anisotropy)a.enable(16);if(S.alphaHash)a.enable(17);if(S.batching)a.enable(18);if(S.dispersion)a.enable(19);if(S.retroreflection)a.enable(24);if(S.diffuseRoughness)a.enable(25);if(S.batchingColor)a.enable(20);if(S.gradientMap)a.enable(21);if(S.packedNormalMap)a.enable(22);if(S.vertexNormals)a.enable(23);if(g.push(a.mask),a.disableAll(),S.fog)a.enable(0);if(S.useFog)a.enable(1);if(S.flatShading)a.enable(2);if(S.logarithmicDepthBuffer)a.enable(3);if(S.reversedDepthBuffer)a.enable(4);if(S.skinning)a.enable(5);if(S.morphTargets)a.enable(6);if(S.morphNormals)a.enable(7);if(S.morphColors)a.enable(8);if(S.premultipliedAlpha)a.enable(9);if(S.shadowMapEnabled)a.enable(10);if(S.doubleSided)a.enable(11);if(S.flipSided)a.enable(12);if(S.useDepthPacking)a.enable(13);if(S.dithering)a.enable(14);if(S.transmission)a.enable(15);if(S.sheen)a.enable(16);if(S.opaque)a.enable(17);if(S.pointsUvs)a.enable(18);if(S.decodeVideoTexture)a.enable(19);if(S.decodeVideoTextureEmissive)a.enable(20);if(S.alphaToCoverage)a.enable(21);if(S.numLightProbeGrids>0)a.enable(22);if(S.hasPositionAttribute)a.enable(23);g.push(a.mask)}function M(g){let S=d[g.type],P;if(S){let z=Nn[S];P=od.clone(z.uniforms)}else P=g.uniforms;return P}function T(g,S){let P=h.get(S);if(P!==void 0)++P.usedTimes;else P=new Xx(e,S,g,s),c.push(P),h.set(S,P);return P}function b(g){if(--g.usedTimes===0){let S=c.indexOf(g);c[S]=c[c.length-1],c.pop(),h.delete(g.cacheKey),g.destroy()}}function E(g){o.remove(g)}function A(){o.dispose()}return{getParameters:_,getProgramCacheKey:y,getUniforms:M,acquireProgram:T,releaseProgram:b,releaseShaderCache:E,programs:c,dispose:A}}function Zx(){let e=new WeakMap;function t(a){return e.has(a)}function n(a){let o=e.get(a);if(o===void 0)o={},e.set(a,o);return o}function i(a){e.delete(a)}function s(a,o,l){e.get(a)[o]=l}function r(){e=new WeakMap}return{has:t,get:n,remove:i,update:s,dispose:r}}function Kx(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function Nd(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function Dd(){let e=[],t=0,n=[],i=[],s=[];function r(){t=0,n.length=0,i.length=0,s.length=0}function a(d){let f=0;if(d.isInstancedMesh)f+=2;if(d.isSkinnedMesh)f+=1;return f}function o(d,f,_,y,p,m){let M=e[t];if(M===void 0)M={id:d.id,object:d,geometry:f,material:_,materialVariant:a(d),groupOrder:y,renderOrder:d.renderOrder,z:p,group:m},e[t]=M;else M.id=d.id,M.object=d,M.geometry=f,M.material=_,M.materialVariant=a(d),M.groupOrder=y,M.renderOrder=d.renderOrder,M.z=p,M.group=m;return t++,M}function l(d,f,_,y,p,m,M){if(M.reversedDepth===!0)p=-p;let T=o(d,f,_,y,p,m);if(_.transmission>0)i.push(T);else if(_.transparent===!0)s.push(T);else n.push(T)}function c(d,f,_,y,p,m){let M=o(d,f,_,y,p,m);if(_.transmission>0)i.unshift(M);else if(_.transparent===!0)s.unshift(M);else n.unshift(M)}function h(d,f){if(n.length>1)n.sort(d||Kx);if(i.length>1)i.sort(f||Nd);if(s.length>1)s.sort(f||Nd)}function u(){for(let d=t,f=e.length;d<f;d++){let _=e[d];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:s,init:r,push:l,unshift:c,finish:u,sort:h}}function Jx(){let e=new WeakMap;function t(i,s){let r=e.get(i),a;if(r===void 0)a=new Dd,e.set(i,[a]);else if(s>=r.length)a=new Dd,r.push(a);else a=r[s];return a}function n(){e=new WeakMap}return{get:t,dispose:n}}function jx(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"SunLight":case"DirectionalLight":n={direction:new D,color:new Ee};break;case"SpotLight":n={position:new D,direction:new D,color:new Ee,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new D,color:new Ee,distance:0,decay:0};break;case"HemisphereLight":n={direction:new D,skyColor:new Ee,groundColor:new Ee};break;case"RectAreaLight":n={color:new Ee,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function Qx(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"SunLight":case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke,shadowCameraNear:1,shadowCameraFar:1000};break}return e[t.id]=n,n}}}function tv(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function nv(e){let t=new jx,n=Qx(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new D);let s=new D,r=new Fe,a=new Fe;function o(c){let h=0,u=0,d=0;for(let H=0;H<9;H++)i.probe[H].set(0,0,0);let f=0,_=0,y=0,p=0,m=0,M=0,T=0,b=0,E=0,A=0,g=0,S=0,P=0,z=0;c.sort(tv);for(let H=0,Q=c.length;H<Q;H++){let C=c[H],{color:Y,intensity:K,distance:B}=C,ae=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===zi)ae=C.shadow.map.texture;else ae=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)h+=Y.r*K,u+=Y.g*K,d+=Y.b*K;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],K);z++}else if(C.isSunLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize.copy(j.mapSize).multiply(j.getFrameExtents()),i.sunShadow[_]=ie,i.sunShadowMap[_]=ae;let be=j.getViewportCount();for(let Z=0;Z<be;Z++)i.sunShadowMatrix[y+Z]=j.getMatrix(Z),i.sunShadowCascade[y+Z]=j._cascadeData[Z];y+=be,_++}i.sun[f]=V,f++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,i.directionalShadow[p]=ie,i.directionalShadowMap[p]=ae,i.directionalShadowMatrix[p]=C.shadow.matrix,E++}i.directional[p]=V,p++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(Y).multiplyScalar(K),V.distance=B,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[M]=V;let j=C.shadow;if(C.map){if(i.spotLightMap[S]=C.map,S++,j.updateMatrices(C),C.castShadow)P++}if(i.spotLightMatrix[M]=j.matrix,C.castShadow){let ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,i.spotShadow[M]=ie,i.spotShadowMap[M]=ae,g++}M++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(Y).multiplyScalar(K),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[T]=V,T++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,ie.shadowCameraNear=j.camera.near,ie.shadowCameraFar=j.camera.far,i.pointShadow[m]=ie,i.pointShadowMap[m]=ae,i.pointShadowMatrix[m]=C.shadow.matrix,A++}i.point[m]=V,m++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(K),V.groundColor.copy(C.groundColor).multiplyScalar(K),i.hemi[b]=V,b++}}if(T>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2;else i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2;i.ambient[0]=h,i.ambient[1]=u,i.ambient[2]=d;let N=i.hash;if(N.sunLength!==f||N.directionalLength!==p||N.pointLength!==m||N.spotLength!==M||N.rectAreaLength!==T||N.hemiLength!==b||N.numSunShadows!==_||N.numDirectionalShadows!==E||N.numPointShadows!==A||N.numSpotShadows!==g||N.numSpotMaps!==S||N.numLightProbes!==z)i.sun.length=f,i.directional.length=p,i.spot.length=M,i.rectArea.length=T,i.point.length=m,i.hemi.length=b,i.sunShadow.length=_,i.sunShadowMap.length=_,i.sunShadowMatrix.length=y,i.sunShadowCascade.length=y,i.directionalShadow.length=E,i.directionalShadowMap.length=E,i.directionalShadowMatrix.length=E,i.pointShadow.length=A,i.pointShadowMap.length=A,i.pointShadowMatrix.length=A,i.spotShadow.length=g,i.spotShadowMap.length=g,i.spotLightMatrix.length=g+S-P,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=z,N.sunLength=f,N.directionalLength=p,N.pointLength=m,N.spotLength=M,N.rectAreaLength=T,N.hemiLength=b,N.numSunShadows=_,N.numDirectionalShadows=E,N.numPointShadows=A,N.numSpotShadows=g,N.numSpotMaps=S,N.numLightProbes=z,i.version=ev++}function l(c,h){let u=0,d=0,f=0,_=0,y=0,p=0,m=h.matrixWorldInverse;for(let M=0,T=c.length;M<T;M++){let b=c[M];if(b.isSunLight){let E=i.sun[u];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),u++}else if(b.isDirectionalLight){let E=i.directional[d];E.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(m),d++}else if(b.isSpotLight){let E=i.spot[_];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),E.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(m),_++}else if(b.isRectAreaLight){let E=i.rectArea[y];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),a.identity(),r.copy(b.matrixWorld),r.premultiply(m),a.extractRotation(r),E.halfWidth.set(b.width*0.5,0,0),E.halfHeight.set(0,b.height*0.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),y++}else if(b.isPointLight){let E=i.point[f];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),f++}else if(b.isHemisphereLight){let E=i.hemi[p];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),p++}}}return{setup:o,setupView:l,state:i}}function Ud(e){let t=new nv(e),n=[],i=[],s=[];function r(u){h.camera=u,n.length=0,i.length=0,s.length=0}function a(u){if(u.isLightProbeGrid)s.push(u);else n.push(u)}function o(u){i.push(u)}function l(){t.setup(n),s.sort((u,d)=>u.priority-d.priority||u.id-d.id)}function c(u){t.setupView(n,u)}let h={lightsArray:n,shadowsArray:i,lightProbeGridArray:s,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function iv(e){let t=new WeakMap;function n(s,r=0){let a=t.get(s),o;if(a===void 0)o=new Ud(e),t.set(s,[o]);else if(r>=a.length)o=new Ud(e),a.push(o);else o=a[r];return o}function i(){t=new WeakMap}return{get:n,dispose:i}}function lv(e,t,n){let i=new Fi,s=new ke,r=new ke,a=new tt,o=new Kl,l=new Jl,c={},h=n.maxTextureSize,u={[ci]:Xt,[Xt]:ci,[$t]:$t},d=new Kn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ke},radius:{value:4}},vertexShader:sv,fragmentShader:rv}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let _=new Yt;_.setAttribute("position",new pt(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let y=new yt(_,d),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Zs;let m=this.type;this.render=function(A,g,S){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(A.length===0)return;if(this.type===du)Te("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Zs;let P=e.getRenderTarget(),z=e.getActiveCubeFace(),N=e.getActiveMipmapLevel(),H=e.state;if(H.setBlending(Oi),H.buffers.depth.getReversed()===!0)H.buffers.color.setClear(0,0,0,0);else H.buffers.color.setClear(1,1,1,1);H.buffers.depth.setTest(!0),H.setScissorTest(!1);let Q=m!==this.type;if(Q)g.traverse(function(C){if(C.material)if(Array.isArray(C.material))C.material.forEach((Y)=>Y.needsUpdate=!0);else C.material.needsUpdate=!0});for(let C=0,Y=A.length;C<Y;C++){let K=A[C],B=K.shadow;if(B===void 0){Te("WebGLShadowMap:",K,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;s.copy(B.mapSize);let ae=B.getFrameExtents();if(s.multiply(ae),r.copy(B.mapSize),s.x>h||s.y>h){if(s.x>h)r.x=Math.floor(h/ae.x),s.x=r.x*ae.x,B.mapSize.x=r.x;if(s.y>h)r.y=Math.floor(h/ae.y),s.y=r.y*ae.y,B.mapSize.y=r.y}let V=e.state.buffers.depth.getReversed();if(B.camera._reversedDepth=V,B.map===null||Q===!0){if(B.map!==null){if(B.map.depthTexture!==null)B.map.depthTexture.dispose(),B.map.depthTexture=null;B.map.dispose()}if(this.type===ps){if(K.isPointLight){Te("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}B.map=new hn(s.x,s.y,{format:zi,type:Cn,minFilter:mt,magFilter:mt,generateMipmaps:!1}),B.map.texture.name=K.name+".shadowMap",B.map.depthTexture=new pi(s.x,s.y,qn),B.map.depthTexture.name=K.name+".shadowMapDepth",B.map.depthTexture.format=vs,B.map.depthTexture.compareFunction=null,B.map.depthTexture.minFilter=yn,B.map.depthTexture.magFilter=yn}else{if(K.isPointLight)B.map=new Ba(s.x),B.map.depthTexture=new wa(s.x,ui);else B.map=new hn(s.x,s.y),B.map.depthTexture=new pi(s.x,s.y,ui);if(B.map.depthTexture.name=K.name+".shadowMap",B.map.depthTexture.format=vs,this.type===Zs)B.map.depthTexture.compareFunction=V?Ol:Fl,B.map.depthTexture.minFilter=mt,B.map.depthTexture.magFilter=mt;else B.map.depthTexture.compareFunction=null,B.map.depthTexture.minFilter=yn,B.map.depthTexture.magFilter=yn}B.camera.updateProjectionMatrix()}if(B.map.isWebGLCubeRenderTarget!==!0&&(B.map.width!==s.x||B.map.height!==s.y))B.map.setSize(s.x,s.y);let j=B.map.isWebGLCubeRenderTarget?6:B.getViewportCount();if(K.isPointLight!==!0)B.updateMatrices(K,S);let ie=(B.camera.layers.mask&4294967294)!==0?B.camera.layers:S.layers;for(let be=0;be<j;be++){let Z=B.getCamera(be);if(K.isPointLight){let{camera:ne,matrix:ye}=B,Ce=K.distance||ne.far;if(Ce!==ne.far)ne.far=Ce,ne.updateProjectionMatrix();fr.setFromMatrixPosition(K.matrixWorld),ne.position.copy(fr),uc.copy(ne.position),uc.add(av[be]),ne.up.copy(ov[be]),ne.lookAt(uc),ne.updateMatrixWorld(),ye.makeTranslation(-fr.x,-fr.y,-fr.z),Fd.multiplyMatrices(ne.projectionMatrix,ne.matrixWorldInverse),B._frustum.setFromProjectionMatrix(Fd,ne.coordinateSystem,ne.reversedDepth)}if(B.map.isWebGLCubeRenderTarget)e.setRenderTarget(B.map,be),e.clear();else{if(be===0)e.setRenderTarget(B.map),e.clear();let ne=B.getViewport(be);a.set(r.x*ne.x,r.y*ne.y,r.x*ne.z,r.y*ne.w),H.viewport(a)}i=B.getFrustum(be),b(g,S,Z,K,ie,this.type)}if(B.isPointLightShadow!==!0&&this.type===ps)M(B,S);B.needsUpdate=!1}m=this.type,p.needsUpdate=!1,e.setRenderTarget(P,z,N)};function M(A,g){let S=t.update(y);if(d.defines.VSM_SAMPLES!==A.blurSamples)d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0;if(A.mapPass===null)A.mapPass=new hn(s.x,s.y,{format:zi,type:Cn});else if(A.mapPass.width!==A.map.width||A.mapPass.height!==A.map.height)A.mapPass.setSize(A.map.width,A.map.height);d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value.set(A.map.width,A.map.height),d.uniforms.radius.value=A.radius,e.setRenderTarget(A.mapPass),e.clear(),e.renderBufferDirect(g,null,S,d,y,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value.set(A.map.width,A.map.height),f.uniforms.radius.value=A.radius,e.setRenderTarget(A.map),e.clear(),e.renderBufferDirect(g,null,S,f,y,null)}function T(A,g,S,P){let z=null,N=S.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(N!==void 0)z=N;else if(z=S.isPointLight===!0?l:o,e.localClippingEnabled&&g.clipShadows===!0&&Array.isArray(g.clippingPlanes)&&g.clippingPlanes.length!==0||g.displacementMap&&g.displacementScale!==0||g.alphaMap&&g.alphaTest>0||g.map&&g.alphaTest>0||g.alphaToCoverage===!0){let H=z.uuid,Q=g.uuid,C=c[H];if(C===void 0)C={},c[H]=C;let Y=C[Q];if(Y===void 0)Y=z.clone(),C[Q]=Y,g.addEventListener("dispose",E);z=Y}if(z.visible=g.visible,z.wireframe=g.wireframe,P===ps)z.side=g.shadowSide!==null?g.shadowSide:g.side;else z.side=g.shadowSide!==null?g.shadowSide:u[g.side];if(z.alphaMap=g.alphaMap,z.alphaTest=g.alphaToCoverage===!0?0.5:g.alphaTest,z.map=g.map,z.clipShadows=g.clipShadows,z.clippingPlanes=g.clippingPlanes,z.clipIntersection=g.clipIntersection,z.displacementMap=g.displacementMap,z.displacementScale=g.displacementScale,z.displacementBias=g.displacementBias,z.wireframeLinewidth=g.wireframeLinewidth,z.linewidth=g.linewidth,S.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=e.properties.get(z);H.light=S}return z}function b(A,g,S,P,z,N){if(A.visible===!1)return;if(A.layers.test(z)&&(A.isMesh||A.isLine||A.isPoints)){if((A.castShadow||A.receiveShadow&&N===ps)&&(!A.frustumCulled||A.intersectsFrustum(i))){A.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,A.matrixWorld);let C=t.update(A),Y=A.material;if(Array.isArray(Y)){let K=C.groups;for(let B=0,ae=K.length;B<ae;B++){let V=K[B],j=Y[V.materialIndex];if(j&&j.visible){let ie=T(A,j,P,N);A.onBeforeShadow(e,A,g,S,C,ie,V),e.renderBufferDirect(S,null,C,ie,A,V),A.onAfterShadow(e,A,g,S,C,ie,V)}}}else if(Y.visible){let K=T(A,Y,P,N);A.onBeforeShadow(e,A,g,S,C,K,null),e.renderBufferDirect(S,null,C,K,A,null),A.onAfterShadow(e,A,g,S,C,K,null)}}}let Q=A.children;for(let C=0,Y=Q.length;C<Y;C++)b(Q[C],g,S,P,z,N)}function E(A){A.target.removeEventListener("dispose",E);for(let S in c){let P=c[S],z=A.target.uuid;if(z in P)P[z].dispose(),delete P[z]}}}function cv(e,t){function n(){let R=!1,X=new tt,W=null,te=new tt(0,0,0,0);return{setMask:function(se){if(W!==se&&!R)e.colorMask(se,se,se,se),W=se},setLocked:function(se){R=se},setClear:function(se,ue,Ae,we,pe){if(pe===!0)se*=we,ue*=we,Ae*=we;if(X.set(se,ue,Ae,we),te.equals(X)===!1)e.clearColor(se,ue,Ae,we),te.copy(X)},reset:function(){R=!1,W=null,te.set(-1,0,0,0)}}}function i(){let R=!1,X=!1,W=null,te=null,se=null;return{setReversed:function(ue){if(X!==ue){let Ae=t.get("EXT_clip_control");if(ue)Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.ZERO_TO_ONE_EXT);else Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.NEGATIVE_ONE_TO_ONE_EXT);X=ue;let we=se;se=null,this.setClear(we)}},getReversed:function(){return X},setTest:function(ue){if(ue)Se(e.DEPTH_TEST);else je(e.DEPTH_TEST)},setMask:function(ue){if(W!==ue&&!R)e.depthMask(ue),W=ue},setFunc:function(ue){if(X)ue=rd[ue];if(te!==ue){switch(ue){case Nu:e.depthFunc(e.NEVER);break;case Du:e.depthFunc(e.ALWAYS);break;case Uu:e.depthFunc(e.LESS);break;case Wo:e.depthFunc(e.LEQUAL);break;case Fu:e.depthFunc(e.EQUAL);break;case Ou:e.depthFunc(e.GEQUAL);break;case Bu:e.depthFunc(e.GREATER);break;case ku:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}te=ue}},setLocked:function(ue){R=ue},setClear:function(ue){if(se!==ue){if(se=ue,X)ue=1-ue;e.clearDepth(ue)}},reset:function(){R=!1,W=null,te=null,se=null,X=!1}}}function s(){let R=!1,X=null,W=null,te=null,se=null,ue=null,Ae=null,we=null,pe=null;return{setTest:function(Re){if(!R)if(Re)Se(e.STENCIL_TEST);else je(e.STENCIL_TEST)},setMask:function(Re){if(X!==Re&&!R)e.stencilMask(Re),X=Re},setFunc:function(Re,Be,me){if(W!==Re||te!==Be||se!==me)e.stencilFunc(Re,Be,me),W=Re,te=Be,se=me},setOp:function(Re,Be,me){if(ue!==Re||Ae!==Be||we!==me)e.stencilOp(Re,Be,me),ue=Re,Ae=Be,we=me},setLocked:function(Re){R=Re},setClear:function(Re){if(pe!==Re)e.clearStencil(Re),pe=Re},reset:function(){R=!1,X=null,W=null,te=null,se=null,ue=null,Ae=null,we=null,pe=null}}}let r=new n,a=new i,o=new s,l={},c=new WeakMap,h={},u={},d={},f=new WeakMap,_=[],y=null,p=!1,m=null,M=null,T=null,b=null,E=null,A=null,g=null,S=new Ee(0,0,0),P=0,z=!1,N=null,H=null,Q=null,C=null,Y=null,K=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=!1,ae=0,V=e.getParameter(e.VERSION);if(V.indexOf("WebGL")!==-1)ae=parseFloat(/^WebGL (\d)/.exec(V)[1]),B=ae>=1;else if(V.indexOf("OpenGL ES")!==-1)ae=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),B=ae>=2;let j=null,ie={},be=e.getParameter(e.SCISSOR_BOX),Z=e.getParameter(e.VIEWPORT),ne=new tt().fromArray(be),ye=new tt().fromArray(Z);function Ce(R,X,W,te){let se=new Uint8Array(4),ue=e.createTexture();e.bindTexture(R,ue),e.texParameteri(R,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(R,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let Ae=0;Ae<W;Ae++)if(R===e.TEXTURE_3D||R===e.TEXTURE_2D_ARRAY)e.texImage3D(X,0,e.RGBA,1,1,te,0,e.RGBA,e.UNSIGNED_BYTE,se);else e.texImage2D(X+Ae,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,se);return ue}let Ie={};Ie[e.TEXTURE_2D]=Ce(e.TEXTURE_2D,e.TEXTURE_2D,1),Ie[e.TEXTURE_CUBE_MAP]=Ce(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ie[e.TEXTURE_2D_ARRAY]=Ce(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),Ie[e.TEXTURE_3D]=Ce(e.TEXTURE_3D,e.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Se(e.DEPTH_TEST),a.setFunc(Wo),Zt(!1),_t(ko),Se(e.CULL_FACE),gt(Oi);function Se(R){if(h[R]!==!0)e.enable(R),h[R]=!0}function je(R){if(h[R]!==!1)e.disable(R),h[R]=!1}function We(R,X){if(d[R]!==X){if(e.bindFramebuffer(R,X),d[R]=X,R===e.DRAW_FRAMEBUFFER)d[e.FRAMEBUFFER]=X;if(R===e.FRAMEBUFFER)d[e.DRAW_FRAMEBUFFER]=X;return!0}return!1}function Oe(R,X){let W=_,te=!1;if(R){if(W=f.get(X),W===void 0)W=[],f.set(X,W);let se=R.textures;if(W.length!==se.length||W[0]!==e.COLOR_ATTACHMENT0){for(let ue=0,Ae=se.length;ue<Ae;ue++)W[ue]=e.COLOR_ATTACHMENT0+ue;W.length=se.length,te=!0}}else if(W[0]!==e.BACK)W[0]=e.BACK,te=!0;if(te)e.drawBuffers(W)}function lt(R){if(y!==R)return e.useProgram(R),y=R,!0;return!1}let qe={[ms]:e.FUNC_ADD,[pu]:e.FUNC_SUBTRACT,[mu]:e.FUNC_REVERSE_SUBTRACT};qe[gu]=e.MIN,qe[_u]=e.MAX;let dt={[xu]:e.ZERO,[vu]:e.ONE,[yu]:e.SRC_COLOR,[bu]:e.SRC_ALPHA,[Ru]:e.SRC_ALPHA_SATURATE,[Eu]:e.DST_COLOR,[wu]:e.DST_ALPHA,[Su]:e.ONE_MINUS_SRC_COLOR,[Mu]:e.ONE_MINUS_SRC_ALPHA,[Au]:e.ONE_MINUS_DST_COLOR,[Tu]:e.ONE_MINUS_DST_ALPHA,[Cu]:e.CONSTANT_COLOR,[Iu]:e.ONE_MINUS_CONSTANT_COLOR,[Pu]:e.CONSTANT_ALPHA,[Lu]:e.ONE_MINUS_CONSTANT_ALPHA};function gt(R,X,W,te,se,ue,Ae,we,pe,Re){if(R===Oi){if(p===!0)je(e.BLEND),p=!1;return}if(p===!1)Se(e.BLEND),p=!0;if(R!==fu){if(R!==m||Re!==z){if(M!==ms||E!==ms)e.blendEquation(e.FUNC_ADD),M=ms,E=ms;if(Re)switch(R){case Ks:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case zo:e.blendFunc(e.ONE,e.ONE);break;case Ho:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Go:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Le("WebGLState: Invalid blending: ",R);break}else switch(R){case Ks:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case zo:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Ho:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Go:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",R);break}T=null,b=null,A=null,g=null,S.set(0,0,0),P=0,m=R,z=Re}return}if(se=se||X,ue=ue||W,Ae=Ae||te,X!==M||se!==E)e.blendEquationSeparate(qe[X],qe[se]),M=X,E=se;if(W!==T||te!==b||ue!==A||Ae!==g)e.blendFuncSeparate(dt[W],dt[te],dt[ue],dt[Ae]),T=W,b=te,A=ue,g=Ae;if(we.equals(S)===!1||pe!==P)e.blendColor(we.r,we.g,we.b,pe),S.copy(we),P=pe;m=R,z=!1}function kt(R,X){R.side===$t?je(e.CULL_FACE):Se(e.CULL_FACE);let W=R.side===Xt;if(X)W=!W;Zt(W),R.blending===Ks&&R.transparent===!1?gt(Oi):gt(R.blending,R.blendEquation,R.blendSrc,R.blendDst,R.blendEquationAlpha,R.blendSrcAlpha,R.blendDstAlpha,R.blendColor,R.blendAlpha,R.premultipliedAlpha),a.setFunc(R.depthFunc),a.setTest(R.depthTest),a.setMask(R.depthWrite),r.setMask(R.colorWrite);let te=R.stencilWrite;if(o.setTest(te),te)o.setMask(R.stencilWriteMask),o.setFunc(R.stencilFunc,R.stencilRef,R.stencilFuncMask),o.setOp(R.stencilFail,R.stencilZFail,R.stencilZPass);zt(R.polygonOffset,R.polygonOffsetFactor,R.polygonOffsetUnits),R.alphaToCoverage===!0?Se(e.SAMPLE_ALPHA_TO_COVERAGE):je(e.SAMPLE_ALPHA_TO_COVERAGE)}function Zt(R){if(N!==R){if(R)e.frontFace(e.CW);else e.frontFace(e.CCW);N=R}}function _t(R){if(R!==hu){if(Se(e.CULL_FACE),R!==H)if(R===ko)e.cullFace(e.BACK);else if(R===uu)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else je(e.CULL_FACE);H=R}function Rt(R){if(R!==Q){if(B)e.lineWidth(R);Q=R}}function zt(R,X,W){if(R){if(Se(e.POLYGON_OFFSET_FILL),C!==X||Y!==W){if(C=X,Y=W,a.getReversed())X=-X,W=-W;e.polygonOffset(X,W)}}else je(e.POLYGON_OFFSET_FILL)}function Ht(R){if(R)Se(e.SCISSOR_TEST);else je(e.SCISSOR_TEST)}function dn(R){if(R===void 0)R=e.TEXTURE0+K-1;if(j!==R)e.activeTexture(R),j=R}function L(R,X,W){if(W===void 0)if(j===null)W=e.TEXTURE0+K-1;else W=j;let te=ie[W];if(te===void 0)te={type:void 0,texture:void 0},ie[W]=te;if(te.type!==R||te.texture!==X){if(j!==W)e.activeTexture(W),j=W;e.bindTexture(R,X||Ie[R]),te.type=R,te.texture=X}}function fn(){let R=ie[j];if(R!==void 0&&R.type!==void 0)e.bindTexture(R.type,null),R.type=void 0,R.texture=void 0}function Qe(){try{e.compressedTexImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function Mt(){try{e.compressedTexImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function de(){try{e.texSubImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function rt(){try{e.texSubImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function Pe(){try{e.compressedTexSubImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function De(){try{e.compressedTexSubImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function Ct(){try{e.texStorage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function w(){try{e.texStorage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function x(){try{e.texImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function U(){try{e.texImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function ee(R){if(u[R]!==void 0)return u[R];else return e.getParameter(R)}function J(R,X){if(u[R]!==X)e.pixelStorei(R,X),u[R]=X}function re(R){if(ne.equals(R)===!1)e.scissor(R.x,R.y,R.z,R.w),ne.copy(R)}function ce(R){if(ye.equals(R)===!1)e.viewport(R.x,R.y,R.z,R.w),ye.copy(R)}function G(R,X){let W=c.get(X);if(W===void 0)W=new WeakMap,c.set(X,W);let te=W.get(R);if(te===void 0)te=e.getUniformBlockIndex(X,R.name),e.uniformBlockBinding(X,te,te),W.set(R,te)}function q(R,X,W){let se=c.get(X).get(R);if(l[se]!==W)e.bindBufferBase(e.UNIFORM_BUFFER,se,W),l[se]=W}function oe(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),a.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),h={},u={},j=null,ie={},d={},l={},f=new WeakMap,_=[],y=null,p=!1,m=null,M=null,T=null,b=null,E=null,A=null,g=null,S=new Ee(0,0,0),P=0,z=!1,N=null,H=null,Q=null,C=null,Y=null,ne.set(0,0,e.canvas.width,e.canvas.height),ye.set(0,0,e.canvas.width,e.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:Se,disable:je,bindFramebuffer:We,drawBuffers:Oe,useProgram:lt,setBlending:gt,setMaterial:kt,setFlipSided:Zt,setCullFace:_t,setLineWidth:Rt,setPolygonOffset:zt,setScissorTest:Ht,activeTexture:dn,bindTexture:L,unbindTexture:fn,compressedTexImage2D:Qe,compressedTexImage3D:Mt,texImage2D:x,texImage3D:U,pixelStorei:J,getParameter:ee,updateUBOMapping:G,uniformBlockBinding:q,texStorage2D:Ct,texStorage3D:w,texSubImage2D:de,texSubImage3D:rt,compressedTexSubImage2D:Pe,compressedTexSubImage3D:De,scissor:re,viewport:ce,reset:oe}}function hv(e,t,n,i,s,r,a){let o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ke,h=new WeakMap,u=new Set,d,f=new WeakMap,_=new Set,y=new FinalizationRegistry((w)=>_.delete(w)),p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(w){}function m(w,x){return p?new OffscreenCanvas(w,x):ds("canvas")}function M(w,x,U){let ee=1,J=Ct(w);if(J.width>U||J.height>U)ee=U/Math.max(J.width,J.height);if(ee<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){let re=Math.floor(ee*J.width),ce=Math.floor(ee*J.height);if(d===void 0)d=m(re,ce);let G=x?m(re,ce):d;return G.width=re,G.height=ce,G.getContext("2d").drawImage(w,0,0,re,ce),Te("WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+re+"x"+ce+")."),G}else{if("data"in w)Te("WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+").");return w}return w}function T(w){return w.generateMipmaps}function b(w){e.generateMipmap(w)}function E(w){if(w.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(w.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function A(w,x,U,ee,J,re=!1){if(w!==null){if(e[w]!==void 0)return e[w];Te("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ce;if(ee){if(ce=t.get("EXT_texture_norm16"),!ce)Te("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let G=x;if(x===e.RED){if(U===e.FLOAT)G=e.R32F;if(U===e.HALF_FLOAT)G=e.R16F;if(U===e.UNSIGNED_BYTE)G=e.R8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.R16_EXT;if(U===e.SHORT&&ce)G=ce.R16_SNORM_EXT}if(x===e.RED_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.R8UI;if(U===e.UNSIGNED_SHORT)G=e.R16UI;if(U===e.UNSIGNED_INT)G=e.R32UI;if(U===e.BYTE)G=e.R8I;if(U===e.SHORT)G=e.R16I;if(U===e.INT)G=e.R32I}if(x===e.RG){if(U===e.FLOAT)G=e.RG32F;if(U===e.HALF_FLOAT)G=e.RG16F;if(U===e.UNSIGNED_BYTE)G=e.RG8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.RG16_EXT;if(U===e.SHORT&&ce)G=ce.RG16_SNORM_EXT}if(x===e.RG_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RG8UI;if(U===e.UNSIGNED_SHORT)G=e.RG16UI;if(U===e.UNSIGNED_INT)G=e.RG32UI;if(U===e.BYTE)G=e.RG8I;if(U===e.SHORT)G=e.RG16I;if(U===e.INT)G=e.RG32I}if(x===e.RGB_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RGB8UI;if(U===e.UNSIGNED_SHORT)G=e.RGB16UI;if(U===e.UNSIGNED_INT)G=e.RGB32UI;if(U===e.BYTE)G=e.RGB8I;if(U===e.SHORT)G=e.RGB16I;if(U===e.INT)G=e.RGB32I}if(x===e.RGBA_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RGBA8UI;if(U===e.UNSIGNED_SHORT)G=e.RGBA16UI;if(U===e.UNSIGNED_INT)G=e.RGBA32UI;if(U===e.BYTE)G=e.RGBA8I;if(U===e.SHORT)G=e.RGBA16I;if(U===e.INT)G=e.RGBA32I}if(x===e.RGB){if(U===e.UNSIGNED_SHORT&&ce)G=ce.RGB16_EXT;if(U===e.SHORT&&ce)G=ce.RGB16_SNORM_EXT;if(U===e.UNSIGNED_INT_5_9_9_9_REV)G=e.RGB9_E5;if(U===e.UNSIGNED_INT_10F_11F_11F_REV)G=e.R11F_G11F_B10F}if(x===e.RGBA){let q=re?Ul:He.getTransfer(J);if(U===e.FLOAT)G=e.RGBA32F;if(U===e.HALF_FLOAT)G=e.RGBA16F;if(U===e.UNSIGNED_BYTE)G=q===st?e.SRGB8_ALPHA8:e.RGBA8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.RGBA16_EXT;if(U===e.SHORT&&ce)G=ce.RGBA16_SNORM_EXT;if(U===e.UNSIGNED_SHORT_4_4_4_4)G=e.RGBA4;if(U===e.UNSIGNED_SHORT_5_5_5_1)G=e.RGB5_A1}if(G===e.R16F||G===e.R32F||G===e.RG16F||G===e.RG32F||G===e.RGBA16F||G===e.RGBA32F)t.get("EXT_color_buffer_float");return G}function g(w,x){let U;if(w){if(x===null||x===ui||x===ki)U=e.DEPTH24_STENCIL8;else if(x===qn)U=e.DEPTH32F_STENCIL8;else if(x===Qs)U=e.DEPTH24_STENCIL8,Te("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(x===null||x===ui||x===ki)U=e.DEPTH_COMPONENT24;else if(x===qn)U=e.DEPTH_COMPONENT32F;else if(x===Qs)U=e.DEPTH_COMPONENT16;return U}function S(w,x){if(T(w)===!0||w.isFramebufferTexture&&w.minFilter!==yn&&w.minFilter!==mt)return Math.log2(Math.max(x.width,x.height))+1;else if(w.mipmaps.length>0)return w.mipmaps.length;else if(w.isCompressedTexture&&Array.isArray(w.image))return x.mipmaps.length;else return 1}function P(w){let x=new WeakRef(w);i.get(w).__ref=x,_.add(x),y.register(w,x,x)}function z(w){let x=i.get(w).__ref;if(x===void 0)return;_.delete(x),y.unregister(x)}function N(w){Q(w.target)}function H(w){C(w.target)}function Q(w){if(w.removeEventListener("dispose",N),z(w),K(w),w.isVideoTexture)h.delete(w);if(w.isHTMLTexture)u.delete(w)}function C(w){w.removeEventListener("dispose",H),z(w),ae(w)}function Y(){for(let w of _){let x=w.deref();if(x===void 0)continue;if(x.isRenderTarget===!0)C(x);else Q(x)}_.clear(),u.clear()}function K(w){let x=i.get(w);if(x.__webglInit===void 0)return;let U=w.source,ee=f.get(U);if(ee){let J=ee[x.__cacheKey];if(J.usedTimes--,J.usedTimes===0)B(w);if(Object.keys(ee).length===0)f.delete(U)}i.remove(w)}function B(w){let x=i.get(w);e.deleteTexture(x.__webglTexture);let U=w.source,ee=f.get(U);delete ee[x.__cacheKey],a.memory.textures--}function ae(w){let x=i.get(w);if(x.__depthDisposeCallback)x.__depthDisposeCallback();let U=w.depthTexture;if(U&&U.renderTarget===w)Q(U);if(w.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(x.__webglFramebuffer[J]))for(let re=0;re<x.__webglFramebuffer[J].length;re++)e.deleteFramebuffer(x.__webglFramebuffer[J][re]);else e.deleteFramebuffer(x.__webglFramebuffer[J]);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer[J])}else{if(Array.isArray(x.__webglFramebuffer))for(let J=0;J<x.__webglFramebuffer.length;J++)e.deleteFramebuffer(x.__webglFramebuffer[J]);else e.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer);if(x.__webglMultisampledFramebuffer)e.deleteFramebuffer(x.__webglMultisampledFramebuffer);if(x.__webglColorRenderbuffer){for(let J=0;J<x.__webglColorRenderbuffer.length;J++)if(x.__webglColorRenderbuffer[J])e.deleteRenderbuffer(x.__webglColorRenderbuffer[J])}if(x.__webglDepthRenderbuffer)e.deleteRenderbuffer(x.__webglDepthRenderbuffer)}let ee=w.textures;for(let J=0,re=ee.length;J<re;J++){let ce=i.get(ee[J]);if(ce.__webglTexture)e.deleteTexture(ce.__webglTexture),a.memory.textures--;i.remove(ee[J])}i.remove(w)}let V=0;function j(){V=0}function ie(){return V}function be(w){V=w}function Z(){let w=V;if(w>=s.maxTextures)Te("WebGLTextures: Trying to use "+(w+1)+" texture units while this GPU supports only "+s.maxTextures);return V+=1,w}function ne(w){let x=[];return x.push(w.wrapS),x.push(w.wrapT),x.push(w.wrapR||0),x.push(w.magFilter),x.push(w.minFilter),x.push(w.anisotropy),x.push(w.internalFormat),x.push(w.format),x.push(w.type),x.push(w.generateMipmaps),x.push(w.mipmapsAutoUpdate),x.push(w.premultiplyAlpha),x.push(w.flipY),x.push(w.unpackAlignment),x.push(w.colorSpace),x.join()}function ye(w,x){let U=i.get(w);if(w.isVideoTexture)Pe(w);if(w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&U.__version!==w.version){let ee=w.image;if(ee===null)Te("WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)Te("WebGLRenderer: Texture marked for update but image is incomplete");else{kt(U,w,x);return}}else if(w.isExternalTexture)U.__webglTexture=w.sourceTexture?w.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,U.__webglTexture,e.TEXTURE0+x)}function Ce(w,x){let U=i.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){kt(U,w,x);return}else if(w.isExternalTexture)U.__webglTexture=w.sourceTexture?w.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,U.__webglTexture,e.TEXTURE0+x)}function Ie(w,x){let U=i.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){kt(U,w,x);return}n.bindTexture(e.TEXTURE_3D,U.__webglTexture,e.TEXTURE0+x)}function Se(w,x){let U=i.get(w);if(w.version>0&&U.__version!==w.version){Zt(U,w,x);return}n.bindTexture(e.TEXTURE_CUBE_MAP,U.__webglTexture,e.TEXTURE0+x)}let je={[hi]:e.REPEAT,[_s]:e.CLAMP_TO_EDGE,[na]:e.MIRRORED_REPEAT},We={[yn]:e.NEAREST,[ia]:e.NEAREST_MIPMAP_NEAREST,[Bi]:e.NEAREST_MIPMAP_LINEAR,[mt]:e.LINEAR,[xs]:e.LINEAR_MIPMAP_NEAREST,[tn]:e.LINEAR_MIPMAP_LINEAR},Oe={[Ju]:e.NEVER,[Bl]:e.ALWAYS,[ju]:e.LESS,[Fl]:e.LEQUAL,[Qu]:e.EQUAL,[Ol]:e.GEQUAL,[ed]:e.GREATER,[td]:e.NOTEQUAL};function lt(w,x){if(x.type===qn&&t.has("OES_texture_float_linear")===!1&&(x.magFilter===mt||x.magFilter===xs||x.magFilter===Bi||x.magFilter===tn||x.minFilter===mt||x.minFilter===xs||x.minFilter===Bi||x.minFilter===tn))Te("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(w,e.TEXTURE_WRAP_S,je[x.wrapS]),e.texParameteri(w,e.TEXTURE_WRAP_T,je[x.wrapT]),w===e.TEXTURE_3D||w===e.TEXTURE_2D_ARRAY)e.texParameteri(w,e.TEXTURE_WRAP_R,je[x.wrapR]);if(e.texParameteri(w,e.TEXTURE_MAG_FILTER,We[x.magFilter]),e.texParameteri(w,e.TEXTURE_MIN_FILTER,We[x.minFilter]),x.compareFunction)e.texParameteri(w,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(w,e.TEXTURE_COMPARE_FUNC,Oe[x.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===yn)return;if(x.minFilter!==Bi&&x.minFilter!==tn)return;if(x.type===qn&&t.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||i.get(x).__currentAnisotropy){let U=t.get("EXT_texture_filter_anisotropic");e.texParameterf(w,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,s.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy}}}function qe(w,x){let U=!1;if(w.__webglInit===void 0)w.__webglInit=!0,x.addEventListener("dispose",N),P(x);let ee=x.source,J=f.get(ee);if(J===void 0)J={},f.set(ee,J);let re=ne(x);if(re!==w.__cacheKey){if(J[re]===void 0)J[re]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,U=!0;J[re].usedTimes++;let ce=J[w.__cacheKey];if(ce!==void 0){if(J[w.__cacheKey].usedTimes--,ce.usedTimes===0)B(x)}w.__cacheKey=re,w.__webglTexture=J[re].texture}return U}function dt(w,x,U){return Math.floor(Math.floor(w/U)/x)}function gt(w,x,U,ee){let re=w.updateRanges;if(re.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,x.width,x.height,U,ee,x.data);else{re.sort((R,X)=>R.start-X.start);let ce=0;for(let R=1;R<re.length;R++){let X=re[ce],W=re[R],te=X.start+X.count,se=dt(W.start,x.width,4),ue=dt(X.start,x.width,4);if(W.start<=te+1&&se===ue&&dt(W.start+W.count-1,x.width,4)===se)X.count=Math.max(X.count,W.start+W.count-X.start);else++ce,re[ce]=W}re.length=ce+1;let G=n.getParameter(e.UNPACK_ROW_LENGTH),q=n.getParameter(e.UNPACK_SKIP_PIXELS),oe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,x.width);for(let R=0,X=re.length;R<X;R++){let W=re[R],te=Math.floor(W.start/4),se=Math.ceil(W.count/4),ue=te%x.width,Ae=Math.floor(te/x.width),we=se,pe=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,ue),n.pixelStorei(e.UNPACK_SKIP_ROWS,Ae),n.texSubImage2D(e.TEXTURE_2D,0,ue,Ae,we,1,U,ee,x.data)}w.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,G),n.pixelStorei(e.UNPACK_SKIP_PIXELS,q),n.pixelStorei(e.UNPACK_SKIP_ROWS,oe)}}function kt(w,x,U){let ee=e.TEXTURE_2D;if(x.isDataArrayTexture||x.isCompressedArrayTexture)ee=e.TEXTURE_2D_ARRAY;if(x.isData3DTexture)ee=e.TEXTURE_3D;let J=qe(w,x),re=x.source;n.bindTexture(ee,w.__webglTexture,e.TEXTURE0+U);let ce=i.get(re);if(re.version!==ce.__version||J===!0){if(n.activeTexture(e.TEXTURE0+U),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){let pe=He.getPrimaries(He.workingColorSpace),Re=x.colorSpace===Hi?null:He.getPrimaries(x.colorSpace),Be=x.colorSpace===Hi||pe===Re?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be)}n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment);let q=M(x.image,!1,s.maxTextureSize);q=De(x,q);let oe=r.convert(x.format,x.colorSpace),R=r.convert(x.type),X=A(x.internalFormat,oe,R,x.normalized,x.colorSpace,x.isVideoTexture);lt(ee,x);let W,te=x.mipmaps,se=x.isVideoTexture!==!0,ue=ce.__version===void 0||J===!0,Ae=re.dataReady,we=S(x,q);if(x.isDepthTexture){if(X=g(x.format===di,x.type),ue)if(se)n.texStorage2D(e.TEXTURE_2D,1,X,q.width,q.height);else n.texImage2D(e.TEXTURE_2D,0,X,q.width,q.height,0,oe,R,null)}else if(x.isDataTexture)if(te.length>0){if(se&&ue)n.texStorage2D(e.TEXTURE_2D,we,X,te[0].width,te[0].height);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,R,W.data)}else n.texImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,oe,R,W.data);x.generateMipmaps=!1}else if(se){if(ue)n.texStorage2D(e.TEXTURE_2D,we,X,q.width,q.height);if(Ae)gt(x,q,oe,R)}else n.texImage2D(e.TEXTURE_2D,0,X,q.width,q.height,0,oe,R,q.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){if(se&&ue)n.texStorage3D(e.TEXTURE_2D_ARRAY,we,X,te[0].width,te[0].height,q.depth);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],x.format!==bn)if(oe!==null)if(se){if(Ae)if(x.layerUpdates.size>0){let Be=lc(W.width,W.height,x.format,x.type);for(let me of x.layerUpdates){let et=W.data.subarray(me*Be/W.data.BYTES_PER_ELEMENT,(me+1)*Be/W.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,me,W.width,W.height,1,oe,et)}}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,0,W.width,W.height,q.depth,oe,W.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,pe,X,W.width,W.height,q.depth,0,W.data,0,0);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(se){if(Ae)n.texSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,0,W.width,W.height,q.depth,oe,R,W.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,pe,X,W.width,W.height,q.depth,0,oe,R,W.data);if(x.layerUpdates.size>0)x.clearLayerUpdates()}else{if(se&&ue)n.texStorage2D(e.TEXTURE_2D,we,X,te[0].width,te[0].height);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],x.format!==bn)if(oe!==null)if(se){if(Ae)n.compressedTexSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,W.data)}else n.compressedTexImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,W.data);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,R,W.data)}else n.texImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,oe,R,W.data)}else if(x.isDataArrayTexture)if(se){if(ue)n.texStorage3D(e.TEXTURE_2D_ARRAY,we,X,q.width,q.height,q.depth);if(Ae)if(x.layerUpdates.size>0){let pe=lc(q.width,q.height,x.format,x.type);for(let Re of x.layerUpdates){let Be=q.data.subarray(Re*pe/q.data.BYTES_PER_ELEMENT,(Re+1)*pe/q.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,Re,q.width,q.height,1,oe,R,Be)}x.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,q.width,q.height,q.depth,oe,R,q.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,X,q.width,q.height,q.depth,0,oe,R,q.data);else if(x.isData3DTexture)if(se){if(ue)n.texStorage3D(e.TEXTURE_3D,we,X,q.width,q.height,q.depth);if(Ae)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,q.width,q.height,q.depth,oe,R,q.data)}else n.texImage3D(e.TEXTURE_3D,0,X,q.width,q.height,q.depth,0,oe,R,q.data);else if(x.isFramebufferTexture){if(ue)if(se)n.texStorage2D(e.TEXTURE_2D,we,X,q.width,q.height);else{let pe=q.width,Re=q.height;for(let Be=0;Be<we;Be++)n.texImage2D(e.TEXTURE_2D,Be,X,pe,Re,0,oe,R,null),pe>>=1,Re>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in e){let pe=e.canvas;if(!pe.hasAttribute("layoutsubtree"))pe.setAttribute("layoutsubtree","true");if(q.parentNode!==pe){pe.appendChild(q),u.add(x),pe.onpaint=(Re)=>{let Be=Re.changedElements;for(let me of u)if(Be.includes(me.image))me.needsUpdate=!0},pe.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,q);else{let{RGBA:Be,RGBA:me,UNSIGNED_BYTE:et}=e;e.texElementImage2D(e.TEXTURE_2D,0,Be,me,et,q)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(te.length>0){if(se&&ue){let pe=Ct(te[0]);n.texStorage2D(e.TEXTURE_2D,we,X,pe.width,pe.height)}for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,oe,R,W)}else n.texImage2D(e.TEXTURE_2D,pe,X,oe,R,W);x.generateMipmaps=!1}else if(se){if(ue){let pe=Ct(q);n.texStorage2D(e.TEXTURE_2D,we,X,pe.width,pe.height)}if(Ae)n.texSubImage2D(e.TEXTURE_2D,0,0,0,oe,R,q)}else n.texImage2D(e.TEXTURE_2D,0,X,oe,R,q);if(T(x)&&x.mipmapsAutoUpdate===!0)b(ee);if(ce.__version=re.version,x.onUpdate)x.onUpdate(x)}w.__version=x.version}function Zt(w,x,U){if(x.image.length!==6)return;let ee=qe(w,x),J=x.source;n.bindTexture(e.TEXTURE_CUBE_MAP,w.__webglTexture,e.TEXTURE0+U);let re=i.get(J);if(J.version!==re.__version||ee===!0){n.activeTexture(e.TEXTURE0+U);let ce=He.getPrimaries(He.workingColorSpace),G=x.colorSpace===Hi?null:He.getPrimaries(x.colorSpace),q=x.colorSpace===Hi||ce===G?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,q);let oe=x.isCompressedTexture||x.image[0].isCompressedTexture,R=x.image[0]&&x.image[0].isDataTexture,X=[];for(let me=0;me<6;me++){if(!oe&&!R)X[me]=M(x.image[me],!0,s.maxCubemapSize);else X[me]=R?x.image[me].image:x.image[me];X[me]=De(x,X[me])}let W=X[0],te=r.convert(x.format,x.colorSpace),se=r.convert(x.type),ue=A(x.internalFormat,te,se,x.normalized,x.colorSpace),Ae=x.isVideoTexture!==!0,we=re.__version===void 0||ee===!0,pe=J.dataReady,Re=S(x,W);lt(e.TEXTURE_CUBE_MAP,x);let Be;if(x.isDepthTexture){if(ue=g(x.format===di,x.type),we)if(Ae)n.texStorage2D(e.TEXTURE_CUBE_MAP,1,ue,W.width,W.height);else for(let me=0;me<6;me++)n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,W.width,W.height,0,te,se,null)}else if(oe){if(Ae&&we)n.texStorage2D(e.TEXTURE_CUBE_MAP,Re,ue,W.width,W.height);for(let me=0;me<6;me++){Be=X[me].mipmaps;for(let et=0;et<Be.length;et++){let wt=Be[et];if(x.format!==bn)if(te!==null)if(Ae){if(pe)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,0,0,wt.width,wt.height,te,wt.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,ue,wt.width,wt.height,0,wt.data);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,0,0,wt.width,wt.height,te,se,wt.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,ue,wt.width,wt.height,0,te,se,wt.data)}}}else{if(Be=x.mipmaps,Ae&&we){if(Be.length>0)Re++;let me=Ct(X[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,Re,ue,me.width,me.height)}for(let me=0;me<6;me++)if(R){if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,X[me].width,X[me].height,te,se,X[me].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,X[me].width,X[me].height,0,te,se,X[me].data);for(let et=0;et<Be.length;et++){let Un=Be[et].image[me].image;if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,0,0,Un.width,Un.height,te,se,Un.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,ue,Un.width,Un.height,0,te,se,Un.data)}}else{if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,te,se,X[me])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,te,se,X[me]);for(let et=0;et<Be.length;et++){let wt=Be[et];if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,0,0,te,se,wt.image[me])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,ue,te,se,wt.image[me])}}}if(T(x)&&x.mipmapsAutoUpdate===!0)b(e.TEXTURE_CUBE_MAP);if(re.__version=J.version,x.onUpdate)x.onUpdate(x)}w.__version=x.version}function _t(w,x,U,ee,J,re){let ce=r.convert(U.format,U.colorSpace),G=r.convert(U.type),q=A(U.internalFormat,ce,G,U.normalized,U.colorSpace),oe=i.get(x),R=i.get(U);if(R.__renderTarget=x,!oe.__hasExternalTextures){let X=Math.max(1,x.width>>re),W=Math.max(1,x.height>>re);if(J===e.TEXTURE_3D||J===e.TEXTURE_2D_ARRAY)n.texImage3D(J,re,q,X,W,x.depth,0,ce,G,null);else n.texImage2D(J,re,q,X,W,0,ce,G,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,w),rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,ee,J,R.__webglTexture,0,de(x));else if(J===e.TEXTURE_2D||J>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,ee,J,R.__webglTexture,re);n.bindFramebuffer(e.FRAMEBUFFER,null)}function Rt(w,x,U){if(e.bindRenderbuffer(e.RENDERBUFFER,w),x.depthBuffer){let ee=x.depthTexture,J=ee&&ee.isDepthTexture?ee.type:null,re=g(x.stencilBuffer,J),ce=x.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(rt(x))o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,de(x),re,x.width,x.height);else if(U)e.renderbufferStorageMultisample(e.RENDERBUFFER,de(x),re,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,re,x.width,x.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,ce,e.RENDERBUFFER,w)}else{let ee=x.textures;for(let J=0;J<ee.length;J++){let re=ee[J],ce=r.convert(re.format,re.colorSpace),G=r.convert(re.type),q=A(re.internalFormat,ce,G,re.normalized,re.colorSpace);if(rt(x))o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,de(x),q,x.width,x.height);else if(U)e.renderbufferStorageMultisample(e.RENDERBUFFER,de(x),q,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,q,x.width,x.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function zt(w,x,U){let ee=x.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,w),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let J=i.get(x.depthTexture);J.__renderTarget=x;let re=ee?x.depthTexture.image[0]:x.depthTexture.image;if(!J.__webglTexture||re.width!==x.width||re.height!==x.height)re.width=x.width,re.height=x.height,x.depthTexture.needsUpdate=!0;if(ee)Se(x.depthTexture,0);else ye(x.depthTexture,0);let ce=J.__webglTexture,G=de(x),q=ee?e.TEXTURE_CUBE_MAP_POSITIVE_X+U:e.TEXTURE_2D,oe=x.depthTexture.format===di?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(x.depthTexture.format===vs)if(rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,oe,q,ce,0,G);else e.framebufferTexture2D(e.FRAMEBUFFER,oe,q,ce,0);else if(x.depthTexture.format===di)if(rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,oe,q,ce,0,G);else e.framebufferTexture2D(e.FRAMEBUFFER,oe,q,ce,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ht(w){let x=i.get(w),U=w.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==w.depthTexture){let ee=w.depthTexture;if(x.__depthDisposeCallback)x.__depthDisposeCallback();if(ee){let J=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,ee.removeEventListener("dispose",J)};ee.addEventListener("dispose",J),x.__depthDisposeCallback=J}x.__boundDepthTexture=ee}if(w.depthTexture&&!x.__autoAllocateDepthBuffer)if(U)for(let ee=0;ee<6;ee++)zt(x.__webglFramebuffer[ee],w,ee);else if(w.texture.mipmaps.length>0)zt(x.__webglFramebuffer[0],w,0);else zt(x.__webglFramebuffer,w,0);else if(U){x.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[ee]),x.__webglDepthbuffer[ee]===void 0)x.__webglDepthbuffer[ee]=e.createRenderbuffer(),Rt(x.__webglDepthbuffer[ee],w,!1);else{let J=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=x.__webglDepthbuffer[ee];e.bindRenderbuffer(e.RENDERBUFFER,re),e.framebufferRenderbuffer(e.FRAMEBUFFER,J,e.RENDERBUFFER,re)}}else{if(w.texture.mipmaps.length>0)n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer);if(x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=e.createRenderbuffer(),Rt(x.__webglDepthbuffer,w,!1);else{let J=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=x.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,re),e.framebufferRenderbuffer(e.FRAMEBUFFER,J,e.RENDERBUFFER,re)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function dn(w,x,U){let ee=i.get(w);if(x!==void 0)_t(ee.__webglFramebuffer,w,w.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(U!==void 0)Ht(w)}function L(w){let x=w.texture,U=i.get(w),ee=i.get(x);w.addEventListener("dispose",H),P(w);let J=w.textures,re=w.isWebGLCubeRenderTarget===!0,ce=J.length>1;if(!ce){if(ee.__webglTexture===void 0)ee.__webglTexture=e.createTexture();ee.__version=x.version,a.memory.textures++}if(re){U.__webglFramebuffer=[];for(let G=0;G<6;G++)if(x.mipmaps.length>0){U.__webglFramebuffer[G]=[];for(let q=0;q<x.mipmaps.length;q++)U.__webglFramebuffer[G][q]=e.createFramebuffer()}else U.__webglFramebuffer[G]=e.createFramebuffer()}else{if(x.mipmaps.length>0){U.__webglFramebuffer=[];for(let G=0;G<x.mipmaps.length;G++)U.__webglFramebuffer[G]=e.createFramebuffer()}else U.__webglFramebuffer=e.createFramebuffer();if(ce)for(let G=0,q=J.length;G<q;G++){let oe=i.get(J[G]);if(oe.__webglTexture===void 0)oe.__webglTexture=e.createTexture(),a.memory.textures++}if(w.samples>0&&rt(w)===!1){U.__webglMultisampledFramebuffer=e.createFramebuffer(),U.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let G=0;G<J.length;G++){let q=J[G];U.__webglColorRenderbuffer[G]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,U.__webglColorRenderbuffer[G]);let oe=r.convert(q.format,q.colorSpace),R=r.convert(q.type),X=A(q.internalFormat,oe,R,q.normalized,q.colorSpace,w.isXRRenderTarget===!0),W=de(w);e.renderbufferStorageMultisample(e.RENDERBUFFER,W,X,w.width,w.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+G,e.RENDERBUFFER,U.__webglColorRenderbuffer[G])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),w.depthBuffer)U.__webglDepthRenderbuffer=e.createRenderbuffer(),Rt(U.__webglDepthRenderbuffer,w,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(re){n.bindTexture(e.TEXTURE_CUBE_MAP,ee.__webglTexture),lt(e.TEXTURE_CUBE_MAP,x);for(let G=0;G<6;G++)if(x.mipmaps.length>0)for(let q=0;q<x.mipmaps.length;q++)_t(U.__webglFramebuffer[G][q],w,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+G,q);else _t(U.__webglFramebuffer[G],w,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+G,0);if(T(x))b(e.TEXTURE_CUBE_MAP);else if(x.mipmaps.length>0)e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAX_LEVEL,x.mipmaps.length-1);n.unbindTexture()}else if(ce){for(let G=0,q=J.length;G<q;G++){let oe=J[G],R=i.get(oe),X=e.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)X=w.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,R.__webglTexture),lt(X,oe),_t(U.__webglFramebuffer,w,oe,e.COLOR_ATTACHMENT0+G,X,0),T(oe))b(X)}n.unbindTexture()}else{let G=e.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)G=w.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(G,ee.__webglTexture),lt(G,x),x.mipmaps.length>0)for(let q=0;q<x.mipmaps.length;q++)_t(U.__webglFramebuffer[q],w,x,e.COLOR_ATTACHMENT0,G,q);else _t(U.__webglFramebuffer,w,x,e.COLOR_ATTACHMENT0,G,0);if(T(x))b(G);else if(x.mipmaps.length>0)e.texParameteri(G,e.TEXTURE_MAX_LEVEL,x.mipmaps.length-1);n.unbindTexture()}if(w.depthBuffer)Ht(w)}function fn(w){let x=w.textures;for(let U=0,ee=x.length;U<ee;U++){let J=x[U];if(T(J)&&J.mipmapsAutoUpdate===!0){let re=E(w),ce=i.get(J).__webglTexture;n.bindTexture(re,ce),b(re),n.unbindTexture()}}}let Qe=[];function Mt(w){if(w.samples>0){if(rt(w)===!1){let{textures:x,width:U,height:ee}=w,J=e.COLOR_BUFFER_BIT,re=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ce=i.get(w),G=x.length>1;if(G)for(let oe=0;oe<x.length;oe++)n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.TEXTURE_2D,null,0);if(n.bindFramebuffer(e.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer),w.texture.mipmaps.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let oe=0;oe<x.length;oe++){if(w.resolveDepthBuffer){if(w.depthBuffer)J|=e.DEPTH_BUFFER_BIT;if(w.stencilBuffer&&w.resolveStencilBuffer)J|=e.STENCIL_BUFFER_BIT}if(G){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,ce.__webglColorRenderbuffer[oe]);let R=i.get(x[oe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,R,0)}if(e.blitFramebuffer(0,0,U,ee,0,0,U,ee,J,e.NEAREST),l===!0){if(Qe.length=0,Qe.push(e.COLOR_ATTACHMENT0+oe),w.depthBuffer&&w.storeMultisampledDepthBuffer===!1)Qe.push(re);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,Qe)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),G)for(let oe=0;oe<x.length;oe++){n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.RENDERBUFFER,ce.__webglColorRenderbuffer[oe]);let R=i.get(x[oe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.TEXTURE_2D,R,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.storeMultisampledDepthBuffer===!1&&l){let x=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[x])}}}function de(w){return Math.min(s.maxSamples,w.samples)}function rt(w){let x=i.get(w);return w.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function Pe(w){let x=a.render.frame;if(h.get(w)!==x)h.set(w,x),w.update()}function De(w,x){let{colorSpace:U,format:ee,type:J}=w;if(w.isCompressedTexture===!0||w.isVideoTexture===!0)return x;if(U!==nn&&U!==Hi)if(He.getTransfer(U)===st){if(ee!==bn||J!==Sn)Te("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Le("WebGLTextures: Unsupported texture color space:",U);return x}function Ct(w){if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement)c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height;else if(typeof VideoFrame<"u"&&w instanceof VideoFrame)c.width=w.displayWidth,c.height=w.displayHeight;else c.width=w.width,c.height=w.height;return c}this.allocateTextureUnit=Z,this.resetTextureUnits=j,this.getTextureUnits=ie,this.setTextureUnits=be,this.setTexture2D=ye,this.setTexture2DArray=Ce,this.setTexture3D=Ie,this.setTextureCube=Se,this.rebindTextures=dn,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fn,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=Ht,this.setupFrameBufferTexture=_t,this.useMultisampledRTT=rt,this.dispose=Y}function uv(e,t){function n(i,s=Hi){let r,a=He.getTransfer(s);if(i===Sn)return e.UNSIGNED_BYTE;if(i===Jo)return e.UNSIGNED_SHORT_4_4_4_4;if(i===jo)return e.UNSIGNED_SHORT_5_5_5_1;if(i===Xu)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===$u)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===Wu)return e.BYTE;if(i===Vu)return e.SHORT;if(i===Qs)return e.UNSIGNED_SHORT;if(i===Ko)return e.INT;if(i===ui)return e.UNSIGNED_INT;if(i===qn)return e.FLOAT;if(i===Cn)return e.HALF_FLOAT;if(i===qu)return e.ALPHA;if(i===Yu)return e.RGB;if(i===bn)return e.RGBA;if(i===vs)return e.DEPTH_COMPONENT;if(i===di)return e.DEPTH_STENCIL;if(i===Zu)return e.RED;if(i===Qo)return e.RED_INTEGER;if(i===zi)return e.RG;if(i===el)return e.RG_INTEGER;if(i===tl)return e.RGBA_INTEGER;if(i===sa||i===ra||i===aa||i===oa)if(a===st)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===sa)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ra)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===aa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===oa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===sa)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ra)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===aa)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===oa)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===nl||i===il||i===sl||i===rl)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===nl)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===il)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===sl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===rl)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===al||i===ol||i===ll||i===cl||i===hl||i===la||i===ul)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(i===al||i===ol)return a===st?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===ll)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===cl)return r.COMPRESSED_R11_EAC;if(i===hl)return r.COMPRESSED_SIGNED_R11_EAC;if(i===la)return r.COMPRESSED_RG11_EAC;if(i===ul)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===dl||i===fl||i===pl||i===ml||i===gl||i===_l||i===xl||i===vl||i===yl||i===Sl||i===bl||i===Ml||i===wl||i===Tl)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(i===dl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===pl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ml)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===gl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===_l)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===xl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===vl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===yl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Sl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===bl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ml)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Tl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===El||i===Al||i===Rl)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(i===El)return a===st?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Al)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Rl)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Cl||i===Il||i===ca||i===Pl)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(i===Cl)return r.COMPRESSED_RED_RGTC1_EXT;if(i===Il)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ca)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Pl)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===ki)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}class jd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ta(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new Kn({vertexShader:dv,fragmentShader:fv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new yt(new cr(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}function mv(e,t){function n(p,m){if(p.matrixAutoUpdate===!0)p.updateMatrix();m.value.copy(p.matrix)}function i(p,m){if(m.color.getRGB(p.fogColor.value,Yl(e)),m.isFog)p.fogNear.value=m.near,p.fogFar.value=m.far;else if(m.isFogExp2)p.fogDensity.value=m.density}function s(p,m,M,T,b){if(m.isNodeMaterial)m.uniformsNeedUpdate=!1;else if(m.isMeshBasicMaterial)r(p,m);else if(m.isMeshLambertMaterial){if(r(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshToonMaterial)r(p,m),u(p,m);else if(m.isMeshPhongMaterial){if(r(p,m),h(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshStandardMaterial){if(r(p,m),d(p,m),m.isMeshPhysicalMaterial)f(p,m,b)}else if(m.isMeshMatcapMaterial)r(p,m),_(p,m);else if(m.isMeshDepthMaterial)r(p,m);else if(m.isMeshDistanceMaterial)r(p,m),y(p,m);else if(m.isMeshNormalMaterial)r(p,m);else if(m.isLineBasicMaterial){if(a(p,m),m.isLineDashedMaterial)o(p,m)}else if(m.isPointsMaterial)l(p,m,M,T);else if(m.isSpriteMaterial)c(p,m);else if(m.isShadowMaterial)p.color.value.copy(m.color),p.opacity.value=m.opacity;else if(m.isShaderMaterial)m.uniformsNeedUpdate=!1}function r(p,m){if(p.opacity.value=m.opacity,m.color)p.diffuse.value.copy(m.color);if(m.emissive)p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity);if(m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.bumpMap){if(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Xt)p.bumpScale.value*=-1}if(m.normalMap){if(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Xt)p.normalScale.value.negate()}if(m.displacementMap)p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias;if(m.emissiveMap)p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform);if(m.specularMap)p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest;let M=t.get(m),{envMap:T,envMapRotation:b}=M;if(T){if(p.envMap.value=T,p.envMapRotation.value.setFromMatrix4(pv.makeRotationFromEuler(b)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(ef);p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio}if(m.lightMap)p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform);if(m.aoMap)p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform)}function a(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map)p.map.value=m.map,n(m.map,p.mapTransform)}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function l(p,m,M,T){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*M,p.scale.value=T*0.5,m.map)p.map.value=m.map,n(m.map,p.uvTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function c(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function h(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,0.0001)}function u(p,m){if(m.gradientMap)p.gradientMap.value=m.gradientMap}function d(p,m){if(p.metalness.value=m.metalness,m.metalnessMap)p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=m.roughness,m.roughnessMap)p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform);if(m.envMap)p.envMapIntensity.value=m.envMapIntensity}function f(p,m,M){if(p.ior.value=m.ior,m.diffuseRoughness>0){if(p.diffuseRoughness.value=m.diffuseRoughness,m.diffuseRoughnessMap)p.diffuseRoughnessMap.value=m.diffuseRoughnessMap,n(m.diffuseRoughnessMap,p.diffuseRoughnessMapTransform)}if(m.sheen>0){if(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap)p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform);if(m.sheenRoughnessMap)p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(m.clearcoat>0){if(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap)p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform);if(m.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(m.clearcoatNormalMap){if(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Xt)p.clearcoatNormalScale.value.negate()}}if(m.dispersion>0)p.dispersion.value=m.dispersion;if(m.retroreflectivity>0)p.retroreflectivity.value=m.retroreflectivity;if(m.iridescence>0){if(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessMinimum,p.iridescenceThicknessMaximum.value=m.iridescenceThicknessMaximum,m.iridescenceMap)p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform);if(m.iridescenceThicknessMap)p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(m.transmission>0){if(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=M.texture,p.transmissionSamplerSize.value.set(M.width,M.height),m.transmissionMap)p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=m.thickness,m.thicknessMap)p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)}if(m.anisotropy>0){if(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap)p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap)p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform);if(m.specularIntensityMap)p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform)}function _(p,m){if(m.matcap)p.matcap.value=m.matcap}function y(p,m){let M=t.get(m).light;p.referencePosition.value.setFromMatrixPosition(M.matrixWorld),p.nearDistance.value=M.shadow.camera.near,p.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function gv(e,t,n,i){let s={},r={};function a(M,T){let b=T.program;i.uniformBlockBinding(M,b,s[M.id])}function o(M,T){let b=s[M.id];if(b===void 0)_(M),b=l(M),s[M.id]=b,M.addEventListener("dispose",p);let E=T.program;i.updateUBOMapping(M,E);let A=t.render.frame;if(r[M.id]!==A)c(M),r[M.id]=A}function l(M){let T=e.createBuffer(),{__size:b,usage:E}=M;return e.bindBuffer(e.UNIFORM_BUFFER,T),e.bufferData(e.UNIFORM_BUFFER,b,E),e.bindBuffer(e.UNIFORM_BUFFER,null),T}function c(M){let T=s[M.id],{uniforms:b,__cache:E}=M;e.bindBuffer(e.UNIFORM_BUFFER,T);for(let A=0,g=b.length;A<g;A++){let S=b[A];if(Array.isArray(S))for(let P=0,z=S.length;P<z;P++)h(S[P],A,P,E);else h(S,A,0,E)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function h(M,T,b,E){if(d(M,T,b,E)===!0){let{__offset:A,value:g}=M;if(Array.isArray(g)){let S=0;for(let P=0;P<g.length;P++){let z=g[P],N=y(z,!0);u(z,M.__data,S),S+=N.storage/Float32Array.BYTES_PER_ELEMENT}}else u(g,M.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,A,M.__data)}}function u(M,T,b){if(typeof M==="number"||typeof M==="boolean")T[b]=M;else if(M.isMatrix3)T[b]=M.elements[0],T[b+1]=M.elements[1],T[b+2]=M.elements[2],T[b+3]=0,T[b+4]=M.elements[3],T[b+5]=M.elements[4],T[b+6]=M.elements[5],T[b+7]=0,T[b+8]=M.elements[6],T[b+9]=M.elements[7],T[b+10]=M.elements[8],T[b+11]=0;else if(ArrayBuffer.isView(M))T.set(M.subarray(0,T.length-b),b);else M.toArray(T,b)}function d(M,T,b,E){let A=M.value,g=T+"_"+b;if(Array.isArray(A)){if(E[g]===void 0)E[g]=[];let S=E[g],P=!1;for(let z=0;z<A.length;z++)if(f(A[z],S,z)===!0)P=!0;return P}return f(A,E,g)}function f(M,T,b){if(T[b]===void 0){if(typeof M==="number"||typeof M==="boolean")T[b]=M;else if(ArrayBuffer.isView(M))T[b]=M.slice();else T[b]=M.clone();return!0}else{let E=T[b];if(typeof M==="number"||typeof M==="boolean"){if(E!==M)return T[b]=M,!0}else if(ArrayBuffer.isView(M))return!0;else if(E.equals(M)===!1)return E.copy(M),!0}return!1}function _(M){let T=M.uniforms,b=0,E=16;for(let g=0,S=T.length;g<S;g++){let P=Array.isArray(T[g])?T[g]:[T[g]];for(let z=0,N=P.length;z<N;z++){let H=P[z],Q=Array.isArray(H.value)?H.value:[H.value],C=Array.isArray(T[g])||Array.isArray(H.value),Y=b;for(let B=0,ae=Q.length;B<ae;B++){let V=Q[B],j=y(V,C),ie=b%E,be=ie%j.boundary,Z=ie+be;if(b+=be,Z!==0&&E-Z<j.storage)b+=E-Z;if(B===0)Y=b;b+=j.storage}let K=H.type==="int"?Int32Array:H.type==="uint"?Uint32Array:Float32Array;H.__data=new K((b-Y)/Float32Array.BYTES_PER_ELEMENT),H.__offset=Y}}let A=b%E;if(A>0)b+=E-A;return M.__size=b,M.__cache={},this}function y(M,T){let b={boundary:0,storage:0};if(typeof M==="number"||typeof M==="boolean")b.boundary=4,b.storage=4;else if(M.isVector2)b.boundary=8,b.storage=8;else if(M.isVector3||M.isColor)b.boundary=16,b.storage=12;else if(M.isVector4)b.boundary=16,b.storage=16;else if(M.isMatrix3)b.boundary=16,b.storage=48;else if(M.isMatrix4)b.boundary=16,b.storage=64;else if(M.isTexture)Te("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(M))b.boundary=16,b.storage=M.byteLength;else Te("WebGLRenderer: Unsupported uniform value type.",M);if(T===!0)b.boundary=16,b.storage=Math.ceil(b.storage/16)*16;return b}function p(M){let T=M.target;T.removeEventListener("dispose",p),e.deleteBuffer(s[T.id]),delete s[T.id],delete r[T.id]}function m(){for(let M in s)e.deleteBuffer(s[M]);s={},r={}}return{bind:a,update:o,dispose:m}}function xv(){if(Ln===null)Ln=new Wi(_v,16,16,zi,Cn),Ln.name="DFG_LUT",Ln.minFilter=mt,Ln.magFilter=mt,Ln.wrapS=_s,Ln.wrapT=_s,Ln.generateMipmaps=!1,Ln.needsUpdate=!0;return Ln}class fc{constructor(e={}){let{canvas:t=nd(),context:n=null,depth:i=!0,stencil:s=!1,alpha:r=!1,antialias:a=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:u=!1,outputBufferType:d=Sn}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=r;let _=d,y=new Set([tl,el,Qo]),p=new Set([Sn,ui,Qs,ki,Jo,jo]),m=new Uint32Array(4),M=new Int32Array(4),T={textures:[],min:[],max:[],resolution:[]},b=null,E=null,A=[],g=[],S=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Rn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let P=this,z=!1,N=null,H=null,Q=null,C=null;this._outputColorSpace=ln;let Y=0,K=0,B=null,ae=-1,V=null,j=new tt,ie=new tt,be=null,Z=new Ee(0),ne=0,{width:ye,height:Ce}=t,Ie=1,Se=null,je=null,We=new tt(0,0,ye,Ce),Oe=new tt(0,0,ye,Ce),lt=!1,qe=new Fi,dt=new va,gt=!1,kt=!1,Zt=new Fe,_t=new D,Rt=new tt,zt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ht=!1;function dn(){return B===null?Ie:1}let L=n;function fn(v,I){return t.getContext(v,I)}let Qe,Mt,de,rt,Pe,De,Ct,w,x,U,ee,J,re,ce,G,q,oe,R,X,W,te,se,ue;try{let v={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${cu}`);if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",Re,!1),t.addEventListener("webglcontextcreationerror",Be,!1),L===null){if(L=fn("webgl2",v),L===null)if(fn("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}Ae()}catch(v){throw t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Be,!1),Le("WebGLRenderer: "+v.message),v}function Ae(){if(Qe=new C0(L),Qe.init(),te=new uv(L,Qe),Mt=new x0(L,Qe,e,te),de=new cv(L,Qe),Mt.reversedDepthBuffer&&u)de.buffers.depth.setReversed(!0);H=L.createFramebuffer(),Q=L.createFramebuffer(),C=L.createFramebuffer(),rt=new L0(L),Pe=new Zx,De=new hv(L,Qe,de,Pe,Mt,te,rt),Ct=new R0(P),w=new Dm(L),se=new g0(L,w),x=new I0(L,w,rt,se),U=new D0(L,x,w,se,rt),R=new N0(L,Mt,De),G=new v0(Pe),ee=new Yx(P,Ct,Qe,Mt,se,G),J=new mv(P,Pe),re=new Jx,ce=new iv(Qe),oe=new m0(P,Ct,de,U,f,o),q=new lv(P,U,Mt),ue=new gv(L,rt,Mt,de),X=new _0(L,Qe,rt),W=new P0(L,Qe,rt),rt.programs=ee.programs,P.capabilities=Mt,P.extensions=Qe,P.properties=Pe,P.renderLists=re,P.shadowMap=q,P.state=de,P.info=rt}if(_!==Sn)S=new F0(_,t.width,t.height,a,i,s);let we=new Qd(P,L);this.xr=we,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let v=Qe.get("WEBGL_lose_context");if(v)v.loseContext()},this.forceContextRestore=function(){let v=Qe.get("WEBGL_lose_context");if(v)v.restoreContext()},this.getPixelRatio=function(){return Ie},this.setPixelRatio=function(v){if(v===void 0)return;Ie=v,this.setSize(ye,Ce,!1)},this.getSize=function(v){return v.set(ye,Ce)},this.setSize=function(v,I,k=!0){if(we.isPresenting){Te("WebGLRenderer: Can't change size while VR device is presenting.");return}if(ye=v,Ce=I,t.width=Math.floor(v*Ie),t.height=Math.floor(I*Ie),k===!0)t.style.width=v+"px",t.style.height=I+"px";if(S!==null)S.setSize(t.width,t.height);this.setViewport(0,0,v,I)},this.getDrawingBufferSize=function(v){return v.set(ye*Ie,Ce*Ie).floor()},this.setDrawingBufferSize=function(v,I,k){ye=v,Ce=I,Ie=k,t.width=Math.floor(v*k),t.height=Math.floor(I*k),this.setViewport(0,0,v,I)},this.setEffects=function(v){if(_===Sn){Le("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let I=0;I<v.length;I++)if(v[I].isOutputPass===!0){Te("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(j)},this.getViewport=function(v){return v.copy(We)},this.setViewport=function(v,I,k,F){if(v.isVector4)We.set(v.x,v.y,v.z,v.w);else We.set(v,I,k,F);de.viewport(j.copy(We).multiplyScalar(dn()).round())},this.getScissor=function(v){return v.copy(Oe)},this.setScissor=function(v,I,k,F){if(v.isVector4)Oe.set(v.x,v.y,v.z,v.w);else Oe.set(v,I,k,F);de.scissor(ie.copy(Oe).multiplyScalar(dn()).round())},this.getScissorTest=function(){return lt},this.setScissorTest=function(v){de.setScissorTest(lt=v)},this.setOpaqueSort=function(v){Se=v},this.setTransparentSort=function(v){je=v},this.getClearColor=function(v){return v.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor(...arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha(...arguments)},this.clear=function(v=!0,I=!0,k=!0){let F=0;if(v){let O=!1;if(B!==null){let he=B.texture.format;O=y.has(he)}if(O){let he=B.texture.type,_e=p.has(he),le=oe.getClearColor(),ge=oe.getClearAlpha(),{r:Me,g:Ue,b:Xe}=le;if(_e)m[0]=Me,m[1]=Ue,m[2]=Xe,m[3]=ge,L.clearBufferuiv(L.COLOR,0,m);else M[0]=Me,M[1]=Ue,M[2]=Xe,M[3]=ge,L.clearBufferiv(L.COLOR,0,M)}else F|=L.COLOR_BUFFER_BIT}if(I)F|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(k)F|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(F!==0)L.clear(F)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),N=v},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Be,!1),oe.dispose(),re.dispose(),ce.dispose(),De.dispose(),Pe.dispose(),Ct.dispose(),U.dispose(),x.dispose(),se.dispose(),ue.dispose(),ee.dispose(),we.dispose(),we.removeEventListener("sessionstart",Dc),we.removeEventListener("sessionend",Uc),bi.stop()};function pe(v){v.preventDefault(),Ys("WebGLRenderer: Context Lost."),z=!0}function Re(){Ys("WebGLRenderer: Context Restored."),z=!1;let v=rt.autoReset,I=q.enabled,k=q.autoUpdate,F=q.needsUpdate,O=q.type;Ae(),rt.autoReset=v,q.enabled=I,q.autoUpdate=k,q.needsUpdate=F,q.type=O}function Be(v){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function me(v){let I=v.target;I.removeEventListener("dispose",me),et(I)}function et(v){wt(v),Pe.remove(v)}function wt(v){let I=Pe.get(v).programs;if(I!==void 0){if(I.forEach(function(k){ee.releaseProgram(k)}),v.isShaderMaterial)ee.releaseShaderCache(v)}}this.renderBufferDirect=function(v,I,k,F,O,he){if(I===null)I=zt;let _e=O.isMesh&&O.matrixWorld.determinantAffine()<0,le=Zf(v,I,k,F,O);de.setMaterial(F,_e);let ge=k.index,Me=1;if(F.wireframe===!0){if(ge=x.getWireframeAttribute(k),ge===void 0)return;Me=2}let Ue=k.drawRange,Xe=k.attributes.position,xe=Ue.start*Me,$e=(Ue.start+Ue.count)*Me;if(he!==null)xe=Math.max(xe,he.start*Me),$e=Math.min($e,(he.start+he.count)*Me);if(ge!==null)xe=Math.max(xe,0),$e=Math.min($e,ge.count);else if(Xe!==void 0&&Xe!==null)xe=Math.max(xe,0),$e=Math.min($e,Xe.count);let xt=$e-xe;if(xt<0||xt===1/0)return;se.setup(O,F,le,k,ge);let at,nt=X;if(ge!==null)at=w.get(ge),nt=W,nt.setIndex(at);if(O.isMesh)if(F.wireframe===!0)de.setLineWidth(F.wireframeLinewidth*dn()),nt.setMode(L.LINES);else nt.setMode(L.TRIANGLES);else if(O.isLine){let It=F.linewidth;if(It===void 0)It=1;if(de.setLineWidth(It*dn()),O.isLineSegments)nt.setMode(L.LINES);else if(O.isLineLoop)nt.setMode(L.LINE_LOOP);else nt.setMode(L.LINE_STRIP)}else if(O.isPoints)nt.setMode(L.POINTS);else if(O.isSprite)nt.setMode(L.TRIANGLES);if(O.isBatchedMesh)if(!Qe.get("WEBGL_multi_draw")){let{_multiDrawStarts:It,_multiDrawCounts:ve,_multiDrawCount:Ot}=O,Ke=ge?w.get(ge).bytesPerElement:1,Mi=Pe.get(F).currentProgram.getUniforms();for(let Pt=0;Pt<Ot;Pt++)Mi.setValue(L,"_gl_DrawID",Pt),nt.render(It[Pt]/Ke,ve[Pt])}else nt.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else if(O.isInstancedMesh)nt.renderInstances(xe,xt,O.count);else if(k.isInstancedBufferGeometry){let It=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,ve=Math.min(k.instanceCount,It);nt.renderInstances(xe,xt,ve)}else nt.render(xe,xt)};function Un(v,I,k,F){if(N!==null&&v.isNodeMaterial)N.setObject(F,v);if(gt===!0)G.setState(v,k,!1);if(v.transparent===!0&&v.side===$t&&v.forceSinglePass===!1)v.side=Xt,v.needsUpdate=!0,Is(v,I,F),v.side=ci,v.needsUpdate=!0,Is(v,I,F),v.side=$t;else Is(v,I,F)}this.compile=function(v,I,k=null){if(k===null)k=v;if(N!==null)N.renderStart(v,I,k);if(E=ce.get(k),E.init(I),g.push(E),k.traverseVisible(function(O){if(O.isLight&&O.layers.test(I.layers)){if(E.pushLight(O),O.castShadow)E.pushShadow(O)}}),v!==k)v.traverseVisible(function(O){if(O.isLight&&O.layers.test(I.layers)){if(E.pushLight(O),O.castShadow)E.pushShadow(O)}});if(E.setupLights(),N!==null)N.updateLights(E.state.lightsArray);if(kt=this.localClippingEnabled,gt=G.init(this.clippingPlanes,kt),gt===!0)G.setGlobalState(this.clippingPlanes,I);if(N!==null)q.render(E.state.shadowsArray,k,I);let F=new Set;if(v.traverse(function(O){if(!(O.isMesh||O.isPoints||O.isLine||O.isSprite))return;let he=O.material;if(he)if(Array.isArray(he))for(let _e=0;_e<he.length;_e++){let le=he[_e];Un(le,k,I,O),F.add(le)}else Un(he,k,I,O),F.add(he)}),E=g.pop(),N!==null)N.renderEnd();return F},this.compileAsync=function(v,I,k=null){let F=this.compile(v,I,k);return new Promise((O)=>{function he(){if(F.forEach(function(_e){let ge=Pe.get(_e).currentProgram;if(ge===void 0||ge.isReady())F.delete(_e)}),F.size===0){O(v);return}setTimeout(he,10)}if(Qe.get("KHR_parallel_shader_compile")!==null)he();else setTimeout(he,10)})};let Ha=null;function qf(v){if(Ha)Ha(v)}function Dc(){bi.stop()}function Uc(){bi.start()}let bi=new Od;if(bi.setAnimationLoop(qf),typeof self<"u")bi.setContext(self);this.setAnimationLoop=function(v){Ha=v,we.setAnimationLoop(v),v===null?bi.stop():bi.start()},we.addEventListener("sessionstart",Dc),we.addEventListener("sessionend",Uc),this.render=function(v,I){if(I!==void 0&&I.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;if(N!==null)N.renderStart(v,I);let k=we.enabled===!0&&we.isPresenting===!0,F=S!==null&&(B===null||k)&&S.begin(P,B);if(v.matrixWorldAutoUpdate===!0)v.updateMatrixWorld();if(I.parent===null&&I.matrixWorldAutoUpdate===!0)I.updateMatrixWorld();if(we.enabled===!0&&we.isPresenting===!0&&(S===null||S.isCompositing()===!1)){if(we.cameraAutoUpdate===!0)we.updateCamera(I);I=we.getCamera()}if(v.isScene===!0)v.onBeforeRender(P,v,I,B);if(E=ce.get(v,g.length),E.init(I),E.state.textureUnits=De.getTextureUnits(),g.push(E),Zt.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),I.isArrayCamera)dt.setFromArrayCamera(I);else qe.setFromProjectionMatrix(Zt,zl,I.reversedDepth);if(kt=this.localClippingEnabled,gt=G.init(this.clippingPlanes,kt),b=re.get(v,A.length),b.init(),A.push(b),this.info.render.frame++,we.enabled===!0&&we.isPresenting===!0){let _e=P.xr.getDepthSensingMesh();if(_e!==null)Ga(_e,I,-1/0,P.sortObjects)}if(Ga(v,I,0,P.sortObjects),b.finish(),N!==null)N.updateLights(E.state.lightsArray);if(P.sortObjects===!0)b.sort(Se,je);if(Ht=we.enabled===!1||we.isPresenting===!1||we.hasDepthSensing()===!1,Ht)oe.addToRenderList(b,v);if(this.info.autoReset===!0)this.info.reset();if(gt===!0)G.beginShadows();let O=E.state.shadowsArray;if(q.render(O,v,I),gt===!0)G.endShadows();if((F&&S.hasRenderPass())===!1){let _e=b.opaque,le=b.transmissive;if(E.setupLights(),I.isArrayCamera){let ge=I.cameras;if(le.length>0)for(let Me=0,Ue=ge.length;Me<Ue;Me++){let Xe=ge[Me];Oc(_e,le,v,Xe)}if(Ht)oe.render(v);for(let Me=0,Ue=ge.length;Me<Ue;Me++){let Xe=ge[Me];Fc(b,v,Xe,Xe.viewport)}}else{if(le.length>0)Oc(_e,le,v,I);if(Ht)oe.render(v);Fc(b,v,I)}}if(B!==null&&K===0)De.updateMultisampleRenderTarget(B),De.updateRenderTargetMipmap(B);if(F)S.end(P);if(v.isScene===!0)v.onAfterRender(P,v,I);if(se.resetDefaultState(),ae=-1,V=null,g.pop(),g.length>0){if(E=g[g.length-1],De.setTextureUnits(E.state.textureUnits),gt===!0)G.setGlobalState(P.clippingPlanes,E.state.camera)}else E=null;if(A.pop(),A.length>0)b=A[A.length-1];else b=null;if(N!==null)N.renderEnd()};function Ga(v,I,k,F){if(v.visible===!1)return;if(v.layers.test(I.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD){if(v.autoUpdate===!0)v.update(I)}else if(v.isLight){if(E.pushLight(v),v.castShadow)E.pushShadow(v)}else if(v.isSprite){let _e=I.isArrayCamera?dt:qe;if(!v.frustumCulled||v.intersectsFrustum(_e)){if(F)Rt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(Zt);let le=U.update(v),ge=v.material;if(ge.visible)b.push(v,le,ge,k,Rt.z,null,I)}}else if(v.isMesh||v.isLine||v.isPoints){let _e=I.isArrayCamera?dt:qe;if(!v.frustumCulled||v.intersectsFrustum(_e)){let le=U.update(v),ge=v.material;if(F){if(v.boundingSphere!==void 0){if(v.boundingSphere===null)v.computeBoundingSphere();Rt.copy(v.boundingSphere.center)}else{if(le.boundingSphere===null)le.computeBoundingSphere();Rt.copy(le.boundingSphere.center)}Rt.applyMatrix4(v.matrixWorld).applyMatrix4(Zt)}if(Array.isArray(ge)){let Me=le.groups;for(let Ue=0,Xe=Me.length;Ue<Xe;Ue++){let xe=Me[Ue],$e=ge[xe.materialIndex];if($e&&$e.visible)b.push(v,le,$e,k,Rt.z,xe,I)}}else if(ge.visible)b.push(v,le,ge,k,Rt.z,null,I)}}}let he=v.children;for(let _e=0,le=he.length;_e<le;_e++)Ga(he[_e],I,k,F)}function Fc(v,I,k,F){let{opaque:O,transmissive:he,transparent:_e}=v;if(E.setupLightsView(k),gt===!0)G.setGlobalState(P.clippingPlanes,k);if(F)de.viewport(j.copy(F));if(O.length>0)xr(O,I,k);if(he.length>0)xr(he,I,k);if(_e.length>0)xr(_e,I,k);de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function Oc(v,I,k,F){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[F.id]===void 0){let xe=Qe.has("EXT_color_buffer_half_float")||Qe.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[F.id]=new hn(1,1,{generateMipmaps:!0,type:xe?Cn:Sn,minFilter:tn,samples:Math.max(4,Mt.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:He.workingColorSpace})}let he=E.state.transmissionRenderTarget[F.id],_e=F.viewport||j;he.setSize(_e.z*P.transmissionResolutionScale,_e.w*P.transmissionResolutionScale);let le=P.getRenderTarget(),ge=P.getActiveCubeFace(),Me=P.getActiveMipmapLevel();if(P.setRenderTarget(he),P.getClearColor(Z),ne=P.getClearAlpha(),ne<1)P.setClearColor(16777215,0.5);if(P.clear(),Ht)oe.render(k);let Ue=P.toneMapping;P.toneMapping=Rn;let Xe=F.viewport;if(F.viewport!==void 0)F.viewport=void 0;if(E.setupLightsView(F),gt===!0)G.setGlobalState(P.clippingPlanes,F);if(xr(v,k,F),De.updateMultisampleRenderTarget(he),De.updateRenderTargetMipmap(he),Qe.has("WEBGL_multisampled_render_to_texture")===!1){let xe=!1;for(let $e=0,xt=I.length;$e<xt;$e++){let at=I[$e],{object:nt,geometry:It,material:ve,group:Ot}=at;if(ve.side===$t&&nt.layers.test(F.layers)){let Ke=ve.side;ve.side=Xt,ve.needsUpdate=!0,Bc(nt,k,F,It,ve,Ot),ve.side=Ke,ve.needsUpdate=!0,xe=!0}}if(xe===!0)De.updateMultisampleRenderTarget(he),De.updateRenderTargetMipmap(he)}if(P.setRenderTarget(le,ge,Me),P.setClearColor(Z,ne),Xe!==void 0)F.viewport=Xe;P.toneMapping=Ue}function xr(v,I,k){let F=I.isScene===!0?I.overrideMaterial:null;for(let O=0,he=v.length;O<he;O++){let _e=v[O],{object:le,geometry:ge,group:Me}=_e,Ue=_e.material;if(Ue.allowOverride===!0&&F!==null)Ue=F;if(le.layers.test(k.layers))Bc(le,I,k,ge,Ue,Me)}}function Bc(v,I,k,F,O,he){if(N!==null&&O.isNodeMaterial)N.setObject(v,O);if(v.onBeforeRender(P,I,k,F,O,he),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),O.onBeforeRender(P,I,k,F,v,he),O.transparent===!0&&O.side===$t&&O.forceSinglePass===!1)O.side=Xt,O.needsUpdate=!0,P.renderBufferDirect(k,I,F,O,v,he),O.side=ci,O.needsUpdate=!0,P.renderBufferDirect(k,I,F,O,v,he),O.side=$t;else P.renderBufferDirect(k,I,F,O,v,he);v.onAfterRender(P,I,k,F,O,he)}function kc(v){let I=0;for(let k of v)if(k.texture!==null)I++;return I}function Is(v,I,k){if(I.isScene!==!0)I=zt;let F=Pe.get(v),O=E.state.lights,he=E.state.shadowsArray,_e=O.state.version,le=ee.getParameters(v,O.state,he,I,k,E.state.lightProbeGridArray),ge=ee.getProgramCacheKey(le),Me=F.programs;F.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?I.environment:null,F.fog=I.fog;let Ue=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;if(F.envMap=Ct.get(v.envMap||F.environment,Ue),F.envMapRotation=F.environment!==null&&v.envMap===null?I.environmentRotation:v.envMapRotation,Me===void 0)v.addEventListener("dispose",me),Me=new Map,F.programs=Me,F.programVariants=new Map;let Xe=Me.get(ge);if(Xe!==void 0){if(F.currentProgram===Xe&&F.lightsStateVersion===_e)return Hc(v,le),Xe}else{if(le.uniforms=ee.getUniforms(v),N!==null&&v.isNodeMaterial)N.build(v,k,le);v.onBeforeCompile(le,P),Xe=ee.acquireProgram(le,ge),Me.set(ge,Xe),F.uniforms=le.uniforms}let xe=F.uniforms;if(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)xe.clippingPlanes=G.uniform;if(Hc(v,le),F.needsLights=Jf(v),F.lightsStateVersion=_e,F.needsLights)xe.ambientLightColor.value=O.state.ambient,xe.lightProbe.value=O.state.probe,xe.sunLights.value=O.state.sun,xe.sunLightShadows.value=O.state.sunShadow,xe.directionalLights.value=O.state.directional,xe.directionalLightShadows.value=O.state.directionalShadow,xe.spotLights.value=O.state.spot,xe.spotLightShadows.value=O.state.spotShadow,xe.rectAreaLights.value=O.state.rectArea,xe.ltc_1.value=O.state.rectAreaLTC1,xe.ltc_2.value=O.state.rectAreaLTC2,xe.pointLights.value=O.state.point,xe.pointLightShadows.value=O.state.pointShadow,xe.hemisphereLights.value=O.state.hemi,xe.sunShadowMatrix.value=O.state.sunShadowMatrix,xe.sunShadowCascade.value=O.state.sunShadowCascade,xe.directionalShadowMatrix.value=O.state.directionalShadowMatrix,xe.spotLightMatrix.value=O.state.spotLightMatrix,xe.spotLightMap.value=O.state.spotLightMap,xe.pointShadowMatrix.value=O.state.pointShadowMatrix;return F.numLightProbeGrids=kc(E.state.lightProbeGridArray),F.currentProgram=Xe,F.uniformsList=null,Xe}function Yf(v,I,k,F,O){let he=Pe.get(v),_e=he.currentProgram.id+","+F+","+O,le=he.programVariants.get(_e);if(le===void 0)le=Is(v,I,k),he.programVariants.set(_e,le);else he.currentProgram=le,he.uniformsList=null,he.outputColorSpace=F,he.toneMapping=O;return le}function zc(v){if(v.uniformsList===null){let I=v.currentProgram.getUniforms();v.uniformsList=mr.seqWithValue(I.seq,v.uniforms)}return v.uniformsList}function Hc(v,I){let k=Pe.get(v);k.outputColorSpace=I.outputColorSpace,k.batching=I.batching,k.batchingColor=I.batchingColor,k.instancing=I.instancing,k.instancingColor=I.instancingColor,k.instancingMorph=I.instancingMorph,k.skinning=I.skinning,k.morphTargets=I.morphTargets,k.morphNormals=I.morphNormals,k.morphColors=I.morphColors,k.morphTargetsCount=I.morphTargetsCount,k.numClippingPlanes=I.numClippingPlanes,k.numIntersection=I.numClipIntersection,k.vertexAlphas=I.vertexAlphas,k.vertexTangents=I.vertexTangents,k.toneMapping=I.toneMapping}function Zf(v,I,k,F,O){if(I.isScene!==!0)I=zt;De.resetTextureUnits();let he=I.fog,_e=F.isMeshStandardMaterial||F.isMeshLambertMaterial||F.isMeshPhongMaterial?I.environment:null,le=B===null?P.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:He.workingColorSpace,ge=F.isMeshStandardMaterial||F.isMeshLambertMaterial&&!F.envMap||F.isMeshPhongMaterial&&!F.envMap,Me=Ct.get(F.envMap||_e,ge),Ue=F.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Xe=!!k.attributes.tangent&&(!!F.normalMap||F.anisotropy>0),xe=!!k.morphAttributes.position,$e=!!k.morphAttributes.normal,xt=!!k.morphAttributes.color,at=Rn;if(F.toneMapped){if(B===null||B.isXRRenderTarget===!0)at=P.toneMapping}let nt=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,It=nt!==void 0?nt.length:0,ve=Pe.get(F),Ot=E.state.lights;if(gt===!0){if(kt===!0||v!==V){let ht=v===V&&F.id===ae;G.setState(F,v,ht)}}let Ke=!1,Mi=!1;if(F.version===ve.__version){if(ve.needsLights&&ve.lightsStateVersion!==Ot.state.version)Ke=!0;else if(O.isBatchedMesh&&ve.batching===!1)Ke=!0;else if(!O.isBatchedMesh&&ve.batching===!0)Ke=!0;else if(O.isBatchedMesh&&ve.batchingColor===!0&&O._colorsTexture===null)Ke=!0;else if(O.isBatchedMesh&&ve.batchingColor===!1&&O._colorsTexture!==null)Ke=!0;else if(O.isInstancedMesh&&ve.instancing===!1)Ke=!0;else if(!O.isInstancedMesh&&ve.instancing===!0)Ke=!0;else if(O.isSkinnedMesh&&ve.skinning===!1)Ke=!0;else if(!O.isSkinnedMesh&&ve.skinning===!0)Ke=!0;else if(O.isInstancedMesh&&ve.instancingColor===!0&&O.instanceColor===null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingColor===!1&&O.instanceColor!==null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingMorph===!0&&O.morphTexture===null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingMorph===!1&&O.morphTexture!==null)Ke=!0;else if(ve.envMap!==Me)Ke=!0;else if(F.fog===!0&&ve.fog!==he)Ke=!0;else if(ve.numClippingPlanes!==void 0&&(ve.numClippingPlanes!==G.numPlanes||ve.numIntersection!==G.numIntersection))Ke=!0;else if(ve.vertexAlphas!==Ue)Ke=!0;else if(ve.vertexTangents!==Xe)Ke=!0;else if(ve.morphTargets!==xe)Ke=!0;else if(ve.morphNormals!==$e)Ke=!0;else if(ve.morphColors!==xt)Ke=!0;else if(ve.morphTargetsCount!==It)Ke=!0;else if(ve.numLightProbeGrids!==kc(E.state.lightProbeGridArray))Ke=!0;else if(ve.outputColorSpace!==le||ve.toneMapping!==at)Mi=!0}else Ke=!0,ve.__version=F.version;let Pt=ve.currentProgram;if(Ke===!0||Mi===!0){if(Pt=Mi===!0?Yf(F,I,O,le,at):Is(F,I,O),N&&F.isNodeMaterial)N.onUpdateProgram(F,Pt,ve)}let vr=!1,Qn=!1,wi=!1,Ye=Pt.getUniforms(),At=ve.uniforms;if(de.useProgram(Pt.program))vr=!0,Qn=!0,wi=!0;if(F.id!==ae)ae=F.id,Qn=!0;if(vr||V!==v){if(de.buffers.depth.getReversed()&&v.reversedDepth!==!0)v._reversedDepth=!0,v.updateProjectionMatrix();Ye.setValue(L,"projectionMatrix",v.projectionMatrix),Ye.setValue(L,"viewMatrix",v.matrixWorldInverse);let Tt=Ye.map.cameraPosition;if(Tt!==void 0)Tt.setValue(L,_t.setFromMatrixPosition(v.matrixWorld));if(Mt.logarithmicDepthBuffer)Ye.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2));if(F.isMeshPhongMaterial||F.isMeshToonMaterial||F.isMeshLambertMaterial||F.isMeshBasicMaterial||F.isMeshStandardMaterial||F.isShaderMaterial)Ye.setValue(L,"isOrthographic",v.isOrthographicCamera===!0);if(V!==v)V=v,Qn=!0,wi=!0}if(ve.needsLights){if(Ot.state.sunShadowMap.length>0)Ye.setValue(L,"sunShadowMap",Ot.state.sunShadowMap,De);if(Ot.state.directionalShadowMap.length>0)Ye.setValue(L,"directionalShadowMap",Ot.state.directionalShadowMap,De);if(Ot.state.spotShadowMap.length>0)Ye.setValue(L,"spotShadowMap",Ot.state.spotShadowMap,De);if(Ot.state.pointShadowMap.length>0)Ye.setValue(L,"pointShadowMap",Ot.state.pointShadowMap,De)}if(O.isSkinnedMesh){Ye.setOptional(L,O,"bindMatrix"),Ye.setOptional(L,O,"bindMatrixInverse");let ht=O.skeleton;if(ht){if(ht.boneTexture===null)ht.computeBoneTexture();Ye.setValue(L,"boneTexture",ht.boneTexture,De)}}if(O.isBatchedMesh){if(Ye.setOptional(L,O,"batchingTexture"),Ye.setValue(L,"batchingTexture",O._matricesTexture,De),Ye.setOptional(L,O,"batchingIdTexture"),Ye.setValue(L,"batchingIdTexture",O._indirectTexture,De),Ye.setOptional(L,O,"batchingColorTexture"),O._colorsTexture!==null)Ye.setValue(L,"batchingColorTexture",O._colorsTexture,De)}let pn=k.morphAttributes;if(pn.position!==void 0||pn.normal!==void 0||pn.color!==void 0)R.update(O,k,Pt);if(Qn||ve.receiveShadow!==O.receiveShadow)ve.receiveShadow=O.receiveShadow,Ye.setValue(L,"receiveShadow",O.receiveShadow);if((F.isMeshStandardMaterial||F.isMeshLambertMaterial||F.isMeshPhongMaterial)&&F.envMap===null&&I.environment!==null)At.envMapIntensity.value=I.environmentIntensity;if(At.dfgLUT!==void 0)At.dfgLUT.value=xv();if(Qn){if(Ye.setValue(L,"toneMappingExposure",P.toneMappingExposure),ve.needsLights)Kf(At,wi);if(he&&F.fog===!0)J.refreshFogUniforms(At,he);if(J.refreshMaterialUniforms(At,F,Ie,Ce,E.state.transmissionRenderTarget[v.id]),ve.needsLights&&ve.numLightProbeGrids>0){let ht=T,Tt=0;for(let Fn of E.state.lightProbeGridArray){if(Fn.texture===null)continue;ht.textures[Tt]=Fn.texture,ht.min[Tt]=Fn.boundingBox.min,ht.max[Tt]=Fn.boundingBox.max,ht.resolution[Tt]=Fn.resolution,Tt++}for(let Fn in ht)ht[Fn].length=Tt;At.probesSH.value=ht.textures,At.probesMin.value=ht.min,At.probesMax.value=ht.max,At.probesResolution.value=ht.resolution}mr.upload(L,zc(ve),At,De)}if(F.isShaderMaterial&&F.uniformsNeedUpdate===!0)mr.upload(L,zc(ve),At,De),F.uniformsNeedUpdate=!1;if(F.isSpriteMaterial)Ye.setValue(L,"center",O.center);if(Ye.setValue(L,"modelViewMatrix",O.modelViewMatrix),Ye.setValue(L,"normalMatrix",O.normalMatrix),Ye.setValue(L,"modelMatrix",O.matrixWorld),F.uniformsGroups!==void 0){let ht=F.uniformsGroups;for(let Tt=0,Fn=ht.length;Tt<Fn;Tt++){let Wc=ht[Tt];ue.update(Wc,Pt),ue.bind(Wc,Pt)}}return Pt}function Kf(v,I){v.ambientLightColor.needsUpdate=I,v.lightProbe.needsUpdate=I,v.sunLights.needsUpdate=I,v.sunLightShadows.needsUpdate=I,v.directionalLights.needsUpdate=I,v.directionalLightShadows.needsUpdate=I,v.pointLights.needsUpdate=I,v.pointLightShadows.needsUpdate=I,v.spotLights.needsUpdate=I,v.spotLightShadows.needsUpdate=I,v.rectAreaLights.needsUpdate=I,v.hemisphereLights.needsUpdate=I}function Jf(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return Y},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(v,I,k){let F=Pe.get(v);if(F.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,F.__autoAllocateDepthBuffer===!1)F.__useRenderToTexture=!1;Pe.get(v.texture).__webglTexture=I,Pe.get(v.depthTexture).__webglTexture=F.__autoAllocateDepthBuffer?void 0:k,F.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,I){let k=Pe.get(v);k.__webglFramebuffer=I,k.__useDefaultFramebuffer=I===void 0},this.setRenderTarget=function(v,I=0,k=0){B=v,Y=I,K=k;let F=null,O=!1,he=!1;if(v){let le=Pe.get(v);if(le.__useDefaultFramebuffer!==void 0){de.bindFramebuffer(L.FRAMEBUFFER,le.__webglFramebuffer),j.copy(v.viewport),ie.copy(v.scissor),be=v.scissorTest,de.viewport(j),de.scissor(ie),de.setScissorTest(be),ae=-1;return}else if(le.__webglFramebuffer===void 0)De.setupRenderTarget(v);else if(le.__hasExternalTextures)De.rebindTextures(v,Pe.get(v.texture).__webglTexture,Pe.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Ue=v.depthTexture;if(le.__boundDepthTexture!==Ue){if(Ue!==null&&Pe.has(Ue)&&(v.width!==Ue.image.width||v.height!==Ue.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");De.setupDepthRenderbuffer(v)}}let ge=v.texture;if(ge.isData3DTexture||ge.isDataArrayTexture||ge.isCompressedArrayTexture)he=!0;let Me=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget){if(Array.isArray(Me[I]))F=Me[I][k];else F=Me[I];O=!0}else if(v.samples>0&&De.useMultisampledRTT(v)===!1)F=Pe.get(v).__webglMultisampledFramebuffer;else if(Array.isArray(Me))F=Me[k];else F=Me;j.copy(v.viewport),ie.copy(v.scissor),be=v.scissorTest}else j.copy(We).multiplyScalar(Ie).floor(),ie.copy(Oe).multiplyScalar(Ie).floor(),be=lt;if(k!==0)F=H;if(de.bindFramebuffer(L.FRAMEBUFFER,F))de.drawBuffers(v,F);if(de.viewport(j),de.scissor(ie),de.setScissorTest(be),O){let le=Pe.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+I,le.__webglTexture,k)}else if(he){let le=I;for(let ge=0;ge<v.textures.length;ge++){let Me=Pe.get(v.textures[ge]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+ge,Me.__webglTexture,k,le)}}else if(v!==null&&k!==0){let le=Pe.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,le.__webglTexture,k)}ae=-1};function Gc(v){let I=Pe.get(v);if(I.__readFormat!==v.format||I.__readType!==v.type)I.__readFormat=v.format,I.__readType=v.type,I.__formatReadable=Mt.textureFormatReadable(v.format),I.__typeReadable=Mt.textureTypeReadable(v.type);return I}if(this.readRenderTargetPixels=function(v,I,k,F,O,he,_e,le=0){if(!(v&&v.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0){if(ge=ge[_e],Array.isArray(ge))ge=ge[0]}if(ge){de.bindFramebuffer(L.FRAMEBUFFER,ge);try{let Me=v.textures[le],{format:Ue,type:Xe}=Me;if(v.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+le);let xe=Gc(Me);if(xe.__formatReadable===!1){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(xe.__typeReadable===!1){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(I>=0&&I<=v.width-F&&(k>=0&&k<=v.height-O))L.readPixels(I,k,F,O,te.convert(Ue),te.convert(Xe),he)}finally{let Me=B!==null?Pe.get(B).__webglFramebuffer:null;de.bindFramebuffer(L.FRAMEBUFFER,Me)}}},this.readRenderTargetPixelsAsync=async function(v,I,k,F,O,he,_e,le=0){if(!(v&&v.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0){if(ge=ge[_e],Array.isArray(ge))ge=ge[0]}if(ge)if(I>=0&&I<=v.width-F&&(k>=0&&k<=v.height-O)){de.bindFramebuffer(L.FRAMEBUFFER,ge);let Me=v.textures[le],{format:Ue,type:Xe}=Me;if(v.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+le);let xe=Gc(Me);if(xe.__formatReadable===!1)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(xe.__typeReadable===!1)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let $e=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,$e),L.bufferData(L.PIXEL_PACK_BUFFER,he.byteLength,L.STREAM_READ),L.readPixels(I,k,F,O,te.convert(Ue),te.convert(Xe),0),L.bindBuffer(L.PIXEL_PACK_BUFFER,null);let xt=B!==null?Pe.get(B).__webglFramebuffer:null;de.bindFramebuffer(L.FRAMEBUFFER,xt);let at=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await sd(L,at,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,$e),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,he),L.bindBuffer(L.PIXEL_PACK_BUFFER,null),L.deleteBuffer($e),L.deleteSync(at),he}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,I=null,k=0){let F=Math.pow(2,-k),O=Math.floor(v.image.width*F),he=Math.floor(v.image.height*F),_e=I!==null?I.x:0,le=I!==null?I.y:0;De.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,k,0,0,_e,le,O,he),de.unbindTexture()},this.copyTextureToTexture=function(v,I,k=null,F=null,O=0,he=0){let _e,le,ge,Me,Ue,Xe,xe,$e,xt,at=v.isCompressedTexture?v.mipmaps[he]:v.image;if(k!==null)_e=k.max.x-k.min.x,le=k.max.y-k.min.y,ge=k.isBox3?k.max.z-k.min.z:1,Me=k.min.x,Ue=k.min.y,Xe=k.isBox3?k.min.z:0;else{let Ye=Math.pow(2,-O);if(_e=Math.floor(at.width*Ye),le=Math.floor(at.height*Ye),v.isDataArrayTexture)ge=at.depth;else if(v.isData3DTexture)ge=Math.floor(at.depth*Ye);else ge=1;Me=0,Ue=0,Xe=0}if(F!==null)xe=F.x,$e=F.y,xt=F.z;else xe=0,$e=0,xt=0;let nt=te.convert(I.format),It=te.convert(I.type),ve;if(I.isData3DTexture)De.setTexture3D(I,0),ve=L.TEXTURE_3D;else if(I.isDataArrayTexture||I.isCompressedArrayTexture)De.setTexture2DArray(I,0),ve=L.TEXTURE_2D_ARRAY;else De.setTexture2D(I,0),ve=L.TEXTURE_2D;de.activeTexture(L.TEXTURE0),de.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,I.flipY),de.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),de.pixelStorei(L.UNPACK_ALIGNMENT,I.unpackAlignment);let Ot=de.getParameter(L.UNPACK_ROW_LENGTH),Ke=de.getParameter(L.UNPACK_IMAGE_HEIGHT),Mi=de.getParameter(L.UNPACK_SKIP_PIXELS),Pt=de.getParameter(L.UNPACK_SKIP_ROWS),vr=de.getParameter(L.UNPACK_SKIP_IMAGES);de.pixelStorei(L.UNPACK_ROW_LENGTH,at.width),de.pixelStorei(L.UNPACK_IMAGE_HEIGHT,at.height),de.pixelStorei(L.UNPACK_SKIP_PIXELS,Me),de.pixelStorei(L.UNPACK_SKIP_ROWS,Ue),de.pixelStorei(L.UNPACK_SKIP_IMAGES,Xe);let Qn=v.isDataArrayTexture||v.isData3DTexture,wi=I.isDataArrayTexture||I.isData3DTexture;if(v.isDepthTexture){let Ye=Pe.get(v),At=Pe.get(I),pn=Pe.get(Ye.__renderTarget),ht=Pe.get(At.__renderTarget);de.bindFramebuffer(L.READ_FRAMEBUFFER,pn.__webglFramebuffer),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,ht.__webglFramebuffer);for(let Tt=0;Tt<ge;Tt++){if(Qn)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(v).__webglTexture,O,Xe+Tt),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(I).__webglTexture,he,xt+Tt);L.blitFramebuffer(Me,Ue,Me+_e,Ue+le,xe,$e,xe+_e,$e+le,L.DEPTH_BUFFER_BIT,L.NEAREST)}de.bindFramebuffer(L.READ_FRAMEBUFFER,null),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(O!==0||v.isRenderTargetTexture||Pe.has(v)){let Ye=Pe.get(v),At=Pe.get(I);de.bindFramebuffer(L.READ_FRAMEBUFFER,Q),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,C);for(let pn=0;pn<ge;pn++){if(Qn)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Ye.__webglTexture,O,Xe+pn);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Ye.__webglTexture,O);if(wi)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,At.__webglTexture,he,xt+pn);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,At.__webglTexture,he);if(O!==0)L.blitFramebuffer(Me,Ue,Me+_e,Ue+le,xe,$e,xe+_e,$e+le,L.COLOR_BUFFER_BIT,L.NEAREST);else if(wi)L.copyTexSubImage3D(ve,he,xe,$e,xt+pn,Me,Ue,_e,le);else L.copyTexSubImage2D(ve,he,xe,$e,Me,Ue,_e,le)}de.bindFramebuffer(L.READ_FRAMEBUFFER,null),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(wi)if(v.isDataTexture||v.isData3DTexture)L.texSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,It,at.data);else if(I.isCompressedArrayTexture)L.compressedTexSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,at.data);else L.texSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,It,at);else if(v.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,he,xe,$e,_e,le,nt,It,at.data);else if(v.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,he,xe,$e,at.width,at.height,nt,at.data);else L.texSubImage2D(L.TEXTURE_2D,he,xe,$e,_e,le,nt,It,at);if(de.pixelStorei(L.UNPACK_ROW_LENGTH,Ot),de.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ke),de.pixelStorei(L.UNPACK_SKIP_PIXELS,Mi),de.pixelStorei(L.UNPACK_SKIP_ROWS,Pt),de.pixelStorei(L.UNPACK_SKIP_IMAGES,vr),he===0&&I.generateMipmaps===!0&&I.mipmapsAutoUpdate===!0)L.generateMipmap(ve);de.unbindTexture()},this.initRenderTarget=function(v){if(Pe.get(v).__webglFramebuffer===void 0)De.setupRenderTarget(v)},this.initTexture=function(v){if(v.isCubeTexture)De.setTextureCube(v,0);else if(v.isData3DTexture)De.setTexture3D(v,0);else if(v.isDataArrayTexture||v.isCompressedArrayTexture)De.setTexture2DArray(v,0);else De.setTexture2D(v,0);de.unbindTexture()},this.resetState=function(){Y=0,K=0,B=null,de.reset(),se.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=He._getDrawingBufferColorSpace(e),t.unpackColorSpace=He._getUnpackColorSpace()}}var Um=`#ifdef USE_ALPHAHASH
|
|
321
|
+
`+j)}else if(C!=="")Te("WebGLProgram: Program Info Log:",C);else if(Y===""||K==="")ae=!1;if(ae)z.diagnostics={runnable:B,programLog:C,vertexShader:{log:Y,prefix:y},fragmentShader:{log:K,prefix:p}}}s.deleteShader(b),s.deleteShader(E),g=new gr(s,_),S=Dx(s,_)}let g;this.getUniforms=function(){if(g===void 0)A(this);return g};let S;this.getAttributes=function(){if(S===void 0)A(this);return S};let P=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(P===!1)P=s.getProgramParameter(_,wx);return P},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Tx++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=E,this}class Kd{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);if(i.has(t)===!1)i.add(t),t.usedTimes++;if(i.has(n)===!1)i.add(n),n.usedTimes++;return this}remove(e){let t=this.materialCache.get(e);for(let n of t)if(n.usedTimes--,n.usedTimes===0)this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);if(n===void 0)n=new Set,t.set(e,n);return n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);if(n===void 0)n=new Jd(e),t.set(e,n);return n}}class Jd{constructor(e){this.id=$x++,this.code=e,this.usedTimes=0}}function qx(e){return e===zi||e===la||e===ca}function Yx(e,t,n,i,s,r){let a=new ir,o=new Kd,l=new Set,c=[],h=new Map,u=i.logarithmicDepthBuffer,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(g){if(l.add(g),g===0)return"uv";return`uv${g}`}function _(g,S,P,z,N,H){let Q=z.fog,C=N.geometry,Y=g.isMeshStandardMaterial||g.isMeshLambertMaterial||g.isMeshPhongMaterial?z.environment:null,K=g.isMeshStandardMaterial||g.isMeshLambertMaterial&&!g.envMap||g.isMeshPhongMaterial&&!g.envMap,B=t.get(g.envMap||Y,K),ae=d[g.type],V=i.precision;if(g.precision!==null){if(V=i.getMaxPrecision(g.precision),V!==g.precision)Te("WebGLProgram.getParameters:",g.precision,"not supported, using",V,"instead.")}let j=C.morphAttributes.position||C.morphAttributes.normal||C.morphAttributes.color,ie=j!==void 0?j.length:0,be=0;if(C.morphAttributes.position!==void 0)be=1;if(C.morphAttributes.normal!==void 0)be=2;if(C.morphAttributes.color!==void 0)be=3;let Z,ne,ye,Ce;if(ae){let me=Nn[ae];Z=me.vertexShader,ne=me.fragmentShader}else{Z=g.vertexShader,ne=g.fragmentShader;let me=o.getVertexShaderStage(g),et=o.getFragmentShaderStage(g);o.update(g,me,et),ye=me.id,Ce=et.id}let Ie=e.getRenderTarget(),Se=e.state.buffers.depth.getReversed(),je=N.isInstancedMesh===!0,We=N.isBatchedMesh===!0,Oe=!!g.map,lt=!!g.matcap,qe=!!B,dt=qe&&B.isPMREMTexture===!0,gt=!!g.aoMap,kt=!!g.lightMap,Zt=!!g.bumpMap&&g.wireframe===!1,_t=!!g.normalMap,Rt=!!g.displacementMap,zt=!!g.emissiveMap,Ht=!!g.metalnessMap,dn=!!g.roughnessMap,L=g.anisotropy>0,fn=g.clearcoat>0,Qe=g.diffuseRoughness>0,Mt=g.dispersion>0,de=g.retroreflectivity>0,rt=g.iridescence>0,Pe=g.sheen>0,De=g.transmission>0,Ct=L&&!!g.anisotropyMap,w=fn&&!!g.clearcoatMap,x=fn&&!!g.clearcoatNormalMap,U=fn&&!!g.clearcoatRoughnessMap,ee=Qe&&!!g.diffuseRoughnessMap,J=rt&&!!g.iridescenceMap,re=rt&&!!g.iridescenceThicknessMap,ce=Pe&&!!g.sheenColorMap,G=Pe&&!!g.sheenRoughnessMap,q=!!g.specularMap,oe=!!g.specularColorMap,R=!!g.specularIntensityMap,X=De&&!!g.transmissionMap,W=De&&!!g.thicknessMap,te=!!g.gradientMap,se=!!g.alphaMap,ue=g.alphaTest>0,Ae=!!g.alphaHash,we=!!g.extensions,pe=Rn;if(g.toneMapped){if(Ie===null||Ie.isXRRenderTarget===!0)pe=e.toneMapping}let Re=dt?B.isCompressedCubeTexture?B.image[0].mipmaps:B.mipmaps:null,Be={shaderID:ae,shaderType:g.type,shaderName:g.name,vertexShader:Z,fragmentShader:ne,defines:g.defines,customVertexShaderID:ye,customFragmentShaderID:Ce,isRawShaderMaterial:g.isRawShaderMaterial===!0,glslVersion:g.glslVersion,precision:V,batching:We,batchingColor:We&&N._colorsTexture!==null,instancing:je,instancingColor:je&&N.instanceColor!==null,instancingMorph:je&&N.morphTexture!==null,outputColorSpace:Ie===null?e.outputColorSpace:Ie.isXRRenderTarget===!0?Ie.texture.colorSpace:He.workingColorSpace,alphaToCoverage:!!g.alphaToCoverage,map:Oe,matcap:lt,envMap:qe,envMapMode:qe&&B.mapping,envMapPMREM:dt,envMapMaxLod:dt?Re.length-1:null,envMapSize:dt?Re[0].width:null,aoMap:gt,lightMap:kt,bumpMap:Zt,normalMap:_t,displacementMap:Rt,emissiveMap:zt,normalMapObjectSpace:_t&&g.normalMapType===Ku,normalMapTangentSpace:_t&&g.normalMapType===Dl,packedNormalMap:_t&&g.normalMapType===Dl&&qx(g.normalMap.format),metalnessMap:Ht,roughnessMap:dn,anisotropy:L,anisotropyMap:Ct,clearcoat:fn,clearcoatMap:w,clearcoatNormalMap:x,clearcoatRoughnessMap:U,diffuseRoughness:Qe,diffuseRoughnessMap:ee,dispersion:Mt,retroreflection:de,iridescence:rt,iridescenceMap:J,iridescenceThicknessMap:re,sheen:Pe,sheenColorMap:ce,sheenRoughnessMap:G,specularMap:q,specularColorMap:oe,specularIntensityMap:R,transmission:De,transmissionMap:X,thicknessMap:W,gradientMap:te,opaque:g.transparent===!1&&g.blending===Js&&g.alphaToCoverage===!1,alphaMap:se,alphaTest:ue,alphaHash:Ae,combine:g.combine,mapUv:Oe&&f(g.map.channel),aoMapUv:gt&&f(g.aoMap.channel),lightMapUv:kt&&f(g.lightMap.channel),bumpMapUv:Zt&&f(g.bumpMap.channel),normalMapUv:_t&&f(g.normalMap.channel),displacementMapUv:Rt&&f(g.displacementMap.channel),emissiveMapUv:zt&&f(g.emissiveMap.channel),metalnessMapUv:Ht&&f(g.metalnessMap.channel),roughnessMapUv:dn&&f(g.roughnessMap.channel),anisotropyMapUv:Ct&&f(g.anisotropyMap.channel),clearcoatMapUv:w&&f(g.clearcoatMap.channel),clearcoatNormalMapUv:x&&f(g.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:U&&f(g.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:ee&&f(g.diffuseRoughnessMap.channel),iridescenceMapUv:J&&f(g.iridescenceMap.channel),iridescenceThicknessMapUv:re&&f(g.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&f(g.sheenColorMap.channel),sheenRoughnessMapUv:G&&f(g.sheenRoughnessMap.channel),specularMapUv:q&&f(g.specularMap.channel),specularColorMapUv:oe&&f(g.specularColorMap.channel),specularIntensityMapUv:R&&f(g.specularIntensityMap.channel),transmissionMapUv:X&&f(g.transmissionMap.channel),thicknessMapUv:W&&f(g.thicknessMap.channel),alphaMapUv:se&&f(g.alphaMap.channel),vertexTangents:!!C.attributes.tangent&&(_t||L),vertexNormals:!!C.attributes.normal,vertexColors:g.vertexColors,vertexAlphas:g.vertexColors===!0&&!!C.attributes.color&&C.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!C.attributes.uv&&(Oe||se),fog:!!Q,useFog:g.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:g.wireframe===!1&&(g.flatShading===!0||C.attributes.normal===void 0&&_t===!1&&(g.isMeshLambertMaterial||g.isMeshPhongMaterial||g.isMeshStandardMaterial||g.isMeshPhysicalMaterial)),sizeAttenuation:g.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:Se,skinning:N.isSkinnedMesh===!0,hasPositionAttribute:C.attributes.position!==void 0,morphTargets:C.morphAttributes.position!==void 0,morphNormals:C.morphAttributes.normal!==void 0,morphColors:C.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:be,numSunLights:S.sun.length,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numSunLightShadows:S.sunShadowMap.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numLightProbeGrids:H.filter((me)=>me.texture!==null).length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:g.dithering,shadowMapEnabled:e.shadowMap.enabled&&P.length>0,shadowMapType:e.shadowMap.type,toneMapping:pe,decodeVideoTexture:Oe&&g.map.isVideoTexture===!0&&He.getTransfer(g.map.colorSpace)===st,decodeVideoTextureEmissive:zt&&g.emissiveMap.isVideoTexture===!0&&He.getTransfer(g.emissiveMap.colorSpace)===st,premultipliedAlpha:g.premultipliedAlpha,doubleSided:g.side===$t,flipSided:g.side===Xt,useDepthPacking:g.depthPacking>=0,depthPacking:g.depthPacking||0,index0AttributeName:g.index0AttributeName,extensionClipCullDistance:we&&g.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&g.extensions.multiDraw===!0||We)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:g.customProgramCacheKey()};return Be.vertexUv1s=l.has(1),Be.vertexUv2s=l.has(2),Be.vertexUv3s=l.has(3),l.clear(),Be}function y(g){let S=[];if(g.shaderID)S.push(g.shaderID);else S.push(g.customVertexShaderID),S.push(g.customFragmentShaderID);if(g.defines!==void 0)for(let P in g.defines)S.push(P),S.push(g.defines[P]);if(g.isRawShaderMaterial===!1)p(S,g),m(S,g),S.push(e.outputColorSpace);return S.push(g.customProgramCacheKey),S.join()}function p(g,S){g.push(S.precision),g.push(S.outputColorSpace),g.push(S.envMapMode),g.push(S.envMapPMREM),g.push(S.envMapMaxLod),g.push(S.envMapSize),g.push(S.mapUv),g.push(S.alphaMapUv),g.push(S.lightMapUv),g.push(S.aoMapUv),g.push(S.bumpMapUv),g.push(S.normalMapUv),g.push(S.displacementMapUv),g.push(S.emissiveMapUv),g.push(S.metalnessMapUv),g.push(S.roughnessMapUv),g.push(S.anisotropyMapUv),g.push(S.clearcoatMapUv),g.push(S.clearcoatNormalMapUv),g.push(S.clearcoatRoughnessMapUv),g.push(S.diffuseRoughnessMapUv),g.push(S.iridescenceMapUv),g.push(S.iridescenceThicknessMapUv),g.push(S.sheenColorMapUv),g.push(S.sheenRoughnessMapUv),g.push(S.specularMapUv),g.push(S.specularColorMapUv),g.push(S.specularIntensityMapUv),g.push(S.transmissionMapUv),g.push(S.thicknessMapUv),g.push(S.combine),g.push(S.fogExp2),g.push(S.sizeAttenuation),g.push(S.morphTargetsCount),g.push(S.numSunLights),g.push(S.numDirLights),g.push(S.numPointLights),g.push(S.numSpotLights),g.push(S.numSpotLightMaps),g.push(S.numHemiLights),g.push(S.numRectAreaLights),g.push(S.numSunLightShadows),g.push(S.numDirLightShadows),g.push(S.numPointLightShadows),g.push(S.numSpotLightShadows),g.push(S.numSpotLightShadowsWithMaps),g.push(S.numLightProbes),g.push(S.numLightProbeGrids),g.push(S.shadowMapType),g.push(S.toneMapping),g.push(S.numClippingPlanes),g.push(S.numClipIntersection),g.push(S.depthPacking)}function m(g,S){if(a.disableAll(),S.instancing)a.enable(0);if(S.instancingColor)a.enable(1);if(S.instancingMorph)a.enable(2);if(S.matcap)a.enable(3);if(S.envMap)a.enable(4);if(S.normalMapObjectSpace)a.enable(5);if(S.normalMapTangentSpace)a.enable(6);if(S.clearcoat)a.enable(7);if(S.iridescence)a.enable(8);if(S.alphaTest)a.enable(9);if(S.vertexColors)a.enable(10);if(S.vertexAlphas)a.enable(11);if(S.vertexUv1s)a.enable(12);if(S.vertexUv2s)a.enable(13);if(S.vertexUv3s)a.enable(14);if(S.vertexTangents)a.enable(15);if(S.anisotropy)a.enable(16);if(S.alphaHash)a.enable(17);if(S.batching)a.enable(18);if(S.dispersion)a.enable(19);if(S.retroreflection)a.enable(24);if(S.diffuseRoughness)a.enable(25);if(S.batchingColor)a.enable(20);if(S.gradientMap)a.enable(21);if(S.packedNormalMap)a.enable(22);if(S.vertexNormals)a.enable(23);if(g.push(a.mask),a.disableAll(),S.fog)a.enable(0);if(S.useFog)a.enable(1);if(S.flatShading)a.enable(2);if(S.logarithmicDepthBuffer)a.enable(3);if(S.reversedDepthBuffer)a.enable(4);if(S.skinning)a.enable(5);if(S.morphTargets)a.enable(6);if(S.morphNormals)a.enable(7);if(S.morphColors)a.enable(8);if(S.premultipliedAlpha)a.enable(9);if(S.shadowMapEnabled)a.enable(10);if(S.doubleSided)a.enable(11);if(S.flipSided)a.enable(12);if(S.useDepthPacking)a.enable(13);if(S.dithering)a.enable(14);if(S.transmission)a.enable(15);if(S.sheen)a.enable(16);if(S.opaque)a.enable(17);if(S.pointsUvs)a.enable(18);if(S.decodeVideoTexture)a.enable(19);if(S.decodeVideoTextureEmissive)a.enable(20);if(S.alphaToCoverage)a.enable(21);if(S.numLightProbeGrids>0)a.enable(22);if(S.hasPositionAttribute)a.enable(23);g.push(a.mask)}function M(g){let S=d[g.type],P;if(S){let z=Nn[S];P=od.clone(z.uniforms)}else P=g.uniforms;return P}function T(g,S){let P=h.get(S);if(P!==void 0)++P.usedTimes;else P=new Xx(e,S,g,s),c.push(P),h.set(S,P);return P}function b(g){if(--g.usedTimes===0){let S=c.indexOf(g);c[S]=c[c.length-1],c.pop(),h.delete(g.cacheKey),g.destroy()}}function E(g){o.remove(g)}function A(){o.dispose()}return{getParameters:_,getProgramCacheKey:y,getUniforms:M,acquireProgram:T,releaseProgram:b,releaseShaderCache:E,programs:c,dispose:A}}function Zx(){let e=new WeakMap;function t(a){return e.has(a)}function n(a){let o=e.get(a);if(o===void 0)o={},e.set(a,o);return o}function i(a){e.delete(a)}function s(a,o,l){e.get(a)[o]=l}function r(){e=new WeakMap}return{has:t,get:n,remove:i,update:s,dispose:r}}function Kx(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.material.id!==t.material.id)return e.material.id-t.material.id;else if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;else if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function Nd(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;else if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;else if(e.z!==t.z)return t.z-e.z;else return e.id-t.id}function Dd(){let e=[],t=0,n=[],i=[],s=[];function r(){t=0,n.length=0,i.length=0,s.length=0}function a(d){let f=0;if(d.isInstancedMesh)f+=2;if(d.isSkinnedMesh)f+=1;return f}function o(d,f,_,y,p,m){let M=e[t];if(M===void 0)M={id:d.id,object:d,geometry:f,material:_,materialVariant:a(d),groupOrder:y,renderOrder:d.renderOrder,z:p,group:m},e[t]=M;else M.id=d.id,M.object=d,M.geometry=f,M.material=_,M.materialVariant=a(d),M.groupOrder=y,M.renderOrder=d.renderOrder,M.z=p,M.group=m;return t++,M}function l(d,f,_,y,p,m,M){if(M.reversedDepth===!0)p=-p;let T=o(d,f,_,y,p,m);if(_.transmission>0)i.push(T);else if(_.transparent===!0)s.push(T);else n.push(T)}function c(d,f,_,y,p,m){let M=o(d,f,_,y,p,m);if(_.transmission>0)i.unshift(M);else if(_.transparent===!0)s.unshift(M);else n.unshift(M)}function h(d,f){if(n.length>1)n.sort(d||Kx);if(i.length>1)i.sort(f||Nd);if(s.length>1)s.sort(f||Nd)}function u(){for(let d=t,f=e.length;d<f;d++){let _=e[d];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:n,transmissive:i,transparent:s,init:r,push:l,unshift:c,finish:u,sort:h}}function Jx(){let e=new WeakMap;function t(i,s){let r=e.get(i),a;if(r===void 0)a=new Dd,e.set(i,[a]);else if(s>=r.length)a=new Dd,r.push(a);else a=r[s];return a}function n(){e=new WeakMap}return{get:t,dispose:n}}function jx(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"SunLight":case"DirectionalLight":n={direction:new D,color:new Ee};break;case"SpotLight":n={position:new D,direction:new D,color:new Ee,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new D,color:new Ee,distance:0,decay:0};break;case"HemisphereLight":n={direction:new D,skyColor:new Ee,groundColor:new Ee};break;case"RectAreaLight":n={color:new Ee,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function Qx(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"SunLight":case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke,shadowCameraNear:1,shadowCameraFar:1000};break}return e[t.id]=n,n}}}function tv(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function nv(e){let t=new jx,n=Qx(),i={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new D);let s=new D,r=new Fe,a=new Fe;function o(c){let h=0,u=0,d=0;for(let H=0;H<9;H++)i.probe[H].set(0,0,0);let f=0,_=0,y=0,p=0,m=0,M=0,T=0,b=0,E=0,A=0,g=0,S=0,P=0,z=0;c.sort(tv);for(let H=0,Q=c.length;H<Q;H++){let C=c[H],{color:Y,intensity:K,distance:B}=C,ae=null;if(C.shadow&&C.shadow.map)if(C.shadow.map.texture.format===zi)ae=C.shadow.map.texture;else ae=C.shadow.map.depthTexture||C.shadow.map.texture;if(C.isAmbientLight)h+=Y.r*K,u+=Y.g*K,d+=Y.b*K;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],K);z++}else if(C.isSunLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize.copy(j.mapSize).multiply(j.getFrameExtents()),i.sunShadow[_]=ie,i.sunShadowMap[_]=ae;let be=j.getViewportCount();for(let Z=0;Z<be;Z++)i.sunShadowMatrix[y+Z]=j.getMatrix(Z),i.sunShadowCascade[y+Z]=j._cascadeData[Z];y+=be,_++}i.sun[f]=V,f++}else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,i.directionalShadow[p]=ie,i.directionalShadowMap[p]=ae,i.directionalShadowMatrix[p]=C.shadow.matrix,E++}i.directional[p]=V,p++}else if(C.isSpotLight){let V=t.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(Y).multiplyScalar(K),V.distance=B,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[M]=V;let j=C.shadow;if(C.map){if(i.spotLightMap[S]=C.map,S++,j.updateMatrices(C),C.castShadow)P++}if(i.spotLightMatrix[M]=j.matrix,C.castShadow){let ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,i.spotShadow[M]=ie,i.spotShadowMap[M]=ae,g++}M++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(Y).multiplyScalar(K),V.halfWidth.set(C.width*0.5,0,0),V.halfHeight.set(0,C.height*0.5,0),i.rectArea[T]=V,T++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){let j=C.shadow,ie=n.get(C);ie.shadowIntensity=j.intensity,ie.shadowBias=j.bias,ie.shadowNormalBias=j.normalBias,ie.shadowRadius=j.radius,ie.shadowMapSize=j.mapSize,ie.shadowCameraNear=j.camera.near,ie.shadowCameraFar=j.camera.far,i.pointShadow[m]=ie,i.pointShadowMap[m]=ae,i.pointShadowMatrix[m]=C.shadow.matrix,A++}i.point[m]=V,m++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(K),V.groundColor.copy(C.groundColor).multiplyScalar(K),i.hemi[b]=V,b++}}if(T>0)if(e.has("OES_texture_float_linear")===!0)i.rectAreaLTC1=fe.LTC_FLOAT_1,i.rectAreaLTC2=fe.LTC_FLOAT_2;else i.rectAreaLTC1=fe.LTC_HALF_1,i.rectAreaLTC2=fe.LTC_HALF_2;i.ambient[0]=h,i.ambient[1]=u,i.ambient[2]=d;let N=i.hash;if(N.sunLength!==f||N.directionalLength!==p||N.pointLength!==m||N.spotLength!==M||N.rectAreaLength!==T||N.hemiLength!==b||N.numSunShadows!==_||N.numDirectionalShadows!==E||N.numPointShadows!==A||N.numSpotShadows!==g||N.numSpotMaps!==S||N.numLightProbes!==z)i.sun.length=f,i.directional.length=p,i.spot.length=M,i.rectArea.length=T,i.point.length=m,i.hemi.length=b,i.sunShadow.length=_,i.sunShadowMap.length=_,i.sunShadowMatrix.length=y,i.sunShadowCascade.length=y,i.directionalShadow.length=E,i.directionalShadowMap.length=E,i.directionalShadowMatrix.length=E,i.pointShadow.length=A,i.pointShadowMap.length=A,i.pointShadowMatrix.length=A,i.spotShadow.length=g,i.spotShadowMap.length=g,i.spotLightMatrix.length=g+S-P,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=z,N.sunLength=f,N.directionalLength=p,N.pointLength=m,N.spotLength=M,N.rectAreaLength=T,N.hemiLength=b,N.numSunShadows=_,N.numDirectionalShadows=E,N.numPointShadows=A,N.numSpotShadows=g,N.numSpotMaps=S,N.numLightProbes=z,i.version=ev++}function l(c,h){let u=0,d=0,f=0,_=0,y=0,p=0,m=h.matrixWorldInverse;for(let M=0,T=c.length;M<T;M++){let b=c[M];if(b.isSunLight){let E=i.sun[u];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),u++}else if(b.isDirectionalLight){let E=i.directional[d];E.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(m),d++}else if(b.isSpotLight){let E=i.spot[_];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),E.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(m),_++}else if(b.isRectAreaLight){let E=i.rectArea[y];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),a.identity(),r.copy(b.matrixWorld),r.premultiply(m),a.extractRotation(r),E.halfWidth.set(b.width*0.5,0,0),E.halfHeight.set(0,b.height*0.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),y++}else if(b.isPointLight){let E=i.point[f];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),f++}else if(b.isHemisphereLight){let E=i.hemi[p];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),p++}}}return{setup:o,setupView:l,state:i}}function Ud(e){let t=new nv(e),n=[],i=[],s=[];function r(u){h.camera=u,n.length=0,i.length=0,s.length=0}function a(u){if(u.isLightProbeGrid)s.push(u);else n.push(u)}function o(u){i.push(u)}function l(){t.setup(n),s.sort((u,d)=>u.priority-d.priority||u.id-d.id)}function c(u){t.setupView(n,u)}let h={lightsArray:n,shadowsArray:i,lightProbeGridArray:s,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function iv(e){let t=new WeakMap;function n(s,r=0){let a=t.get(s),o;if(a===void 0)o=new Ud(e),t.set(s,[o]);else if(r>=a.length)o=new Ud(e),a.push(o);else o=a[r];return o}function i(){t=new WeakMap}return{get:n,dispose:i}}function lv(e,t,n){let i=new Fi,s=new ke,r=new ke,a=new tt,o=new Kl,l=new Jl,c={},h=n.maxTextureSize,u={[ci]:Xt,[Xt]:ci,[$t]:$t},d=new Kn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ke},radius:{value:4}},vertexShader:sv,fragmentShader:rv}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let _=new Yt;_.setAttribute("position",new pt(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let y=new yt(_,d),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ks;let m=this.type;this.render=function(A,g,S){if(p.enabled===!1)return;if(p.autoUpdate===!1&&p.needsUpdate===!1)return;if(A.length===0)return;if(this.type===du)Te("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=Ks;let P=e.getRenderTarget(),z=e.getActiveCubeFace(),N=e.getActiveMipmapLevel(),H=e.state;if(H.setBlending(Oi),H.buffers.depth.getReversed()===!0)H.buffers.color.setClear(0,0,0,0);else H.buffers.color.setClear(1,1,1,1);H.buffers.depth.setTest(!0),H.setScissorTest(!1);let Q=m!==this.type;if(Q)g.traverse(function(C){if(C.material)if(Array.isArray(C.material))C.material.forEach((Y)=>Y.needsUpdate=!0);else C.material.needsUpdate=!0});for(let C=0,Y=A.length;C<Y;C++){let K=A[C],B=K.shadow;if(B===void 0){Te("WebGLShadowMap:",K,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;s.copy(B.mapSize);let ae=B.getFrameExtents();if(s.multiply(ae),r.copy(B.mapSize),s.x>h||s.y>h){if(s.x>h)r.x=Math.floor(h/ae.x),s.x=r.x*ae.x,B.mapSize.x=r.x;if(s.y>h)r.y=Math.floor(h/ae.y),s.y=r.y*ae.y,B.mapSize.y=r.y}let V=e.state.buffers.depth.getReversed();if(B.camera._reversedDepth=V,B.map===null||Q===!0){if(B.map!==null){if(B.map.depthTexture!==null)B.map.depthTexture.dispose(),B.map.depthTexture=null;B.map.dispose()}if(this.type===ps){if(K.isPointLight){Te("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}B.map=new hn(s.x,s.y,{format:zi,type:Cn,minFilter:mt,magFilter:mt,generateMipmaps:!1}),B.map.texture.name=K.name+".shadowMap",B.map.depthTexture=new pi(s.x,s.y,qn),B.map.depthTexture.name=K.name+".shadowMapDepth",B.map.depthTexture.format=vs,B.map.depthTexture.compareFunction=null,B.map.depthTexture.minFilter=yn,B.map.depthTexture.magFilter=yn}else{if(K.isPointLight)B.map=new Ba(s.x),B.map.depthTexture=new wa(s.x,ui);else B.map=new hn(s.x,s.y),B.map.depthTexture=new pi(s.x,s.y,ui);if(B.map.depthTexture.name=K.name+".shadowMap",B.map.depthTexture.format=vs,this.type===Ks)B.map.depthTexture.compareFunction=V?Ol:Fl,B.map.depthTexture.minFilter=mt,B.map.depthTexture.magFilter=mt;else B.map.depthTexture.compareFunction=null,B.map.depthTexture.minFilter=yn,B.map.depthTexture.magFilter=yn}B.camera.updateProjectionMatrix()}if(B.map.isWebGLCubeRenderTarget!==!0&&(B.map.width!==s.x||B.map.height!==s.y))B.map.setSize(s.x,s.y);let j=B.map.isWebGLCubeRenderTarget?6:B.getViewportCount();if(K.isPointLight!==!0)B.updateMatrices(K,S);let ie=(B.camera.layers.mask&4294967294)!==0?B.camera.layers:S.layers;for(let be=0;be<j;be++){let Z=B.getCamera(be);if(K.isPointLight){let{camera:ne,matrix:ye}=B,Ce=K.distance||ne.far;if(Ce!==ne.far)ne.far=Ce,ne.updateProjectionMatrix();pr.setFromMatrixPosition(K.matrixWorld),ne.position.copy(pr),uc.copy(ne.position),uc.add(av[be]),ne.up.copy(ov[be]),ne.lookAt(uc),ne.updateMatrixWorld(),ye.makeTranslation(-pr.x,-pr.y,-pr.z),Fd.multiplyMatrices(ne.projectionMatrix,ne.matrixWorldInverse),B._frustum.setFromProjectionMatrix(Fd,ne.coordinateSystem,ne.reversedDepth)}if(B.map.isWebGLCubeRenderTarget)e.setRenderTarget(B.map,be),e.clear();else{if(be===0)e.setRenderTarget(B.map),e.clear();let ne=B.getViewport(be);a.set(r.x*ne.x,r.y*ne.y,r.x*ne.z,r.y*ne.w),H.viewport(a)}i=B.getFrustum(be),b(g,S,Z,K,ie,this.type)}if(B.isPointLightShadow!==!0&&this.type===ps)M(B,S);B.needsUpdate=!1}m=this.type,p.needsUpdate=!1,e.setRenderTarget(P,z,N)};function M(A,g){let S=t.update(y);if(d.defines.VSM_SAMPLES!==A.blurSamples)d.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0;if(A.mapPass===null)A.mapPass=new hn(s.x,s.y,{format:zi,type:Cn});else if(A.mapPass.width!==A.map.width||A.mapPass.height!==A.map.height)A.mapPass.setSize(A.map.width,A.map.height);d.uniforms.shadow_pass.value=A.map.depthTexture,d.uniforms.resolution.value.set(A.map.width,A.map.height),d.uniforms.radius.value=A.radius,e.setRenderTarget(A.mapPass),e.clear(),e.renderBufferDirect(g,null,S,d,y,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value.set(A.map.width,A.map.height),f.uniforms.radius.value=A.radius,e.setRenderTarget(A.map),e.clear(),e.renderBufferDirect(g,null,S,f,y,null)}function T(A,g,S,P){let z=null,N=S.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(N!==void 0)z=N;else if(z=S.isPointLight===!0?l:o,e.localClippingEnabled&&g.clipShadows===!0&&Array.isArray(g.clippingPlanes)&&g.clippingPlanes.length!==0||g.displacementMap&&g.displacementScale!==0||g.alphaMap&&g.alphaTest>0||g.map&&g.alphaTest>0||g.alphaToCoverage===!0){let H=z.uuid,Q=g.uuid,C=c[H];if(C===void 0)C={},c[H]=C;let Y=C[Q];if(Y===void 0)Y=z.clone(),C[Q]=Y,g.addEventListener("dispose",E);z=Y}if(z.visible=g.visible,z.wireframe=g.wireframe,P===ps)z.side=g.shadowSide!==null?g.shadowSide:g.side;else z.side=g.shadowSide!==null?g.shadowSide:u[g.side];if(z.alphaMap=g.alphaMap,z.alphaTest=g.alphaToCoverage===!0?0.5:g.alphaTest,z.map=g.map,z.clipShadows=g.clipShadows,z.clippingPlanes=g.clippingPlanes,z.clipIntersection=g.clipIntersection,z.displacementMap=g.displacementMap,z.displacementScale=g.displacementScale,z.displacementBias=g.displacementBias,z.wireframeLinewidth=g.wireframeLinewidth,z.linewidth=g.linewidth,S.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=e.properties.get(z);H.light=S}return z}function b(A,g,S,P,z,N){if(A.visible===!1)return;if(A.layers.test(z)&&(A.isMesh||A.isLine||A.isPoints)){if((A.castShadow||A.receiveShadow&&N===ps)&&(!A.frustumCulled||A.intersectsFrustum(i))){A.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,A.matrixWorld);let C=t.update(A),Y=A.material;if(Array.isArray(Y)){let K=C.groups;for(let B=0,ae=K.length;B<ae;B++){let V=K[B],j=Y[V.materialIndex];if(j&&j.visible){let ie=T(A,j,P,N);A.onBeforeShadow(e,A,g,S,C,ie,V),e.renderBufferDirect(S,null,C,ie,A,V),A.onAfterShadow(e,A,g,S,C,ie,V)}}}else if(Y.visible){let K=T(A,Y,P,N);A.onBeforeShadow(e,A,g,S,C,K,null),e.renderBufferDirect(S,null,C,K,A,null),A.onAfterShadow(e,A,g,S,C,K,null)}}}let Q=A.children;for(let C=0,Y=Q.length;C<Y;C++)b(Q[C],g,S,P,z,N)}function E(A){A.target.removeEventListener("dispose",E);for(let S in c){let P=c[S],z=A.target.uuid;if(z in P)P[z].dispose(),delete P[z]}}}function cv(e,t){function n(){let R=!1,X=new tt,W=null,te=new tt(0,0,0,0);return{setMask:function(se){if(W!==se&&!R)e.colorMask(se,se,se,se),W=se},setLocked:function(se){R=se},setClear:function(se,ue,Ae,we,pe){if(pe===!0)se*=we,ue*=we,Ae*=we;if(X.set(se,ue,Ae,we),te.equals(X)===!1)e.clearColor(se,ue,Ae,we),te.copy(X)},reset:function(){R=!1,W=null,te.set(-1,0,0,0)}}}function i(){let R=!1,X=!1,W=null,te=null,se=null;return{setReversed:function(ue){if(X!==ue){let Ae=t.get("EXT_clip_control");if(ue)Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.ZERO_TO_ONE_EXT);else Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.NEGATIVE_ONE_TO_ONE_EXT);X=ue;let we=se;se=null,this.setClear(we)}},getReversed:function(){return X},setTest:function(ue){if(ue)Se(e.DEPTH_TEST);else je(e.DEPTH_TEST)},setMask:function(ue){if(W!==ue&&!R)e.depthMask(ue),W=ue},setFunc:function(ue){if(X)ue=rd[ue];if(te!==ue){switch(ue){case Nu:e.depthFunc(e.NEVER);break;case Du:e.depthFunc(e.ALWAYS);break;case Uu:e.depthFunc(e.LESS);break;case Wo:e.depthFunc(e.LEQUAL);break;case Fu:e.depthFunc(e.EQUAL);break;case Ou:e.depthFunc(e.GEQUAL);break;case Bu:e.depthFunc(e.GREATER);break;case ku:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}te=ue}},setLocked:function(ue){R=ue},setClear:function(ue){if(se!==ue){if(se=ue,X)ue=1-ue;e.clearDepth(ue)}},reset:function(){R=!1,W=null,te=null,se=null,X=!1}}}function s(){let R=!1,X=null,W=null,te=null,se=null,ue=null,Ae=null,we=null,pe=null;return{setTest:function(Re){if(!R)if(Re)Se(e.STENCIL_TEST);else je(e.STENCIL_TEST)},setMask:function(Re){if(X!==Re&&!R)e.stencilMask(Re),X=Re},setFunc:function(Re,Be,me){if(W!==Re||te!==Be||se!==me)e.stencilFunc(Re,Be,me),W=Re,te=Be,se=me},setOp:function(Re,Be,me){if(ue!==Re||Ae!==Be||we!==me)e.stencilOp(Re,Be,me),ue=Re,Ae=Be,we=me},setLocked:function(Re){R=Re},setClear:function(Re){if(pe!==Re)e.clearStencil(Re),pe=Re},reset:function(){R=!1,X=null,W=null,te=null,se=null,ue=null,Ae=null,we=null,pe=null}}}let r=new n,a=new i,o=new s,l={},c=new WeakMap,h={},u={},d={},f=new WeakMap,_=[],y=null,p=!1,m=null,M=null,T=null,b=null,E=null,A=null,g=null,S=new Ee(0,0,0),P=0,z=!1,N=null,H=null,Q=null,C=null,Y=null,K=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=!1,ae=0,V=e.getParameter(e.VERSION);if(V.indexOf("WebGL")!==-1)ae=parseFloat(/^WebGL (\d)/.exec(V)[1]),B=ae>=1;else if(V.indexOf("OpenGL ES")!==-1)ae=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),B=ae>=2;let j=null,ie={},be=e.getParameter(e.SCISSOR_BOX),Z=e.getParameter(e.VIEWPORT),ne=new tt().fromArray(be),ye=new tt().fromArray(Z);function Ce(R,X,W,te){let se=new Uint8Array(4),ue=e.createTexture();e.bindTexture(R,ue),e.texParameteri(R,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(R,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let Ae=0;Ae<W;Ae++)if(R===e.TEXTURE_3D||R===e.TEXTURE_2D_ARRAY)e.texImage3D(X,0,e.RGBA,1,1,te,0,e.RGBA,e.UNSIGNED_BYTE,se);else e.texImage2D(X+Ae,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,se);return ue}let Ie={};Ie[e.TEXTURE_2D]=Ce(e.TEXTURE_2D,e.TEXTURE_2D,1),Ie[e.TEXTURE_CUBE_MAP]=Ce(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ie[e.TEXTURE_2D_ARRAY]=Ce(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),Ie[e.TEXTURE_3D]=Ce(e.TEXTURE_3D,e.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),Se(e.DEPTH_TEST),a.setFunc(Wo),Zt(!1),_t(ko),Se(e.CULL_FACE),gt(Oi);function Se(R){if(h[R]!==!0)e.enable(R),h[R]=!0}function je(R){if(h[R]!==!1)e.disable(R),h[R]=!1}function We(R,X){if(d[R]!==X){if(e.bindFramebuffer(R,X),d[R]=X,R===e.DRAW_FRAMEBUFFER)d[e.FRAMEBUFFER]=X;if(R===e.FRAMEBUFFER)d[e.DRAW_FRAMEBUFFER]=X;return!0}return!1}function Oe(R,X){let W=_,te=!1;if(R){if(W=f.get(X),W===void 0)W=[],f.set(X,W);let se=R.textures;if(W.length!==se.length||W[0]!==e.COLOR_ATTACHMENT0){for(let ue=0,Ae=se.length;ue<Ae;ue++)W[ue]=e.COLOR_ATTACHMENT0+ue;W.length=se.length,te=!0}}else if(W[0]!==e.BACK)W[0]=e.BACK,te=!0;if(te)e.drawBuffers(W)}function lt(R){if(y!==R)return e.useProgram(R),y=R,!0;return!1}let qe={[ms]:e.FUNC_ADD,[pu]:e.FUNC_SUBTRACT,[mu]:e.FUNC_REVERSE_SUBTRACT};qe[gu]=e.MIN,qe[_u]=e.MAX;let dt={[xu]:e.ZERO,[vu]:e.ONE,[yu]:e.SRC_COLOR,[bu]:e.SRC_ALPHA,[Ru]:e.SRC_ALPHA_SATURATE,[Eu]:e.DST_COLOR,[wu]:e.DST_ALPHA,[Su]:e.ONE_MINUS_SRC_COLOR,[Mu]:e.ONE_MINUS_SRC_ALPHA,[Au]:e.ONE_MINUS_DST_COLOR,[Tu]:e.ONE_MINUS_DST_ALPHA,[Cu]:e.CONSTANT_COLOR,[Iu]:e.ONE_MINUS_CONSTANT_COLOR,[Pu]:e.CONSTANT_ALPHA,[Lu]:e.ONE_MINUS_CONSTANT_ALPHA};function gt(R,X,W,te,se,ue,Ae,we,pe,Re){if(R===Oi){if(p===!0)je(e.BLEND),p=!1;return}if(p===!1)Se(e.BLEND),p=!0;if(R!==fu){if(R!==m||Re!==z){if(M!==ms||E!==ms)e.blendEquation(e.FUNC_ADD),M=ms,E=ms;if(Re)switch(R){case Js:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case zo:e.blendFunc(e.ONE,e.ONE);break;case Ho:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Go:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:Le("WebGLState: Invalid blending: ",R);break}else switch(R){case Js:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case zo:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case Ho:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Go:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",R);break}T=null,b=null,A=null,g=null,S.set(0,0,0),P=0,m=R,z=Re}return}if(se=se||X,ue=ue||W,Ae=Ae||te,X!==M||se!==E)e.blendEquationSeparate(qe[X],qe[se]),M=X,E=se;if(W!==T||te!==b||ue!==A||Ae!==g)e.blendFuncSeparate(dt[W],dt[te],dt[ue],dt[Ae]),T=W,b=te,A=ue,g=Ae;if(we.equals(S)===!1||pe!==P)e.blendColor(we.r,we.g,we.b,pe),S.copy(we),P=pe;m=R,z=!1}function kt(R,X){R.side===$t?je(e.CULL_FACE):Se(e.CULL_FACE);let W=R.side===Xt;if(X)W=!W;Zt(W),R.blending===Js&&R.transparent===!1?gt(Oi):gt(R.blending,R.blendEquation,R.blendSrc,R.blendDst,R.blendEquationAlpha,R.blendSrcAlpha,R.blendDstAlpha,R.blendColor,R.blendAlpha,R.premultipliedAlpha),a.setFunc(R.depthFunc),a.setTest(R.depthTest),a.setMask(R.depthWrite),r.setMask(R.colorWrite);let te=R.stencilWrite;if(o.setTest(te),te)o.setMask(R.stencilWriteMask),o.setFunc(R.stencilFunc,R.stencilRef,R.stencilFuncMask),o.setOp(R.stencilFail,R.stencilZFail,R.stencilZPass);zt(R.polygonOffset,R.polygonOffsetFactor,R.polygonOffsetUnits),R.alphaToCoverage===!0?Se(e.SAMPLE_ALPHA_TO_COVERAGE):je(e.SAMPLE_ALPHA_TO_COVERAGE)}function Zt(R){if(N!==R){if(R)e.frontFace(e.CW);else e.frontFace(e.CCW);N=R}}function _t(R){if(R!==hu){if(Se(e.CULL_FACE),R!==H)if(R===ko)e.cullFace(e.BACK);else if(R===uu)e.cullFace(e.FRONT);else e.cullFace(e.FRONT_AND_BACK)}else je(e.CULL_FACE);H=R}function Rt(R){if(R!==Q){if(B)e.lineWidth(R);Q=R}}function zt(R,X,W){if(R){if(Se(e.POLYGON_OFFSET_FILL),C!==X||Y!==W){if(C=X,Y=W,a.getReversed())X=-X,W=-W;e.polygonOffset(X,W)}}else je(e.POLYGON_OFFSET_FILL)}function Ht(R){if(R)Se(e.SCISSOR_TEST);else je(e.SCISSOR_TEST)}function dn(R){if(R===void 0)R=e.TEXTURE0+K-1;if(j!==R)e.activeTexture(R),j=R}function L(R,X,W){if(W===void 0)if(j===null)W=e.TEXTURE0+K-1;else W=j;let te=ie[W];if(te===void 0)te={type:void 0,texture:void 0},ie[W]=te;if(te.type!==R||te.texture!==X){if(j!==W)e.activeTexture(W),j=W;e.bindTexture(R,X||Ie[R]),te.type=R,te.texture=X}}function fn(){let R=ie[j];if(R!==void 0&&R.type!==void 0)e.bindTexture(R.type,null),R.type=void 0,R.texture=void 0}function Qe(){try{e.compressedTexImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function Mt(){try{e.compressedTexImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function de(){try{e.texSubImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function rt(){try{e.texSubImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function Pe(){try{e.compressedTexSubImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function De(){try{e.compressedTexSubImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function Ct(){try{e.texStorage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function w(){try{e.texStorage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function x(){try{e.texImage2D(...arguments)}catch(R){Le("WebGLState:",R)}}function U(){try{e.texImage3D(...arguments)}catch(R){Le("WebGLState:",R)}}function ee(R){if(u[R]!==void 0)return u[R];else return e.getParameter(R)}function J(R,X){if(u[R]!==X)e.pixelStorei(R,X),u[R]=X}function re(R){if(ne.equals(R)===!1)e.scissor(R.x,R.y,R.z,R.w),ne.copy(R)}function ce(R){if(ye.equals(R)===!1)e.viewport(R.x,R.y,R.z,R.w),ye.copy(R)}function G(R,X){let W=c.get(X);if(W===void 0)W=new WeakMap,c.set(X,W);let te=W.get(R);if(te===void 0)te=e.getUniformBlockIndex(X,R.name),e.uniformBlockBinding(X,te,te),W.set(R,te)}function q(R,X,W){let se=c.get(X).get(R);if(l[se]!==W)e.bindBufferBase(e.UNIFORM_BUFFER,se,W),l[se]=W}function oe(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),a.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),h={},u={},j=null,ie={},d={},l={},f=new WeakMap,_=[],y=null,p=!1,m=null,M=null,T=null,b=null,E=null,A=null,g=null,S=new Ee(0,0,0),P=0,z=!1,N=null,H=null,Q=null,C=null,Y=null,ne.set(0,0,e.canvas.width,e.canvas.height),ye.set(0,0,e.canvas.width,e.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:Se,disable:je,bindFramebuffer:We,drawBuffers:Oe,useProgram:lt,setBlending:gt,setMaterial:kt,setFlipSided:Zt,setCullFace:_t,setLineWidth:Rt,setPolygonOffset:zt,setScissorTest:Ht,activeTexture:dn,bindTexture:L,unbindTexture:fn,compressedTexImage2D:Qe,compressedTexImage3D:Mt,texImage2D:x,texImage3D:U,pixelStorei:J,getParameter:ee,updateUBOMapping:G,uniformBlockBinding:q,texStorage2D:Ct,texStorage3D:w,texSubImage2D:de,texSubImage3D:rt,compressedTexSubImage2D:Pe,compressedTexSubImage3D:De,scissor:re,viewport:ce,reset:oe}}function hv(e,t,n,i,s,r,a){let o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ke,h=new WeakMap,u=new Set,d,f=new WeakMap,_=new Set,y=new FinalizationRegistry((w)=>_.delete(w)),p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(w){}function m(w,x){return p?new OffscreenCanvas(w,x):ds("canvas")}function M(w,x,U){let ee=1,J=Ct(w);if(J.width>U||J.height>U)ee=U/Math.max(J.width,J.height);if(ee<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){let re=Math.floor(ee*J.width),ce=Math.floor(ee*J.height);if(d===void 0)d=m(re,ce);let G=x?m(re,ce):d;return G.width=re,G.height=ce,G.getContext("2d").drawImage(w,0,0,re,ce),Te("WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+re+"x"+ce+")."),G}else{if("data"in w)Te("WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+").");return w}return w}function T(w){return w.generateMipmaps}function b(w){e.generateMipmap(w)}function E(w){if(w.isWebGLCubeRenderTarget)return e.TEXTURE_CUBE_MAP;if(w.isWebGL3DRenderTarget)return e.TEXTURE_3D;if(w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture)return e.TEXTURE_2D_ARRAY;return e.TEXTURE_2D}function A(w,x,U,ee,J,re=!1){if(w!==null){if(e[w]!==void 0)return e[w];Te("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ce;if(ee){if(ce=t.get("EXT_texture_norm16"),!ce)Te("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let G=x;if(x===e.RED){if(U===e.FLOAT)G=e.R32F;if(U===e.HALF_FLOAT)G=e.R16F;if(U===e.UNSIGNED_BYTE)G=e.R8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.R16_EXT;if(U===e.SHORT&&ce)G=ce.R16_SNORM_EXT}if(x===e.RED_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.R8UI;if(U===e.UNSIGNED_SHORT)G=e.R16UI;if(U===e.UNSIGNED_INT)G=e.R32UI;if(U===e.BYTE)G=e.R8I;if(U===e.SHORT)G=e.R16I;if(U===e.INT)G=e.R32I}if(x===e.RG){if(U===e.FLOAT)G=e.RG32F;if(U===e.HALF_FLOAT)G=e.RG16F;if(U===e.UNSIGNED_BYTE)G=e.RG8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.RG16_EXT;if(U===e.SHORT&&ce)G=ce.RG16_SNORM_EXT}if(x===e.RG_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RG8UI;if(U===e.UNSIGNED_SHORT)G=e.RG16UI;if(U===e.UNSIGNED_INT)G=e.RG32UI;if(U===e.BYTE)G=e.RG8I;if(U===e.SHORT)G=e.RG16I;if(U===e.INT)G=e.RG32I}if(x===e.RGB_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RGB8UI;if(U===e.UNSIGNED_SHORT)G=e.RGB16UI;if(U===e.UNSIGNED_INT)G=e.RGB32UI;if(U===e.BYTE)G=e.RGB8I;if(U===e.SHORT)G=e.RGB16I;if(U===e.INT)G=e.RGB32I}if(x===e.RGBA_INTEGER){if(U===e.UNSIGNED_BYTE)G=e.RGBA8UI;if(U===e.UNSIGNED_SHORT)G=e.RGBA16UI;if(U===e.UNSIGNED_INT)G=e.RGBA32UI;if(U===e.BYTE)G=e.RGBA8I;if(U===e.SHORT)G=e.RGBA16I;if(U===e.INT)G=e.RGBA32I}if(x===e.RGB){if(U===e.UNSIGNED_SHORT&&ce)G=ce.RGB16_EXT;if(U===e.SHORT&&ce)G=ce.RGB16_SNORM_EXT;if(U===e.UNSIGNED_INT_5_9_9_9_REV)G=e.RGB9_E5;if(U===e.UNSIGNED_INT_10F_11F_11F_REV)G=e.R11F_G11F_B10F}if(x===e.RGBA){let q=re?Ul:He.getTransfer(J);if(U===e.FLOAT)G=e.RGBA32F;if(U===e.HALF_FLOAT)G=e.RGBA16F;if(U===e.UNSIGNED_BYTE)G=q===st?e.SRGB8_ALPHA8:e.RGBA8;if(U===e.UNSIGNED_SHORT&&ce)G=ce.RGBA16_EXT;if(U===e.SHORT&&ce)G=ce.RGBA16_SNORM_EXT;if(U===e.UNSIGNED_SHORT_4_4_4_4)G=e.RGBA4;if(U===e.UNSIGNED_SHORT_5_5_5_1)G=e.RGB5_A1}if(G===e.R16F||G===e.R32F||G===e.RG16F||G===e.RG32F||G===e.RGBA16F||G===e.RGBA32F)t.get("EXT_color_buffer_float");return G}function g(w,x){let U;if(w){if(x===null||x===ui||x===ki)U=e.DEPTH24_STENCIL8;else if(x===qn)U=e.DEPTH32F_STENCIL8;else if(x===er)U=e.DEPTH24_STENCIL8,Te("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(x===null||x===ui||x===ki)U=e.DEPTH_COMPONENT24;else if(x===qn)U=e.DEPTH_COMPONENT32F;else if(x===er)U=e.DEPTH_COMPONENT16;return U}function S(w,x){if(T(w)===!0||w.isFramebufferTexture&&w.minFilter!==yn&&w.minFilter!==mt)return Math.log2(Math.max(x.width,x.height))+1;else if(w.mipmaps.length>0)return w.mipmaps.length;else if(w.isCompressedTexture&&Array.isArray(w.image))return x.mipmaps.length;else return 1}function P(w){let x=new WeakRef(w);i.get(w).__ref=x,_.add(x),y.register(w,x,x)}function z(w){let x=i.get(w).__ref;if(x===void 0)return;_.delete(x),y.unregister(x)}function N(w){Q(w.target)}function H(w){C(w.target)}function Q(w){if(w.removeEventListener("dispose",N),z(w),K(w),w.isVideoTexture)h.delete(w);if(w.isHTMLTexture)u.delete(w)}function C(w){w.removeEventListener("dispose",H),z(w),ae(w)}function Y(){for(let w of _){let x=w.deref();if(x===void 0)continue;if(x.isRenderTarget===!0)C(x);else Q(x)}_.clear(),u.clear()}function K(w){let x=i.get(w);if(x.__webglInit===void 0)return;let U=w.source,ee=f.get(U);if(ee){let J=ee[x.__cacheKey];if(J.usedTimes--,J.usedTimes===0)B(w);if(Object.keys(ee).length===0)f.delete(U)}i.remove(w)}function B(w){let x=i.get(w);e.deleteTexture(x.__webglTexture);let U=w.source,ee=f.get(U);delete ee[x.__cacheKey],a.memory.textures--}function ae(w){let x=i.get(w);if(x.__depthDisposeCallback)x.__depthDisposeCallback();let U=w.depthTexture;if(U&&U.renderTarget===w)Q(U);if(w.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(x.__webglFramebuffer[J]))for(let re=0;re<x.__webglFramebuffer[J].length;re++)e.deleteFramebuffer(x.__webglFramebuffer[J][re]);else e.deleteFramebuffer(x.__webglFramebuffer[J]);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer[J])}else{if(Array.isArray(x.__webglFramebuffer))for(let J=0;J<x.__webglFramebuffer.length;J++)e.deleteFramebuffer(x.__webglFramebuffer[J]);else e.deleteFramebuffer(x.__webglFramebuffer);if(x.__webglDepthbuffer)e.deleteRenderbuffer(x.__webglDepthbuffer);if(x.__webglMultisampledFramebuffer)e.deleteFramebuffer(x.__webglMultisampledFramebuffer);if(x.__webglColorRenderbuffer){for(let J=0;J<x.__webglColorRenderbuffer.length;J++)if(x.__webglColorRenderbuffer[J])e.deleteRenderbuffer(x.__webglColorRenderbuffer[J])}if(x.__webglDepthRenderbuffer)e.deleteRenderbuffer(x.__webglDepthRenderbuffer)}let ee=w.textures;for(let J=0,re=ee.length;J<re;J++){let ce=i.get(ee[J]);if(ce.__webglTexture)e.deleteTexture(ce.__webglTexture),a.memory.textures--;i.remove(ee[J])}i.remove(w)}let V=0;function j(){V=0}function ie(){return V}function be(w){V=w}function Z(){let w=V;if(w>=s.maxTextures)Te("WebGLTextures: Trying to use "+(w+1)+" texture units while this GPU supports only "+s.maxTextures);return V+=1,w}function ne(w){let x=[];return x.push(w.wrapS),x.push(w.wrapT),x.push(w.wrapR||0),x.push(w.magFilter),x.push(w.minFilter),x.push(w.anisotropy),x.push(w.internalFormat),x.push(w.format),x.push(w.type),x.push(w.generateMipmaps),x.push(w.mipmapsAutoUpdate),x.push(w.premultiplyAlpha),x.push(w.flipY),x.push(w.unpackAlignment),x.push(w.colorSpace),x.join()}function ye(w,x){let U=i.get(w);if(w.isVideoTexture)Pe(w);if(w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&U.__version!==w.version){let ee=w.image;if(ee===null)Te("WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)Te("WebGLRenderer: Texture marked for update but image is incomplete");else{kt(U,w,x);return}}else if(w.isExternalTexture)U.__webglTexture=w.sourceTexture?w.sourceTexture:null;n.bindTexture(e.TEXTURE_2D,U.__webglTexture,e.TEXTURE0+x)}function Ce(w,x){let U=i.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){kt(U,w,x);return}else if(w.isExternalTexture)U.__webglTexture=w.sourceTexture?w.sourceTexture:null;n.bindTexture(e.TEXTURE_2D_ARRAY,U.__webglTexture,e.TEXTURE0+x)}function Ie(w,x){let U=i.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){kt(U,w,x);return}n.bindTexture(e.TEXTURE_3D,U.__webglTexture,e.TEXTURE0+x)}function Se(w,x){let U=i.get(w);if(w.version>0&&U.__version!==w.version){Zt(U,w,x);return}n.bindTexture(e.TEXTURE_CUBE_MAP,U.__webglTexture,e.TEXTURE0+x)}let je={[hi]:e.REPEAT,[_s]:e.CLAMP_TO_EDGE,[na]:e.MIRRORED_REPEAT},We={[yn]:e.NEAREST,[ia]:e.NEAREST_MIPMAP_NEAREST,[Bi]:e.NEAREST_MIPMAP_LINEAR,[mt]:e.LINEAR,[xs]:e.LINEAR_MIPMAP_NEAREST,[tn]:e.LINEAR_MIPMAP_LINEAR},Oe={[Ju]:e.NEVER,[Bl]:e.ALWAYS,[ju]:e.LESS,[Fl]:e.LEQUAL,[Qu]:e.EQUAL,[Ol]:e.GEQUAL,[ed]:e.GREATER,[td]:e.NOTEQUAL};function lt(w,x){if(x.type===qn&&t.has("OES_texture_float_linear")===!1&&(x.magFilter===mt||x.magFilter===xs||x.magFilter===Bi||x.magFilter===tn||x.minFilter===mt||x.minFilter===xs||x.minFilter===Bi||x.minFilter===tn))Te("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(e.texParameteri(w,e.TEXTURE_WRAP_S,je[x.wrapS]),e.texParameteri(w,e.TEXTURE_WRAP_T,je[x.wrapT]),w===e.TEXTURE_3D||w===e.TEXTURE_2D_ARRAY)e.texParameteri(w,e.TEXTURE_WRAP_R,je[x.wrapR]);if(e.texParameteri(w,e.TEXTURE_MAG_FILTER,We[x.magFilter]),e.texParameteri(w,e.TEXTURE_MIN_FILTER,We[x.minFilter]),x.compareFunction)e.texParameteri(w,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(w,e.TEXTURE_COMPARE_FUNC,Oe[x.compareFunction]);if(t.has("EXT_texture_filter_anisotropic")===!0){if(x.magFilter===yn)return;if(x.minFilter!==Bi&&x.minFilter!==tn)return;if(x.type===qn&&t.has("OES_texture_float_linear")===!1)return;if(x.anisotropy>1||i.get(x).__currentAnisotropy){let U=t.get("EXT_texture_filter_anisotropic");e.texParameterf(w,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(x.anisotropy,s.getMaxAnisotropy())),i.get(x).__currentAnisotropy=x.anisotropy}}}function qe(w,x){let U=!1;if(w.__webglInit===void 0)w.__webglInit=!0,x.addEventListener("dispose",N),P(x);let ee=x.source,J=f.get(ee);if(J===void 0)J={},f.set(ee,J);let re=ne(x);if(re!==w.__cacheKey){if(J[re]===void 0)J[re]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,U=!0;J[re].usedTimes++;let ce=J[w.__cacheKey];if(ce!==void 0){if(J[w.__cacheKey].usedTimes--,ce.usedTimes===0)B(x)}w.__cacheKey=re,w.__webglTexture=J[re].texture}return U}function dt(w,x,U){return Math.floor(Math.floor(w/U)/x)}function gt(w,x,U,ee){let re=w.updateRanges;if(re.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,x.width,x.height,U,ee,x.data);else{re.sort((R,X)=>R.start-X.start);let ce=0;for(let R=1;R<re.length;R++){let X=re[ce],W=re[R],te=X.start+X.count,se=dt(W.start,x.width,4),ue=dt(X.start,x.width,4);if(W.start<=te+1&&se===ue&&dt(W.start+W.count-1,x.width,4)===se)X.count=Math.max(X.count,W.start+W.count-X.start);else++ce,re[ce]=W}re.length=ce+1;let G=n.getParameter(e.UNPACK_ROW_LENGTH),q=n.getParameter(e.UNPACK_SKIP_PIXELS),oe=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,x.width);for(let R=0,X=re.length;R<X;R++){let W=re[R],te=Math.floor(W.start/4),se=Math.ceil(W.count/4),ue=te%x.width,Ae=Math.floor(te/x.width),we=se,pe=1;n.pixelStorei(e.UNPACK_SKIP_PIXELS,ue),n.pixelStorei(e.UNPACK_SKIP_ROWS,Ae),n.texSubImage2D(e.TEXTURE_2D,0,ue,Ae,we,1,U,ee,x.data)}w.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,G),n.pixelStorei(e.UNPACK_SKIP_PIXELS,q),n.pixelStorei(e.UNPACK_SKIP_ROWS,oe)}}function kt(w,x,U){let ee=e.TEXTURE_2D;if(x.isDataArrayTexture||x.isCompressedArrayTexture)ee=e.TEXTURE_2D_ARRAY;if(x.isData3DTexture)ee=e.TEXTURE_3D;let J=qe(w,x),re=x.source;n.bindTexture(ee,w.__webglTexture,e.TEXTURE0+U);let ce=i.get(re);if(re.version!==ce.__version||J===!0){if(n.activeTexture(e.TEXTURE0+U),(typeof ImageBitmap<"u"&&x.image instanceof ImageBitmap)===!1){let pe=He.getPrimaries(He.workingColorSpace),Re=x.colorSpace===Hi?null:He.getPrimaries(x.colorSpace),Be=x.colorSpace===Hi||pe===Re?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be)}n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment);let q=M(x.image,!1,s.maxTextureSize);q=De(x,q);let oe=r.convert(x.format,x.colorSpace),R=r.convert(x.type),X=A(x.internalFormat,oe,R,x.normalized,x.colorSpace,x.isVideoTexture);lt(ee,x);let W,te=x.mipmaps,se=x.isVideoTexture!==!0,ue=ce.__version===void 0||J===!0,Ae=re.dataReady,we=S(x,q);if(x.isDepthTexture){if(X=g(x.format===di,x.type),ue)if(se)n.texStorage2D(e.TEXTURE_2D,1,X,q.width,q.height);else n.texImage2D(e.TEXTURE_2D,0,X,q.width,q.height,0,oe,R,null)}else if(x.isDataTexture)if(te.length>0){if(se&&ue)n.texStorage2D(e.TEXTURE_2D,we,X,te[0].width,te[0].height);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,R,W.data)}else n.texImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,oe,R,W.data);x.generateMipmaps=!1}else if(se){if(ue)n.texStorage2D(e.TEXTURE_2D,we,X,q.width,q.height);if(Ae)gt(x,q,oe,R)}else n.texImage2D(e.TEXTURE_2D,0,X,q.width,q.height,0,oe,R,q.data);else if(x.isCompressedTexture)if(x.isCompressedArrayTexture){if(se&&ue)n.texStorage3D(e.TEXTURE_2D_ARRAY,we,X,te[0].width,te[0].height,q.depth);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],x.format!==bn)if(oe!==null)if(se){if(Ae)if(x.layerUpdates.size>0){let Be=lc(W.width,W.height,x.format,x.type);for(let me of x.layerUpdates){let et=W.data.subarray(me*Be/W.data.BYTES_PER_ELEMENT,(me+1)*Be/W.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,me,W.width,W.height,1,oe,et)}}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,0,W.width,W.height,q.depth,oe,W.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,pe,X,W.width,W.height,q.depth,0,W.data,0,0);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(se){if(Ae)n.texSubImage3D(e.TEXTURE_2D_ARRAY,pe,0,0,0,W.width,W.height,q.depth,oe,R,W.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,pe,X,W.width,W.height,q.depth,0,oe,R,W.data);if(x.layerUpdates.size>0)x.clearLayerUpdates()}else{if(se&&ue)n.texStorage2D(e.TEXTURE_2D,we,X,te[0].width,te[0].height);for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],x.format!==bn)if(oe!==null)if(se){if(Ae)n.compressedTexSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,W.data)}else n.compressedTexImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,W.data);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,W.width,W.height,oe,R,W.data)}else n.texImage2D(e.TEXTURE_2D,pe,X,W.width,W.height,0,oe,R,W.data)}else if(x.isDataArrayTexture)if(se){if(ue)n.texStorage3D(e.TEXTURE_2D_ARRAY,we,X,q.width,q.height,q.depth);if(Ae)if(x.layerUpdates.size>0){let pe=lc(q.width,q.height,x.format,x.type);for(let Re of x.layerUpdates){let Be=q.data.subarray(Re*pe/q.data.BYTES_PER_ELEMENT,(Re+1)*pe/q.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,Re,q.width,q.height,1,oe,R,Be)}x.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,q.width,q.height,q.depth,oe,R,q.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,X,q.width,q.height,q.depth,0,oe,R,q.data);else if(x.isData3DTexture)if(se){if(ue)n.texStorage3D(e.TEXTURE_3D,we,X,q.width,q.height,q.depth);if(Ae)n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,q.width,q.height,q.depth,oe,R,q.data)}else n.texImage3D(e.TEXTURE_3D,0,X,q.width,q.height,q.depth,0,oe,R,q.data);else if(x.isFramebufferTexture){if(ue)if(se)n.texStorage2D(e.TEXTURE_2D,we,X,q.width,q.height);else{let pe=q.width,Re=q.height;for(let Be=0;Be<we;Be++)n.texImage2D(e.TEXTURE_2D,Be,X,pe,Re,0,oe,R,null),pe>>=1,Re>>=1}}else if(x.isHTMLTexture){if("texElementImage2D"in e){let pe=e.canvas;if(!pe.hasAttribute("layoutsubtree"))pe.setAttribute("layoutsubtree","true");if(q.parentNode!==pe){pe.appendChild(q),u.add(x),pe.onpaint=(Re)=>{let Be=Re.changedElements;for(let me of u)if(Be.includes(me.image))me.needsUpdate=!0},pe.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,q);else{let{RGBA:Be,RGBA:me,UNSIGNED_BYTE:et}=e;e.texElementImage2D(e.TEXTURE_2D,0,Be,me,et,q)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(te.length>0){if(se&&ue){let pe=Ct(te[0]);n.texStorage2D(e.TEXTURE_2D,we,X,pe.width,pe.height)}for(let pe=0,Re=te.length;pe<Re;pe++)if(W=te[pe],se){if(Ae)n.texSubImage2D(e.TEXTURE_2D,pe,0,0,oe,R,W)}else n.texImage2D(e.TEXTURE_2D,pe,X,oe,R,W);x.generateMipmaps=!1}else if(se){if(ue){let pe=Ct(q);n.texStorage2D(e.TEXTURE_2D,we,X,pe.width,pe.height)}if(Ae)n.texSubImage2D(e.TEXTURE_2D,0,0,0,oe,R,q)}else n.texImage2D(e.TEXTURE_2D,0,X,oe,R,q);if(T(x)&&x.mipmapsAutoUpdate===!0)b(ee);if(ce.__version=re.version,x.onUpdate)x.onUpdate(x)}w.__version=x.version}function Zt(w,x,U){if(x.image.length!==6)return;let ee=qe(w,x),J=x.source;n.bindTexture(e.TEXTURE_CUBE_MAP,w.__webglTexture,e.TEXTURE0+U);let re=i.get(J);if(J.version!==re.__version||ee===!0){n.activeTexture(e.TEXTURE0+U);let ce=He.getPrimaries(He.workingColorSpace),G=x.colorSpace===Hi?null:He.getPrimaries(x.colorSpace),q=x.colorSpace===Hi||ce===G?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,x.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,x.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,q);let oe=x.isCompressedTexture||x.image[0].isCompressedTexture,R=x.image[0]&&x.image[0].isDataTexture,X=[];for(let me=0;me<6;me++){if(!oe&&!R)X[me]=M(x.image[me],!0,s.maxCubemapSize);else X[me]=R?x.image[me].image:x.image[me];X[me]=De(x,X[me])}let W=X[0],te=r.convert(x.format,x.colorSpace),se=r.convert(x.type),ue=A(x.internalFormat,te,se,x.normalized,x.colorSpace),Ae=x.isVideoTexture!==!0,we=re.__version===void 0||ee===!0,pe=J.dataReady,Re=S(x,W);lt(e.TEXTURE_CUBE_MAP,x);let Be;if(x.isDepthTexture){if(ue=g(x.format===di,x.type),we)if(Ae)n.texStorage2D(e.TEXTURE_CUBE_MAP,1,ue,W.width,W.height);else for(let me=0;me<6;me++)n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,W.width,W.height,0,te,se,null)}else if(oe){if(Ae&&we)n.texStorage2D(e.TEXTURE_CUBE_MAP,Re,ue,W.width,W.height);for(let me=0;me<6;me++){Be=X[me].mipmaps;for(let et=0;et<Be.length;et++){let wt=Be[et];if(x.format!==bn)if(te!==null)if(Ae){if(pe)n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,0,0,wt.width,wt.height,te,wt.data)}else n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,ue,wt.width,wt.height,0,wt.data);else Te("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,0,0,wt.width,wt.height,te,se,wt.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et,ue,wt.width,wt.height,0,te,se,wt.data)}}}else{if(Be=x.mipmaps,Ae&&we){if(Be.length>0)Re++;let me=Ct(X[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,Re,ue,me.width,me.height)}for(let me=0;me<6;me++)if(R){if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,X[me].width,X[me].height,te,se,X[me].data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,X[me].width,X[me].height,0,te,se,X[me].data);for(let et=0;et<Be.length;et++){let Un=Be[et].image[me].image;if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,0,0,Un.width,Un.height,te,se,Un.data)}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,ue,Un.width,Un.height,0,te,se,Un.data)}}else{if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,te,se,X[me])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,ue,te,se,X[me]);for(let et=0;et<Be.length;et++){let wt=Be[et];if(Ae){if(pe)n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,0,0,te,se,wt.image[me])}else n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+me,et+1,ue,te,se,wt.image[me])}}}if(T(x)&&x.mipmapsAutoUpdate===!0)b(e.TEXTURE_CUBE_MAP);if(re.__version=J.version,x.onUpdate)x.onUpdate(x)}w.__version=x.version}function _t(w,x,U,ee,J,re){let ce=r.convert(U.format,U.colorSpace),G=r.convert(U.type),q=A(U.internalFormat,ce,G,U.normalized,U.colorSpace),oe=i.get(x),R=i.get(U);if(R.__renderTarget=x,!oe.__hasExternalTextures){let X=Math.max(1,x.width>>re),W=Math.max(1,x.height>>re);if(J===e.TEXTURE_3D||J===e.TEXTURE_2D_ARRAY)n.texImage3D(J,re,q,X,W,x.depth,0,ce,G,null);else n.texImage2D(J,re,q,X,W,0,ce,G,null)}if(n.bindFramebuffer(e.FRAMEBUFFER,w),rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,ee,J,R.__webglTexture,0,de(x));else if(J===e.TEXTURE_2D||J>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)e.framebufferTexture2D(e.FRAMEBUFFER,ee,J,R.__webglTexture,re);n.bindFramebuffer(e.FRAMEBUFFER,null)}function Rt(w,x,U){if(e.bindRenderbuffer(e.RENDERBUFFER,w),x.depthBuffer){let ee=x.depthTexture,J=ee&&ee.isDepthTexture?ee.type:null,re=g(x.stencilBuffer,J),ce=x.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(rt(x))o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,de(x),re,x.width,x.height);else if(U)e.renderbufferStorageMultisample(e.RENDERBUFFER,de(x),re,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,re,x.width,x.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,ce,e.RENDERBUFFER,w)}else{let ee=x.textures;for(let J=0;J<ee.length;J++){let re=ee[J],ce=r.convert(re.format,re.colorSpace),G=r.convert(re.type),q=A(re.internalFormat,ce,G,re.normalized,re.colorSpace);if(rt(x))o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,de(x),q,x.width,x.height);else if(U)e.renderbufferStorageMultisample(e.RENDERBUFFER,de(x),q,x.width,x.height);else e.renderbufferStorage(e.RENDERBUFFER,q,x.width,x.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function zt(w,x,U){let ee=x.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,w),!(x.depthTexture&&x.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let J=i.get(x.depthTexture);J.__renderTarget=x;let re=ee?x.depthTexture.image[0]:x.depthTexture.image;if(!J.__webglTexture||re.width!==x.width||re.height!==x.height)re.width=x.width,re.height=x.height,x.depthTexture.needsUpdate=!0;if(ee)Se(x.depthTexture,0);else ye(x.depthTexture,0);let ce=J.__webglTexture,G=de(x),q=ee?e.TEXTURE_CUBE_MAP_POSITIVE_X+U:e.TEXTURE_2D,oe=x.depthTexture.format===di?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(x.depthTexture.format===vs)if(rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,oe,q,ce,0,G);else e.framebufferTexture2D(e.FRAMEBUFFER,oe,q,ce,0);else if(x.depthTexture.format===di)if(rt(x))o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,oe,q,ce,0,G);else e.framebufferTexture2D(e.FRAMEBUFFER,oe,q,ce,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Ht(w){let x=i.get(w),U=w.isWebGLCubeRenderTarget===!0;if(x.__boundDepthTexture!==w.depthTexture){let ee=w.depthTexture;if(x.__depthDisposeCallback)x.__depthDisposeCallback();if(ee){let J=()=>{delete x.__boundDepthTexture,delete x.__depthDisposeCallback,ee.removeEventListener("dispose",J)};ee.addEventListener("dispose",J),x.__depthDisposeCallback=J}x.__boundDepthTexture=ee}if(w.depthTexture&&!x.__autoAllocateDepthBuffer)if(U)for(let ee=0;ee<6;ee++)zt(x.__webglFramebuffer[ee],w,ee);else if(w.texture.mipmaps.length>0)zt(x.__webglFramebuffer[0],w,0);else zt(x.__webglFramebuffer,w,0);else if(U){x.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[ee]),x.__webglDepthbuffer[ee]===void 0)x.__webglDepthbuffer[ee]=e.createRenderbuffer(),Rt(x.__webglDepthbuffer[ee],w,!1);else{let J=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=x.__webglDepthbuffer[ee];e.bindRenderbuffer(e.RENDERBUFFER,re),e.framebufferRenderbuffer(e.FRAMEBUFFER,J,e.RENDERBUFFER,re)}}else{if(w.texture.mipmaps.length>0)n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer[0]);else n.bindFramebuffer(e.FRAMEBUFFER,x.__webglFramebuffer);if(x.__webglDepthbuffer===void 0)x.__webglDepthbuffer=e.createRenderbuffer(),Rt(x.__webglDepthbuffer,w,!1);else{let J=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=x.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,re),e.framebufferRenderbuffer(e.FRAMEBUFFER,J,e.RENDERBUFFER,re)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function dn(w,x,U){let ee=i.get(w);if(x!==void 0)_t(ee.__webglFramebuffer,w,w.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0);if(U!==void 0)Ht(w)}function L(w){let x=w.texture,U=i.get(w),ee=i.get(x);w.addEventListener("dispose",H),P(w);let J=w.textures,re=w.isWebGLCubeRenderTarget===!0,ce=J.length>1;if(!ce){if(ee.__webglTexture===void 0)ee.__webglTexture=e.createTexture();ee.__version=x.version,a.memory.textures++}if(re){U.__webglFramebuffer=[];for(let G=0;G<6;G++)if(x.mipmaps.length>0){U.__webglFramebuffer[G]=[];for(let q=0;q<x.mipmaps.length;q++)U.__webglFramebuffer[G][q]=e.createFramebuffer()}else U.__webglFramebuffer[G]=e.createFramebuffer()}else{if(x.mipmaps.length>0){U.__webglFramebuffer=[];for(let G=0;G<x.mipmaps.length;G++)U.__webglFramebuffer[G]=e.createFramebuffer()}else U.__webglFramebuffer=e.createFramebuffer();if(ce)for(let G=0,q=J.length;G<q;G++){let oe=i.get(J[G]);if(oe.__webglTexture===void 0)oe.__webglTexture=e.createTexture(),a.memory.textures++}if(w.samples>0&&rt(w)===!1){U.__webglMultisampledFramebuffer=e.createFramebuffer(),U.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let G=0;G<J.length;G++){let q=J[G];U.__webglColorRenderbuffer[G]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,U.__webglColorRenderbuffer[G]);let oe=r.convert(q.format,q.colorSpace),R=r.convert(q.type),X=A(q.internalFormat,oe,R,q.normalized,q.colorSpace,w.isXRRenderTarget===!0),W=de(w);e.renderbufferStorageMultisample(e.RENDERBUFFER,W,X,w.width,w.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+G,e.RENDERBUFFER,U.__webglColorRenderbuffer[G])}if(e.bindRenderbuffer(e.RENDERBUFFER,null),w.depthBuffer)U.__webglDepthRenderbuffer=e.createRenderbuffer(),Rt(U.__webglDepthRenderbuffer,w,!0);n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(re){n.bindTexture(e.TEXTURE_CUBE_MAP,ee.__webglTexture),lt(e.TEXTURE_CUBE_MAP,x);for(let G=0;G<6;G++)if(x.mipmaps.length>0)for(let q=0;q<x.mipmaps.length;q++)_t(U.__webglFramebuffer[G][q],w,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+G,q);else _t(U.__webglFramebuffer[G],w,x,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+G,0);if(T(x))b(e.TEXTURE_CUBE_MAP);else if(x.mipmaps.length>0)e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAX_LEVEL,x.mipmaps.length-1);n.unbindTexture()}else if(ce){for(let G=0,q=J.length;G<q;G++){let oe=J[G],R=i.get(oe),X=e.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)X=w.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(X,R.__webglTexture),lt(X,oe),_t(U.__webglFramebuffer,w,oe,e.COLOR_ATTACHMENT0+G,X,0),T(oe))b(X)}n.unbindTexture()}else{let G=e.TEXTURE_2D;if(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)G=w.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY;if(n.bindTexture(G,ee.__webglTexture),lt(G,x),x.mipmaps.length>0)for(let q=0;q<x.mipmaps.length;q++)_t(U.__webglFramebuffer[q],w,x,e.COLOR_ATTACHMENT0,G,q);else _t(U.__webglFramebuffer,w,x,e.COLOR_ATTACHMENT0,G,0);if(T(x))b(G);else if(x.mipmaps.length>0)e.texParameteri(G,e.TEXTURE_MAX_LEVEL,x.mipmaps.length-1);n.unbindTexture()}if(w.depthBuffer)Ht(w)}function fn(w){let x=w.textures;for(let U=0,ee=x.length;U<ee;U++){let J=x[U];if(T(J)&&J.mipmapsAutoUpdate===!0){let re=E(w),ce=i.get(J).__webglTexture;n.bindTexture(re,ce),b(re),n.unbindTexture()}}}let Qe=[];function Mt(w){if(w.samples>0){if(rt(w)===!1){let{textures:x,width:U,height:ee}=w,J=e.COLOR_BUFFER_BIT,re=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ce=i.get(w),G=x.length>1;if(G)for(let oe=0;oe<x.length;oe++)n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.TEXTURE_2D,null,0);if(n.bindFramebuffer(e.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer),w.texture.mipmaps.length>0)n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]);else n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let oe=0;oe<x.length;oe++){if(w.resolveDepthBuffer){if(w.depthBuffer)J|=e.DEPTH_BUFFER_BIT;if(w.stencilBuffer&&w.resolveStencilBuffer)J|=e.STENCIL_BUFFER_BIT}if(G){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,ce.__webglColorRenderbuffer[oe]);let R=i.get(x[oe]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,R,0)}if(e.blitFramebuffer(0,0,U,ee,0,0,U,ee,J,e.NEAREST),l===!0){if(Qe.length=0,Qe.push(e.COLOR_ATTACHMENT0+oe),w.depthBuffer&&w.storeMultisampledDepthBuffer===!1)Qe.push(re);e.invalidateFramebuffer(e.READ_FRAMEBUFFER,Qe)}}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),G)for(let oe=0;oe<x.length;oe++){n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.RENDERBUFFER,ce.__webglColorRenderbuffer[oe]);let R=i.get(x[oe]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,ce.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+oe,e.TEXTURE_2D,R,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.storeMultisampledDepthBuffer===!1&&l){let x=w.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[x])}}}function de(w){return Math.min(s.maxSamples,w.samples)}function rt(w){let x=i.get(w);return w.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&x.__useRenderToTexture!==!1}function Pe(w){let x=a.render.frame;if(h.get(w)!==x)h.set(w,x),w.update()}function De(w,x){let{colorSpace:U,format:ee,type:J}=w;if(w.isCompressedTexture===!0||w.isVideoTexture===!0)return x;if(U!==nn&&U!==Hi)if(He.getTransfer(U)===st){if(ee!==bn||J!==Sn)Te("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else Le("WebGLTextures: Unsupported texture color space:",U);return x}function Ct(w){if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement)c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height;else if(typeof VideoFrame<"u"&&w instanceof VideoFrame)c.width=w.displayWidth,c.height=w.displayHeight;else c.width=w.width,c.height=w.height;return c}this.allocateTextureUnit=Z,this.resetTextureUnits=j,this.getTextureUnits=ie,this.setTextureUnits=be,this.setTexture2D=ye,this.setTexture2DArray=Ce,this.setTexture3D=Ie,this.setTextureCube=Se,this.rebindTextures=dn,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fn,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=Ht,this.setupFrameBufferTexture=_t,this.useMultisampledRTT=rt,this.dispose=Y}function uv(e,t){function n(i,s=Hi){let r,a=He.getTransfer(s);if(i===Sn)return e.UNSIGNED_BYTE;if(i===Jo)return e.UNSIGNED_SHORT_4_4_4_4;if(i===jo)return e.UNSIGNED_SHORT_5_5_5_1;if(i===Xu)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===$u)return e.UNSIGNED_INT_10F_11F_11F_REV;if(i===Wu)return e.BYTE;if(i===Vu)return e.SHORT;if(i===er)return e.UNSIGNED_SHORT;if(i===Ko)return e.INT;if(i===ui)return e.UNSIGNED_INT;if(i===qn)return e.FLOAT;if(i===Cn)return e.HALF_FLOAT;if(i===qu)return e.ALPHA;if(i===Yu)return e.RGB;if(i===bn)return e.RGBA;if(i===vs)return e.DEPTH_COMPONENT;if(i===di)return e.DEPTH_STENCIL;if(i===Zu)return e.RED;if(i===Qo)return e.RED_INTEGER;if(i===zi)return e.RG;if(i===el)return e.RG_INTEGER;if(i===tl)return e.RGBA_INTEGER;if(i===sa||i===ra||i===aa||i===oa)if(a===st)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===sa)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ra)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===aa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===oa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===sa)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ra)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===aa)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===oa)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===nl||i===il||i===sl||i===rl)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===nl)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===il)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===sl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===rl)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===al||i===ol||i===ll||i===cl||i===hl||i===la||i===ul)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(i===al||i===ol)return a===st?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===ll)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===cl)return r.COMPRESSED_R11_EAC;if(i===hl)return r.COMPRESSED_SIGNED_R11_EAC;if(i===la)return r.COMPRESSED_RG11_EAC;if(i===ul)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===dl||i===fl||i===pl||i===ml||i===gl||i===_l||i===xl||i===vl||i===yl||i===Sl||i===bl||i===Ml||i===wl||i===Tl)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(i===dl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===pl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ml)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===gl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===_l)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===xl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===vl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===yl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Sl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===bl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ml)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Tl)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===El||i===Al||i===Rl)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(i===El)return a===st?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Al)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Rl)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Cl||i===Il||i===ca||i===Pl)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(i===Cl)return r.COMPRESSED_RED_RGTC1_EXT;if(i===Il)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ca)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Pl)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(i===ki)return e.UNSIGNED_INT_24_8;return e[i]!==void 0?e[i]:null}return{convert:n}}class jd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ta(e.texture);if(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)this.depthNear=e.depthNear,this.depthFar=e.depthFar;this.texture=n}}getMesh(e){if(this.texture!==null){if(this.mesh===null){let t=e.cameras[0].viewport,n=new Kn({vertexShader:dv,fragmentShader:fv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new yt(new hr(20,20),n)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}function mv(e,t){function n(p,m){if(p.matrixAutoUpdate===!0)p.updateMatrix();m.value.copy(p.matrix)}function i(p,m){if(m.color.getRGB(p.fogColor.value,Yl(e)),m.isFog)p.fogNear.value=m.near,p.fogFar.value=m.far;else if(m.isFogExp2)p.fogDensity.value=m.density}function s(p,m,M,T,b){if(m.isNodeMaterial)m.uniformsNeedUpdate=!1;else if(m.isMeshBasicMaterial)r(p,m);else if(m.isMeshLambertMaterial){if(r(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshToonMaterial)r(p,m),u(p,m);else if(m.isMeshPhongMaterial){if(r(p,m),h(p,m),m.envMap)p.envMapIntensity.value=m.envMapIntensity}else if(m.isMeshStandardMaterial){if(r(p,m),d(p,m),m.isMeshPhysicalMaterial)f(p,m,b)}else if(m.isMeshMatcapMaterial)r(p,m),_(p,m);else if(m.isMeshDepthMaterial)r(p,m);else if(m.isMeshDistanceMaterial)r(p,m),y(p,m);else if(m.isMeshNormalMaterial)r(p,m);else if(m.isLineBasicMaterial){if(a(p,m),m.isLineDashedMaterial)o(p,m)}else if(m.isPointsMaterial)l(p,m,M,T);else if(m.isSpriteMaterial)c(p,m);else if(m.isShadowMaterial)p.color.value.copy(m.color),p.opacity.value=m.opacity;else if(m.isShaderMaterial)m.uniformsNeedUpdate=!1}function r(p,m){if(p.opacity.value=m.opacity,m.color)p.diffuse.value.copy(m.color);if(m.emissive)p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity);if(m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.bumpMap){if(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Xt)p.bumpScale.value*=-1}if(m.normalMap){if(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Xt)p.normalScale.value.negate()}if(m.displacementMap)p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias;if(m.emissiveMap)p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform);if(m.specularMap)p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest;let M=t.get(m),{envMap:T,envMapRotation:b}=M;if(T){if(p.envMap.value=T,p.envMapRotation.value.setFromMatrix4(pv.makeRotationFromEuler(b)).transpose(),T.isCubeTexture&&T.isRenderTargetTexture===!1)p.envMapRotation.value.premultiply(ef);p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio}if(m.lightMap)p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform);if(m.aoMap)p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform)}function a(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map)p.map.value=m.map,n(m.map,p.mapTransform)}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function l(p,m,M,T){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*M,p.scale.value=T*0.5,m.map)p.map.value=m.map,n(m.map,p.uvTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function c(p,m){if(p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map)p.map.value=m.map,n(m.map,p.mapTransform);if(m.alphaMap)p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform);if(m.alphaTest>0)p.alphaTest.value=m.alphaTest}function h(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,0.0001)}function u(p,m){if(m.gradientMap)p.gradientMap.value=m.gradientMap}function d(p,m){if(p.metalness.value=m.metalness,m.metalnessMap)p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform);if(p.roughness.value=m.roughness,m.roughnessMap)p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform);if(m.envMap)p.envMapIntensity.value=m.envMapIntensity}function f(p,m,M){if(p.ior.value=m.ior,m.diffuseRoughness>0){if(p.diffuseRoughness.value=m.diffuseRoughness,m.diffuseRoughnessMap)p.diffuseRoughnessMap.value=m.diffuseRoughnessMap,n(m.diffuseRoughnessMap,p.diffuseRoughnessMapTransform)}if(m.sheen>0){if(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap)p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform);if(m.sheenRoughnessMap)p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform)}if(m.clearcoat>0){if(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap)p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform);if(m.clearcoatRoughnessMap)p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform);if(m.clearcoatNormalMap){if(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Xt)p.clearcoatNormalScale.value.negate()}}if(m.dispersion>0)p.dispersion.value=m.dispersion;if(m.retroreflectivity>0)p.retroreflectivity.value=m.retroreflectivity;if(m.iridescence>0){if(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessMinimum,p.iridescenceThicknessMaximum.value=m.iridescenceThicknessMaximum,m.iridescenceMap)p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform);if(m.iridescenceThicknessMap)p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform)}if(m.transmission>0){if(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=M.texture,p.transmissionSamplerSize.value.set(M.width,M.height),m.transmissionMap)p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform);if(p.thickness.value=m.thickness,m.thicknessMap)p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform);p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)}if(m.anisotropy>0){if(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap)p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform)}if(p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap)p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform);if(m.specularIntensityMap)p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform)}function _(p,m){if(m.matcap)p.matcap.value=m.matcap}function y(p,m){let M=t.get(m).light;p.referencePosition.value.setFromMatrixPosition(M.matrixWorld),p.nearDistance.value=M.shadow.camera.near,p.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function gv(e,t,n,i){let s={},r={};function a(M,T){let b=T.program;i.uniformBlockBinding(M,b,s[M.id])}function o(M,T){let b=s[M.id];if(b===void 0)_(M),b=l(M),s[M.id]=b,M.addEventListener("dispose",p);let E=T.program;i.updateUBOMapping(M,E);let A=t.render.frame;if(r[M.id]!==A)c(M),r[M.id]=A}function l(M){let T=e.createBuffer(),{__size:b,usage:E}=M;return e.bindBuffer(e.UNIFORM_BUFFER,T),e.bufferData(e.UNIFORM_BUFFER,b,E),e.bindBuffer(e.UNIFORM_BUFFER,null),T}function c(M){let T=s[M.id],{uniforms:b,__cache:E}=M;e.bindBuffer(e.UNIFORM_BUFFER,T);for(let A=0,g=b.length;A<g;A++){let S=b[A];if(Array.isArray(S))for(let P=0,z=S.length;P<z;P++)h(S[P],A,P,E);else h(S,A,0,E)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function h(M,T,b,E){if(d(M,T,b,E)===!0){let{__offset:A,value:g}=M;if(Array.isArray(g)){let S=0;for(let P=0;P<g.length;P++){let z=g[P],N=y(z,!0);u(z,M.__data,S),S+=N.storage/Float32Array.BYTES_PER_ELEMENT}}else u(g,M.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,A,M.__data)}}function u(M,T,b){if(typeof M==="number"||typeof M==="boolean")T[b]=M;else if(M.isMatrix3)T[b]=M.elements[0],T[b+1]=M.elements[1],T[b+2]=M.elements[2],T[b+3]=0,T[b+4]=M.elements[3],T[b+5]=M.elements[4],T[b+6]=M.elements[5],T[b+7]=0,T[b+8]=M.elements[6],T[b+9]=M.elements[7],T[b+10]=M.elements[8],T[b+11]=0;else if(ArrayBuffer.isView(M))T.set(M.subarray(0,T.length-b),b);else M.toArray(T,b)}function d(M,T,b,E){let A=M.value,g=T+"_"+b;if(Array.isArray(A)){if(E[g]===void 0)E[g]=[];let S=E[g],P=!1;for(let z=0;z<A.length;z++)if(f(A[z],S,z)===!0)P=!0;return P}return f(A,E,g)}function f(M,T,b){if(T[b]===void 0){if(typeof M==="number"||typeof M==="boolean")T[b]=M;else if(ArrayBuffer.isView(M))T[b]=M.slice();else T[b]=M.clone();return!0}else{let E=T[b];if(typeof M==="number"||typeof M==="boolean"){if(E!==M)return T[b]=M,!0}else if(ArrayBuffer.isView(M))return!0;else if(E.equals(M)===!1)return E.copy(M),!0}return!1}function _(M){let T=M.uniforms,b=0,E=16;for(let g=0,S=T.length;g<S;g++){let P=Array.isArray(T[g])?T[g]:[T[g]];for(let z=0,N=P.length;z<N;z++){let H=P[z],Q=Array.isArray(H.value)?H.value:[H.value],C=Array.isArray(T[g])||Array.isArray(H.value),Y=b;for(let B=0,ae=Q.length;B<ae;B++){let V=Q[B],j=y(V,C),ie=b%E,be=ie%j.boundary,Z=ie+be;if(b+=be,Z!==0&&E-Z<j.storage)b+=E-Z;if(B===0)Y=b;b+=j.storage}let K=H.type==="int"?Int32Array:H.type==="uint"?Uint32Array:Float32Array;H.__data=new K((b-Y)/Float32Array.BYTES_PER_ELEMENT),H.__offset=Y}}let A=b%E;if(A>0)b+=E-A;return M.__size=b,M.__cache={},this}function y(M,T){let b={boundary:0,storage:0};if(typeof M==="number"||typeof M==="boolean")b.boundary=4,b.storage=4;else if(M.isVector2)b.boundary=8,b.storage=8;else if(M.isVector3||M.isColor)b.boundary=16,b.storage=12;else if(M.isVector4)b.boundary=16,b.storage=16;else if(M.isMatrix3)b.boundary=16,b.storage=48;else if(M.isMatrix4)b.boundary=16,b.storage=64;else if(M.isTexture)Te("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(M))b.boundary=16,b.storage=M.byteLength;else Te("WebGLRenderer: Unsupported uniform value type.",M);if(T===!0)b.boundary=16,b.storage=Math.ceil(b.storage/16)*16;return b}function p(M){let T=M.target;T.removeEventListener("dispose",p),e.deleteBuffer(s[T.id]),delete s[T.id],delete r[T.id]}function m(){for(let M in s)e.deleteBuffer(s[M]);s={},r={}}return{bind:a,update:o,dispose:m}}function xv(){if(Ln===null)Ln=new Wi(_v,16,16,zi,Cn),Ln.name="DFG_LUT",Ln.minFilter=mt,Ln.magFilter=mt,Ln.wrapS=_s,Ln.wrapT=_s,Ln.generateMipmaps=!1,Ln.needsUpdate=!0;return Ln}class fc{constructor(e={}){let{canvas:t=nd(),context:n=null,depth:i=!0,stencil:s=!1,alpha:r=!1,antialias:a=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:u=!1,outputBufferType:d=Sn}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=r;let _=d,y=new Set([tl,el,Qo]),p=new Set([Sn,ui,er,ki,Jo,jo]),m=new Uint32Array(4),M=new Int32Array(4),T={textures:[],min:[],max:[],resolution:[]},b=null,E=null,A=[],g=[],S=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Rn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let P=this,z=!1,N=null,H=null,Q=null,C=null;this._outputColorSpace=ln;let Y=0,K=0,B=null,ae=-1,V=null,j=new tt,ie=new tt,be=null,Z=new Ee(0),ne=0,{width:ye,height:Ce}=t,Ie=1,Se=null,je=null,We=new tt(0,0,ye,Ce),Oe=new tt(0,0,ye,Ce),lt=!1,qe=new Fi,dt=new va,gt=!1,kt=!1,Zt=new Fe,_t=new D,Rt=new tt,zt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ht=!1;function dn(){return B===null?Ie:1}let L=n;function fn(v,I){return t.getContext(v,I)}let Qe,Mt,de,rt,Pe,De,Ct,w,x,U,ee,J,re,ce,G,q,oe,R,X,W,te,se,ue;try{let v={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t)t.setAttribute("data-engine",`three.js r${cu}`);if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",Re,!1),t.addEventListener("webglcontextcreationerror",Be,!1),L===null){if(L=fn("webgl2",v),L===null)if(fn("webgl2"))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}Ae()}catch(v){throw t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Be,!1),Le("WebGLRenderer: "+v.message),v}function Ae(){if(Qe=new C0(L),Qe.init(),te=new uv(L,Qe),Mt=new x0(L,Qe,e,te),de=new cv(L,Qe),Mt.reversedDepthBuffer&&u)de.buffers.depth.setReversed(!0);H=L.createFramebuffer(),Q=L.createFramebuffer(),C=L.createFramebuffer(),rt=new L0(L),Pe=new Zx,De=new hv(L,Qe,de,Pe,Mt,te,rt),Ct=new R0(P),w=new Dm(L),se=new g0(L,w),x=new I0(L,w,rt,se),U=new D0(L,x,w,se,rt),R=new N0(L,Mt,De),G=new v0(Pe),ee=new Yx(P,Ct,Qe,Mt,se,G),J=new mv(P,Pe),re=new Jx,ce=new iv(Qe),oe=new m0(P,Ct,de,U,f,o),q=new lv(P,U,Mt),ue=new gv(L,rt,Mt,de),X=new _0(L,Qe,rt),W=new P0(L,Qe,rt),rt.programs=ee.programs,P.capabilities=Mt,P.extensions=Qe,P.properties=Pe,P.renderLists=re,P.shadowMap=q,P.state=de,P.info=rt}if(_!==Sn)S=new F0(_,t.width,t.height,a,i,s);let we=new Qd(P,L);this.xr=we,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let v=Qe.get("WEBGL_lose_context");if(v)v.loseContext()},this.forceContextRestore=function(){let v=Qe.get("WEBGL_lose_context");if(v)v.restoreContext()},this.getPixelRatio=function(){return Ie},this.setPixelRatio=function(v){if(v===void 0)return;Ie=v,this.setSize(ye,Ce,!1)},this.getSize=function(v){return v.set(ye,Ce)},this.setSize=function(v,I,k=!0){if(we.isPresenting){Te("WebGLRenderer: Can't change size while VR device is presenting.");return}if(ye=v,Ce=I,t.width=Math.floor(v*Ie),t.height=Math.floor(I*Ie),k===!0)t.style.width=v+"px",t.style.height=I+"px";if(S!==null)S.setSize(t.width,t.height);this.setViewport(0,0,v,I)},this.getDrawingBufferSize=function(v){return v.set(ye*Ie,Ce*Ie).floor()},this.setDrawingBufferSize=function(v,I,k){ye=v,Ce=I,Ie=k,t.width=Math.floor(v*k),t.height=Math.floor(I*k),this.setViewport(0,0,v,I)},this.setEffects=function(v){if(_===Sn){Le("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let I=0;I<v.length;I++)if(v[I].isOutputPass===!0){Te("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}S.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(j)},this.getViewport=function(v){return v.copy(We)},this.setViewport=function(v,I,k,F){if(v.isVector4)We.set(v.x,v.y,v.z,v.w);else We.set(v,I,k,F);de.viewport(j.copy(We).multiplyScalar(dn()).round())},this.getScissor=function(v){return v.copy(Oe)},this.setScissor=function(v,I,k,F){if(v.isVector4)Oe.set(v.x,v.y,v.z,v.w);else Oe.set(v,I,k,F);de.scissor(ie.copy(Oe).multiplyScalar(dn()).round())},this.getScissorTest=function(){return lt},this.setScissorTest=function(v){de.setScissorTest(lt=v)},this.setOpaqueSort=function(v){Se=v},this.setTransparentSort=function(v){je=v},this.getClearColor=function(v){return v.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor(...arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha(...arguments)},this.clear=function(v=!0,I=!0,k=!0){let F=0;if(v){let O=!1;if(B!==null){let he=B.texture.format;O=y.has(he)}if(O){let he=B.texture.type,_e=p.has(he),le=oe.getClearColor(),ge=oe.getClearAlpha(),{r:Me,g:Ue,b:Xe}=le;if(_e)m[0]=Me,m[1]=Ue,m[2]=Xe,m[3]=ge,L.clearBufferuiv(L.COLOR,0,m);else M[0]=Me,M[1]=Ue,M[2]=Xe,M[3]=ge,L.clearBufferiv(L.COLOR,0,M)}else F|=L.COLOR_BUFFER_BIT}if(I)F|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(k)F|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(F!==0)L.clear(F)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),N=v},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Be,!1),oe.dispose(),re.dispose(),ce.dispose(),De.dispose(),Pe.dispose(),Ct.dispose(),U.dispose(),x.dispose(),se.dispose(),ue.dispose(),ee.dispose(),we.dispose(),we.removeEventListener("sessionstart",Dc),we.removeEventListener("sessionend",Uc),bi.stop()};function pe(v){v.preventDefault(),Zs("WebGLRenderer: Context Lost."),z=!0}function Re(){Zs("WebGLRenderer: Context Restored."),z=!1;let v=rt.autoReset,I=q.enabled,k=q.autoUpdate,F=q.needsUpdate,O=q.type;Ae(),rt.autoReset=v,q.enabled=I,q.autoUpdate=k,q.needsUpdate=F,q.type=O}function Be(v){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function me(v){let I=v.target;I.removeEventListener("dispose",me),et(I)}function et(v){wt(v),Pe.remove(v)}function wt(v){let I=Pe.get(v).programs;if(I!==void 0){if(I.forEach(function(k){ee.releaseProgram(k)}),v.isShaderMaterial)ee.releaseShaderCache(v)}}this.renderBufferDirect=function(v,I,k,F,O,he){if(I===null)I=zt;let _e=O.isMesh&&O.matrixWorld.determinantAffine()<0,le=Zf(v,I,k,F,O);de.setMaterial(F,_e);let ge=k.index,Me=1;if(F.wireframe===!0){if(ge=x.getWireframeAttribute(k),ge===void 0)return;Me=2}let Ue=k.drawRange,Xe=k.attributes.position,xe=Ue.start*Me,$e=(Ue.start+Ue.count)*Me;if(he!==null)xe=Math.max(xe,he.start*Me),$e=Math.min($e,(he.start+he.count)*Me);if(ge!==null)xe=Math.max(xe,0),$e=Math.min($e,ge.count);else if(Xe!==void 0&&Xe!==null)xe=Math.max(xe,0),$e=Math.min($e,Xe.count);let xt=$e-xe;if(xt<0||xt===1/0)return;se.setup(O,F,le,k,ge);let at,nt=X;if(ge!==null)at=w.get(ge),nt=W,nt.setIndex(at);if(O.isMesh)if(F.wireframe===!0)de.setLineWidth(F.wireframeLinewidth*dn()),nt.setMode(L.LINES);else nt.setMode(L.TRIANGLES);else if(O.isLine){let It=F.linewidth;if(It===void 0)It=1;if(de.setLineWidth(It*dn()),O.isLineSegments)nt.setMode(L.LINES);else if(O.isLineLoop)nt.setMode(L.LINE_LOOP);else nt.setMode(L.LINE_STRIP)}else if(O.isPoints)nt.setMode(L.POINTS);else if(O.isSprite)nt.setMode(L.TRIANGLES);if(O.isBatchedMesh)if(!Qe.get("WEBGL_multi_draw")){let{_multiDrawStarts:It,_multiDrawCounts:ve,_multiDrawCount:Ot}=O,Ke=ge?w.get(ge).bytesPerElement:1,Mi=Pe.get(F).currentProgram.getUniforms();for(let Pt=0;Pt<Ot;Pt++)Mi.setValue(L,"_gl_DrawID",Pt),nt.render(It[Pt]/Ke,ve[Pt])}else nt.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else if(O.isInstancedMesh)nt.renderInstances(xe,xt,O.count);else if(k.isInstancedBufferGeometry){let It=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,ve=Math.min(k.instanceCount,It);nt.renderInstances(xe,xt,ve)}else nt.render(xe,xt)};function Un(v,I,k,F){if(N!==null&&v.isNodeMaterial)N.setObject(F,v);if(gt===!0)G.setState(v,k,!1);if(v.transparent===!0&&v.side===$t&&v.forceSinglePass===!1)v.side=Xt,v.needsUpdate=!0,Is(v,I,F),v.side=ci,v.needsUpdate=!0,Is(v,I,F),v.side=$t;else Is(v,I,F)}this.compile=function(v,I,k=null){if(k===null)k=v;if(N!==null)N.renderStart(v,I,k);if(E=ce.get(k),E.init(I),g.push(E),k.traverseVisible(function(O){if(O.isLight&&O.layers.test(I.layers)){if(E.pushLight(O),O.castShadow)E.pushShadow(O)}}),v!==k)v.traverseVisible(function(O){if(O.isLight&&O.layers.test(I.layers)){if(E.pushLight(O),O.castShadow)E.pushShadow(O)}});if(E.setupLights(),N!==null)N.updateLights(E.state.lightsArray);if(kt=this.localClippingEnabled,gt=G.init(this.clippingPlanes,kt),gt===!0)G.setGlobalState(this.clippingPlanes,I);if(N!==null)q.render(E.state.shadowsArray,k,I);let F=new Set;if(v.traverse(function(O){if(!(O.isMesh||O.isPoints||O.isLine||O.isSprite))return;let he=O.material;if(he)if(Array.isArray(he))for(let _e=0;_e<he.length;_e++){let le=he[_e];Un(le,k,I,O),F.add(le)}else Un(he,k,I,O),F.add(he)}),E=g.pop(),N!==null)N.renderEnd();return F},this.compileAsync=function(v,I,k=null){let F=this.compile(v,I,k);return new Promise((O)=>{function he(){if(F.forEach(function(_e){let ge=Pe.get(_e).currentProgram;if(ge===void 0||ge.isReady())F.delete(_e)}),F.size===0){O(v);return}setTimeout(he,10)}if(Qe.get("KHR_parallel_shader_compile")!==null)he();else setTimeout(he,10)})};let Ha=null;function qf(v){if(Ha)Ha(v)}function Dc(){bi.stop()}function Uc(){bi.start()}let bi=new Od;if(bi.setAnimationLoop(qf),typeof self<"u")bi.setContext(self);this.setAnimationLoop=function(v){Ha=v,we.setAnimationLoop(v),v===null?bi.stop():bi.start()},we.addEventListener("sessionstart",Dc),we.addEventListener("sessionend",Uc),this.render=function(v,I){if(I!==void 0&&I.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;if(N!==null)N.renderStart(v,I);let k=we.enabled===!0&&we.isPresenting===!0,F=S!==null&&(B===null||k)&&S.begin(P,B);if(v.matrixWorldAutoUpdate===!0)v.updateMatrixWorld();if(I.parent===null&&I.matrixWorldAutoUpdate===!0)I.updateMatrixWorld();if(we.enabled===!0&&we.isPresenting===!0&&(S===null||S.isCompositing()===!1)){if(we.cameraAutoUpdate===!0)we.updateCamera(I);I=we.getCamera()}if(v.isScene===!0)v.onBeforeRender(P,v,I,B);if(E=ce.get(v,g.length),E.init(I),E.state.textureUnits=De.getTextureUnits(),g.push(E),Zt.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),I.isArrayCamera)dt.setFromArrayCamera(I);else qe.setFromProjectionMatrix(Zt,zl,I.reversedDepth);if(kt=this.localClippingEnabled,gt=G.init(this.clippingPlanes,kt),b=re.get(v,A.length),b.init(),A.push(b),this.info.render.frame++,we.enabled===!0&&we.isPresenting===!0){let _e=P.xr.getDepthSensingMesh();if(_e!==null)Ga(_e,I,-1/0,P.sortObjects)}if(Ga(v,I,0,P.sortObjects),b.finish(),N!==null)N.updateLights(E.state.lightsArray);if(P.sortObjects===!0)b.sort(Se,je);if(Ht=we.enabled===!1||we.isPresenting===!1||we.hasDepthSensing()===!1,Ht)oe.addToRenderList(b,v);if(this.info.autoReset===!0)this.info.reset();if(gt===!0)G.beginShadows();let O=E.state.shadowsArray;if(q.render(O,v,I),gt===!0)G.endShadows();if((F&&S.hasRenderPass())===!1){let _e=b.opaque,le=b.transmissive;if(E.setupLights(),I.isArrayCamera){let ge=I.cameras;if(le.length>0)for(let Me=0,Ue=ge.length;Me<Ue;Me++){let Xe=ge[Me];Oc(_e,le,v,Xe)}if(Ht)oe.render(v);for(let Me=0,Ue=ge.length;Me<Ue;Me++){let Xe=ge[Me];Fc(b,v,Xe,Xe.viewport)}}else{if(le.length>0)Oc(_e,le,v,I);if(Ht)oe.render(v);Fc(b,v,I)}}if(B!==null&&K===0)De.updateMultisampleRenderTarget(B),De.updateRenderTargetMipmap(B);if(F)S.end(P);if(v.isScene===!0)v.onAfterRender(P,v,I);if(se.resetDefaultState(),ae=-1,V=null,g.pop(),g.length>0){if(E=g[g.length-1],De.setTextureUnits(E.state.textureUnits),gt===!0)G.setGlobalState(P.clippingPlanes,E.state.camera)}else E=null;if(A.pop(),A.length>0)b=A[A.length-1];else b=null;if(N!==null)N.renderEnd()};function Ga(v,I,k,F){if(v.visible===!1)return;if(v.layers.test(I.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD){if(v.autoUpdate===!0)v.update(I)}else if(v.isLight){if(E.pushLight(v),v.castShadow)E.pushShadow(v)}else if(v.isSprite){let _e=I.isArrayCamera?dt:qe;if(!v.frustumCulled||v.intersectsFrustum(_e)){if(F)Rt.setFromMatrixPosition(v.matrixWorld).applyMatrix4(Zt);let le=U.update(v),ge=v.material;if(ge.visible)b.push(v,le,ge,k,Rt.z,null,I)}}else if(v.isMesh||v.isLine||v.isPoints){let _e=I.isArrayCamera?dt:qe;if(!v.frustumCulled||v.intersectsFrustum(_e)){let le=U.update(v),ge=v.material;if(F){if(v.boundingSphere!==void 0){if(v.boundingSphere===null)v.computeBoundingSphere();Rt.copy(v.boundingSphere.center)}else{if(le.boundingSphere===null)le.computeBoundingSphere();Rt.copy(le.boundingSphere.center)}Rt.applyMatrix4(v.matrixWorld).applyMatrix4(Zt)}if(Array.isArray(ge)){let Me=le.groups;for(let Ue=0,Xe=Me.length;Ue<Xe;Ue++){let xe=Me[Ue],$e=ge[xe.materialIndex];if($e&&$e.visible)b.push(v,le,$e,k,Rt.z,xe,I)}}else if(ge.visible)b.push(v,le,ge,k,Rt.z,null,I)}}}let he=v.children;for(let _e=0,le=he.length;_e<le;_e++)Ga(he[_e],I,k,F)}function Fc(v,I,k,F){let{opaque:O,transmissive:he,transparent:_e}=v;if(E.setupLightsView(k),gt===!0)G.setGlobalState(P.clippingPlanes,k);if(F)de.viewport(j.copy(F));if(O.length>0)vr(O,I,k);if(he.length>0)vr(he,I,k);if(_e.length>0)vr(_e,I,k);de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function Oc(v,I,k,F){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[F.id]===void 0){let xe=Qe.has("EXT_color_buffer_half_float")||Qe.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[F.id]=new hn(1,1,{generateMipmaps:!0,type:xe?Cn:Sn,minFilter:tn,samples:Math.max(4,Mt.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:He.workingColorSpace})}let he=E.state.transmissionRenderTarget[F.id],_e=F.viewport||j;he.setSize(_e.z*P.transmissionResolutionScale,_e.w*P.transmissionResolutionScale);let le=P.getRenderTarget(),ge=P.getActiveCubeFace(),Me=P.getActiveMipmapLevel();if(P.setRenderTarget(he),P.getClearColor(Z),ne=P.getClearAlpha(),ne<1)P.setClearColor(16777215,0.5);if(P.clear(),Ht)oe.render(k);let Ue=P.toneMapping;P.toneMapping=Rn;let Xe=F.viewport;if(F.viewport!==void 0)F.viewport=void 0;if(E.setupLightsView(F),gt===!0)G.setGlobalState(P.clippingPlanes,F);if(vr(v,k,F),De.updateMultisampleRenderTarget(he),De.updateRenderTargetMipmap(he),Qe.has("WEBGL_multisampled_render_to_texture")===!1){let xe=!1;for(let $e=0,xt=I.length;$e<xt;$e++){let at=I[$e],{object:nt,geometry:It,material:ve,group:Ot}=at;if(ve.side===$t&&nt.layers.test(F.layers)){let Ke=ve.side;ve.side=Xt,ve.needsUpdate=!0,Bc(nt,k,F,It,ve,Ot),ve.side=Ke,ve.needsUpdate=!0,xe=!0}}if(xe===!0)De.updateMultisampleRenderTarget(he),De.updateRenderTargetMipmap(he)}if(P.setRenderTarget(le,ge,Me),P.setClearColor(Z,ne),Xe!==void 0)F.viewport=Xe;P.toneMapping=Ue}function vr(v,I,k){let F=I.isScene===!0?I.overrideMaterial:null;for(let O=0,he=v.length;O<he;O++){let _e=v[O],{object:le,geometry:ge,group:Me}=_e,Ue=_e.material;if(Ue.allowOverride===!0&&F!==null)Ue=F;if(le.layers.test(k.layers))Bc(le,I,k,ge,Ue,Me)}}function Bc(v,I,k,F,O,he){if(N!==null&&O.isNodeMaterial)N.setObject(v,O);if(v.onBeforeRender(P,I,k,F,O,he),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),O.onBeforeRender(P,I,k,F,v,he),O.transparent===!0&&O.side===$t&&O.forceSinglePass===!1)O.side=Xt,O.needsUpdate=!0,P.renderBufferDirect(k,I,F,O,v,he),O.side=ci,O.needsUpdate=!0,P.renderBufferDirect(k,I,F,O,v,he),O.side=$t;else P.renderBufferDirect(k,I,F,O,v,he);v.onAfterRender(P,I,k,F,O,he)}function kc(v){let I=0;for(let k of v)if(k.texture!==null)I++;return I}function Is(v,I,k){if(I.isScene!==!0)I=zt;let F=Pe.get(v),O=E.state.lights,he=E.state.shadowsArray,_e=O.state.version,le=ee.getParameters(v,O.state,he,I,k,E.state.lightProbeGridArray),ge=ee.getProgramCacheKey(le),Me=F.programs;F.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?I.environment:null,F.fog=I.fog;let Ue=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;if(F.envMap=Ct.get(v.envMap||F.environment,Ue),F.envMapRotation=F.environment!==null&&v.envMap===null?I.environmentRotation:v.envMapRotation,Me===void 0)v.addEventListener("dispose",me),Me=new Map,F.programs=Me,F.programVariants=new Map;let Xe=Me.get(ge);if(Xe!==void 0){if(F.currentProgram===Xe&&F.lightsStateVersion===_e)return Hc(v,le),Xe}else{if(le.uniforms=ee.getUniforms(v),N!==null&&v.isNodeMaterial)N.build(v,k,le);v.onBeforeCompile(le,P),Xe=ee.acquireProgram(le,ge),Me.set(ge,Xe),F.uniforms=le.uniforms}let xe=F.uniforms;if(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)xe.clippingPlanes=G.uniform;if(Hc(v,le),F.needsLights=Jf(v),F.lightsStateVersion=_e,F.needsLights)xe.ambientLightColor.value=O.state.ambient,xe.lightProbe.value=O.state.probe,xe.sunLights.value=O.state.sun,xe.sunLightShadows.value=O.state.sunShadow,xe.directionalLights.value=O.state.directional,xe.directionalLightShadows.value=O.state.directionalShadow,xe.spotLights.value=O.state.spot,xe.spotLightShadows.value=O.state.spotShadow,xe.rectAreaLights.value=O.state.rectArea,xe.ltc_1.value=O.state.rectAreaLTC1,xe.ltc_2.value=O.state.rectAreaLTC2,xe.pointLights.value=O.state.point,xe.pointLightShadows.value=O.state.pointShadow,xe.hemisphereLights.value=O.state.hemi,xe.sunShadowMatrix.value=O.state.sunShadowMatrix,xe.sunShadowCascade.value=O.state.sunShadowCascade,xe.directionalShadowMatrix.value=O.state.directionalShadowMatrix,xe.spotLightMatrix.value=O.state.spotLightMatrix,xe.spotLightMap.value=O.state.spotLightMap,xe.pointShadowMatrix.value=O.state.pointShadowMatrix;return F.numLightProbeGrids=kc(E.state.lightProbeGridArray),F.currentProgram=Xe,F.uniformsList=null,Xe}function Yf(v,I,k,F,O){let he=Pe.get(v),_e=he.currentProgram.id+","+F+","+O,le=he.programVariants.get(_e);if(le===void 0)le=Is(v,I,k),he.programVariants.set(_e,le);else he.currentProgram=le,he.uniformsList=null,he.outputColorSpace=F,he.toneMapping=O;return le}function zc(v){if(v.uniformsList===null){let I=v.currentProgram.getUniforms();v.uniformsList=gr.seqWithValue(I.seq,v.uniforms)}return v.uniformsList}function Hc(v,I){let k=Pe.get(v);k.outputColorSpace=I.outputColorSpace,k.batching=I.batching,k.batchingColor=I.batchingColor,k.instancing=I.instancing,k.instancingColor=I.instancingColor,k.instancingMorph=I.instancingMorph,k.skinning=I.skinning,k.morphTargets=I.morphTargets,k.morphNormals=I.morphNormals,k.morphColors=I.morphColors,k.morphTargetsCount=I.morphTargetsCount,k.numClippingPlanes=I.numClippingPlanes,k.numIntersection=I.numClipIntersection,k.vertexAlphas=I.vertexAlphas,k.vertexTangents=I.vertexTangents,k.toneMapping=I.toneMapping}function Zf(v,I,k,F,O){if(I.isScene!==!0)I=zt;De.resetTextureUnits();let he=I.fog,_e=F.isMeshStandardMaterial||F.isMeshLambertMaterial||F.isMeshPhongMaterial?I.environment:null,le=B===null?P.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:He.workingColorSpace,ge=F.isMeshStandardMaterial||F.isMeshLambertMaterial&&!F.envMap||F.isMeshPhongMaterial&&!F.envMap,Me=Ct.get(F.envMap||_e,ge),Ue=F.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Xe=!!k.attributes.tangent&&(!!F.normalMap||F.anisotropy>0),xe=!!k.morphAttributes.position,$e=!!k.morphAttributes.normal,xt=!!k.morphAttributes.color,at=Rn;if(F.toneMapped){if(B===null||B.isXRRenderTarget===!0)at=P.toneMapping}let nt=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,It=nt!==void 0?nt.length:0,ve=Pe.get(F),Ot=E.state.lights;if(gt===!0){if(kt===!0||v!==V){let ht=v===V&&F.id===ae;G.setState(F,v,ht)}}let Ke=!1,Mi=!1;if(F.version===ve.__version){if(ve.needsLights&&ve.lightsStateVersion!==Ot.state.version)Ke=!0;else if(O.isBatchedMesh&&ve.batching===!1)Ke=!0;else if(!O.isBatchedMesh&&ve.batching===!0)Ke=!0;else if(O.isBatchedMesh&&ve.batchingColor===!0&&O._colorsTexture===null)Ke=!0;else if(O.isBatchedMesh&&ve.batchingColor===!1&&O._colorsTexture!==null)Ke=!0;else if(O.isInstancedMesh&&ve.instancing===!1)Ke=!0;else if(!O.isInstancedMesh&&ve.instancing===!0)Ke=!0;else if(O.isSkinnedMesh&&ve.skinning===!1)Ke=!0;else if(!O.isSkinnedMesh&&ve.skinning===!0)Ke=!0;else if(O.isInstancedMesh&&ve.instancingColor===!0&&O.instanceColor===null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingColor===!1&&O.instanceColor!==null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingMorph===!0&&O.morphTexture===null)Ke=!0;else if(O.isInstancedMesh&&ve.instancingMorph===!1&&O.morphTexture!==null)Ke=!0;else if(ve.envMap!==Me)Ke=!0;else if(F.fog===!0&&ve.fog!==he)Ke=!0;else if(ve.numClippingPlanes!==void 0&&(ve.numClippingPlanes!==G.numPlanes||ve.numIntersection!==G.numIntersection))Ke=!0;else if(ve.vertexAlphas!==Ue)Ke=!0;else if(ve.vertexTangents!==Xe)Ke=!0;else if(ve.morphTargets!==xe)Ke=!0;else if(ve.morphNormals!==$e)Ke=!0;else if(ve.morphColors!==xt)Ke=!0;else if(ve.morphTargetsCount!==It)Ke=!0;else if(ve.numLightProbeGrids!==kc(E.state.lightProbeGridArray))Ke=!0;else if(ve.outputColorSpace!==le||ve.toneMapping!==at)Mi=!0}else Ke=!0,ve.__version=F.version;let Pt=ve.currentProgram;if(Ke===!0||Mi===!0){if(Pt=Mi===!0?Yf(F,I,O,le,at):Is(F,I,O),N&&F.isNodeMaterial)N.onUpdateProgram(F,Pt,ve)}let yr=!1,Qn=!1,wi=!1,Ye=Pt.getUniforms(),At=ve.uniforms;if(de.useProgram(Pt.program))yr=!0,Qn=!0,wi=!0;if(F.id!==ae)ae=F.id,Qn=!0;if(yr||V!==v){if(de.buffers.depth.getReversed()&&v.reversedDepth!==!0)v._reversedDepth=!0,v.updateProjectionMatrix();Ye.setValue(L,"projectionMatrix",v.projectionMatrix),Ye.setValue(L,"viewMatrix",v.matrixWorldInverse);let Tt=Ye.map.cameraPosition;if(Tt!==void 0)Tt.setValue(L,_t.setFromMatrixPosition(v.matrixWorld));if(Mt.logarithmicDepthBuffer)Ye.setValue(L,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2));if(F.isMeshPhongMaterial||F.isMeshToonMaterial||F.isMeshLambertMaterial||F.isMeshBasicMaterial||F.isMeshStandardMaterial||F.isShaderMaterial)Ye.setValue(L,"isOrthographic",v.isOrthographicCamera===!0);if(V!==v)V=v,Qn=!0,wi=!0}if(ve.needsLights){if(Ot.state.sunShadowMap.length>0)Ye.setValue(L,"sunShadowMap",Ot.state.sunShadowMap,De);if(Ot.state.directionalShadowMap.length>0)Ye.setValue(L,"directionalShadowMap",Ot.state.directionalShadowMap,De);if(Ot.state.spotShadowMap.length>0)Ye.setValue(L,"spotShadowMap",Ot.state.spotShadowMap,De);if(Ot.state.pointShadowMap.length>0)Ye.setValue(L,"pointShadowMap",Ot.state.pointShadowMap,De)}if(O.isSkinnedMesh){Ye.setOptional(L,O,"bindMatrix"),Ye.setOptional(L,O,"bindMatrixInverse");let ht=O.skeleton;if(ht){if(ht.boneTexture===null)ht.computeBoneTexture();Ye.setValue(L,"boneTexture",ht.boneTexture,De)}}if(O.isBatchedMesh){if(Ye.setOptional(L,O,"batchingTexture"),Ye.setValue(L,"batchingTexture",O._matricesTexture,De),Ye.setOptional(L,O,"batchingIdTexture"),Ye.setValue(L,"batchingIdTexture",O._indirectTexture,De),Ye.setOptional(L,O,"batchingColorTexture"),O._colorsTexture!==null)Ye.setValue(L,"batchingColorTexture",O._colorsTexture,De)}let pn=k.morphAttributes;if(pn.position!==void 0||pn.normal!==void 0||pn.color!==void 0)R.update(O,k,Pt);if(Qn||ve.receiveShadow!==O.receiveShadow)ve.receiveShadow=O.receiveShadow,Ye.setValue(L,"receiveShadow",O.receiveShadow);if((F.isMeshStandardMaterial||F.isMeshLambertMaterial||F.isMeshPhongMaterial)&&F.envMap===null&&I.environment!==null)At.envMapIntensity.value=I.environmentIntensity;if(At.dfgLUT!==void 0)At.dfgLUT.value=xv();if(Qn){if(Ye.setValue(L,"toneMappingExposure",P.toneMappingExposure),ve.needsLights)Kf(At,wi);if(he&&F.fog===!0)J.refreshFogUniforms(At,he);if(J.refreshMaterialUniforms(At,F,Ie,Ce,E.state.transmissionRenderTarget[v.id]),ve.needsLights&&ve.numLightProbeGrids>0){let ht=T,Tt=0;for(let Fn of E.state.lightProbeGridArray){if(Fn.texture===null)continue;ht.textures[Tt]=Fn.texture,ht.min[Tt]=Fn.boundingBox.min,ht.max[Tt]=Fn.boundingBox.max,ht.resolution[Tt]=Fn.resolution,Tt++}for(let Fn in ht)ht[Fn].length=Tt;At.probesSH.value=ht.textures,At.probesMin.value=ht.min,At.probesMax.value=ht.max,At.probesResolution.value=ht.resolution}gr.upload(L,zc(ve),At,De)}if(F.isShaderMaterial&&F.uniformsNeedUpdate===!0)gr.upload(L,zc(ve),At,De),F.uniformsNeedUpdate=!1;if(F.isSpriteMaterial)Ye.setValue(L,"center",O.center);if(Ye.setValue(L,"modelViewMatrix",O.modelViewMatrix),Ye.setValue(L,"normalMatrix",O.normalMatrix),Ye.setValue(L,"modelMatrix",O.matrixWorld),F.uniformsGroups!==void 0){let ht=F.uniformsGroups;for(let Tt=0,Fn=ht.length;Tt<Fn;Tt++){let Wc=ht[Tt];ue.update(Wc,Pt),ue.bind(Wc,Pt)}}return Pt}function Kf(v,I){v.ambientLightColor.needsUpdate=I,v.lightProbe.needsUpdate=I,v.sunLights.needsUpdate=I,v.sunLightShadows.needsUpdate=I,v.directionalLights.needsUpdate=I,v.directionalLightShadows.needsUpdate=I,v.pointLights.needsUpdate=I,v.pointLightShadows.needsUpdate=I,v.spotLights.needsUpdate=I,v.spotLightShadows.needsUpdate=I,v.rectAreaLights.needsUpdate=I,v.hemisphereLights.needsUpdate=I}function Jf(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return Y},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(v,I,k){let F=Pe.get(v);if(F.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,F.__autoAllocateDepthBuffer===!1)F.__useRenderToTexture=!1;Pe.get(v.texture).__webglTexture=I,Pe.get(v.depthTexture).__webglTexture=F.__autoAllocateDepthBuffer?void 0:k,F.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,I){let k=Pe.get(v);k.__webglFramebuffer=I,k.__useDefaultFramebuffer=I===void 0},this.setRenderTarget=function(v,I=0,k=0){B=v,Y=I,K=k;let F=null,O=!1,he=!1;if(v){let le=Pe.get(v);if(le.__useDefaultFramebuffer!==void 0){de.bindFramebuffer(L.FRAMEBUFFER,le.__webglFramebuffer),j.copy(v.viewport),ie.copy(v.scissor),be=v.scissorTest,de.viewport(j),de.scissor(ie),de.setScissorTest(be),ae=-1;return}else if(le.__webglFramebuffer===void 0)De.setupRenderTarget(v);else if(le.__hasExternalTextures)De.rebindTextures(v,Pe.get(v.texture).__webglTexture,Pe.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Ue=v.depthTexture;if(le.__boundDepthTexture!==Ue){if(Ue!==null&&Pe.has(Ue)&&(v.width!==Ue.image.width||v.height!==Ue.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");De.setupDepthRenderbuffer(v)}}let ge=v.texture;if(ge.isData3DTexture||ge.isDataArrayTexture||ge.isCompressedArrayTexture)he=!0;let Me=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget){if(Array.isArray(Me[I]))F=Me[I][k];else F=Me[I];O=!0}else if(v.samples>0&&De.useMultisampledRTT(v)===!1)F=Pe.get(v).__webglMultisampledFramebuffer;else if(Array.isArray(Me))F=Me[k];else F=Me;j.copy(v.viewport),ie.copy(v.scissor),be=v.scissorTest}else j.copy(We).multiplyScalar(Ie).floor(),ie.copy(Oe).multiplyScalar(Ie).floor(),be=lt;if(k!==0)F=H;if(de.bindFramebuffer(L.FRAMEBUFFER,F))de.drawBuffers(v,F);if(de.viewport(j),de.scissor(ie),de.setScissorTest(be),O){let le=Pe.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+I,le.__webglTexture,k)}else if(he){let le=I;for(let ge=0;ge<v.textures.length;ge++){let Me=Pe.get(v.textures[ge]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+ge,Me.__webglTexture,k,le)}}else if(v!==null&&k!==0){let le=Pe.get(v.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,le.__webglTexture,k)}ae=-1};function Gc(v){let I=Pe.get(v);if(I.__readFormat!==v.format||I.__readType!==v.type)I.__readFormat=v.format,I.__readType=v.type,I.__formatReadable=Mt.textureFormatReadable(v.format),I.__typeReadable=Mt.textureTypeReadable(v.type);return I}if(this.readRenderTargetPixels=function(v,I,k,F,O,he,_e,le=0){if(!(v&&v.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ge=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0){if(ge=ge[_e],Array.isArray(ge))ge=ge[0]}if(ge){de.bindFramebuffer(L.FRAMEBUFFER,ge);try{let Me=v.textures[le],{format:Ue,type:Xe}=Me;if(v.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+le);let xe=Gc(Me);if(xe.__formatReadable===!1){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(xe.__typeReadable===!1){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(I>=0&&I<=v.width-F&&(k>=0&&k<=v.height-O))L.readPixels(I,k,F,O,te.convert(Ue),te.convert(Xe),he)}finally{let Me=B!==null?Pe.get(B).__webglFramebuffer:null;de.bindFramebuffer(L.FRAMEBUFFER,Me)}}},this.readRenderTargetPixelsAsync=async function(v,I,k,F,O,he,_e,le=0){if(!(v&&v.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ge=Pe.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0){if(ge=ge[_e],Array.isArray(ge))ge=ge[0]}if(ge)if(I>=0&&I<=v.width-F&&(k>=0&&k<=v.height-O)){de.bindFramebuffer(L.FRAMEBUFFER,ge);let Me=v.textures[le],{format:Ue,type:Xe}=Me;if(v.textures.length>1)L.readBuffer(L.COLOR_ATTACHMENT0+le);let xe=Gc(Me);if(xe.__formatReadable===!1)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(xe.__typeReadable===!1)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let $e=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,$e),L.bufferData(L.PIXEL_PACK_BUFFER,he.byteLength,L.STREAM_READ),L.readPixels(I,k,F,O,te.convert(Ue),te.convert(Xe),0),L.bindBuffer(L.PIXEL_PACK_BUFFER,null);let xt=B!==null?Pe.get(B).__webglFramebuffer:null;de.bindFramebuffer(L.FRAMEBUFFER,xt);let at=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await sd(L,at,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,$e),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,he),L.bindBuffer(L.PIXEL_PACK_BUFFER,null),L.deleteBuffer($e),L.deleteSync(at),he}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,I=null,k=0){let F=Math.pow(2,-k),O=Math.floor(v.image.width*F),he=Math.floor(v.image.height*F),_e=I!==null?I.x:0,le=I!==null?I.y:0;De.setTexture2D(v,0),L.copyTexSubImage2D(L.TEXTURE_2D,k,0,0,_e,le,O,he),de.unbindTexture()},this.copyTextureToTexture=function(v,I,k=null,F=null,O=0,he=0){let _e,le,ge,Me,Ue,Xe,xe,$e,xt,at=v.isCompressedTexture?v.mipmaps[he]:v.image;if(k!==null)_e=k.max.x-k.min.x,le=k.max.y-k.min.y,ge=k.isBox3?k.max.z-k.min.z:1,Me=k.min.x,Ue=k.min.y,Xe=k.isBox3?k.min.z:0;else{let Ye=Math.pow(2,-O);if(_e=Math.floor(at.width*Ye),le=Math.floor(at.height*Ye),v.isDataArrayTexture)ge=at.depth;else if(v.isData3DTexture)ge=Math.floor(at.depth*Ye);else ge=1;Me=0,Ue=0,Xe=0}if(F!==null)xe=F.x,$e=F.y,xt=F.z;else xe=0,$e=0,xt=0;let nt=te.convert(I.format),It=te.convert(I.type),ve;if(I.isData3DTexture)De.setTexture3D(I,0),ve=L.TEXTURE_3D;else if(I.isDataArrayTexture||I.isCompressedArrayTexture)De.setTexture2DArray(I,0),ve=L.TEXTURE_2D_ARRAY;else De.setTexture2D(I,0),ve=L.TEXTURE_2D;de.activeTexture(L.TEXTURE0),de.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,I.flipY),de.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),de.pixelStorei(L.UNPACK_ALIGNMENT,I.unpackAlignment);let Ot=de.getParameter(L.UNPACK_ROW_LENGTH),Ke=de.getParameter(L.UNPACK_IMAGE_HEIGHT),Mi=de.getParameter(L.UNPACK_SKIP_PIXELS),Pt=de.getParameter(L.UNPACK_SKIP_ROWS),yr=de.getParameter(L.UNPACK_SKIP_IMAGES);de.pixelStorei(L.UNPACK_ROW_LENGTH,at.width),de.pixelStorei(L.UNPACK_IMAGE_HEIGHT,at.height),de.pixelStorei(L.UNPACK_SKIP_PIXELS,Me),de.pixelStorei(L.UNPACK_SKIP_ROWS,Ue),de.pixelStorei(L.UNPACK_SKIP_IMAGES,Xe);let Qn=v.isDataArrayTexture||v.isData3DTexture,wi=I.isDataArrayTexture||I.isData3DTexture;if(v.isDepthTexture){let Ye=Pe.get(v),At=Pe.get(I),pn=Pe.get(Ye.__renderTarget),ht=Pe.get(At.__renderTarget);de.bindFramebuffer(L.READ_FRAMEBUFFER,pn.__webglFramebuffer),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,ht.__webglFramebuffer);for(let Tt=0;Tt<ge;Tt++){if(Qn)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(v).__webglTexture,O,Xe+Tt),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(I).__webglTexture,he,xt+Tt);L.blitFramebuffer(Me,Ue,Me+_e,Ue+le,xe,$e,xe+_e,$e+le,L.DEPTH_BUFFER_BIT,L.NEAREST)}de.bindFramebuffer(L.READ_FRAMEBUFFER,null),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(O!==0||v.isRenderTargetTexture||Pe.has(v)){let Ye=Pe.get(v),At=Pe.get(I);de.bindFramebuffer(L.READ_FRAMEBUFFER,Q),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,C);for(let pn=0;pn<ge;pn++){if(Qn)L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Ye.__webglTexture,O,Xe+pn);else L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Ye.__webglTexture,O);if(wi)L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,At.__webglTexture,he,xt+pn);else L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,At.__webglTexture,he);if(O!==0)L.blitFramebuffer(Me,Ue,Me+_e,Ue+le,xe,$e,xe+_e,$e+le,L.COLOR_BUFFER_BIT,L.NEAREST);else if(wi)L.copyTexSubImage3D(ve,he,xe,$e,xt+pn,Me,Ue,_e,le);else L.copyTexSubImage2D(ve,he,xe,$e,Me,Ue,_e,le)}de.bindFramebuffer(L.READ_FRAMEBUFFER,null),de.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(wi)if(v.isDataTexture||v.isData3DTexture)L.texSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,It,at.data);else if(I.isCompressedArrayTexture)L.compressedTexSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,at.data);else L.texSubImage3D(ve,he,xe,$e,xt,_e,le,ge,nt,It,at);else if(v.isDataTexture)L.texSubImage2D(L.TEXTURE_2D,he,xe,$e,_e,le,nt,It,at.data);else if(v.isCompressedTexture)L.compressedTexSubImage2D(L.TEXTURE_2D,he,xe,$e,at.width,at.height,nt,at.data);else L.texSubImage2D(L.TEXTURE_2D,he,xe,$e,_e,le,nt,It,at);if(de.pixelStorei(L.UNPACK_ROW_LENGTH,Ot),de.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Ke),de.pixelStorei(L.UNPACK_SKIP_PIXELS,Mi),de.pixelStorei(L.UNPACK_SKIP_ROWS,Pt),de.pixelStorei(L.UNPACK_SKIP_IMAGES,yr),he===0&&I.generateMipmaps===!0&&I.mipmapsAutoUpdate===!0)L.generateMipmap(ve);de.unbindTexture()},this.initRenderTarget=function(v){if(Pe.get(v).__webglFramebuffer===void 0)De.setupRenderTarget(v)},this.initTexture=function(v){if(v.isCubeTexture)De.setTextureCube(v,0);else if(v.isData3DTexture)De.setTexture3D(v,0);else if(v.isDataArrayTexture||v.isCompressedArrayTexture)De.setTexture2DArray(v,0);else De.setTexture2D(v,0);de.unbindTexture()},this.resetState=function(){Y=0,K=0,B=null,de.reset(),se.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return zl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=He._getDrawingBufferColorSpace(e),t.unpackColorSpace=He._getUnpackColorSpace()}}var Um=`#ifdef USE_ALPHAHASH
|
|
322
322
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
323
323
|
#endif`,Fm=`#ifdef USE_ALPHAHASH
|
|
324
324
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -4163,7 +4163,7 @@ void main() {
|
|
|
4163
4163
|
squared_mean = squared_mean / samples;
|
|
4164
4164
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4165
4165
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4166
|
-
}`,av,ov,Fd,
|
|
4166
|
+
}`,av,ov,Fd,pr,uc,dv=`
|
|
4167
4167
|
void main() {
|
|
4168
4168
|
|
|
4169
4169
|
gl_Position = vec4( position, 1.0 );
|
|
@@ -4222,7 +4222,7 @@ void main() {
|
|
|
4222
4222
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
4223
4223
|
|
|
4224
4224
|
}
|
|
4225
|
-
`},i=new ws(5,5,5),s=new Kn({name:"CubemapFromEquirect",uniforms:Vi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xt,blending:Oi});s.uniforms.tEquirect.value=t;let r=new yt(i,s),a=t.minFilter;if(t.minFilter===tn)t.minFilter=mt;return new dr(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let s=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(s)}};M0=new D,w0=new Ee;U0={[Vo]:"LINEAR_TONE_MAPPING",[Xo]:"REINHARD_TONE_MAPPING",[$o]:"CINEON_TONE_MAPPING",[Js]:"ACES_FILMIC_TONE_MAPPING",[Yo]:"AGX_TONE_MAPPING",[Zo]:"NEUTRAL_TONE_MAPPING",[qo]:"CUSTOM_TONE_MAPPING"};Hd=new ft,Gd=new pi(1,1),Wd=new wa(1),Vd=new fa,Xd=new ql,$d=new Ma,yd=[],Sd=[],bd=new Float32Array(16),Md=new Float32Array(9),wd=new Float32Array(4);hc=/(\w+)(\])?(\[|\.)?/g;Ad=new Ne;Cx={[Vo]:"Linear",[Xo]:"Reinhard",[$o]:"Cineon",[Js]:"ACESFilmic",[Yo]:"AgX",[Zo]:"Neutral",[qo]:"Custom"};Fa=new D;Ux=/^[ \t]*#include +<([\w\d./]+)>/gm;Ox=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;kx={[Zs]:"SHADOWMAP_TYPE_PCF",[ps]:"SHADOWMAP_TYPE_VSM"};Hx={[gs]:"ENVMAP_MODE_REFRACTION"};Wx={[zu]:"ENVMAP_BLENDING_MULTIPLY",[Hu]:"ENVMAP_BLENDING_MIX",[Gu]:"ENVMAP_BLENDING_ADD"};av=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],ov=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],Fd=new Fe,fr=new D,uc=new D;Qd=class Qd extends Yn{constructor(e,t){super();let n=this,i=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,f=null,_=typeof XRWebGLBinding<"u",y=new jd,p={},m=t.getContextAttributes(),M=null,T=null,b=[],E=[],A=new ke,g=null,S=null,P=new Dt;P.viewport=new tt;let z=new Dt;z.viewport=new tt;let N=[P,z],H=new rc,Q=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=b[Z];if(ne===void 0)ne=new ir,b[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=b[Z];if(ne===void 0)ne=new ir,b[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=b[Z];if(ne===void 0)ne=new ir,b[Z]=ne;return ne.getHandSpace()};function Y(Z){let ne=E.indexOf(Z.inputSource);if(ne===-1)return;let ye=b[ne];if(ye!==void 0)ye.update(Z.inputSource,Z.frame,l||r),ye.dispatchEvent({type:Z.type,data:Z.inputSource})}function K(){i.removeEventListener("select",Y),i.removeEventListener("selectstart",Y),i.removeEventListener("selectend",Y),i.removeEventListener("squeeze",Y),i.removeEventListener("squeezestart",Y),i.removeEventListener("squeezeend",Y),i.removeEventListener("end",K),i.removeEventListener("inputsourceschange",B);for(let Z=0;Z<b.length;Z++){let ne=E[Z];if(ne===null)continue;E[Z]=null,b[Z].disconnect(ne)}Q=null,C=null,y.reset();for(let Z in p)delete p[Z];if(e.setRenderTarget(M),d=null,u=null,h=null,i=null,T=null,be.stop(),n.isPresenting=!1,e.setPixelRatio(g),e.setSize(A.width,A.height,!1),S!==null){let Z=S.camera;Z.fov=S.fov,Z.zoom=S.zoom,Z.updateProjectionMatrix(),S=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(s=Z,n.isPresenting===!0)Te("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(a=Z,n.isPresenting===!0)Te("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||r},this.setReferenceSpace=function(Z){l=Z},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){if(h===null&&_)h=new XRWebGLBinding(i,t);return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(M=e.getRenderTarget(),i.addEventListener("select",Y),i.addEventListener("selectstart",Y),i.addEventListener("selectend",Y),i.addEventListener("squeeze",Y),i.addEventListener("squeezestart",Y),i.addEventListener("squeezeend",Y),i.addEventListener("end",K),i.addEventListener("inputsourceschange",B),m.xrCompatible!==!0)await t.makeXRCompatible();if(g=e.getPixelRatio(),e.getSize(A),!(_&&("createProjectionLayer"in XRWebGLBinding.prototype))){let ye={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,ye),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),T=new hn(d.framebufferWidth,d.framebufferHeight,{format:bn,type:Sn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{let ye=null,Ce=null,Ie=null;if(m.depth)Ie=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ye=m.stencil?di:vs,Ce=m.stencil?ki:ui;let Se={colorFormat:t.RGBA8,depthFormat:Ie,scaleFactor:s};h=this.getBinding(),u=h.createProjectionLayer(Se),i.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),T=new hn(u.textureWidth,u.textureHeight,{format:bn,type:Sn,depthTexture:new pi(u.textureWidth,u.textureHeight,Ce,void 0,void 0,void 0,void 0,void 0,void 0,ye),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1,storeMultisampledDepthBuffer:u.ignoreDepthValues===!1,storeMultisampledStencilBuffer:u.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await i.requestReferenceSpace(a),be.setContext(i),be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function B(Z){for(let ne=0;ne<Z.removed.length;ne++){let ye=Z.removed[ne],Ce=E.indexOf(ye);if(Ce>=0)E[Ce]=null,b[Ce].disconnect(ye)}for(let ne=0;ne<Z.added.length;ne++){let ye=Z.added[ne],Ce=E.indexOf(ye);if(Ce===-1){for(let Se=0;Se<b.length;Se++)if(Se>=E.length){E.push(ye),Ce=Se;break}else if(E[Se]===null){E[Se]=ye,Ce=Se;break}if(Ce===-1)break}let Ie=b[Ce];if(Ie)Ie.connect(ye)}}function ae(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:ye}=Z;if(y.texture!==null){if(y.depthNear>0)ne=y.depthNear;if(y.depthFar>0)ye=y.depthFar}if(H.near=z.near=P.near=ne,H.far=z.far=P.far=ye,Q!==H.near||C!==H.far)i.updateRenderState({depthNear:H.near,depthFar:H.far}),Q=H.near,C=H.far;H.layers.mask=Z.layers.mask|6,P.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Ce=Z.parent,Ie=H.cameras;ae(H,Ce);for(let Se=0;Se<Ie.length;Se++)ae(Ie[Se],Ce);if(H.projectionMatrix.copy(P.projectionMatrix),H.projectionMatrixInverse.copy(P.projectionMatrixInverse),S===null&&Z.isPerspectiveCamera)S={camera:Z,fov:Z.fov,zoom:Z.zoom};V(Z,H,Ce)};function V(Z,ne,ye){if(ye===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(ye.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=Ui*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return H},this.getFoveation=function(){if(u===null&&d===null)return;return o},this.setFoveation=function(Z){if(o=Z,u!==null)u.fixedFoveation=Z;if(d!==null&&d.fixedFoveation!==void 0)d.fixedFoveation=Z},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(H)},this.getCameraTexture=function(Z){return p[Z]};let j=null;function ie(Z,ne){if(c=ne.getViewerPose(l||r),f=ne,c!==null){let ye=c.views;if(d!==null)e.setRenderTargetFramebuffer(T,d.framebuffer),e.setRenderTarget(T);let Ce=!1;if(ye.length!==H.cameras.length)H.cameras.length=0,Ce=!0;for(let We=0;We<ye.length;We++){let Oe=ye[We],lt=null;if(d!==null)lt=d.getViewport(Oe);else{let dt=h.getViewSubImage(u,Oe);if(lt=dt.viewport,We===0)e.setRenderTargetTextures(T,dt.colorTexture,dt.depthStencilTexture),e.setRenderTarget(T)}let qe=N[We];if(qe===void 0)qe=new Dt,qe.layers.enable(We),qe.viewport=new tt,N[We]=qe;if(qe.matrix.fromArray(Oe.transform.matrix),qe.matrix.decompose(qe.position,qe.quaternion,qe.scale),qe.projectionMatrix.fromArray(Oe.projectionMatrix),qe.projectionMatrixInverse.copy(qe.projectionMatrix).invert(),qe.viewport.set(lt.x,lt.y,lt.width,lt.height),We===0)H.matrix.copy(qe.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale);if(Ce===!0)H.cameras.push(qe)}let Ie=i.enabledFeatures;if(Ie&&Ie.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=n.getBinding();let We=h.getDepthInformation(ye[0]);if(We&&We.isValid&&We.texture)y.init(We,i.renderState)}if(Ie&&Ie.includes("camera-access")&&_){e.state.unbindTexture(),h=n.getBinding();for(let We=0;We<ye.length;We++){let Oe=ye[We].camera;if(Oe){let lt=p[Oe];if(!lt)lt=new Ta,p[Oe]=lt;let qe=h.getCameraImage(Oe);lt.sourceTexture=qe}}}}for(let ye=0;ye<b.length;ye++){let Ce=E[ye],Ie=b[ye];if(Ce!==null&&Ie!==void 0)Ie.update(Ce,ne,l||r)}if(j)j(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});f=null}let be=new Od;be.setAnimationLoop(ie),this.setAnimationLoop=function(Z){j=Z},this.dispose=function(){}}};pv=new Fe,ef=new Ne;ef.set(-1,0,0,0,1,0,0,0,1);_v=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183])});function mc(e,t){if(t===Nl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===ys||t===er){let n=e.getIndex();if(n===null){let r=[],a=e.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,s=[];if(t===ys)for(let r=1;r<=i;r++)s.push(n.getX(0)),s.push(n.getX(r)),s.push(n.getX(r+1));else for(let r=0;r<i;r++)if(r%2===0)s.push(n.getX(r)),s.push(n.getX(r+1)),s.push(n.getX(r+2));else s.push(n.getX(r+2)),s.push(n.getX(r+1)),s.push(n.getX(r));if(s.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");return e.setIndex(s),e.clearGroups(),e}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var tf=On(()=>{As()});function nf(e){let t=new Map,n=new Map,i=e.clone();return sf(e,i,function(s,r){t.set(r,s),n.set(s,r)}),i.traverse(function(s){if(!s.isSkinnedMesh)return;let r=s,a=t.get(s),o=a.skeleton.bones;r.skeleton=a.skeleton.clone(),r.bindMatrix.copy(a.bindMatrix),r.skeleton.bones=o.map(function(l){return n.get(l)}),r.bind(r.skeleton,r.bindMatrix)}),i}function sf(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)sf(e.children[i],t.children[i],n)}var rf=()=>{};function vv(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function ut(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}class hf{constructor(e){this.parser=e,this.name=Ge.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let s=t[n];if(s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l,c=new Ee(16777215);if(o.color!==void 0)c.setRGB(o.color[0],o.color[1],o.color[2],nn);let h=o.range!==void 0?o.range:0;switch(o.type){case"directional":l=new $i(c),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new La(c),l.distance=h;break;case"spot":l=new Pa(c),l.distance=h,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,l.angle=o.spot.outerConeAngle,l.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}if(l.position.set(0,0,0),Dn(l,o),o.intensity!==void 0)l.intensity=o.intensity;return l.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;if(a===void 0)return null;return this._loadLight(a).then(function(o){return n._getNodeRef(t.cache,a,o)})}}class uf{constructor(){this.name=Ge.KHR_MATERIALS_UNLIT}getMaterialType(){return Zn}extendParams(e,t,n){let i=[];e.color=new Ee(1,1,1),e.opacity=1;let s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){let r=s.baseColorFactor;e.color.setRGB(r[0],r[1],r[2],nn),e.opacity=r[3]}if(s.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",s.baseColorTexture,ln))}return Promise.all(i)}}class df{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class ff{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let s=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ke(s,s)}}return Promise.all(i)}}class pf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_DIFFUSE_ROUGHNESS}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.diffuseRoughness=n.diffuseRoughnessFactor!==void 0?n.diffuseRoughnessFactor:0,n.diffuseRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"diffuseRoughnessMap",n.diffuseRoughnessTexture));return Promise.all(i)}}class mf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_DISPERSION}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class gf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessMinimum=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessMaximum=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class _f{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SHEEN}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Ee(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let s=n.sheenColorFactor;t.sheenColor.setRGB(s[0],s[1],s[2],nn)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,ln));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class xf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class vf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_VOLUME}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let s=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ee().setRGB(s[0],s[1],s[2],nn),Promise.all(i)}}class yf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IOR}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class Sf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SPECULAR}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let s=n.specularColorFactor||[1,1,1];if(t.specularColor=new Ee().setRGB(s[0],s[1],s[2],nn),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,ln));return Promise.all(i)}}class bf{constructor(e){this.parser=e,this.name=Ge.EXT_MATERIALS_BUMP}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class Mf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class wf{constructor(e){this.parser=e,this.name=Ge.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let s=i.extensions[this.name],r=t.options.ktx2Loader;if(!r)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,s.source,r)}}class Tf{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;let r=s.extensions[t],a=i.images[r.source],o=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);if(l!==null)o=l}return n.loadTextureImage(e,r.source,o)}}class Ef{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;let r=s.extensions[t],a=i.images[r.source],o=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);if(l!==null)o=l}return n.loadTextureImage(e,r.source,o)}}class vc{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return s.then(function(a){let o=i.byteOffset||0,l=i.byteLength||0,{count:c,byteStride:h}=i,u=new Uint8Array(a,o,l);if(r.decodeGltfBufferAsync)return r.decodeGltfBufferAsync(c,h,u,i.mode,i.filter).then(function(d){return d.buffer});else return r.ready.then(function(){let d=new ArrayBuffer(c*h);return r.decodeGltfBuffer(new Uint8Array(d),c,h,u,i.mode,i.filter),d})})}else return null}}class Af{constructor(e){this.name=Ge.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let l of i.primitives)if(l.mode!==un.TRIANGLES&&l.mode!==un.TRIANGLE_STRIP&&l.mode!==un.TRIANGLE_FAN&&l.mode!==void 0)return null;let r=n.extensions[this.name].attributes,a=[],o={};for(let l in r)a.push(this.parser.getDependency("accessor",r[l]).then((c)=>(o[l]=c,o[l])));if(a.length<1)return null;return a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((l)=>{let c=l.pop(),h=c.isGroup?c.children:[c],u=l[0].count,d=[];for(let f of h){let _=new Fe,y=new D,p=new cn,m=new D(1,1,1),M=new xa(f.geometry,f.material,u);for(let b=0;b<u;b++){if(o.TRANSLATION)y.fromBufferAttribute(o.TRANSLATION,b);if(o.ROTATION)p.fromBufferAttribute(o.ROTATION,b);if(o.SCALE)m.fromBufferAttribute(o.SCALE,b);M.setMatrixAt(b,_.compose(y,p,m))}let T=null;for(let b in o)if(b==="_COLOR_0"){let E=o[b];M.instanceColor=new li(E.array,E.itemSize,E.normalized)}else if(b!=="TRANSLATION"&&b!=="ROTATION"&&b!=="SCALE"){if(T===null){let A=M.geometry;T=new Yt,T.name=A.name;for(let g in A.attributes)T.setAttribute(g,A.attributes[g]);for(let g in A.morphAttributes)T.morphAttributes[g]=A.morphAttributes[g];if(A.index!==null)T.setIndex(A.index);T.morphTargetsRelative=A.morphTargetsRelative;for(let g of A.groups)T.addGroup(g.start,g.count,g.materialIndex);if(A.boundingBox!==null)T.boundingBox=A.boundingBox.clone();if(A.boundingSphere!==null)T.boundingSphere=A.boundingSphere.clone();T.drawRange.start=A.drawRange.start,T.drawRange.count=A.drawRange.count,T.userData=Object.assign({},A.userData),M.geometry=T}let E=o[b];T.setAttribute(b,new li(E.array,E.itemSize,E.normalized))}ot.prototype.copy.call(M,f),this.parser.assignFinalMaterial(M),d.push(M)}if(c.isGroup)return c.clear(),c.add(...d),c;return d[0]})}}class Cf{constructor(e){this.name=Ge.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,_r),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Rf)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-_r,s=new DataView(e,_r),r=0;while(r<i){let a=s.getUint32(r,!0);r+=4;let o=s.getUint32(r,!0);if(r+=4,o===af.JSON){let l=new Uint8Array(e,_r+r,a);this.content=n.decode(l)}else if(o===af.BIN){let l=_r+r;this.body=e.slice(l,l+a)}r+=a}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class If{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ge.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,a={},o={},l={};for(let c in r){let h=yc[c]||c.toLowerCase();a[h]=r[c]}for(let c in e.attributes){let h=yc[c]||c.toLowerCase();if(r[c]!==void 0){let u=n.accessors[e.attributes[c]],d=Rs[u.componentType];l[h]=d.name,o[h]=u.normalized===!0}}return t.getDependency("bufferView",s).then(function(c){return new Promise(function(h,u){i.decodeDracoFile(c,function(d){for(let f in d.attributes){let _=d.attributes[f],y=o[f];if(y!==void 0)_.normalized=y}h(d)},a,l,nn,u)})})}}class Pf{constructor(){this.name=Ge.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);if(t.rotation!==void 0){let n=Math.cos(e.rotation),i=Math.sin(e.rotation);e.matrix.set(e.repeat.x*n,e.repeat.y*i,e.offset.x,-e.repeat.x*i,e.repeat.y*n,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}}class Lf{constructor(){this.name=Ge.KHR_MESH_QUANTIZATION}}function bv(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new Pn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ci});return e.DefaultMaterial}function qi(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function Dn(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function Mv(e,t,n){let i=!1,s=!1,r=!1;for(let c=0,h=t.length;c<h;c++){let u=t[c];if(u.POSITION!==void 0)i=!0;if(u.NORMAL!==void 0)s=!0;if(u.COLOR_0!==void 0)r=!0;if(i&&s&&r)break}if(!i&&!s&&!r)return Promise.resolve(e);let a=[],o=[],l=[];for(let c=0,h=t.length;c<h;c++){let u=t[c];if(i){let d=u.POSITION!==void 0?n.getDependency("accessor",u.POSITION):e.attributes.position;a.push(d)}if(s){let d=u.NORMAL!==void 0?n.getDependency("accessor",u.NORMAL):e.attributes.normal;o.push(d)}if(r){let d=u.COLOR_0!==void 0?n.getDependency("accessor",u.COLOR_0):e.attributes.color;l.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){let h=c[0],u=c[1],d=c[2];if(i)e.morphAttributes.position=h;if(s)e.morphAttributes.normal=u;if(r)e.morphAttributes.color=d;return e.morphTargetsRelative=!0,e})}function wv(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,s=n.length;i<s;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Tv(e){let t,n=e.extensions&&e.extensions[Ge.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+xc(n.attributes);else t=e.indices+":"+xc(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,s=e.targets.length;i<s;i++)t+=":"+xc(e.targets[i]);return t}function xc(e){let t="",n=Object.keys(e).sort();for(let i=0,s=n.length;i<s;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Sc(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ev(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}class Df{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new vv,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let o=a.match(/Version\/(\d+)/);i=n&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,r=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||s&&r<98)this.textureLoader=new Ra(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache);else this.textureLoader=new Na(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new hr(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType("arraybuffer"),this.options.withCredentials||this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){let a={scene:r[0][i.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:i.asset,parser:n,userData:{}};return qi(s,a,i),Dn(a,i),Promise.all(n._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(let o of a.scenes)o.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){let r=t[i].joints;for(let a=0,o=r.length;a<o;a++)e[r[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.mesh!==void 0){if(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0)n[r.mesh].isSkinnedMesh=!0}if(r.camera!==void 0)this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),s=(r,a)=>{let o=this.associations.get(r);if(o!=null)this.associations.set(a,o);for(let[l,c]of r.children.entries())s(c,a.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let s=e(t[i]);if(s)n.push(s)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ge.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(s,r){n.load(yi.resolveURL(t.uri,i.path),s,void 0,function(){r(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let r=gc[i.type],a=Rs[i.componentType],o=i.normalized===!0,l=new a(i.count*r);return Promise.resolve(new pt(l,r,o))}let s=[];if(i.bufferView!==void 0)s.push(this.getDependency("bufferView",i.bufferView));else s.push(null);if(i.sparse!==void 0)s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(s).then(function(r){let a=r[0],o=gc[i.type],l=Rs[i.componentType],c=l.BYTES_PER_ELEMENT,h=c*o,u=i.byteOffset||0,d=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,f=i.normalized===!0,_,y;if(d&&d!==h){let p=Math.floor(u/d),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,M=t.cache.get(m);if(!M)_=new l(a,p*d,i.count*d/c),M=new sr(_,d/c),t.cache.add(m,M);y=new Ss(M,o,u%d/c,f)}else{if(a===null)_=new l(i.count*o);else _=new l(a,u,i.count*o);y=new pt(_,o,f)}if(i.sparse!==void 0){let p=gc.SCALAR,m=Rs[i.sparse.indices.componentType],M=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,b=new m(r[1],M,i.sparse.count*p),E=new l(r[2],T,i.sparse.count*o);if(a!==null)y=new pt(y.array.slice(),y.itemSize,y.normalized);y.normalized=!1;for(let A=0,g=b.length;A<g;A++){let S=b[A];if(y.setX(S,E[A*o]),o>=2)y.setY(S,E[A*o+1]);if(o>=3)y.setZ(S,E[A*o+2]);if(o>=4)y.setW(S,E[A*o+3]);if(o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}y.normalized=f}return y})}loadTexture(e){let t=this.json,n=this.options,s=t.textures[e].source,r=t.images[s],a=this.textureLoader;if(r.uri){let o=n.manager.getHandler(r.uri);if(o!==null)a=o}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){let i=this,s=this.json,r=s.textures[e],a=s.images[t],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,n).then(function(c){if(c.flipY=!1,c.name=r.name||a.name||"",c.name===""&&typeof a.uri==="string"&&a.uri.startsWith("data:image/")===!1)c.name=a.uri;let u=(s.samplers||{})[r.sampler]||{};return c.magFilter=of[u.magFilter]||mt,c.minFilter=of[u.minFilter]||tn,c.wrapS=lf[u.wrapS]||hi,c.wrapT=lf[u.wrapT]||hi,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==yn&&c.minFilter!==mt,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let r=i.images[e],a=self.URL||self.webkitURL,o=r.uri||"",l=!1,c;if(t.isKTX2Loader===!0&&r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(u){return new Promise(function(d,f){t.parse(u,d,f)})});else{if(r.bufferView!==void 0)o=n.getDependency("bufferView",r.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:r.mimeType});return o=a.createObjectURL(d),o});else if(r.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");c=Promise.resolve(o).then(function(u){return new Promise(function(d,f){let _=d;if(t.isImageBitmapLoader===!0)_=function(y){let p=new ft(y);p.needsUpdate=!0,d(p)};t.load(yi.resolveURL(u,s.path),_,void 0,f)})})}let h=c.then(function(u){if(l===!0)a.revokeObjectURL(o);return Dn(u,r),u.userData.mimeType=r.mimeType||Ev(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){let s=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0)r=r.clone(),r.channel=n.texCoord;if(s.extensions[Ge.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let o=s.associations.get(r);r=s.extensions[Ge.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),s.associations.set(r,o)}}if(i!==void 0)r.colorSpace=i;return e[t]=r,r})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,o=this.cache.get(a);if(!o)o=new lr,rn.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,o.sizeAttenuation=!1,this.cache.add(a,o);n=o}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,o=this.cache.get(a);if(!o)o=new or,rn.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,this.cache.add(a,o);n=o}if(i||s||r){let a="ClonedMaterial:"+n.uuid+":";if(i)a+="derivative-tangents:";if(s)a+="vertex-colors:";if(r)a+="flat-shading:";let o=this.cache.get(a);if(!o){if(o=n.clone(),s)o.vertexColors=!0;if(r)o.flatShading=!0;if(i){if(o.normalScale)o.normalScale.y*=-1;if(o.clearcoatNormalScale)o.clearcoatNormalScale.y*=-1}this.cache.add(a,o),this.associations.set(o,this.associations.get(n))}n=o}e.material=n}getMaterialType(){return Pn}loadMaterial(e){let t=this,n=this.json,i=this.extensions,s=n.materials[e],r,a={},o=s.extensions||{},l=[];if(o[Ge.KHR_MATERIALS_UNLIT]){let h=i[Ge.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),l.push(h.extendParams(a,s,t))}else{let h=s.pbrMetallicRoughness||{};if(a.color=new Ee(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let u=h.baseColorFactor;a.color.setRGB(u[0],u[1],u[2],nn),a.opacity=u[3]}if(h.baseColorTexture!==void 0)l.push(t.assignTexture(a,"map",h.baseColorTexture,ln));if(a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0)l.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture));r=this._invokeOne(function(u){return u.getMaterialType&&u.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(u){return u.extendMaterialParams&&u.extendMaterialParams(e,a)})))}if(s.doubleSided===!0)a.side=$t;let c=s.alphaMode||_c.OPAQUE;if(c===_c.BLEND)a.transparent=!0,a.depthWrite=!1;else if(a.transparent=!1,c===_c.MASK)a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:0.5;if(s.normalTexture!==void 0&&r!==Zn){if(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new ke(1,1),s.normalTexture.scale!==void 0){let h=s.normalTexture.scale;a.normalScale.set(h,h)}}if(s.occlusionTexture!==void 0&&r!==Zn){if(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0)a.aoMapIntensity=s.occlusionTexture.strength}if(s.emissiveFactor!==void 0&&r!==Zn){let h=s.emissiveFactor;a.emissive=new Ee().setRGB(h[0],h[1],h[2],nn)}if(s.emissiveTexture!==void 0&&r!==Zn)l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,ln));return Promise.all(l).then(function(){let h=new r(a);if(s.name)h.name=s.name;if(Dn(h,s),t.associations.set(h,{materials:e}),s.extensions)qi(i,h,s);return h})}createUniqueName(e){let t=Je.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(o){return cf(o,a,t)})}let r=[];for(let a=0,o=e.length;a<o;a++){let l=e[a],c=Tv(l),h=i[c];if(h)r.push(h.promise);else{let u;if(l.extensions&&l.extensions[Ge.KHR_DRACO_MESH_COMPRESSION])u=s(l);else u=cf(new Yt,l,t);if(l.mode===un.TRIANGLE_STRIP)u=u.then((d)=>mc(d,er));else if(l.mode===un.TRIANGLE_FAN)u=u.then((d)=>mc(d,ys));i[c]={primitive:l,promise:u},r.push(u)}}return Promise.all(r)}loadMesh(e){let t=this,n=this.json,i=this.extensions,s=n.meshes[e],r=s.primitives,a=[];for(let o=0,l=r.length;o<l;o++){let c=r[o].material===void 0?bv(this.cache):this.getDependency("material",r[o].material);a.push(c)}return a.push(t.loadGeometries(r)),Promise.all(a).then(async function(o){let l=o.slice(0,o.length-1),c=o[o.length-1],h=[];for(let d=0,f=c.length;d<f;d++){let _=c[d],y=r[d],p,m=l[d];if(y.mode===un.TRIANGLES||y.mode===un.TRIANGLE_STRIP||y.mode===un.TRIANGLE_FAN||y.mode===void 0){let M=s.isSkinnedMesh===!0,T=_.hasAttribute("skinIndex")&&_.hasAttribute("skinWeight");if(M&&T===!1)console.warn("THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled.");if(p=M&&T?new _a(_,m):new yt(_,m),p.isSkinnedMesh===!0)p.normalizeSkinWeights()}else if(y.mode===un.LINES)p=new ya(_,m);else if(y.mode===un.LINE_STRIP)p=new bs(_,m);else if(y.mode===un.LINE_LOOP)p=new Sa(_,m);else if(y.mode===un.POINTS)p=new ba(_,m);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+y.mode);if(Object.keys(p.geometry.morphAttributes).length>0)wv(p,s);if(p.name=t.createUniqueName(s.name||"mesh_"+e),Dn(p,s),y.extensions)qi(i,p,y);t.assignFinalMaterial(p),h.push(p)}for(let d=0,f=h.length;d<f;d++)t.associations.set(h[d],{meshes:e,primitives:d});if(h.length===1){if(s.extensions)qi(i,h[0],s);return h[0]}let u=new En;if(s.extensions)qi(i,u,s);t.associations.set(u,{meshes:e});for(let d=0,f=h.length;d<f;d++)u.add(h[d]);return u})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Dt(fi.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new vi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return Dn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let s=i.pop(),r=i,a=[],o=[];for(let l=0,c=r.length;l<c;l++){let h=r[l];if(h){a.push(h);let u=new Fe;if(s!==null)u.fromArray(s.array,l*16);o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new ar(a,o)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,r=[],a=[],o=[],l=[],c=[];for(let h=0,u=i.channels.length;h<u;h++){let d=i.channels[h],f=i.samplers[d.sampler],_=d.target,y=_.node,p=i.parameters!==void 0?i.parameters[f.input]:f.input,m=i.parameters!==void 0?i.parameters[f.output]:f.output;if(_.node===void 0)continue;r.push(this.getDependency("node",y)),a.push(this.getDependency("accessor",p)),o.push(this.getDependency("accessor",m)),l.push(f),c.push(_)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(h){let u=h[0],d=h[1],f=h[2],_=h[3],y=h[4],p=[];for(let M=0,T=u.length;M<T;M++){let b=u[M],E=d[M],A=f[M],g=_[M],S=y[M];if(b===void 0)continue;if(b.updateMatrix)b.updateMatrix();let P=n._createAnimationTracks(b,E,A,g,S);if(P)for(let z=0;z<P.length;z++)p.push(P[z])}let m=new Aa(s,void 0,p);return Dn(m,i),m})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(s){let r=n._getNodeRef(n.meshCache,i.mesh,s);if(i.weights!==void 0)r.traverse(function(a){if(!a.isMesh)return;for(let o=0,l=i.weights.length;o<l;o++)a.morphTargetInfluences[o]=i.weights[o]});return r})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),r=[],a=i.children||[];for(let l=0,c=a.length;l<c;l++)r.push(n.getDependency("node",a[l]));let o=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(r),o]).then(function(l){let c=l[0],h=l[1],u=l[2];if(u!==null)c.traverse(function(d){if(!d.isSkinnedMesh)return;d.bind(u,Av)});for(let d=0,f=h.length;d<f;d++)c.add(h[d]);if(c.userData.pivot!==void 0&&h.length>0){let d=c.userData.pivot,f=h[0];c.pivot=new D().fromArray(d),c.position.x-=d[0],c.position.y-=d[1],c.position.z-=d[2],f.position.set(0,0,0),delete c.userData.pivot}return c})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let s=t.nodes[e],r=s.name?i.createUniqueName(s.name):"",a=[],o=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});if(o)a.push(o);if(s.camera!==void 0)a.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)}));return i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let c;if(s.isBone===!0)c=new rr;else if(l.length>1)c=new En;else if(l.length===1)c=l[0];else c=new ot;if(c!==l[0])for(let h=0,u=l.length;h<u;h++)c.add(l[h]);if(s.name)c.userData.name=s.name,c.name=r;if(Dn(c,s),s.extensions)qi(n,c,s);if(s.matrix!==void 0){let h=new Fe;h.fromArray(s.matrix),c.applyMatrix4(h)}else{if(s.translation!==void 0)c.position.fromArray(s.translation);if(s.rotation!==void 0)c.quaternion.fromArray(s.rotation);if(s.scale!==void 0)c.scale.fromArray(s.scale)}if(!i.associations.has(c))i.associations.set(c,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){let h=i.associations.get(c);i.associations.set(c,{...h})}return i.associations.get(c).nodes=e,c}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,s=new En;if(n.name)s.name=i.createUniqueName(n.name);if(Dn(s,n),n.extensions)qi(t,s,n);let r=n.nodes||[],a=[];for(let o=0,l=r.length;o<l;o++)a.push(i.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let c=0,h=o.length;c<h;c++){let u=o[c];if(u.parent!==null)s.add(nf(u));else s.add(u)}let l=(c)=>{let h=new Map;for(let[u,d]of i.associations)if(u instanceof rn||u instanceof ft)h.set(u,d);return c.traverse((u)=>{let d=i.associations.get(u);if(d!=null)h.set(u,d)}),h};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){let r=[],a=e.name?e.name:e.uuid,o=[];function l(d){if(d.morphTargetInfluences)o.push(d.name?d.name:d.uuid)}if(Si[s.path]===Si.weights){if(l(e),e.isGroup)e.children.forEach(l)}else o.push(a);let c;switch(Si[s.path]){case Si.weights:c=gi;break;case Si.rotation:c=_i;break;case Si.translation:case Si.scale:c=Xi;break;default:switch(n.itemSize){case 1:c=gi;break;case 2:case 3:default:c=Xi;break}break}let h=i.interpolation!==void 0?Sv[i.interpolation]:ha,u=this._getArrayFromAccessor(n);for(let d=0,f=o.length;d<f;d++){let _=new c(o[d]+"."+Si[s.path],t.array,u,h);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(_);r.push(_)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Sc(t.constructor),i=new Float32Array(t.length);for(let s=0,r=t.length;s<r;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof _i?Nf:Mc)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Rv(e,t,n){let i=t.attributes,s=new qt;if(i.POSITION!==void 0){let o=n.json.accessors[i.POSITION],{min:l,max:c}=o;if(l!==void 0&&c!==void 0){if(s.set(new D(l[0],l[1],l[2]),new D(c[0],c[1],c[2])),o.normalized){let h=Sc(Rs[o.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=t.targets;if(r!==void 0){let o=new D,l=new D;for(let c=0,h=r.length;c<h;c++){let u=r[c];if(u.POSITION!==void 0){let d=n.json.accessors[u.POSITION],{min:f,max:_}=d;if(f!==void 0&&_!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(_[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(_[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(_[2]))),d.normalized){let y=Sc(Rs[d.componentType]);l.multiplyScalar(y)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(o)}e.boundingBox=s;let a=new sn;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,e.boundingSphere=a}function cf(e,t,n){let i=t.attributes,s=[];function r(a,o){return n.getDependency("accessor",a).then(function(l){e.setAttribute(o,l)})}for(let a in i){let o=yc[a]||a.toLowerCase();if(o in e.attributes)continue;s.push(r(i[a],o))}if(t.indices!==void 0&&!e.index){let a=n.getDependency("accessor",t.indices).then(function(o){e.setIndex(o)});s.push(a)}if(He.workingColorSpace!==nn&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${He.workingColorSpace}" not supported.`);return Dn(e,t),Rv(e,t,n),Promise.all(s).then(function(){return t.targets!==void 0?Mv(e,t.targets,n):e})}var bc,Ge,Rf="glTF",_r=12,af,Mc,yv,Nf,un,Rs,of,lf,gc,yc,Si,Sv,_c,Av;var Uf=On(()=>{As();tf();rf();bc=class bc extends jn{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new ff(t)}),this.register(function(t){return new pf(t)}),this.register(function(t){return new mf(t)}),this.register(function(t){return new wf(t)}),this.register(function(t){return new Tf(t)}),this.register(function(t){return new Ef(t)}),this.register(function(t){return new _f(t)}),this.register(function(t){return new xf(t)}),this.register(function(t){return new vf(t)}),this.register(function(t){return new yf(t)}),this.register(function(t){return new df(t)}),this.register(function(t){return new Sf(t)}),this.register(function(t){return new gf(t)}),this.register(function(t){return new Mf(t)}),this.register(function(t){return new bf(t)}),this.register(function(t){return new hf(t)}),this.register(function(t){return new vc(t,Ge.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new vc(t,Ge.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Af(t)})}load(e,t,n,i){let s=this,r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){let l=yi.extractUrlBase(e);r=yi.resolveURL(l,this.path)}else r=yi.extractUrlBase(e);this.manager.itemStart(e);let a=function(l){if(i)i(l);else console.error(l);s.manager.itemError(e),s.manager.itemEnd(e)},o=new hr(this.manager);o.setPriority(this.priority),o.setCache(this.cache),o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{s.parse(l,r,function(c){t(c),s.manager.itemEnd(e)},a)}catch(c){a(c)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let s,r={},a={},o=new TextDecoder;if(typeof e==="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===Rf){try{r[Ge.KHR_BINARY_GLTF]=new Cf(e)}catch(h){if(i)i(h);return}s=JSON.parse(r[Ge.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new Df(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){let h=this.pluginCallbacks[c](l);if(!h.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");a[h.name]=h,r[h.name]=!0}if(s.extensionsUsed)for(let c=0;c<s.extensionsUsed.length;++c){let h=s.extensionsUsed[c],u=s.extensionsRequired||[];switch(h){case Ge.KHR_MATERIALS_UNLIT:r[h]=new uf;break;case Ge.KHR_DRACO_MESH_COMPRESSION:r[h]=new If(s,this.dracoLoader);break;case Ge.KHR_TEXTURE_TRANSFORM:r[h]=new Pf;break;case Ge.KHR_MESH_QUANTIZATION:r[h]=new Lf;break;default:if(u.indexOf(h)>=0&&a[h]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(r),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}};Ge={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DIFFUSE_ROUGHNESS:"KHR_materials_diffuse_roughness",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};af={JSON:1313821514,BIN:5130562};Mc=class Mc extends Jn{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let r=0;r!==i;r++)t[r]=n[s+r];return t}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,l=a*3,c=i-t,h=(n-t)/c,u=h*h,d=u*h,f=e*l,_=f-l,y=-2*d+3*u,p=d-u,m=1-y,M=p-u+h;for(let T=0;T!==a;T++){let b=r[_+T+a],E=r[_+T+o]*c,A=r[f+T+a],g=r[f+T]*c;s[T]=m*b+M*E+y*A+p*g}return s}};yv=new cn;Nf=class Nf extends Mc{interpolate_(e,t,n,i){let s=super.interpolate_(e,t,n,i);return yv.fromArray(s).normalize().toArray(s),s}};un={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},of={9728:yn,9729:mt,9984:ia,9985:xs,9986:Bi,9987:tn},lf={33071:_s,33648:na,10497:hi},gc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Si={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Sv={CUBICSPLINE:void 0,LINEAR:ha,STEP:Ll},_c={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};Av=new Fe});var Tc=(e)=>e.bids.find((t)=>t.status==="leading");class Ec{yaw={offset:0,velocity:0};pitch={offset:0,velocity:0};flutter={offset:0,velocity:0};turn(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return;this.yaw.velocity=Cs(this.yaw.velocity-Cs(e,1)*5.5,9),this.pitch.velocity=Cs(this.pitch.velocity-Cs(t,1)*4,7),this.flutter.velocity=Cs(this.flutter.velocity+Math.min(Math.hypot(e,t),1)*3,6)}advance(e){if(!Number.isFinite(e)||e<0||e>0.25)return this.reset(),!1;let t=e;while(t>0){let i=Math.min(t,0.008333333333333333);this.integrate(this.yaw,i,75,9,0.34),this.integrate(this.pitch,i,90,10,0.24),this.integrate(this.flutter,i,220,8,0.22),t-=i}let n=[this.yaw,this.pitch,this.flutter].some((i)=>Math.abs(i.offset)>0.0001||Math.abs(i.velocity)>0.001);if(!n)this.reset();return n}reset(){for(let e of[this.yaw,this.pitch,this.flutter])e.offset=0,e.velocity=0}integrate(e,t,n,i,s){if(e.velocity+=(-n*e.offset-i*e.velocity)*t,e.offset+=e.velocity*t,Math.abs(e.offset)>s)e.offset=Cs(e.offset,s),e.velocity=0}}class Ac{geometry;rest;restNormals;normalCorrections;weights;ripples;height;deformed=!1;constructor(e){this.geometry=e;let t=e.getAttribute("position");if(!e.getAttribute("normal"))e.computeVertexNormals();let n=e.getAttribute("normal");this.rest=new Float32Array(t.count*3),this.restNormals=new Float32Array(n.count*3),this.normalCorrections=new Float32Array(n.count*3),this.weights=new Float32Array(t.count),this.ripples=new Float32Array(t.count),e.computeBoundingBox(),e.computeBoundingSphere();let i=e.boundingBox;this.height=Math.max(i.max.y-i.min.y,0.001);let s=Math.max(Math.abs(i.min.x),Math.abs(i.max.x),0.001);for(let r=0;r<t.count;r++){let a=t.getX(r),o=t.getY(r),l=t.getZ(r);this.rest.set([a,o,l],r*3),this.restNormals.set([n.getX(r),n.getY(r),n.getZ(r)],r*3);let c=(i.max.y-o)/this.height,h=fi.smoothstep(c,0.25,1),u=fi.smoothstep(Math.abs(a)/s,0.58,1)*fi.smoothstep(c,0.06,0.28);this.weights[r]=Math.max(h*h,u*0.8),this.ripples[r]=Math.sin(a/s*8+c*5)*(h**3+u*0.7)}e.computeVertexNormals();for(let r=0;r<n.count;r++)this.normalCorrections[r*3]=this.restNormals[r*3]-n.getX(r),this.normalCorrections[r*3+1]=this.restNormals[r*3+1]-n.getY(r),this.normalCorrections[r*3+2]=this.restNormals[r*3+2]-n.getZ(r),n.setXYZ(r,this.restNormals[r*3],this.restNormals[r*3+1],this.restNormals[r*3+2]);if(e.boundingBox.expandByScalar(this.height*0.35),e.boundingSphere.radius+=this.height*0.35,t instanceof pt)t.setUsage(ua);if(n instanceof pt)n.setUsage(ua)}apply(e){let t=this.geometry.getAttribute("position");for(let i=0;i<t.count;i++){let s=this.rest[i*3],r=this.rest[i*3+1],a=this.rest[i*3+2],o=this.weights[i],l=e.yaw.offset*o,c=Math.cos(l),h=Math.sin(l),u=e.flutter.offset*this.height*0.13*this.ripples[i];t.setXYZ(i,s*c+a*h+e.yaw.offset*this.height*0.12*o,r+Math.abs(l)*this.height*0.025*o+u*0.25,a*c-s*h+e.pitch.offset*this.height*0.4*o+u)}t.needsUpdate=!0,this.geometry.computeVertexNormals();let n=this.geometry.getAttribute("normal");for(let i=0;i<n.count;i++){let s=n.getX(i)+this.normalCorrections[i*3],r=n.getY(i)+this.normalCorrections[i*3+1],a=n.getZ(i)+this.normalCorrections[i*3+2],o=Math.hypot(s,r,a)||1;n.setXYZ(i,s/o,r/o,a/o)}this.deformed=!0}restore(){if(!this.deformed)return;let e=this.geometry.getAttribute("position"),t=this.geometry.getAttribute("normal");for(let n=0;n<e.count;n++)e.setXYZ(n,this.rest[n*3],this.rest[n*3+1],this.rest[n*3+2]),t.setXYZ(n,this.restNormals[n*3],this.restNormals[n*3+1],this.restNormals[n*3+2]);e.needsUpdate=t.needsUpdate=!0,this.deformed=!1}}var Cs=(e,t)=>Math.max(-t,Math.min(t,e));var Ff=On(()=>{As()});function Of(e){let t=Math.max(1,Math.round(e.length*0.02)),n=0,i=Math.round(e.length*0.42);for(let s=Math.round(e.length*0.22);s<e.length*0.6;s++){let r=e[Math.max(0,s-t)],a=e[Math.min(e.length-1,s+t)],o=r.right-r.left-(a.right-a.left);if(o>n)n=o,i=s}return i/(e.length-1)}function Bf(e,t,n){return e<=t?e/t*n:n+(e-t)/(1-t)*(1-n)}function kf(e,t,n,i,s,r=[]){e.clearRect(0,0,i*2,s);for(let[a,o]of["front","back"].entries()){let l=t?.[o],c=l&&n.get(l.url);if(!l||!c?.complete||!c.naturalWidth)continue;let h=Math.min(i/c.naturalWidth,s/c.naturalHeight)*l.scale,u=c.naturalWidth*h,d=c.naturalHeight*h;if(e.save(),e.beginPath(),e.rect(a*i,0,i,s),e.clip(),l.photo&&r.length){e.translate(a*i+i/2+l.x*i/100,s/2+l.y*s/100),e.scale(l.scale,l.scale);let f=Of(r),_=r[Math.round(r.length*0.58)];for(let y=0;y<r.length;y++){let p=r[y],m=o==="front"?p.left:1-p.right,M=o==="front"?p.right:1-p.left,T=y/r.length,b=o==="front"?_.left:1-_.right,E=o==="front"?_.right:1-_.left,A=[[0,0.25,m,b],[0.25,0.5,b,E],[0.75,0.25,E,M]];for(let[g,S,P,z]of A){if(z<=P)continue;e.drawImage(c,g*c.naturalWidth,Bf(T,f,0.42)*(c.naturalHeight-1),S*c.naturalWidth,c.naturalHeight/r.length,(P-0.5)*i-2,(T-0.5)*s,(z-P)*i+4,s/r.length+1)}}e.restore();continue}e.drawImage(c,a*i+(i-u)/2+l.x*i/100,(s-d)/2+l.y*s/100,u,d),e.restore()}}var zf=()=>{};class Rc{silhouette=[];canvas=document.createElement("canvas");texture=new Ms(this.canvas);uniforms={wodiraArtworkMap:{value:this.texture},wodiraArtworkEnabled:{value:!1},wodiraFrontFabricColor:{value:new Ee},wodiraBackFabricColor:{value:new Ee}};constructor(e){e.updateMatrixWorld(!0);let t=e.matrixWorld.clone().invert(),n=new qt,i=[];e.traverse((a)=>{if(!(a instanceof yt))return;let o=a.geometry.getAttribute("position"),l=t.clone().multiply(a.matrixWorld);if(!a.geometry.hasAttribute("normal"))a.geometry.computeVertexNormals();let c=a.geometry.getAttribute("normal"),h=new Ne().getNormalMatrix(l),u=Array.from({length:c.count},(f,_)=>new D().fromBufferAttribute(c,_).applyNormalMatrix(h).z),d=Array.from({length:o.count},(f,_)=>{let y=new D().fromBufferAttribute(o,_).applyMatrix4(l);return n.expandByPoint(y),y});i.push({mesh:a,positions:d,facing:u})});let s=n.getSize(new D),r=512;this.silhouette=Array.from({length:r},()=>({left:1,right:0}));for(let{mesh:a,positions:o}of i){let l=a.geometry.index,c=l?.count??o.length;for(let h=0;h<c;h+=3){let u=[0,1,2].map((d)=>o[l?l.getX(h+d):h+d]);for(let d=0;d<3;d++){let f=u[d],_=u[(d+1)%3],y=(n.max.y-f.y)/s.y*r,p=(n.max.y-_.y)/s.y*r;if(Math.abs(p-y)<0.00001)continue;let m=Math.max(0,Math.ceil(Math.min(y,p)-0.5)),M=Math.min(r-1,Math.floor(Math.max(y,p)-0.5));for(let T=m;T<=M;T++){let b=(T+0.5-y)/(p-y),E=(f.x+(_.x-f.x)*b-n.min.x)/s.x,A=this.silhouette[T];A.left=Math.min(A.left,E),A.right=Math.max(A.right,E)}}}}for(let a=0;a<r;a++)if(this.silhouette[a].right<=this.silhouette[a].left)this.silhouette[a]={...this.silhouette[a-1]??{left:0,right:1}};this.canvas.width=2048,this.canvas.height=Math.min(2048,Math.max(1,Math.round(1024*s.y/s.x))),this.texture.colorSpace=ln,this.texture.flipY=!1,this.texture.generateMipmaps=!1,this.texture.minFilter=mt;for(let{mesh:a,positions:o,facing:l}of i){let c=new Float32Array(o.length*3);o.forEach((h,u)=>{c[u*3]=(h.x-n.min.x)/s.x,c[u*3+1]=(n.max.y-h.y)/s.y,c[u*3+2]=l[u]}),a.geometry.setAttribute("wodiraArtworkUv",new pt(c,3));for(let h of Array.isArray(a.material)?a.material:[a.material]){if(!(h instanceof Pn))continue;h.onBeforeCompile=(u)=>{Object.assign(u.uniforms,this.uniforms),u.vertexShader=u.vertexShader.replace("#include <common>",`#include <common>
|
|
4225
|
+
`},i=new ws(5,5,5),s=new Kn({name:"CubemapFromEquirect",uniforms:Vi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xt,blending:Oi});s.uniforms.tEquirect.value=t;let r=new yt(i,s),a=t.minFilter;if(t.minFilter===tn)t.minFilter=mt;return new fr(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let s=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(s)}};M0=new D,w0=new Ee;U0={[Vo]:"LINEAR_TONE_MAPPING",[Xo]:"REINHARD_TONE_MAPPING",[$o]:"CINEON_TONE_MAPPING",[js]:"ACES_FILMIC_TONE_MAPPING",[Yo]:"AGX_TONE_MAPPING",[Zo]:"NEUTRAL_TONE_MAPPING",[qo]:"CUSTOM_TONE_MAPPING"};Hd=new ft,Gd=new pi(1,1),Wd=new wa(1),Vd=new fa,Xd=new ql,$d=new Ma,yd=[],Sd=[],bd=new Float32Array(16),Md=new Float32Array(9),wd=new Float32Array(4);hc=/(\w+)(\])?(\[|\.)?/g;Ad=new Ne;Cx={[Vo]:"Linear",[Xo]:"Reinhard",[$o]:"Cineon",[js]:"ACESFilmic",[Yo]:"AgX",[Zo]:"Neutral",[qo]:"Custom"};Fa=new D;Ux=/^[ \t]*#include +<([\w\d./]+)>/gm;Ox=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;kx={[Ks]:"SHADOWMAP_TYPE_PCF",[ps]:"SHADOWMAP_TYPE_VSM"};Hx={[gs]:"ENVMAP_MODE_REFRACTION"};Wx={[zu]:"ENVMAP_BLENDING_MULTIPLY",[Hu]:"ENVMAP_BLENDING_MIX",[Gu]:"ENVMAP_BLENDING_ADD"};av=[new D(1,0,0),new D(-1,0,0),new D(0,1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1)],ov=[new D(0,-1,0),new D(0,-1,0),new D(0,0,1),new D(0,0,-1),new D(0,-1,0),new D(0,-1,0)],Fd=new Fe,pr=new D,uc=new D;Qd=class Qd extends Yn{constructor(e,t){super();let n=this,i=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,f=null,_=typeof XRWebGLBinding<"u",y=new jd,p={},m=t.getContextAttributes(),M=null,T=null,b=[],E=[],A=new ke,g=null,S=null,P=new Dt;P.viewport=new tt;let z=new Dt;z.viewport=new tt;let N=[P,z],H=new rc,Q=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ne=b[Z];if(ne===void 0)ne=new sr,b[Z]=ne;return ne.getTargetRaySpace()},this.getControllerGrip=function(Z){let ne=b[Z];if(ne===void 0)ne=new sr,b[Z]=ne;return ne.getGripSpace()},this.getHand=function(Z){let ne=b[Z];if(ne===void 0)ne=new sr,b[Z]=ne;return ne.getHandSpace()};function Y(Z){let ne=E.indexOf(Z.inputSource);if(ne===-1)return;let ye=b[ne];if(ye!==void 0)ye.update(Z.inputSource,Z.frame,l||r),ye.dispatchEvent({type:Z.type,data:Z.inputSource})}function K(){i.removeEventListener("select",Y),i.removeEventListener("selectstart",Y),i.removeEventListener("selectend",Y),i.removeEventListener("squeeze",Y),i.removeEventListener("squeezestart",Y),i.removeEventListener("squeezeend",Y),i.removeEventListener("end",K),i.removeEventListener("inputsourceschange",B);for(let Z=0;Z<b.length;Z++){let ne=E[Z];if(ne===null)continue;E[Z]=null,b[Z].disconnect(ne)}Q=null,C=null,y.reset();for(let Z in p)delete p[Z];if(e.setRenderTarget(M),d=null,u=null,h=null,i=null,T=null,be.stop(),n.isPresenting=!1,e.setPixelRatio(g),e.setSize(A.width,A.height,!1),S!==null){let Z=S.camera;Z.fov=S.fov,Z.zoom=S.zoom,Z.updateProjectionMatrix(),S=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){if(s=Z,n.isPresenting===!0)Te("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){if(a=Z,n.isPresenting===!0)Te("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||r},this.setReferenceSpace=function(Z){l=Z},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){if(h===null&&_)h=new XRWebGLBinding(i,t);return h},this.getFrame=function(){return f},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(M=e.getRenderTarget(),i.addEventListener("select",Y),i.addEventListener("selectstart",Y),i.addEventListener("selectend",Y),i.addEventListener("squeeze",Y),i.addEventListener("squeezestart",Y),i.addEventListener("squeezeend",Y),i.addEventListener("end",K),i.addEventListener("inputsourceschange",B),m.xrCompatible!==!0)await t.makeXRCompatible();if(g=e.getPixelRatio(),e.getSize(A),!(_&&("createProjectionLayer"in XRWebGLBinding.prototype))){let ye={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,ye),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),T=new hn(d.framebufferWidth,d.framebufferHeight,{format:bn,type:Sn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{let ye=null,Ce=null,Ie=null;if(m.depth)Ie=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ye=m.stencil?di:vs,Ce=m.stencil?ki:ui;let Se={colorFormat:t.RGBA8,depthFormat:Ie,scaleFactor:s};h=this.getBinding(),u=h.createProjectionLayer(Se),i.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),T=new hn(u.textureWidth,u.textureHeight,{format:bn,type:Sn,depthTexture:new pi(u.textureWidth,u.textureHeight,Ce,void 0,void 0,void 0,void 0,void 0,void 0,ye),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1,storeMultisampledDepthBuffer:u.ignoreDepthValues===!1,storeMultisampledStencilBuffer:u.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await i.requestReferenceSpace(a),be.setContext(i),be.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function B(Z){for(let ne=0;ne<Z.removed.length;ne++){let ye=Z.removed[ne],Ce=E.indexOf(ye);if(Ce>=0)E[Ce]=null,b[Ce].disconnect(ye)}for(let ne=0;ne<Z.added.length;ne++){let ye=Z.added[ne],Ce=E.indexOf(ye);if(Ce===-1){for(let Se=0;Se<b.length;Se++)if(Se>=E.length){E.push(ye),Ce=Se;break}else if(E[Se]===null){E[Se]=ye,Ce=Se;break}if(Ce===-1)break}let Ie=b[Ce];if(Ie)Ie.connect(ye)}}function ae(Z,ne){if(ne===null)Z.matrixWorld.copy(Z.matrix);else Z.matrixWorld.multiplyMatrices(ne.matrixWorld,Z.matrix);Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let{near:ne,far:ye}=Z;if(y.texture!==null){if(y.depthNear>0)ne=y.depthNear;if(y.depthFar>0)ye=y.depthFar}if(H.near=z.near=P.near=ne,H.far=z.far=P.far=ye,Q!==H.near||C!==H.far)i.updateRenderState({depthNear:H.near,depthFar:H.far}),Q=H.near,C=H.far;H.layers.mask=Z.layers.mask|6,P.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Ce=Z.parent,Ie=H.cameras;ae(H,Ce);for(let Se=0;Se<Ie.length;Se++)ae(Ie[Se],Ce);if(H.projectionMatrix.copy(P.projectionMatrix),H.projectionMatrixInverse.copy(P.projectionMatrixInverse),S===null&&Z.isPerspectiveCamera)S={camera:Z,fov:Z.fov,zoom:Z.zoom};V(Z,H,Ce)};function V(Z,ne,ye){if(ye===null)Z.matrix.copy(ne.matrixWorld);else Z.matrix.copy(ye.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ne.matrixWorld);if(Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ne.projectionMatrix),Z.projectionMatrixInverse.copy(ne.projectionMatrixInverse),Z.isPerspectiveCamera)Z.fov=Ui*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1}this.getCamera=function(){return H},this.getFoveation=function(){if(u===null&&d===null)return;return o},this.setFoveation=function(Z){if(o=Z,u!==null)u.fixedFoveation=Z;if(d!==null&&d.fixedFoveation!==void 0)d.fixedFoveation=Z},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(H)},this.getCameraTexture=function(Z){return p[Z]};let j=null;function ie(Z,ne){if(c=ne.getViewerPose(l||r),f=ne,c!==null){let ye=c.views;if(d!==null)e.setRenderTargetFramebuffer(T,d.framebuffer),e.setRenderTarget(T);let Ce=!1;if(ye.length!==H.cameras.length)H.cameras.length=0,Ce=!0;for(let We=0;We<ye.length;We++){let Oe=ye[We],lt=null;if(d!==null)lt=d.getViewport(Oe);else{let dt=h.getViewSubImage(u,Oe);if(lt=dt.viewport,We===0)e.setRenderTargetTextures(T,dt.colorTexture,dt.depthStencilTexture),e.setRenderTarget(T)}let qe=N[We];if(qe===void 0)qe=new Dt,qe.layers.enable(We),qe.viewport=new tt,N[We]=qe;if(qe.matrix.fromArray(Oe.transform.matrix),qe.matrix.decompose(qe.position,qe.quaternion,qe.scale),qe.projectionMatrix.fromArray(Oe.projectionMatrix),qe.projectionMatrixInverse.copy(qe.projectionMatrix).invert(),qe.viewport.set(lt.x,lt.y,lt.width,lt.height),We===0)H.matrix.copy(qe.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale);if(Ce===!0)H.cameras.push(qe)}let Ie=i.enabledFeatures;if(Ie&&Ie.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=n.getBinding();let We=h.getDepthInformation(ye[0]);if(We&&We.isValid&&We.texture)y.init(We,i.renderState)}if(Ie&&Ie.includes("camera-access")&&_){e.state.unbindTexture(),h=n.getBinding();for(let We=0;We<ye.length;We++){let Oe=ye[We].camera;if(Oe){let lt=p[Oe];if(!lt)lt=new Ta,p[Oe]=lt;let qe=h.getCameraImage(Oe);lt.sourceTexture=qe}}}}for(let ye=0;ye<b.length;ye++){let Ce=E[ye],Ie=b[ye];if(Ce!==null&&Ie!==void 0)Ie.update(Ce,ne,l||r)}if(j)j(Z,ne);if(ne.detectedPlanes)n.dispatchEvent({type:"planesdetected",data:ne});f=null}let be=new Od;be.setAnimationLoop(ie),this.setAnimationLoop=function(Z){j=Z},this.dispose=function(){}}};pv=new Fe,ef=new Ne;ef.set(-1,0,0,0,1,0,0,0,1);_v=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183])});function mc(e,t){if(t===Nl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===ys||t===tr){let n=e.getIndex();if(n===null){let r=[],a=e.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);e.setIndex(r),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,s=[];if(t===ys)for(let r=1;r<=i;r++)s.push(n.getX(0)),s.push(n.getX(r)),s.push(n.getX(r+1));else for(let r=0;r<i;r++)if(r%2===0)s.push(n.getX(r)),s.push(n.getX(r+1)),s.push(n.getX(r+2));else s.push(n.getX(r+2)),s.push(n.getX(r+1)),s.push(n.getX(r));if(s.length/3!==i)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");return e.setIndex(s),e.clearGroups(),e}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var tf=On(()=>{As()});function nf(e){let t=new Map,n=new Map,i=e.clone();return sf(e,i,function(s,r){t.set(r,s),n.set(s,r)}),i.traverse(function(s){if(!s.isSkinnedMesh)return;let r=s,a=t.get(s),o=a.skeleton.bones;r.skeleton=a.skeleton.clone(),r.bindMatrix.copy(a.bindMatrix),r.skeleton.bones=o.map(function(l){return n.get(l)}),r.bind(r.skeleton,r.bindMatrix)}),i}function sf(e,t,n){n(e,t);for(let i=0;i<e.children.length;i++)sf(e.children[i],t.children[i],n)}var rf=()=>{};function vv(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function ut(e,t,n){let i=e.json.materials[t];if(i.extensions&&i.extensions[n])return i.extensions[n];return null}class hf{constructor(e){this.parser=e,this.name=Ge.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let s=t[n];if(s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0)e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l,c=new Ee(16777215);if(o.color!==void 0)c.setRGB(o.color[0],o.color[1],o.color[2],nn);let h=o.range!==void 0?o.range:0;switch(o.type){case"directional":l=new $i(c),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new La(c),l.distance=h;break;case"spot":l=new Pa(c),l.distance=h,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,l.angle=o.spot.outerConeAngle,l.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}if(l.position.set(0,0,0),Dn(l,o),o.intensity!==void 0)l.intensity=o.intensity;return l.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e!=="light")return;return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;if(a===void 0)return null;return this._loadLight(a).then(function(o){return n._getNodeRef(t.cache,a,o)})}}class uf{constructor(){this.name=Ge.KHR_MATERIALS_UNLIT}getMaterialType(){return Zn}extendParams(e,t,n){let i=[];e.color=new Ee(1,1,1),e.opacity=1;let s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){let r=s.baseColorFactor;e.color.setRGB(r[0],r[1],r[2],nn),e.opacity=r[3]}if(s.baseColorTexture!==void 0)i.push(n.assignTexture(e,"map",s.baseColorTexture,ln))}return Promise.all(i)}}class df{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();if(n.emissiveStrength!==void 0)t.emissiveIntensity=n.emissiveStrength;return Promise.resolve()}}class ff{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.clearcoatFactor!==void 0)t.clearcoat=n.clearcoatFactor;if(n.clearcoatTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture));if(n.clearcoatRoughnessFactor!==void 0)t.clearcoatRoughness=n.clearcoatRoughnessFactor;if(n.clearcoatRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture));if(n.clearcoatNormalTexture!==void 0){if(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0){let s=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ke(s,s)}}return Promise.all(i)}}class pf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_DIFFUSE_ROUGHNESS}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.diffuseRoughness=n.diffuseRoughnessFactor!==void 0?n.diffuseRoughnessFactor:0,n.diffuseRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"diffuseRoughnessMap",n.diffuseRoughnessTexture));return Promise.all(i)}}class mf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_DISPERSION}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();return t.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}}class gf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.iridescenceFactor!==void 0)t.iridescence=n.iridescenceFactor;if(n.iridescenceTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture));if(n.iridescenceIor!==void 0)t.iridescenceIOR=n.iridescenceIor;if(n.iridescenceThicknessMinimum!==void 0)t.iridescenceThicknessMinimum=n.iridescenceThicknessMinimum;if(n.iridescenceThicknessMaximum!==void 0)t.iridescenceThicknessMaximum=n.iridescenceThicknessMaximum;if(n.iridescenceThicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture));return Promise.all(i)}}class _f{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SHEEN}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.sheenColor=new Ee(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let s=n.sheenColorFactor;t.sheenColor.setRGB(s[0],s[1],s[2],nn)}if(n.sheenRoughnessFactor!==void 0)t.sheenRoughness=n.sheenRoughnessFactor;if(n.sheenColorTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,ln));if(n.sheenRoughnessTexture!==void 0)i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture));return Promise.all(i)}}class xf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.transmissionFactor!==void 0)t.transmission=n.transmissionFactor;if(n.transmissionTexture!==void 0)i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture));return Promise.all(i)}}class vf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_VOLUME}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0)i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture));t.attenuationDistance=n.attenuationDistance||1/0;let s=n.attenuationColor||[1,1,1];return t.attenuationColor=new Ee().setRGB(s[0],s[1],s[2],nn),Promise.all(i)}}class yf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_IOR}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();if(t.ior=n.ior!==void 0?n.ior:1.5,t.ior===0)t.ior=1000;return Promise.resolve()}}class Sf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_SPECULAR}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0)i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let s=n.specularColorFactor||[1,1,1];if(t.specularColor=new Ee().setRGB(s[0],s[1],s[2],nn),n.specularColorTexture!==void 0)i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,ln));return Promise.all(i)}}class bf{constructor(e){this.parser=e,this.name=Ge.EXT_MATERIALS_BUMP}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0)i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture));return Promise.all(i)}}class Mf{constructor(e){this.parser=e,this.name=Ge.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return ut(this.parser,e,this.name)!==null?Ft:null}extendMaterialParams(e,t){let n=ut(this.parser,e,this.name);if(n===null)return Promise.resolve();let i=[];if(n.anisotropyStrength!==void 0)t.anisotropy=n.anisotropyStrength;if(n.anisotropyRotation!==void 0)t.anisotropyRotation=n.anisotropyRotation;if(n.anisotropyTexture!==void 0)i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture));return Promise.all(i)}}class wf{constructor(e){this.parser=e,this.name=Ge.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let s=i.extensions[this.name],r=t.options.ktx2Loader;if(!r)if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return t.loadTextureImage(e,s.source,r)}}class Tf{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;let r=s.extensions[t],a=i.images[r.source],o=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);if(l!==null)o=l}return n.loadTextureImage(e,r.source,o)}}class Ef{constructor(e){this.parser=e,this.name=Ge.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;let r=s.extensions[t],a=i.images[r.source],o=n.textureLoader;if(a.uri){let l=n.options.manager.getHandler(a.uri);if(l!==null)o=l}return n.loadTextureImage(e,r.source,o)}}class vc{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported)if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return s.then(function(a){let o=i.byteOffset||0,l=i.byteLength||0,{count:c,byteStride:h}=i,u=new Uint8Array(a,o,l);if(r.decodeGltfBufferAsync)return r.decodeGltfBufferAsync(c,h,u,i.mode,i.filter).then(function(d){return d.buffer});else return r.ready.then(function(){let d=new ArrayBuffer(c*h);return r.decodeGltfBuffer(new Uint8Array(d),c,h,u,i.mode,i.filter),d})})}else return null}}class Af{constructor(e){this.name=Ge.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let i=t.meshes[n.mesh];for(let l of i.primitives)if(l.mode!==un.TRIANGLES&&l.mode!==un.TRIANGLE_STRIP&&l.mode!==un.TRIANGLE_FAN&&l.mode!==void 0)return null;let r=n.extensions[this.name].attributes,a=[],o={};for(let l in r)a.push(this.parser.getDependency("accessor",r[l]).then((c)=>(o[l]=c,o[l])));if(a.length<1)return null;return a.push(this.parser.createNodeMesh(e)),Promise.all(a).then((l)=>{let c=l.pop(),h=c.isGroup?c.children:[c],u=l[0].count,d=[];for(let f of h){let _=new Fe,y=new D,p=new cn,m=new D(1,1,1),M=new xa(f.geometry,f.material,u);for(let b=0;b<u;b++){if(o.TRANSLATION)y.fromBufferAttribute(o.TRANSLATION,b);if(o.ROTATION)p.fromBufferAttribute(o.ROTATION,b);if(o.SCALE)m.fromBufferAttribute(o.SCALE,b);M.setMatrixAt(b,_.compose(y,p,m))}let T=null;for(let b in o)if(b==="_COLOR_0"){let E=o[b];M.instanceColor=new li(E.array,E.itemSize,E.normalized)}else if(b!=="TRANSLATION"&&b!=="ROTATION"&&b!=="SCALE"){if(T===null){let A=M.geometry;T=new Yt,T.name=A.name;for(let g in A.attributes)T.setAttribute(g,A.attributes[g]);for(let g in A.morphAttributes)T.morphAttributes[g]=A.morphAttributes[g];if(A.index!==null)T.setIndex(A.index);T.morphTargetsRelative=A.morphTargetsRelative;for(let g of A.groups)T.addGroup(g.start,g.count,g.materialIndex);if(A.boundingBox!==null)T.boundingBox=A.boundingBox.clone();if(A.boundingSphere!==null)T.boundingSphere=A.boundingSphere.clone();T.drawRange.start=A.drawRange.start,T.drawRange.count=A.drawRange.count,T.userData=Object.assign({},A.userData),M.geometry=T}let E=o[b];T.setAttribute(b,new li(E.array,E.itemSize,E.normalized))}ot.prototype.copy.call(M,f),this.parser.assignFinalMaterial(M),d.push(M)}if(c.isGroup)return c.clear(),c.add(...d),c;return d[0]})}}class Cf{constructor(e){this.name=Ge.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,xr),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Rf)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let i=this.header.length-xr,s=new DataView(e,xr),r=0;while(r<i){let a=s.getUint32(r,!0);r+=4;let o=s.getUint32(r,!0);if(r+=4,o===af.JSON){let l=new Uint8Array(e,xr+r,a);this.content=n.decode(l)}else if(o===af.BIN){let l=xr+r;this.body=e.slice(l,l+a)}r+=a}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class If{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ge.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,a={},o={},l={};for(let c in r){let h=yc[c]||c.toLowerCase();a[h]=r[c]}for(let c in e.attributes){let h=yc[c]||c.toLowerCase();if(r[c]!==void 0){let u=n.accessors[e.attributes[c]],d=Rs[u.componentType];l[h]=d.name,o[h]=u.normalized===!0}}return t.getDependency("bufferView",s).then(function(c){return new Promise(function(h,u){i.decodeDracoFile(c,function(d){for(let f in d.attributes){let _=d.attributes[f],y=o[f];if(y!==void 0)_.normalized=y}h(d)},a,l,nn,u)})})}}class Pf{constructor(){this.name=Ge.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0)e.channel=t.texCoord;if(t.offset!==void 0)e.offset.fromArray(t.offset);if(t.rotation!==void 0)e.rotation=t.rotation;if(t.scale!==void 0)e.repeat.fromArray(t.scale);if(t.rotation!==void 0){let n=Math.cos(e.rotation),i=Math.sin(e.rotation);e.matrix.set(e.repeat.x*n,e.repeat.y*i,e.offset.x,-e.repeat.x*i,e.repeat.y*n,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}}class Lf{constructor(){this.name=Ge.KHR_MESH_QUANTIZATION}}function bv(e){if(e.DefaultMaterial===void 0)e.DefaultMaterial=new Pn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ci});return e.DefaultMaterial}function qi(e,t,n){for(let i in n.extensions)if(e[i]===void 0)t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i]}function Dn(e,t){if(t.extras!==void 0)if(typeof t.extras==="object")Object.assign(e.userData,t.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras)}function Mv(e,t,n){let i=!1,s=!1,r=!1;for(let c=0,h=t.length;c<h;c++){let u=t[c];if(u.POSITION!==void 0)i=!0;if(u.NORMAL!==void 0)s=!0;if(u.COLOR_0!==void 0)r=!0;if(i&&s&&r)break}if(!i&&!s&&!r)return Promise.resolve(e);let a=[],o=[],l=[];for(let c=0,h=t.length;c<h;c++){let u=t[c];if(i){let d=u.POSITION!==void 0?n.getDependency("accessor",u.POSITION):e.attributes.position;a.push(d)}if(s){let d=u.NORMAL!==void 0?n.getDependency("accessor",u.NORMAL):e.attributes.normal;o.push(d)}if(r){let d=u.COLOR_0!==void 0?n.getDependency("accessor",u.COLOR_0):e.attributes.color;l.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(c){let h=c[0],u=c[1],d=c[2];if(i)e.morphAttributes.position=h;if(s)e.morphAttributes.normal=u;if(r)e.morphAttributes.color=d;return e.morphTargetsRelative=!0,e})}function wv(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let i=0,s=n.length;i<s;i++)e.morphTargetDictionary[n[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Tv(e){let t,n=e.extensions&&e.extensions[Ge.KHR_DRACO_MESH_COMPRESSION];if(n)t="draco:"+n.bufferView+":"+n.indices+":"+xc(n.attributes);else t=e.indices+":"+xc(e.attributes)+":"+e.mode;if(e.targets!==void 0)for(let i=0,s=e.targets.length;i<s;i++)t+=":"+xc(e.targets[i]);return t}function xc(e){let t="",n=Object.keys(e).sort();for(let i=0,s=n.length;i<s;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Sc(e){switch(e){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ev(e){if(e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0)return"image/webp";if(e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}class Df{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new vv,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,r=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;let o=a.match(/Version\/(\d+)/);i=n&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,r=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||n&&i<17||s&&r<98)this.textureLoader=new Ra(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache);else this.textureLoader=new Na(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ur(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType("arraybuffer"),this.options.withCredentials||this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){let a={scene:r[0][i.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:i.asset,parser:n,userData:{}};return qi(s,a,i),Dn(a,i),Promise.all(n._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(let o of a.scenes)o.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){let r=t[i].joints;for(let a=0,o=r.length;a<o;a++)e[r[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){let r=e[i];if(r.mesh!==void 0){if(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0)n[r.mesh].isSkinnedMesh=!0}if(r.camera!==void 0)this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){if(t===void 0)return;if(e.refs[t]===void 0)e.refs[t]=e.uses[t]=0;e.refs[t]++}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),s=(r,a)=>{let o=this.associations.get(r);if(o!=null)this.associations.set(a,o);for(let[l,c]of r.children.entries())s(c,a.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let s=e(t[i]);if(s)n.push(s)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Ge.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(s,r){n.load(yi.resolveURL(t.uri,i.path),s,void 0,function(){r(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){let r=gc[i.type],a=Rs[i.componentType],o=i.normalized===!0,l=new a(i.count*r);return Promise.resolve(new pt(l,r,o))}let s=[];if(i.bufferView!==void 0)s.push(this.getDependency("bufferView",i.bufferView));else s.push(null);if(i.sparse!==void 0)s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView));return Promise.all(s).then(function(r){let a=r[0],o=gc[i.type],l=Rs[i.componentType],c=l.BYTES_PER_ELEMENT,h=c*o,u=i.byteOffset||0,d=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,f=i.normalized===!0,_,y;if(d&&d!==h){let p=Math.floor(u/d),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,M=t.cache.get(m);if(!M)_=new l(a,p*d,i.count*d/c),M=new rr(_,d/c),t.cache.add(m,M);y=new Ss(M,o,u%d/c,f)}else{if(a===null)_=new l(i.count*o);else _=new l(a,u,i.count*o);y=new pt(_,o,f)}if(i.sparse!==void 0){let p=gc.SCALAR,m=Rs[i.sparse.indices.componentType],M=i.sparse.indices.byteOffset||0,T=i.sparse.values.byteOffset||0,b=new m(r[1],M,i.sparse.count*p),E=new l(r[2],T,i.sparse.count*o);if(a!==null)y=new pt(y.array.slice(),y.itemSize,y.normalized);y.normalized=!1;for(let A=0,g=b.length;A<g;A++){let S=b[A];if(y.setX(S,E[A*o]),o>=2)y.setY(S,E[A*o+1]);if(o>=3)y.setZ(S,E[A*o+2]);if(o>=4)y.setW(S,E[A*o+3]);if(o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}y.normalized=f}return y})}loadTexture(e){let t=this.json,n=this.options,s=t.textures[e].source,r=t.images[s],a=this.textureLoader;if(r.uri){let o=n.manager.getHandler(r.uri);if(o!==null)a=o}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){let i=this,s=this.json,r=s.textures[e],a=s.images[t],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,n).then(function(c){if(c.flipY=!1,c.name=r.name||a.name||"",c.name===""&&typeof a.uri==="string"&&a.uri.startsWith("data:image/")===!1)c.name=a.uri;let u=(s.samplers||{})[r.sampler]||{};return c.magFilter=of[u.magFilter]||mt,c.minFilter=of[u.minFilter]||tn,c.wrapS=lf[u.wrapS]||hi,c.wrapT=lf[u.wrapT]||hi,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==yn&&c.minFilter!==mt,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then((u)=>u.clone());let r=i.images[e],a=self.URL||self.webkitURL,o=r.uri||"",l=!1,c;if(t.isKTX2Loader===!0&&r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(u){return new Promise(function(d,f){t.parse(u,d,f)})});else{if(r.bufferView!==void 0)o=n.getDependency("bufferView",r.bufferView).then(function(u){l=!0;let d=new Blob([u],{type:r.mimeType});return o=a.createObjectURL(d),o});else if(r.uri===void 0)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");c=Promise.resolve(o).then(function(u){return new Promise(function(d,f){let _=d;if(t.isImageBitmapLoader===!0)_=function(y){let p=new ft(y);p.needsUpdate=!0,d(p)};t.load(yi.resolveURL(u,s.path),_,void 0,f)})})}let h=c.then(function(u){if(l===!0)a.revokeObjectURL(o);return Dn(u,r),u.userData.mimeType=r.mimeType||Ev(r.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){let s=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0)r=r.clone(),r.channel=n.texCoord;if(s.extensions[Ge.KHR_TEXTURE_TRANSFORM]){let a=n.extensions!==void 0?n.extensions[Ge.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let o=s.associations.get(r);r=s.extensions[Ge.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),s.associations.set(r,o)}}if(i!==void 0)r.colorSpace=i;return e[t]=r,r})}assignFinalMaterial(e){let{geometry:t,material:n}=e,i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,o=this.cache.get(a);if(!o)o=new cr,rn.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,o.sizeAttenuation=!1,this.cache.add(a,o);n=o}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,o=this.cache.get(a);if(!o)o=new lr,rn.prototype.copy.call(o,n),o.color.copy(n.color),o.map=n.map,this.cache.add(a,o);n=o}if(i||s||r){let a="ClonedMaterial:"+n.uuid+":";if(i)a+="derivative-tangents:";if(s)a+="vertex-colors:";if(r)a+="flat-shading:";let o=this.cache.get(a);if(!o){if(o=n.clone(),s)o.vertexColors=!0;if(r)o.flatShading=!0;if(i){if(o.normalScale)o.normalScale.y*=-1;if(o.clearcoatNormalScale)o.clearcoatNormalScale.y*=-1}this.cache.add(a,o),this.associations.set(o,this.associations.get(n))}n=o}e.material=n}getMaterialType(){return Pn}loadMaterial(e){let t=this,n=this.json,i=this.extensions,s=n.materials[e],r,a={},o=s.extensions||{},l=[];if(o[Ge.KHR_MATERIALS_UNLIT]){let h=i[Ge.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),l.push(h.extendParams(a,s,t))}else{let h=s.pbrMetallicRoughness||{};if(a.color=new Ee(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let u=h.baseColorFactor;a.color.setRGB(u[0],u[1],u[2],nn),a.opacity=u[3]}if(h.baseColorTexture!==void 0)l.push(t.assignTexture(a,"map",h.baseColorTexture,ln));if(a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0)l.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture));r=this._invokeOne(function(u){return u.getMaterialType&&u.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(u){return u.extendMaterialParams&&u.extendMaterialParams(e,a)})))}if(s.doubleSided===!0)a.side=$t;let c=s.alphaMode||_c.OPAQUE;if(c===_c.BLEND)a.transparent=!0,a.depthWrite=!1;else if(a.transparent=!1,c===_c.MASK)a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:0.5;if(s.normalTexture!==void 0&&r!==Zn){if(l.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new ke(1,1),s.normalTexture.scale!==void 0){let h=s.normalTexture.scale;a.normalScale.set(h,h)}}if(s.occlusionTexture!==void 0&&r!==Zn){if(l.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0)a.aoMapIntensity=s.occlusionTexture.strength}if(s.emissiveFactor!==void 0&&r!==Zn){let h=s.emissiveFactor;a.emissive=new Ee().setRGB(h[0],h[1],h[2],nn)}if(s.emissiveTexture!==void 0&&r!==Zn)l.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,ln));return Promise.all(l).then(function(){let h=new r(a);if(s.name)h.name=s.name;if(Dn(h,s),t.associations.set(h,{materials:e}),s.extensions)qi(i,h,s);return h})}createUniqueName(e){let t=Je.sanitizeNodeName(e||"");if(t in this.nodeNamesUsed)return t+"_"+ ++this.nodeNamesUsed[t];else return this.nodeNamesUsed[t]=0,t}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[Ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(o){return cf(o,a,t)})}let r=[];for(let a=0,o=e.length;a<o;a++){let l=e[a],c=Tv(l),h=i[c];if(h)r.push(h.promise);else{let u;if(l.extensions&&l.extensions[Ge.KHR_DRACO_MESH_COMPRESSION])u=s(l);else u=cf(new Yt,l,t);if(l.mode===un.TRIANGLE_STRIP)u=u.then((d)=>mc(d,tr));else if(l.mode===un.TRIANGLE_FAN)u=u.then((d)=>mc(d,ys));i[c]={primitive:l,promise:u},r.push(u)}}return Promise.all(r)}loadMesh(e){let t=this,n=this.json,i=this.extensions,s=n.meshes[e],r=s.primitives,a=[];for(let o=0,l=r.length;o<l;o++){let c=r[o].material===void 0?bv(this.cache):this.getDependency("material",r[o].material);a.push(c)}return a.push(t.loadGeometries(r)),Promise.all(a).then(async function(o){let l=o.slice(0,o.length-1),c=o[o.length-1],h=[];for(let d=0,f=c.length;d<f;d++){let _=c[d],y=r[d],p,m=l[d];if(y.mode===un.TRIANGLES||y.mode===un.TRIANGLE_STRIP||y.mode===un.TRIANGLE_FAN||y.mode===void 0){let M=s.isSkinnedMesh===!0,T=_.hasAttribute("skinIndex")&&_.hasAttribute("skinWeight");if(M&&T===!1)console.warn("THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled.");if(p=M&&T?new _a(_,m):new yt(_,m),p.isSkinnedMesh===!0)p.normalizeSkinWeights()}else if(y.mode===un.LINES)p=new ya(_,m);else if(y.mode===un.LINE_STRIP)p=new bs(_,m);else if(y.mode===un.LINE_LOOP)p=new Sa(_,m);else if(y.mode===un.POINTS)p=new ba(_,m);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+y.mode);if(Object.keys(p.geometry.morphAttributes).length>0)wv(p,s);if(p.name=t.createUniqueName(s.name||"mesh_"+e),Dn(p,s),y.extensions)qi(i,p,y);t.assignFinalMaterial(p),h.push(p)}for(let d=0,f=h.length;d<f;d++)t.associations.set(h[d],{meshes:e,primitives:d});if(h.length===1){if(s.extensions)qi(i,h[0],s);return h[0]}let u=new En;if(s.extensions)qi(i,u,s);t.associations.set(u,{meshes:e});for(let d=0,f=h.length;d<f;d++)u.add(h[d]);return u})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if(n.type==="perspective")t=new Dt(fi.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2000000);else if(n.type==="orthographic")t=new vi(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar);if(n.name)t.name=this.createUniqueName(n.name);return Dn(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));if(t.inverseBindMatrices!==void 0)n.push(this.getDependency("accessor",t.inverseBindMatrices));else n.push(null);return Promise.all(n).then(function(i){let s=i.pop(),r=i,a=[],o=[];for(let l=0,c=r.length;l<c;l++){let h=r[l];if(h){a.push(h);let u=new Fe;if(s!==null)u.fromArray(s.array,l*16);o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new or(a,o)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,r=[],a=[],o=[],l=[],c=[];for(let h=0,u=i.channels.length;h<u;h++){let d=i.channels[h],f=i.samplers[d.sampler],_=d.target,y=_.node,p=i.parameters!==void 0?i.parameters[f.input]:f.input,m=i.parameters!==void 0?i.parameters[f.output]:f.output;if(_.node===void 0)continue;r.push(this.getDependency("node",y)),a.push(this.getDependency("accessor",p)),o.push(this.getDependency("accessor",m)),l.push(f),c.push(_)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(h){let u=h[0],d=h[1],f=h[2],_=h[3],y=h[4],p=[];for(let M=0,T=u.length;M<T;M++){let b=u[M],E=d[M],A=f[M],g=_[M],S=y[M];if(b===void 0)continue;if(b.updateMatrix)b.updateMatrix();let P=n._createAnimationTracks(b,E,A,g,S);if(P)for(let z=0;z<P.length;z++)p.push(P[z])}let m=new Aa(s,void 0,p);return Dn(m,i),m})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];if(i.mesh===void 0)return null;return n.getDependency("mesh",i.mesh).then(function(s){let r=n._getNodeRef(n.meshCache,i.mesh,s);if(i.weights!==void 0)r.traverse(function(a){if(!a.isMesh)return;for(let o=0,l=i.weights.length;o<l;o++)a.morphTargetInfluences[o]=i.weights[o]});return r})}loadNode(e){let t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),r=[],a=i.children||[];for(let l=0,c=a.length;l<c;l++)r.push(n.getDependency("node",a[l]));let o=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(r),o]).then(function(l){let c=l[0],h=l[1],u=l[2];if(u!==null)c.traverse(function(d){if(!d.isSkinnedMesh)return;d.bind(u,Av)});for(let d=0,f=h.length;d<f;d++)c.add(h[d]);if(c.userData.pivot!==void 0&&h.length>0){let d=c.userData.pivot,f=h[0];c.pivot=new D().fromArray(d),c.position.x-=d[0],c.position.y-=d[1],c.position.z-=d[2],f.position.set(0,0,0),delete c.userData.pivot}return c})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let s=t.nodes[e],r=s.name?i.createUniqueName(s.name):"",a=[],o=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});if(o)a.push(o);if(s.camera!==void 0)a.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)}));return i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let c;if(s.isBone===!0)c=new ar;else if(l.length>1)c=new En;else if(l.length===1)c=l[0];else c=new ot;if(c!==l[0])for(let h=0,u=l.length;h<u;h++)c.add(l[h]);if(s.name)c.userData.name=s.name,c.name=r;if(Dn(c,s),s.extensions)qi(n,c,s);if(s.matrix!==void 0){let h=new Fe;h.fromArray(s.matrix),c.applyMatrix4(h)}else{if(s.translation!==void 0)c.position.fromArray(s.translation);if(s.rotation!==void 0)c.quaternion.fromArray(s.rotation);if(s.scale!==void 0)c.scale.fromArray(s.scale)}if(!i.associations.has(c))i.associations.set(c,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){let h=i.associations.get(c);i.associations.set(c,{...h})}return i.associations.get(c).nodes=e,c}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,s=new En;if(n.name)s.name=i.createUniqueName(n.name);if(Dn(s,n),n.extensions)qi(t,s,n);let r=n.nodes||[],a=[];for(let o=0,l=r.length;o<l;o++)a.push(i.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let c=0,h=o.length;c<h;c++){let u=o[c];if(u.parent!==null)s.add(nf(u));else s.add(u)}let l=(c)=>{let h=new Map;for(let[u,d]of i.associations)if(u instanceof rn||u instanceof ft)h.set(u,d);return c.traverse((u)=>{let d=i.associations.get(u);if(d!=null)h.set(u,d)}),h};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){let r=[],a=e.name?e.name:e.uuid,o=[];function l(d){if(d.morphTargetInfluences)o.push(d.name?d.name:d.uuid)}if(Si[s.path]===Si.weights){if(l(e),e.isGroup)e.children.forEach(l)}else o.push(a);let c;switch(Si[s.path]){case Si.weights:c=gi;break;case Si.rotation:c=_i;break;case Si.translation:case Si.scale:c=Xi;break;default:switch(n.itemSize){case 1:c=gi;break;case 2:case 3:default:c=Xi;break}break}let h=i.interpolation!==void 0?Sv[i.interpolation]:ha,u=this._getArrayFromAccessor(n);for(let d=0,f=o.length;d<f;d++){let _=new c(o[d]+"."+Si[s.path],t.array,u,h);if(i.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(_);r.push(_)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let n=Sc(t.constructor),i=new Float32Array(t.length);for(let s=0,r=t.length;s<r;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){return new(this instanceof _i?Nf:Mc)(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Rv(e,t,n){let i=t.attributes,s=new qt;if(i.POSITION!==void 0){let o=n.json.accessors[i.POSITION],{min:l,max:c}=o;if(l!==void 0&&c!==void 0){if(s.set(new D(l[0],l[1],l[2]),new D(c[0],c[1],c[2])),o.normalized){let h=Sc(Rs[o.componentType]);s.min.multiplyScalar(h),s.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let r=t.targets;if(r!==void 0){let o=new D,l=new D;for(let c=0,h=r.length;c<h;c++){let u=r[c];if(u.POSITION!==void 0){let d=n.json.accessors[u.POSITION],{min:f,max:_}=d;if(f!==void 0&&_!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(_[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(_[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(_[2]))),d.normalized){let y=Sc(Rs[d.componentType]);l.multiplyScalar(y)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(o)}e.boundingBox=s;let a=new sn;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,e.boundingSphere=a}function cf(e,t,n){let i=t.attributes,s=[];function r(a,o){return n.getDependency("accessor",a).then(function(l){e.setAttribute(o,l)})}for(let a in i){let o=yc[a]||a.toLowerCase();if(o in e.attributes)continue;s.push(r(i[a],o))}if(t.indices!==void 0&&!e.index){let a=n.getDependency("accessor",t.indices).then(function(o){e.setIndex(o)});s.push(a)}if(He.workingColorSpace!==nn&&"COLOR_0"in i)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${He.workingColorSpace}" not supported.`);return Dn(e,t),Rv(e,t,n),Promise.all(s).then(function(){return t.targets!==void 0?Mv(e,t.targets,n):e})}var bc,Ge,Rf="glTF",xr=12,af,Mc,yv,Nf,un,Rs,of,lf,gc,yc,Si,Sv,_c,Av;var Uf=On(()=>{As();tf();rf();bc=class bc extends jn{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new ff(t)}),this.register(function(t){return new pf(t)}),this.register(function(t){return new mf(t)}),this.register(function(t){return new wf(t)}),this.register(function(t){return new Tf(t)}),this.register(function(t){return new Ef(t)}),this.register(function(t){return new _f(t)}),this.register(function(t){return new xf(t)}),this.register(function(t){return new vf(t)}),this.register(function(t){return new yf(t)}),this.register(function(t){return new df(t)}),this.register(function(t){return new Sf(t)}),this.register(function(t){return new gf(t)}),this.register(function(t){return new Mf(t)}),this.register(function(t){return new bf(t)}),this.register(function(t){return new hf(t)}),this.register(function(t){return new vc(t,Ge.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new vc(t,Ge.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Af(t)})}load(e,t,n,i){let s=this,r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){let l=yi.extractUrlBase(e);r=yi.resolveURL(l,this.path)}else r=yi.extractUrlBase(e);this.manager.itemStart(e);let a=function(l){if(i)i(l);else console.error(l);s.manager.itemError(e),s.manager.itemEnd(e)},o=new ur(this.manager);o.setPriority(this.priority),o.setCache(this.cache),o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{s.parse(l,r,function(c){t(c),s.manager.itemEnd(e)},a)}catch(c){a(c)}},n,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){if(this.pluginCallbacks.indexOf(e)===-1)this.pluginCallbacks.push(e);return this}unregister(e){if(this.pluginCallbacks.indexOf(e)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1);return this}parse(e,t,n,i){let s,r={},a={},o=new TextDecoder;if(typeof e==="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===Rf){try{r[Ge.KHR_BINARY_GLTF]=new Cf(e)}catch(h){if(i)i(h);return}s=JSON.parse(r[Ge.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){if(i)i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new Df(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){let h=this.pluginCallbacks[c](l);if(!h.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");a[h.name]=h,r[h.name]=!0}if(s.extensionsUsed)for(let c=0;c<s.extensionsUsed.length;++c){let h=s.extensionsUsed[c],u=s.extensionsRequired||[];switch(h){case Ge.KHR_MATERIALS_UNLIT:r[h]=new uf;break;case Ge.KHR_DRACO_MESH_COMPRESSION:r[h]=new If(s,this.dracoLoader);break;case Ge.KHR_TEXTURE_TRANSFORM:r[h]=new Pf;break;case Ge.KHR_MESH_QUANTIZATION:r[h]=new Lf;break;default:if(u.indexOf(h)>=0&&a[h]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(r),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}};Ge={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DIFFUSE_ROUGHNESS:"KHR_materials_diffuse_roughness",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};af={JSON:1313821514,BIN:5130562};Mc=class Mc extends Jn{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let r=0;r!==i;r++)t[r]=n[s+r];return t}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,l=a*3,c=i-t,h=(n-t)/c,u=h*h,d=u*h,f=e*l,_=f-l,y=-2*d+3*u,p=d-u,m=1-y,M=p-u+h;for(let T=0;T!==a;T++){let b=r[_+T+a],E=r[_+T+o]*c,A=r[f+T+a],g=r[f+T]*c;s[T]=m*b+M*E+y*A+p*g}return s}};yv=new cn;Nf=class Nf extends Mc{interpolate_(e,t,n,i){let s=super.interpolate_(e,t,n,i);return yv.fromArray(s).normalize().toArray(s),s}};un={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Rs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},of={9728:yn,9729:mt,9984:ia,9985:xs,9986:Bi,9987:tn},lf={33071:_s,33648:na,10497:hi},gc={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},yc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Si={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Sv={CUBICSPLINE:void 0,LINEAR:ha,STEP:Ll},_c={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};Av=new Fe});var Tc=(e)=>e.bids.find((t)=>t.status==="leading");class Ec{yaw={offset:0,velocity:0};pitch={offset:0,velocity:0};flutter={offset:0,velocity:0};turn(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return;this.yaw.velocity=Cs(this.yaw.velocity-Cs(e,1)*5.5,9),this.pitch.velocity=Cs(this.pitch.velocity-Cs(t,1)*4,7),this.flutter.velocity=Cs(this.flutter.velocity+Math.min(Math.hypot(e,t),1)*3,6)}advance(e){if(!Number.isFinite(e)||e<0||e>0.25)return this.reset(),!1;let t=e;while(t>0){let i=Math.min(t,0.008333333333333333);this.integrate(this.yaw,i,75,9,0.34),this.integrate(this.pitch,i,90,10,0.24),this.integrate(this.flutter,i,220,8,0.22),t-=i}let n=[this.yaw,this.pitch,this.flutter].some((i)=>Math.abs(i.offset)>0.0001||Math.abs(i.velocity)>0.001);if(!n)this.reset();return n}reset(){for(let e of[this.yaw,this.pitch,this.flutter])e.offset=0,e.velocity=0}integrate(e,t,n,i,s){if(e.velocity+=(-n*e.offset-i*e.velocity)*t,e.offset+=e.velocity*t,Math.abs(e.offset)>s)e.offset=Cs(e.offset,s),e.velocity=0}}class Ac{geometry;rest;restNormals;normalCorrections;weights;ripples;height;deformed=!1;constructor(e){this.geometry=e;let t=e.getAttribute("position");if(!e.getAttribute("normal"))e.computeVertexNormals();let n=e.getAttribute("normal");this.rest=new Float32Array(t.count*3),this.restNormals=new Float32Array(n.count*3),this.normalCorrections=new Float32Array(n.count*3),this.weights=new Float32Array(t.count),this.ripples=new Float32Array(t.count),e.computeBoundingBox(),e.computeBoundingSphere();let i=e.boundingBox;this.height=Math.max(i.max.y-i.min.y,0.001);let s=Math.max(Math.abs(i.min.x),Math.abs(i.max.x),0.001);for(let r=0;r<t.count;r++){let a=t.getX(r),o=t.getY(r),l=t.getZ(r);this.rest.set([a,o,l],r*3),this.restNormals.set([n.getX(r),n.getY(r),n.getZ(r)],r*3);let c=(i.max.y-o)/this.height,h=fi.smoothstep(c,0.25,1),u=fi.smoothstep(Math.abs(a)/s,0.58,1)*fi.smoothstep(c,0.06,0.28);this.weights[r]=Math.max(h*h,u*0.8),this.ripples[r]=Math.sin(a/s*8+c*5)*(h**3+u*0.7)}e.computeVertexNormals();for(let r=0;r<n.count;r++)this.normalCorrections[r*3]=this.restNormals[r*3]-n.getX(r),this.normalCorrections[r*3+1]=this.restNormals[r*3+1]-n.getY(r),this.normalCorrections[r*3+2]=this.restNormals[r*3+2]-n.getZ(r),n.setXYZ(r,this.restNormals[r*3],this.restNormals[r*3+1],this.restNormals[r*3+2]);if(e.boundingBox.expandByScalar(this.height*0.35),e.boundingSphere.radius+=this.height*0.35,t instanceof pt)t.setUsage(ua);if(n instanceof pt)n.setUsage(ua)}apply(e){let t=this.geometry.getAttribute("position");for(let i=0;i<t.count;i++){let s=this.rest[i*3],r=this.rest[i*3+1],a=this.rest[i*3+2],o=this.weights[i],l=e.yaw.offset*o,c=Math.cos(l),h=Math.sin(l),u=e.flutter.offset*this.height*0.13*this.ripples[i];t.setXYZ(i,s*c+a*h+e.yaw.offset*this.height*0.12*o,r+Math.abs(l)*this.height*0.025*o+u*0.25,a*c-s*h+e.pitch.offset*this.height*0.4*o+u)}t.needsUpdate=!0,this.geometry.computeVertexNormals();let n=this.geometry.getAttribute("normal");for(let i=0;i<n.count;i++){let s=n.getX(i)+this.normalCorrections[i*3],r=n.getY(i)+this.normalCorrections[i*3+1],a=n.getZ(i)+this.normalCorrections[i*3+2],o=Math.hypot(s,r,a)||1;n.setXYZ(i,s/o,r/o,a/o)}this.deformed=!0}restore(){if(!this.deformed)return;let e=this.geometry.getAttribute("position"),t=this.geometry.getAttribute("normal");for(let n=0;n<e.count;n++)e.setXYZ(n,this.rest[n*3],this.rest[n*3+1],this.rest[n*3+2]),t.setXYZ(n,this.restNormals[n*3],this.restNormals[n*3+1],this.restNormals[n*3+2]);e.needsUpdate=t.needsUpdate=!0,this.deformed=!1}}var Cs=(e,t)=>Math.max(-t,Math.min(t,e));var Ff=On(()=>{As()});function Of(e){let t=Math.max(1,Math.round(e.length*0.02)),n=0,i=Math.round(e.length*0.42);for(let s=Math.round(e.length*0.22);s<e.length*0.6;s++){let r=e[Math.max(0,s-t)],a=e[Math.min(e.length-1,s+t)],o=r.right-r.left-(a.right-a.left);if(o>n)n=o,i=s}return i/(e.length-1)}function Bf(e,t,n){return e<=t?e/t*n:n+(e-t)/(1-t)*(1-n)}function kf(e,t,n,i,s,r=[]){e.clearRect(0,0,i*2,s);for(let[a,o]of["front","back"].entries()){let l=t?.[o],c=l&&n.get(l.url);if(!l||!c?.complete||!c.naturalWidth)continue;let h=Math.min(i/c.naturalWidth,s/c.naturalHeight)*l.scale,u=c.naturalWidth*h,d=c.naturalHeight*h;if(e.save(),e.beginPath(),e.rect(a*i,0,i,s),e.clip(),l.photo&&r.length){e.translate(a*i+i/2+l.x*i/100,s/2+l.y*s/100),e.scale(l.scale,l.scale);let f=Of(r),_=r[Math.round(r.length*0.58)];for(let y=0;y<r.length;y++){let p=r[y],m=o==="front"?p.left:1-p.right,M=o==="front"?p.right:1-p.left,T=y/r.length,b=o==="front"?_.left:1-_.right,E=o==="front"?_.right:1-_.left,A=[[0,0.25,m,b],[0.25,0.5,b,E],[0.75,0.25,E,M]];for(let[g,S,P,z]of A){if(z<=P)continue;e.drawImage(c,g*c.naturalWidth,Bf(T,f,0.42)*(c.naturalHeight-1),S*c.naturalWidth,c.naturalHeight/r.length,(P-0.5)*i-2,(T-0.5)*s,(z-P)*i+4,s/r.length+1)}}e.restore();continue}e.drawImage(c,a*i+(i-u)/2+l.x*i/100,(s-d)/2+l.y*s/100,u,d),e.restore()}}var zf=()=>{};class Rc{silhouette=[];canvas=document.createElement("canvas");texture=new Ms(this.canvas);uniforms={wodiraArtworkMap:{value:this.texture},wodiraArtworkEnabled:{value:!1},wodiraFrontFabricColor:{value:new Ee},wodiraBackFabricColor:{value:new Ee}};constructor(e){e.updateMatrixWorld(!0);let t=e.matrixWorld.clone().invert(),n=new qt,i=[];e.traverse((a)=>{if(!(a instanceof yt))return;let o=a.geometry.getAttribute("position"),l=t.clone().multiply(a.matrixWorld);if(!a.geometry.hasAttribute("normal"))a.geometry.computeVertexNormals();let c=a.geometry.getAttribute("normal"),h=new Ne().getNormalMatrix(l),u=Array.from({length:c.count},(f,_)=>new D().fromBufferAttribute(c,_).applyNormalMatrix(h).z),d=Array.from({length:o.count},(f,_)=>{let y=new D().fromBufferAttribute(o,_).applyMatrix4(l);return n.expandByPoint(y),y});i.push({mesh:a,positions:d,facing:u})});let s=n.getSize(new D),r=512;this.silhouette=Array.from({length:r},()=>({left:1,right:0}));for(let{mesh:a,positions:o}of i){let l=a.geometry.index,c=l?.count??o.length;for(let h=0;h<c;h+=3){let u=[0,1,2].map((d)=>o[l?l.getX(h+d):h+d]);for(let d=0;d<3;d++){let f=u[d],_=u[(d+1)%3],y=(n.max.y-f.y)/s.y*r,p=(n.max.y-_.y)/s.y*r;if(Math.abs(p-y)<0.00001)continue;let m=Math.max(0,Math.ceil(Math.min(y,p)-0.5)),M=Math.min(r-1,Math.floor(Math.max(y,p)-0.5));for(let T=m;T<=M;T++){let b=(T+0.5-y)/(p-y),E=(f.x+(_.x-f.x)*b-n.min.x)/s.x,A=this.silhouette[T];A.left=Math.min(A.left,E),A.right=Math.max(A.right,E)}}}}for(let a=0;a<r;a++)if(this.silhouette[a].right<=this.silhouette[a].left)this.silhouette[a]={...this.silhouette[a-1]??{left:0,right:1}};this.canvas.width=2048,this.canvas.height=Math.min(2048,Math.max(1,Math.round(1024*s.y/s.x))),this.texture.colorSpace=ln,this.texture.flipY=!1,this.texture.generateMipmaps=!1,this.texture.minFilter=mt;for(let{mesh:a,positions:o,facing:l}of i){let c=new Float32Array(o.length*3);o.forEach((h,u)=>{c[u*3]=(h.x-n.min.x)/s.x,c[u*3+1]=(n.max.y-h.y)/s.y,c[u*3+2]=l[u]}),a.geometry.setAttribute("wodiraArtworkUv",new pt(c,3));for(let h of Array.isArray(a.material)?a.material:[a.material]){if(!(h instanceof Pn))continue;h.onBeforeCompile=(u)=>{Object.assign(u.uniforms,this.uniforms),u.vertexShader=u.vertexShader.replace("#include <common>",`#include <common>
|
|
4226
4226
|
attribute vec3 wodiraArtworkUv;
|
|
4227
4227
|
varying vec3 vWodiraArtworkUv;`).replace("#include <begin_vertex>",`#include <begin_vertex>
|
|
4228
4228
|
vWodiraArtworkUv = wodiraArtworkUv;`),u.fragmentShader=u.fragmentShader.replace("#include <common>",`#include <common>
|
|
@@ -4259,10 +4259,10 @@ void main() {
|
|
|
4259
4259
|
`),u.fragmentShader=u.fragmentShader.replace("#include <lights_physical_fragment>",`#include <lights_physical_fragment>
|
|
4260
4260
|
#ifdef USE_SHEEN
|
|
4261
4261
|
if (wodiraArtworkEnabled) material.sheenColor = 0.3 * mix(diffuseColor.rgb, vec3(1.0), 0.35);
|
|
4262
|
-
#endif`)},h.customProgramCacheKey=()=>"wodira-artwork-continuous-sponsors-v3",h.needsUpdate=!0}}}update(e,t,n){this.uniforms.wodiraArtworkEnabled.value=!!(e?.front||e?.back);let i=e?.front?.fabricColor,s=e?.back?.fabricColor;this.uniforms.wodiraFrontFabricColor.value.copy(i||s?new Ee(i??s):n),this.uniforms.wodiraBackFabricColor.value.copy(s||i?new Ee(s??i):n);let r=this.canvas.getContext("2d");if(r)kf(r,e,t,this.canvas.width/2,this.canvas.height,this.silhouette);this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}}var Hf=On(()=>{As();zf()});class Cc{canvas;fail;recovering;renderer;scene=new pa;camera=new vi(-1,1,1.12,-1.12,0.1,20);model;observer;disposed=!1;loadController=new AbortController;contextUnavailable=!1;recoveryTimer;firstFrame;frame=0;textureDirty=!1;atlas=document.createElement("canvas");texture=new Ms(this.atlas);fabricTexture=this.createFabricTexture();fabricMaterials=[];images=new Map;slots=[];rotation=0;tilt=0;side="front";viewSurface;rotating=!1;zoom=1;shirtColor="#ffffff";showBidPrices=!1;artwork=null;artworkProjection;priceFormatter;palette;selectedSlotId=null;modelUrl;raycaster=new Da;cloth=new Ec;clothMeshes=[];clothActive=!1;lastFrameTime=0;reducedMotion=matchMedia("(prefers-reduced-motion: reduce)");constructor(e,t,n=()=>{},i={}){this.canvas=e;this.fail=t;this.recovering=n;this.modelUrl=new URL(i.modelUrl??Cv,document.baseURI),this.palette={...Gf,...i.palette},this.priceFormatter=this.createPriceFormatter(i.locale),this.atlas.width=2048,this.atlas.height=574,this.texture.generateMipmaps=!1,this.texture.minFilter=mt,this.texture.colorSpace=ln,this.texture.flipY=!1,this.renderer=new fc({canvas:e,alpha:!0,antialias:!0}),this.renderer.debug.onShaderError=()=>{throw Error("Shirt material shader unavailable")},this.renderer.toneMapping=Js,this.renderer.toneMappingExposure=1,this.renderer.setPixelRatio(Math.min(devicePixelRatio,matchMedia("(pointer: coarse)").matches?1.5:2)),this.fabricTexture.anisotropy=Math.min(4,this.renderer.capabilities.getMaxAnisotropy()),this.camera.position.z=5,this.scene.add(new Ca(16777215,7827851,2.3));let s=new $i(16777215,2.2);s.position.set(-3,4,5),this.scene.add(s);let r=new $i(16777215,1.6);r.position.set(3,2,-4),this.scene.add(r),this.observer=new ResizeObserver(()=>{if(this.disposed||this.contextUnavailable)return;try{let a=e.getBoundingClientRect();this.renderer.setSize(a.width,a.height,!1),this.render()}catch{this.fail()}}),this.observer.observe(e),e.addEventListener("webglcontextlost",this.contextLost),e.addEventListener("webglcontextrestored",this.contextRestored),this.reducedMotion.addEventListener("change",this.resetCloth),document.addEventListener("visibilitychange",this.resetCloth)}async load(){let e=this.modelUrl,t=await fetch(e,{signal:this.loadController.signal});if(!t.ok)throw Error(`Shirt model request failed (${t.status})`);let n=await t.arrayBuffer();this.loadController.signal.throwIfAborted();let i=await new bc().parseAsync(n,new URL(".",e).href);if(this.disposed){this.disposeModel(i.scene);return}this.model=i.scene,this.model.traverse((s)=>{if(!(s instanceof yt))return;this.clothMeshes.push(new Ac(s.geometry));let r=Array.isArray(s.material)?s.material:[s.material];for(let a of r){if(!(a instanceof Pn))continue;if(a.color.set(16777215),a.side=$t,a.metalness=0,a.roughness=1,a.roughnessMap=this.fabricTexture,a.bumpMap=this.fabricTexture,a.bumpScale=0.0012,a.map=this.texture,a instanceof Ft)a.sheen=0.3,a.sheenColorMap=null,a.sheenRoughness=1,a.specularIntensity=0.3,a.clearcoat=0,this.fabricMaterials.push(a)}}),this.scene.add(this.model),this.paint(),await new Promise((s,r)=>{this.firstFrame={resolve:s,reject:r},this.render()})}update(e,t,n,i="#ffffff",s=!1,r=null,a){if(this.slots=e,t!==this.side||a!==this.viewSurface)this.viewSurface=a,this.resetView();this.side=t,this.rotating=n,this.shirtColor=i,this.showBidPrices=s,this.artwork=r;let o=new Set([...e.map((l)=>l.isReserved?l.reservedLogo:Tc(l)?.logo),r?.front?.url,r?.back?.url].filter((l)=>!!l));for(let[l,c]of this.images)if(!o.has(l))c.onload=null,this.images.delete(l);for(let l of o)if(!this.images.has(l)){let c=new Image;if(/^https?:\/\//i.test(l))c.crossOrigin="anonymous";this.images.set(l,c),c.onload=()=>{if(!this.disposed)this.paint(),this.render()},c.src=l}this.paint(),this.render()}async snapshot(e="front"){return this.capture(e,"image/png")}async productionSnapshot(e){return this.capture(e,"image/webp")}async capture(e,t){if(!this.model||this.disposed||this.contextUnavailable)throw Error("Shirt renderer unavailable");if(await Promise.all([...this.images.values()].map((s)=>s.decode())),this.disposed||!this.model||this.contextUnavailable)throw Error("Shirt renderer unavailable");this.resetCloth(),this.paintNow();let n=this.model.rotation.clone(),i=this.camera.zoom;try{this.model.rotation.set(e==="top"?Math.PI/2:0,e==="back"?Math.PI:e==="left"?Math.PI/2:e==="right"?-Math.PI/2:0,0),this.camera.zoom=1,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera);let s=document.createElement("canvas");s.width=640,s.height=Math.round(640*this.renderer.domElement.height/this.renderer.domElement.width);let r=s.getContext("2d");if(!r)throw Error("Canvas unavailable");if(t==="image/webp")r.fillStyle="#ffffff",r.fillRect(0,0,s.width,s.height);return r.drawImage(this.renderer.domElement,0,0,s.width,s.height),await new Promise((a,o)=>s.toBlob((l)=>l?a(l):o(Error("Preview encoding failed")),t,t==="image/webp"?0.82:void 0))}finally{this.model.rotation.copy(n),this.camera.zoom=i,this.camera.updateProjectionMatrix(),this.render()}}setSelectedSlot(e){if(e===this.selectedSlotId)return;this.selectedSlotId=e,this.paint(),this.render()}setAppearance(e){if(e.palette)this.palette={...Gf,...e.palette};if(e.locale!==void 0)this.priceFormatter=this.createPriceFormatter(e.locale);this.paint(),this.render()}createPriceFormatter(e){let t={style:"currency",currency:"EUR",maximumFractionDigits:0};try{return new Intl.NumberFormat(e||document.documentElement.lang||"es-ES",t)}catch{return new Intl.NumberFormat("es-ES",t)}}rotate(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return;let n=this.tilt;if(this.rotation+=e*0.01,this.tilt=Math.max(-0.7,Math.min(0.7,this.tilt+t*0.008)),!this.reducedMotion.matches&&!document.hidden&&(e||this.tilt!==n))this.cloth.turn(e*0.01,this.tilt-n),this.clothActive=!0;this.render()}zoomBy(e){this.zoom=Math.max(0.7,Math.min(1.8,this.zoom+e)),this.render()}resetView(){this.rotation=this.viewSurface==="left-sleeve"?Math.PI/2:this.viewSurface==="right-sleeve"?-Math.PI/2:0,this.tilt=0,this.zoom=1,this.resetCloth()}surface(e,t){if(!this.model)return;let n=this.canvas.getBoundingClientRect();this.raycaster.setFromCamera(new ke((e-n.left)/n.width*2-1,-((t-n.top)/n.height)*2+1),this.camera);let i=this.raycaster.intersectObject(this.model,!0).find((a)=>a.uv);if(!i?.uv)return;let s=Math.min(3,Math.floor(i.uv.x*4)),r;if(s>=2&&i.object instanceof yt&&i.face){let a=i.object.geometry,o=a.getAttribute("wodiraArtworkUv"),l=a.getAttribute("position");if(o){let{a:c,b:h,c:u}=i.face,d=Wt.getBarycoord(i.object.worldToLocal(i.point.clone()),new D().fromBufferAttribute(l,c),new D().fromBufferAttribute(l,h),new D().fromBufferAttribute(l,u),new D);if(d){let f=new D().addScaledVector(new D().fromBufferAttribute(o,c),d.x).addScaledVector(new D().fromBufferAttribute(o,h),d.y).addScaledVector(new D().fromBufferAttribute(o,u),d.z);r={side:f.z>=0?"front":"back",surface:void 0,x:(f.z>=0?f.x:1-f.x)*100,y:f.y*100}}}}return{torso:r,side:s===1?"back":"front",surface:s===2?"left-sleeve":s===3?"right-sleeve":void 0,x:(i.uv.x*4-s)*100,y:i.uv.y*100}}pick(e,t){let n=this.surface(e,t);if(!n)return;for(let i of[n,n.torso]){if(!i)continue;let s=this.slots.find((r)=>i.side===r.side&&i.surface===r.surface&&i.x>=r.x&&i.x<=r.x+r.width&&i.y>=r.y&&i.y<=r.y+r.height);if(s)return s}return}paint(){this.textureDirty=!0}paintNow(){let e=this.atlas.getContext("2d");if(!e)return;e.setTransform(this.atlas.width/4000,0,0,this.atlas.height/1120,0,0);let t=new Ee(this.shirtColor).lerp(new Ee(16777215),0.004);if(this.model&&!this.artworkProjection)this.resetCloth(),this.artworkProjection=new Rc(this.model);this.artworkProjection?.update(this.artwork,this.images,t);for(let n of this.fabricMaterials)n.sheenColor.copy(t).lerp(new Ee(16777215),0.35);e.clearRect(0,0,4000,1120);for(let n of this.slots){let i=(n.surface==="left-sleeve"?2000:n.surface==="right-sleeve"?3000:n.side==="back"?1000:0)+n.x*10,s=n.y*11.2,r=n.width*10,a=n.height*11.2;if(e.save(),n.surface==="left-sleeve")e.translate(2*i+r,0),e.scale(-1,1);let o=Tc(n),l=n.isReserved?n.reservedLogo:o?.logo,c=l?this.images.get(l):void 0;if(c?.complete&&c.naturalWidth){let h=Math.min(r/c.naturalWidth,a/c.naturalHeight),u=c.naturalWidth*h,d=c.naturalHeight*h;e.drawImage(c,i+(r-u)/2,s+(a-d)/2,u,d)}else if(this.rotating)e.fillStyle=n.isReserved?this.palette.reserved:n.id==="drawing-preview"?this.palette.slotPreview:this.palette.slot,e.fillRect(i,s,r,a),e.strokeStyle=this.palette.slotText,e.lineWidth=5,e.strokeRect(i,s,r,a),e.fillStyle=this.palette.slotText,e.font="bold 24px sans-serif",e.textBaseline="middle",e.textAlign="center",e.fillText(n.name,i+r/2,s+a*(this.showBidPrices?0.36:0.5),r-10);if(n.id===this.selectedSlotId)e.strokeStyle=this.palette.selected,e.lineWidth=12,e.strokeRect(i-6,s-6,r+12,a+12);if(this.showBidPrices&&!n.isReserved&&n.id!=="drawing-preview")this.paintBidPrice(e,i,s,r,a,n.bidPrice??o?.amount??n.startingPrice,!!o);e.restore()}this.texture.needsUpdate=!0}paintBidPrice(e,t,n,i,s,r,a){if(!Number.isFinite(r)||r<=0)return;let o=this.priceFormatter.format(r),l=Math.min(56,s*0.43),c=Math.min(46,l*0.82);e.save(),e.font=`700 ${c}px sans-serif`;let h=Math.min(i-12,e.measureText(o).width+26),u=t+(i-h)/2,d=n+s-l-8;e.beginPath(),e.roundRect(u,d,h,l,Math.min(15,l/3)),e.fillStyle=a?this.palette.priceLeading:this.palette.price,e.shadowColor="rgba(16, 22, 50, 0.3)",e.shadowBlur=10,e.shadowOffsetY=3,e.fill(),e.shadowColor="transparent",e.strokeStyle=this.palette.slotText,e.lineWidth=3,e.stroke(),e.fillStyle=this.palette.slotText,e.textAlign="center",e.textBaseline="middle",e.fillText(o,t+i/2,d+l/2,h-14),e.restore()}render(){if(this.disposed||this.contextUnavailable)return;if(this.frame)return;if(!this.lastFrameTime)this.lastFrameTime=performance.now();this.frame=requestAnimationFrame((e)=>{if(this.frame=0,this.disposed||this.contextUnavailable)return;try{let t=Math.max(0,(e-this.lastFrameTime)/1000);if(this.lastFrameTime=e,this.clothActive){this.clothActive=this.cloth.advance(t);for(let n of this.clothMeshes)if(this.clothActive)n.apply(this.cloth);else n.restore()}if(this.textureDirty)this.paintNow(),this.textureDirty=!1;if(this.model)this.model.rotation.set(this.tilt,(this.side==="back"?Math.PI:0)+this.rotation,0);if(this.camera.zoom=this.zoom,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.renderer.getContext().isContextLost())return;if(this.model&&this.canvas.clientWidth>0&&this.canvas.clientHeight>0)this.firstFrame?.resolve(),this.firstFrame=void 0,clearTimeout(this.recoveryTimer),this.recovering(!1);if(this.clothActive)this.render();else this.lastFrameTime=0}catch{this.fail()}})}resetCloth=()=>{this.cloth.reset(),this.clothActive=!1,this.lastFrameTime=this.frame?performance.now():0;for(let e of this.clothMeshes)e.restore();this.render()};createFabricTexture(){let t=new Uint8Array(65536);for(let i=0;i<128;i++)for(let s=0;s<128;s++){let r=i/16*Math.PI*2,a=s/16*Math.PI*2,o=Math.sin(a+Math.sin(r)*0.65)*Math.cos(r),l=Math.sin(s*12.9898+i*78.233)*43758.5453,c=(l-Math.floor(l)-0.5)*10,h=(i*128+s)*4;t[h]=Math.round(128+o*35+c),t[h+1]=Math.round(237+o*10+c*0.3),t[h+2]=0,t[h+3]=255}let n=new Wi(t,128,128,bn);return n.wrapS=n.wrapT=hi,n.repeat.set(64,20),n.generateMipmaps=!0,n.minFilter=tn,n.magFilter=mt,n.needsUpdate=!0,n}contextLost=(e)=>{if(e.preventDefault(),this.disposed)return;this.contextUnavailable=!0,cancelAnimationFrame(this.frame),this.frame=0,this.recovering(!0),clearTimeout(this.recoveryTimer),this.recoveryTimer=setTimeout(()=>this.fail(),8000)};contextRestored=()=>{if(this.disposed)return;this.contextUnavailable=!1;try{let e=this.canvas.getBoundingClientRect();this.renderer.setSize(e.width,e.height,!1),this.paint(),this.resetCloth()}catch{this.fail()}};disposeModel(e){e.traverse((t)=>{if(!(t instanceof yt))return;t.geometry.dispose();for(let n of Array.isArray(t.material)?t.material:[t.material])n.dispose()})}dispose(){if(this.disposed)return;this.disposed=!0,this.loadController.abort(),clearTimeout(this.recoveryTimer),this.firstFrame?.reject(Error("Shirt renderer disposed")),this.firstFrame=void 0,cancelAnimationFrame(this.frame),this.observer.disconnect(),this.canvas.removeEventListener("webglcontextlost",this.contextLost),this.canvas.removeEventListener("webglcontextrestored",this.contextRestored),this.reducedMotion.removeEventListener("change",this.resetCloth),document.removeEventListener("visibilitychange",this.resetCloth),this.clothMeshes=[];for(let e of this.images.values())e.onload=null;if(this.images.clear(),this.texture.dispose(),this.artworkProjection?.dispose(),this.fabricTexture.dispose(),this.fabricMaterials=[],this.model)this.disposeModel(this.model);this.renderer.dispose(),this.renderer.forceContextLoss()}}var Gf,Cv="/images/sponsor-studio/white-shirt-realistic-v1.glb?v=7";var Wf=On(()=>{As();Uf();Ff();Hf();Gf={slot:"#e32397",slotPreview:"#ff1593",slotText:"#ffffff",priceLeading:"#e40086",price:"#101632",reserved:"#c9c5d3",selected:"#101632"}});var yr=globalThis,Wa=yr.ShadowRoot&&(yr.ShadyCSS===void 0||yr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Va=Symbol(),Vc=new WeakMap;class Xa{constructor(e,t,n){if(this._$cssResult$=!0,n!==Va)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this._strings=t}get styleSheet(){let e=this._styleSheet,t=this._strings;if(Wa&&e===void 0){let n=t!==void 0&&t.length===1;if(n)e=Vc.get(t);if(e===void 0){if((this._styleSheet=e=new CSSStyleSheet).replaceSync(this.cssText),n)Vc.set(t,e)}}return e}toString(){return this.cssText}}var jf=(e)=>{if(e._$cssResult$===!0)return e.cssText;else if(typeof e==="number")return e;else throw Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)},Qf=(e)=>new Xa(typeof e==="string"?e:String(e),void 0,Va),Sr=(e,...t)=>{let n=e.length===1?e[0]:t.reduce((i,s,r)=>i+jf(s)+e[r+1],e[0]);return new Xa(n,e,Va)},Xc=(e,t)=>{if(Wa)e.adoptedStyleSheets=t.map((n)=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let i=document.createElement("style"),s=yr.litNonce;if(s!==void 0)i.setAttribute("nonce",s);i.textContent=n.cssText,e.appendChild(i)}},ep=(e)=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Qf(t)},$a=Wa?(e)=>e:(e)=>e instanceof CSSStyleSheet?ep(e):e;var{is:tp,defineProperty:np,getOwnPropertyDescriptor:$c,getOwnPropertyNames:ip,getOwnPropertySymbols:sp,getPrototypeOf:qc}=Object,rp=!1,Gt=globalThis;if(rp)Gt.customElements??=customElements;var Kt=!0,mn,Yc=Gt.trustedTypes,ap=Yc?Yc.emptyScript:"",Kc=Kt?Gt.reactiveElementPolyfillSupportDevMode:Gt.reactiveElementPolyfillSupport;if(Kt)Gt.litIssuedWarnings??=new Set,mn=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!Gt.litIssuedWarnings.has(t)&&!Gt.litIssuedWarnings.has(e))console.warn(t),Gt.litIssuedWarnings.add(t)},queueMicrotask(()=>{if(mn("dev-mode","Lit is in dev mode. Not recommended for production!"),Gt.ShadyDOM?.inUse&&Kc===void 0)mn("polyfill-support-missing","Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded.")});var op=Kt?(e)=>{if(!Gt.emitLitDebugLogEvents)return;Gt.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))}:void 0,Yi=(e,t)=>e,qa={toAttribute(e,t){switch(t){case Boolean:e=e?ap:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e);break}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(i){n=null}break}return n}},Jc=(e,t)=>!tp(e,t),Zc={attribute:!0,type:String,converter:qa,reflect:!1,useDefault:!1,hasChanged:Jc};Symbol.metadata??=Symbol("metadata");Gt.litPropertyMetadata??=new WeakMap;class Jt extends HTMLElement{static addInitializer(e){this.__prepare(),(this._initializers??=[]).push(e)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap&&[...this.__attributeToPropertyMap.keys()]}static createProperty(e,t=Zc){if(t.state)t.attribute=!1;if(this.__prepare(),this.prototype.hasOwnProperty(e))t=Object.create(t),t.wrapped=!0;if(this.elementProperties.set(e,t),!t.noAccessor){let n=Kt?Symbol.for(`${String(e)} (@property() cache)`):Symbol(),i=this.getPropertyDescriptor(e,n,t);if(i!==void 0)np(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=$c(this.prototype,e)??{get(){return this[t]},set(r){this[t]=r}};if(Kt&&i==null){if("value"in($c(this.prototype,e)??{}))throw Error(`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it's actually declared as a value on the prototype. Usually this is due to using @property or @state on a method.`);mn("reactive-property-without-getter",`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it does not have a getter. This will be an error in a future version of Lit.`)}return{get:i,set(r){let a=i?.call(this);s?.call(this,r),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zc}static __prepare(){if(this.hasOwnProperty(Yi("elementProperties",this)))return;let e=qc(this);if(e.finalize(),e._initializers!==void 0)this._initializers=[...e._initializers];this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Yi("finalized",this)))return;if(this.finalized=!0,this.__prepare(),this.hasOwnProperty(Yi("properties",this))){let t=this.properties,n=[...ip(t),...sp(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this.__attributeToPropertyMap=new Map;for(let[t,n]of this.elementProperties){let i=this.__attributeNameForProperty(t,n);if(i!==void 0)this.__attributeToPropertyMap.set(i,t)}if(this.elementStyles=this.finalizeStyles(this.styles),Kt){if(this.hasOwnProperty("createProperty"))mn("no-override-create-property","Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators");if(this.hasOwnProperty("getPropertyDescriptor"))mn("no-override-get-property-descriptor","Overriding ReactiveElement.getPropertyDescriptor() is deprecated. The override will not be called with standard decorators")}}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift($a(i))}else if(e!==void 0)t.push($a(e));return t}static __attributeNameForProperty(e,t){let n=t.attribute;return n===!1?void 0:typeof n==="string"?n:typeof e==="string"?e.toLowerCase():void 0}constructor(){super();this.__instanceProperties=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.__reflectingProperty=null,this.__initialize()}__initialize(){this.__updatePromise=new Promise((e)=>this.enableUpdating=e),this._$changedProperties=new Map,this.__saveInstanceProperties(),this.requestUpdate(),this.constructor._initializers?.forEach((e)=>e(this))}addController(e){if((this.__controllers??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected)e.hostConnected?.()}removeController(e){this.__controllers?.delete(e)}__saveInstanceProperties(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())if(this.hasOwnProperty(n))e.set(n,this[n]),delete this[n];if(e.size>0)this.__instanceProperties=e}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xc(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this.__controllers?.forEach((e)=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this.__controllers?.forEach((e)=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$attributeToProperty(e,n)}__propertyToAttribute(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor.__attributeNameForProperty(e,i);if(s!==void 0&&i.reflect===!0){let a=(i.converter?.toAttribute!==void 0?i.converter:qa).toAttribute(t,i.type);if(Kt&&this.constructor.enabledWarnings.includes("migration")&&a===void 0)mn("undefined-attribute-value",`The attribute value for the ${e} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`);if(this.__reflectingProperty=e,a==null)this.removeAttribute(s);else this.setAttribute(s,a);this.__reflectingProperty=null}}_$attributeToProperty(e,t){let n=this.constructor,i=n.__attributeToPropertyMap.get(e);if(i!==void 0&&this.__reflectingProperty!==i){let s=n.getPropertyOptions(i),r=typeof s.converter==="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:qa;this.__reflectingProperty=i;let a=r.fromAttribute(t,s.type);this[i]=a??this.__defaultValues?.get(i)??a,this.__reflectingProperty=null}}requestUpdate(e,t,n,i=!1,s){if(e!==void 0){if(Kt&&e instanceof Event)mn("","The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()");let r=this.constructor;if(i===!1)s=this[e];if(n??=r.getPropertyOptions(e),(n.hasChanged??Jc)(s,t)||n.useDefault&&n.reflect&&s===this.__defaultValues?.get(e)&&!this.hasAttribute(r.__attributeNameForProperty(e,n)))this._$changeProperty(e,t,n);else return}if(this.isUpdatePending===!1)this.__updatePromise=this.__enqueueUpdate()}_$changeProperty(e,t,{useDefault:n,reflect:i,wrapped:s},r){if(n&&!(this.__defaultValues??=new Map).has(e)){if(this.__defaultValues.set(e,r??t??this[e]),s!==!0||r!==void 0)return}if(!this._$changedProperties.has(e)){if(!this.hasUpdated&&!n)t=void 0;this._$changedProperties.set(e,t)}if(i===!0&&this.__reflectingProperty!==e)(this.__reflectingProperties??=new Set).add(e)}async __enqueueUpdate(){this.isUpdatePending=!0;try{await this.__updatePromise}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();if(e!=null)await e;return!this.isUpdatePending}scheduleUpdate(){let e=this.performUpdate();if(Kt&&this.constructor.enabledWarnings.includes("async-perform-update")&&typeof e?.then==="function")mn("async-perform-update",`Element ${this.localName} returned a Promise from performUpdate(). This behavior is deprecated and will be removed in a future version of ReactiveElement.`);return e}performUpdate(){if(!this.isUpdatePending)return;if(op?.({kind:"update"}),!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),Kt){let s=[...this.constructor.elementProperties.keys()].filter((r)=>this.hasOwnProperty(r)&&(r in qc(this)));if(s.length)throw Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${s.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`)}if(this.__instanceProperties){for(let[i,s]of this.__instanceProperties)this[i]=s;this.__instanceProperties=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,s]of n){let{wrapped:r}=s,a=this[i];if(r===!0&&!this._$changedProperties.has(i)&&a!==void 0)this._$changeProperty(i,void 0,s,a)}}let e=!1,t=this._$changedProperties;try{if(e=this.shouldUpdate(t),e)this.willUpdate(t),this.__controllers?.forEach((n)=>n.hostUpdate?.()),this.update(t);else this.__markUpdated()}catch(n){throw e=!1,this.__markUpdated(),n}if(e)this._$didUpdate(t)}willUpdate(e){}_$didUpdate(e){if(this.__controllers?.forEach((t)=>t.hostUpdated?.()),!this.hasUpdated)this.hasUpdated=!0,this.firstUpdated(e);if(this.updated(e),Kt&&this.isUpdatePending&&this.constructor.enabledWarnings.includes("change-in-update"))mn("change-in-update",`Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`)}__markUpdated(){this._$changedProperties=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.__updatePromise}shouldUpdate(e){return!0}update(e){this.__reflectingProperties&&=this.__reflectingProperties.forEach((t)=>this.__propertyToAttribute(t,this[t])),this.__markUpdated()}updated(e){}firstUpdated(e){}}Jt.elementStyles=[];Jt.shadowRootOptions={mode:"open"};Jt[Yi("elementProperties",Jt)]=new Map;Jt[Yi("finalized",Jt)]=new Map;Kc?.({ReactiveElement:Jt});if(Kt){Jt.enabledWarnings=["change-in-update","async-perform-update"];let e=function(t){if(!t.hasOwnProperty(Yi("enabledWarnings",t)))t.enabledWarnings=t.enabledWarnings.slice()};Jt.enableWarning=function(t){if(e(this),!this.enabledWarnings.includes(t))this.enabledWarnings.push(t)},Jt.disableWarning=function(t){e(this);let n=this.enabledWarnings.indexOf(t);if(n>=0)this.enabledWarnings.splice(n,1)}}(Gt.reactiveElementVersions??=[]).push("2.1.2");if(Kt&&Gt.reactiveElementVersions.length>1)queueMicrotask(()=>{mn("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var jt=globalThis,Ze=(e)=>{if(!jt.emitLitDebugLogEvents)return;jt.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))},lp=0,Ns;jt.litIssuedWarnings??=new Set,Ns=(e,t)=>{if(t+=e?` See https://lit.dev/msg/${e} for more information.`:"",!jt.litIssuedWarnings.has(t)&&!jt.litIssuedWarnings.has(e))console.warn(t),jt.litIssuedWarnings.add(t)},queueMicrotask(()=>{Ns("dev-mode","Lit is in dev mode. Not recommended for production!")});var gn=jt.ShadyDOM?.inUse&&jt.ShadyDOM?.noPatch===!0?jt.ShadyDOM.wrap:(e)=>e,br=jt.trustedTypes,jc=br?br.createPolicy("lit-html",{createHTML:(e)=>e}):void 0,cp=(e)=>e,Er=(e,t,n)=>cp,hp=(e)=>{if(Ri!==Er)throw Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");Ri=e},up=()=>{Ri=Er},ja=(e,t,n)=>Ri(e,t,n),Qa="$lit$",Mn=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Mn,dp=`<${eo}>`,Ei=document,Ds=()=>Ei.createComment(""),Us=(e)=>e===null||typeof e!="object"&&typeof e!="function",to=Array.isArray,rh=(e)=>to(e)||typeof e?.[Symbol.iterator]==="function",Ya=`[
|
|
4262
|
+
#endif`)},h.customProgramCacheKey=()=>"wodira-artwork-continuous-sponsors-v3",h.needsUpdate=!0}}}update(e,t,n){this.uniforms.wodiraArtworkEnabled.value=!!(e?.front||e?.back);let i=e?.front?.fabricColor,s=e?.back?.fabricColor;this.uniforms.wodiraFrontFabricColor.value.copy(i||s?new Ee(i??s):n),this.uniforms.wodiraBackFabricColor.value.copy(s||i?new Ee(s??i):n);let r=this.canvas.getContext("2d");if(r)kf(r,e,t,this.canvas.width/2,this.canvas.height,this.silhouette);this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}}var Hf=On(()=>{As();zf()});class Cc{canvas;fail;recovering;renderer;scene=new pa;camera=new vi(-1,1,1.12,-1.12,0.1,20);model;observer;disposed=!1;loadController=new AbortController;contextUnavailable=!1;recoveryTimer;firstFrame;frame=0;textureDirty=!1;atlas=document.createElement("canvas");texture=new Ms(this.atlas);fabricTexture=this.createFabricTexture();fabricMaterials=[];images=new Map;slots=[];rotation=0;tilt=0;side="front";viewSurface;rotating=!1;zoom=1;shirtColor="#ffffff";showBidPrices=!1;artwork=null;artworkProjection;priceFormatter;palette;selectedSlotId=null;modelUrl;raycaster=new Da;cloth=new Ec;clothMeshes=[];clothActive=!1;lastFrameTime=0;reducedMotion=matchMedia("(prefers-reduced-motion: reduce)");constructor(e,t,n=()=>{},i={}){this.canvas=e;this.fail=t;this.recovering=n;this.modelUrl=new URL(i.modelUrl??Cv,document.baseURI),this.palette={...Gf,...i.palette},this.priceFormatter=this.createPriceFormatter(i.locale),this.atlas.width=2048,this.atlas.height=574,this.texture.generateMipmaps=!1,this.texture.minFilter=mt,this.texture.colorSpace=ln,this.texture.flipY=!1,this.renderer=new fc({canvas:e,alpha:!0,antialias:!0}),this.renderer.debug.onShaderError=()=>{throw Error("Shirt material shader unavailable")},this.renderer.toneMapping=js,this.renderer.toneMappingExposure=1,this.renderer.setPixelRatio(Math.min(devicePixelRatio,matchMedia("(pointer: coarse)").matches?1.5:2)),this.fabricTexture.anisotropy=Math.min(4,this.renderer.capabilities.getMaxAnisotropy()),this.camera.position.z=5,this.scene.add(new Ca(16777215,7827851,2.3));let s=new $i(16777215,2.2);s.position.set(-3,4,5),this.scene.add(s);let r=new $i(16777215,1.6);r.position.set(3,2,-4),this.scene.add(r),this.observer=new ResizeObserver(()=>{if(this.disposed||this.contextUnavailable)return;try{let a=e.getBoundingClientRect();this.renderer.setSize(a.width,a.height,!1),this.render()}catch{this.fail()}}),this.observer.observe(e),e.addEventListener("webglcontextlost",this.contextLost),e.addEventListener("webglcontextrestored",this.contextRestored),this.reducedMotion.addEventListener("change",this.resetCloth),document.addEventListener("visibilitychange",this.resetCloth)}async load(){let e=this.modelUrl,t=await fetch(e,{signal:this.loadController.signal});if(!t.ok)throw Error(`Shirt model request failed (${t.status})`);let n=await t.arrayBuffer();this.loadController.signal.throwIfAborted();let i=await new bc().parseAsync(n,new URL(".",e).href);if(this.disposed){this.disposeModel(i.scene);return}this.model=i.scene,this.model.traverse((s)=>{if(!(s instanceof yt))return;this.clothMeshes.push(new Ac(s.geometry));let r=Array.isArray(s.material)?s.material:[s.material];for(let a of r){if(!(a instanceof Pn))continue;if(a.color.set(16777215),a.side=$t,a.metalness=0,a.roughness=1,a.roughnessMap=this.fabricTexture,a.bumpMap=this.fabricTexture,a.bumpScale=0.0012,a.map=this.texture,a instanceof Ft)a.sheen=0.3,a.sheenColorMap=null,a.sheenRoughness=1,a.specularIntensity=0.3,a.clearcoat=0,this.fabricMaterials.push(a)}}),this.scene.add(this.model),this.paint(),await new Promise((s,r)=>{this.firstFrame={resolve:s,reject:r},this.render()})}update(e,t,n,i="#ffffff",s=!1,r=null,a){if(this.slots=e,t!==this.side||a!==this.viewSurface)this.viewSurface=a,this.resetView();this.side=t,this.rotating=n,this.shirtColor=i,this.showBidPrices=s,this.artwork=r;let o=new Set([...e.map((l)=>l.isReserved?l.reservedLogo:Tc(l)?.logo),r?.front?.url,r?.back?.url].filter((l)=>!!l));for(let[l,c]of this.images)if(!o.has(l))c.onload=null,this.images.delete(l);for(let l of o)if(!this.images.has(l)){let c=new Image;if(/^https?:\/\//i.test(l))c.crossOrigin="anonymous";this.images.set(l,c),c.onload=()=>{if(!this.disposed)this.paint(),this.render()},c.src=l}this.paint(),this.render()}async snapshot(e="front"){return this.capture(e,"image/png")}async productionSnapshot(e){return this.capture(e,"image/webp")}async capture(e,t){if(!this.model||this.disposed||this.contextUnavailable)throw Error("Shirt renderer unavailable");if(await Promise.all([...this.images.values()].map((s)=>s.decode())),this.disposed||!this.model||this.contextUnavailable)throw Error("Shirt renderer unavailable");this.resetCloth(),this.paintNow();let n=this.model.rotation.clone(),i=this.camera.zoom;try{this.model.rotation.set(e==="top"?Math.PI/2:0,e==="back"?Math.PI:e==="left"?Math.PI/2:e==="right"?-Math.PI/2:0,0),this.camera.zoom=1,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera);let s=document.createElement("canvas");s.width=640,s.height=Math.round(640*this.renderer.domElement.height/this.renderer.domElement.width);let r=s.getContext("2d");if(!r)throw Error("Canvas unavailable");if(t==="image/webp")r.fillStyle="#ffffff",r.fillRect(0,0,s.width,s.height);return r.drawImage(this.renderer.domElement,0,0,s.width,s.height),await new Promise((a,o)=>s.toBlob((l)=>l?a(l):o(Error("Preview encoding failed")),t,t==="image/webp"?0.82:void 0))}finally{this.model.rotation.copy(n),this.camera.zoom=i,this.camera.updateProjectionMatrix(),this.render()}}setSelectedSlot(e){if(e===this.selectedSlotId)return;this.selectedSlotId=e,this.paint(),this.render()}setAppearance(e){if(e.palette)this.palette={...Gf,...e.palette};if(e.locale!==void 0)this.priceFormatter=this.createPriceFormatter(e.locale);this.paint(),this.render()}createPriceFormatter(e){let t={style:"currency",currency:"EUR",maximumFractionDigits:0};try{return new Intl.NumberFormat(e||document.documentElement.lang||"es-ES",t)}catch{return new Intl.NumberFormat("es-ES",t)}}rotate(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return;let n=this.tilt;if(this.rotation+=e*0.01,this.tilt=Math.max(-0.7,Math.min(0.7,this.tilt+t*0.008)),!this.reducedMotion.matches&&!document.hidden&&(e||this.tilt!==n))this.cloth.turn(e*0.01,this.tilt-n),this.clothActive=!0;this.render()}zoomBy(e){this.zoom=Math.max(0.7,Math.min(1.8,this.zoom+e)),this.render()}resetView(){this.rotation=this.viewSurface==="left-sleeve"?Math.PI/2:this.viewSurface==="right-sleeve"?-Math.PI/2:0,this.tilt=0,this.zoom=1,this.resetCloth()}surface(e,t){if(!this.model)return;let n=this.canvas.getBoundingClientRect();this.raycaster.setFromCamera(new ke((e-n.left)/n.width*2-1,-((t-n.top)/n.height)*2+1),this.camera);let i=this.raycaster.intersectObject(this.model,!0).find((a)=>a.uv);if(!i?.uv)return;let s=Math.min(3,Math.floor(i.uv.x*4)),r;if(s>=2&&i.object instanceof yt&&i.face){let a=i.object.geometry,o=a.getAttribute("wodiraArtworkUv"),l=a.getAttribute("position");if(o){let{a:c,b:h,c:u}=i.face,d=Wt.getBarycoord(i.object.worldToLocal(i.point.clone()),new D().fromBufferAttribute(l,c),new D().fromBufferAttribute(l,h),new D().fromBufferAttribute(l,u),new D);if(d){let f=new D().addScaledVector(new D().fromBufferAttribute(o,c),d.x).addScaledVector(new D().fromBufferAttribute(o,h),d.y).addScaledVector(new D().fromBufferAttribute(o,u),d.z);r={side:f.z>=0?"front":"back",surface:void 0,x:(f.z>=0?f.x:1-f.x)*100,y:f.y*100}}}}return{torso:r,side:s===1?"back":"front",surface:s===2?"left-sleeve":s===3?"right-sleeve":void 0,x:(i.uv.x*4-s)*100,y:i.uv.y*100}}pick(e,t){let n=this.surface(e,t);if(!n)return;for(let i of[n,n.torso]){if(!i)continue;let s=this.slots.find((r)=>i.side===r.side&&i.surface===r.surface&&i.x>=r.x&&i.x<=r.x+r.width&&i.y>=r.y&&i.y<=r.y+r.height);if(s)return s}return}paint(){this.textureDirty=!0}paintNow(){let e=this.atlas.getContext("2d");if(!e)return;e.setTransform(this.atlas.width/4000,0,0,this.atlas.height/1120,0,0);let t=new Ee(this.shirtColor).lerp(new Ee(16777215),0.004);if(this.model&&!this.artworkProjection)this.resetCloth(),this.artworkProjection=new Rc(this.model);this.artworkProjection?.update(this.artwork,this.images,t);for(let n of this.fabricMaterials)n.sheenColor.copy(t).lerp(new Ee(16777215),0.35);e.clearRect(0,0,4000,1120);for(let n of this.slots){let i=(n.surface==="left-sleeve"?2000:n.surface==="right-sleeve"?3000:n.side==="back"?1000:0)+n.x*10,s=n.y*11.2,r=n.width*10,a=n.height*11.2;if(e.save(),n.surface==="left-sleeve")e.translate(2*i+r,0),e.scale(-1,1);let o=Tc(n),l=n.isReserved?n.reservedLogo:o?.logo,c=l?this.images.get(l):void 0;if(c?.complete&&c.naturalWidth){let h=Math.min(r/c.naturalWidth,a/c.naturalHeight),u=c.naturalWidth*h,d=c.naturalHeight*h;e.drawImage(c,i+(r-u)/2,s+(a-d)/2,u,d)}else if(this.rotating)e.fillStyle=n.isReserved?this.palette.reserved:n.id==="drawing-preview"?this.palette.slotPreview:this.palette.slot,e.fillRect(i,s,r,a),e.strokeStyle=this.palette.slotText,e.lineWidth=5,e.strokeRect(i,s,r,a),e.fillStyle=this.palette.slotText,e.font="bold 24px sans-serif",e.textBaseline="middle",e.textAlign="center",e.fillText(n.name,i+r/2,s+a*(this.showBidPrices?0.36:0.5),r-10);if(n.id===this.selectedSlotId)e.strokeStyle=this.palette.selected,e.lineWidth=12,e.strokeRect(i-6,s-6,r+12,a+12);if(this.showBidPrices&&!n.isReserved&&n.id!=="drawing-preview")this.paintBidPrice(e,i,s,r,a,n.bidPrice??o?.amount??n.startingPrice,!!o);e.restore()}this.texture.needsUpdate=!0}paintBidPrice(e,t,n,i,s,r,a){if(!Number.isFinite(r)||r<=0)return;let o=this.priceFormatter.format(r),l=Math.min(56,s*0.43),c=Math.min(46,l*0.82);e.save(),e.font=`700 ${c}px sans-serif`;let h=Math.min(i-12,e.measureText(o).width+26),u=t+(i-h)/2,d=n+s-l-8;e.beginPath(),e.roundRect(u,d,h,l,Math.min(15,l/3)),e.fillStyle=a?this.palette.priceLeading:this.palette.price,e.shadowColor="rgba(16, 22, 50, 0.3)",e.shadowBlur=10,e.shadowOffsetY=3,e.fill(),e.shadowColor="transparent",e.strokeStyle=this.palette.slotText,e.lineWidth=3,e.stroke(),e.fillStyle=this.palette.slotText,e.textAlign="center",e.textBaseline="middle",e.fillText(o,t+i/2,d+l/2,h-14),e.restore()}render(){if(this.disposed||this.contextUnavailable)return;if(this.frame)return;if(!this.lastFrameTime)this.lastFrameTime=performance.now();this.frame=requestAnimationFrame((e)=>{if(this.frame=0,this.disposed||this.contextUnavailable)return;try{let t=Math.max(0,(e-this.lastFrameTime)/1000);if(this.lastFrameTime=e,this.clothActive){this.clothActive=this.cloth.advance(t);for(let n of this.clothMeshes)if(this.clothActive)n.apply(this.cloth);else n.restore()}if(this.textureDirty)this.paintNow(),this.textureDirty=!1;if(this.model)this.model.rotation.set(this.tilt,(this.side==="back"?Math.PI:0)+this.rotation,0);if(this.camera.zoom=this.zoom,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.renderer.getContext().isContextLost())return;if(this.model&&this.canvas.clientWidth>0&&this.canvas.clientHeight>0)this.firstFrame?.resolve(),this.firstFrame=void 0,clearTimeout(this.recoveryTimer),this.recovering(!1);if(this.clothActive)this.render();else this.lastFrameTime=0}catch{this.fail()}})}resetCloth=()=>{this.cloth.reset(),this.clothActive=!1,this.lastFrameTime=this.frame?performance.now():0;for(let e of this.clothMeshes)e.restore();this.render()};createFabricTexture(){let t=new Uint8Array(65536);for(let i=0;i<128;i++)for(let s=0;s<128;s++){let r=i/16*Math.PI*2,a=s/16*Math.PI*2,o=Math.sin(a+Math.sin(r)*0.65)*Math.cos(r),l=Math.sin(s*12.9898+i*78.233)*43758.5453,c=(l-Math.floor(l)-0.5)*10,h=(i*128+s)*4;t[h]=Math.round(128+o*35+c),t[h+1]=Math.round(237+o*10+c*0.3),t[h+2]=0,t[h+3]=255}let n=new Wi(t,128,128,bn);return n.wrapS=n.wrapT=hi,n.repeat.set(64,20),n.generateMipmaps=!0,n.minFilter=tn,n.magFilter=mt,n.needsUpdate=!0,n}contextLost=(e)=>{if(e.preventDefault(),this.disposed)return;this.contextUnavailable=!0,cancelAnimationFrame(this.frame),this.frame=0,this.recovering(!0),clearTimeout(this.recoveryTimer),this.recoveryTimer=setTimeout(()=>this.fail(),8000)};contextRestored=()=>{if(this.disposed)return;this.contextUnavailable=!1;try{let e=this.canvas.getBoundingClientRect();this.renderer.setSize(e.width,e.height,!1),this.paint(),this.resetCloth()}catch{this.fail()}};disposeModel(e){e.traverse((t)=>{if(!(t instanceof yt))return;t.geometry.dispose();for(let n of Array.isArray(t.material)?t.material:[t.material])n.dispose()})}dispose(){if(this.disposed)return;this.disposed=!0,this.loadController.abort(),clearTimeout(this.recoveryTimer),this.firstFrame?.reject(Error("Shirt renderer disposed")),this.firstFrame=void 0,cancelAnimationFrame(this.frame),this.observer.disconnect(),this.canvas.removeEventListener("webglcontextlost",this.contextLost),this.canvas.removeEventListener("webglcontextrestored",this.contextRestored),this.reducedMotion.removeEventListener("change",this.resetCloth),document.removeEventListener("visibilitychange",this.resetCloth),this.clothMeshes=[];for(let e of this.images.values())e.onload=null;if(this.images.clear(),this.texture.dispose(),this.artworkProjection?.dispose(),this.fabricTexture.dispose(),this.fabricMaterials=[],this.model)this.disposeModel(this.model);this.renderer.dispose(),this.renderer.forceContextLoss()}}var Gf,Cv="/images/sponsor-studio/white-shirt-realistic-v1.glb?v=7";var Wf=On(()=>{As();Uf();Ff();Hf();Gf={slot:"#e32397",slotPreview:"#ff1593",slotText:"#ffffff",priceLeading:"#e40086",price:"#101632",reserved:"#c9c5d3",selected:"#101632"}});var Sr=globalThis,Wa=Sr.ShadowRoot&&(Sr.ShadyCSS===void 0||Sr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Va=Symbol(),Vc=new WeakMap;class Xa{constructor(e,t,n){if(this._$cssResult$=!0,n!==Va)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this._strings=t}get styleSheet(){let e=this._styleSheet,t=this._strings;if(Wa&&e===void 0){let n=t!==void 0&&t.length===1;if(n)e=Vc.get(t);if(e===void 0){if((this._styleSheet=e=new CSSStyleSheet).replaceSync(this.cssText),n)Vc.set(t,e)}}return e}toString(){return this.cssText}}var jf=(e)=>{if(e._$cssResult$===!0)return e.cssText;else if(typeof e==="number")return e;else throw Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)},Qf=(e)=>new Xa(typeof e==="string"?e:String(e),void 0,Va),Ps=(e,...t)=>{let n=e.length===1?e[0]:t.reduce((i,s,r)=>i+jf(s)+e[r+1],e[0]);return new Xa(n,e,Va)},Xc=(e,t)=>{if(Wa)e.adoptedStyleSheets=t.map((n)=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of t){let i=document.createElement("style"),s=Sr.litNonce;if(s!==void 0)i.setAttribute("nonce",s);i.textContent=n.cssText,e.appendChild(i)}},ep=(e)=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Qf(t)},$a=Wa?(e)=>e:(e)=>e instanceof CSSStyleSheet?ep(e):e;var{is:tp,defineProperty:np,getOwnPropertyDescriptor:$c,getOwnPropertyNames:ip,getOwnPropertySymbols:sp,getPrototypeOf:qc}=Object,rp=!1,Gt=globalThis;if(rp)Gt.customElements??=customElements;var Kt=!0,mn,Yc=Gt.trustedTypes,ap=Yc?Yc.emptyScript:"",Kc=Kt?Gt.reactiveElementPolyfillSupportDevMode:Gt.reactiveElementPolyfillSupport;if(Kt)Gt.litIssuedWarnings??=new Set,mn=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!Gt.litIssuedWarnings.has(t)&&!Gt.litIssuedWarnings.has(e))console.warn(t),Gt.litIssuedWarnings.add(t)},queueMicrotask(()=>{if(mn("dev-mode","Lit is in dev mode. Not recommended for production!"),Gt.ShadyDOM?.inUse&&Kc===void 0)mn("polyfill-support-missing","Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded.")});var op=Kt?(e)=>{if(!Gt.emitLitDebugLogEvents)return;Gt.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))}:void 0,Yi=(e,t)=>e,qa={toAttribute(e,t){switch(t){case Boolean:e=e?ap:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e);break}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(i){n=null}break}return n}},Jc=(e,t)=>!tp(e,t),Zc={attribute:!0,type:String,converter:qa,reflect:!1,useDefault:!1,hasChanged:Jc};Symbol.metadata??=Symbol("metadata");Gt.litPropertyMetadata??=new WeakMap;class Jt extends HTMLElement{static addInitializer(e){this.__prepare(),(this._initializers??=[]).push(e)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap&&[...this.__attributeToPropertyMap.keys()]}static createProperty(e,t=Zc){if(t.state)t.attribute=!1;if(this.__prepare(),this.prototype.hasOwnProperty(e))t=Object.create(t),t.wrapped=!0;if(this.elementProperties.set(e,t),!t.noAccessor){let n=Kt?Symbol.for(`${String(e)} (@property() cache)`):Symbol(),i=this.getPropertyDescriptor(e,n,t);if(i!==void 0)np(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){let{get:i,set:s}=$c(this.prototype,e)??{get(){return this[t]},set(r){this[t]=r}};if(Kt&&i==null){if("value"in($c(this.prototype,e)??{}))throw Error(`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it's actually declared as a value on the prototype. Usually this is due to using @property or @state on a method.`);mn("reactive-property-without-getter",`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it does not have a getter. This will be an error in a future version of Lit.`)}return{get:i,set(r){let a=i?.call(this);s?.call(this,r),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zc}static __prepare(){if(this.hasOwnProperty(Yi("elementProperties",this)))return;let e=qc(this);if(e.finalize(),e._initializers!==void 0)this._initializers=[...e._initializers];this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Yi("finalized",this)))return;if(this.finalized=!0,this.__prepare(),this.hasOwnProperty(Yi("properties",this))){let t=this.properties,n=[...ip(t),...sp(t)];for(let i of n)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,i]of t)this.elementProperties.set(n,i)}this.__attributeToPropertyMap=new Map;for(let[t,n]of this.elementProperties){let i=this.__attributeNameForProperty(t,n);if(i!==void 0)this.__attributeToPropertyMap.set(i,t)}if(this.elementStyles=this.finalizeStyles(this.styles),Kt){if(this.hasOwnProperty("createProperty"))mn("no-override-create-property","Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators");if(this.hasOwnProperty("getPropertyDescriptor"))mn("no-override-get-property-descriptor","Overriding ReactiveElement.getPropertyDescriptor() is deprecated. The override will not be called with standard decorators")}}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift($a(i))}else if(e!==void 0)t.push($a(e));return t}static __attributeNameForProperty(e,t){let n=t.attribute;return n===!1?void 0:typeof n==="string"?n:typeof e==="string"?e.toLowerCase():void 0}constructor(){super();this.__instanceProperties=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.__reflectingProperty=null,this.__initialize()}__initialize(){this.__updatePromise=new Promise((e)=>this.enableUpdating=e),this._$changedProperties=new Map,this.__saveInstanceProperties(),this.requestUpdate(),this.constructor._initializers?.forEach((e)=>e(this))}addController(e){if((this.__controllers??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected)e.hostConnected?.()}removeController(e){this.__controllers?.delete(e)}__saveInstanceProperties(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())if(this.hasOwnProperty(n))e.set(n,this[n]),delete this[n];if(e.size>0)this.__instanceProperties=e}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xc(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this.__controllers?.forEach((e)=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this.__controllers?.forEach((e)=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$attributeToProperty(e,n)}__propertyToAttribute(e,t){let i=this.constructor.elementProperties.get(e),s=this.constructor.__attributeNameForProperty(e,i);if(s!==void 0&&i.reflect===!0){let a=(i.converter?.toAttribute!==void 0?i.converter:qa).toAttribute(t,i.type);if(Kt&&this.constructor.enabledWarnings.includes("migration")&&a===void 0)mn("undefined-attribute-value",`The attribute value for the ${e} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`);if(this.__reflectingProperty=e,a==null)this.removeAttribute(s);else this.setAttribute(s,a);this.__reflectingProperty=null}}_$attributeToProperty(e,t){let n=this.constructor,i=n.__attributeToPropertyMap.get(e);if(i!==void 0&&this.__reflectingProperty!==i){let s=n.getPropertyOptions(i),r=typeof s.converter==="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:qa;this.__reflectingProperty=i;let a=r.fromAttribute(t,s.type);this[i]=a??this.__defaultValues?.get(i)??a,this.__reflectingProperty=null}}requestUpdate(e,t,n,i=!1,s){if(e!==void 0){if(Kt&&e instanceof Event)mn("","The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()");let r=this.constructor;if(i===!1)s=this[e];if(n??=r.getPropertyOptions(e),(n.hasChanged??Jc)(s,t)||n.useDefault&&n.reflect&&s===this.__defaultValues?.get(e)&&!this.hasAttribute(r.__attributeNameForProperty(e,n)))this._$changeProperty(e,t,n);else return}if(this.isUpdatePending===!1)this.__updatePromise=this.__enqueueUpdate()}_$changeProperty(e,t,{useDefault:n,reflect:i,wrapped:s},r){if(n&&!(this.__defaultValues??=new Map).has(e)){if(this.__defaultValues.set(e,r??t??this[e]),s!==!0||r!==void 0)return}if(!this._$changedProperties.has(e)){if(!this.hasUpdated&&!n)t=void 0;this._$changedProperties.set(e,t)}if(i===!0&&this.__reflectingProperty!==e)(this.__reflectingProperties??=new Set).add(e)}async __enqueueUpdate(){this.isUpdatePending=!0;try{await this.__updatePromise}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();if(e!=null)await e;return!this.isUpdatePending}scheduleUpdate(){let e=this.performUpdate();if(Kt&&this.constructor.enabledWarnings.includes("async-perform-update")&&typeof e?.then==="function")mn("async-perform-update",`Element ${this.localName} returned a Promise from performUpdate(). This behavior is deprecated and will be removed in a future version of ReactiveElement.`);return e}performUpdate(){if(!this.isUpdatePending)return;if(op?.({kind:"update"}),!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),Kt){let s=[...this.constructor.elementProperties.keys()].filter((r)=>this.hasOwnProperty(r)&&(r in qc(this)));if(s.length)throw Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${s.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`)}if(this.__instanceProperties){for(let[i,s]of this.__instanceProperties)this[i]=s;this.__instanceProperties=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[i,s]of n){let{wrapped:r}=s,a=this[i];if(r===!0&&!this._$changedProperties.has(i)&&a!==void 0)this._$changeProperty(i,void 0,s,a)}}let e=!1,t=this._$changedProperties;try{if(e=this.shouldUpdate(t),e)this.willUpdate(t),this.__controllers?.forEach((n)=>n.hostUpdate?.()),this.update(t);else this.__markUpdated()}catch(n){throw e=!1,this.__markUpdated(),n}if(e)this._$didUpdate(t)}willUpdate(e){}_$didUpdate(e){if(this.__controllers?.forEach((t)=>t.hostUpdated?.()),!this.hasUpdated)this.hasUpdated=!0,this.firstUpdated(e);if(this.updated(e),Kt&&this.isUpdatePending&&this.constructor.enabledWarnings.includes("change-in-update"))mn("change-in-update",`Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`)}__markUpdated(){this._$changedProperties=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.__updatePromise}shouldUpdate(e){return!0}update(e){this.__reflectingProperties&&=this.__reflectingProperties.forEach((t)=>this.__propertyToAttribute(t,this[t])),this.__markUpdated()}updated(e){}firstUpdated(e){}}Jt.elementStyles=[];Jt.shadowRootOptions={mode:"open"};Jt[Yi("elementProperties",Jt)]=new Map;Jt[Yi("finalized",Jt)]=new Map;Kc?.({ReactiveElement:Jt});if(Kt){Jt.enabledWarnings=["change-in-update","async-perform-update"];let e=function(t){if(!t.hasOwnProperty(Yi("enabledWarnings",t)))t.enabledWarnings=t.enabledWarnings.slice()};Jt.enableWarning=function(t){if(e(this),!this.enabledWarnings.includes(t))this.enabledWarnings.push(t)},Jt.disableWarning=function(t){e(this);let n=this.enabledWarnings.indexOf(t);if(n>=0)this.enabledWarnings.splice(n,1)}}(Gt.reactiveElementVersions??=[]).push("2.1.2");if(Kt&&Gt.reactiveElementVersions.length>1)queueMicrotask(()=>{mn("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var jt=globalThis,Ze=(e)=>{if(!jt.emitLitDebugLogEvents)return;jt.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))},lp=0,Ds;jt.litIssuedWarnings??=new Set,Ds=(e,t)=>{if(t+=e?` See https://lit.dev/msg/${e} for more information.`:"",!jt.litIssuedWarnings.has(t)&&!jt.litIssuedWarnings.has(e))console.warn(t),jt.litIssuedWarnings.add(t)},queueMicrotask(()=>{Ds("dev-mode","Lit is in dev mode. Not recommended for production!")});var gn=jt.ShadyDOM?.inUse&&jt.ShadyDOM?.noPatch===!0?jt.ShadyDOM.wrap:(e)=>e,br=jt.trustedTypes,jc=br?br.createPolicy("lit-html",{createHTML:(e)=>e}):void 0,cp=(e)=>e,Er=(e,t,n)=>cp,hp=(e)=>{if(Ri!==Er)throw Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");Ri=e},up=()=>{Ri=Er},ja=(e,t,n)=>Ri(e,t,n),Qa="$lit$",Mn=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Mn,dp=`<${eo}>`,Ei=document,Us=()=>Ei.createComment(""),Fs=(e)=>e===null||typeof e!="object"&&typeof e!="function",to=Array.isArray,rh=(e)=>to(e)||typeof e?.[Symbol.iterator]==="function",Ya=`[
|
|
4263
4263
|
\f\r]`,fp=`[^
|
|
4264
|
-
\f\r"'\`<>=]`,pp=`[^\\s"'>=/]`,
|
|
4265
|
-
This is probably caused by illegal octal escape sequences.`);if(n.some((i)=>i?._$litStatic$))
|
|
4264
|
+
\f\r"'\`<>=]`,pp=`[^\\s"'>=/]`,Ls=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Qc=1,Za=2,mp=3,eh=/-->/g,th=/>/g,ei=new RegExp(`>|${Ya}(?:(${pp}+)(${Ya}*=${Ya}*(?:${fp}|("|')|))|$)`,"g"),gp=0,nh=1,_p=2,ih=3,Ka=/'/g,Ja=/"/g,ah=/^(?:script|style|textarea|title)$/i,oh=1,Mr=2,wr=3,no=1,Tr=2,xp=3,vp=4,yp=5,io=6,Sp=7,so=(e)=>(t,...n)=>{if(t.some((i)=>i===void 0))console.warn(`Some template strings are undefined.
|
|
4265
|
+
This is probably caused by illegal octal escape sequences.`);if(n.some((i)=>i?._$litStatic$))Ds("",`Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.
|
|
4266
4266
|
Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);return{["_$litType$"]:e,strings:t,values:n}},it=so(oh),kv=so(Mr),zv=so(wr),Ai=Symbol.for("lit-noChange"),ct=Symbol.for("lit-nothing"),sh=new WeakMap,Ti=Ei.createTreeWalker(Ei,129),Ri=Er;function lh(e,t){if(!to(e)||!e.hasOwnProperty("raw")){let n="invalid template strings array";throw n=`
|
|
4267
4267
|
Internal Error: expected template strings to be an array
|
|
4268
4268
|
with a 'raw' field. Faking a template strings array by
|
|
@@ -4274,7 +4274,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
|
|
|
4274
4274
|
https://github.com/lit/lit/issues/new?template=bug_report.md
|
|
4275
4275
|
and include information about your build tooling, if any.
|
|
4276
4276
|
`.trim().replace(/\n */g,`
|
|
4277
|
-
`),Error(n)}return jc!==void 0?jc.createHTML(t):t}var ch=(e,t)=>{let n=e.length-1,i=[],s=t===Mr?"<svg>":t===wr?"<math>":"",r,a=Ps;for(let l=0;l<n;l++){let c=e[l],h=-1,u,d=0,f;while(d<c.length){if(a.lastIndex=d,f=a.exec(c),f===null)break;if(d=a.lastIndex,a===Ps){if(f[Qc]==="!--")a=eh;else if(f[Qc]!==void 0)a=th;else if(f[Za]!==void 0){if(ah.test(f[Za]))r=new RegExp(`</${f[Za]}`,"g");a=ei}else if(f[mp]!==void 0)throw Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(a===ei)if(f[gp]===">")a=r??Ps,h=-1;else if(f[nh]===void 0)h=-2;else h=a.lastIndex-f[_p].length,u=f[nh],a=f[ih]===void 0?ei:f[ih]==='"'?Ja:Ka;else if(a===Ja||a===Ka)a=ei;else if(a===eh||a===th)a=Ps;else a=ei,r=void 0}console.assert(h===-1||a===ei||a===Ka||a===Ja,"unexpected parse state B");let _=a===ei&&e[l+1].startsWith("/>")?" ":"";s+=a===Ps?c+dp:h>=0?(i.push(u),c.slice(0,h)+Qa+c.slice(h))+Mn+_:c+Mn+(h===-2?l:_)}let o=s+(e[n]||"<?>")+(t===Mr?"</svg>":t===wr?"</math>":"");return[lh(e,o),i]};class Fs{constructor({strings:e,["_$litType$"]:t},n){this.parts=[];let i,s=0,r=0,a=e.length-1,o=this.parts,[l,c]=ch(e,t);if(this.el=Fs.createElement(l,n),Ti.currentNode=this.el.content,t===Mr||t===wr){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}while((i=Ti.nextNode())!==null&&o.length<a){if(i.nodeType===1){{let h=i.localName;if(/^(?:textarea|template)$/i.test(h)&&i.innerHTML.includes(Mn)){let u=`Expressions are not supported inside \`${h}\` elements. See https://lit.dev/msg/expression-in-${h} for more information.`;if(h==="template")throw Error(u);else Ns("",u)}}if(i.hasAttributes()){for(let h of i.getAttributeNames())if(h.endsWith(Qa)){let u=c[r++],f=i.getAttribute(h).split(Mn),_=/([.?@])?(.*)/.exec(u);o.push({type:no,index:s,name:_[2],strings:f,ctor:_[1]==="."?ao:_[1]==="?"?oo:_[1]==="@"?lo:Ki}),i.removeAttribute(h)}else if(h.startsWith(Mn))o.push({type:io,index:s}),i.removeAttribute(h)}if(ah.test(i.tagName)){let h=i.textContent.split(Mn),u=h.length-1;if(u>0){i.textContent=br?br.emptyScript:"";for(let d=0;d<u;d++)i.append(h[d],Ds()),Ti.nextNode(),o.push({type:Tr,index:++s});i.append(h[u],Ds())}}}else if(i.nodeType===8)if(i.data===eo)o.push({type:Tr,index:s});else{let u=-1;while((u=i.data.indexOf(Mn,u+1))!==-1)o.push({type:Sp,index:s}),u+=Mn.length-1}s++}if(c.length!==r)throw Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");Ze&&Ze({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){let n=Ei.createElement("template");return n.innerHTML=e,n}}function Ci(e,t,n=e,i){if(t===Ai)return t;let s=i!==void 0?n.__directives?.[i]:n.__directive,r=Us(t)?void 0:t._$litDirective$;if(s?.constructor!==r){if(s?._$notifyDirectiveConnectionChanged?.(!1),r===void 0)s=void 0;else s=new r(e),s._$initialize(e,n,i);if(i!==void 0)(n.__directives??=[])[i]=s;else n.__directive=s}if(s!==void 0)t=Ci(e,s._$resolve(e,t.values),s,i);return t}class ro{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){let{el:{content:t},parts:n}=this._$template,i=(e?.creationScope??Ei).importNode(t,!0);Ti.currentNode=i;let s=Ti.nextNode(),r=0,a=0,o=n[0];while(o!==void 0){if(r===o.index){let l;if(o.type===Tr)l=new Zi(s,s.nextSibling,this,e);else if(o.type===no)l=new o.ctor(s,o.name,o.strings,this,e);else if(o.type===io)l=new co(s,this,e);this._$parts.push(l),o=n[++a]}if(r!==o?.index)s=Ti.nextNode(),r++}return Ti.currentNode=Ei,i}_update(e){let t=0;for(let n of this._$parts){if(n!==void 0)if(Ze&&Ze({kind:"set part",part:n,value:e[t],valueIndex:t,values:e,templateInstance:this}),n.strings!==void 0)n._$setValue(e,n,t),t+=n.strings.length-2;else n._$setValue(e[t]);t++}}}class Zi{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,n,i){this.type=Tr,this._$committedValue=ct,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=n,this.options=i,this.__isConnected=i?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=gn(this._$startNode).parentNode,t=this._$parent;if(t!==void 0&&e?.nodeType===11)e=t.parentNode;return e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(this.parentNode===null)throw Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=Ci(this,e,t),Us(e)){if(e===ct||e==null||e===""){if(this._$committedValue!==ct)Ze&&Ze({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=ct}else if(e!==this._$committedValue&&e!==Ai)this._commitText(e)}else if(e._$litType$!==void 0)this._commitTemplateResult(e);else if(e.nodeType!==void 0){if(this.options?.host===e){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(e)}else if(rh(e))this._commitIterable(e);else this._commitText(e)}_insert(e){return gn(gn(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),Ri!==Er){let t=this._$startNode.parentNode?.nodeName;if(t==="STYLE"||t==="SCRIPT"){let n="Forbidden";if(t==="STYLE")n="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else n="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw Error(n)}}Ze&&Ze({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==ct&&Us(this._$committedValue)){let t=gn(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=ja(t,"data","property");e=this._textSanitizer(e),Ze&&Ze({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{let t=Ei.createTextNode("");if(this._commitNode(t),this._textSanitizer===void 0)this._textSanitizer=ja(t,"data","property");e=this._textSanitizer(e),Ze&&Ze({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){let{values:t,["_$litType$"]:n}=e,i=typeof n==="number"?this._$getTemplate(e):(n.el===void 0&&(n.el=Fs.createElement(lh(n.h,n.h[0]),this.options)),n);if(this._$committedValue?._$template===i)Ze&&Ze({kind:"template updating",template:i,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{let s=new ro(i,this),r=s._clone(this.options);Ze&&Ze({kind:"template instantiated",template:i,instance:s,parts:s._$parts,options:this.options,fragment:r,values:t}),s._update(t),Ze&&Ze({kind:"template instantiated and updated",template:i,instance:s,parts:s._$parts,options:this.options,fragment:r,values:t}),this._commitNode(r),this._$committedValue=s}}_$getTemplate(e){let t=sh.get(e.strings);if(t===void 0)sh.set(e.strings,t=new Fs(e));return t}_commitIterable(e){if(!to(this._$committedValue))this._$committedValue=[],this._$clear();let t=this._$committedValue,n=0,i;for(let s of e){if(n===t.length)t.push(i=new Zi(this._insert(Ds()),this._insert(Ds()),this,this.options));else i=t[n];i._$setValue(s),n++}if(n<t.length)this._$clear(i&&gn(i._$endNode).nextSibling,n),t.length=n}_$clear(e=gn(this._$startNode).nextSibling,t){this._$notifyConnectionChanged?.(!1,!0,t);while(e!==this._$endNode){let n=gn(e).nextSibling;gn(e).remove(),e=n}}setConnected(e){if(this._$parent===void 0)this.__isConnected=e,this._$notifyConnectionChanged?.(e);else throw Error("part.setConnected() may only be called on a RootPart returned from render().")}}class Ki{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,n,i,s){if(this.type=no,this._$committedValue=ct,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=i,this.options=s,n.length>2||n[0]!==""||n[1]!=="")this._$committedValue=Array(n.length-1).fill(new String),this.strings=n;else this._$committedValue=ct;this._sanitizer=void 0}_$setValue(e,t=this,n,i){let s=this.strings,r=!1;if(s===void 0){if(e=Ci(this,e,t,0),r=!Us(e)||e!==this._$committedValue&&e!==Ai,r)this._$committedValue=e}else{let a=e;e=s[0];let o,l;for(o=0;o<s.length-1;o++){if(l=Ci(this,a[n+o],t,o),l===Ai)l=this._$committedValue[o];if(r||=!Us(l)||l!==this._$committedValue[o],l===ct)e=ct;else if(e!==ct)e+=(l??"")+s[o+1];this._$committedValue[o]=l}}if(r&&!i)this._commitValue(e)}_commitValue(e){if(e===ct)gn(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=Ri(this.element,this.name,"attribute");e=this._sanitizer(e??""),Ze&&Ze({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),gn(this.element).setAttribute(this.name,e??"")}}}class ao extends Ki{constructor(){super(...arguments);this.type=xp}_commitValue(e){if(this._sanitizer===void 0)this._sanitizer=Ri(this.element,this.name,"property");e=this._sanitizer(e),Ze&&Ze({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===ct?void 0:e}}class oo extends Ki{constructor(){super(...arguments);this.type=vp}_commitValue(e){Ze&&Ze({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(e&&e!==ct),options:this.options}),gn(this.element).toggleAttribute(this.name,!!e&&e!==ct)}}class lo extends Ki{constructor(e,t,n,i,s){super(e,t,n,i,s);if(this.type=yp,this.strings!==void 0)throw Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if(e=Ci(this,e,t,0)??ct,e===Ai)return;let n=this._$committedValue,i=e===ct&&n!==ct||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==ct&&(n===ct||i);if(Ze&&Ze({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:i,addListener:s,oldListener:n}),i)this.element.removeEventListener(this.name,this,n);if(s)this.element.addEventListener(this.name,this,e);this._$committedValue=e}handleEvent(e){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,e);else this._$committedValue.handleEvent(e)}}class co{constructor(e,t,n){this.element=e,this.type=io,this._$disconnectableChildren=void 0,this._$parent=t,this.options=n}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){Ze&&Ze({kind:"commit to element binding",element:this.element,value:e,options:this.options}),Ci(this,e)}}var hh={_boundAttributeSuffix:Qa,_marker:Mn,_markerMatch:eo,_HTML_RESULT:oh,_getTemplateHtml:ch,_TemplateInstance:ro,_isIterable:rh,_resolveDirective:Ci,_ChildPart:Zi,_AttributePart:Ki,_BooleanAttributePart:oo,_EventPart:lo,_PropertyPart:ao,_ElementPart:co},bp=jt.litHtmlPolyfillSupportDevMode;bp?.(Fs,Zi);(jt.litHtmlVersions??=[]).push("3.3.3");if(jt.litHtmlVersions.length>1)queueMicrotask(()=>{Ns("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var Ls=(e,t,n)=>{if(t==null)throw TypeError(`The container to render into may not be ${t}`);let i=lp++,s=n?.renderBefore??t,r=s._$litPart$;if(Ze&&Ze({kind:"begin render",id:i,value:e,container:t,options:n,part:r}),r===void 0){let a=n?.renderBefore??null;s._$litPart$=r=new Zi(t.insertBefore(Ds(),a),a,void 0,n??{})}return r._$setValue(e),Ze&&Ze({kind:"end render",id:i,value:e,container:t,options:n,part:r}),r};Ls.setSanitizer=hp,Ls.createSanitizer=ja,Ls._testOnlyClearSanitizerFactoryDoNotCallOrElse=up;var Mp=(e,t)=>e,ho=!0,Bn=globalThis,uh;if(ho)Bn.litIssuedWarnings??=new Set,uh=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!Bn.litIssuedWarnings.has(t)&&!Bn.litIssuedWarnings.has(e))console.warn(t),Bn.litIssuedWarnings.add(t)};class ti extends Jt{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(e),this.__childPart=Ls(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return Ai}}ti._$litElement$=!0;ti[Mp("finalized",ti)]=!0;Bn.litElementHydrateSupport?.({LitElement:ti});var wp=ho?Bn.litElementPolyfillSupportDevMode:Bn.litElementPolyfillSupport;wp?.({LitElement:ti});(Bn.litElementVersions??=[]).push("4.2.2");if(ho&&Bn.litElementVersions.length>1)queueMicrotask(()=>{uh("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var dh=(e)=>(...t)=>({["_$litDirective$"]:e,values:t});class uo{constructor(e){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(e,t,n){this.__part=e,this._$parent=t,this.__attributeIndex=n}_$resolve(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}var{_ChildPart:ty}=hh,Tp=!0,ny=Tp&&window.ShadyDOM?.inUse&&window.ShadyDOM?.noPatch===!0?window.ShadyDOM.wrap:(e)=>e;var Ep={},fh=(e,t=Ep)=>e._$committedValue=t;class ph extends uo{constructor(){super(...arguments);this.key=ct}render(e,t){return this.key=e,t}update(e,[t,n]){if(t!==this.key)fh(e),this.key=t;return n}}var mh=dh(ph);class _h extends Error{status;statusText;payload;constructor(e){super(e.message);this.name="WodiraBrowserApiError",this.status=e.status,this.statusText=e.statusText,this.payload=e.payload}}var Ap="https://api.wodira.app",Rp="/external/v1/browser";class xh{publishableKey;baseUrl;fetcher;headers;checkoutSecrets=new Map;constructor(e){if(!e.publishableKey?.trim())throw Error("WodiraBrowserClient requires a publishableKey.");if(!e.publishableKey.startsWith("wpk_live_"))throw Error("Wodira browser publishable keys must start with wpk_live_.");this.publishableKey=e.publishableKey.trim(),this.baseUrl=(e.baseUrl??Ap).replace(/\/+$/,""),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis),this.headers=e.headers}searchEvents(e={},t){return this.request("/events/search",{method:"POST",body:e,signal:t})}getEvent(e,t){return this.request(`/events/${encodeURIComponent(e)}`,{signal:t})}getShirtSponsorCampaign(e,t){return this.request(`/shirt-sponsors/${encodeURIComponent(e)}`,{signal:t})}getEventRoutes(e,t){return this.request(`/events/${encodeURIComponent(e)}/routes`,{signal:t})}eventRouteGpxUrl(e,t){return`${this.baseUrl}/events/${encodeURIComponent(e)}/routes/${encodeURIComponent(t)}/gpx`}getEventShirtSponsorCampaign(e,t){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor`,{signal:t,credentials:"omit",cache:"no-store"})}requestShirtGuestCode(e,t,n){return this.shirtGuestPost(e,"code",t,n)}verifyShirtGuestCode(e,t,n){return this.shirtGuestPost(e,"verify",t,n)}createShirtGuestCheckout(e,t,n){return this.shirtGuestPost(e,"checkout",t,n)}getShirtGuestCheckoutStatus(e,t,n){return this.shirtGuestPost(e,"status",t,n)}shirtGuestPost(e,t,n,i){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor/guest/${t}`,{method:"POST",body:n,signal:i,credentials:"omit",cache:"no-store"})}getPricingCards(e,t){return this.request(`/events/${encodeURIComponent(e)}/pricing-cards`,{signal:t})}getRegistrationSummary(e,t){return this.request("/checkout/registration/summary",{method:"POST",body:e,signal:t})}createRegistrationCheckoutSession(e,t){let n=e.checkoutResumeSecret;if(!n&&e.idempotencyKey){if(n=this.checkoutSecrets.get(e.idempotencyKey),!n){if(n=globalThis.crypto.randomUUID(),this.checkoutSecrets.size>=128)this.checkoutSecrets.delete(this.checkoutSecrets.keys().next().value);this.checkoutSecrets.set(e.idempotencyKey,n)}}return this.request("/checkout/registration/session",{method:"POST",body:Pp({...e,...n?{checkoutResumeSecret:n}:{}}),signal:t})}lookupRegistrationReceipts(e,t,n){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/lookup`,{method:"POST",body:t,signal:n})}sendRegistrationReceipts(e,t,n){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/send`,{method:"POST",body:t,signal:n})}async request(e,t={}){let n=new Headers(this.headers);n.set("accept","application/json"),n.set("x-publishable-key",this.publishableKey);let i={method:t.method??"GET",headers:n};if(t.credentials)i.credentials=t.credentials;if(t.cache)i.cache=t.cache;if(t.signal)i.signal=t.signal;if(t.body!==void 0)n.set("content-type","application/json"),i.body=JSON.stringify(t.body);let s=await this.fetcher(`${this.baseUrl}${Rp}${e}`,i);if(!s.ok){let a=await Cp(s);throw new _h({status:s.status,statusText:s.statusText,message:Ip(a,s),payload:a})}let r=await s.text();return r?JSON.parse(r):void 0}}function vh(e){return new xh(e)}async function Cp(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function Ip(e,t){if(typeof e==="string")return e;let n=e?.message,i=n!==null&&typeof n==="object"&&"message"in n?n.message:n;if(typeof i==="string")return i;if(Array.isArray(i))return i.filter((s)=>typeof s==="string").join(", ");if(typeof e?.error==="string")return e.error;return`WODira browser API request failed with ${t.status} ${t.statusText}`}function Pp(e){return{...e,athletes:e.athletes.map(gh),...e.guestRegistrations?{guestRegistrations:e.guestRegistrations.map((t)=>({...t,athletes:t.athletes.map(gh)}))}:{}}}function gh(e){return{...e,birthDate:e.birthDate instanceof Date?e.birthDate.toISOString().slice(0,10):e.birthDate}}var yh=Sr`
|
|
4277
|
+
`),Error(n)}return jc!==void 0?jc.createHTML(t):t}var ch=(e,t)=>{let n=e.length-1,i=[],s=t===Mr?"<svg>":t===wr?"<math>":"",r,a=Ls;for(let l=0;l<n;l++){let c=e[l],h=-1,u,d=0,f;while(d<c.length){if(a.lastIndex=d,f=a.exec(c),f===null)break;if(d=a.lastIndex,a===Ls){if(f[Qc]==="!--")a=eh;else if(f[Qc]!==void 0)a=th;else if(f[Za]!==void 0){if(ah.test(f[Za]))r=new RegExp(`</${f[Za]}`,"g");a=ei}else if(f[mp]!==void 0)throw Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(a===ei)if(f[gp]===">")a=r??Ls,h=-1;else if(f[nh]===void 0)h=-2;else h=a.lastIndex-f[_p].length,u=f[nh],a=f[ih]===void 0?ei:f[ih]==='"'?Ja:Ka;else if(a===Ja||a===Ka)a=ei;else if(a===eh||a===th)a=Ls;else a=ei,r=void 0}console.assert(h===-1||a===ei||a===Ka||a===Ja,"unexpected parse state B");let _=a===ei&&e[l+1].startsWith("/>")?" ":"";s+=a===Ls?c+dp:h>=0?(i.push(u),c.slice(0,h)+Qa+c.slice(h))+Mn+_:c+Mn+(h===-2?l:_)}let o=s+(e[n]||"<?>")+(t===Mr?"</svg>":t===wr?"</math>":"");return[lh(e,o),i]};class Os{constructor({strings:e,["_$litType$"]:t},n){this.parts=[];let i,s=0,r=0,a=e.length-1,o=this.parts,[l,c]=ch(e,t);if(this.el=Os.createElement(l,n),Ti.currentNode=this.el.content,t===Mr||t===wr){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}while((i=Ti.nextNode())!==null&&o.length<a){if(i.nodeType===1){{let h=i.localName;if(/^(?:textarea|template)$/i.test(h)&&i.innerHTML.includes(Mn)){let u=`Expressions are not supported inside \`${h}\` elements. See https://lit.dev/msg/expression-in-${h} for more information.`;if(h==="template")throw Error(u);else Ds("",u)}}if(i.hasAttributes()){for(let h of i.getAttributeNames())if(h.endsWith(Qa)){let u=c[r++],f=i.getAttribute(h).split(Mn),_=/([.?@])?(.*)/.exec(u);o.push({type:no,index:s,name:_[2],strings:f,ctor:_[1]==="."?ao:_[1]==="?"?oo:_[1]==="@"?lo:Ki}),i.removeAttribute(h)}else if(h.startsWith(Mn))o.push({type:io,index:s}),i.removeAttribute(h)}if(ah.test(i.tagName)){let h=i.textContent.split(Mn),u=h.length-1;if(u>0){i.textContent=br?br.emptyScript:"";for(let d=0;d<u;d++)i.append(h[d],Us()),Ti.nextNode(),o.push({type:Tr,index:++s});i.append(h[u],Us())}}}else if(i.nodeType===8)if(i.data===eo)o.push({type:Tr,index:s});else{let u=-1;while((u=i.data.indexOf(Mn,u+1))!==-1)o.push({type:Sp,index:s}),u+=Mn.length-1}s++}if(c.length!==r)throw Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");Ze&&Ze({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){let n=Ei.createElement("template");return n.innerHTML=e,n}}function Ci(e,t,n=e,i){if(t===Ai)return t;let s=i!==void 0?n.__directives?.[i]:n.__directive,r=Fs(t)?void 0:t._$litDirective$;if(s?.constructor!==r){if(s?._$notifyDirectiveConnectionChanged?.(!1),r===void 0)s=void 0;else s=new r(e),s._$initialize(e,n,i);if(i!==void 0)(n.__directives??=[])[i]=s;else n.__directive=s}if(s!==void 0)t=Ci(e,s._$resolve(e,t.values),s,i);return t}class ro{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){let{el:{content:t},parts:n}=this._$template,i=(e?.creationScope??Ei).importNode(t,!0);Ti.currentNode=i;let s=Ti.nextNode(),r=0,a=0,o=n[0];while(o!==void 0){if(r===o.index){let l;if(o.type===Tr)l=new Zi(s,s.nextSibling,this,e);else if(o.type===no)l=new o.ctor(s,o.name,o.strings,this,e);else if(o.type===io)l=new co(s,this,e);this._$parts.push(l),o=n[++a]}if(r!==o?.index)s=Ti.nextNode(),r++}return Ti.currentNode=Ei,i}_update(e){let t=0;for(let n of this._$parts){if(n!==void 0)if(Ze&&Ze({kind:"set part",part:n,value:e[t],valueIndex:t,values:e,templateInstance:this}),n.strings!==void 0)n._$setValue(e,n,t),t+=n.strings.length-2;else n._$setValue(e[t]);t++}}}class Zi{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,n,i){this.type=Tr,this._$committedValue=ct,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=n,this.options=i,this.__isConnected=i?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=gn(this._$startNode).parentNode,t=this._$parent;if(t!==void 0&&e?.nodeType===11)e=t.parentNode;return e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(this.parentNode===null)throw Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=Ci(this,e,t),Fs(e)){if(e===ct||e==null||e===""){if(this._$committedValue!==ct)Ze&&Ze({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=ct}else if(e!==this._$committedValue&&e!==Ai)this._commitText(e)}else if(e._$litType$!==void 0)this._commitTemplateResult(e);else if(e.nodeType!==void 0){if(this.options?.host===e){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(e)}else if(rh(e))this._commitIterable(e);else this._commitText(e)}_insert(e){return gn(gn(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),Ri!==Er){let t=this._$startNode.parentNode?.nodeName;if(t==="STYLE"||t==="SCRIPT"){let n="Forbidden";if(t==="STYLE")n="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else n="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw Error(n)}}Ze&&Ze({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==ct&&Fs(this._$committedValue)){let t=gn(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=ja(t,"data","property");e=this._textSanitizer(e),Ze&&Ze({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{let t=Ei.createTextNode("");if(this._commitNode(t),this._textSanitizer===void 0)this._textSanitizer=ja(t,"data","property");e=this._textSanitizer(e),Ze&&Ze({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){let{values:t,["_$litType$"]:n}=e,i=typeof n==="number"?this._$getTemplate(e):(n.el===void 0&&(n.el=Os.createElement(lh(n.h,n.h[0]),this.options)),n);if(this._$committedValue?._$template===i)Ze&&Ze({kind:"template updating",template:i,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{let s=new ro(i,this),r=s._clone(this.options);Ze&&Ze({kind:"template instantiated",template:i,instance:s,parts:s._$parts,options:this.options,fragment:r,values:t}),s._update(t),Ze&&Ze({kind:"template instantiated and updated",template:i,instance:s,parts:s._$parts,options:this.options,fragment:r,values:t}),this._commitNode(r),this._$committedValue=s}}_$getTemplate(e){let t=sh.get(e.strings);if(t===void 0)sh.set(e.strings,t=new Os(e));return t}_commitIterable(e){if(!to(this._$committedValue))this._$committedValue=[],this._$clear();let t=this._$committedValue,n=0,i;for(let s of e){if(n===t.length)t.push(i=new Zi(this._insert(Us()),this._insert(Us()),this,this.options));else i=t[n];i._$setValue(s),n++}if(n<t.length)this._$clear(i&&gn(i._$endNode).nextSibling,n),t.length=n}_$clear(e=gn(this._$startNode).nextSibling,t){this._$notifyConnectionChanged?.(!1,!0,t);while(e!==this._$endNode){let n=gn(e).nextSibling;gn(e).remove(),e=n}}setConnected(e){if(this._$parent===void 0)this.__isConnected=e,this._$notifyConnectionChanged?.(e);else throw Error("part.setConnected() may only be called on a RootPart returned from render().")}}class Ki{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,n,i,s){if(this.type=no,this._$committedValue=ct,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=i,this.options=s,n.length>2||n[0]!==""||n[1]!=="")this._$committedValue=Array(n.length-1).fill(new String),this.strings=n;else this._$committedValue=ct;this._sanitizer=void 0}_$setValue(e,t=this,n,i){let s=this.strings,r=!1;if(s===void 0){if(e=Ci(this,e,t,0),r=!Fs(e)||e!==this._$committedValue&&e!==Ai,r)this._$committedValue=e}else{let a=e;e=s[0];let o,l;for(o=0;o<s.length-1;o++){if(l=Ci(this,a[n+o],t,o),l===Ai)l=this._$committedValue[o];if(r||=!Fs(l)||l!==this._$committedValue[o],l===ct)e=ct;else if(e!==ct)e+=(l??"")+s[o+1];this._$committedValue[o]=l}}if(r&&!i)this._commitValue(e)}_commitValue(e){if(e===ct)gn(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=Ri(this.element,this.name,"attribute");e=this._sanitizer(e??""),Ze&&Ze({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),gn(this.element).setAttribute(this.name,e??"")}}}class ao extends Ki{constructor(){super(...arguments);this.type=xp}_commitValue(e){if(this._sanitizer===void 0)this._sanitizer=Ri(this.element,this.name,"property");e=this._sanitizer(e),Ze&&Ze({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===ct?void 0:e}}class oo extends Ki{constructor(){super(...arguments);this.type=vp}_commitValue(e){Ze&&Ze({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(e&&e!==ct),options:this.options}),gn(this.element).toggleAttribute(this.name,!!e&&e!==ct)}}class lo extends Ki{constructor(e,t,n,i,s){super(e,t,n,i,s);if(this.type=yp,this.strings!==void 0)throw Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if(e=Ci(this,e,t,0)??ct,e===Ai)return;let n=this._$committedValue,i=e===ct&&n!==ct||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==ct&&(n===ct||i);if(Ze&&Ze({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:i,addListener:s,oldListener:n}),i)this.element.removeEventListener(this.name,this,n);if(s)this.element.addEventListener(this.name,this,e);this._$committedValue=e}handleEvent(e){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,e);else this._$committedValue.handleEvent(e)}}class co{constructor(e,t,n){this.element=e,this.type=io,this._$disconnectableChildren=void 0,this._$parent=t,this.options=n}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){Ze&&Ze({kind:"commit to element binding",element:this.element,value:e,options:this.options}),Ci(this,e)}}var hh={_boundAttributeSuffix:Qa,_marker:Mn,_markerMatch:eo,_HTML_RESULT:oh,_getTemplateHtml:ch,_TemplateInstance:ro,_isIterable:rh,_resolveDirective:Ci,_ChildPart:Zi,_AttributePart:Ki,_BooleanAttributePart:oo,_EventPart:lo,_PropertyPart:ao,_ElementPart:co},bp=jt.litHtmlPolyfillSupportDevMode;bp?.(Os,Zi);(jt.litHtmlVersions??=[]).push("3.3.3");if(jt.litHtmlVersions.length>1)queueMicrotask(()=>{Ds("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var Ns=(e,t,n)=>{if(t==null)throw TypeError(`The container to render into may not be ${t}`);let i=lp++,s=n?.renderBefore??t,r=s._$litPart$;if(Ze&&Ze({kind:"begin render",id:i,value:e,container:t,options:n,part:r}),r===void 0){let a=n?.renderBefore??null;s._$litPart$=r=new Zi(t.insertBefore(Us(),a),a,void 0,n??{})}return r._$setValue(e),Ze&&Ze({kind:"end render",id:i,value:e,container:t,options:n,part:r}),r};Ns.setSanitizer=hp,Ns.createSanitizer=ja,Ns._testOnlyClearSanitizerFactoryDoNotCallOrElse=up;var Mp=(e,t)=>e,ho=!0,Bn=globalThis,uh;if(ho)Bn.litIssuedWarnings??=new Set,uh=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!Bn.litIssuedWarnings.has(t)&&!Bn.litIssuedWarnings.has(e))console.warn(t),Bn.litIssuedWarnings.add(t)};class ti extends Jt{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(e),this.__childPart=Ns(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return Ai}}ti._$litElement$=!0;ti[Mp("finalized",ti)]=!0;Bn.litElementHydrateSupport?.({LitElement:ti});var wp=ho?Bn.litElementPolyfillSupportDevMode:Bn.litElementPolyfillSupport;wp?.({LitElement:ti});(Bn.litElementVersions??=[]).push("4.2.2");if(ho&&Bn.litElementVersions.length>1)queueMicrotask(()=>{uh("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var dh=(e)=>(...t)=>({["_$litDirective$"]:e,values:t});class uo{constructor(e){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(e,t,n){this.__part=e,this._$parent=t,this.__attributeIndex=n}_$resolve(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}var{_ChildPart:ty}=hh,Tp=!0,ny=Tp&&window.ShadyDOM?.inUse&&window.ShadyDOM?.noPatch===!0?window.ShadyDOM.wrap:(e)=>e;var Ep={},fh=(e,t=Ep)=>e._$committedValue=t;class ph extends uo{constructor(){super(...arguments);this.key=ct}render(e,t){return this.key=e,t}update(e,[t,n]){if(t!==this.key)fh(e),this.key=t;return n}}var mh=dh(ph);class _h extends Error{status;statusText;payload;constructor(e){super(e.message);this.name="WodiraBrowserApiError",this.status=e.status,this.statusText=e.statusText,this.payload=e.payload}}var Ap="https://api.wodira.app",Rp="/external/v1/browser";class xh{publishableKey;baseUrl;fetcher;headers;checkoutSecrets=new Map;constructor(e){if(!e.publishableKey?.trim())throw Error("WodiraBrowserClient requires a publishableKey.");if(!e.publishableKey.startsWith("wpk_live_"))throw Error("Wodira browser publishable keys must start with wpk_live_.");this.publishableKey=e.publishableKey.trim(),this.baseUrl=(e.baseUrl??Ap).replace(/\/+$/,""),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis),this.headers=e.headers}searchEvents(e={},t){return this.request("/events/search",{method:"POST",body:e,signal:t})}getEvent(e,t){return this.request(`/events/${encodeURIComponent(e)}`,{signal:t})}getShirtSponsorCampaign(e,t){return this.request(`/shirt-sponsors/${encodeURIComponent(e)}`,{signal:t})}getEventRoutes(e,t){return this.request(`/events/${encodeURIComponent(e)}/routes`,{signal:t})}eventRouteGpxUrl(e,t){return`${this.baseUrl}/events/${encodeURIComponent(e)}/routes/${encodeURIComponent(t)}/gpx`}getEventShirtSponsorCampaign(e,t){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor`,{signal:t,credentials:"omit",cache:"no-store"})}requestShirtGuestCode(e,t,n){return this.shirtGuestPost(e,"code",t,n)}verifyShirtGuestCode(e,t,n){return this.shirtGuestPost(e,"verify",t,n)}createShirtGuestCheckout(e,t,n){return this.shirtGuestPost(e,"checkout",t,n)}getShirtGuestCheckoutStatus(e,t,n){return this.shirtGuestPost(e,"status",t,n)}shirtGuestPost(e,t,n,i){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor/guest/${t}`,{method:"POST",body:n,signal:i,credentials:"omit",cache:"no-store"})}getPricingCards(e,t){return this.request(`/events/${encodeURIComponent(e)}/pricing-cards`,{signal:t})}getRegistrationSummary(e,t){return this.request("/checkout/registration/summary",{method:"POST",body:e,signal:t})}createRegistrationCheckoutSession(e,t){let n=e.checkoutResumeSecret;if(!n&&e.idempotencyKey){if(n=this.checkoutSecrets.get(e.idempotencyKey),!n){if(n=globalThis.crypto.randomUUID(),this.checkoutSecrets.size>=128)this.checkoutSecrets.delete(this.checkoutSecrets.keys().next().value);this.checkoutSecrets.set(e.idempotencyKey,n)}}return this.request("/checkout/registration/session",{method:"POST",body:Pp({...e,...n?{checkoutResumeSecret:n}:{}}),signal:t})}lookupRegistrationReceipts(e,t,n){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/lookup`,{method:"POST",body:t,signal:n})}sendRegistrationReceipts(e,t,n){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/send`,{method:"POST",body:t,signal:n})}async request(e,t={}){let n=new Headers(this.headers);n.set("accept","application/json"),n.set("x-publishable-key",this.publishableKey);let i={method:t.method??"GET",headers:n};if(t.credentials)i.credentials=t.credentials;if(t.cache)i.cache=t.cache;if(t.signal)i.signal=t.signal;if(t.body!==void 0)n.set("content-type","application/json"),i.body=JSON.stringify(t.body);let s=await this.fetcher(`${this.baseUrl}${Rp}${e}`,i);if(!s.ok){let a=await Cp(s);throw new _h({status:s.status,statusText:s.statusText,message:Ip(a,s),payload:a})}let r=await s.text();return r?JSON.parse(r):void 0}}function vh(e){return new xh(e)}async function Cp(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function Ip(e,t){if(typeof e==="string")return e;let n=e?.message,i=n!==null&&typeof n==="object"&&"message"in n?n.message:n;if(typeof i==="string")return i;if(Array.isArray(i))return i.filter((s)=>typeof s==="string").join(", ");if(typeof e?.error==="string")return e.error;return`WODira browser API request failed with ${t.status} ${t.statusText}`}function Pp(e){return{...e,athletes:e.athletes.map(gh),...e.guestRegistrations?{guestRegistrations:e.guestRegistrations.map((t)=>({...t,athletes:t.athletes.map(gh)}))}:{}}}function gh(e){return{...e,birthDate:e.birthDate instanceof Date?e.birthDate.toISOString().slice(0,10):e.birthDate}}var yh=Ps`
|
|
4278
4278
|
:host {
|
|
4279
4279
|
box-sizing: border-box;
|
|
4280
4280
|
color: var(--wodira-color-text, #17132e);
|
|
@@ -4704,7 +4704,75 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
|
|
|
4704
4704
|
justify-content: space-between;
|
|
4705
4705
|
gap: var(--wodira-space, 1rem);
|
|
4706
4706
|
}
|
|
4707
|
-
|
|
4707
|
+
`,dy=Ps`
|
|
4708
|
+
[part~='waiver-item'] {
|
|
4709
|
+
align-items: center;
|
|
4710
|
+
display: flex;
|
|
4711
|
+
flex-wrap: wrap;
|
|
4712
|
+
gap: 0.25rem 0.75rem;
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
[part~='waiver-read'] {
|
|
4716
|
+
min-height: var(--wodira-control-height, 2.75rem);
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
[part~='waiver-dialog'] {
|
|
4720
|
+
background: var(--wodira-color-surface, #fff);
|
|
4721
|
+
border: 1px solid var(--wodira-color-border, #dcd9e3);
|
|
4722
|
+
border-radius: var(--wodira-radius, 1rem);
|
|
4723
|
+
color: var(--wodira-color-text, #17132e);
|
|
4724
|
+
max-height: calc(100dvh - 2rem);
|
|
4725
|
+
max-width: calc(100vw - 2rem);
|
|
4726
|
+
padding: 0;
|
|
4727
|
+
width: 42rem;
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
[part~='waiver-dialog'][open] {
|
|
4731
|
+
display: flex;
|
|
4732
|
+
flex-direction: column;
|
|
4733
|
+
}
|
|
4734
|
+
|
|
4735
|
+
[part~='waiver-dialog']::backdrop {
|
|
4736
|
+
background: rgb(23 19 46 / 0.56);
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4739
|
+
[part~='waiver-dialog-header'] {
|
|
4740
|
+
align-items: start;
|
|
4741
|
+
border-bottom: 1px solid var(--wodira-color-border, #dcd9e3);
|
|
4742
|
+
display: flex;
|
|
4743
|
+
gap: 0.75rem;
|
|
4744
|
+
justify-content: space-between;
|
|
4745
|
+
padding: clamp(0.75rem, 3vw, 1.5rem);
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4748
|
+
[part~='waiver-dialog-header'] h2 {
|
|
4749
|
+
font-size: clamp(1.1rem, 2.25vw, 1.5rem);
|
|
4750
|
+
line-height: 1.3;
|
|
4751
|
+
margin: 0.35rem 0 0;
|
|
4752
|
+
min-width: 0;
|
|
4753
|
+
overflow-wrap: anywhere;
|
|
4754
|
+
}
|
|
4755
|
+
|
|
4756
|
+
[part~='waiver-close'] {
|
|
4757
|
+
flex-shrink: 0;
|
|
4758
|
+
}
|
|
4759
|
+
|
|
4760
|
+
[part~='waiver-document'] {
|
|
4761
|
+
font-size: 1rem;
|
|
4762
|
+
line-height: 1.65;
|
|
4763
|
+
min-height: 0;
|
|
4764
|
+
overflow: auto;
|
|
4765
|
+
overflow-wrap: anywhere;
|
|
4766
|
+
overscroll-behavior: contain;
|
|
4767
|
+
padding: clamp(0.75rem, 3vw, 1.5rem);
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
[part~='waiver-document'] > :first-child { margin-top: 0; }
|
|
4771
|
+
[part~='waiver-document'] > :last-child { margin-bottom: 0; }
|
|
4772
|
+
[part~='waiver-document'] a { color: var(--wodira-color-accent, #c40072); }
|
|
4773
|
+
[part~='waiver-document'] pre { white-space: pre-wrap; }
|
|
4774
|
+
[part~='waiver-document-plain'] { white-space: pre-wrap; }
|
|
4775
|
+
`;var Iv={es:{label:"Patrocina la camiseta del evento",loading:"Cargando camiseta y pujas…",error:"No se ha podido cargar la campaña.",invalid:"Configura una campaña y una clave publicable válidas.",retry:"Reintentar",shirtAria:"Camiseta 3D. Arrástrala para girarla y toca un espacio para elegirlo.",hint:"Arrastra para girar · Toca un espacio para pujar",noModel:"La vista 3D no está disponible en este dispositivo. Elige un espacio en la lista.",zoomIn:"Acercar camiseta",zoomOut:"Alejar camiseta",views:"Vista de la camiseta",slots:"Espacios",closes:"Cierre de pujas",shirts:"camisetas",from:"Desde",current:"Puja actual",reserved:"Reservado por la organización",minimum:"Puja mínima",increments:"Incrementos de",amount:"Tu puja (€)",bid:"Pujar",outbid:"Superar la puja",closed:"Las pujas de esta camiseta están cerradas.",pick:"Elige un espacio en la camiseta o en la lista.",belowMinimum:"La puja debe ser de al menos",step:"Usa múltiplos del incremento a partir de la puja mínima.",guestNote:"Verifica tu email y continúa al pago seguro, sin contraseña.",note:"Terminarás en WODira: inicio de sesión, logotipo en SVG y pago seguro con Stripe.",popupBlocked:"Tu navegador ha bloqueado la ventana de WODira.",openBid:"Abrir la puja en WODira",waiting:"Completa la puja en la ventana de WODira. Esta camiseta se actualizará sola.",paid:"Puja confirmada. Tu marca ya aparece en la camiseta.",leads:"lidera",sides:{front:"Delantera",back:"Trasera","left-sleeve":"Manga izquierda","right-sleeve":"Manga derecha"}},en:{label:"Sponsor the event shirt",loading:"Loading shirt and bids…",error:"The campaign could not be loaded.",invalid:"Set a valid campaign and publishable key.",retry:"Retry",shirtAria:"3D shirt. Drag it to turn it and tap a space to choose it.",hint:"Drag to turn · Tap a space to bid",noModel:"The 3D view is not available on this device. Choose a space from the list.",zoomIn:"Zoom in",zoomOut:"Zoom out",views:"Shirt view",slots:"Spaces",closes:"Bidding closes",shirts:"shirts",from:"From",current:"Current bid",reserved:"Reserved by the organizer",minimum:"Minimum bid",increments:"Increments of",amount:"Your bid (€)",bid:"Bid",outbid:"Outbid",closed:"Bidding for this shirt is closed.",pick:"Choose a space on the shirt or in the list.",belowMinimum:"The bid must be at least",step:"Use multiples of the increment above the minimum bid.",guestNote:"Verify your email and continue to secure payment, without a password.",note:"You will finish on WODira: sign-in, SVG logo and secure Stripe payment.",popupBlocked:"Your browser blocked the WODira window.",openBid:"Open the bid on WODira",waiting:"Complete the bid in the WODira window. This shirt will update by itself.",paid:"Bid confirmed. Your brand is now on the shirt.",leads:"leads",sides:{front:"Front",back:"Back","left-sleeve":"Left sleeve","right-sleeve":"Right sleeve"}},pt:{label:"Patrocina a camisola do evento",loading:"A carregar camisola e licitações…",error:"Não foi possível carregar a campanha.",invalid:"Configura uma campanha e uma chave publicável válidas.",retry:"Tentar novamente",shirtAria:"Camisola 3D. Arrasta-a para a rodar e toca num espaço para o escolher.",hint:"Arrasta para rodar · Toca num espaço para licitar",noModel:"A vista 3D não está disponível neste dispositivo. Escolhe um espaço na lista.",zoomIn:"Aproximar camisola",zoomOut:"Afastar camisola",views:"Vista da camisola",slots:"Espaços",closes:"Fim das licitações",shirts:"camisolas",from:"Desde",current:"Licitação atual",reserved:"Reservado pela organização",minimum:"Licitação mínima",increments:"Incrementos de",amount:"A tua licitação (€)",bid:"Licitar",outbid:"Superar a licitação",closed:"As licitações desta camisola estão fechadas.",pick:"Escolhe um espaço na camisola ou na lista.",belowMinimum:"A licitação deve ser de pelo menos",step:"Usa múltiplos do incremento a partir da licitação mínima.",guestNote:"Verifica o teu email e continua para o pagamento seguro, sem palavra-passe.",note:"Vais terminar na WODira: início de sessão, logótipo em SVG e pagamento seguro com Stripe.",popupBlocked:"O teu navegador bloqueou a janela da WODira.",openBid:"Abrir a licitação na WODira",waiting:"Conclui a licitação na janela da WODira. Esta camisola atualiza-se sozinha.",paid:"Licitação confirmada. A tua marca já aparece na camisola.",leads:"lidera",sides:{front:"Frente",back:"Costas","left-sleeve":"Manga esquerda","right-sleeve":"Manga direita"}}},Ic=["front","back","left-sleeve","right-sleeve"],Pc="https://wodira.app",Pv="/images/sponsor-studio/white-shirt-realistic-v1.glb?v=7",Vf=6,Lv={slot:["--wodira-color-accent","#c40072"],slotPreview:["--wodira-color-accent","#c40072"],slotText:["--wodira-color-accent-contrast","#ffffff"],priceLeading:["--wodira-color-accent","#c40072"],price:["--wodira-color-primary","#17132e"],reserved:["--wodira-color-border","#dcd9e3"],selected:["--wodira-color-primary","#17132e"]};function Xf(e){return e==="left-sleeve"||e==="right-sleeve"?{side:"front",surface:e}:{side:e}}function Nv(e){let t={id:e.id,name:e.name,...Xf(e.side),x:e.x,y:e.y,width:e.width,height:e.height,printWidth:e.printWidthCm,printHeight:e.printHeightCm,startingPrice:e.startingPriceCents/100,bidPrice:e.minimumBidCents/100,increment:e.incrementCents/100,isReserved:!!e.isReserved,bids:e.leadingArtworkUrl?[{id:e.id,buyer:e.leadingBrandName??"",amount:(e.leadingAmountCents??0)/100,paidAt:0,status:"leading",logo:e.leadingArtworkUrl,views:0,opens:0,clicks:0}]:[]};if(e.reservedArtworkUrl)t.reservedLogo=e.reservedArtworkUrl;return t}function Lc(e){try{let t=new URL(e),n=["localhost","127.0.0.1","[::1]"].includes(t.hostname);if(t.username||t.password)return null;return t.protocol==="https:"||n&&t.protocol==="http:"?t:null}catch{return null}}class Nc extends ti{static properties={campaignId:{type:String,attribute:"campaign-id"},modelUrl:{type:String,attribute:"model-url"},bidMode:{type:String,attribute:"bid-mode"},campaignData:{attribute:!1},publishableKey:{type:String,attribute:"publishable-key"},baseUrl:{type:String,attribute:"base-url"},appUrl:{type:String,attribute:"app-url"},locale:{type:String},campaign:{state:!0},loading:{state:!0},failed:{state:!0},selectedSlotId:{state:!0},side:{state:!0},amountEuros:{state:!0},modelUnavailable:{state:!0},modelLoading:{state:!0},status:{state:!0}};static styles=[yh,Ps`
|
|
4708
4776
|
:host {
|
|
4709
4777
|
/* Earlier releases used these shorter names; they still apply as fallbacks. */
|
|
4710
4778
|
--_accent: var(--wodira-color-accent, var(--wodira-primary, #c40072));
|