diff --git a/backend/admin/src/main.tsx b/backend/admin/src/main.tsx
index 0d20797..7f95eaa 100644
--- a/backend/admin/src/main.tsx
+++ b/backend/admin/src/main.tsx
@@ -53,6 +53,8 @@ const GALLERY_TABS: GalleryTab[] = ['decks', 'cas', 'engines', 'icgs']
const MIN_SPEED_LEVEL = 1
const MAX_SPEED_LEVEL = 10
const DEFAULT_SPEED_LEVEL = 5
+const MAX_SPEED_FRAME_BUDGET_MS = 12
+const MAX_SPEED_STEPS_PER_FRAME = 64
interface RootConfig {
rootName: string
@@ -736,16 +738,55 @@ function WindowControls({
function playbackIntervalMs(speedLevel: number) {
const clamped = Math.max(MIN_SPEED_LEVEL, Math.min(MAX_SPEED_LEVEL, speedLevel))
+ if (clamped >= MAX_SPEED_LEVEL) return 0
const slowMs = 720
const fastMs = 60
- const t = (clamped - MIN_SPEED_LEVEL) / (MAX_SPEED_LEVEL - MIN_SPEED_LEVEL)
+ const t = (clamped - MIN_SPEED_LEVEL) / (MAX_SPEED_LEVEL - MIN_SPEED_LEVEL - 1)
return Math.round(slowMs - (slowMs - fastMs) * t)
}
-function speedStepsPerSecond(speedLevel: number) {
+function isMaxPlaybackSpeed(speedLevel: number) {
+ return speedLevel >= MAX_SPEED_LEVEL
+}
+
+function speedReadout(speedLevel: number) {
+ if (isMaxPlaybackSpeed(speedLevel)) return 'MAX'
return Math.round((1000 / playbackIntervalMs(speedLevel)) * 10) / 10
}
+function startPlaybackLoop(speedLevel: number, step: () => void) {
+ if (!isMaxPlaybackSpeed(speedLevel)) {
+ const timer = window.setInterval(step, playbackIntervalMs(speedLevel))
+ return () => window.clearInterval(timer)
+ }
+
+ let cancelled = false
+ let frame = 0
+
+ function tick() {
+ const startedAt = performance.now()
+ let steps = 0
+
+ while (
+ !cancelled &&
+ steps < MAX_SPEED_STEPS_PER_FRAME &&
+ performance.now() - startedAt < MAX_SPEED_FRAME_BUDGET_MS
+ ) {
+ step()
+ steps += 1
+ }
+
+ if (!cancelled) frame = window.requestAnimationFrame(tick)
+ }
+
+ frame = window.requestAnimationFrame(tick)
+
+ return () => {
+ cancelled = true
+ window.cancelAnimationFrame(frame)
+ }
+}
+
function StudioSpeedKnob({
className = '',
speedLevel,
@@ -758,13 +799,13 @@ function StudioSpeedKnob({
const clamped = Math.max(MIN_SPEED_LEVEL, Math.min(MAX_SPEED_LEVEL, speedLevel))
const turn = (clamped - MIN_SPEED_LEVEL) / (MAX_SPEED_LEVEL - MIN_SPEED_LEVEL)
const angle = -132 + turn * 264
- const stepsPerSecond = speedStepsPerSecond(clamped)
+ const readout = speedReadout(clamped)
return (
)
}
@@ -2294,15 +2335,14 @@ function LibraryEditor({
React.useEffect(() => {
if (!running) return
- const timer = window.setInterval(() => {
+ return startPlaybackLoop(speedLevel, () => {
setCells((current) => {
const stepped = stepCaSimulation(current, previewSettings)
setRuntimeSettings(stepped.settings)
return stepped.cells
})
setGeneration((current) => current + 1)
- }, playbackIntervalMs(speedLevel))
- return () => window.clearInterval(timer)
+ })
}, [previewSettings, running, speedLevel])
React.useEffect(() => {
@@ -3518,8 +3558,7 @@ function DeckViewer({ deckId }: { deckId: string }) {
React.useEffect(() => {
if (!running) return
- const timer = window.setInterval(stepOnce, playbackIntervalMs(speedLevel))
- return () => window.clearInterval(timer)
+ return startPlaybackLoop(speedLevel, stepOnce)
}, [running, speedLevel, stepOnce])
React.useEffect(() => {
@@ -3726,15 +3765,14 @@ function DeckEditor({ deckId, initialSceneId }: { deckId: string; initialSceneId
React.useEffect(() => {
if (!running) return
- const timer = window.setInterval(() => {
+ return startPlaybackLoop(speedLevel, () => {
setCells((current) => {
const stepped = stepCaSimulation(current, previewSettings)
setRuntimeSettings(stepped.settings)
return stepped.cells
})
setGeneration((current) => current + 1)
- }, playbackIntervalMs(speedLevel))
- return () => window.clearInterval(timer)
+ })
}, [previewSettings, running, speedLevel])
React.useEffect(() => {
diff --git a/backend/admin/src/voxel3d/voxelRendererCore.ts b/backend/admin/src/voxel3d/voxelRendererCore.ts
index 1d0a200..1fb629a 100644
--- a/backend/admin/src/voxel3d/voxelRendererCore.ts
+++ b/backend/admin/src/voxel3d/voxelRendererCore.ts
@@ -30,6 +30,7 @@ interface SceneBundle {
bounds: THREE.LineSegments
camera: THREE.PerspectiveCamera
controls: OrbitControls
+ glowMesh: THREE.InstancedMesh | null
grid: THREE.GridHelper
mesh: THREE.InstancedMesh | null
mountNode: HTMLDivElement
@@ -61,10 +62,20 @@ function disposeMesh(scene: THREE.Scene, mesh: THREE.InstancedMesh | null) {
function createVoxelMaterial(primaryColor: THREE.Color) {
return new THREE.MeshStandardMaterial({
color: primaryColor,
- emissive: primaryColor.clone().multiplyScalar(0.36),
- emissiveIntensity: 0.26,
+ emissive: primaryColor.clone().multiplyScalar(0.58),
+ emissiveIntensity: 0.48,
metalness: 0.04,
- roughness: 0.28,
+ roughness: 0.68,
+ vertexColors: true
+ })
+}
+
+function createVoxelGlowMaterial() {
+ return new THREE.MeshBasicMaterial({
+ blending: THREE.AdditiveBlending,
+ depthWrite: false,
+ opacity: 0.26,
+ transparent: true,
vertexColors: true
})
}
@@ -112,6 +123,18 @@ function createVoxelMesh(size: number, options: VoxelRendererOptions) {
return mesh
}
+function createVoxelGlowMesh(size: number, options: VoxelRendererOptions) {
+ const spacing = WORLD_SIZE / size
+ const edge = spacing * (1 - clamp(options.cellGap, 0.02, 0.45)) * 1.18
+ const geometry = new THREE.BoxGeometry(edge, edge, edge)
+ const material = createVoxelGlowMaterial()
+ const mesh = new THREE.InstancedMesh(geometry, material, Math.max(1, size ** 3))
+ mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage)
+ mesh.castShadow = false
+ mesh.receiveShadow = false
+ return mesh
+}
+
const CATEGORICAL_STATE_COLORS = [
'#70f45f',
'#f0c94a',
@@ -195,12 +218,17 @@ function colorForCell(
function updateVoxelMesh(bundle: SceneBundle, cells: VoxelCell[], size: number, ruleId: string, options: VoxelRendererOptions) {
disposeMesh(bundle.scene, bundle.mesh)
+ disposeMesh(bundle.scene, bundle.glowMesh)
bundle.mesh = createVoxelMesh(size, options)
+ bundle.glowMesh = createVoxelGlowMesh(size, options)
+ bundle.scene.add(bundle.glowMesh)
bundle.scene.add(bundle.mesh)
const mesh = bundle.mesh
+ const glowMesh = bundle.glowMesh
const dummy = new THREE.Object3D()
const color = new THREE.Color()
+ const glowColor = new THREE.Color()
const spacing = WORLD_SIZE / size
const origin = -WORLD_SIZE / 2 + spacing / 2
const statePalette = createStatePalette(cells, options)
@@ -216,14 +244,22 @@ function updateVoxelMesh(bundle: SceneBundle, cells: VoxelCell[], size: number,
colorForCell(bundle, cell, size, ruleId, statePalette, color)
mesh.setMatrixAt(instanceIndex, dummy.matrix)
mesh.setColorAt(instanceIndex, color)
+ glowColor.copy(color).lerp(new THREE.Color('#ffffff'), 0.16).multiplyScalar(1.18)
+ glowMesh.setMatrixAt(instanceIndex, dummy.matrix)
+ glowMesh.setColorAt(instanceIndex, glowColor)
instanceIndex += 1
}
mesh.count = instanceIndex
+ glowMesh.count = instanceIndex
mesh.instanceMatrix.needsUpdate = true
+ glowMesh.instanceMatrix.needsUpdate = true
if (mesh.instanceColor) {
mesh.instanceColor.needsUpdate = true
}
+ if (glowMesh.instanceColor) {
+ glowMesh.instanceColor.needsUpdate = true
+ }
}
export function createVoxelRendererCore(targetNode: HTMLDivElement, options: VoxelRendererOptions): VoxelRendererCore {
@@ -239,7 +275,7 @@ export function createVoxelRendererCore(targetNode: HTMLDivElement, options: Vox
renderer.shadowMap.type = THREE.PCFSoftShadowMap
renderer.outputColorSpace = THREE.SRGBColorSpace
renderer.toneMapping = THREE.ACESFilmicToneMapping
- renderer.toneMappingExposure = 1.12
+ renderer.toneMappingExposure = 1.32
targetNode.appendChild(renderer.domElement)
const controls = new OrbitControls(camera, renderer.domElement)
@@ -249,16 +285,16 @@ export function createVoxelRendererCore(targetNode: HTMLDivElement, options: Vox
controls.maxDistance = 60
controls.target.set(0, 0, 0)
- scene.add(new THREE.AmbientLight('#f5efb7', 0.42))
- scene.add(new THREE.HemisphereLight('#f5efb7', '#061006', 0.96))
+ scene.add(new THREE.AmbientLight('#f5efb7', 0.72))
+ scene.add(new THREE.HemisphereLight('#f5efb7', '#10360d', 1.18))
- const keyLight = new THREE.DirectionalLight('#fff3a8', 1.25)
+ const keyLight = new THREE.DirectionalLight('#fff3a8', 0.82)
keyLight.position.set(18, 28, 14)
keyLight.target.position.set(0, 0, 0)
scene.add(keyLight)
scene.add(keyLight.target)
- const fillLight = new THREE.DirectionalLight(options.accentColor, 0.46)
+ const fillLight = new THREE.DirectionalLight(options.accentColor, 0.72)
fillLight.position.set(-24, 18, -12)
scene.add(fillLight)
@@ -273,6 +309,7 @@ export function createVoxelRendererCore(targetNode: HTMLDivElement, options: Vox
bounds,
camera,
controls,
+ glowMesh: null,
grid,
mesh: null,
mountNode: targetNode,
@@ -310,6 +347,7 @@ export function createVoxelRendererCore(targetNode: HTMLDivElement, options: Vox
window.cancelAnimationFrame(bundle.animationFrame)
bundle.resizeObserver.disconnect()
disposeMesh(bundle.scene, bundle.mesh)
+ disposeMesh(bundle.scene, bundle.glowMesh)
bundle.bounds.geometry.dispose()
disposeMaterial(bundle.bounds.material)
bundle.grid.geometry.dispose()
diff --git a/backend/public/admin/assets/index-nVGDjB10.js b/backend/public/admin/assets/index-COp4VUl7.js
similarity index 59%
rename from backend/public/admin/assets/index-nVGDjB10.js
rename to backend/public/admin/assets/index-COp4VUl7.js
index 7bf6e13..841852e 100644
--- a/backend/public/admin/assets/index-nVGDjB10.js
+++ b/backend/public/admin/assets/index-COp4VUl7.js
@@ -1,18 +1,18 @@
-(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function n(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();function zx(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var $f={exports:{}},dl={};var nv;function QM(){if(nv)return dl;nv=1;var a=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),"key"in l){c={};for(var p in l)p!=="key"&&(c[p]=l[p])}else c=l;return l=c.ref,{$$typeof:a,type:s,key:d,ref:l!==void 0?l:null,props:c}}return dl.Fragment=e,dl.jsx=n,dl.jsxs=n,dl}var iv;function JM(){return iv||(iv=1,$f.exports=QM()),$f.exports}var g=JM(),Qf={exports:{}},Mt={};var av;function eb(){if(av)return Mt;av=1;var a=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),v=Symbol.iterator;function b(z){return z===null||typeof z!="object"?null:(z=v&&z[v]||z["@@iterator"],typeof z=="function"?z:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,y={};function x(z,te,Ee){this.props=z,this.context=te,this.refs=y,this.updater=Ee||A}x.prototype.isReactComponent={},x.prototype.setState=function(z,te){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,te,"setState")},x.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function P(){}P.prototype=x.prototype;function L(z,te,Ee){this.props=z,this.context=te,this.refs=y,this.updater=Ee||A}var R=L.prototype=new P;R.constructor=L,w(R,x.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function O(){}var U={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function N(z,te,Ee){var Oe=Ee.ref;return{$$typeof:a,type:z,key:te,ref:Oe!==void 0?Oe:null,props:Ee}}function k(z,te){return N(z.type,te,z.props)}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===a}function Q(z){var te={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Ee){return te[Ee]})}var de=/\/+/g;function pe(z,te){return typeof z=="object"&&z!==null&&z.key!=null?Q(""+z.key):te.toString(36)}function J(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(O,O):(z.status="pending",z.then(function(te){z.status==="pending"&&(z.status="fulfilled",z.value=te)},function(te){z.status==="pending"&&(z.status="rejected",z.reason=te)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function G(z,te,Ee,Oe,He){var le=typeof z;(le==="undefined"||le==="boolean")&&(z=null);var Me=!1;if(z===null)Me=!0;else switch(le){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(z.$$typeof){case a:case e:Me=!0;break;case _:return Me=z._init,G(Me(z._payload),te,Ee,Oe,He)}}if(Me)return He=He(z),Me=Oe===""?"."+pe(z,0):Oe,I(He)?(Ee="",Me!=null&&(Ee=Me.replace(de,"$&/")+"/"),G(He,te,Ee,"",function(rt){return rt})):He!=null&&(V(He)&&(He=k(He,Ee+(He.key==null||z&&z.key===He.key?"":(""+He.key).replace(de,"$&/")+"/")+Me)),te.push(He)),1;Me=0;var Ae=Oe===""?".":Oe+":";if(I(z))for(var je=0;je>>1,xe=G[Se];if(0>>1;Sel(Ee,se))Oel(He,Ee)?(G[Se]=He,G[Oe]=se,Se=Oe):(G[Se]=Ee,G[te]=se,Se=te);else if(Oel(He,se))G[Se]=He,G[Oe]=se,Se=Oe;else break e}}return j}function l(G,j){var se=G.sortIndex-j.sortIndex;return se!==0?se:G.id-j.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;a.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();a.unstable_now=function(){return d.now()-p}}var m=[],h=[],_=1,S=null,v=3,b=!1,A=!1,w=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function R(G){for(var j=n(h);j!==null;){if(j.callback===null)s(h);else if(j.startTime<=G)s(h),j.sortIndex=j.expirationTime,e(m,j);else break;j=n(h)}}function I(G){if(w=!1,R(G),!A)if(n(m)!==null)A=!0,O||(O=!0,Q());else{var j=n(h);j!==null&&J(I,j.startTime-G)}}var O=!1,U=-1,T=5,N=-1;function k(){return y?!0:!(a.unstable_now()-NG&&k());){var Se=S.callback;if(typeof Se=="function"){S.callback=null,v=S.priorityLevel;var xe=Se(S.expirationTime<=G);if(G=a.unstable_now(),typeof xe=="function"){S.callback=xe,R(G),j=!0;break t}S===n(m)&&s(m),R(G)}else s(m);S=n(m)}if(S!==null)j=!0;else{var z=n(h);z!==null&&J(I,z.startTime-G),j=!1}}break e}finally{S=null,v=se,b=!1}j=void 0}}finally{j?Q():O=!1}}}var Q;if(typeof L=="function")Q=function(){L(V)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,pe=de.port2;de.port1.onmessage=V,Q=function(){pe.postMessage(null)}}else Q=function(){x(V,0)};function J(G,j){U=x(function(){G(a.unstable_now())},j)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(G){G.callback=null},a.unstable_forceFrameRate=function(G){0>G||125Se?(G.sortIndex=se,e(h,G),n(m)===null&&G===n(h)&&(w?(P(U),U=-1):w=!0,J(I,se-Se))):(G.sortIndex=xe,e(m,G),A||b||(A=!0,O||(O=!0,Q()))),G},a.unstable_shouldYield=k,a.unstable_wrapCallback=function(G){var j=v;return function(){var se=v;v=j;try{return G.apply(this,arguments)}finally{v=se}}}})(th)),th}var ov;function ib(){return ov||(ov=1,eh.exports=nb()),eh.exports}var nh={exports:{}},Xn={};var lv;function ab(){if(lv)return Xn;lv=1;var a=Xp();function e(m){var h="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(e){console.error(e)}}return a(),nh.exports=ab(),nh.exports}var uv;function rb(){if(uv)return fl;uv=1;var a=ib(),e=Xp(),n=sb();function s(t){var i="https://react.dev/errors/"+t;if(1xe||(t.current=Se[xe],Se[xe]=null,xe--)}function Ee(t,i){xe++,Se[xe]=t.current,t.current=i}var Oe=z(null),He=z(null),le=z(null),Me=z(null);function Ae(t,i){switch(Ee(le,i),Ee(He,t),Ee(Oe,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?T_(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=T_(i),t=A_(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}te(Oe),Ee(Oe,t)}function je(){te(Oe),te(He),te(le)}function rt(t){t.memoizedState!==null&&Ee(Me,t);var i=Oe.current,r=A_(i,t.type);i!==r&&(Ee(He,t),Ee(Oe,r))}function $e(t){He.current===t&&(te(Oe),te(He)),Me.current===t&&(te(Me),ol._currentValue=se)}var Pt,_t;function ft(t){if(Pt===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);Pt=i&&i[1]||"",_t=-1{for(const c of l)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function n(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(l){if(l.ep)return;l.ep=!0;const c=n(l);fetch(l.href,c)}})();function Gx(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var $d={exports:{}},hl={};var sv;function nb(){if(sv)return hl;sv=1;var a=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,l,c){var f=null;if(c!==void 0&&(f=""+c),l.key!==void 0&&(f=""+l.key),"key"in l){c={};for(var p in l)p!=="key"&&(c[p]=l[p])}else c=l;return l=c.ref,{$$typeof:a,type:s,key:f,ref:l!==void 0?l:null,props:c}}return hl.Fragment=e,hl.jsx=n,hl.jsxs=n,hl}var rv;function ib(){return rv||(rv=1,$d.exports=nb()),$d.exports}var g=ib(),Qd={exports:{}},Mt={};var ov;function ab(){if(ov)return Mt;ov=1;var a=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),v=Symbol.iterator;function M(z){return z===null||typeof z!="object"?null:(z=v&&z[v]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,y={};function x(z,te,Ee){this.props=z,this.context=te,this.refs=y,this.updater=Ee||E}x.prototype.isReactComponent={},x.prototype.setState=function(z,te){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,te,"setState")},x.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function P(){}P.prototype=x.prototype;function L(z,te,Ee){this.props=z,this.context=te,this.refs=y,this.updater=Ee||E}var R=L.prototype=new P;R.constructor=L,w(R,x.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function O(){}var U={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function N(z,te,Ee){var Oe=Ee.ref;return{$$typeof:a,type:z,key:te,ref:Oe!==void 0?Oe:null,props:Ee}}function k(z,te){return N(z.type,te,z.props)}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===a}function Q(z){var te={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(Ee){return te[Ee]})}var fe=/\/+/g;function pe(z,te){return typeof z=="object"&&z!==null&&z.key!=null?Q(""+z.key):te.toString(36)}function J(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(O,O):(z.status="pending",z.then(function(te){z.status==="pending"&&(z.status="fulfilled",z.value=te)},function(te){z.status==="pending"&&(z.status="rejected",z.reason=te)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function G(z,te,Ee,Oe,He){var le=typeof z;(le==="undefined"||le==="boolean")&&(z=null);var Me=!1;if(z===null)Me=!0;else switch(le){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(z.$$typeof){case a:case e:Me=!0;break;case _:return Me=z._init,G(Me(z._payload),te,Ee,Oe,He)}}if(Me)return He=He(z),Me=Oe===""?"."+pe(z,0):Oe,I(He)?(Ee="",Me!=null&&(Ee=Me.replace(fe,"$&/")+"/"),G(He,te,Ee,"",function(rt){return rt})):He!=null&&(V(He)&&(He=k(He,Ee+(He.key==null||z&&z.key===He.key?"":(""+He.key).replace(fe,"$&/")+"/")+Me)),te.push(He)),1;Me=0;var Ae=Oe===""?".":Oe+":";if(I(z))for(var je=0;je>>1,xe=G[Se];if(0>>1;Sel(Ee,se))Oel(He,Ee)?(G[Se]=He,G[Oe]=se,Se=Oe):(G[Se]=Ee,G[te]=se,Se=te);else if(Oel(He,se))G[Se]=He,G[Oe]=se,Se=Oe;else break e}}return j}function l(G,j){var se=G.sortIndex-j.sortIndex;return se!==0?se:G.id-j.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;a.unstable_now=function(){return c.now()}}else{var f=Date,p=f.now();a.unstable_now=function(){return f.now()-p}}var m=[],h=[],_=1,S=null,v=3,M=!1,E=!1,w=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function R(G){for(var j=n(h);j!==null;){if(j.callback===null)s(h);else if(j.startTime<=G)s(h),j.sortIndex=j.expirationTime,e(m,j);else break;j=n(h)}}function I(G){if(w=!1,R(G),!E)if(n(m)!==null)E=!0,O||(O=!0,Q());else{var j=n(h);j!==null&&J(I,j.startTime-G)}}var O=!1,U=-1,A=5,N=-1;function k(){return y?!0:!(a.unstable_now()-NG&&k());){var Se=S.callback;if(typeof Se=="function"){S.callback=null,v=S.priorityLevel;var xe=Se(S.expirationTime<=G);if(G=a.unstable_now(),typeof xe=="function"){S.callback=xe,R(G),j=!0;break t}S===n(m)&&s(m),R(G)}else s(m);S=n(m)}if(S!==null)j=!0;else{var z=n(h);z!==null&&J(I,z.startTime-G),j=!1}}break e}finally{S=null,v=se,M=!1}j=void 0}}finally{j?Q():O=!1}}}var Q;if(typeof L=="function")Q=function(){L(V)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,pe=fe.port2;fe.port1.onmessage=V,Q=function(){pe.postMessage(null)}}else Q=function(){x(V,0)};function J(G,j){U=x(function(){G(a.unstable_now())},j)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(G){G.callback=null},a.unstable_forceFrameRate=function(G){0>G||125Se?(G.sortIndex=se,e(h,G),n(m)===null&&G===n(h)&&(w?(P(U),U=-1):w=!0,J(I,se-Se))):(G.sortIndex=xe,e(m,G),E||M||(E=!0,O||(O=!0,Q()))),G},a.unstable_shouldYield=k,a.unstable_wrapCallback=function(G){var j=v;return function(){var se=v;v=j;try{return G.apply(this,arguments)}finally{v=se}}}})(th)),th}var uv;function ob(){return uv||(uv=1,eh.exports=rb()),eh.exports}var nh={exports:{}},Xn={};var fv;function lb(){if(fv)return Xn;fv=1;var a=Wp();function e(m){var h="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(e){console.error(e)}}return a(),nh.exports=lb(),nh.exports}var hv;function ub(){if(hv)return pl;hv=1;var a=ob(),e=Wp(),n=cb();function s(t){var i="https://react.dev/errors/"+t;if(1xe||(t.current=Se[xe],Se[xe]=null,xe--)}function Ee(t,i){xe++,Se[xe]=t.current,t.current=i}var Oe=z(null),He=z(null),le=z(null),Me=z(null);function Ae(t,i){switch(Ee(le,i),Ee(He,t),Ee(Oe,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?w_(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=w_(i),t=R_(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}te(Oe),Ee(Oe,t)}function je(){te(Oe),te(He),te(le)}function rt(t){t.memoizedState!==null&&Ee(Me,t);var i=Oe.current,r=R_(i,t.type);i!==r&&(Ee(He,t),Ee(Oe,r))}function $e(t){He.current===t&&(te(Oe),te(He)),Me.current===t&&(te(Me),cl._currentValue=se)}var Pt,gt;function dt(t){if(Pt===void 0)try{throw Error()}catch(r){var i=r.stack.trim().match(/\n( *(at )?)/);Pt=i&&i[1]||"",gt=-1)":-1u||X[o]!==ue[u]){var be=`
-`+X[o].replace(" at new "," at ");return t.displayName&&be.includes("")&&(be=be.replace("",t.displayName)),be}while(1<=o&&0<=u);break}}}finally{yt=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?ft(r):""}function It(t,i){switch(t.tag){case 26:case 27:case 5:return ft(t.type);case 16:return ft("Lazy");case 13:return t.child!==i&&i!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return ht(t.type,!1);case 11:return ht(t.type.render,!1);case 1:return ht(t.type,!0);case 31:return ft("Activity");default:return""}}function zt(t){try{var i="",r=null;do i+=It(t,r),r=t,t=t.return;while(t);return i}catch(o){return`
+`+X[o].replace(" at new "," at ");return t.displayName&&be.includes("")&&(be=be.replace("",t.displayName)),be}while(1<=o&&0<=u);break}}}finally{yt=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?dt(r):""}function It(t,i){switch(t.tag){case 26:case 27:case 5:return dt(t.type);case 16:return dt("Lazy");case 13:return t.child!==i&&i!==null?dt("Suspense Fallback"):dt("Suspense");case 19:return dt("SuspenseList");case 0:case 15:return ht(t.type,!1);case 11:return ht(t.type.render,!1);case 1:return ht(t.type,!0);case 31:return dt("Activity");default:return""}}function zt(t){try{var i="",r=null;do i+=It(t,r),r=t,t=t.return;while(t);return i}catch(o){return`
Error generating stack: `+o.message+`
-`+o.stack}}var qt=Object.prototype.hasOwnProperty,rn=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,K=a.unstable_shouldYield,F=a.unstable_requestPaint,Ue=a.unstable_now,vt=a.unstable_getCurrentPriorityLevel,B=a.unstable_ImmediatePriority,C=a.unstable_UserBlockingPriority,ie=a.unstable_NormalPriority,oe=a.unstable_LowPriority,he=a.unstable_IdlePriority,Ne=a.log,Re=a.unstable_setDisableYieldValue,_e=null,ve=null;function Ie(t){if(typeof Ne=="function"&&Re(t),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(_e,t)}catch{}}var Xe=Math.clz32?Math.clz32:st,Ve=Math.log,ge=Math.LN2;function st(t){return t>>>=0,t===0?32:31-(Ve(t)/ge|0)|0}var Je=256,tt=262144,Z=4194304;function Le(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function ye(t,i,r){var o=t.pendingLanes;if(o===0)return 0;var u=0,f=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var D=o&134217727;return D!==0?(o=D&~f,o!==0?u=Le(o):(M&=D,M!==0?u=Le(M):r||(r=D&~t,r!==0&&(u=Le(r))))):(D=o&~f,D!==0?u=Le(D):M!==0?u=Le(M):r||(r=o&~t,r!==0&&(u=Le(r)))),u===0?0:i!==0&&i!==u&&(i&f)===0&&(f=u&-u,r=i&-i,f>=r||f===32&&(r&4194048)!==0)?i:u}function Fe(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Ge(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ce(){var t=Z;return Z<<=1,(Z&62914560)===0&&(Z=4194304),t}function Qe(t){for(var i=[],r=0;31>r;r++)i.push(t);return i}function Ze(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Yt(t,i,r,o,u,f){var M=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var D=t.entanglements,X=t.expirationTimes,ue=t.hiddenUpdates;for(r=M&~r;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Zt=/[\n"\\]/g;function Kt(t){return t.replace(Zt,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ke(t,i,r,o,u,f,M,D){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),i!=null?M==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+nt(i)):t.value!==""+nt(i)&&(t.value=""+nt(i)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),i!=null?Nt(t,M,nt(i)):r!=null?Nt(t,M,nt(r)):o!=null&&t.removeAttribute("value"),u==null&&f!=null&&(t.defaultChecked=!!f),u!=null&&(t.checked=u&&typeof u!="function"&&typeof u!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?t.name=""+nt(D):t.removeAttribute("name")}function jn(t,i,r,o,u,f,M,D){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(t.type=f),i!=null||r!=null){if(!(f!=="submit"&&f!=="reset"||i!=null)){Et(t);return}r=r!=null?""+nt(r):"",i=i!=null?""+nt(i):r,D||i===t.value||(t.value=i),t.defaultValue=i}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=D?t.checked:!!o,t.defaultChecked=!!o,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Et(t)}function Nt(t,i,r){i==="number"&&on(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function wn(t,i,r,o){if(t=t.options,i){i={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(va)try{var To={};Object.defineProperty(To,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{Ku=!1}var Ya=null,$u=null,Fl=null;function Am(){if(Fl)return Fl;var t,i=$u,r=i.length,o,u="value"in Ya?Ya.value:Ya.textContent,f=u.length;for(t=0;t=wo),Um=" ",Lm=!1;function Om(t,i){switch(t){case"keyup":return yS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var gr=!1;function MS(t,i){switch(t){case"compositionend":return Pm(i);case"keypress":return i.which!==32?null:(Lm=!0,Um);case"textInput":return t=i.data,t===Um&&Lm?null:t;default:return null}}function bS(t,i){if(gr)return t==="compositionend"||!nd&&Om(t,i)?(t=Am(),Fl=$u=Ya=null,gr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:r,offset:i-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=km(r)}}function Xm(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Xm(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Wm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=on(t.document);i instanceof t.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)t=i.contentWindow;else break;i=on(t.document)}return i}function sd(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var NS=va&&"documentMode"in document&&11>=document.documentMode,_r=null,rd=null,Uo=null,od=!1;function qm(t,i,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;od||_r==null||_r!==on(o)||(o=_r,"selectionStart"in o&&sd(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Uo&&No(Uo,o)||(Uo=o,o=Nc(rd,"onSelect"),0>=M,u-=M,ta=1<<32-Xe(i)+u|r<At?(Ft=at,at=null):Ft=at.sibling;var jt=fe(ae,at,ce[At],Te);if(jt===null){at===null&&(at=Ft);break}t&&at&&jt.alternate===null&&i(ae,at),$=f(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt,at=Ft}if(At===ce.length)return r(ae,at),Ht&&ya(ae,At),lt;if(at===null){for(;AtAt?(Ft=at,at=null):Ft=at.sibling;var gs=fe(ae,at,jt.value,Te);if(gs===null){at===null&&(at=Ft);break}t&&at&&gs.alternate===null&&i(ae,at),$=f(gs,$,At),kt===null?lt=gs:kt.sibling=gs,kt=gs,at=Ft}if(jt.done)return r(ae,at),Ht&&ya(ae,At),lt;if(at===null){for(;!jt.done;At++,jt=ce.next())jt=we(ae,jt.value,Te),jt!==null&&($=f(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt);return Ht&&ya(ae,At),lt}for(at=o(at);!jt.done;At++,jt=ce.next())jt=me(at,ae,At,jt.value,Te),jt!==null&&(t&&jt.alternate!==null&&at.delete(jt.key===null?At:jt.key),$=f(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt);return t&&at.forEach(function($M){return i(ae,$M)}),Ht&&ya(ae,At),lt}function an(ae,$,ce,Te){if(typeof ce=="object"&&ce!==null&&ce.type===w&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:e:{for(var lt=ce.key;$!==null;){if($.key===lt){if(lt=ce.type,lt===w){if($.tag===7){r(ae,$.sibling),Te=u($,ce.props.children),Te.return=ae,ae=Te;break e}}else if($.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===T&&Vs(lt)===$.type){r(ae,$.sibling),Te=u($,ce.props),Fo(Te,ce),Te.return=ae,ae=Te;break e}r(ae,$);break}else i(ae,$);$=$.sibling}ce.type===w?(Te=Bs(ce.props.children,ae.mode,Te,ce.key),Te.return=ae,ae=Te):(Te=Yl(ce.type,ce.key,ce.props,null,ae.mode,Te),Fo(Te,ce),Te.return=ae,ae=Te)}return M(ae);case A:e:{for(lt=ce.key;$!==null;){if($.key===lt)if($.tag===4&&$.stateNode.containerInfo===ce.containerInfo&&$.stateNode.implementation===ce.implementation){r(ae,$.sibling),Te=u($,ce.children||[]),Te.return=ae,ae=Te;break e}else{r(ae,$);break}else i(ae,$);$=$.sibling}Te=pd(ce,ae.mode,Te),Te.return=ae,ae=Te}return M(ae);case T:return ce=Vs(ce),an(ae,$,ce,Te)}if(J(ce))return et(ae,$,ce,Te);if(Q(ce)){if(lt=Q(ce),typeof lt!="function")throw Error(s(150));return ce=lt.call(ce),mt(ae,$,ce,Te)}if(typeof ce.then=="function")return an(ae,$,tc(ce),Te);if(ce.$$typeof===L)return an(ae,$,$l(ae,ce),Te);nc(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,$!==null&&$.tag===6?(r(ae,$.sibling),Te=u($,ce),Te.return=ae,ae=Te):(r(ae,$),Te=hd(ce,ae.mode,Te),Te.return=ae,ae=Te),M(ae)):r(ae,$)}return function(ae,$,ce,Te){try{Bo=0;var lt=an(ae,$,ce,Te);return wr=null,lt}catch(at){if(at===Cr||at===Jl)throw at;var kt=fi(29,at,null,ae.mode);return kt.lanes=Te,kt.return=ae,kt}}}var js=gg(!0),_g=gg(!1),Ja=!1;function Ad(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cd(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function es(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ts(t,i,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Xt&2)!==0){var u=o.pending;return u===null?i.next=i:(i.next=u.next,u.next=i),o.pending=i,i=ql(t),eg(t,null,r),i}return Wl(t,o,i,r),ql(t)}function zo(t,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,fn(t,r)}}function wd(t,i){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var u=null,f=null;if(r=r.firstBaseUpdate,r!==null){do{var M={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};f===null?u=f=M:f=f.next=M,r=r.next}while(r!==null);f===null?u=f=i:f=f.next=i}else u=f=i;r={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=i:t.next=i,r.lastBaseUpdate=i}var Rd=!1;function Ho(){if(Rd){var t=Ar;if(t!==null)throw t}}function Go(t,i,r,o){Rd=!1;var u=t.updateQueue;Ja=!1;var f=u.firstBaseUpdate,M=u.lastBaseUpdate,D=u.shared.pending;if(D!==null){u.shared.pending=null;var X=D,ue=X.next;X.next=null,M===null?f=ue:M.next=ue,M=X;var be=t.alternate;be!==null&&(be=be.updateQueue,D=be.lastBaseUpdate,D!==M&&(D===null?be.firstBaseUpdate=ue:D.next=ue,be.lastBaseUpdate=X))}if(f!==null){var we=u.baseState;M=0,be=ue=X=null,D=f;do{var fe=D.lane&-536870913,me=fe!==D.lane;if(me?(Bt&fe)===fe:(o&fe)===fe){fe!==0&&fe===Tr&&(Rd=!0),be!==null&&(be=be.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var et=t,mt=D;fe=i;var an=r;switch(mt.tag){case 1:if(et=mt.payload,typeof et=="function"){we=et.call(an,we,fe);break e}we=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=mt.payload,fe=typeof et=="function"?et.call(an,we,fe):et,fe==null)break e;we=S({},we,fe);break e;case 2:Ja=!0}}fe=D.callback,fe!==null&&(t.flags|=64,me&&(t.flags|=8192),me=u.callbacks,me===null?u.callbacks=[fe]:me.push(fe))}else me={lane:fe,tag:D.tag,payload:D.payload,callback:D.callback,next:null},be===null?(ue=be=me,X=we):be=be.next=me,M|=fe;if(D=D.next,D===null){if(D=u.shared.pending,D===null)break;me=D,D=me.next,me.next=null,u.lastBaseUpdate=me,u.shared.pending=null}}while(!0);be===null&&(X=we),u.baseState=X,u.firstBaseUpdate=ue,u.lastBaseUpdate=be,f===null&&(u.shared.lanes=0),rs|=M,t.lanes=M,t.memoizedState=we}}function vg(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function xg(t,i){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;tf?f:8;var M=G.T,D={};G.T=D,Yd(t,!1,i,r);try{var X=u(),ue=G.S;if(ue!==null&&ue(D,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var be=HS(X,o);jo(t,i,be,_i(t))}else jo(t,i,o,_i(t))}catch(we){jo(t,i,{then:function(){},status:"rejected",reason:we},_i())}finally{j.p=f,M!==null&&D.types!==null&&(M.types=D.types),G.T=M}}function WS(){}function Wd(t,i,r,o){if(t.tag!==5)throw Error(s(476));var u=$g(t).queue;Kg(t,u,i,se,r===null?WS:function(){return Qg(t),r(o)})}function $g(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:se},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:r},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Qg(t){var i=$g(t);i.next===null&&(i=t.alternate.memoizedState),jo(t,i.next.queue,{},_i())}function qd(){return zn(ol)}function Jg(){return Mn().memoizedState}function e0(){return Mn().memoizedState}function qS(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var r=_i();t=es(r);var o=ts(i,t,r);o!==null&&(ii(o,i,r),zo(o,i,r)),i={cache:Md()},t.payload=i;return}i=i.return}}function YS(t,i,r){var o=_i();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},fc(t)?n0(i,r):(r=dd(t,i,r,o),r!==null&&(ii(r,t,o),i0(r,i,o)))}function t0(t,i,r){var o=_i();jo(t,i,r,o)}function jo(t,i,r,o){var u={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(fc(t))n0(i,u);else{var f=t.alternate;if(t.lanes===0&&(f===null||f.lanes===0)&&(f=i.lastRenderedReducer,f!==null))try{var M=i.lastRenderedState,D=f(M,r);if(u.hasEagerState=!0,u.eagerState=D,di(D,M))return Wl(t,i,u,0),ln===null&&Xl(),!1}catch{}if(r=dd(t,i,u,o),r!==null)return ii(r,t,o),i0(r,i,o),!0}return!1}function Yd(t,i,r,o){if(o={lane:2,revertLane:Cf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},fc(t)){if(i)throw Error(s(479))}else i=dd(t,r,o,2),i!==null&&ii(i,t,2)}function fc(t){var i=t.alternate;return t===Tt||i!==null&&i===Tt}function n0(t,i){Dr=sc=!0;var r=t.pending;r===null?i.next=i:(i.next=r.next,r.next=i),t.pending=i}function i0(t,i,r){if((r&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,fn(t,r)}}var Xo={readContext:zn,use:lc,useCallback:xn,useContext:xn,useEffect:xn,useImperativeHandle:xn,useLayoutEffect:xn,useInsertionEffect:xn,useMemo:xn,useReducer:xn,useRef:xn,useState:xn,useDebugValue:xn,useDeferredValue:xn,useTransition:xn,useSyncExternalStore:xn,useId:xn,useHostTransitionStatus:xn,useFormState:xn,useActionState:xn,useOptimistic:xn,useMemoCache:xn,useCacheRefresh:xn};Xo.useEffectEvent=xn;var a0={readContext:zn,use:lc,useCallback:function(t,i){return Zn().memoizedState=[t,i===void 0?null:i],t},useContext:zn,useEffect:Gg,useImperativeHandle:function(t,i,r){r=r!=null?r.concat([t]):null,uc(4194308,4,Xg.bind(null,i,t),r)},useLayoutEffect:function(t,i){return uc(4194308,4,t,i)},useInsertionEffect:function(t,i){uc(4,2,t,i)},useMemo:function(t,i){var r=Zn();i=i===void 0?null:i;var o=t();if(Xs){Ie(!0);try{t()}finally{Ie(!1)}}return r.memoizedState=[o,i],o},useReducer:function(t,i,r){var o=Zn();if(r!==void 0){var u=r(i);if(Xs){Ie(!0);try{r(i)}finally{Ie(!1)}}}else u=i;return o.memoizedState=o.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},o.queue=t,t=t.dispatch=YS.bind(null,Tt,t),[o.memoizedState,t]},useRef:function(t){var i=Zn();return t={current:t},i.memoizedState=t},useState:function(t){t=Gd(t);var i=t.queue,r=t0.bind(null,Tt,i);return i.dispatch=r,[t.memoizedState,r]},useDebugValue:jd,useDeferredValue:function(t,i){var r=Zn();return Xd(r,t,i)},useTransition:function(){var t=Gd(!1);return t=Kg.bind(null,Tt,t.queue,!0,!1),Zn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,r){var o=Tt,u=Zn();if(Ht){if(r===void 0)throw Error(s(407));r=r()}else{if(r=i(),ln===null)throw Error(s(349));(Bt&127)!==0||Tg(o,i,r)}u.memoizedState=r;var f={value:r,getSnapshot:i};return u.queue=f,Gg(Cg.bind(null,o,f,t),[t]),o.flags|=2048,Ur(9,{destroy:void 0},Ag.bind(null,o,f,r,i),null),r},useId:function(){var t=Zn(),i=ln.identifierPrefix;if(Ht){var r=na,o=ta;r=(o&~(1<<32-Xe(o)-1)).toString(32)+r,i="_"+i+"R_"+r,r=rc++,0<\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof o.is=="string"?M.createElement("select",{is:o.is}):M.createElement("select"),o.multiple?f.multiple=!0:o.size&&(f.size=o.size);break;default:f=typeof o.is=="string"?M.createElement(u,{is:o.is}):M.createElement(u)}}f[St]=i,f[_n]=o;e:for(M=i.child;M!==null;){if(M.tag===5||M.tag===6)f.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===i)break e;for(;M.sibling===null;){if(M.return===null||M.return===i)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}i.stateNode=f;e:switch(Gn(f,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Aa(i)}}return dn(i),cf(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,r),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Aa(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=le.current,br(i)){if(t=i.stateNode,r=i.memoizedProps,o=null,u=Fn,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}t[St]=i,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||b_(t.nodeValue,r)),t||$a(i,!0)}else t=Uc(t).createTextNode(o),t[St]=i,i.stateNode=t}return dn(i),null;case 31:if(r=i.memoizedState,t===null||t.memoizedState!==null){if(o=br(i),r!==null){if(t===null){if(!o)throw Error(s(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[St]=i}else Fs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dn(i),t=!1}else r=vd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return i.flags&256?(pi(i),i):(pi(i),null);if((i.flags&128)!==0)throw Error(s(558))}return dn(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=br(i),o!==null&&o.dehydrated!==null){if(t===null){if(!u)throw Error(s(318));if(u=i.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[St]=i}else Fs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;dn(i),u=!1}else u=vd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return i.flags&256?(pi(i),i):(pi(i),null)}return pi(i),(i.flags&128)!==0?(i.lanes=r,i):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=i.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),f=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),f!==u&&(o.flags|=2048)),r!==t&&r&&(i.child.flags|=8192),_c(i,i.updateQueue),dn(i),null);case 4:return je(),t===null&&Nf(i.stateNode.containerInfo),dn(i),null;case 10:return Ma(i.type),dn(i),null;case 19:if(te(Sn),o=i.memoizedState,o===null)return dn(i),null;if(u=(i.flags&128)!==0,f=o.rendering,f===null)if(u)qo(o,!1);else{if(yn!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(f=ac(t),f!==null){for(i.flags|=128,qo(o,!1),t=f.updateQueue,i.updateQueue=t,_c(i,t),i.subtreeFlags=0,t=r,r=i.child;r!==null;)tg(r,t),r=r.sibling;return Ee(Sn,Sn.current&1|2),Ht&&ya(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&Ue()>Mc&&(i.flags|=128,u=!0,qo(o,!1),i.lanes=4194304)}else{if(!u)if(t=ac(f),t!==null){if(i.flags|=128,u=!0,t=t.updateQueue,i.updateQueue=t,_c(i,t),qo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!f.alternate&&!Ht)return dn(i),null}else 2*Ue()-o.renderingStartTime>Mc&&r!==536870912&&(i.flags|=128,u=!0,qo(o,!1),i.lanes=4194304);o.isBackwards?(f.sibling=i.child,i.child=f):(t=o.last,t!==null?t.sibling=f:i.child=f,o.last=f)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ue(),t.sibling=null,r=Sn.current,Ee(Sn,u?r&1|2:r&1),Ht&&ya(i,o.treeForkCount),t):(dn(i),null);case 22:case 23:return pi(i),Nd(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(r&536870912)!==0&&(i.flags&128)===0&&(dn(i),i.subtreeFlags&6&&(i.flags|=8192)):dn(i),r=i.updateQueue,r!==null&&_c(i,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048),t!==null&&te(Gs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),Ma(bn),dn(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function JS(t,i){switch(gd(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ma(bn),je(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return $e(i),null;case 31:if(i.memoizedState!==null){if(pi(i),i.alternate===null)throw Error(s(340));Fs()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(pi(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Fs()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return te(Sn),null;case 4:return je(),null;case 10:return Ma(i.type),null;case 22:case 23:return pi(i),Nd(),t!==null&&te(Gs),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Ma(bn),null;case 25:return null;default:return null}}function w0(t,i){switch(gd(i),i.tag){case 3:Ma(bn),je();break;case 26:case 27:case 5:$e(i);break;case 4:je();break;case 31:i.memoizedState!==null&&pi(i);break;case 13:pi(i);break;case 19:te(Sn);break;case 10:Ma(i.type);break;case 22:case 23:pi(i),Nd(),t!==null&&te(Gs);break;case 24:Ma(bn)}}function Yo(t,i){try{var r=i.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var u=o.next;r=u;do{if((r.tag&t)===t){o=void 0;var f=r.create,M=r.inst;o=f(),M.destroy=o}r=r.next}while(r!==u)}}catch(D){Jt(i,i.return,D)}}function as(t,i,r){try{var o=i.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&t)===t){var M=o.inst,D=M.destroy;if(D!==void 0){M.destroy=void 0,u=i;var X=r,ue=D;try{ue()}catch(be){Jt(u,X,be)}}}o=o.next}while(o!==f)}}catch(be){Jt(i,i.return,be)}}function R0(t){var i=t.updateQueue;if(i!==null){var r=t.stateNode;try{xg(i,r)}catch(o){Jt(t,t.return,o)}}}function D0(t,i,r){r.props=Ws(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){Jt(t,i,o)}}function Zo(t,i){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(u){Jt(t,i,u)}}function ia(t,i){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(u){Jt(t,i,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){Jt(t,i,u)}else r.current=null}function N0(t){var i=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(u){Jt(t,t.return,u)}}function uf(t,i,r){try{var o=t.stateNode;SM(o,t.type,r,i),o[_n]=i}catch(u){Jt(t,t.return,u)}}function U0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ds(t.type)||t.tag===4}function df(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||U0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ds(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ff(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(t),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=_a));else if(o!==4&&(o===27&&ds(t.type)&&(r=t.stateNode,i=null),t=t.child,t!==null))for(ff(t,i,r),t=t.sibling;t!==null;)ff(t,i,r),t=t.sibling}function vc(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?r.insertBefore(t,i):r.appendChild(t);else if(o!==4&&(o===27&&ds(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(vc(t,i,r),t=t.sibling;t!==null;)vc(t,i,r),t=t.sibling}function L0(t){var i=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,u=i.attributes;u.length;)i.removeAttributeNode(u[0]);Gn(i,o,r),i[St]=t,i[_n]=r}catch(f){Jt(t,t.return,f)}}var Ca=!1,An=!1,hf=!1,O0=typeof WeakSet=="function"?WeakSet:Set,On=null;function eM(t,i){if(t=t.containerInfo,Of=zc,t=Wm(t),sd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var u=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{r.nodeType,f.nodeType}catch{r=null;break e}var M=0,D=-1,X=-1,ue=0,be=0,we=t,fe=null;t:for(;;){for(var me;we!==r||u!==0&&we.nodeType!==3||(D=M+u),we!==f||o!==0&&we.nodeType!==3||(X=M+o),we.nodeType===3&&(M+=we.nodeValue.length),(me=we.firstChild)!==null;)fe=we,we=me;for(;;){if(we===t)break t;if(fe===r&&++ue===u&&(D=M),fe===f&&++be===o&&(X=M),(me=we.nextSibling)!==null)break;we=fe,fe=we.parentNode}we=me}r=D===-1||X===-1?null:{start:D,end:X}}else r=null}r=r||{start:0,end:0}}else r=null;for(Pf={focusedElem:t,selectionRange:r},zc=!1,On=i;On!==null;)if(i=On,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,On=t;else for(;On!==null;){switch(i=On,f=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r title"))),Gn(f,o,r),f[St]=t,vn(f),o=f;break e;case"link":var M=H_("link","href",u).get(o+(r.href||""));if(M){for(var D=0;Dan&&(M=an,an=mt,mt=M);var ae=jm(D,mt),$=jm(D,an);if(ae&&$&&(me.rangeCount!==1||me.anchorNode!==ae.node||me.anchorOffset!==ae.offset||me.focusNode!==$.node||me.focusOffset!==$.offset)){var ce=we.createRange();ce.setStart(ae.node,ae.offset),me.removeAllRanges(),mt>an?(me.addRange(ce),me.extend($.node,$.offset)):(ce.setEnd($.node,$.offset),me.addRange(ce))}}}}for(we=[],me=D;me=me.parentNode;)me.nodeType===1&&we.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;Dr?32:r,G.T=null,r=yf,yf=null;var f=ls,M=Ua;if(Rn=0,Br=ls=null,Ua=0,(Xt&6)!==0)throw Error(s(331));var D=Xt;if(Xt|=4,X0(f.current),V0(f,f.current,M,r),Xt=D,tl(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(_e,f)}catch{}return!0}finally{j.p=u,G.T=o,c_(t,i)}}function d_(t,i,r){i=bi(r,i),i=Qd(t.stateNode,i,2),t=ts(t,i,2),t!==null&&(Ze(t,2),aa(t))}function Jt(t,i,r){if(t.tag===3)d_(t,t,r);else for(;i!==null;){if(i.tag===3){d_(i,t,r);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(os===null||!os.has(o))){t=bi(r,t),r=f0(2),o=ts(i,r,2),o!==null&&(h0(r,o,i,t),Ze(o,2),aa(o));break}}i=i.return}}function Ef(t,i,r){var o=t.pingCache;if(o===null){o=t.pingCache=new iM;var u=new Set;o.set(i,u)}else u=o.get(i),u===void 0&&(u=new Set,o.set(i,u));u.has(r)||(gf=!0,u.add(r),t=lM.bind(null,t,i,r),i.then(t,t))}function lM(t,i,r){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ln===t&&(Bt&r)===r&&(yn===4||yn===3&&(Bt&62914560)===Bt&&300>Ue()-Sc?(Xt&2)===0&&Fr(t,0):_f|=r,Ir===Bt&&(Ir=0)),aa(t)}function f_(t,i){i===0&&(i=Ce()),t=Is(t,i),t!==null&&(Ze(t,i),aa(t))}function cM(t){var i=t.memoizedState,r=0;i!==null&&(r=i.retryLane),f_(t,r)}function uM(t,i){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,u=t.memoizedState;u!==null&&(r=u.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),f_(t,r)}function dM(t,i){return rn(t,i)}var wc=null,Hr=null,Tf=!1,Rc=!1,Af=!1,us=0;function aa(t){t!==Hr&&t.next===null&&(Hr===null?wc=Hr=t:Hr=Hr.next=t),Rc=!0,Tf||(Tf=!0,hM())}function tl(t,i){if(!Af&&Rc){Af=!0;do for(var r=!1,o=wc;o!==null;){if(t!==0){var u=o.pendingLanes;if(u===0)var f=0;else{var M=o.suspendedLanes,D=o.pingedLanes;f=(1<<31-Xe(42|t)+1)-1,f&=u&~(M&~D),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(r=!0,g_(o,f))}else f=Bt,f=ye(o,o===ln?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(f&3)===0||Fe(o,f)||(r=!0,g_(o,f));o=o.next}while(r);Af=!1}}function fM(){h_()}function h_(){Rc=Tf=!1;var t=0;us!==0&&bM()&&(t=us);for(var i=Ue(),r=null,o=wc;o!==null;){var u=o.next,f=p_(o,i);f===0?(o.next=null,r===null?wc=u:r.next=u,u===null&&(Hr=r)):(r=o,(t!==0||(f&3)!==0)&&(Rc=!0)),o=u}Rn!==0&&Rn!==5||tl(t),us!==0&&(us=0)}function p_(t,i){for(var r=t.suspendedLanes,o=t.pingedLanes,u=t.expirationTimes,f=t.pendingLanes&-62914561;0D)break;var be=X.transferSize,we=X.initiatorType;be&&E_(we)&&(X=X.responseEnd,M+=be*(X"u"?null:document;function I_(t,i,r){var o=Gr;if(o&&typeof i=="string"&&i){var u=Kt(i);u='link[rel="'+t+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),P_.has(u)||(P_.add(u),t={rel:t,crossOrigin:r,href:i},o.querySelector(u)===null&&(i=o.createElement("link"),Gn(i,"link",t),vn(i),o.head.appendChild(i)))}}function UM(t){La.D(t),I_("dns-prefetch",t,null)}function LM(t,i){La.C(t,i),I_("preconnect",t,i)}function OM(t,i,r){La.L(t,i,r);var o=Gr;if(o&&t&&i){var u='link[rel="preload"][as="'+Kt(i)+'"]';i==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Kt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Kt(r.imageSizes)+'"]')):u+='[href="'+Kt(t)+'"]';var f=u;switch(i){case"style":f=Vr(t);break;case"script":f=kr(t)}Ri.has(f)||(t=S({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:t,as:i},r),Ri.set(f,t),o.querySelector(u)!==null||i==="style"&&o.querySelector(sl(f))||i==="script"&&o.querySelector(rl(f))||(i=o.createElement("link"),Gn(i,"link",t),vn(i),o.head.appendChild(i)))}}function PM(t,i){La.m(t,i);var r=Gr;if(r&&t){var o=i&&typeof i.as=="string"?i.as:"script",u='link[rel="modulepreload"][as="'+Kt(o)+'"][href="'+Kt(t)+'"]',f=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=kr(t)}if(!Ri.has(f)&&(t=S({rel:"modulepreload",href:t},i),Ri.set(f,t),r.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(rl(f)))return}o=r.createElement("link"),Gn(o,"link",t),vn(o),r.head.appendChild(o)}}}function IM(t,i,r){La.S(t,i,r);var o=Gr;if(o&&t){var u=Bi(o).hoistableStyles,f=Vr(t);i=i||"default";var M=u.get(f);if(!M){var D={loading:0,preload:null};if(M=o.querySelector(sl(f)))D.loading=5;else{t=S({rel:"stylesheet",href:t,"data-precedence":i},r),(r=Ri.get(f))&&Vf(t,r);var X=M=o.createElement("link");vn(X),Gn(X,"link",t),X._p=new Promise(function(ue,be){X.onload=ue,X.onerror=be}),X.addEventListener("load",function(){D.loading|=1}),X.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Oc(M,i,o)}M={type:"stylesheet",instance:M,count:1,state:D},u.set(f,M)}}}function BM(t,i){La.X(t,i);var r=Gr;if(r&&t){var o=Bi(r).hoistableScripts,u=kr(t),f=o.get(u);f||(f=r.querySelector(rl(u)),f||(t=S({src:t,async:!0},i),(i=Ri.get(u))&&kf(t,i),f=r.createElement("script"),vn(f),Gn(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function FM(t,i){La.M(t,i);var r=Gr;if(r&&t){var o=Bi(r).hoistableScripts,u=kr(t),f=o.get(u);f||(f=r.querySelector(rl(u)),f||(t=S({src:t,async:!0,type:"module"},i),(i=Ri.get(u))&&kf(t,i),f=r.createElement("script"),vn(f),Gn(f,"link",t),r.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},o.set(u,f))}}function B_(t,i,r,o){var u=(u=le.current)?Lc(u):null;if(!u)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=Vr(r.href),r=Bi(u).hoistableStyles,o=r.get(i),o||(o={type:"style",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Vr(r.href);var f=Bi(u).hoistableStyles,M=f.get(t);if(M||(u=u.ownerDocument||u,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(t,M),(f=u.querySelector(sl(t)))&&!f._p&&(M.instance=f,M.state.loading=5),Ri.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Ri.set(t,r),f||zM(u,t,r,M.state))),i&&o===null)throw Error(s(528,""));return M}if(i&&o!==null)throw Error(s(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=kr(r),r=Bi(u).hoistableScripts,o=r.get(i),o||(o={type:"script",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Vr(t){return'href="'+Kt(t)+'"'}function sl(t){return'link[rel="stylesheet"]['+t+"]"}function F_(t){return S({},t,{"data-precedence":t.precedence,precedence:null})}function zM(t,i,r,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),Gn(i,"link",r),vn(i),t.head.appendChild(i))}function kr(t){return'[src="'+Kt(t)+'"]'}function rl(t){return"script[async]"+t}function z_(t,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Kt(r.href)+'"]');if(o)return i.instance=o,vn(o),o;var u=S({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),vn(o),Gn(o,"style",u),Oc(o,r.precedence,t),i.instance=o;case"stylesheet":u=Vr(r.href);var f=t.querySelector(sl(u));if(f)return i.state.loading|=4,i.instance=f,vn(f),f;o=F_(r),(u=Ri.get(u))&&Vf(o,u),f=(t.ownerDocument||t).createElement("link"),vn(f);var M=f;return M._p=new Promise(function(D,X){M.onload=D,M.onerror=X}),Gn(f,"link",o),i.state.loading|=4,Oc(f,r.precedence,t),i.instance=f;case"script":return f=kr(r.src),(u=t.querySelector(rl(f)))?(i.instance=u,vn(u),u):(o=r,(u=Ri.get(f))&&(o=S({},r),kf(o,u)),t=t.ownerDocument||t,u=t.createElement("script"),vn(u),Gn(u,"link",o),t.head.appendChild(u),i.instance=u);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Oc(o,r.precedence,t));return i.instance}function Oc(t,i,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,f=u,M=0;M title"):null)}function HM(t,i,r){if(r===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(t=i.disabled,typeof i.precedence=="string"&&t==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function V_(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function GM(t,i,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=Vr(o.href),f=i.querySelector(sl(u));if(f){i=f._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Ic.bind(t),i.then(t,t)),r.state.loading|=4,r.instance=f,vn(f);return}f=i.ownerDocument||i,o=F_(o),(u=Ri.get(u))&&Vf(o,u),f=f.createElement("link"),vn(f);var M=f;M._p=new Promise(function(D,X){M.onload=D,M.onerror=X}),Gn(f,"link",o),r.instance=f}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Ic.bind(t),i.addEventListener("load",r),i.addEventListener("error",r))}}var jf=0;function VM(t,i){return t.stylesheets&&t.count===0&&Fc(t,t.stylesheets),0jf?50:800)+i);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Ic(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bc=null;function Fc(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bc=new Map,i.forEach(kM,t),Bc=null,Ic.call(t))}function kM(t,i){if(!(i.state.loading&4)){var r=Bc.get(t);if(r)var o=r.get(null);else{r=new Map,Bc.set(t,r);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(e){console.error(e)}}return a(),Jf.exports=rb(),Jf.exports}var lb=ob();const cb=zx(lb),ub="wrap",db=24;function Hx(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}function fb(a,e){return a===void 0||e===void 0?!1:Array.isArray(a)||Array.isArray(e)?!Array.isArray(a)||!Array.isArray(e)?!1:JSON.stringify([...a].sort())===JSON.stringify([...e].sort()):a===e}function za(a,e){return e?(a.supported_classes??a.supportedClasses??[]).some(s=>s.dimensions===e.dimensions&&fb(s.states,e.states)&&hb(s,e)):!1}function hb(a,e){return!a.neighborhoodId||!e.neighborhoodId?!0:a.neighborhoodId===e.neighborhoodId}function ar(a){const e=a?.caClass;if(!Hx(e))return;const n=typeof e.dimensions=="number"?e.dimensions:void 0,s=e.states;if(!(!n||typeof s!="number"&&!Array.isArray(s)))return{neighborhoodId:typeof e.neighborhoodId=="string"?e.neighborhoodId:void 0,dimensions:n,states:s}}function Gx(a,e,n=db){const s=Hx(a)?a:{},l=Array.isArray(s.size)?s.size:[],c=typeof l[0]=="number"?l[0]:n,d=e>=2&&typeof l[1]=="number"?l[1]:1,p=e>=3&&typeof l[2]=="number"?l[2]:1;return[c,d,p]}function zu(a){let e=2166136261;for(let n=0;n{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function pb(a){return a==="wrap"||a==="mirror"||a==="fixed"}function Wp(a){return Il(a?.simulation?.grid)}function Il(a){return pb(a?.boundary)?a.boundary:a?.wrap===!1?"fixed":ub}function Vx(a,e){return(a%e+e)%e}function mb(a,e){if(e<=1)return 0;const n=(e-1)*2,s=Vx(a,n);return s<=e-1?s:n-s}function Va(a,e,n){return e<=0?null:n==="wrap"?Vx(a,e):n==="mirror"?mb(a,e):a>=0&&a[...e])}function fv(a,e="cells"){const n=a[0]?.length??0;for(const s of a){if(s.length!==n)throw new Error(`${e} must be rectangular`);for(const l of s)if(typeof l!="boolean")throw new Error(`${e} must contain boolean cell states`)}}function gb(a,e,n="engine output"){if(fv(a,"input cells"),fv(e,n),e.length!==a.length||(e[0]?.length??0)!==(a[0]?.length??0))throw new Error(`${n} must preserve the input grid dimensions`)}function _b(a){const e=/(?:rule[-_\s]*)?(\d{1,3})/i.exec(a??"");return e?Math.max(0,Math.min(255,Number(e[1]))):110}function vb(a,e){const n=_b(e.simulation?.ruleId),s=kx(a),l=a[0]?.length??0;if(a.length===0||l===0)return s;const c=Il(e.simulation?.grid),d=Math.max(0,a.findIndex(m=>m.some(Boolean))),p=a[d]??[];for(let m=0;m>A&1)===1}return s}class Ru{position;forward;constructor(e,n){this.position=e,this.forward=n}}function Mu(a){return a===1||a===2||a===3||a===4||a===5||a===6}function xb(a,e){return[a[0]+e[0],a[1]+e[1],a[2]+e[2]]}function yb(a,e){return[a[0]-e[0],a[1]-e[1],a[2]-e[2]]}function jx(a,e){const n=Va(a[0],e.size[0],e.boundary),s=Va(a[1],e.size[1],e.boundary),l=Va(a[2],e.size[2],e.boundary);return n===null||s===null||l===null?null:[n,s,l]}function jh(a,e,n){return jx(xb(a,e),n)}function ih(a,e,n){return jx(yb(a,e),n)}function Xx(a){return(a+2)%6+1}function lo(a){return a===1?[1,0,0]:a===2?[0,1,0]:a===3?[0,0,1]:a===4?[-1,0,0]:a===5?[0,-1,0]:a===6?[0,0,-1]:null}function Wi(a){return`${a[0]}_${a[1]}_${a[2]}`}function Sb(a,e,n){const s=[];for(const l of a.values()){let c=0,d=0;if(l.forward!==null){for(let p=1;p<=6;p=p+1){const m=lo(p);if(!m)continue;const h=jh(l.position,m,n);if(!h)continue;const _=a.get(Wi(h));!_||_.forward===null||(_.forward===Xx(p)&&(d+=1),p===l.forward&&(c+=1))}c<=1&&d===0&&s.push(l)}}return s}function Wx(a=100){return zu(String(a))}function Mb(a,e,n,s=Wx()){const l=Sb(a,e,n);if(l.length===0)throw new Error("Cannot evolve, no heads");const c=l[Math.floor(s()*l.length)]??l[0];return bb(a,c,e,n)}function bb(a,e,n,s,l){let c=0,d=0,p=e,m=e,h=!0;const _=new Set;for(;h;){const x=Wi(p.position);if(_.has(x)){h=!1,m=p;break}if(_.add(x),p.forward===null)break;const P=lo(p.forward);if(!P)break;const L=jh(p.position,P,s);if(!L)break;const R=a.get(Wi(L));R&&Mu(R.forward)?(p=R,h=!0):(h=!1,m=p)}if(m.forward===null)return{changes:c,emits:d,comment:`T:${n} | Tail has no symbol to move.`};const S=lo(m.forward);if(!S)return{changes:c,emits:d,comment:`T:${n} | Tail symbol has no direction.`};const v=ih(e.position,S,s);if(!v)return{changes:c,emits:d,comment:`T:${n} | Tail would move outside fixed boundary.`};const b=Wi(v);a.has(b)||a.set(b,new Ru(v,null));const A=a.get(b);if(!A)throw new Error(`Unable to create naga place cell at ${b}`);if(e.forward===Xx(m.forward)){let x=`T:${n} | Emission! ${A.position.join(",")} implied contradiction.`,P=!0;p=a.get(Wi(e.position))??e;const L=new Set;for(;P;){const T=Wi(p.position);if(L.has(T)||(L.add(T),p.forward===null))break;const N=lo(p.forward);if(!N)break;const k=jh(p.position,N,s);if(!k)break;const V=a.get(Wi(k));if(V&&Mu(V.forward)){p=V;const Q=ih(p.position,S,s);if(!Q){P=!1;break}const de=a.get(Wi(Q));P=!!(de&&Mu(de.forward))}else P=!1}const R=ih(p.position,S,s);if(!R)return{changes:c,emits:d,comment:`T:${n} | Kink would move outside fixed boundary.`};const I=Wi(R);a.has(I)||a.set(I,new Ru(R,null));const O=a.get(I);if(!O)throw new Error(`Unable to create naga kink place cell at ${I}`);const U=O.forward;return O.forward=m.forward,m.forward=U,d+=1,c+=1,x+=` Kink at ${R.join(",")}, swapped ${O.forward} for ${U}.`,{changes:c,emits:d,comment:x}}const w=`T:${n} | Take tail symbol ${m.forward} from ${m.position.join(",")}, put into ${A.position.join(",")} in exchange for ${A.forward}`,y=A.forward;return A.forward=m.forward,m.forward=y,c+=1,{changes:c,emits:d,comment:w}}function Eb(a,e){const n=a.simulation?.grid?.size,s=Array.isArray(n)&&typeof n[0]=="number"?n[0]:e[0]?.length??24,l=Array.isArray(n)&&typeof n[1]=="number"?n[1]:e.length||24,c=Array.isArray(n)&&typeof n[2]=="number"?n[2]:24;return[Math.max(1,s),Math.max(1,l),Math.max(1,c)]}function Tb(a){const e=a[3]??1;return Mu(e)?e:1}function Ab(a){const e=new Map;for(const n of a??[]){const[s,l,c=0]=n;if(!Number.isInteger(s)||!Number.isInteger(l)||!Number.isInteger(c))continue;const d=[s,l,c];e.set(Wi(d),new Ru(d,Tb(n)))}return e}function Cb(a){const e=new Map;for(let n=0;n=e[0]||c>=e[1]||d>=e[2]||n.push([l,c,d,s.forward]))}return n}function Rb(a,e){const n=e.map(s=>s.map(()=>!1));for(const s of a){const[l,c]=s;!Number.isInteger(l)||!Number.isInteger(c)||c<0||l<0||c>=n.length||l>=(n[c]?.length??0)||(n[c][l]=!0)}return n}function Db(a){return a.simulation??={},a.simulation.initialCondition??={},a.simulation}function Nb(a,e){const n=Db(e),s=Eb(e,a),l=n.initialCondition?.cells,c=Array.isArray(l)&&l.length>0?Ab(l):Cb(a),d=typeof n.nagaTick=="number"?n.nagaTick:0,p=typeof n.seed=="string"?n.seed:"naga",m={boundary:Il(n.grid),size:s};try{Mb(c,d,m,Wx(`${p}:${d}`))}catch(_){if(!(_ instanceof Error)||_.message!=="Cannot evolve, no heads")throw _}const h=wb(c,s);return n.initialCondition={...n.initialCondition,type:"cells",cells:h},n.nagaTick=d+1,Rb(h,a)}function qp(a){return kx(a)}function qx(a){return a.map(e=>e.map(()=>!1))}function Ub(a){const e=/^B([0-8]*)\/S([0-8]*)$/i.exec(a);return e?{birth:new Set(e[1].split("").map(Number)),survival:new Set(e[2].split("").map(Number))}:{birth:new Set([3]),survival:new Set([2,3])}}function Yx(a,e){const n=Ub(e.simulation?.ruleId??"B3/S23"),s=qx(a),l=a.length,c=a[0]?.length??0,d=Il(e.simulation?.grid);for(let p=0;p0&&Ob(p,h,m)l!==a);return s[Math.floor(n()*s.length)]??a}function ah(a,e,n){return`${a}_${e}_${n}`}function pv(a,e,n,s,l,c){return a>=0&&e>=0&&n>=0&&a=0;--e)if(a[e]>=65535)return!0;return!1}function Ou(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}function bE(){const a=Ou("canvas");return a.style.display="block",a}const Mv={};function bv(...a){const e="THREE."+a.shift();console.log(e,...a)}function dy(a){const e=a[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=a[1];n&&n.isStackTrace?a[0]+=" "+n.getLocation():a[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return a}function gt(...a){a=dy(a);const e="THREE."+a.shift();{const n=a[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...a)}}function Vt(...a){a=dy(a);const e="THREE."+a.shift();{const n=a[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...a)}}function fo(...a){const e=a.join(" ");e in Mv||(Mv[e]=!0,gt(...a))}function EE(a,e,n){return new Promise(function(s,l){function c(){switch(a.clientWaitSync(e,a.SYNC_FLUSH_COMMANDS_BIT,0)){case a.WAIT_FAILED:l();break;case a.TIMEOUT_EXPIRED:setTimeout(c,n);break;default:s()}}setTimeout(c,n)})}const TE={[Yh]:Zh,[Kh]:Jh,[$h]:ep,[go]:Qh,[Zh]:Yh,[Jh]:Kh,[ep]:$h,[Qh]:go};class Ns{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(n)===-1&&s[e].push(n)}hasEventListener(e,n){const s=this._listeners;return s===void 0?!1:s[e]!==void 0&&s[e].indexOf(n)!==-1}removeEventListener(e,n){const s=this._listeners;if(s===void 0)return;const l=s[e];if(l!==void 0){const c=l.indexOf(n);c!==-1&&l.splice(c,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const s=n[e.type];if(s!==void 0){e.target=this;const l=s.slice(0);for(let c=0,d=l.length;c>8&255]+Wn[a>>16&255]+Wn[a>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[n&63|128]+Wn[n>>8&255]+"-"+Wn[n>>16&255]+Wn[n>>24&255]+Wn[s&255]+Wn[s>>8&255]+Wn[s>>16&255]+Wn[s>>24&255]).toLowerCase()}function Ot(a,e,n){return Math.max(e,Math.min(n,a))}function AE(a,e){return(a%e+e)%e}function lh(a,e,n){return(1-n)*a+n*e}function hl(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return a/4294967295;case Uint16Array:return a/65535;case Uint8Array:return a/255;case Int32Array:return Math.max(a/2147483647,-1);case Int16Array:return Math.max(a/32767,-1);case Int8Array:return Math.max(a/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ai(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return Math.round(a*4294967295);case Uint16Array:return Math.round(a*65535);case Uint8Array:return Math.round(a*255);case Int32Array:return Math.round(a*2147483647);case Int16Array:return Math.round(a*32767);case Int8Array:return Math.round(a*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const CE={DEG2RAD:wl},xm=class xm{constructor(e=0,n=0){this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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){const n=this.x,s=this.y,l=e.elements;return this.x=l[0]*n+l[3]*s+l[6],this.y=l[1]*n+l[4]*s+l[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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(e)/n;return Math.acos(Ot(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,s=this.y-e.y;return n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const s=Math.cos(n),l=Math.sin(n),c=this.x-e.x,d=this.y-e.y;return this.x=c*s-d*l+e.x,this.y=c*l+d*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};xm.prototype.isVector2=!0;let xt=xm;class ws{constructor(e=0,n=0,s=0,l=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=s,this._w=l}static slerpFlat(e,n,s,l,c,d,p){let m=s[l+0],h=s[l+1],_=s[l+2],S=s[l+3],v=c[d+0],b=c[d+1],A=c[d+2],w=c[d+3];if(S!==w||m!==v||h!==b||_!==A){let y=m*v+h*b+_*A+S*w;y<0&&(v=-v,b=-b,A=-A,w=-w,y=-y);let x=1-p;if(y<.9995){const P=Math.acos(y),L=Math.sin(P);x=Math.sin(x*P)/L,p=Math.sin(p*P)/L,m=m*x+v*p,h=h*x+b*p,_=_*x+A*p,S=S*x+w*p}else{m=m*x+v*p,h=h*x+b*p,_=_*x+A*p,S=S*x+w*p;const P=1/Math.sqrt(m*m+h*h+_*_+S*S);m*=P,h*=P,_*=P,S*=P}}e[n]=m,e[n+1]=h,e[n+2]=_,e[n+3]=S}static multiplyQuaternionsFlat(e,n,s,l,c,d){const p=s[l],m=s[l+1],h=s[l+2],_=s[l+3],S=c[d],v=c[d+1],b=c[d+2],A=c[d+3];return e[n]=p*A+_*S+m*b-h*v,e[n+1]=m*A+_*v+h*S-p*b,e[n+2]=h*A+_*b+p*v-m*S,e[n+3]=_*A-p*S-m*v-h*b,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,n,s,l){return this._x=e,this._y=n,this._z=s,this._w=l,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,n=!0){const s=e._x,l=e._y,c=e._z,d=e._order,p=Math.cos,m=Math.sin,h=p(s/2),_=p(l/2),S=p(c/2),v=m(s/2),b=m(l/2),A=m(c/2);switch(d){case"XYZ":this._x=v*_*S+h*b*A,this._y=h*b*S-v*_*A,this._z=h*_*A+v*b*S,this._w=h*_*S-v*b*A;break;case"YXZ":this._x=v*_*S+h*b*A,this._y=h*b*S-v*_*A,this._z=h*_*A-v*b*S,this._w=h*_*S+v*b*A;break;case"ZXY":this._x=v*_*S-h*b*A,this._y=h*b*S+v*_*A,this._z=h*_*A+v*b*S,this._w=h*_*S-v*b*A;break;case"ZYX":this._x=v*_*S-h*b*A,this._y=h*b*S+v*_*A,this._z=h*_*A-v*b*S,this._w=h*_*S+v*b*A;break;case"YZX":this._x=v*_*S+h*b*A,this._y=h*b*S+v*_*A,this._z=h*_*A-v*b*S,this._w=h*_*S-v*b*A;break;case"XZY":this._x=v*_*S-h*b*A,this._y=h*b*S-v*_*A,this._z=h*_*A+v*b*S,this._w=h*_*S+v*b*A;break;default:gt("Quaternion: .setFromEuler() encountered an unknown order: "+d)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const s=n/2,l=Math.sin(s);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,s=n[0],l=n[4],c=n[8],d=n[1],p=n[5],m=n[9],h=n[2],_=n[6],S=n[10],v=s+p+S;if(v>0){const b=.5/Math.sqrt(v+1);this._w=.25/b,this._x=(_-m)*b,this._y=(c-h)*b,this._z=(d-l)*b}else if(s>p&&s>S){const b=2*Math.sqrt(1+s-p-S);this._w=(_-m)/b,this._x=.25*b,this._y=(l+d)/b,this._z=(c+h)/b}else if(p>S){const b=2*Math.sqrt(1+p-s-S);this._w=(c-h)/b,this._x=(l+d)/b,this._y=.25*b,this._z=(m+_)/b}else{const b=2*Math.sqrt(1+S-s-p);this._w=(d-l)/b,this._x=(c+h)/b,this._y=(m+_)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let s=e.dot(n)+1;return s<1e-8?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ot(this.dot(e),-1,1)))}rotateTowards(e,n){const s=this.angleTo(e);if(s===0)return this;const l=Math.min(1,n/s);return this.slerp(e,l),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();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const s=e._x,l=e._y,c=e._z,d=e._w,p=n._x,m=n._y,h=n._z,_=n._w;return this._x=s*_+d*p+l*h-c*m,this._y=l*_+d*m+c*p-s*h,this._z=c*_+d*h+s*m-l*p,this._w=d*_-s*p-l*m-c*h,this._onChangeCallback(),this}slerp(e,n){let s=e._x,l=e._y,c=e._z,d=e._w,p=this.dot(e);p<0&&(s=-s,l=-l,c=-c,d=-d,p=-p);let m=1-n;if(p<.9995){const h=Math.acos(p),_=Math.sin(h);m=Math.sin(m*h)/_,n=Math.sin(n*h)/_,this._x=this._x*m+s*n,this._y=this._y*m+l*n,this._z=this._z*m+c*n,this._w=this._w*m+d*n,this._onChangeCallback()}else this._x=this._x*m+s*n,this._y=this._y*m+l*n,this._z=this._z*m+c*n,this._w=this._w*m+d*n,this.normalize();return this}slerpQuaternions(e,n,s){return this.copy(e).slerp(n,s)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),s=Math.random(),l=Math.sqrt(1-s),c=Math.sqrt(s);return this.set(l*Math.sin(e),l*Math.cos(e),c*Math.sin(n),c*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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}}const ym=class ym{constructor(e=0,n=0,s=0){this.x=e,this.y=n,this.z=s}set(e,n,s){return s===void 0&&(s=this.z),this.x=e,this.y=n,this.z=s,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Ev.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Ev.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*n+c[3]*s+c[6]*l,this.y=c[1]*n+c[4]*s+c[7]*l,this.z=c[2]*n+c[5]*s+c[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,s=this.y,l=this.z,c=e.elements,d=1/(c[3]*n+c[7]*s+c[11]*l+c[15]);return this.x=(c[0]*n+c[4]*s+c[8]*l+c[12])*d,this.y=(c[1]*n+c[5]*s+c[9]*l+c[13])*d,this.z=(c[2]*n+c[6]*s+c[10]*l+c[14])*d,this}applyQuaternion(e){const n=this.x,s=this.y,l=this.z,c=e.x,d=e.y,p=e.z,m=e.w,h=2*(d*l-p*s),_=2*(p*n-c*l),S=2*(c*s-d*n);return this.x=n+m*h+d*S-p*_,this.y=s+m*_+p*h-c*S,this.z=l+m*S+c*_-d*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*n+c[4]*s+c[8]*l,this.y=c[1]*n+c[5]*s+c[9]*l,this.z=c[2]*n+c[6]*s+c[10]*l,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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this.z=Ot(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this.z=Ot(this.z,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this.z=e.z+(n.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const s=e.x,l=e.y,c=e.z,d=n.x,p=n.y,m=n.z;return this.x=l*m-c*p,this.y=c*d-s*m,this.z=s*p-l*d,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const s=e.dot(this)/n;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return ch.copy(this).projectOnVector(e),this.sub(ch)}reflect(e){return this.sub(ch.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(e)/n;return Math.acos(Ot(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,s=this.y-e.y,l=this.z-e.z;return n*n+s*s+l*l}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,n,s){const l=Math.sin(n)*e;return this.x=l*Math.sin(s),this.y=Math.cos(n)*e,this.z=l*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,s){return this.x=e*Math.sin(n),this.y=s,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),l=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=s,this.z=l,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,s=Math.sqrt(1-n*n);return this.x=s*Math.cos(e),this.y=n,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ym.prototype.isVector3=!0;let re=ym;const ch=new re,Ev=new ws,Sm=class Sm{constructor(e,n,s,l,c,d,p,m,h){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,s,l,c,d,p,m,h)}set(e,n,s,l,c,d,p,m,h){const _=this.elements;return _[0]=e,_[1]=l,_[2]=p,_[3]=n,_[4]=c,_[5]=m,_[6]=s,_[7]=d,_[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,s=e.elements;return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],this}extractBasis(e,n,s){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const s=e.elements,l=n.elements,c=this.elements,d=s[0],p=s[3],m=s[6],h=s[1],_=s[4],S=s[7],v=s[2],b=s[5],A=s[8],w=l[0],y=l[3],x=l[6],P=l[1],L=l[4],R=l[7],I=l[2],O=l[5],U=l[8];return c[0]=d*w+p*P+m*I,c[3]=d*y+p*L+m*O,c[6]=d*x+p*R+m*U,c[1]=h*w+_*P+S*I,c[4]=h*y+_*L+S*O,c[7]=h*x+_*R+S*U,c[2]=v*w+b*P+A*I,c[5]=v*y+b*L+A*O,c[8]=v*x+b*R+A*U,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],s=e[1],l=e[2],c=e[3],d=e[4],p=e[5],m=e[6],h=e[7],_=e[8];return n*d*_-n*p*h-s*c*_+s*p*m+l*c*h-l*d*m}invert(){const e=this.elements,n=e[0],s=e[1],l=e[2],c=e[3],d=e[4],p=e[5],m=e[6],h=e[7],_=e[8],S=_*d-p*h,v=p*m-_*c,b=h*c-d*m,A=n*S+s*v+l*b;if(A===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/A;return e[0]=S*w,e[1]=(l*h-_*s)*w,e[2]=(p*s-l*d)*w,e[3]=v*w,e[4]=(_*n-l*m)*w,e[5]=(l*c-p*n)*w,e[6]=b*w,e[7]=(s*m-h*n)*w,e[8]=(d*n-s*c)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,s,l,c,d,p){const m=Math.cos(c),h=Math.sin(c);return this.set(s*m,s*h,-s*(m*d+h*p)+d+e,-l*h,l*m,-l*(-h*d+m*p)+p+n,0,0,1),this}scale(e,n){return fo("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(uh.makeScale(e,n)),this}rotate(e){return fo("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(uh.makeRotation(-e)),this}translate(e,n){return fo("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(uh.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),s=Math.sin(e);return this.set(n,-s,0,s,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,s=e.elements;for(let l=0;l<9;l++)if(n[l]!==s[l])return!1;return!0}fromArray(e,n=0){for(let s=0;s<9;s++)this.elements[s]=e[s+n];return this}toArray(e=[],n=0){const s=this.elements;return e[n]=s[0],e[n+1]=s[1],e[n+2]=s[2],e[n+3]=s[3],e[n+4]=s[4],e[n+5]=s[5],e[n+6]=s[6],e[n+7]=s[7],e[n+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Sm.prototype.isMatrix3=!0;let bt=Sm;const uh=new bt,Tv=new bt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Av=new bt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function wE(){const a={enabled:!0,workingColorSpace:Uu,spaces:{},convert:function(l,c,d){return this.enabled===!1||c===d||!c||!d||(this.spaces[c].transfer===en&&(l.r=ja(l.r),l.g=ja(l.g),l.b=ja(l.b)),this.spaces[c].primaries!==this.spaces[d].primaries&&(l.applyMatrix3(this.spaces[c].toXYZ),l.applyMatrix3(this.spaces[d].fromXYZ)),this.spaces[d].transfer===en&&(l.r=ho(l.r),l.g=ho(l.g),l.b=ho(l.b))),l},workingToColorSpace:function(l,c){return this.convert(l,this.workingColorSpace,c)},colorSpaceToWorking:function(l,c){return this.convert(l,c,this.workingColorSpace)},getPrimaries:function(l){return this.spaces[l].primaries},getTransfer:function(l){return l===Es?Lu:this.spaces[l].transfer},getToneMappingMode:function(l){return this.spaces[l].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(l,c=this.workingColorSpace){return l.fromArray(this.spaces[c].luminanceCoefficients)},define:function(l){Object.assign(this.spaces,l)},_getMatrix:function(l,c,d){return l.copy(this.spaces[c].toXYZ).multiply(this.spaces[d].fromXYZ)},_getDrawingBufferColorSpace:function(l){return this.spaces[l].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(l=this.workingColorSpace){return this.spaces[l].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(l,c){return fo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(l,c)},toWorkingColorSpace:function(l,c){return fo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(l,c)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],s=[.3127,.329];return a.define({[Uu]:{primaries:e,whitePoint:s,transfer:Lu,toXYZ:Tv,fromXYZ:Av,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:yi},outputColorSpaceConfig:{drawingBufferColorSpace:yi}},[yi]:{primaries:e,whitePoint:s,transfer:en,toXYZ:Tv,fromXYZ:Av,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:yi}}}),a}const Gt=wE();function ja(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function ho(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}let Wr;class RE{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let s;if(e instanceof HTMLCanvasElement)s=e;else{Wr===void 0&&(Wr=Ou("canvas")),Wr.width=e.width,Wr.height=e.height;const l=Wr.getContext("2d");e instanceof ImageData?l.putImageData(e,0,0):l.drawImage(e,0,0,e.width,e.height),s=Wr}return s.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Ou("canvas");n.width=e.width,n.height=e.height;const s=n.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const l=s.getImageData(0,0,e.width,e.height),c=l.data;for(let d=0;d1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(fh).x}get height(){return this.source.getSize(fh).y}get depth(){return this.source.getSize(fh).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,n){this.updateRanges.push({start:e,count:n})}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.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const s=e[n];if(s===void 0){gt(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const l=this[n];if(l===void 0){gt(`Texture.setValues(): property '${n}' does not exist.`);continue}l&&s&&l.isVector2&&s.isVector2||l&&s&&l.isVector3&&s.isVector3||l&&s&&l.isMatrix3&&s.isMatrix3?l.copy(s):this[n]=s}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={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,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),n||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ay)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case tp:e.x=e.x-Math.floor(e.x);break;case Ga:e.x=e.x<0?0:1;break;case np:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case tp:e.y=e.y-Math.floor(e.y);break;case Ga:e.y=e.y<0?0:1;break;case np:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}$n.DEFAULT_IMAGE=null;$n.DEFAULT_MAPPING=ay;$n.DEFAULT_ANISOTROPY=1;const Mm=class Mm{constructor(e=0,n=0,s=0,l=1){this.x=e,this.y=n,this.z=s,this.w=l}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,s,l){return this.x=e,this.y=n,this.z=s,this.w=l,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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){const n=this.x,s=this.y,l=this.z,c=this.w,d=e.elements;return this.x=d[0]*n+d[4]*s+d[8]*l+d[12]*c,this.y=d[1]*n+d[5]*s+d[9]*l+d[13]*c,this.z=d[2]*n+d[6]*s+d[10]*l+d[14]*c,this.w=d[3]*n+d[7]*s+d[11]*l+d[15]*c,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);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,s,l,c;const m=e.elements,h=m[0],_=m[4],S=m[8],v=m[1],b=m[5],A=m[9],w=m[2],y=m[6],x=m[10];if(Math.abs(_-v)<.01&&Math.abs(S-w)<.01&&Math.abs(A-y)<.01){if(Math.abs(_+v)<.1&&Math.abs(S+w)<.1&&Math.abs(A+y)<.1&&Math.abs(h+b+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const L=(h+1)/2,R=(b+1)/2,I=(x+1)/2,O=(_+v)/4,U=(S+w)/4,T=(A+y)/4;return L>R&&L>I?L<.01?(s=0,l=.707106781,c=.707106781):(s=Math.sqrt(L),l=O/s,c=U/s):R>I?R<.01?(s=.707106781,l=0,c=.707106781):(l=Math.sqrt(R),s=O/l,c=T/l):I<.01?(s=.707106781,l=.707106781,c=0):(c=Math.sqrt(I),s=U/c,l=T/c),this.set(s,l,c,n),this}let P=Math.sqrt((y-A)*(y-A)+(S-w)*(S-w)+(v-_)*(v-_));return Math.abs(P)<.001&&(P=1),this.x=(y-A)/P,this.y=(S-w)/P,this.z=(v-_)/P,this.w=Math.acos((h+b+x-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this.z=Ot(this.z,e.z,n.z),this.w=Ot(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this.z=Ot(this.z,e,n),this.w=Ot(this.w,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this.z=e.z+(n.z-e.z)*s,this.w=e.w+(n.w-e.w)*s,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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}};Mm.prototype.isVector4=!0;let gn=Mm;class UE extends Ns{constructor(e=1,n=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Yn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},s),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=s.depth,this.scissor=new gn(0,0,e,n),this.scissorTest=!1,this.viewport=new gn(0,0,e,n),this.textures=[];const l={width:e,height:n,depth:s.depth},c=new $n(l),d=s.count;for(let p=0;p1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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 n=0,s=e.textures.length;n>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let s=0;s0&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),l.up=this.up.toArray(),this.pivot!==null&&(l.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(l.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(l.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(l.type="BatchedMesh",l.perObjectFrustumCulled=this.perObjectFrustumCulled,l.sortObjects=this.sortObjects,l.drawRanges=this._drawRanges,l.reservedRanges=this._reservedRanges,l.geometryInfo=this._geometryInfo.map(p=>({...p,boundingBox:p.boundingBox?p.boundingBox.toJSON():void 0,boundingSphere:p.boundingSphere?p.boundingSphere.toJSON():void 0})),l.instanceInfo=this._instanceInfo.map(p=>({...p})),l.availableInstanceIds=this._availableInstanceIds.slice(),l.availableGeometryIds=this._availableGeometryIds.slice(),l.nextIndexStart=this._nextIndexStart,l.nextVertexStart=this._nextVertexStart,l.geometryCount=this._geometryCount,l.maxInstanceCount=this._maxInstanceCount,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.matricesTexture=this._matricesTexture.toJSON(e),l.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(l.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(l.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(l.boundingBox=this.boundingBox.toJSON()));function c(p,m){return p[m.uuid]===void 0&&(p[m.uuid]=m.toJSON(e)),m.uuid}if(this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(l.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=c(e.geometries,this.geometry);const p=this.geometry.parameters;if(p!==void 0&&p.shapes!==void 0){const m=p.shapes;if(Array.isArray(m))for(let h=0,_=m.length;h<_;h++){const S=m[h];c(e.shapes,S)}else c(e.shapes,m)}}if(this.isSkinnedMesh&&(l.bindMode=this.bindMode,l.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(e.skeletons,this.skeleton),l.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const p=[];for(let m=0,h=this.material.length;m0){l.children=[];for(let p=0;p0){l.animations=[];for(let p=0;p0&&(s.geometries=p),m.length>0&&(s.materials=m),h.length>0&&(s.textures=h),_.length>0&&(s.images=_),S.length>0&&(s.shapes=S),v.length>0&&(s.skeletons=v),b.length>0&&(s.animations=b),A.length>0&&(s.nodes=A)}return s.object=l,s;function d(p){const m=[];for(const h in p){const _=p[h];delete _.metadata,m.push(_)}return m}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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)),n===!0)for(let s=0;sb+A?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&v<=b-A&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else m!==null&&e.gripSpace&&(c=n.getPose(e.gripSpace,s),c!==null&&(m.matrix.fromArray(c.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,c.linearVelocity?(m.hasLinearVelocity=!0,m.linearVelocity.copy(c.linearVelocity)):m.hasLinearVelocity=!1,c.angularVelocity?(m.hasAngularVelocity=!0,m.angularVelocity.copy(c.angularVelocity)):m.hasAngularVelocity=!1,m.eventsEnabled&&m.dispatchEvent({type:"gripUpdated",data:e,target:this})));p!==null&&(l=n.getPose(e.targetRaySpace,s),l===null&&c!==null&&(l=c),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1,this.dispatchEvent(HE)))}return p!==null&&(p.visible=l!==null),m!==null&&(m.visible=c!==null),h!==null&&(h.visible=d!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const s=new Zc;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[n.jointName]=s,e.add(s)}return e.joints[n.jointName]}}const py={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},vs={h:0,s:0,l:0},Kc={h:0,s:0,l:0};function mh(a,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?a+(e-a)*6*n:n<1/2?e:n<2/3?a+(e-a)*6*(2/3-n):a}class ot{constructor(e,n,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,s)}set(e,n,s){if(n===void 0&&s===void 0){const l=e;l&&l.isColor?this.copy(l):typeof l=="number"?this.setHex(l):typeof l=="string"&&this.setStyle(l)}else this.setRGB(e,n,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=yi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.colorSpaceToWorking(this,n),this}setRGB(e,n,s,l=Gt.workingColorSpace){return this.r=e,this.g=n,this.b=s,Gt.colorSpaceToWorking(this,l),this}setHSL(e,n,s,l=Gt.workingColorSpace){if(e=AE(e,1),n=Ot(n,0,1),s=Ot(s,0,1),n===0)this.r=this.g=this.b=s;else{const c=s<=.5?s*(1+n):s+n-s*n,d=2*s-c;this.r=mh(d,c,e+1/3),this.g=mh(d,c,e),this.b=mh(d,c,e-1/3)}return Gt.colorSpaceToWorking(this,l),this}setStyle(e,n=yi){function s(c){c!==void 0&&parseFloat(c)<1&>("Color: Alpha component of "+e+" will be ignored.")}let l;if(l=/^(\w+)\(([^\)]*)\)/.exec(e)){let c;const d=l[1],p=l[2];switch(d){case"rgb":case"rgba":if(c=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,n);if(c=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,n);break;case"hsl":case"hsla":if(c=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,n);break;default:gt("Color: Unknown color model "+e)}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(e)){const c=l[1],d=c.length;if(d===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,n);if(d===6)return this.setHex(parseInt(c,16),n);gt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=yi){const s=py[e.toLowerCase()];return s!==void 0?this.setHex(s,n):gt("Color: Unknown color "+e),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=ja(e.r),this.g=ja(e.g),this.b=ja(e.b),this}copyLinearToSRGB(e){return this.r=ho(e.r),this.g=ho(e.g),this.b=ho(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yi){return Gt.workingToColorSpace(qn.copy(this),e),Math.round(Ot(qn.r*255,0,255))*65536+Math.round(Ot(qn.g*255,0,255))*256+Math.round(Ot(qn.b*255,0,255))}getHexString(e=yi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Gt.workingColorSpace){Gt.workingToColorSpace(qn.copy(this),n);const s=qn.r,l=qn.g,c=qn.b,d=Math.max(s,l,c),p=Math.min(s,l,c);let m,h;const _=(p+d)/2;if(p===d)m=0,h=0;else{const S=d-p;switch(h=_<=.5?S/(d+p):S/(2-d-p),d){case s:m=(l-c)/S+(l0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const ji=new re,Pa=new re,gh=new re,Ia=new re,Kr=new re,$r=new re,Ov=new re,_h=new re,vh=new re,xh=new re,yh=new gn,Sh=new gn,Mh=new gn;class Oi{constructor(e=new re,n=new re,s=new re){this.a=e,this.b=n,this.c=s}static getNormal(e,n,s,l){l.subVectors(s,n),ji.subVectors(e,n),l.cross(ji);const c=l.lengthSq();return c>0?l.multiplyScalar(1/Math.sqrt(c)):l.set(0,0,0)}static getBarycoord(e,n,s,l,c){ji.subVectors(l,n),Pa.subVectors(s,n),gh.subVectors(e,n);const d=ji.dot(ji),p=ji.dot(Pa),m=ji.dot(gh),h=Pa.dot(Pa),_=Pa.dot(gh),S=d*h-p*p;if(S===0)return c.set(0,0,0),null;const v=1/S,b=(h*m-p*_)*v,A=(d*_-p*m)*v;return c.set(1-b-A,A,b)}static containsPoint(e,n,s,l){return this.getBarycoord(e,n,s,l,Ia)===null?!1:Ia.x>=0&&Ia.y>=0&&Ia.x+Ia.y<=1}static getInterpolation(e,n,s,l,c,d,p,m){return this.getBarycoord(e,n,s,l,Ia)===null?(m.x=0,m.y=0,"z"in m&&(m.z=0),"w"in m&&(m.w=0),null):(m.setScalar(0),m.addScaledVector(c,Ia.x),m.addScaledVector(d,Ia.y),m.addScaledVector(p,Ia.z),m)}static getInterpolatedAttribute(e,n,s,l,c,d){return yh.setScalar(0),Sh.setScalar(0),Mh.setScalar(0),yh.fromBufferAttribute(e,n),Sh.fromBufferAttribute(e,s),Mh.fromBufferAttribute(e,l),d.setScalar(0),d.addScaledVector(yh,c.x),d.addScaledVector(Sh,c.y),d.addScaledVector(Mh,c.z),d}static isFrontFacing(e,n,s,l){return ji.subVectors(s,n),Pa.subVectors(e,n),ji.cross(Pa).dot(l)<0}set(e,n,s){return this.a.copy(e),this.b.copy(n),this.c.copy(s),this}setFromPointsAndIndices(e,n,s,l){return this.a.copy(e[n]),this.b.copy(e[s]),this.c.copy(e[l]),this}setFromAttributeAndIndices(e,n,s,l){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,l),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 ji.subVectors(this.c,this.b),Pa.subVectors(this.a,this.b),ji.cross(Pa).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Oi.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,s,l,c){return Oi.getInterpolation(e,this.a,this.b,this.c,n,s,l,c)}containsPoint(e){return Oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const s=this.a,l=this.b,c=this.c;let d,p;Kr.subVectors(l,s),$r.subVectors(c,s),_h.subVectors(e,s);const m=Kr.dot(_h),h=$r.dot(_h);if(m<=0&&h<=0)return n.copy(s);vh.subVectors(e,l);const _=Kr.dot(vh),S=$r.dot(vh);if(_>=0&&S<=_)return n.copy(l);const v=m*S-_*h;if(v<=0&&m>=0&&_<=0)return d=m/(m-_),n.copy(s).addScaledVector(Kr,d);xh.subVectors(e,c);const b=Kr.dot(xh),A=$r.dot(xh);if(A>=0&&b<=A)return n.copy(c);const w=b*h-m*A;if(w<=0&&h>=0&&A<=0)return p=h/(h-A),n.copy(s).addScaledVector($r,p);const y=_*A-b*S;if(y<=0&&S-_>=0&&b-A>=0)return Ov.subVectors(c,l),p=(S-_)/(S-_+(b-A)),n.copy(l).addScaledVector(Ov,p);const x=1/(y+w+v);return d=w*x,p=v*x,n.copy(s).addScaledVector(Kr,d).addScaledVector($r,p)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ur{constructor(e=new re(1/0,1/0,1/0),n=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,s=e.length;n=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,n){return n.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,Xi),Xi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,s;return e.normal.x>0?(n=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),n<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ml),Qc.subVectors(this.max,ml),Qr.subVectors(e.a,ml),Jr.subVectors(e.b,ml),eo.subVectors(e.c,ml),xs.subVectors(Jr,Qr),ys.subVectors(eo,Jr),Zs.subVectors(Qr,eo);let n=[0,-xs.z,xs.y,0,-ys.z,ys.y,0,-Zs.z,Zs.y,xs.z,0,-xs.x,ys.z,0,-ys.x,Zs.z,0,-Zs.x,-xs.y,xs.x,0,-ys.y,ys.x,0,-Zs.y,Zs.x,0];return!bh(n,Qr,Jr,eo,Qc)||(n=[1,0,0,0,1,0,0,0,1],!bh(n,Qr,Jr,eo,Qc))?!1:(Jc.crossVectors(xs,ys),n=[Jc.x,Jc.y,Jc.z],bh(n,Qr,Jr,eo,Qc))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ba[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ba[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ba[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ba[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ba[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ba[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ba[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ba[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ba),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}}const Ba=[new re,new re,new re,new re,new re,new re,new re,new re],Xi=new re,$c=new ur,Qr=new re,Jr=new re,eo=new re,xs=new re,ys=new re,Zs=new re,ml=new re,Qc=new re,Jc=new re,Ks=new re;function bh(a,e,n,s,l){for(let c=0,d=a.length-3;c<=d;c+=3){Ks.fromArray(a,c);const p=l.x*Math.abs(Ks.x)+l.y*Math.abs(Ks.y)+l.z*Math.abs(Ks.z),m=e.dot(Ks),h=n.dot(Ks),_=s.dot(Ks);if(Math.max(-Math.max(m,h,_),Math.min(m,h,_))>p)return!1}return!0}const Cn=new re,eu=new xt;let VE=0;class Zi extends Ns{constructor(e,n,s=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:VE++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=s,this.usage=yv,this.updateRanges=[],this.gpuType=qi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}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}copyAt(e,n,s){e*=this.itemSize,s*=n.itemSize;for(let l=0,c=this.itemSize;lthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(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;gl.subVectors(e,this.center);const n=gl.lengthSq();if(n>this.radius*this.radius){const s=Math.sqrt(n),l=(s-this.radius)*.5;this.center.addScaledVector(gl,l/s),this.radius+=l}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Eh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gl.copy(e.center).add(Eh)),this.expandByPoint(gl.copy(e.center).sub(Eh))),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}}let jE=0;const Di=new cn,Th=new Nn,to=new re,xi=new ur,_l=new ur,Pn=new re;class Pi extends Ns{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jE++}),this.uuid=Bl(),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){return Array.isArray(e)?this.index=new(ME(e)?gy:my)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,s=0){this.groups.push({start:e,count:n,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const s=this.attributes.normal;if(s!==void 0){const c=new bt().getNormalMatrix(e);s.applyNormalMatrix(c),s.needsUpdate=!0}const l=this.attributes.tangent;return l!==void 0&&(l.transformDirection(e),l.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Di.makeRotationFromQuaternion(e),this.applyMatrix4(Di),this}rotateX(e){return Di.makeRotationX(e),this.applyMatrix4(Di),this}rotateY(e){return Di.makeRotationY(e),this.applyMatrix4(Di),this}rotateZ(e){return Di.makeRotationZ(e),this.applyMatrix4(Di),this}translate(e,n,s){return Di.makeTranslation(e,n,s),this.applyMatrix4(Di),this}scale(e,n,s){return Di.makeScale(e,n,s),this.applyMatrix4(Di),this}lookAt(e){return Th.lookAt(e),Th.updateMatrix(),this.applyMatrix4(Th.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(to).negate(),this.translate(to.x,to.y,to.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const s=[];for(let l=0,c=e.length;ln.count&>("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ur);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let s=0,l=n.length;s0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const m=this.parameters;for(const h in m)m[h]!==void 0&&(e[h]=m[h]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const s=this.attributes;for(const m in s){const h=s[m];e.data.attributes[m]=h.toJSON(e.data)}const l={};let c=!1;for(const m in this.morphAttributes){const h=this.morphAttributes[m],_=[];for(let S=0,v=h.length;S0&&(l[m]=_,c=!0)}c&&(e.data.morphAttributes=l,e.data.morphTargetsRelative=this.morphTargetsRelative);const d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));const p=this.boundingSphere;return p!==null&&(e.data.boundingSphere=p.toJSON()),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;const n={};this.name=e.name;const s=e.index;s!==null&&this.setIndex(s.clone());const l=e.attributes;for(const h in l){const _=l[h];this.setAttribute(h,_.clone(n))}const c=e.morphAttributes;for(const h in c){const _=[],S=c[h];for(let v=0,b=S.length;v0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const s=e[n];if(s===void 0){gt(`Material: parameter '${n}' has value of undefined.`);continue}const l=this[n];if(l===void 0){gt(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}l&&l.isColor?l.set(s):l&&l.isVector2&&s&&s.isVector2||l&&l.isEuler&&s&&s.isEuler||l&&l.isVector3&&s&&s.isVector3?l.copy(s):this[n]=s}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==uo&&(s.blending=this.blending),this.side!==Cs&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==Wh&&(s.blendSrc=this.blendSrc),this.blendDst!==qh&&(s.blendDst=this.blendDst),this.blendEquation!==Js&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==go&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==xv&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Xr&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Xr&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Xr&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.allowOverride===!1&&(s.allowOverride=!1),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function l(c){const d=[];for(const p in c){const m=c[p];delete m.metadata,d.push(m)}return d}if(n){const c=l(e.textures),d=l(e.images);c.length>0&&(s.textures=c),d.length>0&&(s.images=d)}return s}fromJSON(e,n){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new ot().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=n[e.map]||null),e.matcap!==void 0&&(this.matcap=n[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=n[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=n[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=n[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),this.normalScale=new xt().fromArray(s)}return e.displacementMap!==void 0&&(this.displacementMap=n[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=n[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=n[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=n[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=n[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=n[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=n[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=n[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=n[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=n[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=n[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=n[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=n[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=n[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new xt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=n[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=n[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=n[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=n[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=n[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=n[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=n[e.sheenRoughnessMap]||null),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;const n=e.clippingPlanes;let s=null;if(n!==null){const l=n.length;s=new Array(l);for(let c=0;c!==l;++c)s[c]=n[c].clone()}return this.clippingPlanes=s,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){e===!0&&this.version++}}const Fa=new re,Ah=new re,tu=new re,Ss=new re,Ch=new re,nu=new re,wh=new re;class rm{constructor(e=new re,n=new re(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,Fa)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const s=n.dot(this.direction);return s<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Fa.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Fa.copy(this.origin).addScaledVector(this.direction,n),Fa.distanceToSquared(e))}distanceSqToSegment(e,n,s,l){Ah.copy(e).add(n).multiplyScalar(.5),tu.copy(n).sub(e).normalize(),Ss.copy(this.origin).sub(Ah);const c=e.distanceTo(n)*.5,d=-this.direction.dot(tu),p=Ss.dot(this.direction),m=-Ss.dot(tu),h=Ss.lengthSq(),_=Math.abs(1-d*d);let S,v,b,A;if(_>0)if(S=d*m-p,v=d*p-m,A=c*_,S>=0)if(v>=-A)if(v<=A){const w=1/_;S*=w,v*=w,b=S*(S+d*v+2*p)+v*(d*S+v+2*m)+h}else v=c,S=Math.max(0,-(d*v+p)),b=-S*S+v*(v+2*m)+h;else v=-c,S=Math.max(0,-(d*v+p)),b=-S*S+v*(v+2*m)+h;else v<=-A?(S=Math.max(0,-(-d*c+p)),v=S>0?-c:Math.min(Math.max(-c,-m),c),b=-S*S+v*(v+2*m)+h):v<=A?(S=0,v=Math.min(Math.max(-c,-m),c),b=v*(v+2*m)+h):(S=Math.max(0,-(d*c+p)),v=S>0?c:Math.min(Math.max(-c,-m),c),b=-S*S+v*(v+2*m)+h);else v=d>0?-c:c,S=Math.max(0,-(d*v+p)),b=-S*S+v*(v+2*m)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,S),l&&l.copy(Ah).addScaledVector(tu,v),b}intersectSphere(e,n){Fa.subVectors(e.center,this.origin);const s=Fa.dot(this.direction),l=Fa.dot(Fa)-s*s,c=e.radius*e.radius;if(l>c)return null;const d=Math.sqrt(c-l),p=s-d,m=s+d;return m<0?null:p<0?this.at(m,n):this.at(p,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const s=-(this.origin.dot(e.normal)+e.constant)/n;return s>=0?s:null}intersectPlane(e,n){const s=this.distanceToPlane(e);return s===null?null:this.at(s,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let s,l,c,d,p,m;const h=1/this.direction.x,_=1/this.direction.y,S=1/this.direction.z,v=this.origin;return h>=0?(s=(e.min.x-v.x)*h,l=(e.max.x-v.x)*h):(s=(e.max.x-v.x)*h,l=(e.min.x-v.x)*h),_>=0?(c=(e.min.y-v.y)*_,d=(e.max.y-v.y)*_):(c=(e.max.y-v.y)*_,d=(e.min.y-v.y)*_),s>d||c>l||((c>s||isNaN(s))&&(s=c),(d=0?(p=(e.min.z-v.z)*S,m=(e.max.z-v.z)*S):(p=(e.max.z-v.z)*S,m=(e.min.z-v.z)*S),s>m||p>l)||((p>s||s!==s)&&(s=p),(m=0?s:l,n)}intersectsBox(e){return this.intersectBox(e,Fa)!==null}intersectTriangle(e,n,s,l,c){Ch.subVectors(n,e),nu.subVectors(s,e),wh.crossVectors(Ch,nu);let d=this.direction.dot(wh),p;if(d>0){if(l)return null;p=1}else if(d<0)p=-1,d=-d;else return null;Ss.subVectors(this.origin,e);const m=p*this.direction.dot(nu.crossVectors(Ss,nu));if(m<0)return null;const h=p*this.direction.dot(Ch.cross(Ss));if(h<0||m+h>d)return null;const _=-p*Ss.dot(wh);return _<0?null:this.at(_/d,c)}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)}}class _y extends Mo{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(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 Rs,this.combine=$x,this.reflectivity=1,this.refractionRatio=.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}}const Pv=new cn,$s=new rm,iu=new So,Iv=new re,au=new re,su=new re,ru=new re,Rh=new re,ou=new re,Bv=new re,lu=new re;class $i extends Nn{constructor(e=new Pi,n=new _y){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,s=Object.keys(n);if(s.length>0){const l=n[s[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,d=l.length;c(e.far-e.near)**2))&&(Pv.copy(c).invert(),$s.copy(e.ray).applyMatrix4(Pv),!(s.boundingBox!==null&&$s.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,n,$s)))}_computeIntersections(e,n,s){let l;const c=this.geometry,d=this.material,p=c.index,m=c.attributes.position,h=c.attributes.uv,_=c.attributes.uv1,S=c.attributes.normal,v=c.groups,b=c.drawRange;if(p!==null)if(Array.isArray(d))for(let A=0,w=v.length;An.far?null:{distance:h,point:lu.clone(),object:a}}function cu(a,e,n,s,l,c,d,p,m,h){a.getVertexPosition(p,au),a.getVertexPosition(m,su),a.getVertexPosition(h,ru);const _=WE(a,e,n,s,au,su,ru,Bv);if(_){const S=new re;Oi.getBarycoord(Bv,au,su,ru,S),l&&(_.uv=Oi.getInterpolatedAttribute(l,p,m,h,S,new xt)),c&&(_.uv1=Oi.getInterpolatedAttribute(c,p,m,h,S,new xt)),d&&(_.normal=Oi.getInterpolatedAttribute(d,p,m,h,S,new re),_.normal.dot(s.direction)>0&&_.normal.multiplyScalar(-1));const v={a:p,b:m,c:h,normal:new re,materialIndex:0};Oi.getNormal(au,su,ru,v.normal),_.face=v,_.barycoord=S}return _}class vy extends $n{constructor(e=null,n=1,s=1,l,c,d,p,m,h=Vn,_=Vn,S,v){super(null,d,p,m,h,_,l,c,S,v),this.isDataTexture=!0,this.image={data:e,width:n,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fv extends Zi{constructor(e,n,s,l=1){super(e,n,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=l}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const no=new cn,zv=new cn,uu=[],Hv=new ur,qE=new cn,vl=new $i,xl=new So;class YE extends $i{constructor(e,n,s){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Fv(new Float32Array(s*16),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let l=0;l1)?null:n.copy(e.start).addScaledVector(l,d)}intersectsLine(e){const n=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return n<0&&s>0||s<0&&n>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,n){const s=n||KE.getNormalMatrix(e),l=this.coplanarPoint(Dh).applyMatrix4(e),c=this.normal.applyMatrix3(s).normalize();return this.constant=-l.dot(c),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)}}const Qs=new So,$E=new xt(.5,.5),du=new re;class om{constructor(e=new bs,n=new bs,s=new bs,l=new bs,c=new bs,d=new bs){this.planes=[e,n,s,l,c,d]}set(e,n,s,l,c,d){const p=this.planes;return p[0].copy(e),p[1].copy(n),p[2].copy(s),p[3].copy(l),p[4].copy(c),p[5].copy(d),this}copy(e){const n=this.planes;for(let s=0;s<6;s++)n[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,n=la,s=!1){const l=this.planes,c=e.elements,d=c[0],p=c[1],m=c[2],h=c[3],_=c[4],S=c[5],v=c[6],b=c[7],A=c[8],w=c[9],y=c[10],x=c[11],P=c[12],L=c[13],R=c[14],I=c[15];if(l[0].setComponents(h-d,b-_,x-A,I-P).normalize(),l[1].setComponents(h+d,b+_,x+A,I+P).normalize(),l[2].setComponents(h+p,b+S,x+w,I+L).normalize(),l[3].setComponents(h-p,b-S,x-w,I-L).normalize(),s)l[4].setComponents(m,v,y,R).normalize(),l[5].setComponents(h-m,b-v,x-y,I-R).normalize();else if(l[4].setComponents(h-m,b-v,x-y,I-R).normalize(),n===la)l[5].setComponents(h+m,b+v,x+y,I+R).normalize();else if(n===Ll)l[5].setComponents(m,v,y,R).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Qs.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qs)}intersectsSprite(e){Qs.center.set(0,0,0);const n=$E.distanceTo(e.center);return Qs.radius=.7071067811865476+n,Qs.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qs)}intersectsSphere(e){const n=this.planes,s=e.center,l=-e.radius;for(let c=0;c<6;c++)if(n[c].distanceToPoint(s)0?e.max.x:e.min.x,du.y=l.normal.y>0?e.max.y:e.min.y,du.z=l.normal.z>0?e.max.z:e.min.z,l.distanceToPoint(du)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let s=0;s<6;s++)if(n[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class lm extends Mo{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(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}}const Pu=new re,Iu=new re,Gv=new cn,yl=new rm,fu=new So,Nh=new re,Vv=new re;class QE extends Nn{constructor(e=new Pi,n=new lm){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,s=[0];for(let l=1,c=n.count;l0){const l=n[s[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,d=l.length;cs)return;Nh.applyMatrix4(a.matrixWorld);const h=e.ray.origin.distanceTo(Nh);if(!(he.far))return{distance:h,point:Vv.clone().applyMatrix4(a.matrixWorld),index:d,face:null,faceIndex:null,barycoord:null,object:a}}const kv=new re,jv=new re;class xy extends QE{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,s=[];for(let l=0,c=n.count;l0?1:-1,_.push(Se.x,Se.y,Se.z),S.push(te/U),S.push(1-xe/T),j+=1}}for(let xe=0;xe>>=0,t===0?32:31-(Ve(t)/ge|0)|0}var Je=256,tt=262144,Z=4194304;function Le(t){var i=t&42;if(i!==0)return i;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function ye(t,i,r){var o=t.pendingLanes;if(o===0)return 0;var u=0,d=t.suspendedLanes,b=t.pingedLanes;t=t.warmLanes;var D=o&134217727;return D!==0?(o=D&~d,o!==0?u=Le(o):(b&=D,b!==0?u=Le(b):r||(r=D&~t,r!==0&&(u=Le(r))))):(D=o&~d,D!==0?u=Le(D):b!==0?u=Le(b):r||(r=o&~t,r!==0&&(u=Le(r)))),u===0?0:i!==0&&i!==u&&(i&d)===0&&(d=u&-u,r=i&-i,d>=r||d===32&&(r&4194048)!==0)?i:u}function Fe(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function Ge(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ce(){var t=Z;return Z<<=1,(Z&62914560)===0&&(Z=4194304),t}function Qe(t){for(var i=[],r=0;31>r;r++)i.push(t);return i}function Ye(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Yt(t,i,r,o,u,d){var b=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var D=t.entanglements,X=t.expirationTimes,ue=t.hiddenUpdates;for(r=b&~r;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Zt=/[\n"\\]/g;function Kt(t){return t.replace(Zt,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Ke(t,i,r,o,u,d,b,D){t.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?t.type=b:t.removeAttribute("type"),i!=null?b==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+nt(i)):t.value!==""+nt(i)&&(t.value=""+nt(i)):b!=="submit"&&b!=="reset"||t.removeAttribute("value"),i!=null?Nt(t,b,nt(i)):r!=null?Nt(t,b,nt(r)):o!=null&&t.removeAttribute("value"),u==null&&d!=null&&(t.defaultChecked=!!d),u!=null&&(t.checked=u&&typeof u!="function"&&typeof u!="symbol"),D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?t.name=""+nt(D):t.removeAttribute("name")}function jn(t,i,r,o,u,d,b,D){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(t.type=d),i!=null||r!=null){if(!(d!=="submit"&&d!=="reset"||i!=null)){Et(t);return}r=r!=null?""+nt(r):"",i=i!=null?""+nt(i):r,D||i===t.value||(t.value=i),t.defaultValue=i}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=D?t.checked:!!o,t.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.name=b),Et(t)}function Nt(t,i,r){i==="number"&&on(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function wn(t,i,r,o){if(t=t.options,i){i={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(va)try{var Co={};Object.defineProperty(Co,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",Co,Co),window.removeEventListener("test",Co,Co)}catch{Ku=!1}var Za=null,$u=null,Fl=null;function Rm(){if(Fl)return Fl;var t,i=$u,r=i.length,o,u="value"in Za?Za.value:Za.textContent,d=u.length;for(t=0;t=Do),Pm=" ",Im=!1;function Bm(t,i){switch(t){case"keyup":return ES.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var _r=!1;function AS(t,i){switch(t){case"compositionend":return Fm(i);case"keypress":return i.which!==32?null:(Im=!0,Pm);case"textInput":return t=i.data,t===Pm&&Im?null:t;default:return null}}function CS(t,i){if(_r)return t==="compositionend"||!nf&&Bm(t,i)?(t=Rm(),Fl=$u=Za=null,_r=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:r,offset:i-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Wm(r)}}function Ym(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ym(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Zm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=on(t.document);i instanceof t.HTMLIFrameElement;){try{var r=typeof i.contentWindow.location.href=="string"}catch{r=!1}if(r)t=i.contentWindow;else break;i=on(t.document)}return i}function rf(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var PS=va&&"documentMode"in document&&11>=document.documentMode,vr=null,of=null,Oo=null,lf=!1;function Km(t,i,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;lf||vr==null||vr!==on(o)||(o=vr,"selectionStart"in o&&rf(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Oo&&Lo(Oo,o)||(Oo=o,o=Nc(of,"onSelect"),0>=b,u-=b,ta=1<<32-Xe(i)+u|r<At?(Ft=at,at=null):Ft=at.sibling;var jt=de(ae,at,ce[At],Te);if(jt===null){at===null&&(at=Ft);break}t&&at&&jt.alternate===null&&i(ae,at),$=d(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt,at=Ft}if(At===ce.length)return r(ae,at),Ht&&ya(ae,At),lt;if(at===null){for(;AtAt?(Ft=at,at=null):Ft=at.sibling;var _s=de(ae,at,jt.value,Te);if(_s===null){at===null&&(at=Ft);break}t&&at&&_s.alternate===null&&i(ae,at),$=d(_s,$,At),kt===null?lt=_s:kt.sibling=_s,kt=_s,at=Ft}if(jt.done)return r(ae,at),Ht&&ya(ae,At),lt;if(at===null){for(;!jt.done;At++,jt=ce.next())jt=we(ae,jt.value,Te),jt!==null&&($=d(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt);return Ht&&ya(ae,At),lt}for(at=o(at);!jt.done;At++,jt=ce.next())jt=me(at,ae,At,jt.value,Te),jt!==null&&(t&&jt.alternate!==null&&at.delete(jt.key===null?At:jt.key),$=d(jt,$,At),kt===null?lt=jt:kt.sibling=jt,kt=jt);return t&&at.forEach(function(tb){return i(ae,tb)}),Ht&&ya(ae,At),lt}function an(ae,$,ce,Te){if(typeof ce=="object"&&ce!==null&&ce.type===w&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case M:e:{for(var lt=ce.key;$!==null;){if($.key===lt){if(lt=ce.type,lt===w){if($.tag===7){r(ae,$.sibling),Te=u($,ce.props.children),Te.return=ae,ae=Te;break e}}else if($.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===A&&ks(lt)===$.type){r(ae,$.sibling),Te=u($,ce.props),Ho(Te,ce),Te.return=ae,ae=Te;break e}r(ae,$);break}else i(ae,$);$=$.sibling}ce.type===w?(Te=Fs(ce.props.children,ae.mode,Te,ce.key),Te.return=ae,ae=Te):(Te=Yl(ce.type,ce.key,ce.props,null,ae.mode,Te),Ho(Te,ce),Te.return=ae,ae=Te)}return b(ae);case E:e:{for(lt=ce.key;$!==null;){if($.key===lt)if($.tag===4&&$.stateNode.containerInfo===ce.containerInfo&&$.stateNode.implementation===ce.implementation){r(ae,$.sibling),Te=u($,ce.children||[]),Te.return=ae,ae=Te;break e}else{r(ae,$);break}else i(ae,$);$=$.sibling}Te=mf(ce,ae.mode,Te),Te.return=ae,ae=Te}return b(ae);case A:return ce=ks(ce),an(ae,$,ce,Te)}if(J(ce))return et(ae,$,ce,Te);if(Q(ce)){if(lt=Q(ce),typeof lt!="function")throw Error(s(150));return ce=lt.call(ce),pt(ae,$,ce,Te)}if(typeof ce.then=="function")return an(ae,$,tc(ce),Te);if(ce.$$typeof===L)return an(ae,$,$l(ae,ce),Te);nc(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,$!==null&&$.tag===6?(r(ae,$.sibling),Te=u($,ce),Te.return=ae,ae=Te):(r(ae,$),Te=pf(ce,ae.mode,Te),Te.return=ae,ae=Te),b(ae)):r(ae,$)}return function(ae,$,ce,Te){try{zo=0;var lt=an(ae,$,ce,Te);return Rr=null,lt}catch(at){if(at===wr||at===Jl)throw at;var kt=di(29,at,null,ae.mode);return kt.lanes=Te,kt.return=ae,kt}}}var Xs=xg(!0),yg=xg(!1),es=!1;function Cf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ts(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ns(t,i,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(Xt&2)!==0){var u=o.pending;return u===null?i.next=i:(i.next=u.next,u.next=i),o.pending=i,i=ql(t),ig(t,null,r),i}return Wl(t,o,i,r),ql(t)}function Go(t,i,r){if(i=i.updateQueue,i!==null&&(i=i.shared,(r&4194048)!==0)){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,dn(t,r)}}function Rf(t,i){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var u=null,d=null;if(r=r.firstBaseUpdate,r!==null){do{var b={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};d===null?u=d=b:d=d.next=b,r=r.next}while(r!==null);d===null?u=d=i:d=d.next=i}else u=d=i;r={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=i:t.next=i,r.lastBaseUpdate=i}var Df=!1;function Vo(){if(Df){var t=Cr;if(t!==null)throw t}}function ko(t,i,r,o){Df=!1;var u=t.updateQueue;es=!1;var d=u.firstBaseUpdate,b=u.lastBaseUpdate,D=u.shared.pending;if(D!==null){u.shared.pending=null;var X=D,ue=X.next;X.next=null,b===null?d=ue:b.next=ue,b=X;var be=t.alternate;be!==null&&(be=be.updateQueue,D=be.lastBaseUpdate,D!==b&&(D===null?be.firstBaseUpdate=ue:D.next=ue,be.lastBaseUpdate=X))}if(d!==null){var we=u.baseState;b=0,be=ue=X=null,D=d;do{var de=D.lane&-536870913,me=de!==D.lane;if(me?(Bt&de)===de:(o&de)===de){de!==0&&de===Ar&&(Df=!0),be!==null&&(be=be.next={lane:0,tag:D.tag,payload:D.payload,callback:null,next:null});e:{var et=t,pt=D;de=i;var an=r;switch(pt.tag){case 1:if(et=pt.payload,typeof et=="function"){we=et.call(an,we,de);break e}we=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=pt.payload,de=typeof et=="function"?et.call(an,we,de):et,de==null)break e;we=S({},we,de);break e;case 2:es=!0}}de=D.callback,de!==null&&(t.flags|=64,me&&(t.flags|=8192),me=u.callbacks,me===null?u.callbacks=[de]:me.push(de))}else me={lane:de,tag:D.tag,payload:D.payload,callback:D.callback,next:null},be===null?(ue=be=me,X=we):be=be.next=me,b|=de;if(D=D.next,D===null){if(D=u.shared.pending,D===null)break;me=D,D=me.next,me.next=null,u.lastBaseUpdate=me,u.shared.pending=null}}while(!0);be===null&&(X=we),u.baseState=X,u.firstBaseUpdate=ue,u.lastBaseUpdate=be,d===null&&(u.shared.lanes=0),os|=b,t.lanes=b,t.memoizedState=we}}function Sg(t,i){if(typeof t!="function")throw Error(s(191,t));t.call(i)}function Mg(t,i){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;td?d:8;var b=G.T,D={};G.T=D,Zf(t,!1,i,r);try{var X=u(),ue=G.S;if(ue!==null&&ue(D,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var be=jS(X,o);Wo(t,i,be,_i(t))}else Wo(t,i,o,_i(t))}catch(we){Wo(t,i,{then:function(){},status:"rejected",reason:we},_i())}finally{j.p=d,b!==null&&D.types!==null&&(b.types=D.types),G.T=b}}function KS(){}function qf(t,i,r,o){if(t.tag!==5)throw Error(s(476));var u=e0(t).queue;Jg(t,u,i,se,r===null?KS:function(){return t0(t),r(o)})}function e0(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:se},next:null};var r={};return i.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ea,lastRenderedState:r},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function t0(t){var i=e0(t);i.next===null&&(i=t.alternate.memoizedState),Wo(t,i.next.queue,{},_i())}function Yf(){return zn(cl)}function n0(){return Mn().memoizedState}function i0(){return Mn().memoizedState}function $S(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var r=_i();t=ts(r);var o=ns(i,t,r);o!==null&&(ii(o,i,r),Go(o,i,r)),i={cache:bf()},t.payload=i;return}i=i.return}}function QS(t,i,r){var o=_i();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},dc(t)?s0(i,r):(r=df(t,i,r,o),r!==null&&(ii(r,t,o),r0(r,i,o)))}function a0(t,i,r){var o=_i();Wo(t,i,r,o)}function Wo(t,i,r,o){var u={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(dc(t))s0(i,u);else{var d=t.alternate;if(t.lanes===0&&(d===null||d.lanes===0)&&(d=i.lastRenderedReducer,d!==null))try{var b=i.lastRenderedState,D=d(b,r);if(u.hasEagerState=!0,u.eagerState=D,fi(D,b))return Wl(t,i,u,0),ln===null&&Xl(),!1}catch{}if(r=df(t,i,u,o),r!==null)return ii(r,t,o),r0(r,i,o),!0}return!1}function Zf(t,i,r,o){if(o={lane:2,revertLane:Cd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},dc(t)){if(i)throw Error(s(479))}else i=df(t,r,o,2),i!==null&&ii(i,t,2)}function dc(t){var i=t.alternate;return t===Tt||i!==null&&i===Tt}function s0(t,i){Nr=sc=!0;var r=t.pending;r===null?i.next=i:(i.next=r.next,r.next=i),t.pending=i}function r0(t,i,r){if((r&4194048)!==0){var o=i.lanes;o&=t.pendingLanes,r|=o,i.lanes=r,dn(t,r)}}var qo={readContext:zn,use:lc,useCallback:xn,useContext:xn,useEffect:xn,useImperativeHandle:xn,useLayoutEffect:xn,useInsertionEffect:xn,useMemo:xn,useReducer:xn,useRef:xn,useState:xn,useDebugValue:xn,useDeferredValue:xn,useTransition:xn,useSyncExternalStore:xn,useId:xn,useHostTransitionStatus:xn,useFormState:xn,useActionState:xn,useOptimistic:xn,useMemoCache:xn,useCacheRefresh:xn};qo.useEffectEvent=xn;var o0={readContext:zn,use:lc,useCallback:function(t,i){return Zn().memoizedState=[t,i===void 0?null:i],t},useContext:zn,useEffect:jg,useImperativeHandle:function(t,i,r){r=r!=null?r.concat([t]):null,uc(4194308,4,Yg.bind(null,i,t),r)},useLayoutEffect:function(t,i){return uc(4194308,4,t,i)},useInsertionEffect:function(t,i){uc(4,2,t,i)},useMemo:function(t,i){var r=Zn();i=i===void 0?null:i;var o=t();if(Ws){Ie(!0);try{t()}finally{Ie(!1)}}return r.memoizedState=[o,i],o},useReducer:function(t,i,r){var o=Zn();if(r!==void 0){var u=r(i);if(Ws){Ie(!0);try{r(i)}finally{Ie(!1)}}}else u=i;return o.memoizedState=o.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},o.queue=t,t=t.dispatch=QS.bind(null,Tt,t),[o.memoizedState,t]},useRef:function(t){var i=Zn();return t={current:t},i.memoizedState=t},useState:function(t){t=Vf(t);var i=t.queue,r=a0.bind(null,Tt,i);return i.dispatch=r,[t.memoizedState,r]},useDebugValue:Xf,useDeferredValue:function(t,i){var r=Zn();return Wf(r,t,i)},useTransition:function(){var t=Vf(!1);return t=Jg.bind(null,Tt,t.queue,!0,!1),Zn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,r){var o=Tt,u=Zn();if(Ht){if(r===void 0)throw Error(s(407));r=r()}else{if(r=i(),ln===null)throw Error(s(349));(Bt&127)!==0||wg(o,i,r)}u.memoizedState=r;var d={value:r,getSnapshot:i};return u.queue=d,jg(Dg.bind(null,o,d,t),[t]),o.flags|=2048,Lr(9,{destroy:void 0},Rg.bind(null,o,d,r,i),null),r},useId:function(){var t=Zn(),i=ln.identifierPrefix;if(Ht){var r=na,o=ta;r=(o&~(1<<32-Xe(o)-1)).toString(32)+r,i="_"+i+"R_"+r,r=rc++,0<\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?d.multiple=!0:o.size&&(d.size=o.size);break;default:d=typeof o.is=="string"?b.createElement(u,{is:o.is}):b.createElement(u)}}d[St]=i,d[_n]=o;e:for(b=i.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===i)break e;for(;b.sibling===null;){if(b.return===null||b.return===i)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}i.stateNode=d;e:switch(Gn(d,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Aa(i)}}return fn(i),cd(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,r),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==o&&Aa(i);else{if(typeof o!="string"&&i.stateNode===null)throw Error(s(166));if(t=le.current,Er(i)){if(t=i.stateNode,r=i.memoizedProps,o=null,u=Fn,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}t[St]=i,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||A_(t.nodeValue,r)),t||Qa(i,!0)}else t=Uc(t).createTextNode(o),t[St]=i,i.stateNode=t}return fn(i),null;case 31:if(r=i.memoizedState,t===null||t.memoizedState!==null){if(o=Er(i),r!==null){if(t===null){if(!o)throw Error(s(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[St]=i}else zs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;fn(i),t=!1}else r=xf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return i.flags&256?(pi(i),i):(pi(i),null);if((i.flags&128)!==0)throw Error(s(558))}return fn(i),null;case 13:if(o=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=Er(i),o!==null&&o.dehydrated!==null){if(t===null){if(!u)throw Error(s(318));if(u=i.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(s(317));u[St]=i}else zs(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;fn(i),u=!1}else u=xf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return i.flags&256?(pi(i),i):(pi(i),null)}return pi(i),(i.flags&128)!==0?(i.lanes=r,i):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=i.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048)),r!==t&&r&&(i.child.flags|=8192),_c(i,i.updateQueue),fn(i),null);case 4:return je(),t===null&&Nd(i.stateNode.containerInfo),fn(i),null;case 10:return Ma(i.type),fn(i),null;case 19:if(te(Sn),o=i.memoizedState,o===null)return fn(i),null;if(u=(i.flags&128)!==0,d=o.rendering,d===null)if(u)Zo(o,!1);else{if(yn!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(d=ac(t),d!==null){for(i.flags|=128,Zo(o,!1),t=d.updateQueue,i.updateQueue=t,_c(i,t),i.subtreeFlags=0,t=r,r=i.child;r!==null;)ag(r,t),r=r.sibling;return Ee(Sn,Sn.current&1|2),Ht&&ya(i,o.treeForkCount),i.child}t=t.sibling}o.tail!==null&&Ue()>Mc&&(i.flags|=128,u=!0,Zo(o,!1),i.lanes=4194304)}else{if(!u)if(t=ac(d),t!==null){if(i.flags|=128,u=!0,t=t.updateQueue,i.updateQueue=t,_c(i,t),Zo(o,!0),o.tail===null&&o.tailMode==="hidden"&&!d.alternate&&!Ht)return fn(i),null}else 2*Ue()-o.renderingStartTime>Mc&&r!==536870912&&(i.flags|=128,u=!0,Zo(o,!1),i.lanes=4194304);o.isBackwards?(d.sibling=i.child,i.child=d):(t=o.last,t!==null?t.sibling=d:i.child=d,o.last=d)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ue(),t.sibling=null,r=Sn.current,Ee(Sn,u?r&1|2:r&1),Ht&&ya(i,o.treeForkCount),t):(fn(i),null);case 22:case 23:return pi(i),Uf(),o=i.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(i.flags|=8192):o&&(i.flags|=8192),o?(r&536870912)!==0&&(i.flags&128)===0&&(fn(i),i.subtreeFlags&6&&(i.flags|=8192)):fn(i),r=i.updateQueue,r!==null&&_c(i,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048),t!==null&&te(Vs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),i.memoizedState.cache!==r&&(i.flags|=2048),Ma(bn),fn(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function iM(t,i){switch(_f(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ma(bn),je(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return $e(i),null;case 31:if(i.memoizedState!==null){if(pi(i),i.alternate===null)throw Error(s(340));zs()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(pi(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(s(340));zs()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return te(Sn),null;case 4:return je(),null;case 10:return Ma(i.type),null;case 22:case 23:return pi(i),Uf(),t!==null&&te(Vs),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return Ma(bn),null;case 25:return null;default:return null}}function N0(t,i){switch(_f(i),i.tag){case 3:Ma(bn),je();break;case 26:case 27:case 5:$e(i);break;case 4:je();break;case 31:i.memoizedState!==null&&pi(i);break;case 13:pi(i);break;case 19:te(Sn);break;case 10:Ma(i.type);break;case 22:case 23:pi(i),Uf(),t!==null&&te(Vs);break;case 24:Ma(bn)}}function Ko(t,i){try{var r=i.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var u=o.next;r=u;do{if((r.tag&t)===t){o=void 0;var d=r.create,b=r.inst;o=d(),b.destroy=o}r=r.next}while(r!==u)}}catch(D){Jt(i,i.return,D)}}function ss(t,i,r){try{var o=i.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var d=u.next;o=d;do{if((o.tag&t)===t){var b=o.inst,D=b.destroy;if(D!==void 0){b.destroy=void 0,u=i;var X=r,ue=D;try{ue()}catch(be){Jt(u,X,be)}}}o=o.next}while(o!==d)}}catch(be){Jt(i,i.return,be)}}function U0(t){var i=t.updateQueue;if(i!==null){var r=t.stateNode;try{Mg(i,r)}catch(o){Jt(t,t.return,o)}}}function L0(t,i,r){r.props=qs(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){Jt(t,i,o)}}function $o(t,i){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(u){Jt(t,i,u)}}function ia(t,i){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(u){Jt(t,i,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){Jt(t,i,u)}else r.current=null}function O0(t){var i=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(u){Jt(t,t.return,u)}}function ud(t,i,r){try{var o=t.stateNode;TM(o,t.type,r,i),o[_n]=i}catch(u){Jt(t,t.return,u)}}function P0(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ds(t.type)||t.tag===4}function fd(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||P0(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ds(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function dd(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,i):(i=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.appendChild(t),r=r._reactRootContainer,r!=null||i.onclick!==null||(i.onclick=_a));else if(o!==4&&(o===27&&ds(t.type)&&(r=t.stateNode,i=null),t=t.child,t!==null))for(dd(t,i,r),t=t.sibling;t!==null;)dd(t,i,r),t=t.sibling}function vc(t,i,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,i?r.insertBefore(t,i):r.appendChild(t);else if(o!==4&&(o===27&&ds(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(vc(t,i,r),t=t.sibling;t!==null;)vc(t,i,r),t=t.sibling}function I0(t){var i=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,u=i.attributes;u.length;)i.removeAttributeNode(u[0]);Gn(i,o,r),i[St]=t,i[_n]=r}catch(d){Jt(t,t.return,d)}}var Ca=!1,An=!1,hd=!1,B0=typeof WeakSet=="function"?WeakSet:Set,On=null;function aM(t,i){if(t=t.containerInfo,Od=zc,t=Zm(t),rf(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var u=o.anchorOffset,d=o.focusNode;o=o.focusOffset;try{r.nodeType,d.nodeType}catch{r=null;break e}var b=0,D=-1,X=-1,ue=0,be=0,we=t,de=null;t:for(;;){for(var me;we!==r||u!==0&&we.nodeType!==3||(D=b+u),we!==d||o!==0&&we.nodeType!==3||(X=b+o),we.nodeType===3&&(b+=we.nodeValue.length),(me=we.firstChild)!==null;)de=we,we=me;for(;;){if(we===t)break t;if(de===r&&++ue===u&&(D=b),de===d&&++be===o&&(X=b),(me=we.nextSibling)!==null)break;we=de,de=we.parentNode}we=me}r=D===-1||X===-1?null:{start:D,end:X}}else r=null}r=r||{start:0,end:0}}else r=null;for(Pd={focusedElem:t,selectionRange:r},zc=!1,On=i;On!==null;)if(i=On,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,On=t;else for(;On!==null;){switch(i=On,d=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r title"))),Gn(d,o,r),d[St]=t,vn(d),o=d;break e;case"link":var b=k_("link","href",u).get(o+(r.href||""));if(b){for(var D=0;Dan&&(b=an,an=pt,pt=b);var ae=qm(D,pt),$=qm(D,an);if(ae&&$&&(me.rangeCount!==1||me.anchorNode!==ae.node||me.anchorOffset!==ae.offset||me.focusNode!==$.node||me.focusOffset!==$.offset)){var ce=we.createRange();ce.setStart(ae.node,ae.offset),me.removeAllRanges(),pt>an?(me.addRange(ce),me.extend($.node,$.offset)):(ce.setEnd($.node,$.offset),me.addRange(ce))}}}}for(we=[],me=D;me=me.parentNode;)me.nodeType===1&&we.push({element:me,left:me.scrollLeft,top:me.scrollTop});for(typeof D.focus=="function"&&D.focus(),D=0;Dr?32:r,G.T=null,r=yd,yd=null;var d=cs,b=Ua;if(Rn=0,Fr=cs=null,Ua=0,(Xt&6)!==0)throw Error(s(331));var D=Xt;if(Xt|=4,Y0(d.current),X0(d,d.current,b,r),Xt=D,il(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(_e,d)}catch{}return!0}finally{j.p=u,G.T=o,d_(t,i)}}function p_(t,i,r){i=bi(r,i),i=Jf(t.stateNode,i,2),t=ns(t,i,2),t!==null&&(Ye(t,2),aa(t))}function Jt(t,i,r){if(t.tag===3)p_(t,t,r);else for(;i!==null;){if(i.tag===3){p_(i,t,r);break}else if(i.tag===1){var o=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ls===null||!ls.has(o))){t=bi(r,t),r=m0(2),o=ns(i,r,2),o!==null&&(g0(r,o,i,t),Ye(o,2),aa(o));break}}i=i.return}}function Ed(t,i,r){var o=t.pingCache;if(o===null){o=t.pingCache=new oM;var u=new Set;o.set(i,u)}else u=o.get(i),u===void 0&&(u=new Set,o.set(i,u));u.has(r)||(gd=!0,u.add(r),t=dM.bind(null,t,i,r),i.then(t,t))}function dM(t,i,r){var o=t.pingCache;o!==null&&o.delete(i),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ln===t&&(Bt&r)===r&&(yn===4||yn===3&&(Bt&62914560)===Bt&&300>Ue()-Sc?(Xt&2)===0&&zr(t,0):_d|=r,Br===Bt&&(Br=0)),aa(t)}function m_(t,i){i===0&&(i=Ce()),t=Bs(t,i),t!==null&&(Ye(t,i),aa(t))}function hM(t){var i=t.memoizedState,r=0;i!==null&&(r=i.retryLane),m_(t,r)}function pM(t,i){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,u=t.memoizedState;u!==null&&(r=u.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(s(314))}o!==null&&o.delete(i),m_(t,r)}function mM(t,i){return rn(t,i)}var wc=null,Gr=null,Td=!1,Rc=!1,Ad=!1,fs=0;function aa(t){t!==Gr&&t.next===null&&(Gr===null?wc=Gr=t:Gr=Gr.next=t),Rc=!0,Td||(Td=!0,_M())}function il(t,i){if(!Ad&&Rc){Ad=!0;do for(var r=!1,o=wc;o!==null;){if(t!==0){var u=o.pendingLanes;if(u===0)var d=0;else{var b=o.suspendedLanes,D=o.pingedLanes;d=(1<<31-Xe(42|t)+1)-1,d&=u&~(b&~D),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,x_(o,d))}else d=Bt,d=ye(o,o===ln?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(d&3)===0||Fe(o,d)||(r=!0,x_(o,d));o=o.next}while(r);Ad=!1}}function gM(){g_()}function g_(){Rc=Td=!1;var t=0;fs!==0&&CM()&&(t=fs);for(var i=Ue(),r=null,o=wc;o!==null;){var u=o.next,d=__(o,i);d===0?(o.next=null,r===null?wc=u:r.next=u,u===null&&(Gr=r)):(r=o,(t!==0||(d&3)!==0)&&(Rc=!0)),o=u}Rn!==0&&Rn!==5||il(t),fs!==0&&(fs=0)}function __(t,i){for(var r=t.suspendedLanes,o=t.pingedLanes,u=t.expirationTimes,d=t.pendingLanes&-62914561;0D)break;var be=X.transferSize,we=X.initiatorType;be&&C_(we)&&(X=X.responseEnd,b+=be*(X"u"?null:document;function z_(t,i,r){var o=Vr;if(o&&typeof i=="string"&&i){var u=Kt(i);u='link[rel="'+t+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),F_.has(u)||(F_.add(u),t={rel:t,crossOrigin:r,href:i},o.querySelector(u)===null&&(i=o.createElement("link"),Gn(i,"link",t),vn(i),o.head.appendChild(i)))}}function IM(t){La.D(t),z_("dns-prefetch",t,null)}function BM(t,i){La.C(t,i),z_("preconnect",t,i)}function FM(t,i,r){La.L(t,i,r);var o=Vr;if(o&&t&&i){var u='link[rel="preload"][as="'+Kt(i)+'"]';i==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Kt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Kt(r.imageSizes)+'"]')):u+='[href="'+Kt(t)+'"]';var d=u;switch(i){case"style":d=kr(t);break;case"script":d=jr(t)}Ri.has(d)||(t=S({rel:"preload",href:i==="image"&&r&&r.imageSrcSet?void 0:t,as:i},r),Ri.set(d,t),o.querySelector(u)!==null||i==="style"&&o.querySelector(ol(d))||i==="script"&&o.querySelector(ll(d))||(i=o.createElement("link"),Gn(i,"link",t),vn(i),o.head.appendChild(i)))}}function zM(t,i){La.m(t,i);var r=Vr;if(r&&t){var o=i&&typeof i.as=="string"?i.as:"script",u='link[rel="modulepreload"][as="'+Kt(o)+'"][href="'+Kt(t)+'"]',d=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=jr(t)}if(!Ri.has(d)&&(t=S({rel:"modulepreload",href:t},i),Ri.set(d,t),r.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(ll(d)))return}o=r.createElement("link"),Gn(o,"link",t),vn(o),r.head.appendChild(o)}}}function HM(t,i,r){La.S(t,i,r);var o=Vr;if(o&&t){var u=Bi(o).hoistableStyles,d=kr(t);i=i||"default";var b=u.get(d);if(!b){var D={loading:0,preload:null};if(b=o.querySelector(ol(d)))D.loading=5;else{t=S({rel:"stylesheet",href:t,"data-precedence":i},r),(r=Ri.get(d))&&Vd(t,r);var X=b=o.createElement("link");vn(X),Gn(X,"link",t),X._p=new Promise(function(ue,be){X.onload=ue,X.onerror=be}),X.addEventListener("load",function(){D.loading|=1}),X.addEventListener("error",function(){D.loading|=2}),D.loading|=4,Oc(b,i,o)}b={type:"stylesheet",instance:b,count:1,state:D},u.set(d,b)}}}function GM(t,i){La.X(t,i);var r=Vr;if(r&&t){var o=Bi(r).hoistableScripts,u=jr(t),d=o.get(u);d||(d=r.querySelector(ll(u)),d||(t=S({src:t,async:!0},i),(i=Ri.get(u))&&kd(t,i),d=r.createElement("script"),vn(d),Gn(d,"link",t),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function VM(t,i){La.M(t,i);var r=Vr;if(r&&t){var o=Bi(r).hoistableScripts,u=jr(t),d=o.get(u);d||(d=r.querySelector(ll(u)),d||(t=S({src:t,async:!0,type:"module"},i),(i=Ri.get(u))&&kd(t,i),d=r.createElement("script"),vn(d),Gn(d,"link",t),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function H_(t,i,r,o){var u=(u=le.current)?Lc(u):null;if(!u)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(i=kr(r.href),r=Bi(u).hoistableStyles,o=r.get(i),o||(o={type:"style",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=kr(r.href);var d=Bi(u).hoistableStyles,b=d.get(t);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(t,b),(d=u.querySelector(ol(t)))&&!d._p&&(b.instance=d,b.state.loading=5),Ri.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Ri.set(t,r),d||kM(u,t,r,b.state))),i&&o===null)throw Error(s(528,""));return b}if(i&&o!==null)throw Error(s(529,""));return null;case"script":return i=r.async,r=r.src,typeof r=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=jr(r),r=Bi(u).hoistableScripts,o=r.get(i),o||(o={type:"script",instance:null,count:0,state:null},r.set(i,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function kr(t){return'href="'+Kt(t)+'"'}function ol(t){return'link[rel="stylesheet"]['+t+"]"}function G_(t){return S({},t,{"data-precedence":t.precedence,precedence:null})}function kM(t,i,r,o){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?o.loading=1:(i=t.createElement("link"),o.preload=i,i.addEventListener("load",function(){return o.loading|=1}),i.addEventListener("error",function(){return o.loading|=2}),Gn(i,"link",r),vn(i),t.head.appendChild(i))}function jr(t){return'[src="'+Kt(t)+'"]'}function ll(t){return"script[async]"+t}function V_(t,i,r){if(i.count++,i.instance===null)switch(i.type){case"style":var o=t.querySelector('style[data-href~="'+Kt(r.href)+'"]');if(o)return i.instance=o,vn(o),o;var u=S({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),vn(o),Gn(o,"style",u),Oc(o,r.precedence,t),i.instance=o;case"stylesheet":u=kr(r.href);var d=t.querySelector(ol(u));if(d)return i.state.loading|=4,i.instance=d,vn(d),d;o=G_(r),(u=Ri.get(u))&&Vd(o,u),d=(t.ownerDocument||t).createElement("link"),vn(d);var b=d;return b._p=new Promise(function(D,X){b.onload=D,b.onerror=X}),Gn(d,"link",o),i.state.loading|=4,Oc(d,r.precedence,t),i.instance=d;case"script":return d=jr(r.src),(u=t.querySelector(ll(d)))?(i.instance=u,vn(u),u):(o=r,(u=Ri.get(d))&&(o=S({},r),kd(o,u)),t=t.ownerDocument||t,u=t.createElement("script"),vn(u),Gn(u,"link",o),t.head.appendChild(u),i.instance=u);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(o=i.instance,i.state.loading|=4,Oc(o,r.precedence,t));return i.instance}function Oc(t,i,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,d=u,b=0;b title"):null)}function jM(t,i,r){if(r===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(t=i.disabled,typeof i.precedence=="string"&&t==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function X_(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function XM(t,i,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=kr(o.href),d=i.querySelector(ol(u));if(d){i=d._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Ic.bind(t),i.then(t,t)),r.state.loading|=4,r.instance=d,vn(d);return}d=i.ownerDocument||i,o=G_(o),(u=Ri.get(u))&&Vd(o,u),d=d.createElement("link"),vn(d);var b=d;b._p=new Promise(function(D,X){b.onload=D,b.onerror=X}),Gn(d,"link",o),r.instance=d}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Ic.bind(t),i.addEventListener("load",r),i.addEventListener("error",r))}}var jd=0;function WM(t,i){return t.stylesheets&&t.count===0&&Fc(t,t.stylesheets),0jd?50:800)+i);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function Ic(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bc=null;function Fc(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bc=new Map,i.forEach(qM,t),Bc=null,Ic.call(t))}function qM(t,i){if(!(i.state.loading&4)){var r=Bc.get(t);if(r)var o=r.get(null);else{r=new Map,Bc.set(t,r);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(e){console.error(e)}}return a(),Jd.exports=ub(),Jd.exports}var db=fb();const hb=Gx(db),pb="wrap",mb=24;function Vx(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}function gb(a,e){return a===void 0||e===void 0?!1:Array.isArray(a)||Array.isArray(e)?!Array.isArray(a)||!Array.isArray(e)?!1:JSON.stringify([...a].sort())===JSON.stringify([...e].sort()):a===e}function za(a,e){return e?(a.supported_classes??a.supportedClasses??[]).some(s=>s.dimensions===e.dimensions&&gb(s.states,e.states)&&_b(s,e)):!1}function _b(a,e){return!a.neighborhoodId||!e.neighborhoodId?!0:a.neighborhoodId===e.neighborhoodId}function sr(a){const e=a?.caClass;if(!Vx(e))return;const n=typeof e.dimensions=="number"?e.dimensions:void 0,s=e.states;if(!(!n||typeof s!="number"&&!Array.isArray(s)))return{neighborhoodId:typeof e.neighborhoodId=="string"?e.neighborhoodId:void 0,dimensions:n,states:s}}function kx(a,e,n=mb){const s=Vx(a)?a:{},l=Array.isArray(s.size)?s.size:[],c=typeof l[0]=="number"?l[0]:n,f=e>=2&&typeof l[1]=="number"?l[1]:1,p=e>=3&&typeof l[2]=="number"?l[2]:1;return[c,f,p]}function Hu(a){let e=2166136261;for(let n=0;n{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function vb(a){return a==="wrap"||a==="mirror"||a==="fixed"}function qp(a){return Il(a?.simulation?.grid)}function Il(a){return vb(a?.boundary)?a.boundary:a?.wrap===!1?"fixed":pb}function jx(a,e){return(a%e+e)%e}function xb(a,e){if(e<=1)return 0;const n=(e-1)*2,s=jx(a,n);return s<=e-1?s:n-s}function Va(a,e,n){return e<=0?null:n==="wrap"?jx(a,e):n==="mirror"?xb(a,e):a>=0&&a[...e])}function mv(a,e="cells"){const n=a[0]?.length??0;for(const s of a){if(s.length!==n)throw new Error(`${e} must be rectangular`);for(const l of s)if(typeof l!="boolean")throw new Error(`${e} must contain boolean cell states`)}}function yb(a,e,n="engine output"){if(mv(a,"input cells"),mv(e,n),e.length!==a.length||(e[0]?.length??0)!==(a[0]?.length??0))throw new Error(`${n} must preserve the input grid dimensions`)}function Sb(a){const e=/(?:rule[-_\s]*)?(\d{1,3})/i.exec(a??"");return e?Math.max(0,Math.min(255,Number(e[1]))):110}function Mb(a,e){const n=Sb(e.simulation?.ruleId),s=Xx(a),l=a[0]?.length??0;if(a.length===0||l===0)return s;const c=Il(e.simulation?.grid),f=Math.max(0,a.findIndex(m=>m.some(Boolean))),p=a[f]??[];for(let m=0;m>E&1)===1}return s}class Ru{position;forward;constructor(e,n){this.position=e,this.forward=n}}function Mu(a){return a===1||a===2||a===3||a===4||a===5||a===6}function bb(a,e){return[a[0]+e[0],a[1]+e[1],a[2]+e[2]]}function Eb(a,e){return[a[0]-e[0],a[1]-e[1],a[2]-e[2]]}function Wx(a,e){const n=Va(a[0],e.size[0],e.boundary),s=Va(a[1],e.size[1],e.boundary),l=Va(a[2],e.size[2],e.boundary);return n===null||s===null||l===null?null:[n,s,l]}function jh(a,e,n){return Wx(bb(a,e),n)}function ih(a,e,n){return Wx(Eb(a,e),n)}function qx(a){return(a+2)%6+1}function uo(a){return a===1?[1,0,0]:a===2?[0,1,0]:a===3?[0,0,1]:a===4?[-1,0,0]:a===5?[0,-1,0]:a===6?[0,0,-1]:null}function Wi(a){return`${a[0]}_${a[1]}_${a[2]}`}function Tb(a,e,n){const s=[];for(const l of a.values()){let c=0,f=0;if(l.forward!==null){for(let p=1;p<=6;p=p+1){const m=uo(p);if(!m)continue;const h=jh(l.position,m,n);if(!h)continue;const _=a.get(Wi(h));!_||_.forward===null||(_.forward===qx(p)&&(f+=1),p===l.forward&&(c+=1))}c<=1&&f===0&&s.push(l)}}return s}function Yx(a=100){return Hu(String(a))}function Ab(a,e,n,s=Yx()){const l=Tb(a,e,n);if(l.length===0)throw new Error("Cannot evolve, no heads");const c=l[Math.floor(s()*l.length)]??l[0];return Cb(a,c,e,n)}function Cb(a,e,n,s,l){let c=0,f=0,p=e,m=e,h=!0;const _=new Set;for(;h;){const x=Wi(p.position);if(_.has(x)){h=!1,m=p;break}if(_.add(x),p.forward===null)break;const P=uo(p.forward);if(!P)break;const L=jh(p.position,P,s);if(!L)break;const R=a.get(Wi(L));R&&Mu(R.forward)?(p=R,h=!0):(h=!1,m=p)}if(m.forward===null)return{changes:c,emits:f,comment:`T:${n} | Tail has no symbol to move.`};const S=uo(m.forward);if(!S)return{changes:c,emits:f,comment:`T:${n} | Tail symbol has no direction.`};const v=ih(e.position,S,s);if(!v)return{changes:c,emits:f,comment:`T:${n} | Tail would move outside fixed boundary.`};const M=Wi(v);a.has(M)||a.set(M,new Ru(v,null));const E=a.get(M);if(!E)throw new Error(`Unable to create naga place cell at ${M}`);if(e.forward===qx(m.forward)){let x=`T:${n} | Emission! ${E.position.join(",")} implied contradiction.`,P=!0;p=a.get(Wi(e.position))??e;const L=new Set;for(;P;){const A=Wi(p.position);if(L.has(A)||(L.add(A),p.forward===null))break;const N=uo(p.forward);if(!N)break;const k=jh(p.position,N,s);if(!k)break;const V=a.get(Wi(k));if(V&&Mu(V.forward)){p=V;const Q=ih(p.position,S,s);if(!Q){P=!1;break}const fe=a.get(Wi(Q));P=!!(fe&&Mu(fe.forward))}else P=!1}const R=ih(p.position,S,s);if(!R)return{changes:c,emits:f,comment:`T:${n} | Kink would move outside fixed boundary.`};const I=Wi(R);a.has(I)||a.set(I,new Ru(R,null));const O=a.get(I);if(!O)throw new Error(`Unable to create naga kink place cell at ${I}`);const U=O.forward;return O.forward=m.forward,m.forward=U,f+=1,c+=1,x+=` Kink at ${R.join(",")}, swapped ${O.forward} for ${U}.`,{changes:c,emits:f,comment:x}}const w=`T:${n} | Take tail symbol ${m.forward} from ${m.position.join(",")}, put into ${E.position.join(",")} in exchange for ${E.forward}`,y=E.forward;return E.forward=m.forward,m.forward=y,c+=1,{changes:c,emits:f,comment:w}}function wb(a,e){const n=a.simulation?.grid?.size,s=Array.isArray(n)&&typeof n[0]=="number"?n[0]:e[0]?.length??24,l=Array.isArray(n)&&typeof n[1]=="number"?n[1]:e.length||24,c=Array.isArray(n)&&typeof n[2]=="number"?n[2]:24;return[Math.max(1,s),Math.max(1,l),Math.max(1,c)]}function Rb(a){const e=a[3]??1;return Mu(e)?e:1}function Db(a){const e=new Map;for(const n of a??[]){const[s,l,c=0]=n;if(!Number.isInteger(s)||!Number.isInteger(l)||!Number.isInteger(c))continue;const f=[s,l,c];e.set(Wi(f),new Ru(f,Rb(n)))}return e}function Nb(a){const e=new Map;for(let n=0;n=e[0]||c>=e[1]||f>=e[2]||n.push([l,c,f,s.forward]))}return n}function Lb(a,e){const n=e.map(s=>s.map(()=>!1));for(const s of a){const[l,c]=s;!Number.isInteger(l)||!Number.isInteger(c)||c<0||l<0||c>=n.length||l>=(n[c]?.length??0)||(n[c][l]=!0)}return n}function Ob(a){return a.simulation??={},a.simulation.initialCondition??={},a.simulation}function Pb(a,e){const n=Ob(e),s=wb(e,a),l=n.initialCondition?.cells,c=Array.isArray(l)&&l.length>0?Db(l):Nb(a),f=typeof n.nagaTick=="number"?n.nagaTick:0,p=typeof n.seed=="string"?n.seed:"naga",m={boundary:Il(n.grid),size:s};try{Ab(c,f,m,Yx(`${p}:${f}`))}catch(_){if(!(_ instanceof Error)||_.message!=="Cannot evolve, no heads")throw _}const h=Ub(c,s);return n.initialCondition={...n.initialCondition,type:"cells",cells:h},n.nagaTick=f+1,Lb(h,a)}function Yp(a){return Xx(a)}function Zx(a){return a.map(e=>e.map(()=>!1))}function Ib(a){const e=/^B([0-8]*)\/S([0-8]*)$/i.exec(a);return e?{birth:new Set(e[1].split("").map(Number)),survival:new Set(e[2].split("").map(Number))}:{birth:new Set([3]),survival:new Set([2,3])}}function Kx(a,e){const n=Ib(e.simulation?.ruleId??"B3/S23"),s=Zx(a),l=a.length,c=a[0]?.length??0,f=Il(e.simulation?.grid);for(let p=0;p0&&Fb(p,h,m)l!==a);return s[Math.floor(n()*s.length)]??a}function ah(a,e,n){return`${a}_${e}_${n}`}function _v(a,e,n,s,l,c){return a>=0&&e>=0&&n>=0&&a=0;--e)if(a[e]>=65535)return!0;return!1}function Ou(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}function AE(){const a=Ou("canvas");return a.style.display="block",a}const Ev={};function Tv(...a){const e="THREE."+a.shift();console.log(e,...a)}function py(a){const e=a[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=a[1];n&&n.isStackTrace?a[0]+=" "+n.getLocation():a[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return a}function mt(...a){a=py(a);const e="THREE."+a.shift();{const n=a[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...a)}}function Vt(...a){a=py(a);const e="THREE."+a.shift();{const n=a[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...a)}}function po(...a){const e=a.join(" ");e in Ev||(Ev[e]=!0,mt(...a))}function CE(a,e,n){return new Promise(function(s,l){function c(){switch(a.clientWaitSync(e,a.SYNC_FLUSH_COMMANDS_BIT,0)){case a.WAIT_FAILED:l();break;case a.TIMEOUT_EXPIRED:setTimeout(c,n);break;default:s()}}setTimeout(c,n)})}const wE={[Zh]:Kh,[$h]:ep,[Qh]:tp,[vo]:Jh,[Kh]:Zh,[ep]:$h,[tp]:Qh,[Jh]:vo};class Ns{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(n)===-1&&s[e].push(n)}hasEventListener(e,n){const s=this._listeners;return s===void 0?!1:s[e]!==void 0&&s[e].indexOf(n)!==-1}removeEventListener(e,n){const s=this._listeners;if(s===void 0)return;const l=s[e];if(l!==void 0){const c=l.indexOf(n);c!==-1&&l.splice(c,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const s=n[e.type];if(s!==void 0){e.target=this;const l=s.slice(0);for(let c=0,f=l.length;c>8&255]+Wn[a>>16&255]+Wn[a>>24&255]+"-"+Wn[e&255]+Wn[e>>8&255]+"-"+Wn[e>>16&15|64]+Wn[e>>24&255]+"-"+Wn[n&63|128]+Wn[n>>8&255]+"-"+Wn[n>>16&255]+Wn[n>>24&255]+Wn[s&255]+Wn[s>>8&255]+Wn[s>>16&255]+Wn[s>>24&255]).toLowerCase()}function Ot(a,e,n){return Math.max(e,Math.min(n,a))}function RE(a,e){return(a%e+e)%e}function lh(a,e,n){return(1-n)*a+n*e}function ml(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return a/4294967295;case Uint16Array:return a/65535;case Uint8Array:return a/255;case Int32Array:return Math.max(a/2147483647,-1);case Int16Array:return Math.max(a/32767,-1);case Int8Array:return Math.max(a/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function ai(a,e){switch(e.constructor){case Float32Array:return a;case Uint32Array:return Math.round(a*4294967295);case Uint16Array:return Math.round(a*65535);case Uint8Array:return Math.round(a*255);case Int32Array:return Math.round(a*2147483647);case Int16Array:return Math.round(a*32767);case Int8Array:return Math.round(a*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const DE={DEG2RAD:Rl},Mm=class Mm{constructor(e=0,n=0){this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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){const n=this.x,s=this.y,l=e.elements;return this.x=l[0]*n+l[3]*s+l[6],this.y=l[1]*n+l[4]*s+l[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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(e)/n;return Math.acos(Ot(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,s=this.y-e.y;return n*n+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const s=Math.cos(n),l=Math.sin(n),c=this.x-e.x,f=this.y-e.y;return this.x=c*s-f*l+e.x,this.y=c*l+f*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Mm.prototype.isVector2=!0;let xt=Mm;class ws{constructor(e=0,n=0,s=0,l=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=s,this._w=l}static slerpFlat(e,n,s,l,c,f,p){let m=s[l+0],h=s[l+1],_=s[l+2],S=s[l+3],v=c[f+0],M=c[f+1],E=c[f+2],w=c[f+3];if(S!==w||m!==v||h!==M||_!==E){let y=m*v+h*M+_*E+S*w;y<0&&(v=-v,M=-M,E=-E,w=-w,y=-y);let x=1-p;if(y<.9995){const P=Math.acos(y),L=Math.sin(P);x=Math.sin(x*P)/L,p=Math.sin(p*P)/L,m=m*x+v*p,h=h*x+M*p,_=_*x+E*p,S=S*x+w*p}else{m=m*x+v*p,h=h*x+M*p,_=_*x+E*p,S=S*x+w*p;const P=1/Math.sqrt(m*m+h*h+_*_+S*S);m*=P,h*=P,_*=P,S*=P}}e[n]=m,e[n+1]=h,e[n+2]=_,e[n+3]=S}static multiplyQuaternionsFlat(e,n,s,l,c,f){const p=s[l],m=s[l+1],h=s[l+2],_=s[l+3],S=c[f],v=c[f+1],M=c[f+2],E=c[f+3];return e[n]=p*E+_*S+m*M-h*v,e[n+1]=m*E+_*v+h*S-p*M,e[n+2]=h*E+_*M+p*v-m*S,e[n+3]=_*E-p*S-m*v-h*M,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,n,s,l){return this._x=e,this._y=n,this._z=s,this._w=l,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,n=!0){const s=e._x,l=e._y,c=e._z,f=e._order,p=Math.cos,m=Math.sin,h=p(s/2),_=p(l/2),S=p(c/2),v=m(s/2),M=m(l/2),E=m(c/2);switch(f){case"XYZ":this._x=v*_*S+h*M*E,this._y=h*M*S-v*_*E,this._z=h*_*E+v*M*S,this._w=h*_*S-v*M*E;break;case"YXZ":this._x=v*_*S+h*M*E,this._y=h*M*S-v*_*E,this._z=h*_*E-v*M*S,this._w=h*_*S+v*M*E;break;case"ZXY":this._x=v*_*S-h*M*E,this._y=h*M*S+v*_*E,this._z=h*_*E+v*M*S,this._w=h*_*S-v*M*E;break;case"ZYX":this._x=v*_*S-h*M*E,this._y=h*M*S+v*_*E,this._z=h*_*E-v*M*S,this._w=h*_*S+v*M*E;break;case"YZX":this._x=v*_*S+h*M*E,this._y=h*M*S+v*_*E,this._z=h*_*E-v*M*S,this._w=h*_*S-v*M*E;break;case"XZY":this._x=v*_*S-h*M*E,this._y=h*M*S-v*_*E,this._z=h*_*E+v*M*S,this._w=h*_*S+v*M*E;break;default:mt("Quaternion: .setFromEuler() encountered an unknown order: "+f)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const s=n/2,l=Math.sin(s);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,s=n[0],l=n[4],c=n[8],f=n[1],p=n[5],m=n[9],h=n[2],_=n[6],S=n[10],v=s+p+S;if(v>0){const M=.5/Math.sqrt(v+1);this._w=.25/M,this._x=(_-m)*M,this._y=(c-h)*M,this._z=(f-l)*M}else if(s>p&&s>S){const M=2*Math.sqrt(1+s-p-S);this._w=(_-m)/M,this._x=.25*M,this._y=(l+f)/M,this._z=(c+h)/M}else if(p>S){const M=2*Math.sqrt(1+p-s-S);this._w=(c-h)/M,this._x=(l+f)/M,this._y=.25*M,this._z=(m+_)/M}else{const M=2*Math.sqrt(1+S-s-p);this._w=(f-l)/M,this._x=(c+h)/M,this._y=(m+_)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let s=e.dot(n)+1;return s<1e-8?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ot(this.dot(e),-1,1)))}rotateTowards(e,n){const s=this.angleTo(e);if(s===0)return this;const l=Math.min(1,n/s);return this.slerp(e,l),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();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const s=e._x,l=e._y,c=e._z,f=e._w,p=n._x,m=n._y,h=n._z,_=n._w;return this._x=s*_+f*p+l*h-c*m,this._y=l*_+f*m+c*p-s*h,this._z=c*_+f*h+s*m-l*p,this._w=f*_-s*p-l*m-c*h,this._onChangeCallback(),this}slerp(e,n){let s=e._x,l=e._y,c=e._z,f=e._w,p=this.dot(e);p<0&&(s=-s,l=-l,c=-c,f=-f,p=-p);let m=1-n;if(p<.9995){const h=Math.acos(p),_=Math.sin(h);m=Math.sin(m*h)/_,n=Math.sin(n*h)/_,this._x=this._x*m+s*n,this._y=this._y*m+l*n,this._z=this._z*m+c*n,this._w=this._w*m+f*n,this._onChangeCallback()}else this._x=this._x*m+s*n,this._y=this._y*m+l*n,this._z=this._z*m+c*n,this._w=this._w*m+f*n,this.normalize();return this}slerpQuaternions(e,n,s){return this.copy(e).slerp(n,s)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),s=Math.random(),l=Math.sqrt(1-s),c=Math.sqrt(s);return this.set(l*Math.sin(e),l*Math.cos(e),c*Math.sin(n),c*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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}}const bm=class bm{constructor(e=0,n=0,s=0){this.x=e,this.y=n,this.z=s}set(e,n,s){return s===void 0&&(s=this.z),this.x=e,this.y=n,this.z=s,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Av.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Av.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*n+c[3]*s+c[6]*l,this.y=c[1]*n+c[4]*s+c[7]*l,this.z=c[2]*n+c[5]*s+c[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,s=this.y,l=this.z,c=e.elements,f=1/(c[3]*n+c[7]*s+c[11]*l+c[15]);return this.x=(c[0]*n+c[4]*s+c[8]*l+c[12])*f,this.y=(c[1]*n+c[5]*s+c[9]*l+c[13])*f,this.z=(c[2]*n+c[6]*s+c[10]*l+c[14])*f,this}applyQuaternion(e){const n=this.x,s=this.y,l=this.z,c=e.x,f=e.y,p=e.z,m=e.w,h=2*(f*l-p*s),_=2*(p*n-c*l),S=2*(c*s-f*n);return this.x=n+m*h+f*S-p*_,this.y=s+m*_+p*h-c*S,this.z=l+m*S+c*_-f*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,s=this.y,l=this.z,c=e.elements;return this.x=c[0]*n+c[4]*s+c[8]*l,this.y=c[1]*n+c[5]*s+c[9]*l,this.z=c[2]*n+c[6]*s+c[10]*l,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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this.z=Ot(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this.z=Ot(this.z,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this.z=e.z+(n.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const s=e.x,l=e.y,c=e.z,f=n.x,p=n.y,m=n.z;return this.x=l*m-c*p,this.y=c*f-s*m,this.z=s*p-l*f,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const s=e.dot(this)/n;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return ch.copy(this).projectOnVector(e),this.sub(ch)}reflect(e){return this.sub(ch.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const s=this.dot(e)/n;return Math.acos(Ot(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,s=this.y-e.y,l=this.z-e.z;return n*n+s*s+l*l}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,n,s){const l=Math.sin(n)*e;return this.x=l*Math.sin(s),this.y=Math.cos(n)*e,this.z=l*Math.cos(s),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,s){return this.x=e*Math.sin(n),this.y=s,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),l=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=s,this.z=l,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,s=Math.sqrt(1-n*n);return this.x=s*Math.cos(e),this.y=n,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};bm.prototype.isVector3=!0;let re=bm;const ch=new re,Av=new ws,Em=class Em{constructor(e,n,s,l,c,f,p,m,h){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,s,l,c,f,p,m,h)}set(e,n,s,l,c,f,p,m,h){const _=this.elements;return _[0]=e,_[1]=l,_[2]=p,_[3]=n,_[4]=c,_[5]=m,_[6]=s,_[7]=f,_[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,s=e.elements;return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],this}extractBasis(e,n,s){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const s=e.elements,l=n.elements,c=this.elements,f=s[0],p=s[3],m=s[6],h=s[1],_=s[4],S=s[7],v=s[2],M=s[5],E=s[8],w=l[0],y=l[3],x=l[6],P=l[1],L=l[4],R=l[7],I=l[2],O=l[5],U=l[8];return c[0]=f*w+p*P+m*I,c[3]=f*y+p*L+m*O,c[6]=f*x+p*R+m*U,c[1]=h*w+_*P+S*I,c[4]=h*y+_*L+S*O,c[7]=h*x+_*R+S*U,c[2]=v*w+M*P+E*I,c[5]=v*y+M*L+E*O,c[8]=v*x+M*R+E*U,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],s=e[1],l=e[2],c=e[3],f=e[4],p=e[5],m=e[6],h=e[7],_=e[8];return n*f*_-n*p*h-s*c*_+s*p*m+l*c*h-l*f*m}invert(){const e=this.elements,n=e[0],s=e[1],l=e[2],c=e[3],f=e[4],p=e[5],m=e[6],h=e[7],_=e[8],S=_*f-p*h,v=p*m-_*c,M=h*c-f*m,E=n*S+s*v+l*M;if(E===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/E;return e[0]=S*w,e[1]=(l*h-_*s)*w,e[2]=(p*s-l*f)*w,e[3]=v*w,e[4]=(_*n-l*m)*w,e[5]=(l*c-p*n)*w,e[6]=M*w,e[7]=(s*m-h*n)*w,e[8]=(f*n-s*c)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,s,l,c,f,p){const m=Math.cos(c),h=Math.sin(c);return this.set(s*m,s*h,-s*(m*f+h*p)+f+e,-l*h,l*m,-l*(-h*f+m*p)+p+n,0,0,1),this}scale(e,n){return po("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(uh.makeScale(e,n)),this}rotate(e){return po("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(uh.makeRotation(-e)),this}translate(e,n){return po("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(uh.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),s=Math.sin(e);return this.set(n,-s,0,s,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,s=e.elements;for(let l=0;l<9;l++)if(n[l]!==s[l])return!1;return!0}fromArray(e,n=0){for(let s=0;s<9;s++)this.elements[s]=e[s+n];return this}toArray(e=[],n=0){const s=this.elements;return e[n]=s[0],e[n+1]=s[1],e[n+2]=s[2],e[n+3]=s[3],e[n+4]=s[4],e[n+5]=s[5],e[n+6]=s[6],e[n+7]=s[7],e[n+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Em.prototype.isMatrix3=!0;let bt=Em;const uh=new bt,Cv=new bt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wv=new bt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function NE(){const a={enabled:!0,workingColorSpace:Uu,spaces:{},convert:function(l,c,f){return this.enabled===!1||c===f||!c||!f||(this.spaces[c].transfer===en&&(l.r=ja(l.r),l.g=ja(l.g),l.b=ja(l.b)),this.spaces[c].primaries!==this.spaces[f].primaries&&(l.applyMatrix3(this.spaces[c].toXYZ),l.applyMatrix3(this.spaces[f].fromXYZ)),this.spaces[f].transfer===en&&(l.r=mo(l.r),l.g=mo(l.g),l.b=mo(l.b))),l},workingToColorSpace:function(l,c){return this.convert(l,this.workingColorSpace,c)},colorSpaceToWorking:function(l,c){return this.convert(l,c,this.workingColorSpace)},getPrimaries:function(l){return this.spaces[l].primaries},getTransfer:function(l){return l===Ts?Lu:this.spaces[l].transfer},getToneMappingMode:function(l){return this.spaces[l].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(l,c=this.workingColorSpace){return l.fromArray(this.spaces[c].luminanceCoefficients)},define:function(l){Object.assign(this.spaces,l)},_getMatrix:function(l,c,f){return l.copy(this.spaces[c].toXYZ).multiply(this.spaces[f].fromXYZ)},_getDrawingBufferColorSpace:function(l){return this.spaces[l].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(l=this.workingColorSpace){return this.spaces[l].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(l,c){return po("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),a.workingToColorSpace(l,c)},toWorkingColorSpace:function(l,c){return po("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),a.colorSpaceToWorking(l,c)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],s=[.3127,.329];return a.define({[Uu]:{primaries:e,whitePoint:s,transfer:Lu,toXYZ:Cv,fromXYZ:wv,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:yi},outputColorSpaceConfig:{drawingBufferColorSpace:yi}},[yi]:{primaries:e,whitePoint:s,transfer:en,toXYZ:Cv,fromXYZ:wv,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:yi}}}),a}const Gt=NE();function ja(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function mo(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}let qr;class UE{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let s;if(e instanceof HTMLCanvasElement)s=e;else{qr===void 0&&(qr=Ou("canvas")),qr.width=e.width,qr.height=e.height;const l=qr.getContext("2d");e instanceof ImageData?l.putImageData(e,0,0):l.drawImage(e,0,0,e.width,e.height),s=qr}return s.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Ou("canvas");n.width=e.width,n.height=e.height;const s=n.getContext("2d");s.drawImage(e,0,0,e.width,e.height);const l=s.getImageData(0,0,e.width,e.height),c=l.data;for(let f=0;f1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(dh).x}get height(){return this.source.getSize(dh).y}get depth(){return this.source.getSize(dh).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,n){this.updateRanges.push({start:e,count:n})}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.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const s=e[n];if(s===void 0){mt(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const l=this[n];if(l===void 0){mt(`Texture.setValues(): property '${n}' does not exist.`);continue}l&&s&&l.isVector2&&s.isVector2||l&&s&&l.isVector3&&s.isVector3||l&&s&&l.isMatrix3&&s.isMatrix3?l.copy(s):this[n]=s}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const s={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,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),n||(e.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ry)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case np:e.x=e.x-Math.floor(e.x);break;case Ga:e.x=e.x<0?0:1;break;case ip:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case np:e.y=e.y-Math.floor(e.y);break;case Ga:e.y=e.y<0?0:1;break;case ip:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}$n.DEFAULT_IMAGE=null;$n.DEFAULT_MAPPING=ry;$n.DEFAULT_ANISOTROPY=1;const Tm=class Tm{constructor(e=0,n=0,s=0,l=1){this.x=e,this.y=n,this.z=s,this.w=l}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,s,l){return this.x=e,this.y=n,this.z=s,this.w=l,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new 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 new 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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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){const n=this.x,s=this.y,l=this.z,c=this.w,f=e.elements;return this.x=f[0]*n+f[4]*s+f[8]*l+f[12]*c,this.y=f[1]*n+f[5]*s+f[9]*l+f[13]*c,this.z=f[2]*n+f[6]*s+f[10]*l+f[14]*c,this.w=f[3]*n+f[7]*s+f[11]*l+f[15]*c,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);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,s,l,c;const m=e.elements,h=m[0],_=m[4],S=m[8],v=m[1],M=m[5],E=m[9],w=m[2],y=m[6],x=m[10];if(Math.abs(_-v)<.01&&Math.abs(S-w)<.01&&Math.abs(E-y)<.01){if(Math.abs(_+v)<.1&&Math.abs(S+w)<.1&&Math.abs(E+y)<.1&&Math.abs(h+M+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const L=(h+1)/2,R=(M+1)/2,I=(x+1)/2,O=(_+v)/4,U=(S+w)/4,A=(E+y)/4;return L>R&&L>I?L<.01?(s=0,l=.707106781,c=.707106781):(s=Math.sqrt(L),l=O/s,c=U/s):R>I?R<.01?(s=.707106781,l=0,c=.707106781):(l=Math.sqrt(R),s=O/l,c=A/l):I<.01?(s=.707106781,l=.707106781,c=0):(c=Math.sqrt(I),s=U/c,l=A/c),this.set(s,l,c,n),this}let P=Math.sqrt((y-E)*(y-E)+(S-w)*(S-w)+(v-_)*(v-_));return Math.abs(P)<.001&&(P=1),this.x=(y-E)/P,this.y=(S-w)/P,this.z=(v-_)/P,this.w=Math.acos((h+M+x-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[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,n){return this.x=Ot(this.x,e.x,n.x),this.y=Ot(this.y,e.y,n.y),this.z=Ot(this.z,e.z,n.z),this.w=Ot(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Ot(this.x,e,n),this.y=Ot(this.y,e,n),this.z=Ot(this.z,e,n),this.w=Ot(this.w,e,n),this}clampLength(e,n){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ot(s,e,n))}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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,s){return this.x=e.x+(n.x-e.x)*s,this.y=e.y+(n.y-e.y)*s,this.z=e.z+(n.z-e.z)*s,this.w=e.w+(n.w-e.w)*s,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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}};Tm.prototype.isVector4=!0;let gn=Tm;class PE extends Ns{constructor(e=1,n=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Yn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},s),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=s.depth,this.scissor=new gn(0,0,e,n),this.scissorTest=!1,this.viewport=new gn(0,0,e,n),this.textures=[];const l={width:e,height:n,depth:s.depth},c=new $n(l),f=s.count;for(let p=0;p1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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 n=0,s=e.textures.length;n>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let s=0;s0&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),l.up=this.up.toArray(),this.pivot!==null&&(l.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(l.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(l.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(l.type="BatchedMesh",l.perObjectFrustumCulled=this.perObjectFrustumCulled,l.sortObjects=this.sortObjects,l.drawRanges=this._drawRanges,l.reservedRanges=this._reservedRanges,l.geometryInfo=this._geometryInfo.map(p=>({...p,boundingBox:p.boundingBox?p.boundingBox.toJSON():void 0,boundingSphere:p.boundingSphere?p.boundingSphere.toJSON():void 0})),l.instanceInfo=this._instanceInfo.map(p=>({...p})),l.availableInstanceIds=this._availableInstanceIds.slice(),l.availableGeometryIds=this._availableGeometryIds.slice(),l.nextIndexStart=this._nextIndexStart,l.nextVertexStart=this._nextVertexStart,l.geometryCount=this._geometryCount,l.maxInstanceCount=this._maxInstanceCount,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.matricesTexture=this._matricesTexture.toJSON(e),l.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(l.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(l.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(l.boundingBox=this.boundingBox.toJSON()));function c(p,m){return p[m.uuid]===void 0&&(p[m.uuid]=m.toJSON(e)),m.uuid}if(this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(l.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=c(e.geometries,this.geometry);const p=this.geometry.parameters;if(p!==void 0&&p.shapes!==void 0){const m=p.shapes;if(Array.isArray(m))for(let h=0,_=m.length;h<_;h++){const S=m[h];c(e.shapes,S)}else c(e.shapes,m)}}if(this.isSkinnedMesh&&(l.bindMode=this.bindMode,l.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(e.skeletons,this.skeleton),l.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const p=[];for(let m=0,h=this.material.length;m0){l.children=[];for(let p=0;p0){l.animations=[];for(let p=0;p0&&(s.geometries=p),m.length>0&&(s.materials=m),h.length>0&&(s.textures=h),_.length>0&&(s.images=_),S.length>0&&(s.shapes=S),v.length>0&&(s.skeletons=v),M.length>0&&(s.animations=M),E.length>0&&(s.nodes=E)}return s.object=l,s;function f(p){const m=[];for(const h in p){const _=p[h];delete _.metadata,m.push(_)}return m}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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)),n===!0)for(let s=0;sM+E?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&v<=M-E&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else m!==null&&e.gripSpace&&(c=n.getPose(e.gripSpace,s),c!==null&&(m.matrix.fromArray(c.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,c.linearVelocity?(m.hasLinearVelocity=!0,m.linearVelocity.copy(c.linearVelocity)):m.hasLinearVelocity=!1,c.angularVelocity?(m.hasAngularVelocity=!0,m.angularVelocity.copy(c.angularVelocity)):m.hasAngularVelocity=!1,m.eventsEnabled&&m.dispatchEvent({type:"gripUpdated",data:e,target:this})));p!==null&&(l=n.getPose(e.targetRaySpace,s),l===null&&c!==null&&(l=c),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1,this.dispatchEvent(kE)))}return p!==null&&(p.visible=l!==null),m!==null&&(m.visible=c!==null),h!==null&&(h.visible=f!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const s=new Zc;s.matrixAutoUpdate=!1,s.visible=!1,e.joints[n.jointName]=s,e.add(s)}return e.joints[n.jointName]}}const _y={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},xs={h:0,s:0,l:0},Kc={h:0,s:0,l:0};function mh(a,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?a+(e-a)*6*n:n<1/2?e:n<2/3?a+(e-a)*6*(2/3-n):a}class ot{constructor(e,n,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,s)}set(e,n,s){if(n===void 0&&s===void 0){const l=e;l&&l.isColor?this.copy(l):typeof l=="number"?this.setHex(l):typeof l=="string"&&this.setStyle(l)}else this.setRGB(e,n,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=yi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.colorSpaceToWorking(this,n),this}setRGB(e,n,s,l=Gt.workingColorSpace){return this.r=e,this.g=n,this.b=s,Gt.colorSpaceToWorking(this,l),this}setHSL(e,n,s,l=Gt.workingColorSpace){if(e=RE(e,1),n=Ot(n,0,1),s=Ot(s,0,1),n===0)this.r=this.g=this.b=s;else{const c=s<=.5?s*(1+n):s+n-s*n,f=2*s-c;this.r=mh(f,c,e+1/3),this.g=mh(f,c,e),this.b=mh(f,c,e-1/3)}return Gt.colorSpaceToWorking(this,l),this}setStyle(e,n=yi){function s(c){c!==void 0&&parseFloat(c)<1&&mt("Color: Alpha component of "+e+" will be ignored.")}let l;if(l=/^(\w+)\(([^\)]*)\)/.exec(e)){let c;const f=l[1],p=l[2];switch(f){case"rgb":case"rgba":if(c=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,n);if(c=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,n);break;case"hsl":case"hsla":if(c=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(p))return s(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,n);break;default:mt("Color: Unknown color model "+e)}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(e)){const c=l[1],f=c.length;if(f===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,n);if(f===6)return this.setHex(parseInt(c,16),n);mt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=yi){const s=_y[e.toLowerCase()];return s!==void 0?this.setHex(s,n):mt("Color: Unknown color "+e),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=ja(e.r),this.g=ja(e.g),this.b=ja(e.b),this}copyLinearToSRGB(e){return this.r=mo(e.r),this.g=mo(e.g),this.b=mo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yi){return Gt.workingToColorSpace(qn.copy(this),e),Math.round(Ot(qn.r*255,0,255))*65536+Math.round(Ot(qn.g*255,0,255))*256+Math.round(Ot(qn.b*255,0,255))}getHexString(e=yi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Gt.workingColorSpace){Gt.workingToColorSpace(qn.copy(this),n);const s=qn.r,l=qn.g,c=qn.b,f=Math.max(s,l,c),p=Math.min(s,l,c);let m,h;const _=(p+f)/2;if(p===f)m=0,h=0;else{const S=f-p;switch(h=_<=.5?S/(f+p):S/(2-f-p),f){case s:m=(l-c)/S+(l0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const ji=new re,Pa=new re,gh=new re,Ia=new re,$r=new re,Qr=new re,Iv=new re,_h=new re,vh=new re,xh=new re,yh=new gn,Sh=new gn,Mh=new gn;class Oi{constructor(e=new re,n=new re,s=new re){this.a=e,this.b=n,this.c=s}static getNormal(e,n,s,l){l.subVectors(s,n),ji.subVectors(e,n),l.cross(ji);const c=l.lengthSq();return c>0?l.multiplyScalar(1/Math.sqrt(c)):l.set(0,0,0)}static getBarycoord(e,n,s,l,c){ji.subVectors(l,n),Pa.subVectors(s,n),gh.subVectors(e,n);const f=ji.dot(ji),p=ji.dot(Pa),m=ji.dot(gh),h=Pa.dot(Pa),_=Pa.dot(gh),S=f*h-p*p;if(S===0)return c.set(0,0,0),null;const v=1/S,M=(h*m-p*_)*v,E=(f*_-p*m)*v;return c.set(1-M-E,E,M)}static containsPoint(e,n,s,l){return this.getBarycoord(e,n,s,l,Ia)===null?!1:Ia.x>=0&&Ia.y>=0&&Ia.x+Ia.y<=1}static getInterpolation(e,n,s,l,c,f,p,m){return this.getBarycoord(e,n,s,l,Ia)===null?(m.x=0,m.y=0,"z"in m&&(m.z=0),"w"in m&&(m.w=0),null):(m.setScalar(0),m.addScaledVector(c,Ia.x),m.addScaledVector(f,Ia.y),m.addScaledVector(p,Ia.z),m)}static getInterpolatedAttribute(e,n,s,l,c,f){return yh.setScalar(0),Sh.setScalar(0),Mh.setScalar(0),yh.fromBufferAttribute(e,n),Sh.fromBufferAttribute(e,s),Mh.fromBufferAttribute(e,l),f.setScalar(0),f.addScaledVector(yh,c.x),f.addScaledVector(Sh,c.y),f.addScaledVector(Mh,c.z),f}static isFrontFacing(e,n,s,l){return ji.subVectors(s,n),Pa.subVectors(e,n),ji.cross(Pa).dot(l)<0}set(e,n,s){return this.a.copy(e),this.b.copy(n),this.c.copy(s),this}setFromPointsAndIndices(e,n,s,l){return this.a.copy(e[n]),this.b.copy(e[s]),this.c.copy(e[l]),this}setFromAttributeAndIndices(e,n,s,l){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,s),this.c.fromBufferAttribute(e,l),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 ji.subVectors(this.c,this.b),Pa.subVectors(this.a,this.b),ji.cross(Pa).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Oi.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,s,l,c){return Oi.getInterpolation(e,this.a,this.b,this.c,n,s,l,c)}containsPoint(e){return Oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const s=this.a,l=this.b,c=this.c;let f,p;$r.subVectors(l,s),Qr.subVectors(c,s),_h.subVectors(e,s);const m=$r.dot(_h),h=Qr.dot(_h);if(m<=0&&h<=0)return n.copy(s);vh.subVectors(e,l);const _=$r.dot(vh),S=Qr.dot(vh);if(_>=0&&S<=_)return n.copy(l);const v=m*S-_*h;if(v<=0&&m>=0&&_<=0)return f=m/(m-_),n.copy(s).addScaledVector($r,f);xh.subVectors(e,c);const M=$r.dot(xh),E=Qr.dot(xh);if(E>=0&&M<=E)return n.copy(c);const w=M*h-m*E;if(w<=0&&h>=0&&E<=0)return p=h/(h-E),n.copy(s).addScaledVector(Qr,p);const y=_*E-M*S;if(y<=0&&S-_>=0&&M-E>=0)return Iv.subVectors(c,l),p=(S-_)/(S-_+(M-E)),n.copy(l).addScaledVector(Iv,p);const x=1/(y+w+v);return f=w*x,p=v*x,n.copy(s).addScaledVector($r,f).addScaledVector(Qr,p)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class dr{constructor(e=new re(1/0,1/0,1/0),n=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,s=e.length;n=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,n){return n.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,Xi),Xi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,s;return e.normal.x>0?(n=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),n<=-e.constant&&s>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_l),Qc.subVectors(this.max,_l),Jr.subVectors(e.a,_l),eo.subVectors(e.b,_l),to.subVectors(e.c,_l),ys.subVectors(eo,Jr),Ss.subVectors(to,eo),Ks.subVectors(Jr,to);let n=[0,-ys.z,ys.y,0,-Ss.z,Ss.y,0,-Ks.z,Ks.y,ys.z,0,-ys.x,Ss.z,0,-Ss.x,Ks.z,0,-Ks.x,-ys.y,ys.x,0,-Ss.y,Ss.x,0,-Ks.y,Ks.x,0];return!bh(n,Jr,eo,to,Qc)||(n=[1,0,0,0,1,0,0,0,1],!bh(n,Jr,eo,to,Qc))?!1:(Jc.crossVectors(ys,Ss),n=[Jc.x,Jc.y,Jc.z],bh(n,Jr,eo,to,Qc))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ba[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ba[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ba[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ba[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ba[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ba[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ba[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ba[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ba),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}}const Ba=[new re,new re,new re,new re,new re,new re,new re,new re],Xi=new re,$c=new dr,Jr=new re,eo=new re,to=new re,ys=new re,Ss=new re,Ks=new re,_l=new re,Qc=new re,Jc=new re,$s=new re;function bh(a,e,n,s,l){for(let c=0,f=a.length-3;c<=f;c+=3){$s.fromArray(a,c);const p=l.x*Math.abs($s.x)+l.y*Math.abs($s.y)+l.z*Math.abs($s.z),m=e.dot($s),h=n.dot($s),_=s.dot($s);if(Math.max(-Math.max(m,h,_),Math.min(m,h,_))>p)return!1}return!0}const Cn=new re,eu=new xt;let XE=0;class Zi extends Ns{constructor(e,n,s=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:XE++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=s,this.usage=Mv,this.updateRanges=[],this.gpuType=qi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}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}copyAt(e,n,s){e*=this.itemSize,s*=n.itemSize;for(let l=0,c=this.itemSize;lthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(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;vl.subVectors(e,this.center);const n=vl.lengthSq();if(n>this.radius*this.radius){const s=Math.sqrt(n),l=(s-this.radius)*.5;this.center.addScaledVector(vl,l/s),this.radius+=l}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Eh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(vl.copy(e.center).add(Eh)),this.expandByPoint(vl.copy(e.center).sub(Eh))),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}}let qE=0;const Di=new cn,Th=new Nn,no=new re,xi=new dr,xl=new dr,Pn=new re;class Pi extends Ns{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:qE++}),this.uuid=Bl(),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){return Array.isArray(e)?this.index=new(TE(e)?xy:vy)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,s=0){this.groups.push({start:e,count:n,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const s=this.attributes.normal;if(s!==void 0){const c=new bt().getNormalMatrix(e);s.applyNormalMatrix(c),s.needsUpdate=!0}const l=this.attributes.tangent;return l!==void 0&&(l.transformDirection(e),l.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Di.makeRotationFromQuaternion(e),this.applyMatrix4(Di),this}rotateX(e){return Di.makeRotationX(e),this.applyMatrix4(Di),this}rotateY(e){return Di.makeRotationY(e),this.applyMatrix4(Di),this}rotateZ(e){return Di.makeRotationZ(e),this.applyMatrix4(Di),this}translate(e,n,s){return Di.makeTranslation(e,n,s),this.applyMatrix4(Di),this}scale(e,n,s){return Di.makeScale(e,n,s),this.applyMatrix4(Di),this}lookAt(e){return Th.lookAt(e),Th.updateMatrix(),this.applyMatrix4(Th.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(no).negate(),this.translate(no.x,no.y,no.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const s=[];for(let l=0,c=e.length;ln.count&&mt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new dr);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let s=0,l=n.length;s0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const m=this.parameters;for(const h in m)m[h]!==void 0&&(e[h]=m[h]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const s=this.attributes;for(const m in s){const h=s[m];e.data.attributes[m]=h.toJSON(e.data)}const l={};let c=!1;for(const m in this.morphAttributes){const h=this.morphAttributes[m],_=[];for(let S=0,v=h.length;S0&&(l[m]=_,c=!0)}c&&(e.data.morphAttributes=l,e.data.morphTargetsRelative=this.morphTargetsRelative);const f=this.groups;f.length>0&&(e.data.groups=JSON.parse(JSON.stringify(f)));const p=this.boundingSphere;return p!==null&&(e.data.boundingSphere=p.toJSON()),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;const n={};this.name=e.name;const s=e.index;s!==null&&this.setIndex(s.clone());const l=e.attributes;for(const h in l){const _=l[h];this.setAttribute(h,_.clone(n))}const c=e.morphAttributes;for(const h in c){const _=[],S=c[h];for(let v=0,M=S.length;v0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const s=e[n];if(s===void 0){mt(`Material: parameter '${n}' has value of undefined.`);continue}const l=this[n];if(l===void 0){mt(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}l&&l.isColor?l.set(s):l&&l.isVector2&&s&&s.isVector2||l&&l.isEuler&&s&&s.isEuler||l&&l.isVector3&&s&&s.isVector3?l.copy(s):this[n]=s}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),this.roughness!==void 0&&(s.roughness=this.roughness),this.metalness!==void 0&&(s.metalness=this.metalness),this.sheen!==void 0&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(s.shininess=this.shininess),this.clearcoat!==void 0&&(s.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(s.dispersion=this.dispersion),this.iridescence!==void 0&&(s.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(s.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(s.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(e).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(e).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(e).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(e).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(e).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(s.combine=this.combine)),this.envMapRotation!==void 0&&(s.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(s.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(s.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(s.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(s.size=this.size),this.shadowSide!==null&&(s.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==ho&&(s.blending=this.blending),this.side!==Cs&&(s.side=this.side),this.vertexColors===!0&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),this.transparent===!0&&(s.transparent=!0),this.blendSrc!==qh&&(s.blendSrc=this.blendSrc),this.blendDst!==Yh&&(s.blendDst=this.blendDst),this.blendEquation!==er&&(s.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(s.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(s.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==vo&&(s.depthFunc=this.depthFunc),this.depthTest===!1&&(s.depthTest=this.depthTest),this.depthWrite===!1&&(s.depthWrite=this.depthWrite),this.colorWrite===!1&&(s.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Sv&&(s.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(s.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Wr&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Wr&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Wr&&(s.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(s.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(s.rotation=this.rotation),this.polygonOffset===!0&&(s.polygonOffset=!0),this.polygonOffsetFactor!==0&&(s.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(s.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(s.linewidth=this.linewidth),this.dashSize!==void 0&&(s.dashSize=this.dashSize),this.gapSize!==void 0&&(s.gapSize=this.gapSize),this.scale!==void 0&&(s.scale=this.scale),this.dithering===!0&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),this.alphaHash===!0&&(s.alphaHash=!0),this.alphaToCoverage===!0&&(s.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(s.premultipliedAlpha=!0),this.forceSinglePass===!0&&(s.forceSinglePass=!0),this.allowOverride===!1&&(s.allowOverride=!1),this.wireframe===!0&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(s.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(s.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(s.flatShading=!0),this.visible===!1&&(s.visible=!1),this.toneMapped===!1&&(s.toneMapped=!1),this.fog===!1&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData);function l(c){const f=[];for(const p in c){const m=c[p];delete m.metadata,f.push(m)}return f}if(n){const c=l(e.textures),f=l(e.images);c.length>0&&(s.textures=c),f.length>0&&(s.images=f)}return s}fromJSON(e,n){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new ot().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=n[e.map]||null),e.matcap!==void 0&&(this.matcap=n[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=n[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=n[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=n[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),this.normalScale=new xt().fromArray(s)}return e.displacementMap!==void 0&&(this.displacementMap=n[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=n[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=n[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=n[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=n[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=n[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=n[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=n[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=n[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=n[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=n[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=n[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=n[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=n[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new xt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=n[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=n[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=n[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=n[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=n[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=n[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=n[e.sheenRoughnessMap]||null),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;const n=e.clippingPlanes;let s=null;if(n!==null){const l=n.length;s=new Array(l);for(let c=0;c!==l;++c)s[c]=n[c].clone()}return this.clippingPlanes=s,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){e===!0&&this.version++}}const Fa=new re,Ah=new re,tu=new re,Ms=new re,Ch=new re,nu=new re,wh=new re;class om{constructor(e=new re,n=new re(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,Fa)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const s=n.dot(this.direction);return s<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Fa.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Fa.copy(this.origin).addScaledVector(this.direction,n),Fa.distanceToSquared(e))}distanceSqToSegment(e,n,s,l){Ah.copy(e).add(n).multiplyScalar(.5),tu.copy(n).sub(e).normalize(),Ms.copy(this.origin).sub(Ah);const c=e.distanceTo(n)*.5,f=-this.direction.dot(tu),p=Ms.dot(this.direction),m=-Ms.dot(tu),h=Ms.lengthSq(),_=Math.abs(1-f*f);let S,v,M,E;if(_>0)if(S=f*m-p,v=f*p-m,E=c*_,S>=0)if(v>=-E)if(v<=E){const w=1/_;S*=w,v*=w,M=S*(S+f*v+2*p)+v*(f*S+v+2*m)+h}else v=c,S=Math.max(0,-(f*v+p)),M=-S*S+v*(v+2*m)+h;else v=-c,S=Math.max(0,-(f*v+p)),M=-S*S+v*(v+2*m)+h;else v<=-E?(S=Math.max(0,-(-f*c+p)),v=S>0?-c:Math.min(Math.max(-c,-m),c),M=-S*S+v*(v+2*m)+h):v<=E?(S=0,v=Math.min(Math.max(-c,-m),c),M=v*(v+2*m)+h):(S=Math.max(0,-(f*c+p)),v=S>0?c:Math.min(Math.max(-c,-m),c),M=-S*S+v*(v+2*m)+h);else v=f>0?-c:c,S=Math.max(0,-(f*v+p)),M=-S*S+v*(v+2*m)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,S),l&&l.copy(Ah).addScaledVector(tu,v),M}intersectSphere(e,n){Fa.subVectors(e.center,this.origin);const s=Fa.dot(this.direction),l=Fa.dot(Fa)-s*s,c=e.radius*e.radius;if(l>c)return null;const f=Math.sqrt(c-l),p=s-f,m=s+f;return m<0?null:p<0?this.at(m,n):this.at(p,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const s=-(this.origin.dot(e.normal)+e.constant)/n;return s>=0?s:null}intersectPlane(e,n){const s=this.distanceToPlane(e);return s===null?null:this.at(s,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let s,l,c,f,p,m;const h=1/this.direction.x,_=1/this.direction.y,S=1/this.direction.z,v=this.origin;return h>=0?(s=(e.min.x-v.x)*h,l=(e.max.x-v.x)*h):(s=(e.max.x-v.x)*h,l=(e.min.x-v.x)*h),_>=0?(c=(e.min.y-v.y)*_,f=(e.max.y-v.y)*_):(c=(e.max.y-v.y)*_,f=(e.min.y-v.y)*_),s>f||c>l||((c>s||isNaN(s))&&(s=c),(f=0?(p=(e.min.z-v.z)*S,m=(e.max.z-v.z)*S):(p=(e.max.z-v.z)*S,m=(e.min.z-v.z)*S),s>m||p>l)||((p>s||s!==s)&&(s=p),(m=0?s:l,n)}intersectsBox(e){return this.intersectBox(e,Fa)!==null}intersectTriangle(e,n,s,l,c){Ch.subVectors(n,e),nu.subVectors(s,e),wh.crossVectors(Ch,nu);let f=this.direction.dot(wh),p;if(f>0){if(l)return null;p=1}else if(f<0)p=-1,f=-f;else return null;Ms.subVectors(this.origin,e);const m=p*this.direction.dot(nu.crossVectors(Ms,nu));if(m<0)return null;const h=p*this.direction.dot(Ch.cross(Ms));if(h<0||m+h>f)return null;const _=-p*Ms.dot(wh);return _<0?null:this.at(_/f,c)}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)}}class lm extends Eo{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(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 Rs,this.combine=Jx,this.reflectivity=1,this.refractionRatio=.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}}const Bv=new cn,Qs=new om,iu=new bo,Fv=new re,au=new re,su=new re,ru=new re,Rh=new re,ou=new re,zv=new re,lu=new re;class $i extends Nn{constructor(e=new Pi,n=new lm){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,s=Object.keys(n);if(s.length>0){const l=n[s[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,f=l.length;c(e.far-e.near)**2))&&(Bv.copy(c).invert(),Qs.copy(e.ray).applyMatrix4(Bv),!(s.boundingBox!==null&&Qs.intersectsBox(s.boundingBox)===!1)&&this._computeIntersections(e,n,Qs)))}_computeIntersections(e,n,s){let l;const c=this.geometry,f=this.material,p=c.index,m=c.attributes.position,h=c.attributes.uv,_=c.attributes.uv1,S=c.attributes.normal,v=c.groups,M=c.drawRange;if(p!==null)if(Array.isArray(f))for(let E=0,w=v.length;En.far?null:{distance:h,point:lu.clone(),object:a}}function cu(a,e,n,s,l,c,f,p,m,h){a.getVertexPosition(p,au),a.getVertexPosition(m,su),a.getVertexPosition(h,ru);const _=ZE(a,e,n,s,au,su,ru,zv);if(_){const S=new re;Oi.getBarycoord(zv,au,su,ru,S),l&&(_.uv=Oi.getInterpolatedAttribute(l,p,m,h,S,new xt)),c&&(_.uv1=Oi.getInterpolatedAttribute(c,p,m,h,S,new xt)),f&&(_.normal=Oi.getInterpolatedAttribute(f,p,m,h,S,new re),_.normal.dot(s.direction)>0&&_.normal.multiplyScalar(-1));const v={a:p,b:m,c:h,normal:new re,materialIndex:0};Oi.getNormal(au,su,ru,v.normal),_.face=v,_.barycoord=S}return _}class yy extends $n{constructor(e=null,n=1,s=1,l,c,f,p,m,h=Vn,_=Vn,S,v){super(null,f,p,m,h,_,l,c,S,v),this.isDataTexture=!0,this.image={data:e,width:n,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Hv extends Zi{constructor(e,n,s,l=1){super(e,n,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=l}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const io=new cn,Gv=new cn,uu=[],Vv=new dr,KE=new cn,yl=new $i,Sl=new bo;class Sy extends $i{constructor(e,n,s){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Hv(new Float32Array(s*16),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let l=0;l1)?null:n.copy(e.start).addScaledVector(l,f)}intersectsLine(e){const n=this.distanceToPoint(e.start),s=this.distanceToPoint(e.end);return n<0&&s>0||s<0&&n>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,n){const s=n||QE.getNormalMatrix(e),l=this.coplanarPoint(Dh).applyMatrix4(e),c=this.normal.applyMatrix3(s).normalize();return this.constant=-l.dot(c),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)}}const Js=new bo,JE=new xt(.5,.5),fu=new re;class cm{constructor(e=new Es,n=new Es,s=new Es,l=new Es,c=new Es,f=new Es){this.planes=[e,n,s,l,c,f]}set(e,n,s,l,c,f){const p=this.planes;return p[0].copy(e),p[1].copy(n),p[2].copy(s),p[3].copy(l),p[4].copy(c),p[5].copy(f),this}copy(e){const n=this.planes;for(let s=0;s<6;s++)n[s].copy(e.planes[s]);return this}setFromProjectionMatrix(e,n=la,s=!1){const l=this.planes,c=e.elements,f=c[0],p=c[1],m=c[2],h=c[3],_=c[4],S=c[5],v=c[6],M=c[7],E=c[8],w=c[9],y=c[10],x=c[11],P=c[12],L=c[13],R=c[14],I=c[15];if(l[0].setComponents(h-f,M-_,x-E,I-P).normalize(),l[1].setComponents(h+f,M+_,x+E,I+P).normalize(),l[2].setComponents(h+p,M+S,x+w,I+L).normalize(),l[3].setComponents(h-p,M-S,x-w,I-L).normalize(),s)l[4].setComponents(m,v,y,R).normalize(),l[5].setComponents(h-m,M-v,x-y,I-R).normalize();else if(l[4].setComponents(h-m,M-v,x-y,I-R).normalize(),n===la)l[5].setComponents(h+m,M+v,x+y,I+R).normalize();else if(n===Ll)l[5].setComponents(m,v,y,R).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Js.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Js.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Js)}intersectsSprite(e){Js.center.set(0,0,0);const n=JE.distanceTo(e.center);return Js.radius=.7071067811865476+n,Js.applyMatrix4(e.matrixWorld),this.intersectsSphere(Js)}intersectsSphere(e){const n=this.planes,s=e.center,l=-e.radius;for(let c=0;c<6;c++)if(n[c].distanceToPoint(s)0?e.max.x:e.min.x,fu.y=l.normal.y>0?e.max.y:e.min.y,fu.z=l.normal.z>0?e.max.z:e.min.z,l.distanceToPoint(fu)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let s=0;s<6;s++)if(n[s].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class um extends Eo{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ot(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}}const Pu=new re,Iu=new re,kv=new cn,Ml=new om,du=new bo,Nh=new re,jv=new re;class eT extends Nn{constructor(e=new Pi,n=new um){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,s=[0];for(let l=1,c=n.count;l0){const l=n[s[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,f=l.length;cs)return;Nh.applyMatrix4(a.matrixWorld);const h=e.ray.origin.distanceTo(Nh);if(!(he.far))return{distance:h,point:jv.clone().applyMatrix4(a.matrixWorld),index:f,face:null,faceIndex:null,barycoord:null,object:a}}const Xv=new re,Wv=new re;class My extends eT{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,s=[];for(let l=0,c=n.count;l0?1:-1,_.push(Se.x,Se.y,Se.z),S.push(te/U),S.push(1-xe/A),j+=1}}for(let xe=0;xe0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const s={};for(const l in this.extensions)this.extensions[l]===!0&&(s[l]=!0);return Object.keys(s).length>0&&(n.extensions=s),n}fromJSON(e,n){if(super.fromJSON(e,n),e.uniforms!==void 0)for(const s in e.uniforms){const l=e.uniforms[s];switch(this.uniforms[s]={},l.type){case"t":this.uniforms[s].value=n[l.value]||null;break;case"c":this.uniforms[s].value=new ot().setHex(l.value);break;case"v2":this.uniforms[s].value=new xt().fromArray(l.value);break;case"v3":this.uniforms[s].value=new re().fromArray(l.value);break;case"v4":this.uniforms[s].value=new gn().fromArray(l.value);break;case"m3":this.uniforms[s].value=new bt().fromArray(l.value);break;case"m4":this.uniforms[s].value=new cn().fromArray(l.value);break;default:this.uniforms[s].value=l.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)this.extensions[s]=e.extensions[s];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class sT extends ha{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class rT extends Mo{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ot(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 ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Lp,this.normalScale=new xt(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 Rs,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}}class oT extends Mo{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=hE,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}}class lT extends Mo{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}}class cm extends Nn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ot(e),this.intensity=n}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,n}}class cT extends cm{constructor(e,n,s){super(e,s),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Nn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ot(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}toJSON(e){const n=super.toJSON(e);return n.object.groundColor=this.groundColor.getHex(),n}}const Lh=new cn,Wv=new re,qv=new re;class uT{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 xt(512,512),this.mapType=Si,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new om,this._frameExtents=new xt(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,s=this.matrix;Wv.setFromMatrixPosition(e.matrixWorld),n.position.copy(Wv),qv.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(qv),n.updateMatrixWorld(),Lh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Lh,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Ll||n.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(Lh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),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.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const _u=new re,vu=new ws,sa=new re;class by extends Nn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=la,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),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){super.updateMatrixWorld(e),this.matrixWorld.decompose(_u,vu,sa),sa.x===1&&sa.y===1&&sa.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_u,vu,sa.set(1,1,1)).invert()}updateWorldMatrix(e,n,s=!1){super.updateWorldMatrix(e,n,s),this.matrixWorld.decompose(_u,vu,sa),sa.x===1&&sa.y===1&&sa.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_u,vu,sa.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Ms=new re,Yv=new xt,Zv=new xt;class Li extends by{constructor(e=50,n=1,s=.1,l=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=l,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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){const n=.5*this.getFilmHeight()/e;this.fov=Op*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(wl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Op*2*Math.atan(Math.tan(wl*.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,n,s){Ms.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ms.x,Ms.y).multiplyScalar(-e/Ms.z),Ms.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(Ms.x,Ms.y).multiplyScalar(-e/Ms.z)}getViewSize(e,n){return this.getViewBounds(e,Yv,Zv),n.subVectors(Zv,Yv)}setViewOffset(e,n,s,l,c,d){this.aspect=e/n,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=n,this.view.offsetX=s,this.view.offsetY=l,this.view.width=c,this.view.height=d,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(wl*.5*this.fov)/this.zoom,s=2*n,l=this.aspect*s,c=-.5*l;const d=this.view;if(this.view!==null&&this.view.enabled){const m=d.fullWidth,h=d.fullHeight;c+=d.offsetX*l/m,n-=d.offsetY*s/h,l*=d.width/m,s*=d.height/h}const p=this.filmOffset;p!==0&&(c+=e*p/this.getFilmWidth()),this.projectionMatrix.makePerspective(c,c+l,n,n-s,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class um extends by{constructor(e=-1,n=1,s=1,l=-1,c=.1,d=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=s,this.bottom=l,this.near=c,this.far=d,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,s,l,c,d){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=n,this.view.offsetX=s,this.view.offsetY=l,this.view.width=c,this.view.height=d,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let c=s-e,d=s+e,p=l+n,m=l-n;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;c+=h*this.view.offsetX,d=c+h*this.view.width,p-=_*this.view.offsetY,m=p-_*this.view.height}this.projectionMatrix.makeOrthographic(c,d,p,m,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class dT extends uT{constructor(){super(new um(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Kv extends cm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nn.DEFAULT_UP),this.updateMatrix(),this.target=new Nn,this.shadow=new dT}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){const n=super.toJSON(e);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class fT extends cm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}const io=-90,ao=1;class hT extends Nn{constructor(e,n,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const l=new Li(io,ao,e,n);l.layers=this.layers,this.add(l);const c=new Li(io,ao,e,n);c.layers=this.layers,this.add(c);const d=new Li(io,ao,e,n);d.layers=this.layers,this.add(d);const p=new Li(io,ao,e,n);p.layers=this.layers,this.add(p);const m=new Li(io,ao,e,n);m.layers=this.layers,this.add(m);const h=new Li(io,ao,e,n);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[s,l,c,d,p,m]=n;for(const h of n)this.remove(h);if(e===la)s.up.set(0,1,0),s.lookAt(1,0,0),l.up.set(0,1,0),l.lookAt(-1,0,0),c.up.set(0,0,-1),c.lookAt(0,1,0),d.up.set(0,0,1),d.lookAt(0,-1,0),p.up.set(0,1,0),p.lookAt(0,0,1),m.up.set(0,1,0),m.lookAt(0,0,-1);else if(e===Ll)s.up.set(0,-1,0),s.lookAt(-1,0,0),l.up.set(0,-1,0),l.lookAt(1,0,0),c.up.set(0,0,1),c.lookAt(0,1,0),d.up.set(0,0,-1),d.lookAt(0,-1,0),p.up.set(0,-1,0),p.lookAt(0,0,1),m.up.set(0,-1,0),m.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of n)this.add(h),h.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:l}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[c,d,p,m,h,_]=this.children,S=e.getRenderTarget(),v=e.getActiveCubeFace(),b=e.getActiveMipmapLevel(),A=e.xr.enabled;e.xr.enabled=!1;const w=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let y=!1;e.isWebGLRenderer===!0?y=e.state.buffers.depth.getReversed():y=e.reversedDepthBuffer,e.setRenderTarget(s,0,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),e.setRenderTarget(s,1,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,d),e.setRenderTarget(s,2,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,p),e.setRenderTarget(s,3,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,m),e.setRenderTarget(s,4,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,h),s.texture.generateMipmaps=w,e.setRenderTarget(s,5,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,_),e.setRenderTarget(S,v,b),e.xr.enabled=A,s.texture.needsPMREMUpdate=!0}}class pT extends Li{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class $v{constructor(e=1,n=0,s=0){this.radius=e,this.phi=n,this.theta=s}set(e,n,s){return this.radius=e,this.phi=n,this.theta=s,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ot(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,s){return this.radius=Math.sqrt(e*e+n*n+s*s),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,s),this.phi=Math.acos(Ot(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const bm=class bm{constructor(e,n,s,l){this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,s,l)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let s=0;s<4;s++)this.elements[s]=e[s+n];return this}set(e,n,s,l){const c=this.elements;return c[0]=e,c[2]=n,c[1]=s,c[3]=l,this}};bm.prototype.isMatrix2=!0;let Qv=bm;class mT extends xy{constructor(e=10,n=10,s=4473924,l=8947848){s=new ot(s),l=new ot(l);const c=n/2,d=e/n,p=e/2,m=[],h=[];for(let v=0,b=0,A=-p;v<=n;v++,A+=d){m.push(-p,0,A,p,0,A),m.push(A,0,-p,A,0,p);const w=v===c?s:l;w.toArray(h,b),b+=3,w.toArray(h,b),b+=3,w.toArray(h,b),b+=3,w.toArray(h,b),b+=3}const _=new Pi;_.setAttribute("position",new oi(m,3)),_.setAttribute("color",new oi(h,3));const S=new lm({vertexColors:!0,toneMapped:!1});super(_,S),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class gT extends Ns{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){gt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Jv(a,e,n,s){const l=_T(s);switch(n){case cy:return a*e;case Jp:return a*e/l.components*l.byteLength;case em:return a*e/l.components*l.byteLength;case rr:return a*e*2/l.components*l.byteLength;case tm:return a*e*2/l.components*l.byteLength;case uy:return a*e*3/l.components*l.byteLength;case Yi:return a*e*4/l.components*l.byteLength;case nm:return a*e*4/l.components*l.byteLength;case Eu:case Tu:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*8;case Au:case Cu:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case ap:case rp:return Math.max(a,16)*Math.max(e,8)/4;case ip:case sp:return Math.max(a,8)*Math.max(e,8)/2;case op:case lp:case up:case dp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*8;case cp:case Du:case fp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case hp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case pp:return Math.floor((a+4)/5)*Math.floor((e+3)/4)*16;case mp:return Math.floor((a+4)/5)*Math.floor((e+4)/5)*16;case gp:return Math.floor((a+5)/6)*Math.floor((e+4)/5)*16;case _p:return Math.floor((a+5)/6)*Math.floor((e+5)/6)*16;case vp:return Math.floor((a+7)/8)*Math.floor((e+4)/5)*16;case xp:return Math.floor((a+7)/8)*Math.floor((e+5)/6)*16;case yp:return Math.floor((a+7)/8)*Math.floor((e+7)/8)*16;case Sp:return Math.floor((a+9)/10)*Math.floor((e+4)/5)*16;case Mp:return Math.floor((a+9)/10)*Math.floor((e+5)/6)*16;case bp:return Math.floor((a+9)/10)*Math.floor((e+7)/8)*16;case Ep:return Math.floor((a+9)/10)*Math.floor((e+9)/10)*16;case Tp:return Math.floor((a+11)/12)*Math.floor((e+9)/10)*16;case Ap:return Math.floor((a+11)/12)*Math.floor((e+11)/12)*16;case Cp:case wp:case Rp:return Math.ceil(a/4)*Math.ceil(e/4)*16;case Dp:case Np:return Math.ceil(a/4)*Math.ceil(e/4)*8;case Nu:case Up:return Math.ceil(a/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function _T(a){switch(a){case Si:case sy:return{byteLength:1,components:1};case Nl:case ry:case Xa:return{byteLength:2,components:1};case $p:case Qp:return{byteLength:2,components:4};case fa:case Kp:case qi:return{byteLength:4,components:1};case oy:case ly:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${a}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yp}}));typeof window<"u"&&(window.__THREE__?gt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yp);function Ey(){let a=null,e=!1,n=null,s=null;function l(c,d){n(c,d),s=a.requestAnimationFrame(l)}return{start:function(){e!==!0&&n!==null&&a!==null&&(s=a.requestAnimationFrame(l),e=!0)},stop:function(){a!==null&&a.cancelAnimationFrame(s),e=!1},setAnimationLoop:function(c){n=c},setContext:function(c){a=c}}}function vT(a){const e=new WeakMap;function n(p,m){const h=p.array,_=p.usage,S=h.byteLength,v=a.createBuffer();a.bindBuffer(m,v),a.bufferData(m,h,_),p.onUploadCallback();let b;if(h instanceof Float32Array)b=a.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)b=a.HALF_FLOAT;else if(h instanceof Uint16Array)p.isFloat16BufferAttribute?b=a.HALF_FLOAT:b=a.UNSIGNED_SHORT;else if(h instanceof Int16Array)b=a.SHORT;else if(h instanceof Uint32Array)b=a.UNSIGNED_INT;else if(h instanceof Int32Array)b=a.INT;else if(h instanceof Int8Array)b=a.BYTE;else if(h instanceof Uint8Array)b=a.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)b=a.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:v,type:b,bytesPerElement:h.BYTES_PER_ELEMENT,version:p.version,size:S}}function s(p,m,h){const _=m.array,S=m.updateRanges;if(a.bindBuffer(h,p),S.length===0)a.bufferSubData(h,0,_);else{S.sort((b,A)=>b.start-A.start);let v=0;for(let b=1;b0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const s={};for(const l in this.extensions)this.extensions[l]===!0&&(s[l]=!0);return Object.keys(s).length>0&&(n.extensions=s),n}fromJSON(e,n){if(super.fromJSON(e,n),e.uniforms!==void 0)for(const s in e.uniforms){const l=e.uniforms[s];switch(this.uniforms[s]={},l.type){case"t":this.uniforms[s].value=n[l.value]||null;break;case"c":this.uniforms[s].value=new ot().setHex(l.value);break;case"v2":this.uniforms[s].value=new xt().fromArray(l.value);break;case"v3":this.uniforms[s].value=new re().fromArray(l.value);break;case"v4":this.uniforms[s].value=new gn().fromArray(l.value);break;case"m3":this.uniforms[s].value=new bt().fromArray(l.value);break;case"m4":this.uniforms[s].value=new cn().fromArray(l.value);break;default:this.uniforms[s].value=l.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)this.extensions[s]=e.extensions[s];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class oT extends ha{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class lT extends Eo{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ot(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 ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Op,this.normalScale=new xt(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 Rs,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}}class cT extends Eo{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_E,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}}class uT extends Eo{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}}class fm extends Nn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ot(e),this.intensity=n}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,n}}class fT extends fm{constructor(e,n,s){super(e,s),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Nn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ot(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}toJSON(e){const n=super.toJSON(e);return n.object.groundColor=this.groundColor.getHex(),n}}const Lh=new cn,Yv=new re,Zv=new re;class dT{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 xt(512,512),this.mapType=Si,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new cm,this._frameExtents=new xt(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,s=this.matrix;Yv.setFromMatrixPosition(e.matrixWorld),n.position.copy(Yv),Zv.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(Zv),n.updateMatrixWorld(),Lh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Lh,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Ll||n.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(Lh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),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.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const _u=new re,vu=new ws,sa=new re;class Ay extends Nn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=la,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),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){super.updateMatrixWorld(e),this.matrixWorld.decompose(_u,vu,sa),sa.x===1&&sa.y===1&&sa.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_u,vu,sa.set(1,1,1)).invert()}updateWorldMatrix(e,n,s=!1){super.updateWorldMatrix(e,n,s),this.matrixWorld.decompose(_u,vu,sa),sa.x===1&&sa.y===1&&sa.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(_u,vu,sa.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const bs=new re,Kv=new xt,$v=new xt;class Li extends Ay{constructor(e=50,n=1,s=.1,l=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=s,this.far=l,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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){const n=.5*this.getFilmHeight()/e;this.fov=Pp*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Rl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Pp*2*Math.atan(Math.tan(Rl*.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,n,s){bs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(bs.x,bs.y).multiplyScalar(-e/bs.z),bs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(bs.x,bs.y).multiplyScalar(-e/bs.z)}getViewSize(e,n){return this.getViewBounds(e,Kv,$v),n.subVectors($v,Kv)}setViewOffset(e,n,s,l,c,f){this.aspect=e/n,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=n,this.view.offsetX=s,this.view.offsetY=l,this.view.width=c,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Rl*.5*this.fov)/this.zoom,s=2*n,l=this.aspect*s,c=-.5*l;const f=this.view;if(this.view!==null&&this.view.enabled){const m=f.fullWidth,h=f.fullHeight;c+=f.offsetX*l/m,n-=f.offsetY*s/h,l*=f.width/m,s*=f.height/h}const p=this.filmOffset;p!==0&&(c+=e*p/this.getFilmWidth()),this.projectionMatrix.makePerspective(c,c+l,n,n-s,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class dm extends Ay{constructor(e=-1,n=1,s=1,l=-1,c=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=s,this.bottom=l,this.near=c,this.far=f,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,s,l,c,f){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=n,this.view.offsetX=s,this.view.offsetY=l,this.view.width=c,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let c=s-e,f=s+e,p=l+n,m=l-n;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;c+=h*this.view.offsetX,f=c+h*this.view.width,p-=_*this.view.offsetY,m=p-_*this.view.height}this.projectionMatrix.makeOrthographic(c,f,p,m,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class hT extends dT{constructor(){super(new dm(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Qv extends fm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nn.DEFAULT_UP),this.updateMatrix(),this.target=new Nn,this.shadow=new hT}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){const n=super.toJSON(e);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class pT extends fm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}const ao=-90,so=1;class mT extends Nn{constructor(e,n,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const l=new Li(ao,so,e,n);l.layers=this.layers,this.add(l);const c=new Li(ao,so,e,n);c.layers=this.layers,this.add(c);const f=new Li(ao,so,e,n);f.layers=this.layers,this.add(f);const p=new Li(ao,so,e,n);p.layers=this.layers,this.add(p);const m=new Li(ao,so,e,n);m.layers=this.layers,this.add(m);const h=new Li(ao,so,e,n);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[s,l,c,f,p,m]=n;for(const h of n)this.remove(h);if(e===la)s.up.set(0,1,0),s.lookAt(1,0,0),l.up.set(0,1,0),l.lookAt(-1,0,0),c.up.set(0,0,-1),c.lookAt(0,1,0),f.up.set(0,0,1),f.lookAt(0,-1,0),p.up.set(0,1,0),p.lookAt(0,0,1),m.up.set(0,1,0),m.lookAt(0,0,-1);else if(e===Ll)s.up.set(0,-1,0),s.lookAt(-1,0,0),l.up.set(0,-1,0),l.lookAt(1,0,0),c.up.set(0,0,1),c.lookAt(0,1,0),f.up.set(0,0,-1),f.lookAt(0,-1,0),p.up.set(0,-1,0),p.lookAt(0,0,1),m.up.set(0,-1,0),m.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of n)this.add(h),h.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:l}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[c,f,p,m,h,_]=this.children,S=e.getRenderTarget(),v=e.getActiveCubeFace(),M=e.getActiveMipmapLevel(),E=e.xr.enabled;e.xr.enabled=!1;const w=s.texture.generateMipmaps;s.texture.generateMipmaps=!1;let y=!1;e.isWebGLRenderer===!0?y=e.state.buffers.depth.getReversed():y=e.reversedDepthBuffer,e.setRenderTarget(s,0,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),e.setRenderTarget(s,1,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,f),e.setRenderTarget(s,2,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,p),e.setRenderTarget(s,3,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,m),e.setRenderTarget(s,4,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,h),s.texture.generateMipmaps=w,e.setRenderTarget(s,5,l),y&&e.autoClear===!1&&e.clearDepth(),e.render(n,_),e.setRenderTarget(S,v,M),e.xr.enabled=E,s.texture.needsPMREMUpdate=!0}}class gT extends Li{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Jv{constructor(e=1,n=0,s=0){this.radius=e,this.phi=n,this.theta=s}set(e,n,s){return this.radius=e,this.phi=n,this.theta=s,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ot(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,s){return this.radius=Math.sqrt(e*e+n*n+s*s),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,s),this.phi=Math.acos(Ot(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const Am=class Am{constructor(e,n,s,l){this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,s,l)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let s=0;s<4;s++)this.elements[s]=e[s+n];return this}set(e,n,s,l){const c=this.elements;return c[0]=e,c[2]=n,c[1]=s,c[3]=l,this}};Am.prototype.isMatrix2=!0;let ex=Am;class _T extends My{constructor(e=10,n=10,s=4473924,l=8947848){s=new ot(s),l=new ot(l);const c=n/2,f=e/n,p=e/2,m=[],h=[];for(let v=0,M=0,E=-p;v<=n;v++,E+=f){m.push(-p,0,E,p,0,E),m.push(E,0,-p,E,0,p);const w=v===c?s:l;w.toArray(h,M),M+=3,w.toArray(h,M),M+=3,w.toArray(h,M),M+=3,w.toArray(h,M),M+=3}const _=new Pi;_.setAttribute("position",new oi(m,3)),_.setAttribute("color",new oi(h,3));const S=new um({vertexColors:!0,toneMapped:!1});super(_,S),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class vT extends Ns{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){mt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function tx(a,e,n,s){const l=xT(s);switch(n){case fy:return a*e;case em:return a*e/l.components*l.byteLength;case tm:return a*e/l.components*l.byteLength;case lr:return a*e*2/l.components*l.byteLength;case nm:return a*e*2/l.components*l.byteLength;case dy:return a*e*3/l.components*l.byteLength;case Yi:return a*e*4/l.components*l.byteLength;case im:return a*e*4/l.components*l.byteLength;case Eu:case Tu:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*8;case Au:case Cu:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case sp:case op:return Math.max(a,16)*Math.max(e,8)/4;case ap:case rp:return Math.max(a,8)*Math.max(e,8)/2;case lp:case cp:case fp:case dp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*8;case up:case Du:case hp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case pp:return Math.floor((a+3)/4)*Math.floor((e+3)/4)*16;case mp:return Math.floor((a+4)/5)*Math.floor((e+3)/4)*16;case gp:return Math.floor((a+4)/5)*Math.floor((e+4)/5)*16;case _p:return Math.floor((a+5)/6)*Math.floor((e+4)/5)*16;case vp:return Math.floor((a+5)/6)*Math.floor((e+5)/6)*16;case xp:return Math.floor((a+7)/8)*Math.floor((e+4)/5)*16;case yp:return Math.floor((a+7)/8)*Math.floor((e+5)/6)*16;case Sp:return Math.floor((a+7)/8)*Math.floor((e+7)/8)*16;case Mp:return Math.floor((a+9)/10)*Math.floor((e+4)/5)*16;case bp:return Math.floor((a+9)/10)*Math.floor((e+5)/6)*16;case Ep:return Math.floor((a+9)/10)*Math.floor((e+7)/8)*16;case Tp:return Math.floor((a+9)/10)*Math.floor((e+9)/10)*16;case Ap:return Math.floor((a+11)/12)*Math.floor((e+9)/10)*16;case Cp:return Math.floor((a+11)/12)*Math.floor((e+11)/12)*16;case wp:case Rp:case Dp:return Math.ceil(a/4)*Math.ceil(e/4)*16;case Np:case Up:return Math.ceil(a/4)*Math.ceil(e/4)*8;case Nu:case Lp:return Math.ceil(a/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function xT(a){switch(a){case Si:case oy:return{byteLength:1,components:1};case Nl:case ly:case Wa:return{byteLength:2,components:1};case Qp:case Jp:return{byteLength:2,components:4};case da:case $p:case qi:return{byteLength:4,components:1};case cy:case uy:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${a}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zp}}));typeof window<"u"&&(window.__THREE__?mt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zp);function Cy(){let a=null,e=!1,n=null,s=null;function l(c,f){n(c,f),s=a.requestAnimationFrame(l)}return{start:function(){e!==!0&&n!==null&&a!==null&&(s=a.requestAnimationFrame(l),e=!0)},stop:function(){a!==null&&a.cancelAnimationFrame(s),e=!1},setAnimationLoop:function(c){n=c},setContext:function(c){a=c}}}function yT(a){const e=new WeakMap;function n(p,m){const h=p.array,_=p.usage,S=h.byteLength,v=a.createBuffer();a.bindBuffer(m,v),a.bufferData(m,h,_),p.onUploadCallback();let M;if(h instanceof Float32Array)M=a.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)M=a.HALF_FLOAT;else if(h instanceof Uint16Array)p.isFloat16BufferAttribute?M=a.HALF_FLOAT:M=a.UNSIGNED_SHORT;else if(h instanceof Int16Array)M=a.SHORT;else if(h instanceof Uint32Array)M=a.UNSIGNED_INT;else if(h instanceof Int32Array)M=a.INT;else if(h instanceof Int8Array)M=a.BYTE;else if(h instanceof Uint8Array)M=a.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)M=a.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:v,type:M,bytesPerElement:h.BYTES_PER_ELEMENT,version:p.version,size:S}}function s(p,m,h){const _=m.array,S=m.updateRanges;if(a.bindBuffer(h,p),S.length===0)a.bufferSubData(h,0,_);else{S.sort((M,E)=>M.start-E.start);let v=0;for(let M=1;M 0
+#endif`,IT=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#ifdef ALPHA_TO_COVERAGE
float distanceToPlane, distanceGradient;
@@ -262,20 +262,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
if ( clipped ) discard;
#endif
#endif
-#endif`,PT=`#if NUM_CLIPPING_PLANES > 0
+#endif`,BT=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
-#endif`,IT=`#if NUM_CLIPPING_PLANES > 0
+#endif`,FT=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
-#endif`,BT=`#if NUM_CLIPPING_PLANES > 0
+#endif`,zT=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
-#endif`,FT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,HT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
-#endif`,zT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
+#endif`,GT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
varying vec4 vColor;
-#endif`,HT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,VT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec4 vColor;
-#endif`,GT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
+#endif`,kT=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
@@ -288,7 +288,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
#endif
#ifdef USE_BATCHING_COLOR
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
-#endif`,VT=`#define PI 3.141592653589793
+#endif`,jT=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
@@ -359,7 +359,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
-} // validated`,kT=`#ifdef ENVMAP_TYPE_CUBE_UV
+} // validated`,XT=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_minMipLevel 4.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
@@ -452,7 +452,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
-#endif`,jT=`vec3 transformedNormal = objectNormal;
+#endif`,WT=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
vec3 transformedTangent = objectTangent;
#endif
@@ -478,21 +478,21 @@ transformedNormal = normalMatrix * transformedNormal;
#endif
#ifdef USE_TANGENT
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
-#endif`,XT=`#ifdef USE_DISPLACEMENTMAP
+#endif`,qT=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
-#endif`,WT=`#ifdef USE_DISPLACEMENTMAP
+#endif`,YT=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
-#endif`,qT=`#ifdef USE_EMISSIVEMAP
+#endif`,ZT=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
-#endif`,YT=`#ifdef USE_EMISSIVEMAP
+#endif`,KT=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
-#endif`,ZT="gl_FragColor = linearToOutputTexel( gl_FragColor );",KT=`vec4 LinearTransferOETF( in vec4 value ) {
+#endif`,$T="gl_FragColor = linearToOutputTexel( gl_FragColor );",QT=`vec4 LinearTransferOETF( in vec4 value ) {
return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -500,7 +500,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
}
vec4 sRGBTransferOETF( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
-}`,$T=`#ifdef USE_ENVMAP
+}`,JT=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
@@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif
-#endif`,QT=`#ifdef USE_ENVMAP
+#endif`,eA=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
@@ -535,7 +535,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
uniform sampler2D envMap;
#endif
-#endif`,JT=`#ifdef USE_ENVMAP
+#endif`,tA=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
@@ -546,7 +546,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
#else
varying vec3 vReflect;
#endif
-#endif`,e1=`#ifdef USE_ENVMAP
+#endif`,nA=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
#define ENV_WORLDPOS
#endif
@@ -557,7 +557,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
varying vec3 vReflect;
uniform float refractionRatio;
#endif
-#endif`,t1=`#ifdef USE_ENVMAP
+#endif`,iA=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
@@ -574,18 +574,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
-#endif`,n1=`#ifdef USE_FOG
+#endif`,aA=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
-#endif`,i1=`#ifdef USE_FOG
+#endif`,sA=`#ifdef USE_FOG
varying float vFogDepth;
-#endif`,a1=`#ifdef USE_FOG
+#endif`,rA=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
-#endif`,s1=`#ifdef USE_FOG
+#endif`,oA=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
@@ -594,7 +594,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
uniform float fogNear;
uniform float fogFar;
#endif
-#endif`,r1=`#ifdef USE_GRADIENTMAP
+#endif`,lA=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -606,12 +606,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
vec2 fw = fwidth( coord ) * 0.5;
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
#endif
-}`,o1=`#ifdef USE_LIGHTMAP
+}`,cA=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
-#endif`,l1=`LambertMaterial material;
+#endif`,uA=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
-material.specularStrength = specularStrength;`,c1=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,fA=`varying vec3 vViewPosition;
struct LambertMaterial {
vec3 diffuseColor;
float specularStrength;
@@ -625,7 +625,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Lambert
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,u1=`uniform bool receiveShadow;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,dA=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
uniform vec3 lightProbe[ 9 ];
@@ -742,7 +742,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
return irradiance;
}
#endif
-#include `,d1=`#ifdef USE_ENVMAP
+#include `,hA=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -775,8 +775,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
#endif
}
#endif
-#endif`,f1=`ToonMaterial material;
-material.diffuseColor = diffuseColor.rgb;`,h1=`varying vec3 vViewPosition;
+#endif`,pA=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,mA=`varying vec3 vViewPosition;
struct ToonMaterial {
vec3 diffuseColor;
};
@@ -788,11 +788,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,p1=`BlinnPhongMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,gA=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
-material.specularStrength = specularStrength;`,m1=`varying vec3 vViewPosition;
+material.specularStrength = specularStrength;`,_A=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
@@ -809,7 +809,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,g1=`PhysicalMaterial material;
+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,vA=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
@@ -899,7 +899,7 @@ material.roughness = min( material.roughness, 1.0 );
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
-#endif`,_1=`uniform sampler2D dfgLUT;
+#endif`,xA=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
vec3 diffuseColor;
vec3 diffuseContribution;
@@ -1259,7 +1259,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
-}`,v1=`
+}`,yA=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1381,7 +1381,7 @@ IncidentLight directLight;
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
-#endif`,x1=`#if defined( RE_IndirectDiffuse )
+#endif`,SA=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1402,7 +1402,7 @@ IncidentLight directLight;
#ifdef USE_CLEARCOAT
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
#endif
-#endif`,y1=`#if defined( RE_IndirectDiffuse )
+#endif`,MA=`#if defined( RE_IndirectDiffuse )
#if defined( LAMBERT ) || defined( PHONG )
irradiance += iblIrradiance;
#endif
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
-#endif`,S1=`#ifdef USE_LIGHT_PROBES_GRID
+#endif`,bA=`#ifdef USE_LIGHT_PROBES_GRID
uniform highp sampler3D probesSH;
uniform vec3 probesMin;
uniform vec3 probesMax;
@@ -1455,27 +1455,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
result += c8 * 0.429043 * ( x * x - y * y );
return max( result, vec3( 0.0 ) );
}
-#endif`,M1=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,EA=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
-#endif`,b1=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
+#endif`,TA=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,E1=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,AA=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
-#endif`,T1=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
+#endif`,CA=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
-#endif`,A1=`#ifdef USE_MAP
+#endif`,wA=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
-#endif`,C1=`#ifdef USE_MAP
+#endif`,RA=`#ifdef USE_MAP
uniform sampler2D map;
-#endif`,w1=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+#endif`,DA=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
#if defined( USE_POINTS_UV )
vec2 uv = vUv;
#else
@@ -1487,7 +1487,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
-#endif`,R1=`#if defined( USE_POINTS_UV )
+#endif`,NA=`#if defined( USE_POINTS_UV )
varying vec2 vUv;
#else
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1499,19 +1499,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
-#endif`,D1=`float metalnessFactor = metalness;
+#endif`,UA=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
-#endif`,N1=`#ifdef USE_METALNESSMAP
+#endif`,LA=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
-#endif`,U1=`#ifdef USE_INSTANCING_MORPH
+#endif`,OA=`#ifdef USE_INSTANCING_MORPH
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
}
-#endif`,L1=`#if defined( USE_MORPHCOLORS )
+#endif`,PA=`#if defined( USE_MORPHCOLORS )
vColor *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
#if defined( USE_COLOR_ALPHA )
@@ -1520,12 +1520,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
#endif
}
-#endif`,O1=`#ifdef USE_MORPHNORMALS
+#endif`,IA=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,P1=`#ifdef USE_MORPHTARGETS
+#endif`,BA=`#ifdef USE_MORPHTARGETS
#ifndef USE_INSTANCING_MORPH
uniform float morphTargetBaseInfluence;
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1539,12 +1539,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
return texelFetch( morphTargetsTexture, morphUV, 0 );
}
-#endif`,I1=`#ifdef USE_MORPHTARGETS
+#endif`,FA=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
}
-#endif`,B1=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#endif`,zA=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = dFdx( vViewPosition );
vec3 fdy = dFdy( vViewPosition );
@@ -1585,7 +1585,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
tbn2[1] *= faceDirection;
#endif
#endif
-vec3 nonPerturbedNormal = normal;`,F1=`#ifdef USE_NORMALMAP_OBJECTSPACE
+vec3 nonPerturbedNormal = normal;`,HA=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
@@ -1603,19 +1603,19 @@ vec3 nonPerturbedNormal = normal;`,F1=`#ifdef USE_NORMALMAP_OBJECTSPACE
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
-#endif`,z1=`#ifndef FLAT_SHADED
+#endif`,GA=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,H1=`#ifndef FLAT_SHADED
+#endif`,VA=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
-#endif`,G1=`#ifndef FLAT_SHADED
+#endif`,kA=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
@@ -1624,7 +1624,7 @@ vec3 nonPerturbedNormal = normal;`,F1=`#ifdef USE_NORMALMAP_OBJECTSPACE
vBitangent = - vBitangent;
#endif
#endif
-#endif`,V1=`#ifdef USE_NORMALMAP
+#endif`,jA=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
@@ -1646,13 +1646,13 @@ vec3 nonPerturbedNormal = normal;`,F1=`#ifdef USE_NORMALMAP_OBJECTSPACE
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
return mat3( T * scale, B * scale, N );
}
-#endif`,k1=`#ifdef USE_CLEARCOAT
+#endif`,XA=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
-#endif`,j1=`#ifdef USE_CLEARCOAT_NORMALMAP
+#endif`,WA=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
-#endif`,X1=`#ifdef USE_CLEARCOATMAP
+#endif`,qA=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
@@ -1661,18 +1661,18 @@ vec3 nonPerturbedNormal = normal;`,F1=`#ifdef USE_NORMALMAP_OBJECTSPACE
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
-#endif`,W1=`#ifdef USE_IRIDESCENCEMAP
+#endif`,YA=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
-#endif`,q1=`#ifdef OPAQUE
+#endif`,ZA=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Y1=`vec3 packNormalToRGB( const in vec3 normal ) {
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,KA=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1751,9 +1751,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
#else
return ( near * far ) / ( ( far - near ) * depth - far );
#endif
-}`,Z1=`#ifdef PREMULTIPLIED_ALPHA
+}`,$A=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
-#endif`,K1=`vec4 mvPosition = vec4( transformed, 1.0 );
+#endif`,QA=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
mvPosition = batchingMatrix * mvPosition;
#endif
@@ -1761,22 +1761,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
-gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
+gl_Position = projectionMatrix * mvPosition;`,JA=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
-#endif`,Q1=`#ifdef DITHERING
+#endif`,e1=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
-#endif`,J1=`float roughnessFactor = roughness;
+#endif`,t1=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
-#endif`,eA=`#ifdef USE_ROUGHNESSMAP
+#endif`,n1=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
-#endif`,tA=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,i1=`#if NUM_SPOT_LIGHT_COORDS > 0
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
@@ -1976,7 +1976,7 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
}
#endif
#endif
-#endif`,nA=`#if NUM_SPOT_LIGHT_COORDS > 0
+#endif`,a1=`#if NUM_SPOT_LIGHT_COORDS > 0
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
@@ -2017,7 +2017,7 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
-#endif`,iA=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
+#endif`,s1=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
#ifdef HAS_NORMAL
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
#else
@@ -2053,7 +2053,7 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
-#endif`,aA=`float getShadowMask() {
+#endif`,r1=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2085,12 +2085,12 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
#endif
#endif
return shadow;
-}`,sA=`#ifdef USE_SKINNING
+}`,o1=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
-#endif`,rA=`#ifdef USE_SKINNING
+#endif`,l1=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
uniform highp sampler2D boneTexture;
@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
-#endif`,oA=`#ifdef USE_SKINNING
+#endif`,c1=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2113,7 +2113,7 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
-#endif`,lA=`#ifdef USE_SKINNING
+#endif`,u1=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
@@ -2124,17 +2124,17 @@ gl_Position = projectionMatrix * mvPosition;`,$1=`#ifdef DITHERING
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
-#endif`,cA=`float specularStrength;
+#endif`,f1=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
-#endif`,uA=`#ifdef USE_SPECULARMAP
+#endif`,d1=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
-#endif`,dA=`#if defined( TONE_MAPPING )
+#endif`,h1=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
-#endif`,fA=`#ifndef saturate
+#endif`,p1=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
@@ -2231,7 +2231,7 @@ vec3 NeutralToneMapping( vec3 color ) {
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
return mix( color, vec3( newPeak ), g );
}
-vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISSION
+vec3 CustomToneMapping( vec3 color ) { return color; }`,m1=`#ifdef USE_TRANSMISSION
material.transmission = transmission;
material.transmissionAlpha = 1.0;
material.thickness = thickness;
@@ -2252,7 +2252,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
material.attenuationColor, material.attenuationDistance );
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
-#endif`,pA=`#ifdef USE_TRANSMISSION
+#endif`,g1=`#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
@@ -2378,7 +2378,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
}
-#endif`,mA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,_1=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2448,7 +2448,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,gA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,v1=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
#endif
#ifdef USE_MAP
@@ -2542,7 +2542,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
#ifdef USE_THICKNESSMAP
uniform mat3 thicknessMapTransform;
varying vec2 vThicknessMapUv;
-#endif`,_A=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
+#endif`,x1=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
@@ -2613,7 +2613,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
#endif
#ifdef USE_THICKNESSMAP
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
-#endif`,vA=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
+#endif`,y1=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
worldPosition = batchingMatrix * worldPosition;
@@ -2622,12 +2622,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hA=`#ifdef USE_TRANSMISS
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
-#endif`;const xA=`varying vec2 vUv;
+#endif`;const S1=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
-}`,yA=`uniform sampler2D t2D;
+}`,M1=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
@@ -2639,14 +2639,14 @@ void main() {
gl_FragColor = texColor;
#include
#include
-}`,SA=`varying vec3 vWorldDirection;
+}`,b1=`varying vec3 vWorldDirection;
#include
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include
#include
gl_Position.z = gl_Position.w;
-}`,MA=`#ifdef ENVMAP_TYPE_CUBE
+}`,E1=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
@@ -2668,14 +2668,14 @@ void main() {
gl_FragColor = texColor;
#include
#include
-}`,bA=`varying vec3 vWorldDirection;
+}`,T1=`varying vec3 vWorldDirection;
#include
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include
#include
gl_Position.z = gl_Position.w;
-}`,EA=`uniform samplerCube tCube;
+}`,A1=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
@@ -2685,7 +2685,7 @@ void main() {
gl_FragColor.a *= opacity;
#include
#include
-}`,TA=`#include
+}`,C1=`#include
#include
#include
#include
@@ -2712,7 +2712,7 @@ void main() {
#include
#include
vHighPrecisionZW = gl_Position.zw;
-}`,AA=`#if DEPTH_PACKING == 3200
+}`,w1=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include
@@ -2750,7 +2750,7 @@ void main() {
#elif DEPTH_PACKING == 3203
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
#endif
-}`,CA=`#define DISTANCE
+}`,R1=`#define DISTANCE
varying vec3 vWorldPosition;
#include
#include
@@ -2777,7 +2777,7 @@ void main() {
#include
#include
vWorldPosition = worldPosition.xyz;
-}`,wA=`#define DISTANCE
+}`,D1=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
@@ -2800,13 +2800,13 @@ void main() {
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
-}`,RA=`varying vec3 vWorldDirection;
+}`,N1=`varying vec3 vWorldDirection;
#include
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include
#include
-}`,DA=`uniform sampler2D tEquirect;
+}`,U1=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include
void main() {
@@ -2815,7 +2815,7 @@ void main() {
gl_FragColor = texture2D( tEquirect, sampleUV );
#include
#include
-}`,NA=`uniform float scale;
+}`,L1=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include
@@ -2837,7 +2837,7 @@ void main() {
#include
#include
#include
-}`,UA=`uniform vec3 diffuse;
+}`,O1=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
@@ -2865,7 +2865,7 @@ void main() {
#include
#include
#include
-}`,LA=`#include
+}`,P1=`#include
#include
#include
#include
@@ -2897,7 +2897,7 @@ void main() {
#include
#include
#include
-}`,OA=`uniform vec3 diffuse;
+}`,I1=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
@@ -2945,7 +2945,7 @@ void main() {
#include
#include
#include
-}`,PA=`#define LAMBERT
+}`,B1=`#define LAMBERT
varying vec3 vViewPosition;
#include
#include
@@ -2984,7 +2984,7 @@ void main() {
#include
#include
#include
-}`,IA=`#define LAMBERT
+}`,F1=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3042,7 +3042,7 @@ void main() {
#include
#include
#include
-}`,BA=`#define MATCAP
+}`,z1=`#define MATCAP
varying vec3 vViewPosition;
#include
#include
@@ -3076,7 +3076,7 @@ void main() {
#include
#include
vViewPosition = - mvPosition.xyz;
-}`,FA=`#define MATCAP
+}`,H1=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
@@ -3122,7 +3122,7 @@ void main() {
#include
#include
#include
-}`,zA=`#define NORMAL
+}`,G1=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
@@ -3155,7 +3155,7 @@ void main() {
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
-}`,HA=`#define NORMAL
+}`,V1=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
@@ -3176,7 +3176,7 @@ void main() {
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
-}`,GA=`#define PHONG
+}`,k1=`#define PHONG
varying vec3 vViewPosition;
#include
#include
@@ -3215,7 +3215,7 @@ void main() {
#include
#include
#include
-}`,VA=`#define PHONG
+}`,j1=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
@@ -3275,7 +3275,7 @@ void main() {
#include
#include
#include
-}`,kA=`#define STANDARD
+}`,X1=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
@@ -3318,7 +3318,7 @@ void main() {
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
-}`,jA=`#define STANDARD
+}`,W1=`#define STANDARD
#ifdef PHYSICAL
#define IOR
#define USE_SPECULAR
@@ -3443,7 +3443,7 @@ void main() {
#include
#include
#include
-}`,XA=`#define TOON
+}`,q1=`#define TOON
varying vec3 vViewPosition;
#include
#include
@@ -3480,7 +3480,7 @@ void main() {
#include
#include
#include
-}`,WA=`#define TOON
+}`,Y1=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
@@ -3532,7 +3532,7 @@ void main() {
#include
#include
#include
-}`,qA=`uniform float size;
+}`,Z1=`uniform float size;
uniform float scale;
#include
#include
@@ -3563,7 +3563,7 @@ void main() {
#include
#include
#include
-}`,YA=`uniform vec3 diffuse;
+}`,K1=`uniform vec3 diffuse;
uniform float opacity;
#include
#include
@@ -3588,7 +3588,7 @@ void main() {
#include
#include
#include
-}`,ZA=`#include
+}`,$1=`#include
#include
#include
#include
@@ -3611,7 +3611,7 @@ void main() {
#include
#include
#include
-}`,KA=`uniform vec3 color;
+}`,Q1=`uniform vec3 color;
uniform float opacity;
#include
#include
@@ -3627,7 +3627,7 @@ void main() {
#include
#include
#include
-}`,$A=`uniform float rotation;
+}`,J1=`uniform float rotation;
uniform vec2 center;
#include
#include
@@ -3651,7 +3651,7 @@ void main() {
#include
#include
#include
-}`,QA=`uniform vec3 diffuse;
+}`,eC=`uniform vec3 diffuse;
uniform float opacity;
#include
#include
@@ -3676,7 +3676,7 @@ void main() {
#include
#include
#include
-}`,wt={alphahash_fragment:xT,alphahash_pars_fragment:yT,alphamap_fragment:ST,alphamap_pars_fragment:MT,alphatest_fragment:bT,alphatest_pars_fragment:ET,aomap_fragment:TT,aomap_pars_fragment:AT,batching_pars_vertex:CT,batching_vertex:wT,begin_vertex:RT,beginnormal_vertex:DT,bsdfs:NT,iridescence_fragment:UT,bumpmap_pars_fragment:LT,clipping_planes_fragment:OT,clipping_planes_pars_fragment:PT,clipping_planes_pars_vertex:IT,clipping_planes_vertex:BT,color_fragment:FT,color_pars_fragment:zT,color_pars_vertex:HT,color_vertex:GT,common:VT,cube_uv_reflection_fragment:kT,defaultnormal_vertex:jT,displacementmap_pars_vertex:XT,displacementmap_vertex:WT,emissivemap_fragment:qT,emissivemap_pars_fragment:YT,colorspace_fragment:ZT,colorspace_pars_fragment:KT,envmap_fragment:$T,envmap_common_pars_fragment:QT,envmap_pars_fragment:JT,envmap_pars_vertex:e1,envmap_physical_pars_fragment:d1,envmap_vertex:t1,fog_vertex:n1,fog_pars_vertex:i1,fog_fragment:a1,fog_pars_fragment:s1,gradientmap_pars_fragment:r1,lightmap_pars_fragment:o1,lights_lambert_fragment:l1,lights_lambert_pars_fragment:c1,lights_pars_begin:u1,lights_toon_fragment:f1,lights_toon_pars_fragment:h1,lights_phong_fragment:p1,lights_phong_pars_fragment:m1,lights_physical_fragment:g1,lights_physical_pars_fragment:_1,lights_fragment_begin:v1,lights_fragment_maps:x1,lights_fragment_end:y1,lightprobes_pars_fragment:S1,logdepthbuf_fragment:M1,logdepthbuf_pars_fragment:b1,logdepthbuf_pars_vertex:E1,logdepthbuf_vertex:T1,map_fragment:A1,map_pars_fragment:C1,map_particle_fragment:w1,map_particle_pars_fragment:R1,metalnessmap_fragment:D1,metalnessmap_pars_fragment:N1,morphinstance_vertex:U1,morphcolor_vertex:L1,morphnormal_vertex:O1,morphtarget_pars_vertex:P1,morphtarget_vertex:I1,normal_fragment_begin:B1,normal_fragment_maps:F1,normal_pars_fragment:z1,normal_pars_vertex:H1,normal_vertex:G1,normalmap_pars_fragment:V1,clearcoat_normal_fragment_begin:k1,clearcoat_normal_fragment_maps:j1,clearcoat_pars_fragment:X1,iridescence_pars_fragment:W1,opaque_fragment:q1,packing:Y1,premultiplied_alpha_fragment:Z1,project_vertex:K1,dithering_fragment:$1,dithering_pars_fragment:Q1,roughnessmap_fragment:J1,roughnessmap_pars_fragment:eA,shadowmap_pars_fragment:tA,shadowmap_pars_vertex:nA,shadowmap_vertex:iA,shadowmask_pars_fragment:aA,skinbase_vertex:sA,skinning_pars_vertex:rA,skinning_vertex:oA,skinnormal_vertex:lA,specularmap_fragment:cA,specularmap_pars_fragment:uA,tonemapping_fragment:dA,tonemapping_pars_fragment:fA,transmission_fragment:hA,transmission_pars_fragment:pA,uv_pars_fragment:mA,uv_pars_vertex:gA,uv_vertex:_A,worldpos_vertex:vA,background_vert:xA,background_frag:yA,backgroundCube_vert:SA,backgroundCube_frag:MA,cube_vert:bA,cube_frag:EA,depth_vert:TA,depth_frag:AA,distance_vert:CA,distance_frag:wA,equirect_vert:RA,equirect_frag:DA,linedashed_vert:NA,linedashed_frag:UA,meshbasic_vert:LA,meshbasic_frag:OA,meshlambert_vert:PA,meshlambert_frag:IA,meshmatcap_vert:BA,meshmatcap_frag:FA,meshnormal_vert:zA,meshnormal_frag:HA,meshphong_vert:GA,meshphong_frag:VA,meshphysical_vert:kA,meshphysical_frag:jA,meshtoon_vert:XA,meshtoon_frag:WA,points_vert:qA,points_frag:YA,shadow_vert:ZA,shadow_frag:KA,sprite_vert:$A,sprite_frag:QA},qe={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new bt}},envmap:{envMap:{value:null},envMapRotation:{value:new bt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new bt},normalScale:{value:new xt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0},uvTransform:{value:new bt}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new xt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},oa={basic:{uniforms:Kn([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.fog]),vertexShader:wt.meshbasic_vert,fragmentShader:wt.meshbasic_frag},lambert:{uniforms:Kn([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,qe.lights,{emissive:{value:new ot(0)},envMapIntensity:{value:1}}]),vertexShader:wt.meshlambert_vert,fragmentShader:wt.meshlambert_frag},phong:{uniforms:Kn([qe.common,qe.specularmap,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,qe.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:wt.meshphong_vert,fragmentShader:wt.meshphong_frag},standard:{uniforms:Kn([qe.common,qe.envmap,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.roughnessmap,qe.metalnessmap,qe.fog,qe.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wt.meshphysical_vert,fragmentShader:wt.meshphysical_frag},toon:{uniforms:Kn([qe.common,qe.aomap,qe.lightmap,qe.emissivemap,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.gradientmap,qe.fog,qe.lights,{emissive:{value:new ot(0)}}]),vertexShader:wt.meshtoon_vert,fragmentShader:wt.meshtoon_frag},matcap:{uniforms:Kn([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,qe.fog,{matcap:{value:null}}]),vertexShader:wt.meshmatcap_vert,fragmentShader:wt.meshmatcap_frag},points:{uniforms:Kn([qe.points,qe.fog]),vertexShader:wt.points_vert,fragmentShader:wt.points_frag},dashed:{uniforms:Kn([qe.common,qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wt.linedashed_vert,fragmentShader:wt.linedashed_frag},depth:{uniforms:Kn([qe.common,qe.displacementmap]),vertexShader:wt.depth_vert,fragmentShader:wt.depth_frag},normal:{uniforms:Kn([qe.common,qe.bumpmap,qe.normalmap,qe.displacementmap,{opacity:{value:1}}]),vertexShader:wt.meshnormal_vert,fragmentShader:wt.meshnormal_frag},sprite:{uniforms:Kn([qe.sprite,qe.fog]),vertexShader:wt.sprite_vert,fragmentShader:wt.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wt.background_vert,fragmentShader:wt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new bt}},vertexShader:wt.backgroundCube_vert,fragmentShader:wt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wt.cube_vert,fragmentShader:wt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wt.equirect_vert,fragmentShader:wt.equirect_frag},distance:{uniforms:Kn([qe.common,qe.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wt.distance_vert,fragmentShader:wt.distance_frag},shadow:{uniforms:Kn([qe.lights,qe.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:wt.shadow_vert,fragmentShader:wt.shadow_frag}};oa.physical={uniforms:Kn([oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new xt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new bt},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new bt},transmissionSamplerSize:{value:new xt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new xt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:wt.meshphysical_vert,fragmentShader:wt.meshphysical_frag};const xu={r:0,b:0,g:0},JA=new cn,Ty=new bt;Ty.set(-1,0,0,0,1,0,0,0,1);function eC(a,e,n,s,l,c){const d=new ot(0);let p=l===!0?0:1,m,h,_=null,S=0,v=null;function b(P){let L=P.isScene===!0?P.background:null;if(L&&L.isTexture){const R=P.backgroundBlurriness>0;L=e.get(L,R)}return L}function A(P){let L=!1;const R=b(P);R===null?y(d,p):R&&R.isColor&&(y(R,1),L=!0);const I=a.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,c):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,c),(a.autoClear||L)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil))}function w(P,L){const R=b(L);R&&(R.isCubeTexture||R.mapping===Hu)?(h===void 0&&(h=new $i(new dr(1,1,1),new ha({name:"BackgroundCubeMaterial",uniforms:xo(oa.backgroundCube.uniforms),vertexShader:oa.backgroundCube.vertexShader,fragmentShader:oa.backgroundCube.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(I,O,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),h.material.uniforms.envMap.value=R,h.material.uniforms.backgroundBlurriness.value=L.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(JA.makeRotationFromEuler(L.backgroundRotation)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&h.material.uniforms.backgroundRotation.value.premultiply(Ty),h.material.toneMapped=Gt.getTransfer(R.colorSpace)!==en,(_!==R||S!==R.version||v!==a.toneMapping)&&(h.material.needsUpdate=!0,_=R,S=R.version,v=a.toneMapping),h.layers.enableAll(),P.unshift(h,h.geometry,h.material,0,0,null)):R&&R.isTexture&&(m===void 0&&(m=new $i(new Gu(2,2),new ha({name:"BackgroundMaterial",uniforms:xo(oa.background.uniforms),vertexShader:oa.background.vertexShader,fragmentShader:oa.background.fragmentShader,side:Cs,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),m.geometry.deleteAttribute("normal"),Object.defineProperty(m.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(m)),m.material.uniforms.t2D.value=R,m.material.uniforms.backgroundIntensity.value=L.backgroundIntensity,m.material.toneMapped=Gt.getTransfer(R.colorSpace)!==en,R.matrixAutoUpdate===!0&&R.updateMatrix(),m.material.uniforms.uvTransform.value.copy(R.matrix),(_!==R||S!==R.version||v!==a.toneMapping)&&(m.material.needsUpdate=!0,_=R,S=R.version,v=a.toneMapping),m.layers.enableAll(),P.unshift(m,m.geometry,m.material,0,0,null))}function y(P,L){P.getRGB(xu,My(a)),n.buffers.color.setClear(xu.r,xu.g,xu.b,L,c)}function x(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),m!==void 0&&(m.geometry.dispose(),m.material.dispose(),m=void 0)}return{getClearColor:function(){return d},setClearColor:function(P,L=1){d.set(P),p=L,y(d,p)},getClearAlpha:function(){return p},setClearAlpha:function(P){p=P,y(d,p)},render:A,addToRenderList:w,dispose:x}}function tC(a,e){const n=a.getParameter(a.MAX_VERTEX_ATTRIBS),s={},l=v(null);let c=l,d=!1;function p(V,Q,de,pe,J){let G=!1;const j=S(V,pe,de,Q);c!==j&&(c=j,h(c.object)),G=b(V,pe,de,J),G&&A(V,pe,de,J),J!==null&&e.update(J,a.ELEMENT_ARRAY_BUFFER),(G||d)&&(d=!1,R(V,Q,de,pe),J!==null&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e.get(J).buffer))}function m(){return a.createVertexArray()}function h(V){return a.bindVertexArray(V)}function _(V){return a.deleteVertexArray(V)}function S(V,Q,de,pe){const J=pe.wireframe===!0;let G=s[Q.id];G===void 0&&(G={},s[Q.id]=G);const j=V.isInstancedMesh===!0?V.id:0;let se=G[j];se===void 0&&(se={},G[j]=se);let Se=se[de.id];Se===void 0&&(Se={},se[de.id]=Se);let xe=Se[J];return xe===void 0&&(xe=v(m()),Se[J]=xe),xe}function v(V){const Q=[],de=[],pe=[];for(let J=0;J=0){const z=J[Se];let te=G[Se];if(te===void 0&&(Se==="instanceMatrix"&&V.instanceMatrix&&(te=V.instanceMatrix),Se==="instanceColor"&&V.instanceColor&&(te=V.instanceColor)),z===void 0||z.attribute!==te||te&&z.data!==te.data)return!0;j++}return c.attributesNum!==j||c.index!==pe}function A(V,Q,de,pe){const J={},G=Q.attributes;let j=0;const se=de.getAttributes();for(const Se in se)if(se[Se].location>=0){let z=G[Se];z===void 0&&(Se==="instanceMatrix"&&V.instanceMatrix&&(z=V.instanceMatrix),Se==="instanceColor"&&V.instanceColor&&(z=V.instanceColor));const te={};te.attribute=z,z&&z.data&&(te.data=z.data),J[Se]=te,j++}c.attributes=J,c.attributesNum=j,c.index=pe}function w(){const V=c.newAttributes;for(let Q=0,de=V.length;Q=0){let xe=J[se];if(xe===void 0&&(se==="instanceMatrix"&&V.instanceMatrix&&(xe=V.instanceMatrix),se==="instanceColor"&&V.instanceColor&&(xe=V.instanceColor)),xe!==void 0){const z=xe.normalized,te=xe.itemSize,Ee=e.get(xe);if(Ee===void 0)continue;const Oe=Ee.buffer,He=Ee.type,le=Ee.bytesPerElement,Me=He===a.INT||He===a.UNSIGNED_INT||xe.gpuType===Kp;if(xe.isInterleavedBufferAttribute){const Ae=xe.data,je=Ae.stride,rt=xe.offset;if(Ae.isInstancedInterleavedBuffer){for(let $e=0;$e0&&a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision>0)return"highp";U="mediump"}return U==="mediump"&&a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision>0&&a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=n.precision!==void 0?n.precision:"highp";const _=m(h);_!==h&&(gt("WebGLRenderer:",h,"not supported, using",_,"instead."),h=_);const S=n.logarithmicDepthBuffer===!0,v=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control");n.reversedDepthBuffer===!0&&v===!1&>("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const b=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),A=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=a.getParameter(a.MAX_TEXTURE_SIZE),y=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),x=a.getParameter(a.MAX_VERTEX_ATTRIBS),P=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),L=a.getParameter(a.MAX_VARYING_VECTORS),R=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),I=a.getParameter(a.MAX_SAMPLES),O=a.getParameter(a.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:c,getMaxPrecision:m,textureFormatReadable:d,textureTypeReadable:p,precision:h,logarithmicDepthBuffer:S,reversedDepthBuffer:v,maxTextures:b,maxVertexTextures:A,maxTextureSize:w,maxCubemapSize:y,maxAttributes:x,maxVertexUniforms:P,maxVaryings:L,maxFragmentUniforms:R,maxSamples:I,samples:O}}function aC(a){const e=this;let n=null,s=0,l=!1,c=!1;const d=new bs,p=new bt,m={value:null,needsUpdate:!1};this.uniform=m,this.numPlanes=0,this.numIntersection=0,this.init=function(S,v){const b=S.length!==0||v||s!==0||l;return l=v,s=S.length,b},this.beginShadows=function(){c=!0,_(null)},this.endShadows=function(){c=!1},this.setGlobalState=function(S,v){n=_(S,v,0)},this.setState=function(S,v,b){const A=S.clippingPlanes,w=S.clipIntersection,y=S.clipShadows,x=a.get(S);if(!l||A===null||A.length===0||c&&!y)c?_(null):h();else{const P=c?0:s,L=P*4;let R=x.clippingState||null;m.value=R,R=_(A,v,L,b);for(let I=0;I!==L;++I)R[I]=n[I];x.clippingState=R,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=P}};function h(){m.value!==n&&(m.value=n,m.needsUpdate=s>0),e.numPlanes=s,e.numIntersection=0}function _(S,v,b,A){const w=S!==null?S.length:0;let y=null;if(w!==0){if(y=m.value,A!==!0||y===null){const x=b+w*4,P=v.matrixWorldInverse;p.getNormalMatrix(P),(y===null||y.length0&&this._blur(m,0,0,n),this._applyPMREM(m),this._cleanup(m),m}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=sx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ax(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e